mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-31 17:23:31 -05:00
Merge VS Code 1.21 source code (#1067)
* Initial VS Code 1.21 file copy with patches * A few more merges * Post npm install * Fix batch of build breaks * Fix more build breaks * Fix more build errors * Fix more build breaks * Runtime fixes 1 * Get connection dialog working with some todos * Fix a few packaging issues * Copy several node_modules to package build to fix loader issues * Fix breaks from master * A few more fixes * Make tests pass * First pass of license header updates * Second pass of license header updates * Fix restore dialog issues * Remove add additional themes menu items * fix select box issues where the list doesn't show up * formatting * Fix editor dispose issue * Copy over node modules to correct location on all platforms
This commit is contained in:
@@ -25,6 +25,7 @@ import { applyEdit } from 'vs/base/common/jsonFormatter';
|
||||
import { massageFolderPathForWorkspace } from 'vs/platform/workspaces/node/workspaces';
|
||||
import { toWorkspaceFolders } from 'vs/platform/workspace/common/workspace';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
|
||||
export interface IStoredWorkspace {
|
||||
folders: IStoredWorkspaceFolder[];
|
||||
@@ -152,7 +153,7 @@ export class WorkspacesMainService implements IWorkspacesMainService {
|
||||
let storedWorkspace: IStoredWorkspaceFolder;
|
||||
|
||||
// File URI
|
||||
if (folderResource.scheme === 'file') {
|
||||
if (folderResource.scheme === Schemas.file) {
|
||||
storedWorkspace = { path: massageFolderPathForWorkspace(folderResource.fsPath, untitledWorkspaceConfigFolder, []) };
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ import { WORKSPACE_EXTENSION, IWorkspaceSavedEvent, IWorkspaceIdentifier, IRawFi
|
||||
import { ConsoleLogMainService } from 'vs/platform/log/common/log';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { getRandomTestPath } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { normalizeDriveLetter } from 'vs/base/common/labels';
|
||||
|
||||
suite('WorkspacesMainService', () => {
|
||||
const parentDir = getRandomTestPath(os.tmpdir(), 'vsctests', 'workspacesservice');
|
||||
@@ -48,7 +50,7 @@ suite('WorkspacesMainService', () => {
|
||||
}
|
||||
|
||||
const environmentService = new TestEnvironmentService(parseArgs(process.argv), process.execPath);
|
||||
const logService = new ConsoleLogMainService(environmentService);
|
||||
const logService = new ConsoleLogMainService();
|
||||
|
||||
let service: TestWorkspacesMainService;
|
||||
|
||||
@@ -67,6 +69,15 @@ suite('WorkspacesMainService', () => {
|
||||
extfs.del(workspacesHome, os.tmpdir(), done);
|
||||
});
|
||||
|
||||
function assertPathEquals(p1: string, p2): void {
|
||||
if (isWindows) {
|
||||
p1 = normalizeDriveLetter(p1);
|
||||
p2 = normalizeDriveLetter(p2);
|
||||
}
|
||||
|
||||
assert.equal(p1, p2);
|
||||
}
|
||||
|
||||
test('createWorkspace (folders)', done => {
|
||||
return createWorkspace([process.cwd(), os.tmpdir()]).then(workspace => {
|
||||
assert.ok(workspace);
|
||||
@@ -75,8 +86,8 @@ suite('WorkspacesMainService', () => {
|
||||
|
||||
const ws = JSON.parse(fs.readFileSync(workspace.configPath).toString()) as IStoredWorkspace;
|
||||
assert.equal(ws.folders.length, 2); //
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd());
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[1]).path, os.tmpdir());
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd());
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[1]).path, os.tmpdir());
|
||||
|
||||
assert.ok(!(<IRawFileWorkspaceFolder>ws.folders[0]).name);
|
||||
assert.ok(!(<IRawFileWorkspaceFolder>ws.folders[1]).name);
|
||||
@@ -93,8 +104,8 @@ suite('WorkspacesMainService', () => {
|
||||
|
||||
const ws = JSON.parse(fs.readFileSync(workspace.configPath).toString()) as IStoredWorkspace;
|
||||
assert.equal(ws.folders.length, 2); //
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd());
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[1]).path, os.tmpdir());
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd());
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[1]).path, os.tmpdir());
|
||||
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[0]).name, 'currentworkingdirectory');
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[1]).name, 'tempdir');
|
||||
@@ -127,8 +138,8 @@ suite('WorkspacesMainService', () => {
|
||||
|
||||
const ws = JSON.parse(fs.readFileSync(workspace.configPath).toString()) as IStoredWorkspace;
|
||||
assert.equal(ws.folders.length, 2);
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd());
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[1]).path, os.tmpdir());
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd());
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[1]).path, os.tmpdir());
|
||||
|
||||
assert.ok(!(<IRawFileWorkspaceFolder>ws.folders[0]).name);
|
||||
assert.ok(!(<IRawFileWorkspaceFolder>ws.folders[1]).name);
|
||||
@@ -142,8 +153,8 @@ suite('WorkspacesMainService', () => {
|
||||
|
||||
const ws = JSON.parse(fs.readFileSync(workspace.configPath).toString()) as IStoredWorkspace;
|
||||
assert.equal(ws.folders.length, 2);
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd());
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[1]).path, os.tmpdir());
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd());
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[1]).path, os.tmpdir());
|
||||
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[0]).name, 'currentworkingdirectory');
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[1]).name, 'tempdir');
|
||||
@@ -253,12 +264,12 @@ suite('WorkspacesMainService', () => {
|
||||
|
||||
const ws = JSON.parse(fs.readFileSync(savedWorkspace.configPath).toString()) as IStoredWorkspace;
|
||||
assert.equal(ws.folders.length, 3);
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd()); // absolute
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[1]).path, '.'); // relative
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[2]).path, path.relative(path.dirname(workspaceConfigPath), path.join(os.tmpdir(), 'somefolder'))); // relative
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd()); // absolute
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[1]).path, '.'); // relative
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[2]).path, path.relative(path.dirname(workspaceConfigPath), path.join(os.tmpdir(), 'somefolder'))); // relative
|
||||
|
||||
assert.equal(savedWorkspace, savedEvent.workspace);
|
||||
assert.equal(workspace.configPath, savedEvent.oldConfigPath);
|
||||
assertPathEquals(workspace.configPath, savedEvent.oldConfigPath);
|
||||
|
||||
assert.deepEqual(deletedEvent, workspace);
|
||||
|
||||
@@ -281,13 +292,13 @@ suite('WorkspacesMainService', () => {
|
||||
return service.saveWorkspace(savedWorkspace, newWorkspaceConfigPath).then(newSavedWorkspace => {
|
||||
assert.ok(newSavedWorkspace.id);
|
||||
assert.notEqual(newSavedWorkspace.id, workspace.id);
|
||||
assert.equal(newSavedWorkspace.configPath, newWorkspaceConfigPath);
|
||||
assertPathEquals(newSavedWorkspace.configPath, newWorkspaceConfigPath);
|
||||
|
||||
const ws = JSON.parse(fs.readFileSync(newSavedWorkspace.configPath).toString()) as IStoredWorkspace;
|
||||
assert.equal(ws.folders.length, 3);
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd()); // absolute path because outside of tmpdir
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[1]).path, '.'); // relative path because inside of tmpdir
|
||||
assert.equal((<IRawFileWorkspaceFolder>ws.folders[2]).path, path.relative(path.dirname(workspaceConfigPath), path.join(os.tmpdir(), 'somefolder'))); // relative
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd()); // absolute path because outside of tmpdir
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[1]).path, '.'); // relative path because inside of tmpdir
|
||||
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[2]).path, path.relative(path.dirname(workspaceConfigPath), path.join(os.tmpdir(), 'somefolder'))); // relative
|
||||
|
||||
extfs.delSync(workspaceConfigPath);
|
||||
extfs.delSync(newWorkspaceConfigPath);
|
||||
@@ -310,7 +321,7 @@ suite('WorkspacesMainService', () => {
|
||||
return service.saveWorkspace(savedWorkspace, newWorkspaceConfigPath).then(newSavedWorkspace => {
|
||||
assert.ok(newSavedWorkspace.id);
|
||||
assert.notEqual(newSavedWorkspace.id, workspace.id);
|
||||
assert.equal(newSavedWorkspace.configPath, newWorkspaceConfigPath);
|
||||
assertPathEquals(newSavedWorkspace.configPath, newWorkspaceConfigPath);
|
||||
|
||||
const savedContents = fs.readFileSync(newSavedWorkspace.configPath).toString();
|
||||
assert.equal(0, savedContents.indexOf('// this is a comment'));
|
||||
@@ -336,7 +347,7 @@ suite('WorkspacesMainService', () => {
|
||||
return service.saveWorkspace(savedWorkspace, newWorkspaceConfigPath).then(newSavedWorkspace => {
|
||||
assert.ok(newSavedWorkspace.id);
|
||||
assert.notEqual(newSavedWorkspace.id, workspace.id);
|
||||
assert.equal(newSavedWorkspace.configPath, newWorkspaceConfigPath);
|
||||
assertPathEquals(newSavedWorkspace.configPath, newWorkspaceConfigPath);
|
||||
|
||||
const ws = JSON.parse(fs.readFileSync(newSavedWorkspace.configPath).toString()) as IStoredWorkspace;
|
||||
assert.ok(ws.folders.every(f => (<IRawFileWorkspaceFolder>f).path.indexOf('\\') < 0));
|
||||
|
||||
Reference in New Issue
Block a user