mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-31 09:35:39 -05:00
Initial VS Code 1.19 source merge (#571)
* Initial 1.19 xcopy * Fix yarn build * Fix numerous build breaks * Next batch of build break fixes * More build break fixes * Runtime breaks * Additional post merge fixes * Fix windows setup file * Fix test failures. * Update license header blocks to refer to source eula
This commit is contained in:
@@ -92,7 +92,6 @@ export interface IWorkspacesMainService extends IWorkspacesService {
|
||||
|
||||
createWorkspaceSync(folders?: IWorkspaceFolderCreationData[]): IWorkspaceIdentifier;
|
||||
|
||||
resolveWorkspace(path: string): TPromise<IResolvedWorkspace>;
|
||||
resolveWorkspaceSync(path: string): IResolvedWorkspace;
|
||||
|
||||
isUntitledWorkspace(workspace: IWorkspaceIdentifier): boolean;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IWorkspacesService, IWorkspaceIdentifier, IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IWorkspacesService, IWorkspaceIdentifier, IWorkspaceFolderCreationData, IWorkspacesMainService } from 'vs/platform/workspaces/common/workspaces';
|
||||
import URI from 'vs/base/common/uri';
|
||||
|
||||
export interface IWorkspacesChannel extends IChannel {
|
||||
@@ -17,7 +17,7 @@ export interface IWorkspacesChannel extends IChannel {
|
||||
|
||||
export class WorkspacesChannel implements IWorkspacesChannel {
|
||||
|
||||
constructor(private service: IWorkspacesService) { }
|
||||
constructor(private service: IWorkspacesMainService) { }
|
||||
|
||||
public call(command: string, arg?: any): TPromise<any> {
|
||||
switch (command) {
|
||||
@@ -34,7 +34,7 @@ export class WorkspacesChannel implements IWorkspacesChannel {
|
||||
}
|
||||
|
||||
return this.service.createWorkspace(folders);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return void 0;
|
||||
|
||||
@@ -11,9 +11,9 @@ import { isParent } from 'vs/platform/files/common/files';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { extname, join, dirname, isAbsolute, resolve } from 'path';
|
||||
import { mkdirp, writeFile, readFile } from 'vs/base/node/pfs';
|
||||
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
|
||||
import { readFileSync, existsSync, mkdirSync } from 'fs';
|
||||
import { isLinux, isMacintosh } from 'vs/base/common/platform';
|
||||
import { delSync, readdirSync } from 'vs/base/node/extfs';
|
||||
import { delSync, readdirSync, writeFileAndFlushSync } from 'vs/base/node/extfs';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { isEqual } from 'vs/base/common/paths';
|
||||
@@ -57,14 +57,6 @@ export class WorkspacesMainService implements IWorkspacesMainService {
|
||||
return this._onUntitledWorkspaceDeleted.event;
|
||||
}
|
||||
|
||||
public resolveWorkspace(path: string): TPromise<IResolvedWorkspace> {
|
||||
if (!this.isWorkspacePath(path)) {
|
||||
return TPromise.as(null); // does not look like a valid workspace config file
|
||||
}
|
||||
|
||||
return readFile(path).then(contents => this.doResolveWorkspace(path, contents.toString()));
|
||||
}
|
||||
|
||||
public resolveWorkspaceSync(path: string): IResolvedWorkspace {
|
||||
if (!this.isWorkspacePath(path)) {
|
||||
return null; // does not look like a valid workspace config file
|
||||
@@ -94,7 +86,7 @@ export class WorkspacesMainService implements IWorkspacesMainService {
|
||||
folders: toWorkspaceFolders(workspace.folders, URI.file(dirname(path)))
|
||||
};
|
||||
} catch (error) {
|
||||
this.logService.log(error.toString());
|
||||
this.logService.warn(error.toString());
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -144,7 +136,7 @@ export class WorkspacesMainService implements IWorkspacesMainService {
|
||||
|
||||
mkdirSync(configParent);
|
||||
|
||||
writeFileSync(workspace.configPath, JSON.stringify(storedWorkspace, null, '\t'));
|
||||
writeFileAndFlushSync(workspace.configPath, JSON.stringify(storedWorkspace, null, '\t'));
|
||||
|
||||
return workspace;
|
||||
}
|
||||
@@ -270,7 +262,7 @@ export class WorkspacesMainService implements IWorkspacesMainService {
|
||||
try {
|
||||
delSync(dirname(configPath));
|
||||
} catch (error) {
|
||||
this.logService.log(`Unable to delete untitled workspace ${configPath} (${error}).`);
|
||||
this.logService.warn(`Unable to delete untitled workspace ${configPath} (${error}).`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +271,9 @@ export class WorkspacesMainService implements IWorkspacesMainService {
|
||||
try {
|
||||
untitledWorkspacePaths = readdirSync(this.workspacesHome).map(folder => join(this.workspacesHome, folder, UNTITLED_WORKSPACE_NAME));
|
||||
} catch (error) {
|
||||
this.logService.log(`Unable to read folders in ${this.workspacesHome} (${error}).`);
|
||||
if (error && error.code !== 'ENOENT') {
|
||||
this.logService.warn(`Unable to read folders in ${this.workspacesHome} (${error}).`);
|
||||
}
|
||||
}
|
||||
|
||||
const untitledWorkspaces: IWorkspaceIdentifier[] = coalesce(untitledWorkspacePaths.map(untitledWorkspacePath => {
|
||||
|
||||
@@ -15,7 +15,7 @@ import { EnvironmentService } from 'vs/platform/environment/node/environmentServ
|
||||
import { parseArgs } from 'vs/platform/environment/node/argv';
|
||||
import { WorkspacesMainService, IStoredWorkspace } from 'vs/platform/workspaces/electron-main/workspacesMainService';
|
||||
import { WORKSPACE_EXTENSION, IWorkspaceSavedEvent, IWorkspaceIdentifier, IRawFileWorkspaceFolder, IWorkspaceFolderCreationData, IRawUriWorkspaceFolder } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { LogMainService } from 'vs/platform/log/common/log';
|
||||
import { ConsoleLogMainService } from 'vs/platform/log/common/log';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { getRandomTestPath } from 'vs/workbench/test/workbenchTestServices';
|
||||
|
||||
@@ -48,7 +48,7 @@ suite('WorkspacesMainService', () => {
|
||||
}
|
||||
|
||||
const environmentService = new TestEnvironmentService(parseArgs(process.argv), process.execPath);
|
||||
const logService = new LogMainService(environmentService);
|
||||
const logService = new ConsoleLogMainService(environmentService);
|
||||
|
||||
let service: TestWorkspacesMainService;
|
||||
|
||||
@@ -186,32 +186,6 @@ suite('WorkspacesMainService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('resolveWorkspace', done => {
|
||||
return createWorkspace([process.cwd(), os.tmpdir()]).then(workspace => {
|
||||
return service.resolveWorkspace(workspace.configPath).then(ws => {
|
||||
assert.ok(ws);
|
||||
|
||||
// make it a valid workspace path
|
||||
const newPath = path.join(path.dirname(workspace.configPath), `workspace.${WORKSPACE_EXTENSION}`);
|
||||
fs.renameSync(workspace.configPath, newPath);
|
||||
workspace.configPath = newPath;
|
||||
|
||||
return service.resolveWorkspace(workspace.configPath).then(resolved => {
|
||||
assert.equal(2, resolved.folders.length);
|
||||
assert.equal(resolved.configPath, workspace.configPath);
|
||||
assert.ok(resolved.id);
|
||||
|
||||
fs.writeFileSync(workspace.configPath, JSON.stringify({ something: 'something' })); // invalid workspace
|
||||
return service.resolveWorkspace(workspace.configPath).then(resolvedInvalid => {
|
||||
assert.ok(!resolvedInvalid);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('resolveWorkspaceSync (support relative paths)', done => {
|
||||
return createWorkspace([process.cwd(), os.tmpdir()]).then(workspace => {
|
||||
fs.writeFileSync(workspace.configPath, JSON.stringify({ folders: [{ path: './ticino-playground/lib' }] }));
|
||||
|
||||
Reference in New Issue
Block a user