Merge branch 'master' into ben/1_42

This commit is contained in:
Benjamin Pasero 2019-12-07 07:15:16 +01:00
commit ed2d6c4311
10 changed files with 30 additions and 106 deletions

View file

@ -9,7 +9,7 @@
},
"main": "./out/cssServerMain",
"dependencies": {
"vscode-css-languageservice": "^4.0.3-next.23",
"vscode-css-languageservice": "^4.0.3-next.24",
"vscode-languageserver": "^6.0.0-next.3"
},
"devDependencies": {

View file

@ -781,10 +781,10 @@ supports-color@^5.3.0:
dependencies:
has-flag "^3.0.0"
vscode-css-languageservice@^4.0.3-next.23:
version "4.0.3-next.23"
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.23.tgz#b7a835c317a6f0b96ec104e3ce168770f5f0d4ff"
integrity sha512-DmMXBzTd3uYnVMffNlcp+Sy4qdzeE+UG5yivo/5Y1f/Qr//4FyssH0eCZ7K9Vf/9DMKYf9J3HeCNZSTq4EzMrg==
vscode-css-languageservice@^4.0.3-next.24:
version "4.0.3-next.24"
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.24.tgz#6190fb5af4621b7efc1a0772c1a178d996ffb42d"
integrity sha512-7CPBmaQnvkgL7MXZK9vt5R5CwFaQ9TCqWt9aCi9dGm1g0uAgFOwk8+K5+fV2pasI+aoOvb/kLcFjxSSRD03KdA==
dependencies:
vscode-languageserver-textdocument "^1.0.0-next.4"
vscode-languageserver-types "^3.15.0-next.6"

View file

@ -9,7 +9,7 @@
},
"main": "./out/htmlServerMain",
"dependencies": {
"vscode-css-languageservice": "^4.0.3-next.23",
"vscode-css-languageservice": "^4.0.3-next.24",
"vscode-html-languageservice": "^3.0.4-next.11",
"vscode-languageserver": "^6.0.0-next.3",
"vscode-nls": "^4.1.1",

View file

@ -611,10 +611,10 @@ supports-color@^5.3.0:
dependencies:
has-flag "^3.0.0"
vscode-css-languageservice@^4.0.3-next.23:
version "4.0.3-next.23"
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.23.tgz#b7a835c317a6f0b96ec104e3ce168770f5f0d4ff"
integrity sha512-DmMXBzTd3uYnVMffNlcp+Sy4qdzeE+UG5yivo/5Y1f/Qr//4FyssH0eCZ7K9Vf/9DMKYf9J3HeCNZSTq4EzMrg==
vscode-css-languageservice@^4.0.3-next.24:
version "4.0.3-next.24"
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.24.tgz#6190fb5af4621b7efc1a0772c1a178d996ffb42d"
integrity sha512-7CPBmaQnvkgL7MXZK9vt5R5CwFaQ9TCqWt9aCi9dGm1g0uAgFOwk8+K5+fV2pasI+aoOvb/kLcFjxSSRD03KdA==
dependencies:
vscode-languageserver-textdocument "^1.0.0-next.4"
vscode-languageserver-types "^3.15.0-next.6"

View file

@ -13,7 +13,7 @@ suite('workspace-namespace', () => {
teardown(closeAllEditors);
test('rootPath', () => {
assert.ok(pathEquals(vscode.workspace.rootPath!, join(__dirname, '../../testWorkspace')));
assert.equal(vscode.workspace.rootPath, undefined);
});
test('workspaceFile', () => {

View file

@ -1,6 +1,6 @@
{
"name": "code-oss-dev",
"version": "1.41.0",
"version": "1.42.0",
"distro": "17f1b806c349d58f96b4aef97ae59d836e2c5605",
"author": {
"name": "Microsoft Corporation"

View file

@ -339,6 +339,11 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
if (folders.length === 0) {
return undefined;
}
if (folders.length > 1) {
return undefined;
}
// #54483 @Joh Why are we still using fsPath?
return folders[0].uri.fsPath;
}

View file

@ -156,15 +156,17 @@ export class CustomFileEditorInput extends LazilyResolvedWebviewEditorInput {
});
}
public handleMove(_groupId: GroupIdentifier, uri: URI, options?: ITextEditorOptions): IEditorInput | undefined {
public handleMove(groupId: GroupIdentifier, uri: URI, options?: ITextEditorOptions): IEditorInput | undefined {
const editorInfo = this.customEditorService.getCustomEditor(this.viewType);
if (editorInfo?.matches(uri)) {
const webview = assertIsDefined(this.takeOwnershipOfWebview());
return this.instantiationService.createInstance(CustomFileEditorInput,
const newInput = this.instantiationService.createInstance(CustomFileEditorInput,
uri,
this.viewType,
generateUuid(),
new Lazy(() => webview));
newInput.updateGroup(groupId);
return newInput;
}
return undefined;
}

View file

@ -3,23 +3,17 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IDisposable, dispose, Disposable, toDisposable } from 'vs/base/common/lifecycle';
import { IWorkbenchContributionsRegistry, IWorkbenchContribution, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { Disposable } from 'vs/base/common/lifecycle';
import { isMacintosh, isNative } from 'vs/base/common/platform';
import { localize } from 'vs/nls';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { IProductService } from 'vs/platform/product/common/productService';
import { Registry } from 'vs/platform/registry/common/platform';
import { IWindowsConfiguration } from 'vs/platform/windows/common/windows';
import { Extensions as WorkbenchExtensions, IWorkbenchContribution, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { localize } from 'vs/nls';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { RunOnceScheduler } from 'vs/base/common/async';
import { URI } from 'vs/base/common/uri';
import { isEqual } from 'vs/base/common/resources';
import { isMacintosh, isNative } from 'vs/base/common/platform';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IProductService } from 'vs/platform/product/common/productService';
interface IConfiguration extends IWindowsConfiguration {
update: { mode: string; };
@ -132,82 +126,5 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
}
}
export class WorkspaceChangeExtHostRelauncher extends Disposable implements IWorkbenchContribution {
private firstFolderResource?: URI;
private extensionHostRestarter: RunOnceScheduler;
private onDidChangeWorkspaceFoldersUnbind: IDisposable | undefined;
constructor(
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IExtensionService extensionService: IExtensionService,
@IHostService hostService: IHostService,
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService
) {
super();
this.extensionHostRestarter = this._register(new RunOnceScheduler(() => {
if (!!environmentService.extensionTestsLocationURI) {
return; // no restart when in tests: see https://github.com/Microsoft/vscode/issues/66936
}
if (environmentService.configuration.remoteAuthority) {
hostService.reload(); // TODO@aeschli, workaround
} else if (isNative) {
extensionService.restartExtensionHost();
}
}, 10));
this.contextService.getCompleteWorkspace()
.then(workspace => {
this.firstFolderResource = workspace.folders.length > 0 ? workspace.folders[0].uri : undefined;
this.handleWorkbenchState();
this._register(this.contextService.onDidChangeWorkbenchState(() => setTimeout(() => this.handleWorkbenchState())));
});
this._register(toDisposable(() => {
if (this.onDidChangeWorkspaceFoldersUnbind) {
this.onDidChangeWorkspaceFoldersUnbind.dispose();
}
}));
}
private handleWorkbenchState(): void {
// React to folder changes when we are in workspace state
if (this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE) {
// Update our known first folder path if we entered workspace
const workspace = this.contextService.getWorkspace();
this.firstFolderResource = workspace.folders.length > 0 ? workspace.folders[0].uri : undefined;
// Install workspace folder listener
if (!this.onDidChangeWorkspaceFoldersUnbind) {
this.onDidChangeWorkspaceFoldersUnbind = this.contextService.onDidChangeWorkspaceFolders(() => this.onDidChangeWorkspaceFolders());
}
}
// Ignore the workspace folder changes in EMPTY or FOLDER state
else {
dispose(this.onDidChangeWorkspaceFoldersUnbind);
this.onDidChangeWorkspaceFoldersUnbind = undefined;
}
}
private onDidChangeWorkspaceFolders(): void {
const workspace = this.contextService.getWorkspace();
// Restart extension host if first root folder changed (impact on deprecated workspace.rootPath API)
const newFirstFolderResource = workspace.folders.length > 0 ? workspace.folders[0].uri : undefined;
if (!isEqual(this.firstFolderResource, newFirstFolderResource)) {
this.firstFolderResource = newFirstFolderResource;
this.extensionHostRestarter.schedule(); // buffer calls to extension host restart
}
}
}
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
workbenchRegistry.registerWorkbenchContribution(SettingsChangeRelauncher, LifecyclePhase.Restored);
workbenchRegistry.registerWorkbenchContribution(WorkspaceChangeExtHostRelauncher, LifecyclePhase.Restored);

View file

@ -120,7 +120,7 @@ suite('ExtHostWorkspace', function () {
assert.equal(ws.getPath(), undefined);
ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.file('Folder'), 0), aWorkspaceFolderData(URI.file('Another/Folder'), 1)] }, new NullLogService());
assert.equal(ws.getPath()!.replace(/\\/g, '/'), '/Folder');
assert.equal(ws.getPath(), undefined);
ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.file('/Folder'), 0)] }, new NullLogService());
assert.equal(ws.getPath()!.replace(/\\/g, '/'), '/Folder');