From d7ed37e864c6a21b7012b96598d84b4576d7f0ac Mon Sep 17 00:00:00 2001 From: Fmstrat Date: Thu, 16 Jan 2020 09:39:19 -0500 Subject: [PATCH 0001/1667] add ignoreSubmodules option --- extensions/git/package.json | 6 ++++++ extensions/git/package.nls.json | 1 + extensions/git/src/git.ts | 10 ++++++++-- extensions/git/src/repository.ts | 3 +++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/extensions/git/package.json b/extensions/git/package.json index 3e049ddd7e5..75aa3083546 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -1512,6 +1512,12 @@ "default": false, "description": "%config.alwaysSignOff%" }, + "git.ignoreSubmodules": { + "type": "boolean", + "scope": "resource", + "default": false, + "description": "%config.ignoreSubmodules%" + }, "git.ignoredRepositories": { "type": "array", "items": { diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 5c357b40eb0..a892d87d512 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -121,6 +121,7 @@ "config.detectSubmodulesLimit": "Controls the limit of git submodules detected.", "config.alwaysShowStagedChangesResourceGroup": "Always show the Staged Changes resource group.", "config.alwaysSignOff": "Controls the signoff flag for all commits.", + "config.ignoreSubmodules": "Ignore modifications to submodules in the file tree.", "config.ignoredRepositories": "List of git repositories to ignore.", "config.scanRepositories": "List of paths to search for git repositories in.", "config.showProgress": "Controls whether git actions should show progress.", diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index af92f83c1a6..322765dba4c 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -12,7 +12,7 @@ import { EventEmitter } from 'events'; import iconv = require('iconv-lite'); import * as filetype from 'file-type'; import { assign, groupBy, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent, splitInChunks, Limiter } from './util'; -import { CancellationToken, Progress } from 'vscode'; +import { CancellationToken, Progress, workspace } from 'vscode'; import { URI } from 'vscode-uri'; import { detectEncoding } from './encoding'; import { Ref, RefType, Branch, Remote, GitErrorCodes, LogOptions, Change, Status } from './api/git'; @@ -1619,7 +1619,13 @@ export class Repository { return new Promise<{ status: IFileStatus[]; didHitLimit: boolean; }>((c, e) => { const parser = new GitStatusParser(); const env = { GIT_OPTIONAL_LOCKS: '0' }; - const child = this.stream(['status', '-z', '-u'], { env }); + + const config = workspace.getConfiguration('git'); + const args = ['status', '-z', '-u']; + if (config.get('ignoreSubmodules')) { + args.push('--ignore-submodules'); + } + const child = this.stream(args, { env }); const onExit = (exitCode: number) => { if (exitCode !== 0) { diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index 47832f9e0f0..361a35a64b9 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -731,6 +731,9 @@ export class Repository implements Disposable { const onConfigListenerForUntracked = filterEvent(workspace.onDidChangeConfiguration, e => e.affectsConfiguration('git.untrackedChanges', root)); onConfigListenerForUntracked(this.updateModelState, this, this.disposables); + const onConfigListenerForIgnoreSubmodules = filterEvent(workspace.onDidChangeConfiguration, e => e.affectsConfiguration('git.ignoreSubmodules', root)); + onConfigListenerForIgnoreSubmodules(this.updateModelState, this, this.disposables); + this.mergeGroup.hideWhenEmpty = true; this.untrackedGroup.hideWhenEmpty = true; From 2abdb90472470865d7e28cfbdbcd60b9ecf3d64a Mon Sep 17 00:00:00 2001 From: Oliver Larsson Date: Fri, 24 Jan 2020 21:20:44 +0100 Subject: [PATCH 0002/1667] git.pruneOnFetch setting implemented --- extensions/git/package.json | 6 ++++++ extensions/git/package.nls.json | 1 + extensions/git/src/repository.ts | 21 +++++++++++++++++---- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/extensions/git/package.json b/extensions/git/package.json index 2ba6515e963..ace8e1bd984 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -1548,6 +1548,12 @@ "default": false, "description": "%config.fetchOnPull%" }, + "git.pruneOnFetch": { + "type": "boolean", + "scope": "resource", + "default": false, + "description": "%config.pruneOnFetch%" + }, "git.pullTags": { "type": "boolean", "scope": "resource", diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 5c357b40eb0..0b269e889dc 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -128,6 +128,7 @@ "config.confirmEmptyCommits": "Always confirm the creation of empty commits for the 'Git: Commit Empty' command.", "config.fetchOnPull": "Fetch all branches when pulling or just the current one.", "config.pullTags": "Fetch all tags when pulling.", + "config.pruneOnFetch": "Always prune when fetching.", "config.autoStash": "Stash any changes before pulling and restore them after successful pull.", "config.allowForcePush": "Controls whether force push (with or without lease) is enabled.", "config.useForcePushWithLease": "Controls whether force pushing uses the safer force-with-lease variant.", diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index 47832f9e0f0..79f90cfdaeb 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -1072,21 +1072,34 @@ export class Repository implements Disposable { @throttle async fetchDefault(options: { silent?: boolean } = {}): Promise { - await this.run(Operation.Fetch, () => this.repository.fetch(options)); + await this.fetchFrom({ silent: options.silent }); } @throttle async fetchPrune(): Promise { - await this.run(Operation.Fetch, () => this.repository.fetch({ prune: true })); + await this.fetchFrom({ prune: true }); } @throttle async fetchAll(): Promise { - await this.run(Operation.Fetch, () => this.repository.fetch({ all: true })); + await this.fetchFrom({ all: true }); } async fetch(remote?: string, ref?: string, depth?: number): Promise { - await this.run(Operation.Fetch, () => this.repository.fetch({ remote, ref, depth })); + await this.fetchFrom({ remote, ref, depth }); + } + + private async fetchFrom(options: { remote?: string, ref?: string, all?: boolean, prune?: boolean, depth?: number, silent?: boolean } = {}): Promise { + await this.run(Operation.Fetch, async () => { + const config = workspace.getConfiguration('git', Uri.file(this.root)); + const prune = config.get('pruneOnFetch'); + + if (prune) { + options.prune = prune; + } + + this.repository.fetch(options); + }); } @throttle From 712ceb8279a0da8652bae92d497e48a887c98684 Mon Sep 17 00:00:00 2001 From: jeanp413 Date: Sat, 25 Jan 2020 23:59:15 -0500 Subject: [PATCH 0003/1667] Fixes #89145 --- .../ui/tree/compressedObjectTreeModel.ts | 6 +- .../contrib/scm/browser/repositoryPane.ts | 88 +++++++++++++------ 2 files changed, 65 insertions(+), 29 deletions(-) diff --git a/src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts b/src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts index f1da4355047..54cb4e1de00 100644 --- a/src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts +++ b/src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts @@ -49,11 +49,11 @@ export function compress(element: ICompressedTreeElement): ITreeElement = children[0]; + if (childElement.incompressible) { break; } + element = childElement; elements.push(element.element); } diff --git a/src/vs/workbench/contrib/scm/browser/repositoryPane.ts b/src/vs/workbench/contrib/scm/browser/repositoryPane.ts index 81f88f32cd7..075102cb8dd 100644 --- a/src/vs/workbench/contrib/scm/browser/repositoryPane.ts +++ b/src/vs/workbench/contrib/scm/browser/repositoryPane.ts @@ -367,20 +367,24 @@ export class SCMTreeKeyboardNavigationLabelProvider implements ICompressibleKeyb } } +function getSCMResourceId(element: TreeElement): string { + if (ResourceTree.isResourceNode(element)) { + const group = element.context; + return `${group.provider.contextValue}/${group.id}/$FOLDER/${element.uri.toString()}`; + } else if (isSCMResource(element)) { + const group = element.resourceGroup; + const provider = group.provider; + return `${provider.contextValue}/${group.id}/${element.sourceUri.toString()}`; + } else { + const provider = element.provider; + return `${provider.contextValue}/${element.id}`; + } +} + class SCMResourceIdentityProvider implements IIdentityProvider { getId(element: TreeElement): string { - if (ResourceTree.isResourceNode(element)) { - const group = element.context; - return `${group.provider.contextValue}/${group.id}/$FOLDER/${element.uri.toString()}`; - } else if (isSCMResource(element)) { - const group = element.resourceGroup; - const provider = group.provider; - return `${provider.contextValue}/${group.id}/${element.sourceUri.toString()}`; - } else { - const provider = element.provider; - return `${provider.contextValue}/${element.id}`; - } + return getSCMResourceId(element); } } @@ -391,19 +395,31 @@ interface IGroupItem { readonly disposable: IDisposable; } -function groupItemAsTreeElement(item: IGroupItem, mode: ViewModelMode): ICompressedTreeElement { - const children = mode === ViewModelMode.List - ? Iterator.map(Iterator.fromArray(item.resources), element => ({ element, incompressible: true })) - : Iterator.map(item.tree.root.children, node => asTreeElement(node, true)); - - return { element: item.group, children, incompressible: true, collapsible: true }; +interface IViewState { + readonly expanded: Set; } -function asTreeElement(node: IResourceNode, forceIncompressible: boolean): ICompressedTreeElement { +function groupItemAsTreeElement(item: IGroupItem, mode: ViewModelMode, viewState?: IViewState): ICompressedTreeElement { + const children = mode === ViewModelMode.List + ? Iterator.map(Iterator.fromArray(item.resources), element => ({ element, incompressible: true })) + : Iterator.map(item.tree.root.children, node => asTreeElement(node, true, viewState)); + + const element = item.group; + const collapsed = viewState ? !viewState.expanded.has(getSCMResourceId(element)) : false; + + return { element, children, incompressible: true, collapsed, collapsible: true }; +} + +function asTreeElement(node: IResourceNode, forceIncompressible: boolean, viewState?: IViewState): ICompressedTreeElement { + const element = (node.childrenCount === 0 && node.element) ? node.element : node; + const collapsed = viewState ? !viewState.expanded.has(getSCMResourceId(element)) : false; + return { - element: (node.childrenCount === 0 && node.element) ? node.element : node, - children: Iterator.map(node.children, node => asTreeElement(node, false)), - incompressible: !!node.element || forceIncompressible + element, + children: Iterator.map(node.children, node => asTreeElement(node, false, viewState)), + incompressible: !!node.element || forceIncompressible, + collapsed, + collapsible: node.childrenCount > 0 }; } @@ -439,6 +455,7 @@ class ViewModel { private visibilityDisposables = new DisposableStore(); private scrollTop: number | undefined; private firstVisible = true; + private viewState: IViewState | undefined; private disposables = new DisposableStore(); constructor( @@ -449,7 +466,7 @@ class ViewModel { @IConfigurationService protected configurationService: IConfigurationService, ) { } - private onDidSpliceGroups({ start, deleteCount, toInsert }: ISplice): void { + private onDidSpliceGroups({ start, deleteCount, toInsert }: ISplice, viewState?: IViewState): void { const itemsToInsert: IGroupItem[] = []; for (const group of toInsert) { @@ -477,7 +494,7 @@ class ViewModel { item.disposable.dispose(); } - this.refresh(); + this.refresh(undefined, viewState); } private onDidSpliceGroup(item: IGroupItem, { start, deleteCount, toInsert }: ISplice): void { @@ -500,7 +517,8 @@ class ViewModel { if (visible) { this.visibilityDisposables = new DisposableStore(); this.groups.onDidSplice(this.onDidSpliceGroups, this, this.visibilityDisposables); - this.onDidSpliceGroups({ start: 0, deleteCount: this.items.length, toInsert: this.groups.elements }); + this.onDidSpliceGroups({ start: 0, deleteCount: this.items.length, toInsert: this.groups.elements }, this.viewState); + this.viewState = undefined; if (typeof this.scrollTop === 'number') { this.tree.scrollTop = this.scrollTop; @@ -510,20 +528,38 @@ class ViewModel { this.editorService.onDidActiveEditorChange(this.onDidActiveEditorChange, this, this.visibilityDisposables); this.onDidActiveEditorChange(); } else { + this.updateViewState(); this.visibilityDisposables.dispose(); this.onDidSpliceGroups({ start: 0, deleteCount: this.items.length, toInsert: [] }); this.scrollTop = this.tree.scrollTop; } } - private refresh(item?: IGroupItem): void { + private refresh(item?: IGroupItem, viewState?: IViewState): void { if (item) { this.tree.setChildren(item.group, groupItemAsTreeElement(item, this.mode).children); } else { - this.tree.setChildren(null, this.items.map(item => groupItemAsTreeElement(item, this.mode))); + this.tree.setChildren(null, this.items.map(item => groupItemAsTreeElement(item, this.mode, viewState))); } } + private updateViewState(): void { + const expanded = new Set(); + const visit = (node: ITreeNode) => { + if (node.element && node.collapsible && !node.collapsed) { + expanded.add(getSCMResourceId(node.element)); + } + + for (const child of node.children) { + visit(child); + } + }; + + visit(this.tree.getNode()); + + this.viewState = { expanded }; + } + private onDidActiveEditorChange(): void { if (!this.configurationService.getValue('scm.autoReveal')) { return; From cdc6c051e5e710e1851effaf1b9ff3f685baea11 Mon Sep 17 00:00:00 2001 From: jeanp413 Date: Mon, 27 Jan 2020 03:36:01 -0500 Subject: [PATCH 0004/1667] Persist scm tree view state between sessions --- .../contrib/scm/browser/repositoryPane.ts | 74 +++++++++++-------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/src/vs/workbench/contrib/scm/browser/repositoryPane.ts b/src/vs/workbench/contrib/scm/browser/repositoryPane.ts index 075102cb8dd..a91fc19e5a4 100644 --- a/src/vs/workbench/contrib/scm/browser/repositoryPane.ts +++ b/src/vs/workbench/contrib/scm/browser/repositoryPane.ts @@ -395,24 +395,24 @@ interface IGroupItem { readonly disposable: IDisposable; } -interface IViewState { - readonly expanded: Set; +interface ITreeViewState { + readonly expanded: string[]; } -function groupItemAsTreeElement(item: IGroupItem, mode: ViewModelMode, viewState?: IViewState): ICompressedTreeElement { +function groupItemAsTreeElement(item: IGroupItem, mode: ViewModelMode, viewState?: ITreeViewState): ICompressedTreeElement { const children = mode === ViewModelMode.List ? Iterator.map(Iterator.fromArray(item.resources), element => ({ element, incompressible: true })) : Iterator.map(item.tree.root.children, node => asTreeElement(node, true, viewState)); const element = item.group; - const collapsed = viewState ? !viewState.expanded.has(getSCMResourceId(element)) : false; + const collapsed = viewState ? viewState.expanded.indexOf(getSCMResourceId(element)) === -1 : false; return { element, children, incompressible: true, collapsed, collapsible: true }; } -function asTreeElement(node: IResourceNode, forceIncompressible: boolean, viewState?: IViewState): ICompressedTreeElement { +function asTreeElement(node: IResourceNode, forceIncompressible: boolean, viewState?: ITreeViewState): ICompressedTreeElement { const element = (node.childrenCount === 0 && node.element) ? node.element : node; - const collapsed = viewState ? !viewState.expanded.has(getSCMResourceId(element)) : false; + const collapsed = viewState ? viewState.expanded.indexOf(getSCMResourceId(element)) === -1 : false; return { element, @@ -451,22 +451,27 @@ class ViewModel { this._onDidChangeMode.fire(mode); } + get treeViewState(): ITreeViewState | undefined { + this.updateViewState(); + return this._treeViewState; + } + private items: IGroupItem[] = []; private visibilityDisposables = new DisposableStore(); private scrollTop: number | undefined; private firstVisible = true; - private viewState: IViewState | undefined; private disposables = new DisposableStore(); constructor( private groups: ISequence, private tree: WorkbenchCompressibleObjectTree, private _mode: ViewModelMode, + private _treeViewState: ITreeViewState | undefined, @IEditorService protected editorService: IEditorService, - @IConfigurationService protected configurationService: IConfigurationService, + @IConfigurationService protected configurationService: IConfigurationService ) { } - private onDidSpliceGroups({ start, deleteCount, toInsert }: ISplice, viewState?: IViewState): void { + private onDidSpliceGroups({ start, deleteCount, toInsert }: ISplice): void { const itemsToInsert: IGroupItem[] = []; for (const group of toInsert) { @@ -494,7 +499,7 @@ class ViewModel { item.disposable.dispose(); } - this.refresh(undefined, viewState); + this.refresh(undefined, toInsert.length > 0 ? this._treeViewState : undefined); } private onDidSpliceGroup(item: IGroupItem, { start, deleteCount, toInsert }: ISplice): void { @@ -517,8 +522,7 @@ class ViewModel { if (visible) { this.visibilityDisposables = new DisposableStore(); this.groups.onDidSplice(this.onDidSpliceGroups, this, this.visibilityDisposables); - this.onDidSpliceGroups({ start: 0, deleteCount: this.items.length, toInsert: this.groups.elements }, this.viewState); - this.viewState = undefined; + this.onDidSpliceGroups({ start: 0, deleteCount: this.items.length, toInsert: this.groups.elements }); if (typeof this.scrollTop === 'number') { this.tree.scrollTop = this.scrollTop; @@ -535,19 +539,19 @@ class ViewModel { } } - private refresh(item?: IGroupItem, viewState?: IViewState): void { + private refresh(item?: IGroupItem, treeViewState?: ITreeViewState): void { if (item) { this.tree.setChildren(item.group, groupItemAsTreeElement(item, this.mode).children); } else { - this.tree.setChildren(null, this.items.map(item => groupItemAsTreeElement(item, this.mode, viewState))); + this.tree.setChildren(null, this.items.map(item => groupItemAsTreeElement(item, this.mode, treeViewState))); } } private updateViewState(): void { - const expanded = new Set(); + const expanded: string[] = []; const visit = (node: ITreeNode) => { if (node.element && node.collapsible && !node.collapsed) { - expanded.add(getSCMResourceId(node.element)); + expanded.push(getSCMResourceId(node.element)); } for (const child of node.children) { @@ -557,7 +561,7 @@ class ViewModel { visit(this.tree.getNode()); - this.viewState = { expanded }; + this._treeViewState = { expanded }; } private onDidActiveEditorChange(): void { @@ -883,18 +887,27 @@ export class RepositoryPane extends ViewPane { this._register(this.tree); let mode = this.configurationService.getValue<'tree' | 'list'>('scm.defaultViewMode') === 'list' ? ViewModelMode.List : ViewModelMode.Tree; + let treeViewState: ITreeViewState | undefined; const rootUri = this.repository.provider.rootUri; if (typeof rootUri !== 'undefined') { - const storageMode = this.storageService.get(`scm.repository.viewMode:${rootUri.toString()}`, StorageScope.WORKSPACE) as ViewModelMode; + const raw = this.storageService.get(`scm.repository.viewState:${rootUri.toString()}`, StorageScope.WORKSPACE); + if (raw) { + let data: any; + try { + data = JSON.parse(raw); + } catch (e) { + } - if (typeof storageMode === 'string') { - mode = storageMode; + if (typeof data.mode === 'string') { + mode = data.mode; + } + treeViewState = data.treeViewState; } } - this.viewModel = this.instantiationService.createInstance(ViewModel, this.repository.provider.groups, this.tree, mode); + this.viewModel = this.instantiationService.createInstance(ViewModel, this.repository.provider.groups, this.tree, mode, treeViewState); this._register(this.viewModel); addClass(this.listContainer, 'file-icon-themable-tree'); @@ -910,6 +923,17 @@ export class RepositoryPane extends ViewPane { this._register(this.onDidChangeBodyVisibility(this._onDidChangeVisibility, this)); this.updateActions(); + + this._register(this.storageService.onWillSaveState(() => { + if (typeof rootUri === 'undefined') { + return; + } + + this.storageService.store(`scm.repository.viewState:${rootUri.toString()}`, JSON.stringify({ + mode: this.viewModel.mode, + treeViewState: this.viewModel.treeViewState + }), StorageScope.WORKSPACE); + })); } private updateIndentStyles(theme: IFileIconTheme): void { @@ -921,14 +945,6 @@ export class RepositoryPane extends ViewPane { private onDidChangeMode(): void { this.updateIndentStyles(this.themeService.getFileIconTheme()); - - const rootUri = this.repository.provider.rootUri; - - if (typeof rootUri === 'undefined') { - return; - } - - this.storageService.store(`scm.repository.viewMode:${rootUri.toString()}`, this.viewModel.mode, StorageScope.WORKSPACE); } layoutBody(height: number | undefined = this.cachedHeight, width: number | undefined = this.cachedWidth): void { From f23fcb72f5595ea0192d5a2c5f4eff7d0a47410c Mon Sep 17 00:00:00 2001 From: Mathias Rasmussen Date: Sun, 1 Mar 2020 05:14:00 +0100 Subject: [PATCH 0005/1667] allow git amend message only --- extensions/git/src/commands.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index a27fa783fc0..477021ce2c5 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -1408,6 +1408,8 @@ export class CommandCenter { // no staged changes and no tracked unstaged changes || (noStagedChanges && smartCommitChanges === 'tracked' && repository.workingTreeGroup.resourceStates.every(r => r.type === Status.UNTRACKED)) ) + // amend allows changing only the commit message + && !opts.amend && !opts.empty ) { window.showInformationMessage(localize('no changes', "There are no changes to commit.")); From 37bca69ff169e7dedcd7d4a5bda81876fc880c12 Mon Sep 17 00:00:00 2001 From: jeanp413 Date: Sun, 1 Mar 2020 22:09:20 -0500 Subject: [PATCH 0006/1667] :lipstick: --- src/vs/workbench/contrib/scm/browser/repositoryPane.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/scm/browser/repositoryPane.ts b/src/vs/workbench/contrib/scm/browser/repositoryPane.ts index 2acefed09cc..0206d0fa72c 100644 --- a/src/vs/workbench/contrib/scm/browser/repositoryPane.ts +++ b/src/vs/workbench/contrib/scm/browser/repositoryPane.ts @@ -457,7 +457,7 @@ class ViewModel { } } - this.refresh(); + this.refresh(undefined, this._treeViewState); this._onDidChangeMode.fire(mode); } @@ -479,7 +479,9 @@ class ViewModel { private _treeViewState: ITreeViewState | undefined, @IEditorService protected editorService: IEditorService, @IConfigurationService protected configurationService: IConfigurationService - ) { } + ) { + this.disposables.add(this.tree.onDidChangeCollapseState(() => this.updateViewState())); + } private onDidSpliceGroups({ start, deleteCount, toInsert }: ISplice): void { const itemsToInsert: IGroupItem[] = []; @@ -509,7 +511,7 @@ class ViewModel { item.disposable.dispose(); } - this.refresh(undefined, toInsert.length > 0 ? this._treeViewState : undefined); + this.refresh(undefined, this._treeViewState); } private onDidSpliceGroup(item: IGroupItem, { start, deleteCount, toInsert }: ISplice): void { @@ -551,7 +553,7 @@ class ViewModel { private refresh(item?: IGroupItem, treeViewState?: ITreeViewState): void { if (item) { - this.tree.setChildren(item.group, groupItemAsTreeElement(item, this.mode).children); + this.tree.setChildren(item.group, groupItemAsTreeElement(item, this.mode, treeViewState).children); } else { this.tree.setChildren(null, this.items.map(item => groupItemAsTreeElement(item, this.mode, treeViewState))); } From bc85a9ffdb3c1644cfd11a610ce846c6ad22cb06 Mon Sep 17 00:00:00 2001 From: Jacob Date: Thu, 2 Apr 2020 17:34:07 +0200 Subject: [PATCH 0007/1667] Added user choice for opening the folder always. --- extensions/git/src/commands.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 451ff28afca..68299863db7 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -514,7 +514,8 @@ export class CommandCenter { let message = localize('proposeopen', "Would you like to open the cloned repository?"); const open = localize('openrepo', "Open"); const openNewWindow = localize('openreponew', "Open in New Window"); - const choices = [open, openNewWindow]; + const openAlways = localize('openrepoalways', "Always open after cloning"); + const choices = [open, openNewWindow, openAlways]; const addToWorkspace = localize('add', "Add to Workspace"); if (workspace.workspaceFolders) { @@ -541,6 +542,9 @@ export class CommandCenter { workspace.updateWorkspaceFolders(workspace.workspaceFolders!.length, 0, { uri }); } else if (result === openNewWindow) { commands.executeCommand('vscode.openFolder', uri, true); + } else if (result === openAlways) { + commands.executeCommand('vscode.openFolder', uri); + // will add a command for always option later } } catch (err) { if (/already exists and is not an empty directory/.test(err && err.stderr || '')) { From 412a44e9bce95688dc9bb87c561cc3321217b6b1 Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Fri, 3 Apr 2020 12:51:59 +0300 Subject: [PATCH 0008/1667] Git: ask to save unsaved files before stashing --- extensions/git/src/commands.ts | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 451ff28afca..c4a591c1e85 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -2242,6 +2242,44 @@ export class CommandCenter { return; } + const config = workspace.getConfiguration('git', Uri.file(repository.root)); + let promptToSaveFilesBeforeCommit = config.get<'always' | 'staged' | 'never'>('promptToSaveFilesBeforeCommit'); + + // migration + if (promptToSaveFilesBeforeCommit as any === true) { + promptToSaveFilesBeforeCommit = 'always'; + } else if (promptToSaveFilesBeforeCommit as any === false) { + promptToSaveFilesBeforeCommit = 'never'; + } + + if (promptToSaveFilesBeforeCommit !== 'never') { + let documents = workspace.textDocuments + .filter(d => !d.isUntitled && d.isDirty && isDescendant(repository.root, d.uri.fsPath)); + + if (promptToSaveFilesBeforeCommit === 'staged' || repository.indexGroup.resourceStates.length > 0) { + documents = documents + .filter(d => repository.indexGroup.resourceStates.some(s => pathEquals(s.resourceUri.fsPath, d.uri.fsPath))); + } + + if (documents.length > 0) { + const message = documents.length === 1 + ? localize('unsaved stash files single', "The following file has unsaved changes which won't be included in the stash if you proceed: {0}.\n\nWould you like to save it before committing?", path.basename(documents[0].uri.fsPath)) + : localize('unsaved stash files', "There are {0} unsaved files.\n\nWould you like to save them before stashing?", documents.length); + const saveAndStash = localize('save and stash', "Save All & Stash"); + const stash = localize('stash', "Stash Anyway"); + const pick = await window.showWarningMessage(message, { modal: true }, saveAndStash, stash); + + if (pick === saveAndStash) { + await Promise.all(documents.map(d => d.save())); + if (!includeUntracked) { + await repository.add(documents.map(d => d.uri)); + } + } else if (pick !== stash) { + return; // do not stash on cancel + } + } + } + const message = await this.getStashMessage(); if (typeof message === 'undefined') { From 156d5ab2812eb244473f7cded67bb4b68b63af1e Mon Sep 17 00:00:00 2001 From: Jacob Date: Fri, 3 Apr 2020 13:43:50 +0200 Subject: [PATCH 0009/1667] Added setting for opening cloned repository without prompt. #93300 --- extensions/git/package.json | 17 ++++++++ extensions/git/package.nls.json | 5 +++ extensions/git/src/commands.ts | 71 +++++++++++++++++++-------------- 3 files changed, 64 insertions(+), 29 deletions(-) diff --git a/extensions/git/package.json b/extensions/git/package.json index 75306b8a785..9eca6c7791c 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -1467,6 +1467,23 @@ "scope": "resource", "default": "none" }, + "git.promptToOpenClonedRepository": { + "type": "string", + "enum": [ + "currentWindow", + "newWindow", + "noFolderOpened", + "showPrompt" + ], + "enumDescriptions": [ + "%config.promptToOpenClonedRepository.currentWindow%", + "%config.promptToOpenClonedRepository.newWindow%", + "%config.promptToOpenClonedRepository.noFolderOpened%", + "%config.promptToOpenClonedRepository.showPrompt%" + ], + "default": "showPrompt", + "description": "%config.promptToOpenClonedRepository%" + }, "git.showInlineOpenFileAction": { "type": "boolean", "default": true, diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index e163ffad48d..3f847c92fee 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -116,6 +116,11 @@ "config.postCommitCommand.none": "Don't run any command after a commit.", "config.postCommitCommand.push": "Run 'Git Push' after a successful commit.", "config.postCommitCommand.sync": "Run 'Git Sync' after a successful commit.", + "config.promptToOpenClonedRepository": "Controls whether to show a prompt after cloning a repository.", + "config.promptToOpenClonedRepository.currentWindow": "Open repository in current window.", + "config.promptToOpenClonedRepository.newWindow": "Open repository in new window.", + "config.promptToOpenClonedRepository.noFolderOpened": "Open in current window if no folder is opened. Otherwise show prompt.", + "config.promptToOpenClonedRepository.showPrompt": "Always show prompt to choose action.", "config.showInlineOpenFileAction": "Controls whether to show an inline Open File action in the Git changes view.", "config.showPushSuccessNotification": "Controls whether to show a notification when a push is successful.", "config.inputValidation": "Controls when to show commit message input validation.", diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 68299863db7..f36772e6fd0 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -511,41 +511,54 @@ export class CommandCenter { (progress, token) => this.git.clone(url!, parentPath!, progress, token) ); - let message = localize('proposeopen', "Would you like to open the cloned repository?"); - const open = localize('openrepo', "Open"); - const openNewWindow = localize('openreponew', "Open in New Window"); - const openAlways = localize('openrepoalways', "Always open after cloning"); - const choices = [open, openNewWindow, openAlways]; - - const addToWorkspace = localize('add', "Add to Workspace"); - if (workspace.workspaceFolders) { - message = localize('proposeopen2', "Would you like to open the cloned repository, or add it to the current workspace?"); - choices.push(addToWorkspace); - } - - const result = await window.showInformationMessage(message, ...choices); - - const openFolder = result === open; - /* __GDPR__ - "clone" : { - "outcome" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "openFolder": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "isMeasurement": true } - } - */ - this.telemetryReporter.sendTelemetryEvent('clone', { outcome: 'success' }, { openFolder: openFolder ? 1 : 0 }); + let config = workspace.getConfiguration('git'); + let promptToOpenClonedRepository = config.get<'currentWindow' | 'newWindow' | 'noFolderOpened' | 'showPrompt'>('promptToOpenClonedRepository'); const uri = Uri.file(repositoryPath); - if (openFolder) { + if (promptToOpenClonedRepository === 'currentWindow') { commands.executeCommand('vscode.openFolder', uri); - } else if (result === addToWorkspace) { - workspace.updateWorkspaceFolders(workspace.workspaceFolders!.length, 0, { uri }); - } else if (result === openNewWindow) { + } else if (promptToOpenClonedRepository === 'newWindow') { commands.executeCommand('vscode.openFolder', uri, true); - } else if (result === openAlways) { - commands.executeCommand('vscode.openFolder', uri); - // will add a command for always option later + } else { + if (promptToOpenClonedRepository === 'noFolderOpened') { + if (!workspace.workspaceFolders) { + commands.executeCommand('vscode.openFolder', uri); + } + } + + let message = localize('proposeopen', "Would you like to open the cloned repository?"); + const open = localize('openrepo', "Open"); + const openNewWindow = localize('openreponew', "Open in New Window"); + const choices = [open, openNewWindow]; + + const addToWorkspace = localize('add', "Add to Workspace"); + if (workspace.workspaceFolders) { + message = localize('proposeopen2', "Would you like to open the cloned repository, or add it to the current workspace?"); + choices.push(addToWorkspace); + } + + const result = await window.showInformationMessage(message, ...choices); + + + const openFolder = result === open; + /* __GDPR__ + "clone" : { + "outcome" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, + "openFolder": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "isMeasurement": true } + } + */ + this.telemetryReporter.sendTelemetryEvent('clone', { outcome: 'success' }, { openFolder: openFolder ? 1 : 0 }); + + if (openFolder) { + commands.executeCommand('vscode.openFolder', uri); + } else if (result === addToWorkspace) { + workspace.updateWorkspaceFolders(workspace.workspaceFolders!.length, 0, { uri }); + } else if (result === openNewWindow) { + commands.executeCommand('vscode.openFolder', uri, true); + } } + } catch (err) { if (/already exists and is not an empty directory/.test(err && err.stderr || '')) { /* __GDPR__ From 4420bbfbcf7d284eb95132b23b5b82bc01b19a40 Mon Sep 17 00:00:00 2001 From: Nathaniel Palmer Date: Mon, 13 Apr 2020 17:13:39 -0400 Subject: [PATCH 0010/1667] Offer to show git command output on failure --- extensions/git/src/commands.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index e8a696735fc..b4ec7cc525b 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -236,6 +236,7 @@ interface PushOptions { export class CommandCenter { private disposables: Disposable[]; + private lastCommandErrorOutput = ''; constructor( private git: Git, @@ -252,6 +253,13 @@ export class CommandCenter { return commands.registerCommand(commandId, command); } }); + this.disposables.push( + workspace.registerTextDocumentContentProvider('git-output', this) + ); + } + + async provideTextDocumentContent(): Promise { + return this.lastCommandErrorOutput; } @command('git.setLogLevel') @@ -2435,6 +2443,16 @@ export class CommandCenter { const openOutputChannelChoice = localize('open git log', "Open Git Log"); const outputChannel = this.outputChannel as OutputChannel; choices.set(openOutputChannelChoice, () => outputChannel.show()); + const showCommandOutputChoice = localize('show command output', 'Show Command Output'); + if (err.stderr) { + choices.set(showCommandOutputChoice, () => { + this.lastCommandErrorOutput = err.stderr; + const uri = Uri.parse(`git-output://command-error/${err.gitCommand}-${Math.random().toString(16).slice(2, 10)}`); + workspace.openTextDocument(uri).then(doc => { + return window.showTextDocument(doc); + }); + }); + } switch (err.gitErrorCode) { case GitErrorCodes.DirtyWorkTree: From 1243ff76e4e66585418131c634de5a82070a3164 Mon Sep 17 00:00:00 2001 From: Jacob Date: Wed, 22 Apr 2020 14:27:55 +0200 Subject: [PATCH 0011/1667] Changed name of the setting to openAfterClone --- extensions/git/package.json | 12 ++++++------ extensions/git/package.nls.json | 10 +++++----- extensions/git/src/commands.ts | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/extensions/git/package.json b/extensions/git/package.json index 7ba43eedaa6..8d098c504a3 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -1507,7 +1507,7 @@ "scope": "resource", "default": "none" }, - "git.promptToOpenClonedRepository": { + "git.openAfterClone": { "type": "string", "enum": [ "currentWindow", @@ -1516,13 +1516,13 @@ "showPrompt" ], "enumDescriptions": [ - "%config.promptToOpenClonedRepository.currentWindow%", - "%config.promptToOpenClonedRepository.newWindow%", - "%config.promptToOpenClonedRepository.noFolderOpened%", - "%config.promptToOpenClonedRepository.showPrompt%" + "%config.openAfterClone.currentWindow%", + "%config.openAfterClone.newWindow%", + "%config.openAfterClone.noFolderOpened%", + "%config.openAfterClone.showPrompt%" ], "default": "showPrompt", - "description": "%config.promptToOpenClonedRepository%" + "description": "%config.openAfterClone%" }, "git.showInlineOpenFileAction": { "type": "boolean", diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 3ef518de24e..7b0f2a57866 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -116,11 +116,11 @@ "config.postCommitCommand.none": "Don't run any command after a commit.", "config.postCommitCommand.push": "Run 'Git Push' after a successful commit.", "config.postCommitCommand.sync": "Run 'Git Sync' after a successful commit.", - "config.promptToOpenClonedRepository": "Controls whether to show a prompt after cloning a repository.", - "config.promptToOpenClonedRepository.currentWindow": "Open repository in current window.", - "config.promptToOpenClonedRepository.newWindow": "Open repository in new window.", - "config.promptToOpenClonedRepository.noFolderOpened": "Open in current window if no folder is opened. Otherwise show prompt.", - "config.promptToOpenClonedRepository.showPrompt": "Always show prompt to choose action.", + "config.openAfterClone": "Controls whether to show a prompt after cloning a repository.", + "config.openAfterClone.currentWindow": "Open repository in current window.", + "config.openAfterClone.newWindow": "Open repository in new window.", + "config.openAfterClone.noFolderOpened": "Open in current window if no folder is opened. Otherwise show prompt.", + "config.openAfterClone.showPrompt": "Always show prompt to choose action.", "config.showInlineOpenFileAction": "Controls whether to show an inline Open File action in the Git changes view.", "config.showPushSuccessNotification": "Controls whether to show a notification when a push is successful.", "config.inputValidation": "Controls when to show commit message input validation.", diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index b707f75bdc2..8e5d5a06e3e 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -619,16 +619,16 @@ export class CommandCenter { ); let config = workspace.getConfiguration('git'); - let promptToOpenClonedRepository = config.get<'currentWindow' | 'newWindow' | 'noFolderOpened' | 'showPrompt'>('promptToOpenClonedRepository'); + let openAfterClone = config.get<'currentWindow' | 'newWindow' | 'noFolderOpened' | 'showPrompt'>('openAfterClone'); const uri = Uri.file(repositoryPath); - if (promptToOpenClonedRepository === 'currentWindow') { + if (openAfterClone === 'currentWindow') { commands.executeCommand('vscode.openFolder', uri); - } else if (promptToOpenClonedRepository === 'newWindow') { + } else if (openAfterClone === 'newWindow') { commands.executeCommand('vscode.openFolder', uri, true); } else { - if (promptToOpenClonedRepository === 'noFolderOpened') { + if (openAfterClone === 'noFolderOpened') { if (!workspace.workspaceFolders) { commands.executeCommand('vscode.openFolder', uri); } From 1531898fdb10cd559f62669f14afddcb1c179f3e Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 22 Apr 2020 21:22:48 +0200 Subject: [PATCH 0012/1667] avoid loading and twisty set at the same time --- src/vs/base/browser/ui/tree/abstractTree.ts | 12 +++++++++--- src/vs/base/browser/ui/tree/asyncDataTree.ts | 6 ++++-- src/vs/base/browser/ui/tree/objectTree.ts | 5 +++-- src/vs/base/browser/ui/tree/tree.ts | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/vs/base/browser/ui/tree/abstractTree.ts b/src/vs/base/browser/ui/tree/abstractTree.ts index a71e4d6ae48..e5ad99be7c6 100644 --- a/src/vs/base/browser/ui/tree/abstractTree.ts +++ b/src/vs/base/browser/ui/tree/abstractTree.ts @@ -401,15 +401,21 @@ class TreeRenderer implements IListRenderer } private renderTwistie(node: ITreeNode, templateData: ITreeListTemplateData) { + removeClasses(templateData.twistie, treeItemExpandedIcon.classNames); + + let twistieRendered = false; if (this.renderer.renderTwistie) { - this.renderer.renderTwistie(node.element, templateData.twistie); + twistieRendered = this.renderer.renderTwistie(node.element, templateData.twistie); } if (node.collapsible && (!this.hideTwistiesOfChildlessElements || node.visibleChildrenCount > 0)) { - addClasses(templateData.twistie, treeItemExpandedIcon.classNames, 'collapsible'); + if (!twistieRendered) { + addClasses(templateData.twistie, treeItemExpandedIcon.classNames); + } + addClasses(templateData.twistie, 'collapsible'); toggleClass(templateData.twistie, 'collapsed', node.collapsed); } else { - removeClasses(templateData.twistie, treeItemExpandedIcon.classNames, 'collapsible', 'collapsed'); + removeClasses(templateData.twistie, 'collapsible', 'collapsed'); } if (node.collapsible) { diff --git a/src/vs/base/browser/ui/tree/asyncDataTree.ts b/src/vs/base/browser/ui/tree/asyncDataTree.ts index 1e9600e2bff..5102e51a76a 100644 --- a/src/vs/base/browser/ui/tree/asyncDataTree.ts +++ b/src/vs/base/browser/ui/tree/asyncDataTree.ts @@ -112,10 +112,11 @@ class AsyncDataTreeRenderer implements IT renderTwistie(element: IAsyncDataTreeNode, twistieElement: HTMLElement): boolean { if (element.slow) { addClasses(twistieElement, treeItemLoadingIcon.classNames); + return true; } else { removeClasses(twistieElement, treeItemLoadingIcon.classNames); + return false; } - return false; } disposeElement(node: ITreeNode, TFilterData>, index: number, templateData: IDataTreeListTemplateData, height: number | undefined): void { @@ -1056,10 +1057,11 @@ class CompressibleAsyncDataTreeRenderer i renderTwistie(element: IAsyncDataTreeNode, twistieElement: HTMLElement): boolean { if (element.slow) { addClasses(twistieElement, treeItemLoadingIcon.classNames); + return true; } else { removeClasses(twistieElement, treeItemLoadingIcon.classNames); + return false; } - return false; } disposeElement(node: ITreeNode, TFilterData>, index: number, templateData: IDataTreeListTemplateData, height: number | undefined): void { diff --git a/src/vs/base/browser/ui/tree/objectTree.ts b/src/vs/base/browser/ui/tree/objectTree.ts index 38647079853..c0fbecdf732 100644 --- a/src/vs/base/browser/ui/tree/objectTree.ts +++ b/src/vs/base/browser/ui/tree/objectTree.ts @@ -124,10 +124,11 @@ class CompressibleRenderer, TFilterData, TTemplateDat this.renderer.disposeTemplate(templateData.data); } - renderTwistie?(element: T, twistieElement: HTMLElement): void { + renderTwistie?(element: T, twistieElement: HTMLElement): boolean { if (this.renderer.renderTwistie) { - this.renderer.renderTwistie(element, twistieElement); + return this.renderer.renderTwistie(element, twistieElement); } + return false; } } diff --git a/src/vs/base/browser/ui/tree/tree.ts b/src/vs/base/browser/ui/tree/tree.ts index 085bb3d90b7..c17b41fbbed 100644 --- a/src/vs/base/browser/ui/tree/tree.ts +++ b/src/vs/base/browser/ui/tree/tree.ts @@ -129,7 +129,7 @@ export interface ITreeModel { } export interface ITreeRenderer extends IListRenderer, TTemplateData> { - renderTwistie?(element: T, twistieElement: HTMLElement): void; + renderTwistie?(element: T, twistieElement: HTMLElement): boolean; onDidChangeTwistieState?: Event; } From 8e8dc25e6597993141a94cb57f4b5def32313389 Mon Sep 17 00:00:00 2001 From: Evan Krause Date: Wed, 6 May 2020 14:43:00 -0700 Subject: [PATCH 0013/1667] Don't focus editor when un-expanded comment is hidden --- .../contrib/comments/browser/commentThreadWidget.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts b/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts index b99e99ff0ce..f14e3fa6ffe 100644 --- a/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts +++ b/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts @@ -928,9 +928,11 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget } hide() { - this._isExpanded = false; - // Focus the container so that the comment editor will be blurred before it is hidden - this.editor.focus(); + if (this._isExpanded) { + this._isExpanded = false; + // Focus the container so that the comment editor will be blurred before it is hidden + this.editor.focus(); + } super.hide(); } From 63ccc69f08f27bf5888d1706b80dd1a5a12286f5 Mon Sep 17 00:00:00 2001 From: Borja Zarco Date: Sun, 10 May 2020 23:57:21 -0400 Subject: [PATCH 0014/1667] Fix launch configuration input variable resolution. When resolving launch configuration variables during a debug session, the configuration target was not being specified, always defaulting to reading workspace folder inputs. This made it impossible for user or workspace file launch configurations to use input variables, as the inputs list was never found. This change forwards the launch configuration source to the configurationResolverService, so that it looks for the inputs list in the right place. Forwarding the source fixed single-root workspaces, but multi-root workspaces were skipping the inputs lookup, since they pass an undefined workspace folder... In this case, the workspace folder is not relevant, as the config and inputs are defined in the workspace file, and allowing resolution to continue yields the desired behavior. --- .../browser/debugConfigurationManager.ts | 13 ++++++-- .../workbench/contrib/debug/common/debug.ts | 3 +- .../contrib/debug/common/debugger.ts | 2 +- .../browser/configurationResolverService.ts | 6 ++-- .../configurationResolverService.test.ts | 33 +++++++++++++++++++ 5 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts b/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts index d0eff031334..17c3b1bda8e 100644 --- a/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts +++ b/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts @@ -625,8 +625,17 @@ abstract class AbstractLaunch { if (!config || !config.configurations) { return undefined; } - - return config.configurations.find(config => config && config.name === name); + const configuration = config.configurations.find(config => config && config.name === name); + if (configuration) { + if (this instanceof UserLaunch) { + configuration.__configurationTarget = ConfigurationTarget.USER; + } else if (this instanceof WorkspaceLaunch) { + configuration.__configurationTarget = ConfigurationTarget.WORKSPACE; + } else { + configuration.__configurationTarget = ConfigurationTarget.WORKSPACE_FOLDER; + } + } + return configuration; } async getInitialConfigurationContent(folderUri?: uri, type?: string, token?: CancellationToken): Promise { diff --git a/src/vs/workbench/contrib/debug/common/debug.ts b/src/vs/workbench/contrib/debug/common/debug.ts index 997e8f4df84..26df2485c28 100644 --- a/src/vs/workbench/contrib/debug/common/debug.ts +++ b/src/vs/workbench/contrib/debug/common/debug.ts @@ -21,7 +21,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic import { IDisposable } from 'vs/base/common/lifecycle'; import { TaskIdentifier } from 'vs/workbench/contrib/tasks/common/tasks'; import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; import { CancellationToken } from 'vs/base/common/cancellation'; import { DebugConfigurationProviderTriggerKind } from 'vs/workbench/api/common/extHostTypes'; import { DebugCompoundRoot } from 'vs/workbench/contrib/debug/common/debugCompoundRoot'; @@ -512,6 +512,7 @@ export interface IConfig extends IEnvConfig { linux?: IEnvConfig; // internals + __configurationTarget?: ConfigurationTarget; __sessionId?: string; __restart?: any; __autoAttach?: boolean; diff --git a/src/vs/workbench/contrib/debug/common/debugger.ts b/src/vs/workbench/contrib/debug/common/debugger.ts index ca1ee7ebfc3..8ede6963b15 100644 --- a/src/vs/workbench/contrib/debug/common/debugger.ts +++ b/src/vs/workbench/contrib/debug/common/debugger.ts @@ -107,7 +107,7 @@ export class Debugger implements IDebugger { substituteVariables(folder: IWorkspaceFolder | undefined, config: IConfig): Promise { return this.configurationManager.substituteVariables(this.type, folder, config).then(config => { - return this.configurationResolverService.resolveWithInteractionReplace(folder, config, 'launch', this.variables); + return this.configurationResolverService.resolveWithInteractionReplace(folder, config, 'launch', this.variables, config.__configurationTarget); }); } diff --git a/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts b/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts index 42b3431dc41..0a35a47cd77 100644 --- a/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts +++ b/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts @@ -147,8 +147,8 @@ export abstract class BaseConfigurationResolverService extends AbstractVariableR // get all "inputs" let inputs: ConfiguredInput[] = []; - if (folder && this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY && section) { - let result = this.configurationService.inspect(section, { resource: folder.uri }); + if (this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY && section) { + let result = this.configurationService.inspect(section, { resource: folder?.uri }); if (result && (result.userValue || result.workspaceValue || result.workspaceFolderValue)) { switch (target) { case ConfigurationTarget.USER: inputs = (result.userValue)?.inputs; break; @@ -156,7 +156,7 @@ export abstract class BaseConfigurationResolverService extends AbstractVariableR default: inputs = (result.workspaceFolderValue)?.inputs; } } else { - const valueResult = this.configurationService.getValue(section, { resource: folder.uri }); + const valueResult = this.configurationService.getValue(section, { resource: folder?.uri }); if (valueResult) { inputs = valueResult.inputs; } diff --git a/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts b/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts index 9d1f709f55c..de7980bef6e 100644 --- a/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts +++ b/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts @@ -443,6 +443,7 @@ suite('Configuration Resolver Service', () => { assert.equal(1, mockCommandService.callCount); }); }); + test('a single prompt input variable', () => { const configuration = { @@ -470,6 +471,7 @@ suite('Configuration Resolver Service', () => { assert.equal(0, mockCommandService.callCount); }); }); + test('a single pick input variable', () => { const configuration = { @@ -497,6 +499,7 @@ suite('Configuration Resolver Service', () => { assert.equal(0, mockCommandService.callCount); }); }); + test('a single command input variable', () => { const configuration = { @@ -524,6 +527,7 @@ suite('Configuration Resolver Service', () => { assert.equal(1, mockCommandService.callCount); }); }); + test('several input variables and command', () => { const configuration = { @@ -553,6 +557,35 @@ suite('Configuration Resolver Service', () => { assert.equal(2, mockCommandService.callCount); }); }); + + test('input variable with undefined workspace folder', () => { + + const configuration = { + 'name': 'Attach to Process', + 'type': 'node', + 'request': 'attach', + 'processId': '${input:input1}', + 'port': 5858, + 'sourceMaps': false, + 'outDir': null + }; + + return configurationResolverService!.resolveWithInteractionReplace(undefined, configuration, 'tasks').then(result => { + + assert.deepEqual(result, { + 'name': 'Attach to Process', + 'type': 'node', + 'request': 'attach', + 'processId': 'resolvedEnterinput1', + 'port': 5858, + 'sourceMaps': false, + 'outDir': null + }); + + assert.equal(0, mockCommandService.callCount); + }); + }); + test('contributed variable', () => { const buildTask = 'npm: compile'; const variable = 'defaultBuildTask'; From 352f231bec54ae53cf56262f80d45d25fc7e3e29 Mon Sep 17 00:00:00 2001 From: Borja Zarco Date: Mon, 11 May 2020 08:03:24 -0400 Subject: [PATCH 0015/1667] Do not define resource override unless folder is defined. --- .../browser/configurationResolverService.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts b/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts index 0a35a47cd77..5b9afb5b030 100644 --- a/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts +++ b/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts @@ -11,7 +11,7 @@ import { Schemas } from 'vs/base/common/network'; import { toResource } from 'vs/workbench/common/editor'; import { IStringDictionary, forEach, fromMap } from 'vs/base/common/collections'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; -import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationService, IConfigurationOverrides, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { IWorkspaceFolder, IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; @@ -148,7 +148,8 @@ export abstract class BaseConfigurationResolverService extends AbstractVariableR // get all "inputs" let inputs: ConfiguredInput[] = []; if (this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY && section) { - let result = this.configurationService.inspect(section, { resource: folder?.uri }); + const overrides: IConfigurationOverrides = folder ? { resource: folder.uri } : {}; + let result = this.configurationService.inspect(section, overrides); if (result && (result.userValue || result.workspaceValue || result.workspaceFolderValue)) { switch (target) { case ConfigurationTarget.USER: inputs = (result.userValue)?.inputs; break; @@ -156,7 +157,7 @@ export abstract class BaseConfigurationResolverService extends AbstractVariableR default: inputs = (result.workspaceFolderValue)?.inputs; } } else { - const valueResult = this.configurationService.getValue(section, { resource: folder?.uri }); + const valueResult = this.configurationService.getValue(section, overrides); if (valueResult) { inputs = valueResult.inputs; } From cda3fbe7f83bd45859ac7e902c2dce2d9b961b0f Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Fri, 11 Sep 2020 16:22:08 -0700 Subject: [PATCH 0016/1667] debug: use only js-debug auto attach, collapse settings This PR removes the hook in node-debug's auto attach, and uses only js-debug auto attach. As referenced in the linked issues, this involves removing `debug.javascript.usePreviewAutoAttach` and collapsing `debug.node.autoAttach` into `debug.javascript.autoAttachFilter`. The latter option gains a new state: `disabled`. Since there's no runtime cost to having auto attach around, there is now no distinct off versus disabled state. The status bar item and the `Debug: Toggle Auto Attach` command now open a quickpick, which looks like this: ![](https://memes.peet.io/img/20-09-9d2b6c0a-8b3f-4481-b2df-0753c54ee02b.png) The current setting value is selected in the quickpick. If there is a workspace setting for auto attach, the quickpick toggle the setting there by default. Otherwise (as in the image) it will target the user settings. The targeting is more explicit and defaults to the user instead of the workspace, which should help reduce confusion (#97087). Selecting the "scope change" item will reopen the quickpick in that location. Aside from the extra options for the `disabled` state in js-debug's contributions, there's no changes required to it or its interaction with debug-auto-launch. Side note: I really wanted a separator between the states and the scope change item, but this is not possible from an extension #74967. Fixes https://github.com/microsoft/vscode/issues/105883 Fixes https://github.com/microsoft/vscode-js-debug/issues/732 (the rest of it) Fixes https://github.com/microsoft/vscode/issues/105963 Fixes https://github.com/microsoft/vscode/issues/97087 --- extensions/debug-auto-launch/package.json | 33 +- extensions/debug-auto-launch/package.nls.json | 7 - extensions/debug-auto-launch/src/extension.ts | 420 +++++++++--------- 3 files changed, 221 insertions(+), 239 deletions(-) diff --git a/extensions/debug-auto-launch/package.json b/extensions/debug-auto-launch/package.json index 3cb11ef1844..f0dc778263e 100644 --- a/extensions/debug-auto-launch/package.json +++ b/extensions/debug-auto-launch/package.json @@ -17,33 +17,6 @@ "watch": "gulp watch-extension:debug-auto-launch" }, "contributes": { - "configuration": { - "title": "Node debug", - "properties": { - "debug.node.autoAttach": { - "scope": "window", - "type": "string", - "enum": [ - "disabled", - "on", - "off" - ], - "enumDescriptions": [ - "%debug.node.autoAttach.disabled.description%", - "%debug.node.autoAttach.on.description%", - "%debug.node.autoAttach.off.description%" - ], - "description": "%debug.node.autoAttach.description%", - "default": "disabled" - }, - "debug.javascript.usePreviewAutoAttach": { - "scope": "window", - "type": "boolean", - "default": true, - "description": "%debug.javascript.usePreviewAutoAttach%" - } - } - }, "commands": [ { "command": "extension.node-debug.toggleAutoAttach", @@ -57,5 +30,11 @@ }, "devDependencies": { "@types/node": "^12.11.7" + }, + "prettier": { + "printWidth": 100, + "trailingComma": "all", + "singleQuote": true, + "arrowParens": "avoid" } } diff --git a/extensions/debug-auto-launch/package.nls.json b/extensions/debug-auto-launch/package.nls.json index 1179563a6c5..ba9f80dfe8b 100644 --- a/extensions/debug-auto-launch/package.nls.json +++ b/extensions/debug-auto-launch/package.nls.json @@ -1,12 +1,5 @@ { "displayName": "Node Debug Auto-attach", "description": "Helper for auto-attach feature when node-debug extensions are not active.", - - "debug.node.autoAttach.description": "Automatically attach node debugger when node.js was launched in debug mode from integrated terminal.", - "debug.javascript.usePreviewAutoAttach": "Whether to use the preview debugger's version of auto attach.", - "debug.node.autoAttach.disabled.description": "Auto attach is disabled and not shown in status bar.", - "debug.node.autoAttach.on.description": "Auto attach is active.", - "debug.node.autoAttach.off.description": "Auto attach is inactive.", - "toggle.auto.attach": "Toggle Auto Attach" } diff --git a/extensions/debug-auto-launch/src/extension.ts b/extensions/debug-auto-launch/src/extension.ts index 8bd96450c6f..cd00d9eed94 100644 --- a/extensions/debug-auto-launch/src/extension.ts +++ b/extensions/debug-auto-launch/src/extension.ts @@ -8,121 +8,152 @@ import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; const localize = nls.loadMessageBundle(); -const ON_TEXT = localize('status.text.auto.attach.on', 'Auto Attach: On'); -const OFF_TEXT = localize('status.text.auto.attach.off', 'Auto Attach: Off'); +const TEXT_ALWAYS = localize('status.text.auto.attach.always', 'Auto Attach: Always'); +const TEXT_SMART = localize('status.text.auto.attach.smart', 'Auto Attach: Smart'); +const TEXT_WITH_FLAG = localize('status.text.auto.attach.withFlag', 'Auto Attach: With Flag'); +const TEXT_STATE_DESCRIPTION = { + [State.Disabled]: localize( + 'debug.javascript.autoAttach.disabled.description', + 'Auto attach is disabled and not shown in status bar', + ), + [State.Always]: localize( + 'debug.javascript.autoAttach.always.description', + 'Auto attach to every Node.js process launched in the terminal', + ), + [State.Smart]: localize( + 'debug.javascript.autoAttach.smart.description', + "Auto attach when running scripts that aren't in a node_modules folder", + ), + [State.OnlyWithFlag]: localize( + 'debug.javascript.autoAttach.onlyWithFlag.description', + 'Only auto attach when the `--inspect` flag is given', + ), +}; const TOGGLE_COMMAND = 'extension.node-debug.toggleAutoAttach'; -const JS_DEBUG_SETTINGS = 'debug.javascript'; -const JS_DEBUG_USEPREVIEWAA = 'usePreviewAutoAttach'; -const JS_DEBUG_IPC_KEY = 'jsDebugIpcState'; -const JS_DEBUG_REFRESH_SETTINGS = ['autoAttachSmartPattern', 'autoAttachFilter']; // settings that, when changed, should cause us to refresh js-debug vars -const NODE_DEBUG_SETTINGS = 'debug.node'; -const AUTO_ATTACH_SETTING = 'autoAttach'; -const LAST_STATE_STORAGE_KEY = 'lastState'; +const STORAGE_IPC = 'jsDebugIpcState'; +const SETTING_SECTION = 'debug.javascript'; +const SETTING_STATE = 'autoAttachFilter'; -type AUTO_ATTACH_VALUES = 'disabled' | 'on' | 'off'; +/** + * settings that, when changed, should cause us to refresh the state vars + */ +const SETTINGS_CAUSE_REFRESH = new Set( + ['autoAttachSmartPattern', SETTING_STATE].map(s => `${SETTING_SECTION}.${s}`), +); const enum State { - Disabled, - Off, - OnWithJsDebug, - OnWithNodeDebug, + Disabled = 'disabled', + OnlyWithFlag = 'onlyWithFlag', + Smart = 'smart', + Always = 'always', } -// on activation this feature is always disabled... -let currentState: Promise<{ context: vscode.ExtensionContext, state: State; transitionData: unknown }>; +let currentState: Promise<{ context: vscode.ExtensionContext; state: State | null }>; let statusItem: vscode.StatusBarItem | undefined; // and there is no status bar item +let server: Promise | undefined; // auto attach server export function activate(context: vscode.ExtensionContext): void { - const previousState = context.workspaceState.get(LAST_STATE_STORAGE_KEY, State.Disabled); - currentState = Promise.resolve(transitions[previousState].onActivate?.(context, readCurrentState())) - .then(() => ({ context, state: State.Disabled, transitionData: null })); - - context.subscriptions.push(vscode.commands.registerCommand(TOGGLE_COMMAND, toggleAutoAttachSetting)); - - // settings that can result in the "state" being changed--on/off/disable or useV3 toggles - const effectualConfigurationSettings = [ - `${NODE_DEBUG_SETTINGS}.${AUTO_ATTACH_SETTING}`, - `${JS_DEBUG_SETTINGS}.${JS_DEBUG_USEPREVIEWAA}`, - ]; - - const refreshConfigurationSettings = JS_DEBUG_REFRESH_SETTINGS.map(s => `${JS_DEBUG_SETTINGS}.${s}`); + currentState = Promise.resolve({ context, state: null }); context.subscriptions.push( - vscode.workspace.onDidChangeConfiguration((e) => { - if (effectualConfigurationSettings.some(setting => e.affectsConfiguration(setting))) { - updateAutoAttach(); - } else if (refreshConfigurationSettings.some(setting => e.affectsConfiguration(setting))) { - currentState = currentState.then(async s => { - if (s.state !== State.OnWithJsDebug) { - return s; - } - - await transitions[State.OnWithJsDebug].exit?.(context, s.transitionData); - await clearJsDebugAttachState(context); - const transitionData = await transitions[State.OnWithJsDebug].enter?.(context); - return { context, state: State.OnWithJsDebug, transitionData }; - }); - } - }) + vscode.commands.registerCommand(TOGGLE_COMMAND, toggleAutoAttachSetting), ); - updateAutoAttach(); + context.subscriptions.push( + vscode.workspace.onDidChangeConfiguration(e => { + // Whenever a setting is changed, disable auto attach, and re-enable + // it (if necessary) to refresh variables. + if ( + e.affectsConfiguration(`${SETTING_SECTION}.${SETTING_STATE}`) || + [...SETTINGS_CAUSE_REFRESH].some(setting => e.affectsConfiguration(setting)) + ) { + updateAutoAttach(State.Disabled); + updateAutoAttach(readCurrentState()); + } + }), + ); + + updateAutoAttach(readCurrentState()); } export async function deactivate(): Promise { - const { context, state, transitionData } = await currentState; - await transitions[state].exit?.(context, transitionData); + await destroyAttachServer(); } -function toggleAutoAttachSetting() { - const conf = vscode.workspace.getConfiguration(NODE_DEBUG_SETTINGS); - if (conf) { - let value = conf.get(AUTO_ATTACH_SETTING); - if (value === 'on') { - value = 'off'; - } else { - value = 'on'; - } +type StatePickItem = + | (vscode.QuickPickItem & { state: State }) + | (vscode.QuickPickItem & { scope: vscode.ConfigurationTarget }) + | (vscode.QuickPickItem & { type: 'separator' }); - const info = conf.inspect(AUTO_ATTACH_SETTING); - let target: vscode.ConfigurationTarget = vscode.ConfigurationTarget.Global; - if (info) { - if (info.workspaceFolderValue) { - target = vscode.ConfigurationTarget.WorkspaceFolder; - } else if (info.workspaceValue) { - target = vscode.ConfigurationTarget.Workspace; - } else if (info.globalValue) { - target = vscode.ConfigurationTarget.Global; - } else if (info.defaultValue) { - // setting not yet used: store setting in workspace - if (vscode.workspace.workspaceFolders) { - target = vscode.ConfigurationTarget.Workspace; - } - } - } - conf.update(AUTO_ATTACH_SETTING, value, target); +function getDefaultScope(info: ReturnType) { + if (!info) { + return vscode.ConfigurationTarget.Global; + } else if (info.workspaceFolderValue) { + return vscode.ConfigurationTarget.WorkspaceFolder; + } else if (info.workspaceValue) { + return vscode.ConfigurationTarget.Workspace; + } else if (info.globalValue) { + return vscode.ConfigurationTarget.Global; } + + return vscode.ConfigurationTarget.Global; } -function autoAttachWithJsDebug() { - const jsDebugConfig = vscode.workspace.getConfiguration(JS_DEBUG_SETTINGS); - return jsDebugConfig.get(JS_DEBUG_USEPREVIEWAA, true); +async function toggleAutoAttachSetting(scope?: vscode.ConfigurationTarget): Promise { + const section = vscode.workspace.getConfiguration(SETTING_SECTION); + scope = scope || getDefaultScope(section.inspect(SETTING_STATE)); + + const stateItems = [State.Always, State.Smart, State.OnlyWithFlag, State.Disabled].map(state => ({ + state, + label: state.slice(0, 1).toUpperCase() + state.slice(1), + description: TEXT_STATE_DESCRIPTION[state], + alwaysShow: true, + })); + + const scopeItem = + scope === vscode.ConfigurationTarget.Global + ? { + label: localize('scope.workspace', 'Toggle in this workspace $(arrow-right)'), + scope: vscode.ConfigurationTarget.Workspace, + } + : { + label: localize('scope.global', 'Toggle for this machine $(arrow-right)'), + scope: vscode.ConfigurationTarget.Global, + }; + + const quickPick = vscode.window.createQuickPick(); + // todo: have a separator here, see https://github.com/microsoft/vscode/issues/74967 + quickPick.items = [...stateItems, scopeItem]; + + quickPick.show(); + const current = readCurrentState(); + quickPick.activeItems = stateItems.filter(i => i.state === current); + + const result = await new Promise(resolve => { + quickPick.onDidAccept(() => resolve(quickPick.selectedItems[0])); + quickPick.onDidHide(() => resolve()); + }); + + quickPick.dispose(); + + if (!result) { + return; + } + + if ('scope' in result) { + return await toggleAutoAttachSetting(result.scope); + } + + if ('state' in result) { + section.update(SETTING_STATE, result.state, scope); + } } function readCurrentState(): State { - const nodeConfig = vscode.workspace.getConfiguration(NODE_DEBUG_SETTINGS); - const autoAttachState = nodeConfig.get(AUTO_ATTACH_SETTING); - switch (autoAttachState) { - case 'off': - return State.Off; - case 'on': - return autoAttachWithJsDebug() ? State.OnWithJsDebug : State.OnWithNodeDebug; - case 'disabled': - default: - return State.Disabled; - } + const section = vscode.workspace.getConfiguration(SETTING_SECTION); + return section.get(SETTING_STATE) ?? State.Disabled; } /** @@ -134,7 +165,7 @@ function ensureStatusBarExists(context: vscode.ExtensionContext) { statusItem.command = TOGGLE_COMMAND; statusItem.tooltip = localize( 'status.tooltip.auto.attach', - 'Automatically attach to node.js processes in debug mode' + 'Automatically attach to node.js processes in debug mode', ); statusItem.show(); context.subscriptions.push(statusItem); @@ -146,8 +177,63 @@ function ensureStatusBarExists(context: vscode.ExtensionContext) { } async function clearJsDebugAttachState(context: vscode.ExtensionContext) { - await context.workspaceState.update(JS_DEBUG_IPC_KEY, undefined); + await context.workspaceState.update(STORAGE_IPC, undefined); await vscode.commands.executeCommand('extension.js-debug.clearAutoAttachVariables'); + await destroyAttachServer(); +} + +/** + * Turns auto attach on, and returns the server auto attach is listening on + * if it's successful. + */ +async function createAttachServer(context: vscode.ExtensionContext) { + const ipcAddress = await getIpcAddress(context); + if (!ipcAddress) { + return undefined; + } + + server = new Promise((resolve, reject) => { + const s = createServer(socket => { + let data: Buffer[] = []; + socket.on('data', async chunk => { + if (chunk[chunk.length - 1] !== 0) { + // terminated with NUL byte + data.push(chunk); + return; + } + + data.push(chunk.slice(0, -1)); + + try { + await vscode.commands.executeCommand( + 'extension.js-debug.autoAttachToProcess', + JSON.parse(Buffer.concat(data).toString()), + ); + socket.write(Buffer.from([0])); + } catch (err) { + socket.write(Buffer.from([1])); + console.error(err); + } + }); + }) + .on('error', reject) + .listen(ipcAddress, () => resolve(s)); + }).catch(err => { + console.error(err); + return undefined; + }); + + return await server; +} + +/** + * Destroys the auto-attach server, if it's running. + */ +async function destroyAttachServer() { + const instance = await server; + if (instance) { + await new Promise(r => instance.close(r)); + } } interface CachedIpcState { @@ -156,124 +242,46 @@ interface CachedIpcState { settingsValue: string; } -interface StateTransition { - onActivate?(context: vscode.ExtensionContext, currentState: State): Promise; - exit?(context: vscode.ExtensionContext, stateData: StateData): Promise | void; - enter?(context: vscode.ExtensionContext): Promise | StateData; -} - -const makeTransition = (tsn: StateTransition) => tsn; // helper to apply generic type - /** * Map of logic that happens when auto attach states are entered and exited. * All state transitions are queued and run in order; promises are awaited. */ -const transitions: { [S in State]: StateTransition } = { - [State.Disabled]: makeTransition({ - async enter(context) { - statusItem?.hide(); - await clearJsDebugAttachState(context); - }, - }), +const transitions: { [S in State]: (context: vscode.ExtensionContext) => Promise } = { + async [State.Disabled](context) { + await clearJsDebugAttachState(context); + statusItem?.hide(); + }, - [State.Off]: makeTransition({ - enter(context) { - const statusItem = ensureStatusBarExists(context); - statusItem.text = OFF_TEXT; - }, - }), + async [State.OnlyWithFlag](context) { + await createAttachServer(context); + const statusItem = ensureStatusBarExists(context); + statusItem.text = TEXT_WITH_FLAG; + }, - [State.OnWithNodeDebug]: makeTransition({ - async enter(context) { - const statusItem = ensureStatusBarExists(context); - const vscode_pid = process.env['VSCODE_PID']; - const rootPid = vscode_pid ? parseInt(vscode_pid) : 0; - await vscode.commands.executeCommand('extension.node-debug.startAutoAttach', rootPid); - statusItem.text = ON_TEXT; - }, + async [State.Smart](context) { + await createAttachServer(context); + const statusItem = ensureStatusBarExists(context); + statusItem.text = TEXT_SMART; + }, - async exit() { - await vscode.commands.executeCommand('extension.node-debug.stopAutoAttach'); - }, - }), - - [State.OnWithJsDebug]: makeTransition({ - async enter(context) { - const ipcAddress = await getIpcAddress(context); - if (!ipcAddress) { - return null; - } - - const server = await new Promise((resolve, reject) => { - const s = createServer((socket) => { - let data: Buffer[] = []; - socket.on('data', async (chunk) => { - if (chunk[chunk.length - 1] !== 0) { // terminated with NUL byte - data.push(chunk); - return; - } - - data.push(chunk.slice(0, -1)); - - try { - await vscode.commands.executeCommand( - 'extension.js-debug.autoAttachToProcess', - JSON.parse(Buffer.concat(data).toString()) - ); - socket.write(Buffer.from([0])); - } catch (err) { - socket.write(Buffer.from([1])); - console.error(err); - } - }); - }) - .on('error', reject) - .listen(ipcAddress, () => resolve(s)); - }).catch(console.error); - - const statusItem = ensureStatusBarExists(context); - statusItem.text = ON_TEXT; - return server || null; - }, - - async exit(context, server) { - // we don't need to clear the environment variables--the bootloader will - // no-op if the debug server is closed. This prevents having to reload - // terminals if users want to turn it back on. - if (server) { - await new Promise((resolve) => server.close(resolve)); - } - - // but if they toggled auto attach use js-debug off, go ahead and do so - if (!autoAttachWithJsDebug()) { - await clearJsDebugAttachState(context); - } - }, - - async onActivate(context, currentState) { - if (currentState === State.OnWithNodeDebug || currentState === State.Disabled) { - await clearJsDebugAttachState(context); - } - } - }), + async [State.Always](context) { + await createAttachServer(context); + const statusItem = ensureStatusBarExists(context); + statusItem.text = TEXT_ALWAYS; + }, }; /** * Updates the auto attach feature based on the user or workspace setting */ -function updateAutoAttach() { - const newState = readCurrentState(); - - currentState = currentState.then(async ({ context, state: oldState, transitionData }) => { +function updateAutoAttach(newState: State) { + currentState = currentState.then(async ({ context, state: oldState }) => { if (newState === oldState) { - return { context, state: oldState, transitionData }; + return { context, state: oldState }; } - await transitions[oldState].exit?.(context, transitionData); - const newData = await transitions[newState].enter?.(context); - await context.workspaceState.update(LAST_STATE_STORAGE_KEY, newState); - - return { context, state: newState, transitionData: newData }; + await transitions[newState](context); + return { context, state: newState }; }); } @@ -285,41 +293,43 @@ async function getIpcAddress(context: vscode.ExtensionContext) { // Iff the `cachedData` is present, the js-debug registered environment // variables for this workspace--cachedData is set after successfully // invoking the attachment command. - const cachedIpc = context.workspaceState.get(JS_DEBUG_IPC_KEY); + const cachedIpc = context.workspaceState.get(STORAGE_IPC); // We invalidate the IPC data if the js-debug path changes, since that // indicates the extension was updated or reinstalled and the // environment variables will have been lost. // todo: make a way in the API to read environment data directly without activating js-debug? - const jsDebugPath = vscode.extensions.getExtension('ms-vscode.js-debug-nightly')?.extensionPath - || vscode.extensions.getExtension('ms-vscode.js-debug')?.extensionPath; + const jsDebugPath = + vscode.extensions.getExtension('ms-vscode.js-debug-nightly')?.extensionPath || + vscode.extensions.getExtension('ms-vscode.js-debug')?.extensionPath; const settingsValue = getJsDebugSettingKey(); - if (cachedIpc && cachedIpc.jsDebugPath === jsDebugPath && cachedIpc.settingsValue === settingsValue) { + if (cachedIpc?.jsDebugPath === jsDebugPath && cachedIpc?.settingsValue === settingsValue) { return cachedIpc.ipcAddress; } - const result = await vscode.commands.executeCommand<{ ipcAddress: string; }>( + const result = await vscode.commands.executeCommand<{ ipcAddress: string }>( 'extension.js-debug.setAutoAttachVariables', - cachedIpc?.ipcAddress + cachedIpc?.ipcAddress, ); if (!result) { return; } const ipcAddress = result.ipcAddress; - await context.workspaceState.update( - JS_DEBUG_IPC_KEY, - { ipcAddress, jsDebugPath, settingsValue } as CachedIpcState, - ); + await context.workspaceState.update(STORAGE_IPC, { + ipcAddress, + jsDebugPath, + settingsValue, + } as CachedIpcState); return ipcAddress; } function getJsDebugSettingKey() { let o: { [key: string]: unknown } = {}; - const config = vscode.workspace.getConfiguration(JS_DEBUG_SETTINGS); - for (const setting of JS_DEBUG_REFRESH_SETTINGS) { + const config = vscode.workspace.getConfiguration(SETTING_SECTION); + for (const setting of SETTINGS_CAUSE_REFRESH) { o[setting] = config.get(setting); } From 966c186f78ea8907cb7ff98da94535bf127fba79 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 15 Sep 2020 15:15:31 +0200 Subject: [PATCH 0017/1667] handle errors in backup tracker while writing backup --- src/vs/workbench/contrib/backup/common/backupTracker.ts | 6 ++++-- .../backup/test/electron-browser/backupTracker.test.ts | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/backup/common/backupTracker.ts b/src/vs/workbench/contrib/backup/common/backupTracker.ts index 4121d8ae848..dc77a2e51f6 100644 --- a/src/vs/workbench/contrib/backup/common/backupTracker.ts +++ b/src/vs/workbench/contrib/backup/common/backupTracker.ts @@ -130,8 +130,10 @@ export abstract class BackupTracker extends Disposable { if (workingCopy.isDirty()) { this.logService.trace(`[backup tracker] running backup`, workingCopy.resource.toString()); - const backup = await workingCopy.backup(); - this.backupFileService.backup(workingCopy.resource, backup.content, this.getContentVersion(workingCopy), backup.meta); + try { + const backup = await workingCopy.backup(); + await this.backupFileService.backup(workingCopy.resource, backup.content, this.getContentVersion(workingCopy), backup.meta); + } catch (error) { /* Ignore */ } } }, BackupTracker.BACKUP_FROM_CONTENT_CHANGE_DELAY); diff --git a/src/vs/workbench/contrib/backup/test/electron-browser/backupTracker.test.ts b/src/vs/workbench/contrib/backup/test/electron-browser/backupTracker.test.ts index 485390ddab3..663a1a7caa3 100644 --- a/src/vs/workbench/contrib/backup/test/electron-browser/backupTracker.test.ts +++ b/src/vs/workbench/contrib/backup/test/electron-browser/backupTracker.test.ts @@ -105,6 +105,7 @@ suite('BackupTracker', () => { // Delete any existing backups completely and then re-create it. await pfs.rimraf(backupHome, pfs.RimRafMode.MOVE); await pfs.mkdirp(backupHome); + await pfs.mkdirp(workspaceBackupPath); return pfs.writeFile(workspacesJsonPath, ''); }); From 10825b5c4b9777509c601104ae3c864ea333e0b3 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 16 Sep 2020 10:44:08 +0200 Subject: [PATCH 0018/1667] log error --- src/vs/workbench/contrib/backup/common/backupTracker.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/backup/common/backupTracker.ts b/src/vs/workbench/contrib/backup/common/backupTracker.ts index dc77a2e51f6..a854320c20b 100644 --- a/src/vs/workbench/contrib/backup/common/backupTracker.ts +++ b/src/vs/workbench/contrib/backup/common/backupTracker.ts @@ -133,7 +133,9 @@ export abstract class BackupTracker extends Disposable { try { const backup = await workingCopy.backup(); await this.backupFileService.backup(workingCopy.resource, backup.content, this.getContentVersion(workingCopy), backup.meta); - } catch (error) { /* Ignore */ } + } catch (error) { + this.logService.error(error); + } } }, BackupTracker.BACKUP_FROM_CONTENT_CHANGE_DELAY); From 9813ffdf82718c2fec28d6a58f3063a2cd06e71a Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 16 Sep 2020 11:39:58 +0200 Subject: [PATCH 0019/1667] Add resolveCodeAction to internal API, introduce CodeActionItem which knows a CodeAction and the provider, adopt CodeActitemItem in codeAction-land --- src/vs/editor/common/modes.ts | 5 +++ .../editor/contrib/codeAction/codeAction.ts | 45 ++++++++++++++----- .../contrib/codeAction/codeActionCommands.ts | 25 ++++++----- .../contrib/codeAction/codeActionMenu.ts | 14 +++--- .../editor/contrib/codeAction/codeActionUi.ts | 16 +++---- .../codeAction/test/codeAction.test.ts | 31 +++++++------ .../codeEditor/browser/saveParticipants.ts | 2 +- .../markers/browser/markersTreeViewer.ts | 8 ++-- .../api/extHostLanguageFeatures.test.ts | 16 +++---- 9 files changed, 96 insertions(+), 66 deletions(-) diff --git a/src/vs/editor/common/modes.ts b/src/vs/editor/common/modes.ts index 3d34f627b1c..492bab67897 100644 --- a/src/vs/editor/common/modes.ts +++ b/src/vs/editor/common/modes.ts @@ -654,6 +654,11 @@ export interface CodeActionProvider { */ provideCodeActions(model: model.ITextModel, range: Range | Selection, context: CodeActionContext, token: CancellationToken): ProviderResult; + /** + * Given a code action fill in the edit or command. Will only invoked when missing. + */ + resolveCodeAction?(codeAction: CodeAction, token: CancellationToken): ProviderResult; + /** * Optional list of CodeActionKinds that this provider returns. */ diff --git a/src/vs/editor/contrib/codeAction/codeAction.ts b/src/vs/editor/contrib/codeAction/codeAction.ts index f54e722566e..24c60641ee9 100644 --- a/src/vs/editor/contrib/codeAction/codeAction.ts +++ b/src/vs/editor/contrib/codeAction/codeAction.ts @@ -24,9 +24,29 @@ export const sourceActionCommandId = 'editor.action.sourceAction'; export const organizeImportsCommandId = 'editor.action.organizeImports'; export const fixAllCommandId = 'editor.action.fixAll'; +export class CodeActionItem { + + constructor( + readonly action: modes.CodeAction, + readonly provider: modes.CodeActionProvider | undefined, + ) { } + + async resolve(token: CancellationToken): Promise { + // TODO@jrieken when is an item resolved already? + if (this.provider?.resolveCodeAction && !this.action.edit && !this.action.command) { + try { + this.provider.resolveCodeAction(this.action, token); + } catch (err) { + onUnexpectedExternalError(err); + } + } + return this; + } +} + export interface CodeActionSet extends IDisposable { - readonly validActions: readonly modes.CodeAction[]; - readonly allActions: readonly modes.CodeAction[]; + readonly validActions: readonly CodeActionItem[]; + readonly allActions: readonly CodeActionItem[]; readonly hasAutoFix: boolean; readonly documentation: readonly modes.Command[]; @@ -34,7 +54,7 @@ export interface CodeActionSet extends IDisposable { class ManagedCodeActionSet extends Disposable implements CodeActionSet { - private static codeActionsComparator(a: modes.CodeAction, b: modes.CodeAction): number { + private static codeActionsComparator({ action: a }: CodeActionItem, { action: b }: CodeActionItem): number { if (a.isPreferred && !b.isPreferred) { return -1; } else if (!a.isPreferred && b.isPreferred) { @@ -54,27 +74,27 @@ class ManagedCodeActionSet extends Disposable implements CodeActionSet { } } - public readonly validActions: readonly modes.CodeAction[]; - public readonly allActions: readonly modes.CodeAction[]; + public readonly validActions: readonly CodeActionItem[]; + public readonly allActions: readonly CodeActionItem[]; public constructor( - actions: readonly modes.CodeAction[], + actions: readonly CodeActionItem[], public readonly documentation: readonly modes.Command[], disposables: DisposableStore, ) { super(); this._register(disposables); this.allActions = mergeSort([...actions], ManagedCodeActionSet.codeActionsComparator); - this.validActions = this.allActions.filter(action => !action.disabled); + this.validActions = this.allActions.filter(({ action }) => !action.disabled); } public get hasAutoFix() { - return this.validActions.some(fix => !!fix.kind && CodeActionKind.QuickFix.contains(new CodeActionKind(fix.kind)) && !!fix.isPreferred); + return this.validActions.some(({ action: fix }) => !!fix.kind && CodeActionKind.QuickFix.contains(new CodeActionKind(fix.kind)) && !!fix.isPreferred); } } -const emptyCodeActionsResponse = { actions: [] as modes.CodeAction[], documentation: undefined }; +const emptyCodeActionsResponse = { actions: [] as CodeActionItem[], documentation: undefined }; export function getCodeActions( model: ITextModel, @@ -108,7 +128,10 @@ export function getCodeActions( const filteredActions = (providedCodeActions?.actions || []).filter(action => action && filtersAction(filter, action)); const documentation = getDocumentation(provider, filteredActions, filter.include); - return { actions: filteredActions, documentation }; + return { + actions: filteredActions.map(action => new CodeActionItem(action, provider)), + documentation + }; } catch (err) { if (isPromiseCanceledError(err)) { throw err; @@ -226,5 +249,5 @@ registerLanguageCommand('_executeCodeActionProvider', async function (accessor, CancellationToken.None); setTimeout(() => codeActionSet.dispose(), 100); - return codeActionSet.validActions; + return codeActionSet.validActions.map(item => item.action); }); diff --git a/src/vs/editor/contrib/codeAction/codeActionCommands.ts b/src/vs/editor/contrib/codeAction/codeActionCommands.ts index 699e05a4699..65c19a781f6 100644 --- a/src/vs/editor/contrib/codeAction/codeActionCommands.ts +++ b/src/vs/editor/contrib/codeAction/codeActionCommands.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { IAnchor } from 'vs/base/browser/ui/contextview/contextview'; +import { CancellationToken } from 'vs/base/common/cancellation'; import { IJSONSchema } from 'vs/base/common/jsonSchema'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Lazy } from 'vs/base/common/lazy'; @@ -15,8 +16,8 @@ import { IBulkEditService, ResourceEdit } from 'vs/editor/browser/services/bulkE import { IPosition } from 'vs/editor/common/core/position'; import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; -import { CodeAction, CodeActionTriggerType } from 'vs/editor/common/modes'; -import { codeActionCommandId, CodeActionSet, fixAllCommandId, organizeImportsCommandId, refactorCommandId, sourceActionCommandId } from 'vs/editor/contrib/codeAction/codeAction'; +import { CodeActionTriggerType } from 'vs/editor/common/modes'; +import { codeActionCommandId, CodeActionItem, CodeActionSet, fixAllCommandId, organizeImportsCommandId, refactorCommandId, sourceActionCommandId } from 'vs/editor/contrib/codeAction/codeAction'; import { CodeActionUi } from 'vs/editor/contrib/codeAction/codeActionUi'; import { MessageController } from 'vs/editor/contrib/message/messageController'; import * as nls from 'vs/nls'; @@ -130,14 +131,14 @@ export class QuickFixController extends Disposable implements IEditorContributio return this._model.trigger(trigger); } - private _applyCodeAction(action: CodeAction): Promise { + private _applyCodeAction(action: CodeActionItem): Promise { return this._instantiationService.invokeFunction(applyCodeAction, action, this._editor); } } export async function applyCodeAction( accessor: ServicesAccessor, - action: CodeAction, + item: CodeActionItem, editor?: ICodeEditor, ): Promise { const bulkEditService = accessor.get(IBulkEditService); @@ -157,18 +158,20 @@ export async function applyCodeAction( }; telemetryService.publicLog2('codeAction.applyCodeAction', { - codeActionTitle: action.title, - codeActionKind: action.kind, - codeActionIsPreferred: !!action.isPreferred, + codeActionTitle: item.action.title, + codeActionKind: item.action.kind, + codeActionIsPreferred: !!item.action.isPreferred, }); - if (action.edit) { - await bulkEditService.apply(ResourceEdit.convert(action.edit), { editor, label: action.title }); + await item.resolve(CancellationToken.None); + + if (item.action.edit) { + await bulkEditService.apply(ResourceEdit.convert(item.action.edit), { editor, label: item.action.title }); } - if (action.command) { + if (item.action.command) { try { - await commandService.executeCommand(action.command.id, ...(action.command.arguments || [])); + await commandService.executeCommand(item.action.command.id, ...(item.action.command.arguments || [])); } catch (err) { const message = asMessage(err); notificationService.error( diff --git a/src/vs/editor/contrib/codeAction/codeActionMenu.ts b/src/vs/editor/contrib/codeAction/codeActionMenu.ts index 0c9ef9ec71a..186eacd2e34 100644 --- a/src/vs/editor/contrib/codeAction/codeActionMenu.ts +++ b/src/vs/editor/contrib/codeAction/codeActionMenu.ts @@ -14,14 +14,14 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { IPosition, Position } from 'vs/editor/common/core/position'; import { ScrollType } from 'vs/editor/common/editorCommon'; import { CodeAction, CodeActionProviderRegistry, Command } from 'vs/editor/common/modes'; -import { codeActionCommandId, CodeActionSet, fixAllCommandId, organizeImportsCommandId, refactorCommandId, sourceActionCommandId } from 'vs/editor/contrib/codeAction/codeAction'; +import { codeActionCommandId, CodeActionItem, CodeActionSet, fixAllCommandId, organizeImportsCommandId, refactorCommandId, sourceActionCommandId } from 'vs/editor/contrib/codeAction/codeAction'; import { CodeActionAutoApply, CodeActionCommandArgs, CodeActionTrigger, CodeActionKind } from 'vs/editor/contrib/codeAction/types'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKeybindingItem'; interface CodeActionWidgetDelegate { - onSelectCodeAction: (action: CodeAction) => Promise; + onSelectCodeAction: (action: CodeActionItem) => Promise; } interface ResolveCodeActionKeybinding { @@ -103,10 +103,10 @@ export class CodeActionMenu extends Disposable { private getMenuActions( trigger: CodeActionTrigger, - actionsToShow: readonly CodeAction[], + actionsToShow: readonly CodeActionItem[], documentation: readonly Command[] ): IAction[] { - const toCodeActionAction = (action: CodeAction): CodeActionAction => new CodeActionAction(action, () => this._delegate.onSelectCodeAction(action)); + const toCodeActionAction = (item: CodeActionItem): CodeActionAction => new CodeActionAction(item.action, () => this._delegate.onSelectCodeAction(item)); const result: IAction[] = actionsToShow .map(toCodeActionAction); @@ -117,16 +117,16 @@ export class CodeActionMenu extends Disposable { if (model && result.length) { for (const provider of CodeActionProviderRegistry.all(model)) { if (provider._getAdditionalMenuItems) { - allDocumentation.push(...provider._getAdditionalMenuItems({ trigger: trigger.type, only: trigger.filter?.include?.value }, actionsToShow)); + allDocumentation.push(...provider._getAdditionalMenuItems({ trigger: trigger.type, only: trigger.filter?.include?.value }, actionsToShow.map(item => item.action))); } } } if (allDocumentation.length) { - result.push(new Separator(), ...allDocumentation.map(command => toCodeActionAction({ + result.push(new Separator(), ...allDocumentation.map(command => toCodeActionAction(new CodeActionItem({ title: command.title, command: command, - }))); + }, undefined)))); } return result; diff --git a/src/vs/editor/contrib/codeAction/codeActionUi.ts b/src/vs/editor/contrib/codeAction/codeActionUi.ts index 6419e5e42f6..7a645a7bd0b 100644 --- a/src/vs/editor/contrib/codeAction/codeActionUi.ts +++ b/src/vs/editor/contrib/codeAction/codeActionUi.ts @@ -9,8 +9,8 @@ import { Lazy } from 'vs/base/common/lazy'; import { Disposable, MutableDisposable } from 'vs/base/common/lifecycle'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { IPosition } from 'vs/editor/common/core/position'; -import { CodeAction, CodeActionTriggerType } from 'vs/editor/common/modes'; -import { CodeActionSet } from 'vs/editor/contrib/codeAction/codeAction'; +import { CodeActionTriggerType } from 'vs/editor/common/modes'; +import { CodeActionItem, CodeActionSet } from 'vs/editor/contrib/codeAction/codeAction'; import { MessageController } from 'vs/editor/contrib/message/messageController'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { CodeActionMenu, CodeActionShowOptions } from './codeActionMenu'; @@ -29,7 +29,7 @@ export class CodeActionUi extends Disposable { quickFixActionId: string, preferredFixActionId: string, private readonly delegate: { - applyCodeAction: (action: CodeAction, regtriggerAfterApply: boolean) => Promise + applyCodeAction: (action: CodeActionItem, regtriggerAfterApply: boolean) => Promise }, @IInstantiationService instantiationService: IInstantiationService, ) { @@ -83,8 +83,8 @@ export class CodeActionUi extends Disposable { // Check to see if there is an action that we would have applied were it not invalid if (newState.trigger.context) { const invalidAction = this.getInvalidActionThatWouldHaveBeenApplied(newState.trigger, actions); - if (invalidAction && invalidAction.disabled) { - MessageController.get(this._editor).showMessage(invalidAction.disabled, newState.trigger.context.position); + if (invalidAction && invalidAction.action.disabled) { + MessageController.get(this._editor).showMessage(invalidAction.action.disabled, newState.trigger.context.position); actions.dispose(); return; } @@ -114,7 +114,7 @@ export class CodeActionUi extends Disposable { } } - private getInvalidActionThatWouldHaveBeenApplied(trigger: CodeActionTrigger, actions: CodeActionSet): CodeAction | undefined { + private getInvalidActionThatWouldHaveBeenApplied(trigger: CodeActionTrigger, actions: CodeActionSet): CodeActionItem | undefined { if (!actions.allActions.length) { return undefined; } @@ -122,13 +122,13 @@ export class CodeActionUi extends Disposable { if ((trigger.autoApply === CodeActionAutoApply.First && actions.validActions.length === 0) || (trigger.autoApply === CodeActionAutoApply.IfSingle && actions.allActions.length === 1) ) { - return actions.allActions.find(action => action.disabled); + return actions.allActions.find(({ action }) => action.disabled); } return undefined; } - private tryGetValidActionToApply(trigger: CodeActionTrigger, actions: CodeActionSet): CodeAction | undefined { + private tryGetValidActionToApply(trigger: CodeActionTrigger, actions: CodeActionSet): CodeActionItem | undefined { if (!actions.validActions.length) { return undefined; } diff --git a/src/vs/editor/contrib/codeAction/test/codeAction.test.ts b/src/vs/editor/contrib/codeAction/test/codeAction.test.ts index 85510ab2a01..53a80a51108 100644 --- a/src/vs/editor/contrib/codeAction/test/codeAction.test.ts +++ b/src/vs/editor/contrib/codeAction/test/codeAction.test.ts @@ -8,7 +8,7 @@ import { URI } from 'vs/base/common/uri'; import { Range } from 'vs/editor/common/core/range'; import { TextModel } from 'vs/editor/common/model/textModel'; import * as modes from 'vs/editor/common/modes'; -import { getCodeActions } from 'vs/editor/contrib/codeAction/codeAction'; +import { CodeActionItem, getCodeActions } from 'vs/editor/contrib/codeAction/codeAction'; import { CodeActionKind } from 'vs/editor/contrib/codeAction/types'; import { IMarkerData, MarkerSeverity } from 'vs/platform/markers/common/markers'; import { CancellationToken } from 'vs/base/common/cancellation'; @@ -117,14 +117,14 @@ suite('CodeAction', () => { const expected = [ // CodeActions with a diagnostics array are shown first ordered by diagnostics.message - testData.diagnostics.abc, - testData.diagnostics.bcd, + new CodeActionItem(testData.diagnostics.abc, provider), + new CodeActionItem(testData.diagnostics.bcd, provider), // CodeActions without diagnostics are shown in the given order without any further sorting - testData.command.abc, - testData.spelling.bcd, // empty diagnostics array - testData.tsLint.bcd, - testData.tsLint.abc + new CodeActionItem(testData.command.abc, provider), + new CodeActionItem(testData.spelling.bcd, provider), // empty diagnostics array + new CodeActionItem(testData.tsLint.bcd, provider), + new CodeActionItem(testData.tsLint.abc, provider) ]; const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Manual }, Progress.None, CancellationToken.None); @@ -144,14 +144,14 @@ suite('CodeAction', () => { { const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a') } }, Progress.None, CancellationToken.None); assert.equal(actions.length, 2); - assert.strictEqual(actions[0].title, 'a'); - assert.strictEqual(actions[1].title, 'a.b'); + assert.strictEqual(actions[0].action.title, 'a'); + assert.strictEqual(actions[1].action.title, 'a.b'); } { const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a.b') } }, Progress.None, CancellationToken.None); assert.equal(actions.length, 1); - assert.strictEqual(actions[0].title, 'a.b'); + assert.strictEqual(actions[0].action.title, 'a.b'); } { @@ -176,7 +176,7 @@ suite('CodeAction', () => { const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a') } }, Progress.None, CancellationToken.None); assert.equal(actions.length, 1); - assert.strictEqual(actions[0].title, 'a'); + assert.strictEqual(actions[0].action.title, 'a'); }); test('getCodeActions should not return source code action by default', async function () { @@ -190,13 +190,13 @@ suite('CodeAction', () => { { const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto }, Progress.None, CancellationToken.None); assert.equal(actions.length, 1); - assert.strictEqual(actions[0].title, 'b'); + assert.strictEqual(actions[0].action.title, 'b'); } { const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: CodeActionKind.Source, includeSourceActions: true } }, Progress.None, CancellationToken.None); assert.equal(actions.length, 1); - assert.strictEqual(actions[0].title, 'a'); + assert.strictEqual(actions[0].action.title, 'a'); } }); @@ -218,7 +218,7 @@ suite('CodeAction', () => { } }, Progress.None, CancellationToken.None); assert.equal(actions.length, 1); - assert.strictEqual(actions[0].title, 'b'); + assert.strictEqual(actions[0].action.title, 'b'); } }); @@ -255,7 +255,7 @@ suite('CodeAction', () => { }, Progress.None, CancellationToken.None); assert.strictEqual(didInvoke, false); assert.equal(actions.length, 1); - assert.strictEqual(actions[0].title, 'a'); + assert.strictEqual(actions[0].action.title, 'a'); } }); @@ -282,4 +282,3 @@ suite('CodeAction', () => { assert.strictEqual(wasInvoked, false); }); }); - diff --git a/src/vs/workbench/contrib/codeEditor/browser/saveParticipants.ts b/src/vs/workbench/contrib/codeEditor/browser/saveParticipants.ts index 83a504c0135..698828c06d7 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/saveParticipants.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/saveParticipants.ts @@ -344,7 +344,7 @@ class CodeActionOnSaveParticipant implements ITextFileSaveParticipant { const actionsToRun = await this.getActionsToRun(model, codeActionKind, excludes, getActionProgress, token); try { for (const action of actionsToRun.validActions) { - progress.report({ message: localize('codeAction.apply', "Applying code action '{0}'.", action.title) }); + progress.report({ message: localize('codeAction.apply', "Applying code action '{0}'.", action.action.title) }); await this.instantiationService.invokeFunction(applyCodeAction, action); } } catch { diff --git a/src/vs/workbench/contrib/markers/browser/markersTreeViewer.ts b/src/vs/workbench/contrib/markers/browser/markersTreeViewer.ts index c1f4dd65b2f..67f945f0b0d 100644 --- a/src/vs/workbench/contrib/markers/browser/markersTreeViewer.ts +++ b/src/vs/workbench/contrib/markers/browser/markersTreeViewer.ts @@ -691,14 +691,14 @@ export class MarkerViewModel extends Disposable { } private toActions(codeActions: CodeActionSet): IAction[] { - return codeActions.validActions.map(codeAction => new Action( - codeAction.command ? codeAction.command.id : codeAction.title, - codeAction.title, + return codeActions.validActions.map(item => new Action( + item.action.command ? item.action.command.id : item.action.title, + item.action.title, undefined, true, () => { return this.openFileAtMarker(this.marker) - .then(() => this.instantiationService.invokeFunction(applyCodeAction, codeAction)); + .then(() => this.instantiationService.invokeFunction(applyCodeAction, item)); })); } diff --git a/src/vs/workbench/test/browser/api/extHostLanguageFeatures.test.ts b/src/vs/workbench/test/browser/api/extHostLanguageFeatures.test.ts index df33e67802a..efc8b65b150 100644 --- a/src/vs/workbench/test/browser/api/extHostLanguageFeatures.test.ts +++ b/src/vs/workbench/test/browser/api/extHostLanguageFeatures.test.ts @@ -594,10 +594,10 @@ suite('ExtHostLanguageFeatures', function () { const { validActions: actions } = await getCodeActions(model, model.getFullModelRange(), { type: modes.CodeActionTriggerType.Manual }, Progress.None, CancellationToken.None); assert.equal(actions.length, 2); const [first, second] = actions; - assert.equal(first.title, 'Testing1'); - assert.equal(first.command!.id, 'test1'); - assert.equal(second.title, 'Testing2'); - assert.equal(second.command!.id, 'test2'); + assert.equal(first.action.title, 'Testing1'); + assert.equal(first.action.command!.id, 'test1'); + assert.equal(second.action.title, 'Testing2'); + assert.equal(second.action.command!.id, 'test2'); }); test('Quick Fix, code action data conversion', async () => { @@ -618,10 +618,10 @@ suite('ExtHostLanguageFeatures', function () { const { validActions: actions } = await getCodeActions(model, model.getFullModelRange(), { type: modes.CodeActionTriggerType.Manual }, Progress.None, CancellationToken.None); assert.equal(actions.length, 1); const [first] = actions; - assert.equal(first.title, 'Testing1'); - assert.equal(first.command!.title, 'Testing1Command'); - assert.equal(first.command!.id, 'test1'); - assert.equal(first.kind, 'test.scope'); + assert.equal(first.action.title, 'Testing1'); + assert.equal(first.action.command!.title, 'Testing1Command'); + assert.equal(first.action.command!.id, 'test1'); + assert.equal(first.action.kind, 'test.scope'); }); From 136cc276d105e7050db6e7a254362c2465184cde Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 16 Sep 2020 12:34:20 +0200 Subject: [PATCH 0020/1667] proposed API for CodeActionProvider#resolveCodeAction and all the wiring --- .../editor/contrib/codeAction/codeAction.ts | 6 ++++- src/vs/vscode.proposed.d.ts | 11 ++++++++ .../api/browser/mainThreadLanguageFeatures.ts | 16 +++++++++--- .../workbench/api/common/extHost.protocol.ts | 6 +++-- .../api/common/extHostLanguageFeatures.ts | 25 +++++++++++++++++-- 5 files changed, 56 insertions(+), 8 deletions(-) diff --git a/src/vs/editor/contrib/codeAction/codeAction.ts b/src/vs/editor/contrib/codeAction/codeAction.ts index 24c60641ee9..cd22fd6ca60 100644 --- a/src/vs/editor/contrib/codeAction/codeAction.ts +++ b/src/vs/editor/contrib/codeAction/codeAction.ts @@ -34,11 +34,15 @@ export class CodeActionItem { async resolve(token: CancellationToken): Promise { // TODO@jrieken when is an item resolved already? if (this.provider?.resolveCodeAction && !this.action.edit && !this.action.command) { + let action: modes.CodeAction | undefined | null; try { - this.provider.resolveCodeAction(this.action, token); + action = await this.provider.resolveCodeAction(this.action, token); } catch (err) { onUnexpectedExternalError(err); } + if (action) { + this.action.edit = action.edit; + } } return this; } diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 10e23905a66..55e858830d7 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -16,6 +16,17 @@ declare module 'vscode' { + //#region https://github.com/microsoft/vscode/issues/106410 + + export interface CodeActionProvider { + // TODO@jrieken make it clear that there is no support for commands, only code action + // TODO@jrieken only edit can be set + resolveCodeAction?(codeAction: T, token: CancellationToken): ProviderResult; + } + + //#endregion + + // #region auth provider: https://github.com/microsoft/vscode/issues/88309 /** diff --git a/src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts b/src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts index b3133ba44c9..635730ba75b 100644 --- a/src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts +++ b/src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts @@ -292,8 +292,8 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha // --- quick fix - $registerQuickFixSupport(handle: number, selector: IDocumentFilterDto[], metadata: ICodeActionProviderMetadataDto, displayName: string): void { - this._registrations.set(handle, modes.CodeActionProviderRegistry.register(selector, { + $registerQuickFixSupport(handle: number, selector: IDocumentFilterDto[], metadata: ICodeActionProviderMetadataDto, displayName: string, supportsResolve: boolean): void { + const provider: modes.CodeActionProvider = { provideCodeActions: async (model: ITextModel, rangeOrSelection: EditorRange | Selection, context: modes.CodeActionContext, token: CancellationToken): Promise => { const listDto = await this._proxy.$provideCodeActions(handle, model.uri, rangeOrSelection, context, token); if (!listDto) { @@ -311,7 +311,17 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha providedCodeActionKinds: metadata.providedKinds, documentation: metadata.documentation, displayName - })); + }; + + if (supportsResolve) { + provider.resolveCodeAction = async (codeAction: modes.CodeAction, token: CancellationToken): Promise => { + const data = await this._proxy.$resolveCodeAction(handle, (codeAction).cacheId!, token); + codeAction.edit = reviveWorkspaceEditDto(data); + return codeAction; + }; + } + + this._registrations.set(handle, modes.CodeActionProviderRegistry.register(selector, provider)); } // --- formatting diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index c42c42c29b2..f02c0aacd20 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -380,7 +380,7 @@ export interface MainThreadLanguageFeaturesShape extends IDisposable { $registerDocumentHighlightProvider(handle: number, selector: IDocumentFilterDto[]): void; $registerOnTypeRenameProvider(handle: number, selector: IDocumentFilterDto[], stopPattern: IRegExpDto | undefined): void; $registerReferenceSupport(handle: number, selector: IDocumentFilterDto[]): void; - $registerQuickFixSupport(handle: number, selector: IDocumentFilterDto[], metadata: ICodeActionProviderMetadataDto, displayName: string): void; + $registerQuickFixSupport(handle: number, selector: IDocumentFilterDto[], metadata: ICodeActionProviderMetadataDto, displayName: string, supportsResolve: boolean): void; $registerDocumentFormattingSupport(handle: number, selector: IDocumentFilterDto[], extensionId: ExtensionIdentifier, displayName: string): void; $registerRangeFormattingSupport(handle: number, selector: IDocumentFilterDto[], extensionId: ExtensionIdentifier, displayName: string): void; $registerOnTypeFormattingSupport(handle: number, selector: IDocumentFilterDto[], autoFormatTriggerCharacters: string[], extensionId: ExtensionIdentifier): void; @@ -1310,6 +1310,7 @@ export function reviveWorkspaceEditDto(data: IWorkspaceEditDto | undefined): mod export type ICommandDto = ObjectIdentifier & modes.Command; export interface ICodeActionDto { + cacheId?: ChainedCacheId; title: string; edit?: IWorkspaceEditDto; diagnostics?: IMarkerData[]; @@ -1320,7 +1321,7 @@ export interface ICodeActionDto { } export interface ICodeActionListDto { - cacheId: number; + cacheId: CacheId; actions: ReadonlyArray; } @@ -1388,6 +1389,7 @@ export interface ExtHostLanguageFeaturesShape { $provideOnTypeRenameRanges(handle: number, resource: UriComponents, position: IPosition, token: CancellationToken): Promise<{ ranges: IRange[]; wordPattern?: IRegExpDto; } | undefined>; $provideReferences(handle: number, resource: UriComponents, position: IPosition, context: modes.ReferenceContext, token: CancellationToken): Promise; $provideCodeActions(handle: number, resource: UriComponents, rangeOrSelection: IRange | ISelection, context: modes.CodeActionContext, token: CancellationToken): Promise; + $resolveCodeAction(handle: number, id: ChainedCacheId, token: CancellationToken): Promise; $releaseCodeActions(handle: number, cacheId: number): void; $provideDocumentFormattingEdits(handle: number, resource: UriComponents, options: modes.FormattingOptions, token: CancellationToken): Promise; $provideDocumentRangeFormattingEdits(handle: number, resource: UriComponents, range: IRange, options: modes.FormattingOptions, token: CancellationToken): Promise; diff --git a/src/vs/workbench/api/common/extHostLanguageFeatures.ts b/src/vs/workbench/api/common/extHostLanguageFeatures.ts index 80258e2b7d7..853bd792e47 100644 --- a/src/vs/workbench/api/common/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/common/extHostLanguageFeatures.ts @@ -413,7 +413,8 @@ class CodeActionAdapter { this._disposables.set(cacheId, disposables); const actions: CustomCodeAction[] = []; - for (const candidate of commandsOrActions) { + for (let i = 0; i < commandsOrActions.length; i++) { + const candidate = commandsOrActions[i]; if (!candidate) { continue; } @@ -439,6 +440,7 @@ class CodeActionAdapter { // new school: convert code action actions.push({ + cacheId: [cacheId, i], title: candidate.title, command: candidate.command && this._commands.toInternal(candidate.command, disposables), diagnostics: candidate.diagnostics && candidate.diagnostics.map(typeConvert.Diagnostic.from), @@ -454,6 +456,21 @@ class CodeActionAdapter { }); } + public async resolveCodeAction(id: extHostProtocol.ChainedCacheId, token: CancellationToken): Promise { + const [sessionId, itemId] = id; + const item = this._cache.get(sessionId, itemId); + if (!item || CodeActionAdapter._isCommand(item)) { + return undefined; // code actions only! + } + if (!this._provider.resolveCodeAction) { + return; // this should not happen... + } + const resolvedItem = await this._provider.resolveCodeAction(item, token); + return resolvedItem?.edit + ? typeConvert.WorkspaceEdit.from(resolvedItem.edit) + : undefined; + } + public releaseCodeActions(cachedId: number): void { this._disposables.get(cachedId)?.dispose(); this._disposables.delete(cachedId); @@ -1595,7 +1612,7 @@ export class ExtHostLanguageFeatures implements extHostProtocol.ExtHostLanguageF kind: x.kind.value, command: this._commands.converter.toInternal(x.command, store), })) - }, ExtHostLanguageFeatures._extLabel(extension)); + }, ExtHostLanguageFeatures._extLabel(extension), Boolean(extension.enableProposedApi && provider.resolveCodeAction)); store.add(this._createDisposable(handle)); return store; } @@ -1605,6 +1622,10 @@ export class ExtHostLanguageFeatures implements extHostProtocol.ExtHostLanguageF return this._withAdapter(handle, CodeActionAdapter, adapter => adapter.provideCodeActions(URI.revive(resource), rangeOrSelection, context, token), undefined); } + $resolveCodeAction(handle: number, id: extHostProtocol.ChainedCacheId, token: CancellationToken): Promise { + return this._withAdapter(handle, CodeActionAdapter, adapter => adapter.resolveCodeAction(id, token), undefined); + } + $releaseCodeActions(handle: number, cacheId: number): void { this._withAdapter(handle, CodeActionAdapter, adapter => Promise.resolve(adapter.releaseCodeActions(cacheId)), undefined); } From f8ad845310290d1e8788edb0c785d6fdae9dd3f0 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 16 Sep 2020 13:52:26 +0200 Subject: [PATCH 0021/1667] Allow executeCodeActionProvider API command to set the number of items to resolve, unit test to check that and the whole resolve machinery --- .../editor/contrib/codeAction/codeAction.ts | 17 ++++++++-- .../api/common/extHostApiCommands.ts | 7 ++-- .../api/common/extHostLanguageFeatures.ts | 2 +- .../browser/api/extHostApiCommands.test.ts | 32 +++++++++++++++++++ 4 files changed, 52 insertions(+), 6 deletions(-) diff --git a/src/vs/editor/contrib/codeAction/codeAction.ts b/src/vs/editor/contrib/codeAction/codeAction.ts index cd22fd6ca60..eb0bdba64af 100644 --- a/src/vs/editor/contrib/codeAction/codeAction.ts +++ b/src/vs/editor/contrib/codeAction/codeAction.ts @@ -225,7 +225,7 @@ function getDocumentation( } registerLanguageCommand('_executeCodeActionProvider', async function (accessor, args): Promise> { - const { resource, rangeOrSelection, kind } = args; + const { resource, rangeOrSelection, kind, itemResolveCount } = args; if (!(resource instanceof URI)) { throw illegalArgument(); } @@ -252,6 +252,17 @@ registerLanguageCommand('_executeCodeActionProvider', async function (accessor, Progress.None, CancellationToken.None); - setTimeout(() => codeActionSet.dispose(), 100); - return codeActionSet.validActions.map(item => item.action); + + const resolving: Promise[] = []; + const resolveCount = Math.min(codeActionSet.validActions.length, typeof itemResolveCount === 'number' ? itemResolveCount : 0); + for (let i = 0; i < resolveCount; i++) { + resolving.push(codeActionSet.validActions[i].resolve(CancellationToken.None)); + } + + try { + await Promise.all(resolving); + return codeActionSet.validActions.map(item => item.action); + } finally { + setTimeout(() => codeActionSet.dispose(), 100); + } }); diff --git a/src/vs/workbench/api/common/extHostApiCommands.ts b/src/vs/workbench/api/common/extHostApiCommands.ts index e7cac07ee3b..956f358bcd5 100644 --- a/src/vs/workbench/api/common/extHostApiCommands.ts +++ b/src/vs/workbench/api/common/extHostApiCommands.ts @@ -282,6 +282,8 @@ export class ExtHostApiCommands { { name: 'uri', description: 'Uri of a text document', constraint: URI }, { name: 'rangeOrSelection', description: 'Range in a text document. Some refactoring provider requires Selection object.', constraint: types.Range }, { name: 'kind', description: '(optional) Code action kind to return code actions for', constraint: (value: any) => !value || typeof value.value === 'string' }, + { name: 'itemResolveCount', description: '(optional) Number of code actions to resolve (too large numbers slow down code actions)', constraint: (value: any) => value === undefined || typeof value === 'number' } + ], returns: 'A promise that resolves to an array of Command-instances.' }); @@ -436,13 +438,14 @@ export class ExtHostApiCommands { } - private _executeCodeActionProvider(resource: URI, rangeOrSelection: types.Range | types.Selection, kind?: string): Promise<(vscode.CodeAction | vscode.Command | undefined)[] | undefined> { + private _executeCodeActionProvider(resource: URI, rangeOrSelection: types.Range | types.Selection, kind?: string, itemResolveCount?: number): Promise<(vscode.CodeAction | vscode.Command | undefined)[] | undefined> { const args = { resource, rangeOrSelection: types.Selection.isSelection(rangeOrSelection) ? typeConverters.Selection.from(rangeOrSelection) : typeConverters.Range.from(rangeOrSelection), - kind + kind, + itemResolveCount, }; return this._commands.executeCommand('_executeCodeActionProvider', args) .then(tryMapWith(codeAction => { diff --git a/src/vs/workbench/api/common/extHostLanguageFeatures.ts b/src/vs/workbench/api/common/extHostLanguageFeatures.ts index 853bd792e47..faab8cd6491 100644 --- a/src/vs/workbench/api/common/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/common/extHostLanguageFeatures.ts @@ -1612,7 +1612,7 @@ export class ExtHostLanguageFeatures implements extHostProtocol.ExtHostLanguageF kind: x.kind.value, command: this._commands.converter.toInternal(x.command, store), })) - }, ExtHostLanguageFeatures._extLabel(extension), Boolean(extension.enableProposedApi && provider.resolveCodeAction)); + }, ExtHostLanguageFeatures._extLabel(extension), Boolean(provider.resolveCodeAction)); store.add(this._createDisposable(handle)); return store; } diff --git a/src/vs/workbench/test/browser/api/extHostApiCommands.test.ts b/src/vs/workbench/test/browser/api/extHostApiCommands.test.ts index f5290dd2f74..e13e1e2b736 100644 --- a/src/vs/workbench/test/browser/api/extHostApiCommands.test.ts +++ b/src/vs/workbench/test/browser/api/extHostApiCommands.test.ts @@ -925,6 +925,38 @@ suite('ExtHostLanguageFeatureCommands', function () { }); }); + test('resolving code action', async function () { + + let didCallResolve = 0; + class MyAction extends types.CodeAction { } + + disposables.push(extHost.registerCodeActionProvider(nullExtensionDescription, defaultSelector, { + provideCodeActions(document, rangeOrSelection): vscode.CodeAction[] { + return [new MyAction('title', types.CodeActionKind.Empty.append('foo'))]; + }, + resolveCodeAction(action): vscode.CodeAction { + assert.ok(action instanceof MyAction); + + didCallResolve += 1; + action.title = 'resolved title'; + action.edit = new types.WorkspaceEdit(); + return action; + } + })); + + const selection = new types.Selection(0, 0, 1, 1); + + await rpcProtocol.sync(); + + const value = await commands.executeCommand('vscode.executeCodeActionProvider', model.uri, selection, undefined, 1000); + assert.equal(didCallResolve, 1); + assert.equal(value.length, 1); + + const [first] = value; + assert.equal(first.title, 'title'); // does NOT change + assert.ok(first.edit); // is set + }); + // --- code lens test('CodeLens, back and forth', function () { From a9a9512290833b12a8971d7387f5882934bce68b Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Wed, 16 Sep 2020 11:45:34 -0500 Subject: [PATCH 0022/1667] Remove unused import --- .../contrib/terminal/browser/widgets/terminalHoverWidget.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminal/browser/widgets/terminalHoverWidget.ts b/src/vs/workbench/contrib/terminal/browser/widgets/terminalHoverWidget.ts index 80d37019023..fcf02fb583e 100644 --- a/src/vs/workbench/contrib/terminal/browser/widgets/terminalHoverWidget.ts +++ b/src/vs/workbench/contrib/terminal/browser/widgets/terminalHoverWidget.ts @@ -12,7 +12,6 @@ import type { IViewportRange } from 'xterm'; import { IHoverTarget, IHoverService } from 'vs/workbench/services/hover/browser/hover'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { editorHoverHighlight } from 'vs/platform/theme/common/colorRegistry'; -import { AnchorPosition } from 'vs/base/browser/ui/contextview/contextview'; const $ = dom.$; From 989f251ff175fe336d36ecc88ee4ba41d9f35416 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 16 Sep 2020 12:52:12 -0400 Subject: [PATCH 0023/1667] Fixes #106829 --- src/vs/base/browser/ui/dropdown/dropdownActionViewItem.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/base/browser/ui/dropdown/dropdownActionViewItem.ts b/src/vs/base/browser/ui/dropdown/dropdownActionViewItem.ts index 1181ebf8333..54d10a71de3 100644 --- a/src/vs/base/browser/ui/dropdown/dropdownActionViewItem.ts +++ b/src/vs/base/browser/ui/dropdown/dropdownActionViewItem.ts @@ -62,7 +62,7 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem { let classNames: string[] = []; if (typeof this.options.classNames === 'string') { - classNames = this.options.classNames.split(/\W+/g).filter(s => !!s); + classNames = this.options.classNames.split(/\s+/g).filter(s => !!s); } else if (this.options.classNames) { classNames = this.options.classNames; } From 844321a7f209d41a144c2b6a08d74cdbdfe34850 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Tue, 15 Sep 2020 10:43:00 -0700 Subject: [PATCH 0024/1667] normalize eol for build folder --- build/.gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/.gitattributes diff --git a/build/.gitattributes b/build/.gitattributes new file mode 100644 index 00000000000..fcadb2cf979 --- /dev/null +++ b/build/.gitattributes @@ -0,0 +1 @@ +* text eol=lf From d8baf61913ae082a038d3acb26032eaff5b16180 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 3 Sep 2020 16:53:59 -0400 Subject: [PATCH 0025/1667] Adds resourcePath & resourceFolder context keys Allows for more powerful use of the new in operator --- src/vs/workbench/common/resources.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/common/resources.ts b/src/vs/workbench/common/resources.ts index 18ea0bfedb4..df4cc365a95 100644 --- a/src/vs/workbench/common/resources.ts +++ b/src/vs/workbench/common/resources.ts @@ -6,7 +6,7 @@ import { URI } from 'vs/base/common/uri'; import * as objects from 'vs/base/common/objects'; import { Emitter } from 'vs/base/common/event'; -import { basename, extname, relativePath } from 'vs/base/common/resources'; +import { basename, dirname, extname, relativePath } from 'vs/base/common/resources'; import { RawContextKey, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { IModeService } from 'vs/editor/common/services/modeService'; import { IFileService } from 'vs/platform/files/common/files'; @@ -24,6 +24,8 @@ export class ResourceContextKey extends Disposable implements IContextKey { static readonly Scheme = new RawContextKey('resourceScheme', undefined); static readonly Filename = new RawContextKey('resourceFilename', undefined); + static readonly Folder = new RawContextKey('resourceFolder', undefined); + static readonly Path = new RawContextKey('resourcePath', undefined); static readonly LangId = new RawContextKey('resourceLangId', undefined); static readonly Resource = new RawContextKey('resource', undefined); static readonly Extension = new RawContextKey('resourceExtname', undefined); @@ -33,6 +35,8 @@ export class ResourceContextKey extends Disposable implements IContextKey { private readonly _resourceKey: IContextKey; private readonly _schemeKey: IContextKey; private readonly _filenameKey: IContextKey; + private readonly _folderKey: IContextKey; + private readonly _pathKey: IContextKey; private readonly _langIdKey: IContextKey; private readonly _extensionKey: IContextKey; private readonly _hasResource: IContextKey; @@ -47,6 +51,8 @@ export class ResourceContextKey extends Disposable implements IContextKey { this._schemeKey = ResourceContextKey.Scheme.bindTo(this._contextKeyService); this._filenameKey = ResourceContextKey.Filename.bindTo(this._contextKeyService); + this._folderKey = ResourceContextKey.Folder.bindTo(this._contextKeyService); + this._pathKey = ResourceContextKey.Path.bindTo(this._contextKeyService); this._langIdKey = ResourceContextKey.LangId.bindTo(this._contextKeyService); this._resourceKey = ResourceContextKey.Resource.bindTo(this._contextKeyService); this._extensionKey = ResourceContextKey.Extension.bindTo(this._contextKeyService); @@ -70,6 +76,8 @@ export class ResourceContextKey extends Disposable implements IContextKey { this._resourceKey.set(value); this._schemeKey.set(value ? value.scheme : null); this._filenameKey.set(value ? basename(value) : null); + this._folderKey.set(value ? dirname(value).path : null); + this._pathKey.set(value ? value.path : null); this._langIdKey.set(value ? this._modeService.getModeIdByFilepathOrFirstLine(value) : null); this._extensionKey.set(value ? extname(value) : null); this._hasResource.set(!!value); From 7bf5773eb288fd71ae0d3aa256988949c95abcf8 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Tue, 15 Sep 2020 03:29:22 -0400 Subject: [PATCH 0026/1667] Changes to use fsPath --- src/vs/workbench/common/resources.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/common/resources.ts b/src/vs/workbench/common/resources.ts index df4cc365a95..be7617ad1a5 100644 --- a/src/vs/workbench/common/resources.ts +++ b/src/vs/workbench/common/resources.ts @@ -76,8 +76,8 @@ export class ResourceContextKey extends Disposable implements IContextKey { this._resourceKey.set(value); this._schemeKey.set(value ? value.scheme : null); this._filenameKey.set(value ? basename(value) : null); - this._folderKey.set(value ? dirname(value).path : null); - this._pathKey.set(value ? value.path : null); + this._folderKey.set(value ? dirname(value).fsPath : null); + this._pathKey.set(value ? value.fsPath : null); this._langIdKey.set(value ? this._modeService.getModeIdByFilepathOrFirstLine(value) : null); this._extensionKey.set(value ? extname(value) : null); this._hasResource.set(!!value); From 240afbde5815037330d3dcd9a8acefb60ff12e3b Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 16 Sep 2020 01:36:33 -0700 Subject: [PATCH 0027/1667] Use array.equals --- .../src/features/previewConfig.ts | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/extensions/markdown-language-features/src/features/previewConfig.ts b/extensions/markdown-language-features/src/features/previewConfig.ts index ed09a9ce46e..679f3c3ad77 100644 --- a/extensions/markdown-language-features/src/features/previewConfig.ts +++ b/extensions/markdown-language-features/src/features/previewConfig.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; +import { equals } from '../util/arrays'; export class MarkdownPreviewConfiguration { public static getForResource(resource: vscode.Uri) { @@ -21,7 +22,7 @@ export class MarkdownPreviewConfiguration { public readonly lineHeight: number; public readonly fontSize: number; public readonly fontFamily: string | undefined; - public readonly styles: string[]; + public readonly styles: readonly string[]; private constructor(resource: vscode.Uri) { const editorConfig = vscode.workspace.getConfiguration('editor', resource); @@ -49,7 +50,7 @@ export class MarkdownPreviewConfiguration { } public isEqualTo(otherConfig: MarkdownPreviewConfiguration) { - for (let key in this) { + for (const key in this) { if (this.hasOwnProperty(key) && key !== 'styles') { if (this[key] !== otherConfig[key]) { return false; @@ -57,17 +58,7 @@ export class MarkdownPreviewConfiguration { } } - // Check styles - if (this.styles.length !== otherConfig.styles.length) { - return false; - } - for (let i = 0; i < this.styles.length; ++i) { - if (this.styles[i] !== otherConfig.styles[i]) { - return false; - } - } - - return true; + return equals(this.styles, otherConfig.styles); } [key: string]: any; From d1b49cd8b9034a9e35e9d1484d327a723bc13b43 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 16 Sep 2020 08:47:51 -0700 Subject: [PATCH 0028/1667] Adding more explicit typings for TS 4.1 new Promise logic --- .../src/singlefolder-tests/languages.test.ts | 4 ++-- .../src/singlefolder-tests/window.test.ts | 10 +++++----- .../src/singlefolder-tests/workspace.tasks.test.ts | 4 ++-- extensions/vscode-notebook-tests/src/notebook.test.ts | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/languages.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/languages.test.ts index 8c407fb6c8b..a59841f6689 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/languages.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/languages.test.ts @@ -31,7 +31,7 @@ suite('vscode API - languages', () => { let clock = 0; const disposables: vscode.Disposable[] = []; - let close = new Promise(resolve => { + let close = new Promise(resolve => { disposables.push(vscode.workspace.onDidCloseTextDocument(e => { if (e === doc) { assert.equal(doc.languageId, langIdNow); @@ -41,7 +41,7 @@ suite('vscode API - languages', () => { } })); }); - let open = new Promise(resolve => { + let open = new Promise(resolve => { disposables.push(vscode.workspace.onDidOpenTextDocument(e => { if (e === doc) { // same instance! assert.equal(doc.languageId, 'json'); diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts index 9187b34e548..3f4fd2366ce 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts @@ -85,7 +85,7 @@ suite('vscode API - window', () => { let [one, two] = editors; - await new Promise(resolve => { + await new Promise(resolve => { let registration2 = window.onDidChangeTextEditorViewColumn(event => { actualEvent = event; registration2.dispose(); @@ -120,7 +120,7 @@ suite('vscode API - window', () => { let [, two] = editors; two.show(); - return new Promise(resolve => { + return new Promise(resolve => { let registration2 = window.onDidChangeTextEditorViewColumn(event => { actualEvents.push(event); @@ -433,7 +433,7 @@ suite('vscode API - window', () => { let i = 0; const resolves: ((value: string) => void)[] = []; let done: () => void; - const unexpected = new Promise((resolve, reject) => { + const unexpected = new Promise((resolve, reject) => { done = () => resolve(); resolves.push(reject); }); @@ -594,7 +594,7 @@ suite('vscode API - window', () => { function createQuickPickTracker() { const resolves: ((value: T) => void)[] = []; let done: () => void; - const unexpected = new Promise((resolve, reject) => { + const unexpected = new Promise((resolve, reject) => { done = () => resolve(); resolves.push(reject); }); @@ -613,7 +613,7 @@ suite('vscode API - window', () => { return workspace.openTextDocument(join(workspace.rootPath || '', './far.js')).then(doc => window.showTextDocument(doc)).then(editor => { - return new Promise((resolve, _reject) => { + return new Promise((resolve, _reject) => { let subscription = window.onDidChangeTextEditorSelection(e => { assert.ok(e.textEditor === editor); diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts index 37426834335..c831e6d4306 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts @@ -168,7 +168,7 @@ import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomEx }); test('Execution from onDidEndTaskProcess and onDidStartTaskProcess are equal to original', () => { - return new Promise(async (resolve) => { + return new Promise(async (resolve) => { const task = new Task({ type: 'testTask' }, TaskScope.Workspace, 'echo', 'testTask', new ShellExecution('echo', ['hello test'])); let taskExecution: TaskExecution | undefined; const executeDoneEvent: EventEmitter = new EventEmitter(); @@ -213,7 +213,7 @@ import { window, tasks, Disposable, TaskDefinition, Task, EventEmitter, CustomEx // https://github.com/microsoft/vscode/issues/100577 test('A CustomExecution task can be fetched and executed', () => { - return new Promise(async (resolve, reject) => { + return new Promise(async (resolve, reject) => { class CustomTerminal implements Pseudoterminal { private readonly writeEmitter = new EventEmitter(); public readonly onDidWrite: Event = this.writeEmitter.event; diff --git a/extensions/vscode-notebook-tests/src/notebook.test.ts b/extensions/vscode-notebook-tests/src/notebook.test.ts index 6bb916b5d0e..e3ea9eefece 100644 --- a/extensions/vscode-notebook-tests/src/notebook.test.ts +++ b/extensions/vscode-notebook-tests/src/notebook.test.ts @@ -57,7 +57,7 @@ async function splitEditor() { } async function saveFileAndCloseAll(resource: vscode.Uri) { - const documentClosed = new Promise((resolve, _reject) => { + const documentClosed = new Promise((resolve, _reject) => { const d = vscode.notebook.onDidCloseNotebookDocument(e => { if (e.uri.toString() === resource.toString()) { d.dispose(); @@ -71,7 +71,7 @@ async function saveFileAndCloseAll(resource: vscode.Uri) { } async function saveAllFilesAndCloseAll(resource: vscode.Uri | undefined) { - const documentClosed = new Promise((resolve, _reject) => { + const documentClosed = new Promise((resolve, _reject) => { if (!resource) { return resolve(); } From 50cc1d0e9777f3f76f460c24feb139ca695ff506 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 16 Sep 2020 11:48:21 -0700 Subject: [PATCH 0029/1667] Update to use TS 4.1 for building VS Code --- build/package.json | 2 +- build/yarn.lock | 8 ++++---- extensions/git/src/git.ts | 2 +- extensions/git/src/util.ts | 2 +- extensions/github-authentication/src/common/utils.ts | 2 +- extensions/merge-conflict/src/delayer.ts | 6 +++--- .../php-language-features/src/features/utils/async.ts | 6 +++--- .../src/languageFeatures/fixAll.ts | 2 +- .../src/languageFeatures/semanticTokens.ts | 2 +- .../src/test/referencesCodeLens.test.ts | 2 +- .../typescript-language-features/src/test/testUtils.ts | 4 ++-- .../typescript-language-features/src/tsServer/server.ts | 2 +- .../src/typescriptServiceClient.ts | 2 +- .../typescript-language-features/src/utils/async.ts | 6 +++--- .../src/utils/typingsStatus.ts | 2 +- .../src/singlefolder-tests/workspace.test.ts | 2 +- package.json | 2 +- src/vs/monaco.d.ts | 2 +- .../platform/contextkey/test/browser/contextkey.test.ts | 2 +- src/vs/workbench/browser/dnd.ts | 2 +- src/vs/workbench/contrib/debug/browser/rawDebugSession.ts | 2 +- yarn.lock | 8 ++++---- 22 files changed, 35 insertions(+), 35 deletions(-) diff --git a/build/package.json b/build/package.json index e185594554b..73c7d0a7dae 100644 --- a/build/package.json +++ b/build/package.json @@ -45,7 +45,7 @@ "minimist": "^1.2.3", "request": "^2.85.0", "terser": "4.3.8", - "typescript": "^4.1.0-dev.20200824", + "typescript": "^4.1.0-dev.20200916", "vsce": "1.48.0", "vscode-telemetry-extractor": "^1.6.0", "xml2js": "^0.4.17" diff --git a/build/yarn.lock b/build/yarn.lock index 01ebd186c4c..236831e9561 100644 --- a/build/yarn.lock +++ b/build/yarn.lock @@ -2535,10 +2535,10 @@ typescript@^3.0.1: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g== -typescript@^4.1.0-dev.20200824: - version "4.1.0-dev.20200824" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.0-dev.20200824.tgz#34c92d9b6e5124600658c0d4e9b8c125beaf577d" - integrity sha512-hTJfocmebnMKoqRw/xs3bL61z87XXtvOUwYtM7zaCX9mAvnfdo1x1bzQlLZAsvdzRIgAHPJQYbqYHKygWkDw6g== +typescript@^4.1.0-dev.20200916: + version "4.1.0-dev.20200916" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.0-dev.20200916.tgz#b2c803a39d9335086033009903b03e7e53e39223" + integrity sha512-ly2k/AZ3AyfIyLWhBSnW3x7aDufIS9uNRagFZin36jXb6DvZEZwtyx138u8iSvtKE1AV/VNyWLLBkZYojgBM1g== typical@^4.0.0: version "4.0.0" diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index 2383e5cb401..84b0eb1e0a5 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -445,7 +445,7 @@ export class Git { const [, letter] = match; try { - const networkPath = await new Promise(resolve => + const networkPath = await new Promise(resolve => realpath.native(`${letter}:`, { encoding: 'utf8' }, (err, resolvedPath) => resolve(err !== null ? undefined : resolvedPath), ), diff --git a/extensions/git/src/util.ts b/extensions/git/src/util.ts index bc73567dc75..89c7cbe688b 100644 --- a/extensions/git/src/util.ts +++ b/extensions/git/src/util.ts @@ -336,7 +336,7 @@ export function* splitInChunks(array: string[], maxChunkLength: number): Iterabl interface ILimitedTaskFactory { factory: () => Promise; - c: (value?: T | Promise) => void; + c: (value: T | Promise) => void; e: (error?: any) => void; } diff --git a/extensions/github-authentication/src/common/utils.ts b/extensions/github-authentication/src/common/utils.ts index 6b18a9221db..b6fc3361315 100644 --- a/extensions/github-authentication/src/common/utils.ts +++ b/extensions/github-authentication/src/common/utils.ts @@ -25,7 +25,7 @@ export interface PromiseAdapter { ( value: T, resolve: - (value?: U | PromiseLike) => void, + (value: U | PromiseLike) => void, reject: (reason: any) => void ): any; diff --git a/extensions/merge-conflict/src/delayer.ts b/extensions/merge-conflict/src/delayer.ts index 3b8f8e01c51..e4ef18e09c9 100644 --- a/extensions/merge-conflict/src/delayer.ts +++ b/extensions/merge-conflict/src/delayer.ts @@ -12,7 +12,7 @@ export class Delayer { public defaultDelay: number; private timeout: any; // Timer private completionPromise: Promise | null; - private onSuccess: ((value?: T | Thenable | undefined) => void) | null; + private onSuccess: ((value: T | PromiseLike | undefined) => void) | null; private task: ITask | null; constructor(defaultDelay: number) { @@ -30,7 +30,7 @@ export class Delayer { } if (!this.completionPromise) { - this.completionPromise = new Promise((resolve) => { + this.completionPromise = new Promise((resolve) => { this.onSuccess = resolve; }).then(() => { this.completionPromise = null; @@ -76,4 +76,4 @@ export class Delayer { this.timeout = null; } } -} \ No newline at end of file +} diff --git a/extensions/php-language-features/src/features/utils/async.ts b/extensions/php-language-features/src/features/utils/async.ts index f590e7d0014..866118beac0 100644 --- a/extensions/php-language-features/src/features/utils/async.ts +++ b/extensions/php-language-features/src/features/utils/async.ts @@ -105,7 +105,7 @@ export class Delayer { public defaultDelay: number; private timeout: NodeJS.Timer | null; private completionPromise: Promise | null; - private onResolve: ((value: T | Thenable | undefined) => void) | null; + private onResolve: ((value: T | PromiseLike | undefined) => void) | null; private task: ITask | null; constructor(defaultDelay: number) { @@ -121,7 +121,7 @@ export class Delayer { this.cancelTimeout(); if (!this.completionPromise) { - this.completionPromise = new Promise((resolve) => { + this.completionPromise = new Promise((resolve) => { this.onResolve = resolve; }).then(() => { this.completionPromise = null; @@ -182,4 +182,4 @@ export class ThrottledDelayer extends Delayer> { public trigger(promiseFactory: ITask>, delay?: number): Promise> { return super.trigger(() => this.throttler.queue(promiseFactory), delay); } -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/languageFeatures/fixAll.ts b/extensions/typescript-language-features/src/languageFeatures/fixAll.ts index 6a43c535a8b..426a0e4636b 100644 --- a/extensions/typescript-language-features/src/languageFeatures/fixAll.ts +++ b/extensions/typescript-language-features/src/languageFeatures/fixAll.ts @@ -120,7 +120,7 @@ async function buildCombinedFix( // #region Source Actions abstract class SourceAction extends vscode.CodeAction { - abstract async build( + abstract build( client: ITypeScriptServiceClient, file: string, diagnostics: readonly vscode.Diagnostic[], diff --git a/extensions/typescript-language-features/src/languageFeatures/semanticTokens.ts b/extensions/typescript-language-features/src/languageFeatures/semanticTokens.ts index c404ac0b95a..3c2dd7a6458 100644 --- a/extensions/typescript-language-features/src/languageFeatures/semanticTokens.ts +++ b/extensions/typescript-language-features/src/languageFeatures/semanticTokens.ts @@ -134,7 +134,7 @@ class DocumentSemanticTokensProvider implements vscode.DocumentSemanticTokensPro function waitForDocumentChangesToEnd(document: vscode.TextDocument) { let version = document.version; - return new Promise((s) => { + return new Promise((s) => { let iv = setInterval(_ => { if (document.version === version) { clearInterval(iv); diff --git a/extensions/typescript-language-features/src/test/referencesCodeLens.test.ts b/extensions/typescript-language-features/src/test/referencesCodeLens.test.ts index f40edb2ca5d..f848d0f4d03 100644 --- a/extensions/typescript-language-features/src/test/referencesCodeLens.test.ts +++ b/extensions/typescript-language-features/src/test/referencesCodeLens.test.ts @@ -17,7 +17,7 @@ async function updateConfig(newConfig: VsCodeConfiguration): Promise + await new Promise((resolve, reject) => config.update(configKey, newConfig[configKey], vscode.ConfigurationTarget.Global) .then(() => resolve(), reject)); } diff --git a/extensions/typescript-language-features/src/test/testUtils.ts b/extensions/typescript-language-features/src/test/testUtils.ts index ea5e41a26a8..c0ba9a47730 100644 --- a/extensions/typescript-language-features/src/test/testUtils.ts +++ b/extensions/typescript-language-features/src/test/testUtils.ts @@ -68,7 +68,7 @@ export function withRandomFileEditor( }); } -export const wait = (ms: number) => new Promise(resolve => setTimeout(() => resolve(), ms)); +export const wait = (ms: number) => new Promise(resolve => setTimeout(() => resolve(), ms)); export const joinLines = (...args: string[]) => args.join(os.platform() === 'win32' ? '\r\n' : '\n'); @@ -105,7 +105,7 @@ export async function updateConfig(documentUri: vscode.Uri, newConfig: VsCodeCon for (const configKey of Object.keys(newConfig)) { oldConfig[configKey] = config.get(configKey); - await new Promise((resolve, reject) => + await new Promise((resolve, reject) => config.update(configKey, newConfig[configKey], vscode.ConfigurationTarget.Global) .then(() => resolve(), reject)); } diff --git a/extensions/typescript-language-features/src/tsServer/server.ts b/extensions/typescript-language-features/src/tsServer/server.ts index fe8671ab906..d6294f2512d 100644 --- a/extensions/typescript-language-features/src/tsServer/server.ts +++ b/extensions/typescript-language-features/src/tsServer/server.ts @@ -215,7 +215,7 @@ export class ProcessBasedTsServer extends Disposable implements ITypeScriptServe let result: Promise> | undefined; if (executeInfo.expectsResult) { result = new Promise>((resolve, reject) => { - this._callbacks.add(request.seq, { onSuccess: resolve, onError: reject, queuingStartTime: Date.now(), isAsync: executeInfo.isAsync }, executeInfo.isAsync); + this._callbacks.add(request.seq, { onSuccess: resolve as () => ServerResponse.Response | undefined, onError: reject, queuingStartTime: Date.now(), isAsync: executeInfo.isAsync }, executeInfo.isAsync); if (executeInfo.token) { executeInfo.token.onCancellationRequested(() => { diff --git a/extensions/typescript-language-features/src/typescriptServiceClient.ts b/extensions/typescript-language-features/src/typescriptServiceClient.ts index c068f94189b..530e79c7fbd 100644 --- a/extensions/typescript-language-features/src/typescriptServiceClient.ts +++ b/extensions/typescript-language-features/src/typescriptServiceClient.ts @@ -1028,7 +1028,7 @@ class ServerInitializingIndicator extends Disposable { vscode.window.withProgress({ location: vscode.ProgressLocation.Window, title: localize('serverLoading.progress', "Initializing JS/TS language features"), - }, () => new Promise((resolve, reject) => { + }, () => new Promise((resolve, reject) => { this._task = { project: projectName, resolve, reject }; })); } diff --git a/extensions/typescript-language-features/src/utils/async.ts b/extensions/typescript-language-features/src/utils/async.ts index 069b0bffd57..a43cd07cbb4 100644 --- a/extensions/typescript-language-features/src/utils/async.ts +++ b/extensions/typescript-language-features/src/utils/async.ts @@ -12,7 +12,7 @@ export class Delayer { public defaultDelay: number; private timeout: any; // Timer private completionPromise: Promise | null; - private onSuccess: ((value?: T | Thenable) => void) | null; + private onSuccess: ((value: T | PromiseLike | undefined) => void) | null; private task: ITask | null; constructor(defaultDelay: number) { @@ -30,7 +30,7 @@ export class Delayer { } if (!this.completionPromise) { - this.completionPromise = new Promise((resolve) => { + this.completionPromise = new Promise((resolve) => { this.onSuccess = resolve; }).then(() => { this.completionPromise = null; @@ -59,4 +59,4 @@ export class Delayer { this.timeout = null; } } -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/src/utils/typingsStatus.ts b/extensions/typescript-language-features/src/utils/typingsStatus.ts index 6106fa812eb..efb9a540e04 100644 --- a/extensions/typescript-language-features/src/utils/typingsStatus.ts +++ b/extensions/typescript-language-features/src/utils/typingsStatus.ts @@ -75,7 +75,7 @@ export class AtaProgressReporter extends Disposable { private _onBegin(eventId: number): void { const handle = setTimeout(() => this._onEndOrTimeout(eventId), typingsInstallTimeout); - const promise = new Promise(resolve => { + const promise = new Promise(resolve => { this._promises.set(eventId, () => { clearTimeout(handle); resolve(); diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts index 6e1034001f4..90f1205cee9 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts @@ -536,7 +536,7 @@ suite('vscode API - workspace', () => { assert.equal(callCount, 1); assert.equal(doc.getText(), 'call0'); - return new Promise(resolve => { + return new Promise(resolve => { let subscription = vscode.workspace.onDidChangeTextDocument(event => { assert.ok(event.document === doc); diff --git a/package.json b/package.json index 5a7af88a53c..c53aa7e6efd 100644 --- a/package.json +++ b/package.json @@ -166,7 +166,7 @@ "style-loader": "^1.0.0", "ts-loader": "^4.4.2", "tsec": "googleinterns/tsec", - "typescript": "^4.1.0-dev.20200824", + "typescript": "^4.1.0-dev.20200916", "typescript-formatter": "7.1.0", "underscore": "^1.8.2", "vinyl": "^2.0.0", diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 3038f9b40f1..1e433773380 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -4075,7 +4075,7 @@ declare namespace monaco.editor { suggestOnTriggerCharacters: IEditorOption; suggestSelection: IEditorOption; tabCompletion: IEditorOption; - unusualLineTerminators: IEditorOption; + unusualLineTerminators: IEditorOption; useTabStops: IEditorOption; wordSeparators: IEditorOption; wordWrap: IEditorOption; diff --git a/src/vs/platform/contextkey/test/browser/contextkey.test.ts b/src/vs/platform/contextkey/test/browser/contextkey.test.ts index beba468b7f1..d436b6cdf12 100644 --- a/src/vs/platform/contextkey/test/browser/contextkey.test.ts +++ b/src/vs/platform/contextkey/test/browser/contextkey.test.ts @@ -23,7 +23,7 @@ suite('ContextKeyService', () => { let complete: () => void; let reject: (err: Error) => void; - const p = new Promise((_complete, _reject) => { + const p = new Promise((_complete, _reject) => { complete = _complete; reject = _reject; }); diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts index c691b360893..f6072200140 100644 --- a/src/vs/workbench/browser/dnd.ts +++ b/src/vs/workbench/browser/dnd.ts @@ -745,7 +745,7 @@ export class CompositeDragAndDropObserver extends Disposable { } } -export function toggleDropEffect(dataTransfer: DataTransfer | null, dropEffect: string, shouldHaveIt: boolean) { +export function toggleDropEffect(dataTransfer: DataTransfer | null, dropEffect: 'none' | 'copy' | 'link' | 'move', shouldHaveIt: boolean) { if (!dataTransfer) { return; } diff --git a/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts b/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts index deece49a00e..dbca94706fe 100644 --- a/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts +++ b/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts @@ -624,7 +624,7 @@ export class RawDebugSession implements IDisposable { } private send(command: string, args: any, token?: CancellationToken, timeout?: number): Promise { - return new Promise((completeDispatch, errorDispatch) => { + return new Promise((completeDispatch, errorDispatch) => { if (!this.debugAdapter) { if (this.inShutdown) { // We are in shutdown silently complete diff --git a/yarn.lock b/yarn.lock index ffe4436bb5e..95ec3d5eee7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9280,10 +9280,10 @@ typescript@^2.6.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4" integrity sha1-PFtv1/beCRQmkCfwPAlGdY92c6Q= -typescript@^4.1.0-dev.20200824: - version "4.1.0-dev.20200824" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.0-dev.20200824.tgz#34c92d9b6e5124600658c0d4e9b8c125beaf577d" - integrity sha512-hTJfocmebnMKoqRw/xs3bL61z87XXtvOUwYtM7zaCX9mAvnfdo1x1bzQlLZAsvdzRIgAHPJQYbqYHKygWkDw6g== +typescript@^4.1.0-dev.20200916: + version "4.1.0-dev.20200916" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.0-dev.20200916.tgz#b2c803a39d9335086033009903b03e7e53e39223" + integrity sha512-ly2k/AZ3AyfIyLWhBSnW3x7aDufIS9uNRagFZin36jXb6DvZEZwtyx138u8iSvtKE1AV/VNyWLLBkZYojgBM1g== uc.micro@^1.0.1, uc.micro@^1.0.3: version "1.0.3" From 289bce5e1a251491b65252c68d7e3b0d28d5f001 Mon Sep 17 00:00:00 2001 From: rebornix Date: Wed, 16 Sep 2020 14:00:07 -0700 Subject: [PATCH 0030/1667] nb decoration api first cut. --- src/vs/vscode.proposed.d.ts | 18 ++ .../api/browser/mainThreadNotebook.ts | 18 +- .../workbench/api/common/extHost.api.impl.ts | 3 + .../workbench/api/common/extHost.protocol.ts | 5 +- .../workbench/api/common/extHostNotebook.ts | 23 ++ .../api/common/extHostNotebookEditor.ts | 21 ++ .../api/common/extHostTypeConverters.ts | 11 + .../notebook/browser/notebookBrowser.ts | 4 + .../notebook/browser/notebookEditorWidget.ts | 196 ++++++++++++++++-- .../notebook/browser/notebookServiceImpl.ts | 21 +- .../browser/view/renderers/cellRenderer.ts | 17 +- .../browser/view/renderers/codeCell.ts | 6 +- .../browser/view/renderers/markdownCell.ts | 6 +- .../contrib/notebook/common/notebookCommon.ts | 7 + .../notebook/common/notebookService.ts | 6 +- .../notebook/test/testNotebookEditor.ts | 6 + 16 files changed, 343 insertions(+), 25 deletions(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 2f273359c4e..618cd393b7c 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1414,6 +1414,9 @@ declare module 'vscode' { export interface NotebookCellRange { readonly start: number; + /** + * exclusive + */ readonly end: number; } @@ -1505,6 +1508,8 @@ declare module 'vscode' { */ edit(callback: (editBuilder: NotebookEditorEdit) => void): Thenable; + setDecorations(decorationType: NotebookEditorDecorationType, range: NotebookCellRange): void; + revealRange(range: NotebookCellRange, revealType?: NotebookEditorRevealType): void; } @@ -1760,6 +1765,18 @@ declare module 'vscode' { dispose(): void; } + export interface NotebookDecorationRenderOptions { + backgroundColor?: string | ThemeColor; + borderColor?: string | ThemeColor; + top: ThemableDecorationAttachmentRenderOptions; + } + + export interface NotebookEditorDecorationType { + readonly key: string; + dispose(): void; + } + + export namespace notebook { export function registerNotebookContentProvider( notebookType: string, @@ -1783,6 +1800,7 @@ declare module 'vscode' { provider: NotebookKernelProvider ): Disposable; + export function createNotebookEditorDecorationType(options: NotebookDecorationRenderOptions): NotebookEditorDecorationType; export const onDidOpenNotebookDocument: Event; export const onDidCloseNotebookDocument: Event; export const onDidSaveNotebookDocument: Event; diff --git a/src/vs/workbench/api/browser/mainThreadNotebook.ts b/src/vs/workbench/api/browser/mainThreadNotebook.ts index 5e3e0a423ad..0691d5d3cc0 100644 --- a/src/vs/workbench/api/browser/mainThreadNotebook.ts +++ b/src/vs/workbench/api/browser/mainThreadNotebook.ts @@ -18,7 +18,7 @@ import { INotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookB import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel'; import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel'; import { INotebookCellStatusBarService } from 'vs/workbench/contrib/notebook/common/notebookCellStatusBarService'; -import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, CellEditType, DisplayOrderKey, ICellEditOperation, ICellRange, IEditor, IMainCellDto, INotebookDocumentFilter, NotebookCellOutputsSplice, NotebookCellsChangeType, NOTEBOOK_DISPLAY_ORDER, TransientMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, CellEditType, DisplayOrderKey, ICellEditOperation, ICellRange, IEditor, IMainCellDto, INotebookDecorationRenderOptions, INotebookDocumentFilter, NotebookCellOutputsSplice, NotebookCellsChangeType, NOTEBOOK_DISPLAY_ORDER, TransientMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { IMainNotebookController, INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService'; @@ -648,6 +648,22 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo } } + $registerNotebookEditorDecorationType(key: string, options: INotebookDecorationRenderOptions) { + this._notebookService.registerEditorDecorationType(key, options); + } + + $removeNotebookEditorDecorationType(key: string) { + this._notebookService.removeEditorDecorationType(key); + } + + $trySetDecorations(id: string, range: ICellRange, key: string) { + const editor = this._notebookService.listNotebookEditors().find(editor => editor.getId() === id); + if (editor && editor.isNotebookEditor) { + const notebookEditor = editor as INotebookEditor; + notebookEditor.setEditorDecorations(key, range); + } + } + async $setStatusBarEntry(id: number, rawStatusBarEntry: INotebookCellStatusBarEntryDto): Promise { const statusBarEntry = { ...rawStatusBarEntry, diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index eaadfc5f6e4..618ff5e5de6 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -966,6 +966,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I checkProposedApiEnabled(extension); return extHostNotebook.registerNotebookKernelProvider(extension, selector, provider); }, + createNotebookEditorDecorationType(options: vscode.NotebookDecorationRenderOptions): vscode.NotebookEditorDecorationType { + return extHostNotebook.createNotebookEditorDecorationType(options); + }, get activeNotebookEditor(): vscode.NotebookEditor | undefined { checkProposedApiEnabled(extension); return extHostNotebook.activeNotebookEditor; diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index c42c42c29b2..2252959b6cc 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -51,7 +51,7 @@ import { TunnelDto } from 'vs/workbench/api/common/extHostTunnelService'; import { TunnelOptions } from 'vs/platform/remote/common/tunnel'; import { Timeline, TimelineChangeEvent, TimelineOptions, TimelineProviderDescriptor, InternalTimelineOptions } from 'vs/workbench/contrib/timeline/common/timeline'; import { revive } from 'vs/base/common/marshalling'; -import { IProcessedOutput, INotebookDisplayOrder, NotebookCellMetadata, NotebookDocumentMetadata, ICellEditOperation, NotebookCellsChangedEventDto, NotebookDataDto, IMainCellDto, INotebookDocumentFilter, INotebookKernelInfoDto2, TransientMetadata, INotebookCellStatusBarEntry, ICellRange } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { IProcessedOutput, INotebookDisplayOrder, NotebookCellMetadata, NotebookDocumentMetadata, ICellEditOperation, NotebookCellsChangedEventDto, NotebookDataDto, IMainCellDto, INotebookDocumentFilter, INotebookKernelInfoDto2, TransientMetadata, INotebookCellStatusBarEntry, ICellRange, INotebookDecorationRenderOptions } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { CallHierarchyItem } from 'vs/workbench/contrib/callHierarchy/common/callHierarchy'; import { Dto } from 'vs/base/common/types'; import { ISerializableEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariable'; @@ -746,6 +746,9 @@ export interface MainThreadNotebookShape extends IDisposable { $postMessage(editorId: string, forRendererId: string | undefined, value: any): Promise; $setStatusBarEntry(id: number, statusBarEntry: INotebookCellStatusBarEntryDto): Promise; $tryRevealRange(id: string, range: ICellRange, revealType: NotebookEditorRevealType): Promise; + $registerNotebookEditorDecorationType(key: string, options: INotebookDecorationRenderOptions): void; + $removeNotebookEditorDecorationType(key: string): void; + $trySetDecorations(id: string, range: ICellRange, decorationKey: string): void; $onUndoableContentChange(resource: UriComponents, viewType: string, editId: number, label: string | undefined): void; $onContentChange(resource: UriComponents, viewType: string): void; } diff --git a/src/vs/workbench/api/common/extHostNotebook.ts b/src/vs/workbench/api/common/extHostNotebook.ts index 3ed841cbc58..9be0944abe3 100644 --- a/src/vs/workbench/api/common/extHostNotebook.ts +++ b/src/vs/workbench/api/common/extHostNotebook.ts @@ -22,6 +22,7 @@ import * as vscode from 'vscode'; import { ResourceMap } from 'vs/base/common/map'; import { ExtHostCell, ExtHostNotebookDocument } from './extHostNotebookDocument'; import { ExtHostNotebookEditor } from './extHostNotebookEditor'; +import { IdGenerator } from 'vs/base/common/idGenerator'; class ExtHostWebviewCommWrapper extends Disposable { private readonly _onDidReceiveDocumentMessage = new Emitter(); @@ -187,6 +188,24 @@ async function withToken(cb: (token: CancellationToken) => any) { } } +export class NotebookEditorDecorationType implements vscode.NotebookEditorDecorationType { + + private static readonly _Keys = new IdGenerator('NotebookEditorDecorationType'); + + private _proxy: MainThreadNotebookShape; + public key: string; + + constructor(proxy: MainThreadNotebookShape, options: vscode.NotebookDecorationRenderOptions) { + this.key = NotebookEditorDecorationType._Keys.nextId(); + this._proxy = proxy; + this._proxy.$registerNotebookEditorDecorationType(this.key, typeConverters.NotebookDecorationRenderOptions.from(options)); + } + + public dispose(): void { + this._proxy.$removeNotebookEditorDecorationType(this.key); + } +} + export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostNotebookOutputRenderingHandler { private static _notebookKernelProviderHandlePool: number = 0; @@ -338,6 +357,10 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN }); } + createNotebookEditorDecorationType(options: vscode.NotebookDecorationRenderOptions): vscode.NotebookEditorDecorationType { + return new NotebookEditorDecorationType(this._proxy, options); + } + private _withAdapter(handle: number, uri: UriComponents, callback: (adapter: ExtHostNotebookKernelProviderAdapter, document: ExtHostNotebookDocument) => Promise) { const document = this._documents.get(URI.revive(uri)); diff --git a/src/vs/workbench/api/common/extHostNotebookEditor.ts b/src/vs/workbench/api/common/extHostNotebookEditor.ts index 67fcc4f17d8..ea5ecb3512d 100644 --- a/src/vs/workbench/api/common/extHostNotebookEditor.ts +++ b/src/vs/workbench/api/common/extHostNotebookEditor.ts @@ -99,6 +99,8 @@ export class ExtHostNotebookEditor extends Disposable implements vscode.Notebook readonly onDidDispose: Event = this._onDidDispose.event; readonly onDidReceiveMessage: vscode.Event = this._onDidReceiveMessage.event; + private _hasDecorationsForKey: { [key: string]: boolean; } = Object.create(null); + constructor( readonly id: string, private readonly _viewType: string, @@ -214,6 +216,25 @@ export class ExtHostNotebookEditor extends Disposable implements vscode.Notebook return this._proxy.$tryApplyEdits(this._viewType, this.document.uri, editData.documentVersionId, compressedEdits); } + setDecorations(decorationType: vscode.NotebookEditorDecorationType, range: vscode.NotebookCellRange): void { + const willBeEmpty = (range.start === range.end); + if (willBeEmpty && !this._hasDecorationsForKey[decorationType.key]) { + // avoid no-op call to the renderer + return; + } + if (willBeEmpty) { + delete this._hasDecorationsForKey[decorationType.key]; + } else { + this._hasDecorationsForKey[decorationType.key] = true; + } + + return this._proxy.$trySetDecorations( + this.id, + range, + decorationType.key + ); + } + revealRange(range: vscode.NotebookCellRange, revealType?: extHostTypes.NotebookEditorRevealType) { this._proxy.$tryRevealRange(this.id, range, revealType || extHostTypes.NotebookEditorRevealType.Default); } diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index da9bd09b20a..484bc6dd58b 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -32,6 +32,7 @@ import { coalesce, isNonEmptyArray } from 'vs/base/common/arrays'; import { RenderLineNumbersType } from 'vs/editor/common/config/editorOptions'; import { CommandsConverter } from 'vs/workbench/api/common/extHostCommands'; import { ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook'; +import { INotebookDecorationRenderOptions } from 'vs/workbench/contrib/notebook/common/notebookCommon'; export interface PositionLike { line: number; @@ -1348,3 +1349,13 @@ export namespace NotebookExclusiveDocumentPattern { return rp && typeof rp.base === 'string' && typeof rp.pattern === 'string'; } } + +export namespace NotebookDecorationRenderOptions { + export function from(options: vscode.NotebookDecorationRenderOptions): INotebookDecorationRenderOptions { + return { + backgroundColor: options.backgroundColor, + borderColor: options.borderColor, + top: options.top ? ThemableDecorationAttachmentRenderOptions.from(options.top) : undefined + }; + } +} diff --git a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts index d0772635f8f..a2b1ca0b949 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts @@ -438,6 +438,9 @@ export interface INotebookEditor extends IEditor { */ changeModelDecorations(callback: (changeAccessor: IModelDecorationsChangeAccessor) => T): T | null; + setEditorDecorations(key: string, range: ICellRange): void; + removeEditorDecorations(key: string): void; + /** * An event emitted on a "mouseup". * @event @@ -515,6 +518,7 @@ export interface INotebookCellList { } export interface BaseCellRenderTemplate { + rootContainer: HTMLElement; editorPart: HTMLElement; collapsedPart: HTMLElement; expandButton: HTMLElement; diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts index 50ebf29c4cb..926fb957eb0 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts @@ -22,7 +22,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { BareFontInfo } from 'vs/editor/common/config/fontInfo'; import { Range } from 'vs/editor/common/core/range'; -import { IEditor } from 'vs/editor/common/editorCommon'; +import { IEditor, isThemeColor } from 'vs/editor/common/editorCommon'; import * as nls from 'vs/nls'; import { IMenuService, MenuId } from 'vs/platform/actions/common/actions'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -34,7 +34,7 @@ import { ILayoutService } from 'vs/platform/layout/browser/layoutService'; import { IQuickInputService, IQuickPickItem, QuickPickInput } from 'vs/platform/quickinput/common/quickInput'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { contrastBorder, diffInserted, diffRemoved, editorBackground, errorForeground, focusBorder, foreground, listFocusBackground, listInactiveSelectionBackground, registerColor, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, textBlockQuoteBackground, textBlockQuoteBorder, textLinkActiveForeground, textLinkForeground, textPreformatForeground, transparent } from 'vs/platform/theme/common/colorRegistry'; -import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; +import { IColorTheme, IThemeService, registerThemingParticipant, ThemeColor } from 'vs/platform/theme/common/themeService'; import { EditorMemento } from 'vs/workbench/browser/parts/editor/editorPane'; import { IEditorMemento } from 'vs/workbench/common/editor'; import { Memento, MementoObject } from 'vs/workbench/common/memento'; @@ -54,7 +54,7 @@ import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewMod import { NotebookEventDispatcher, NotebookLayoutChangedEvent } from 'vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher'; import { CellViewModel, IModelDecorationsChangeAccessor, INotebookEditorViewState, NotebookViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel'; import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel'; -import { CellKind, CellToolbarLocKey, ICellRange, IInsetRenderOutput, INotebookKernelInfo2, IProcessedOutput, isTransformedDisplayOutput, NotebookCellRunState, NotebookRunState, ShowCellStatusBarKey } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { CellKind, CellToolbarLocKey, ICellRange, IInsetRenderOutput, INotebookDecorationRenderOptions, INotebookKernelInfo2, IProcessedOutput, isTransformedDisplayOutput, NotebookCellRunState, NotebookRunState, ShowCellStatusBarKey } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { NotebookProviderInfo } from 'vs/workbench/contrib/notebook/common/notebookProvider'; import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService'; import { editorGutterModifiedBackground } from 'vs/workbench/contrib/scm/browser/dirtydiffDecorator'; @@ -241,7 +241,8 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor @ILayoutService private readonly layoutService: ILayoutService, @IContextMenuService private readonly contextMenuService: IContextMenuService, @IMenuService private readonly menuService: IMenuService, - @IQuickInputService private readonly quickInputService: IQuickInputService + @IQuickInputService private readonly quickInputService: IQuickInputService, + @IThemeService private readonly themeService: IThemeService ) { super(); this.isEmbedded = creationOptions.isEmbedded || false; @@ -1224,6 +1225,63 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor return this._list!.setHiddenAreas(_ranges, true); } + private _editorStyleSheets = new Map(); + private _decorationRules = new Map(); + private _decortionKeyToIds = new Map(); + + _removeEditorStyleSheets(key: string): void { + this._editorStyleSheets.delete(key); + } + + private _registerDecorationType(key: string) { + const options = this.notebookService.resolveEditorDecorationOptions(key); + + if (options) { + const styleElement = DOM.createStyleSheet(this._body); + const styleSheet = new RefCountedStyleSheet(this, key, styleElement); + this._editorStyleSheets.set(key, styleSheet); + this._decorationRules.set(key, new DecorationCSSRules(this.themeService, styleSheet, { + key, + options, + styleSheet + })); + } + } + + setEditorDecorations(key: string, range: ICellRange): void { + if (!this.viewModel) { + return; + } + + // create css style for the decoration + if (!this._editorStyleSheets.has(key)) { + this._registerDecorationType(key); + } + + const decorationRule = this._decorationRules.get(key); + if (!decorationRule) { + return; + } + + const existingDecorations = this._decortionKeyToIds.get(key) || []; + const newDecorations = this.viewModel.viewCells.slice(range.start, range.end).map(cell => ({ + handle: cell.handle, + options: { className: decorationRule.className, outputClassName: decorationRule.className } + })); + + this._decortionKeyToIds.set(key, this.deltaCellDecorations(existingDecorations, newDecorations)); + } + + + removeEditorDecorations(key: string): void { + if (this._decorationRules.has(key)) { + this._decorationRules.get(key)?.dispose(); + } + + const cellDecorations = this._decortionKeyToIds.get(key); + this.deltaCellDecorations(cellDecorations || [], []); + } + //#endregion //#region Mouse Events @@ -1952,8 +2010,8 @@ registerThemingParticipant((theme, collector) => { const cellSymbolHighlightColor = theme.getColor(cellSymbolHighlight); if (cellSymbolHighlightColor) { - collector.addRule(`.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row .nb-symbolHighlight .cell-focus-indicator, - .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row .nb-symbolHighlight { + collector.addRule(`.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.nb-symbolHighlight .cell-focus-indicator, + .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row.nb-symbolHighlight { background-color: ${cellSymbolHighlightColor} !important; }`); } @@ -2021,11 +2079,11 @@ registerThemingParticipant((theme, collector) => { const modifiedBackground = theme.getColor(editorGutterModifiedBackground); if (modifiedBackground) { collector.addRule(` - .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row .nb-cell-modified .cell-focus-indicator { + .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.nb-cell-modified .cell-focus-indicator { background-color: ${modifiedBackground} !important; } - .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row .nb-cell-modified { + .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row.nb-cell-modified { background-color: ${modifiedBackground} !important; }`); } @@ -2033,22 +2091,22 @@ registerThemingParticipant((theme, collector) => { const addedBackground = theme.getColor(diffInserted); if (addedBackground) { collector.addRule(` - .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row .nb-cell-added .cell-focus-indicator { + .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.nb-cell-added .cell-focus-indicator { background-color: ${addedBackground} !important; } - .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row .nb-cell-added { + .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row.nb-cell-added { background-color: ${addedBackground} !important; }`); } const deletedBackground = theme.getColor(diffRemoved); if (deletedBackground) { collector.addRule(` - .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row .nb-cell-deleted .cell-focus-indicator { + .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.nb-cell-deleted .cell-focus-indicator { background-color: ${deletedBackground} !important; } - .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row .nb-cell-deleted { + .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row.nb-cell-deleted { background-color: ${deletedBackground} !important; }`); } @@ -2077,3 +2135,117 @@ registerThemingParticipant((theme, collector) => { collector.addRule(`.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container { height: ${BOTTOM_CELL_TOOLBAR_HEIGHT}px }`); }); + + +export class RefCountedStyleSheet { + private readonly _widget: NotebookEditorWidget; + private readonly _key: string; + private readonly _styleSheet: HTMLStyleElement; + private _refCount: number; + + constructor(widget: NotebookEditorWidget, key: string, styleSheet: HTMLStyleElement) { + this._widget = widget; + this._key = key; + this._styleSheet = styleSheet; + this._refCount = 0; + } + + public ref(): void { + this._refCount++; + } + + public unref(): void { + this._refCount--; + if (this._refCount === 0) { + this._styleSheet.parentNode?.removeChild(this._styleSheet); + this._widget._removeEditorStyleSheets(this._key); + } + } + + public insertRule(rule: string, index?: number): void { + const sheet = this._styleSheet.sheet; + sheet.insertRule(rule, index); + } +} + +interface ProviderArguments { + styleSheet: RefCountedStyleSheet; + key: string; + options: INotebookDecorationRenderOptions; +} + +class DecorationCSSRules { + private _theme: IColorTheme; + private _className: string; + + get className() { + return this._className; + } + constructor( + private readonly _themeService: IThemeService, + private readonly _styleSheet: RefCountedStyleSheet, + private readonly _providerArgs: ProviderArguments + ) { + this._styleSheet.ref(); + this._theme = this._themeService.getColorTheme(); + this._className = CSSNameHelper.getClassName(this._providerArgs.key, CellDecorationCSSRuleType.ClassName); + this._buildCSS(); + } + + private _buildCSS() { + this._styleSheet.insertRule('.foo { color: red; }', 0); + + if (this._providerArgs.options.backgroundColor) { + const backgroundColor = this._resolveValue(this._providerArgs.options.backgroundColor); + this._styleSheet.insertRule(`.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.${this.className} .cell-focus-indicator, + .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row.${this.className} { + background-color: ${backgroundColor} !important; + }`); + } + + if (this._providerArgs.options.borderColor) { + const borderColor = this._resolveValue(this._providerArgs.options.borderColor); + + this._styleSheet.insertRule(`.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.${this.className} .cell-focus-indicator-top:before, + .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.${this.className} .cell-focus-indicator-bottom:before, + .monaco-workbench .notebookOverlay .monaco-list .${this.className}.markdown-cell-row.focused:before, + .monaco-workbench .notebookOverlay .monaco-list .${this.className}.markdown-cell-row.focused:after { + border-color: ${borderColor} !important; + }`); + + // more specific rule for `.focused` can override existing rules + this._styleSheet.insertRule(`.monaco-workbench .notebookOverlay .monaco-list:focus-within .monaco-list-row.focused.${this.className} .cell-focus-indicator-top:before, + .monaco-workbench .notebookOverlay .monaco-list:focus-within .monaco-list-row.focused.${this.className} .cell-focus-indicator-bottom:before, + .monaco-workbench .notebookOverlay .monaco-list:focus-within .markdown-cell-row.focused.${this.className}:before, + .monaco-workbench .notebookOverlay .monaco-list:focus-within .markdown-cell-row.focused.${this.className}:after { + border-color: ${borderColor} !important; + }`); + } + } + + private _resolveValue(value: string | ThemeColor): string { + if (isThemeColor(value)) { + const color = this._theme.getColor(value.id); + if (color) { + return color.toString(); + } + return 'transparent'; + } + return value; + } + + dispose() { + this._styleSheet.unref(); + } +} + +const enum CellDecorationCSSRuleType { + ClassName = 0, +} + +class CSSNameHelper { + + public static getClassName(key: string, type: CellDecorationCSSRuleType): string { + return 'nb-' + key + '-' + type; + } +} diff --git a/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts b/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts index 513f57b4ad2..b7c97df0df7 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts @@ -27,7 +27,7 @@ import { NotebookKernelProviderAssociationRegistry, NotebookViewTypesExtensionRe import { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel'; import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel'; import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel'; -import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, BUILTIN_RENDERER_ID, CellEditType, CellKind, CellOutputKind, DisplayOrderKey, ICellEditOperation, IDisplayOutput, INotebookKernelInfo2, INotebookKernelProvider, INotebookRendererInfo, INotebookTextModel, IOrderedMimeType, ITransformedDisplayOutputDto, mimeTypeSupportedByCore, NotebookCellOutputsSplice, notebookDocumentFilterMatch, NotebookEditorPriority, NOTEBOOK_DISPLAY_ORDER, sortMimeTypes } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, BUILTIN_RENDERER_ID, CellEditType, CellKind, CellOutputKind, DisplayOrderKey, ICellEditOperation, IDisplayOutput, INotebookDecorationRenderOptions, INotebookKernelInfo2, INotebookKernelProvider, INotebookRendererInfo, INotebookTextModel, IOrderedMimeType, ITransformedDisplayOutputDto, mimeTypeSupportedByCore, NotebookCellOutputsSplice, notebookDocumentFilterMatch, NotebookEditorPriority, NOTEBOOK_DISPLAY_ORDER, sortMimeTypes } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { NotebookOutputRendererInfo } from 'vs/workbench/contrib/notebook/common/notebookOutputRenderer'; import { NotebookEditorDescriptor, NotebookProviderInfo } from 'vs/workbench/contrib/notebook/common/notebookProvider'; import { IMainNotebookController, INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService'; @@ -261,6 +261,7 @@ export class NotebookService extends Disposable implements INotebookService, ICu private _lastClipboardIsCopy: boolean = true; private _displayOrder: { userOrder: string[], defaultOrder: string[] } = Object.create(null); + private readonly _decorationOptionProviders = new Map(); constructor( @IExtensionService private readonly _extensionService: IExtensionService, @@ -519,6 +520,24 @@ export class NotebookService extends Disposable implements INotebookService, ICu } + registerEditorDecorationType(key: string, options: INotebookDecorationRenderOptions): void { + if (this._decorationOptionProviders.has(key)) { + return; + } + + this._decorationOptionProviders.set(key, options); + } + + removeEditorDecorationType(key: string): void { + this._decorationOptionProviders.delete(key); + + this.listNotebookEditors().forEach(editor => editor.removeEditorDecorations(key)); + } + + resolveEditorDecorationOptions(key: string): INotebookDecorationRenderOptions | undefined { + return this._decorationOptionProviders.get(key); + } + getViewTypes(): ICustomEditorInfo[] { return [...this.notebookProviderInfoStore].map(info => ({ id: info.id, diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts index bfdd73a2a84..2b37f5a624f 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts @@ -418,6 +418,7 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR const titleMenu = disposables.add(this.cellMenus.getCellTitleMenu(contextKeyService)); const templateData: MarkdownCellRenderTemplate = { + rootContainer, collapsedPart, expandButton, contextKeyService, @@ -471,6 +472,17 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR } renderElement(element: MarkdownCellViewModel, index: number, templateData: MarkdownCellRenderTemplate, height: number | undefined): void { + const removedClassNames: string[] = []; + templateData.rootContainer.classList.forEach(className => { + if (/^nb\-.*$/.test(className)) { + removedClassNames.push(className); + } + }); + + removedClassNames.forEach(className => { + templateData.rootContainer.classList.remove(className); + }); + this.commonRenderElement(element, templateData); templateData.currentRenderedCell = element; @@ -700,6 +712,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende const titleMenu = disposables.add(this.cellMenus.getCellTitleMenu(contextKeyService)); const templateData: CodeCellRenderTemplate = { + rootContainer, editorPart, collapsedPart, expandButton, @@ -808,14 +821,14 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende renderElement(element: CodeCellViewModel, index: number, templateData: CodeCellRenderTemplate, height: number | undefined): void { const removedClassNames: string[] = []; - templateData.container.classList.forEach(className => { + templateData.rootContainer.classList.forEach(className => { if (/^nb\-.*$/.test(className)) { removedClassNames.push(className); } }); removedClassNames.forEach(className => { - templateData.container.classList.remove(className); + templateData.rootContainer.classList.remove(className); }); this.commonRenderElement(element, templateData); diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts index 64977d72610..8b534f2df4d 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts @@ -223,7 +223,7 @@ export class CodeCell extends Disposable { this._register(viewCell.onCellDecorationsChanged((e) => { e.added.forEach(options => { if (options.className) { - DOM.addClass(templateData.container, options.className); + DOM.addClass(templateData.rootContainer, options.className); } if (options.outputClassName) { @@ -233,7 +233,7 @@ export class CodeCell extends Disposable { e.removed.forEach(options => { if (options.className) { - DOM.removeClass(templateData.container, options.className); + DOM.removeClass(templateData.rootContainer, options.className); } if (options.outputClassName) { @@ -245,7 +245,7 @@ export class CodeCell extends Disposable { viewCell.getCellDecorations().forEach(options => { if (options.className) { - DOM.addClass(templateData.container, options.className); + DOM.addClass(templateData.rootContainer, options.className); } if (options.outputClassName) { diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts index 17db297ad75..51857bc9edc 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts @@ -109,13 +109,13 @@ export class StatefulMarkdownCell extends Disposable { this._register(viewCell.onCellDecorationsChanged((e) => { e.added.forEach(options => { if (options.className) { - DOM.addClass(templateData.container, options.className); + DOM.addClass(templateData.rootContainer, options.className); } }); e.removed.forEach(options => { if (options.className) { - DOM.removeClass(templateData.container, options.className); + DOM.removeClass(templateData.rootContainer, options.className); } }); })); @@ -124,7 +124,7 @@ export class StatefulMarkdownCell extends Disposable { viewCell.getCellDecorations().forEach(options => { if (options.className) { - DOM.addClass(templateData.container, options.className); + DOM.addClass(templateData.rootContainer, options.className); } }); diff --git a/src/vs/workbench/contrib/notebook/common/notebookCommon.ts b/src/vs/workbench/contrib/notebook/common/notebookCommon.ts index 9fa3d125173..ce10e2148a1 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookCommon.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookCommon.ts @@ -24,6 +24,7 @@ import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/no import { IDisposable } from 'vs/base/common/lifecycle'; import { IFileStatWithMetadata } from 'vs/platform/files/common/files'; import { IRange } from 'vs/editor/common/core/range'; +import { ThemeColor } from 'vs/platform/theme/common/themeService'; export enum CellKind { Markdown = 1, @@ -883,3 +884,9 @@ export const enum CellStatusbarAlignment { LEFT, RIGHT } + +export interface INotebookDecorationRenderOptions { + backgroundColor?: string | ThemeColor; + borderColor?: string | ThemeColor; + top?: editorCommon.IContentDecorationRenderOptions; +} diff --git a/src/vs/workbench/contrib/notebook/common/notebookService.ts b/src/vs/workbench/contrib/notebook/common/notebookService.ts index 50de255b4e6..b05db598a5d 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookService.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookService.ts @@ -10,7 +10,7 @@ import { NotebookExtensionDescription } from 'vs/workbench/api/common/extHost.pr import { Event } from 'vs/base/common/event'; import { INotebookTextModel, INotebookRendererInfo, - IEditor, ICellEditOperation, NotebookCellOutputsSplice, INotebookKernelProvider, INotebookKernelInfo2, TransientMetadata, NotebookDataDto, TransientOptions + IEditor, ICellEditOperation, NotebookCellOutputsSplice, INotebookKernelProvider, INotebookKernelInfo2, TransientMetadata, NotebookDataDto, TransientOptions, INotebookDecorationRenderOptions } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel'; import { CancellationToken } from 'vs/base/common/cancellation'; @@ -78,5 +78,7 @@ export interface INotebookService { listNotebookEditors(): readonly IEditor[]; listVisibleNotebookEditors(): readonly IEditor[]; listNotebookDocuments(): readonly NotebookTextModel[]; - + registerEditorDecorationType(key: string, options: INotebookDecorationRenderOptions): void; + removeEditorDecorationType(key: string): void; + resolveEditorDecorationOptions(key: string): INotebookDecorationRenderOptions | undefined; } diff --git a/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts b/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts index d2386aab84c..1679604a859 100644 --- a/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts +++ b/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts @@ -66,6 +66,12 @@ export class TestNotebookEditor implements INotebookEditor { constructor( ) { } + setEditorDecorations(key: string, range: ICellRange): void { + // throw new Error('Method not implemented.'); + } + removeEditorDecorations(key: string): void { + // throw new Error('Method not implemented.'); + } getSelectionHandles(): number[] { return []; } From a8581d60f25d9004932a0e5a6ede9b68ccfe36b1 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 16 Sep 2020 23:55:34 +0200 Subject: [PATCH 0031/1667] fix wsl selfhosting in scripts/code.sh --- scripts/code.sh | 4 ++-- src/vs/platform/environment/node/argvHelper.ts | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/code.sh b/scripts/code.sh index b19cc0df9ff..ef117c55c48 100755 --- a/scripts/code.sh +++ b/scripts/code.sh @@ -57,9 +57,9 @@ function code-wsl() if [ -f "$ELECTRON" ]; then local CWD=$(pwd) cd $ROOT - export WSLENV=ELECTRON_RUN_AS_NODE/w:$WSLENV + export WSLENV=ELECTRON_RUN_AS_NODE/w:VSCODE_DEV/w:$WSLENV local WSL_EXT_ID="ms-vscode-remote.remote-wsl" - local WSL_EXT_WLOC=$(ELECTRON_RUN_AS_NODE=1 "$ROOT/.build/electron/Code - OSS.exe" "out/cli.js" --locate-extension $WSL_EXT_ID) + local WSL_EXT_WLOC=$(VSCODE_DEV=1 ELECTRON_RUN_AS_NODE=1 "$ROOT/.build/electron/Code - OSS.exe" "out/cli.js" --locate-extension $WSL_EXT_ID) cd $CWD if [ -n "$WSL_EXT_WLOC" ]; then # replace \r\n with \n in WSL_EXT_WLOC diff --git a/src/vs/platform/environment/node/argvHelper.ts b/src/vs/platform/environment/node/argvHelper.ts index 2f602517445..a3c16f98de7 100644 --- a/src/vs/platform/environment/node/argvHelper.ts +++ b/src/vs/platform/environment/node/argvHelper.ts @@ -60,11 +60,7 @@ export function parseMainProcessArgv(processArgv: string[]): NativeParsedArgs { * Use this to parse raw code CLI process.argv such as: `Electron cli.js . --verbose --wait` */ export function parseCLIProcessArgv(processArgv: string[]): NativeParsedArgs { - let [, , ...args] = processArgv; - - if (process.env['VSCODE_DEV']) { - args = stripAppPath(args) || []; - } + let [, , ...args] = processArgv; // remove the first non-option argument: it's always the app location return parseAndValidate(args, true); } From 6b083b455be2c60c4df6104896cf9ee5af127cda Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 16 Sep 2020 14:58:31 -0700 Subject: [PATCH 0032/1667] Finalize the WebviewView Api Fixes #46585 This new api allows extensions to contribute webviews to the sidebar or panel --- src/vs/vscode.d.ts | 157 +++++++++++++++++ src/vs/vscode.proposed.d.ts | 163 ------------------ .../workbench/api/common/extHost.api.impl.ts | 1 - 3 files changed, 157 insertions(+), 164 deletions(-) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index fe8860c87c1..df6fe60afc8 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -7127,6 +7127,129 @@ declare module 'vscode' { deserializeWebviewPanel(webviewPanel: WebviewPanel, state: T): Thenable; } + /** + * A webview based view. + */ + export interface WebviewView { + /** + * Identifies the type of the webview view, such as `'hexEditor.dataView'`. + */ + readonly viewType: string; + + /** + * The underlying webview for the view. + */ + readonly webview: Webview; + + /** + * View title displayed in the UI. + * + * The view title is initially taken from the extension `package.json` contribution. + */ + title?: string; + + /** + * Human-readable string which is rendered less prominently in the title. + */ + description?: string; + + /** + * Event fired when the view is disposed. + * + * Views are disposed when they are explicitly hidden by a user (this happens when a user + * right clicks in a view and unchecks the webview view). + * + * Trying to use the view after it has been disposed throws an exception. + */ + readonly onDidDispose: Event; + + /** + * Tracks if the webview is currently visible. + * + * Views are visible when they are on the screen and expanded. + */ + readonly visible: boolean; + + /** + * Event fired when the visibility of the view changes. + * + * Actions that trigger a visibility change: + * + * - The view is collapsed or expanded. + * - The user switches to a different view group in the sidebar or panel. + * + * Note that hiding a view using the context menu instead disposes of the view and fires `onDidDispose`. + */ + readonly onDidChangeVisibility: Event; + + /** + * Reveal the view in the UI. + * + * If the view is collapsed, this will expand it. + * + * @param preserveFocus When `true` the view will not take focus. + */ + show(preserveFocus?: boolean): void; + } + + /** + * Additional information the webview view being resolved. + * + * @param T Type of the webview's state. + */ + interface WebviewViewResolveContext { + /** + * Persisted state from the webview content. + * + * To save resources, VS Code normally deallocates webview documents (the iframe content) that are not visible. + * For example, when the user collapse a view or switches to another top level activity in the sidebar, the + * `WebviewView` itself is kept alive but the webview's underlying document is deallocated. It is recreated when + * the view becomes visible again. + * + * You can prevent this behavior by setting `retainContextWhenHidden` in the `WebviewOptions`. However this + * increases resource usage and should be avoided wherever possible. Instead, you can use persisted state to + * save off a webview's state so that it can be quickly recreated as needed. + * + * To save off a persisted state, inside the webview call `acquireVsCodeApi().setState()` with + * any json serializable object. To restore the state again, call `getState()`. For example: + * + * ```js + * // Within the webview + * const vscode = acquireVsCodeApi(); + * + * // Get existing state + * const oldState = vscode.getState() || { value: 0 }; + * + * // Update state + * setState({ value: oldState.value + 1 }) + * ``` + * + * VS Code ensures that the persisted state is saved correctly when a webview is hidden and across + * editor restarts. + */ + readonly state: T | undefined; + } + + /** + * Provider for creating `WebviewView` elements. + */ + export interface WebviewViewProvider { + /** + * Revolves a webview view. + * + * `resolveWebviewView` is called when a view first becomes visible. This may happen when the view is + * first loaded or when the user hides and then shows a view again. + * + * @param webviewView Webview view to restore. The provider should take ownership of this view. The + * provider must set the webview's `.html` and hook up all webview events it is interested in. + * @param context Additional metadata about the view being resolved. + * @param token Cancellation token indicating that the view being provided is no longer needed. + * + * @return Optional thenable indicating that the view has been fully resolved. + */ + resolveWebviewView(webviewView: WebviewView, context: WebviewViewResolveContext, token: CancellationToken): Thenable | void; + } + /** * Provider for text based custom editors. * @@ -8280,6 +8403,40 @@ declare module 'vscode' { */ export function registerWebviewPanelSerializer(viewType: string, serializer: WebviewPanelSerializer): Disposable; + /** + * Register a new provider for webview views. + * + * @param viewId Unique id of the view. This should match the `id` from the + * `views` contribution in the package.json. + * @param provider Provider for the webview views. + * + * @return Disposable that unregisters the provider. + */ + export function registerWebviewViewProvider(viewId: string, provider: WebviewViewProvider, options?: { + /** + * Content settings for the webview created for this view. + */ + readonly webviewOptions?: { + /** + * Controls if the webview element itself (iframe) is kept around even when the view + * is no longer visible. + * + * Normally the webview's html context is created when the view becomes visible + * and destroyed when it is hidden. Extensions that have complex state + * or UI can set the `retainContextWhenHidden` to make VS Code keep the webview + * context around, even when the webview moves to a background tab. When a webview using + * `retainContextWhenHidden` becomes hidden, its scripts and other dynamic content are suspended. + * When the view becomes visible again, the context is automatically restored + * in the exact same state it was in originally. You cannot send messages to a + * hidden webview, even with `retainContextWhenHidden` enabled. + * + * `retainContextWhenHidden` has a high memory overhead and should only be used if + * your view's context cannot be quickly saved and restored. + */ + readonly retainContextWhenHidden?: boolean; + }; + }): Disposable; + /** * Register a provider for custom editors for the `viewType` contributed by the `customEditors` extension point. * diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 618cd393b7c..5623fae8254 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -2090,169 +2090,6 @@ declare module 'vscode' { } //#endregion - - //#region https://github.com/microsoft/vscode/issues/46585 - - /** - * A webview based view. - */ - export interface WebviewView { - /** - * Identifies the type of the webview view, such as `'hexEditor.dataView'`. - */ - readonly viewType: string; - - /** - * The underlying webview for the view. - */ - readonly webview: Webview; - - /** - * View title displayed in the UI. - * - * The view title is initially taken from the extension `package.json` contribution. - */ - title?: string; - - /** - * Human-readable string which is rendered less prominently in the title. - */ - description?: string; - - /** - * Event fired when the view is disposed. - * - * Views are disposed when they are explicitly hidden by a user (this happens when a user - * right clicks in a view and unchecks the webview view). - * - * Trying to use the view after it has been disposed throws an exception. - */ - readonly onDidDispose: Event; - - /** - * Tracks if the webview is currently visible. - * - * Views are visible when they are on the screen and expanded. - */ - readonly visible: boolean; - - /** - * Event fired when the visibility of the view changes. - * - * Actions that trigger a visibility change: - * - * - The view is collapsed or expanded. - * - The user switches to a different view group in the sidebar or panel. - * - * Note that hiding a view using the context menu instead disposes of the view and fires `onDidDispose`. - */ - readonly onDidChangeVisibility: Event; - - /** - * Reveal the view in the UI. - * - * If the view is collapsed, this will expand it. - * - * @param preserveFocus When `true` the view will not take focus. - */ - show(preserveFocus?: boolean): void; - } - - /** - * Additional information the webview view being resolved. - * - * @param T Type of the webview's state. - */ - interface WebviewViewResolveContext { - /** - * Persisted state from the webview content. - * - * To save resources, VS Code normally deallocates webview documents (the iframe content) that are not visible. - * For example, when the user collapse a view or switches to another top level activity in the sidebar, the - * `WebviewView` itself is kept alive but the webview's underlying document is deallocated. It is recreated when - * the view becomes visible again. - * - * You can prevent this behavior by setting `retainContextWhenHidden` in the `WebviewOptions`. However this - * increases resource usage and should be avoided wherever possible. Instead, you can use persisted state to - * save off a webview's state so that it can be quickly recreated as needed. - * - * To save off a persisted state, inside the webview call `acquireVsCodeApi().setState()` with - * any json serializable object. To restore the state again, call `getState()`. For example: - * - * ```js - * // Within the webview - * const vscode = acquireVsCodeApi(); - * - * // Get existing state - * const oldState = vscode.getState() || { value: 0 }; - * - * // Update state - * setState({ value: oldState.value + 1 }) - * ``` - * - * VS Code ensures that the persisted state is saved correctly when a webview is hidden and across - * editor restarts. - */ - readonly state: T | undefined; - } - - /** - * Provider for creating `WebviewView` elements. - */ - export interface WebviewViewProvider { - /** - * Revolves a webview view. - * - * `resolveWebviewView` is called when a view first becomes visible. This may happen when the view is - * first loaded or when the user hides and then shows a view again. - * - * @param webviewView Webview view to restore. The serializer should take ownership of this view. The - * provider must set the webview's `.html` and hook up all webview events it is interested in. - * @param context Additional metadata about the view being resolved. - * @param token Cancellation token indicating that the view being provided is no longer needed. - * - * @return Optional thenable indicating that the view has been fully resolved. - */ - resolveWebviewView(webviewView: WebviewView, context: WebviewViewResolveContext, token: CancellationToken): Thenable | void; - } - - namespace window { - /** - * Register a new provider for webview views. - * - * @param viewId Unique id of the view. This should match the `id` from the - * `views` contribution in the package.json. - * @param provider Provider for the webview views. - * - * @return Disposable that unregisters the provider. - */ - export function registerWebviewViewProvider(viewId: string, provider: WebviewViewProvider, options?: { - /** - * Content settings for the webview created for this view. - */ - readonly webviewOptions?: { - /** - * Controls if the webview element itself (iframe) is kept around even when the view - * is no longer visible. - * - * Normally the webview's html context is created when the view becomes visible - * and destroyed when it is hidden. Extensions that have complex state - * or UI can set the `retainContextWhenHidden` to make VS Code keep the webview - * context around, even when the webview moves to a background tab. When a webview using - * `retainContextWhenHidden` becomes hidden, its scripts and other dynamic content are suspended. - * When the view becomes visible again, the context is automatically restored - * in the exact same state it was in originally. You cannot send messages to a - * hidden webview, even with `retainContextWhenHidden` enabled. - * - * `retainContextWhenHidden` has a high memory overhead and should only be used if - * your view's context cannot be quickly saved and restored. - */ - readonly retainContextWhenHidden?: boolean; - }; - }): Disposable; - } - //#endregion - //#region export interface FileSystem { diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 618ff5e5de6..2233c434ff7 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -629,7 +629,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I retainContextWhenHidden?: boolean } }) { - checkProposedApiEnabled(extension); return extHostWebviewViews.registerWebviewViewProvider(extension, viewId, provider, options?.webviewOptions); } }; From 6527a512201e9eddaffbbb3ee0d98cb11d6f6322 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Wed, 16 Sep 2020 12:23:41 -0500 Subject: [PATCH 0033/1667] Revert "Merge branch 'roblou/revertSettingsEditorChanges'" This reverts commit 3c448ca5b338ab9ce85949e5435a202e7b1c0185, reversing changes made to 8ce1c41cb910b2dedaa525f04a1c41684e0fb235. --- .../browser/media/settingsEditor2.css | 49 ++++--- .../browser/preferences.contribution.ts | 101 +++++++++++++-- .../preferences/browser/settingsEditor2.ts | 97 ++++++-------- .../preferences/browser/settingsTree.ts | 122 ++++++++++++++---- .../preferences/browser/settingsWidgets.ts | 31 ++++- .../contrib/preferences/browser/tocTree.ts | 33 ++++- 6 files changed, 314 insertions(+), 119 deletions(-) diff --git a/src/vs/workbench/contrib/preferences/browser/media/settingsEditor2.css b/src/vs/workbench/contrib/preferences/browser/media/settingsEditor2.css index 02f464009af..8b5017293dc 100644 --- a/src/vs/workbench/contrib/preferences/browser/media/settingsEditor2.css +++ b/src/vs/workbench/contrib/preferences/browser/media/settingsEditor2.css @@ -175,14 +175,14 @@ .settings-editor > .settings-body .settings-tree-container .setting-toolbar-container { position: absolute; - left: -32px; + left: -22px; top: 11px; bottom: 0px; width: 26px; } .settings-editor > .settings-body .settings-tree-container .monaco-list-row .mouseover .setting-toolbar-container > .monaco-toolbar .codicon, -.settings-editor > .settings-body .settings-tree-container .monaco-list-row .setting-item-contents.focused .setting-toolbar-container > .monaco-toolbar .codicon, +.settings-editor > .settings-body .settings-tree-container .monaco-list-row.focused .setting-item-contents .setting-toolbar-container > .monaco-toolbar .codicon, .settings-editor > .settings-body .settings-tree-container .monaco-list-row .setting-toolbar-container:hover > .monaco-toolbar .codicon, .settings-editor > .settings-body .settings-tree-container .monaco-list-row .setting-toolbar-container > .monaco-toolbar .active .codicon { opacity: 1; @@ -283,15 +283,34 @@ max-width: 1000px; margin: auto; box-sizing: border-box; - padding-left: 219px; - padding-right: 20px; + padding-left: 204px; + padding-right: 5px; overflow: visible; } +.settings-editor > .settings-body > .settings-tree-container .settings-group-title-label::before, +.settings-editor > .settings-body > .settings-tree-container .settings-group-title-label::after, +.settings-editor > .settings-body > .settings-tree-container .setting-item-contents::before, +.settings-editor > .settings-body > .settings-tree-container .setting-item-contents::after { + content: ' '; + position: absolute; + left: 0px; + right: 0px; +} + +.settings-editor > .settings-body > .settings-tree-container .settings-group-title-label::before, +.settings-editor > .settings-body > .settings-tree-container .setting-item-contents::before { + top: 0px; +} + +.settings-editor > .settings-body > .settings-tree-container .settings-group-title-label::after, +.settings-editor > .settings-body > .settings-tree-container .setting-item-contents::after { + bottom: 0px; +} + .settings-editor > .settings-body > .settings-tree-container .setting-item-contents { position: relative; - padding-top: 12px; - padding-bottom: 18px; + padding: 12px 15px 18px; white-space: normal; } @@ -299,11 +318,9 @@ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - display: inline-block; - /* size to contents for hover to show context button */ + display: inline-block; /* size to contents for hover to show context button */ } - .settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-modified-indicator { display: none; } @@ -315,7 +332,7 @@ width: 6px; border-left-width: 2px; border-left-style: solid; - left: -9px; + left: 5px; top: 15px; bottom: 16px; } @@ -528,12 +545,18 @@ } .settings-editor > .settings-body > .settings-tree-container .settings-group-title-label { + display: inline-block; margin: 0px; font-weight: 600; + height: 100%; + box-sizing: border-box; + padding: 10px; + padding-left: 15px; + width: 100%; + position: relative; } .settings-editor > .settings-body > .settings-tree-container .settings-group-level-1 { - padding-top: 23px; font-size: 24px; } @@ -542,10 +565,6 @@ font-size: 20px; } -.settings-editor > .settings-body > .settings-tree-container .settings-group-level-1.settings-group-first { - padding-top: 7px; -} - .settings-editor.search-mode > .settings-body .settings-toc-container .monaco-list-row .settings-toc-count { display: block; } diff --git a/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts b/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts index 114dd1d556e..d669a204251 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts @@ -12,7 +12,7 @@ import * as nls from 'vs/nls'; import { Action2, MenuId, MenuRegistry, registerAction2 } from 'vs/platform/actions/common/actions'; import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; -import { IsMacNativeContext } from 'vs/platform/contextkey/common/contextkeys'; +import { InputFocusedContext, IsMacNativeContext } from 'vs/platform/contextkey/common/contextkeys'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; @@ -40,6 +40,7 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences'; import { DefaultPreferencesEditorInput, KeybindingsEditorInput, PreferencesEditorInput, SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput'; import { AbstractSideBySideEditorInputFactory } from 'vs/workbench/browser/parts/editor/editor.contribution'; +import { WorkbenchListFocusContextKey } from 'vs/platform/list/browser/listService'; const SETTINGS_EDITOR_COMMAND_SEARCH = 'settings.action.search'; @@ -50,6 +51,8 @@ const SETTINGS_EDITOR_COMMAND_EDIT_FOCUSED_SETTING = 'settings.action.editFocuse const SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_FROM_SEARCH = 'settings.action.focusSettingsFromSearch'; const SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_LIST = 'settings.action.focusSettingsList'; const SETTINGS_EDITOR_COMMAND_FOCUS_TOC = 'settings.action.focusTOC'; +const SETTINGS_EDITOR_COMMAND_FOCUS_TOC2 = 'settings.action.focusTOC2'; +const SETTINGS_EDITOR_COMMAND_FOCUS_CONTROL = 'settings.action.focusSettingControl'; const SETTINGS_EDITOR_COMMAND_SWITCH_TO_JSON = 'settings.switchToJSON'; const SETTINGS_EDITOR_COMMAND_FILTER_MODIFIED = 'settings.filterByModified'; @@ -507,6 +510,14 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon } return null; } + + function settingsEditorFocusSearch(accessor: ServicesAccessor) { + const preferencesEditor = getPreferencesEditor(accessor); + if (preferencesEditor) { + preferencesEditor.focusSearch(); + } + } + registerAction2(class extends Action2 { constructor() { super({ @@ -521,12 +532,24 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon }); } - run(accessor: ServicesAccessor) { - const preferencesEditor = getPreferencesEditor(accessor); - if (preferencesEditor) { - preferencesEditor.focusSearch(); - } + run(accessor: ServicesAccessor) { settingsEditorFocusSearch(accessor); } + }); + + registerAction2(class extends Action2 { + constructor() { + super({ + id: SETTINGS_EDITOR_COMMAND_SEARCH, + precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_TOC_ROW_FOCUS), + keybinding: { + primary: KeyCode.Escape, + weight: KeybindingWeight.WorkbenchContrib, + when: null + }, + title: nls.localize('settings.focusSearch', "Focus settings search") + }); } + + run(accessor: ServicesAccessor) { settingsEditorFocusSearch(accessor); } }); registerAction2(class extends Action2 { @@ -691,16 +714,76 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon constructor() { super({ id: SETTINGS_EDITOR_COMMAND_FOCUS_TOC, - precondition: CONTEXT_SETTINGS_EDITOR, + keybinding: [ + { + primary: KeyCode.Escape, + weight: KeybindingWeight.WorkbenchContrib, + when: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_TOC_ROW_FOCUS.negate()), + }, + { + primary: KeyCode.LeftArrow, + weight: KeybindingWeight.WorkbenchContrib, + when: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_TOC_ROW_FOCUS.negate(), InputFocusedContext.negate()) + }], title: nls.localize('settings.focusSettingsTOC', "Focus settings TOC tree") }); } run(accessor: ServicesAccessor): void { const preferencesEditor = getPreferencesEditor(accessor); - if (preferencesEditor instanceof SettingsEditor2) { - preferencesEditor.focusTOC(); + if (!(preferencesEditor instanceof SettingsEditor2)) { + return; } + + if (document.activeElement?.classList.contains('monaco-list')) { + preferencesEditor.focusTOC(); + } else { + preferencesEditor.focusSettings(); + } + } + }); + + registerAction2(class extends Action2 { + constructor() { + super({ + id: SETTINGS_EDITOR_COMMAND_FOCUS_CONTROL, + precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_TOC_ROW_FOCUS.negate(), WorkbenchListFocusContextKey), + keybinding: { + primary: KeyCode.Enter, + weight: KeybindingWeight.WorkbenchContrib, + }, + title: nls.localize('settings.focusSettingControl', "Focus setting control") + }); + } + + run(accessor: ServicesAccessor): void { + const preferencesEditor = getPreferencesEditor(accessor); + if (!(preferencesEditor instanceof SettingsEditor2)) { + return; + } + + if (document.activeElement?.classList.contains('monaco-list')) { + preferencesEditor.focusSettings(true); + } + } + }); + + registerAction2(class extends Action2 { + constructor() { + super({ + id: SETTINGS_EDITOR_COMMAND_FOCUS_TOC2, + + title: nls.localize('settings.focusSettingsTOC', "Focus settings TOC tree") + }); + } + + run(accessor: ServicesAccessor): void { + const preferencesEditor = getPreferencesEditor(accessor); + if (!(preferencesEditor instanceof SettingsEditor2)) { + return; + } + + preferencesEditor.focusTOC(); } }); diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts index 17f5a27bb21..f551e44afaa 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts @@ -43,7 +43,7 @@ import { IEditorMemento, IEditorOpenContext, IEditorPane } from 'vs/workbench/co import { attachSuggestEnabledInputBoxStyler, SuggestEnabledInput } from 'vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput'; import { SettingsTarget, SettingsTargetsWidget } from 'vs/workbench/contrib/preferences/browser/preferencesWidgets'; import { commonlyUsedData, tocData } from 'vs/workbench/contrib/preferences/browser/settingsLayout'; -import { AbstractSettingRenderer, ISettingLinkClickEvent, ISettingOverrideClickEvent, resolveExtensionsSettings, resolveSettingsTree, SettingsTree, SettingTreeRenderers } from 'vs/workbench/contrib/preferences/browser/settingsTree'; +import { AbstractSettingRenderer, ISettingLinkClickEvent, ISettingOverrideClickEvent, resolveExtensionsSettings, resolveSettingsTree, SettingsTree, SettingTreeRenderers, updateSettingTreeTabOrder } from 'vs/workbench/contrib/preferences/browser/settingsTree'; import { ISettingsEditorViewState, parseQuery, SearchResultIdx, SearchResultModel, SettingsTreeElement, SettingsTreeGroupChild, SettingsTreeGroupElement, SettingsTreeModel, SettingsTreeSettingElement } from 'vs/workbench/contrib/preferences/browser/settingsTreeModels'; import { settingsTextInputBorder } from 'vs/workbench/contrib/preferences/browser/settingsWidgets'; import { createTOCIterator, TOCTree, TOCTreeModel } from 'vs/workbench/contrib/preferences/browser/tocTree'; @@ -149,6 +149,7 @@ export class SettingsEditor2 extends EditorPane { private editorMemento: IEditorMemento; private tocFocusedElement: SettingsTreeGroupElement | null = null; + private treeFocusedElement: SettingsTreeElement | null = null; private settingsTreeScrollTop = 0; private dimension!: DOM.Dimension; @@ -349,7 +350,8 @@ export class SettingsEditor2 extends EditorPane { } } - focusSettings(): void { + focusSettings(focusSettingInput = false): void { + // TODO@roblourens is this in the right place? // Update ARIA global labels const labelElement = this.settingsAriaExtraLabelsContainer.querySelector('#settings_aria_more_actions_shortcut_label'); if (labelElement) { @@ -359,9 +361,18 @@ export class SettingsEditor2 extends EditorPane { } } - const firstFocusable = this.settingsTree.getHTMLElement().querySelector(AbstractSettingRenderer.CONTROL_SELECTOR); - if (firstFocusable) { - (firstFocusable).focus(); + const focused = this.settingsTree.getFocus(); + if (!focused.length) { + this.settingsTree.focusFirst(); + } + + this.settingsTree.domFocus(); + + if (focusSettingInput) { + const controlInFocusedRow = this.settingsTree.getHTMLElement().querySelector(`.focused ${AbstractSettingRenderer.CONTROL_SELECTOR}`); + if (controlInFocusedRow) { + (controlInFocusedRow).focus(); + } } } @@ -511,6 +522,11 @@ export class SettingsEditor2 extends EditorPane { this.settingsTree.reveal(elements[0], sourceTop); + // We need to shift focus from the setting that contains the link to the setting that's + // linked. Clicking on the link sets focus on the setting that contains the link, + // which is why we need the setTimeout + setTimeout(() => this.settingsTree.setFocus([elements[0]]), 50); + const domElements = this.settingRenderers.getDOMElementsForSettingKey(this.settingsTree.getHTMLElement(), evt.targetKey); if (domElements && domElements[0]) { const control = domElements[0].querySelector(AbstractSettingRenderer.CONTROL_SELECTOR); @@ -571,48 +587,7 @@ export class SettingsEditor2 extends EditorPane { })); this.createTOC(bodyContainer); - - this.createFocusSink( - bodyContainer, - e => { - if (DOM.findParentWithClass(e.relatedTarget, 'settings-editor-tree')) { - if (this.settingsTree.scrollTop > 0) { - const firstElement = this.settingsTree.firstVisibleElement; - - if (typeof firstElement !== 'undefined') { - this.settingsTree.reveal(firstElement, 0.1); - } - - return true; - } - } else { - const firstControl = this.settingsTree.getHTMLElement().querySelector(AbstractSettingRenderer.CONTROL_SELECTOR); - if (firstControl) { - (firstControl).focus(); - } - } - - return false; - }, - 'settings list focus helper'); - this.createSettingsTree(bodyContainer); - - this.createFocusSink( - bodyContainer, - e => { - if (DOM.findParentWithClass(e.relatedTarget, 'settings-editor-tree')) { - if (this.settingsTree.scrollTop < this.settingsTree.scrollHeight) { - const lastElement = this.settingsTree.lastVisibleElement; - this.settingsTree.reveal(lastElement, 0.9); - return true; - } - } - - return false; - }, - 'settings list focus helper' - ); } private addCtrlAInterceptor(container: HTMLElement): void { @@ -630,19 +605,6 @@ export class SettingsEditor2 extends EditorPane { })); } - private createFocusSink(container: HTMLElement, callback: (e: any) => boolean, label: string): HTMLElement { - const listFocusSink = DOM.append(container, $('.settings-tree-focus-sink')); - listFocusSink.setAttribute('aria-label', label); - listFocusSink.tabIndex = 0; - this._register(DOM.addDisposableListener(listFocusSink, 'focus', (e: any) => { - if (e.relatedTarget && callback(e)) { - e.relatedTarget.focus(); - } - })); - - return listFocusSink; - } - private createTOC(parent: HTMLElement): void { this.tocTreeModel = this.instantiationService.createInstance(TOCTreeModel, this.viewState); this.tocTreeContainer = DOM.append(parent, $('.settings-toc-container')); @@ -670,6 +632,7 @@ export class SettingsEditor2 extends EditorPane { } } else if (element && (!e.browserEvent || !(e.browserEvent).fromScroll)) { this.settingsTree.reveal(element, 0); + this.settingsTree.setFocus([element]); } })); @@ -719,7 +682,6 @@ export class SettingsEditor2 extends EditorPane { this.settingsTreeContainer, this.viewState, this.settingRenderers.allRenderers)); - this.settingsTree.getHTMLElement().attributes.removeNamedItem('tabindex'); this._register(this.settingsTree.onDidScroll(() => { if (this.settingsTree.scrollTop === this.settingsTreeScrollTop) { @@ -727,6 +689,7 @@ export class SettingsEditor2 extends EditorPane { } this.settingsTreeScrollTop = this.settingsTree.scrollTop; + updateSettingTreeTabOrder(this.settingsTreeContainer); // setTimeout because calling setChildren on the settingsTree can trigger onDidScroll, so it fires when // setChildren has called on the settings tree but not the toc tree yet, so their rendered elements are out of sync @@ -734,6 +697,20 @@ export class SettingsEditor2 extends EditorPane { this.updateTreeScrollSync(); }, 0); })); + + // There is no different select state in the settings tree + this._register(this.settingsTree.onDidChangeFocus(e => { + const element = e.elements[0]; + if (this.treeFocusedElement === element) { + return; + } + + this.treeFocusedElement = element; + this.settingsTree.setSelection(element ? [element] : []); + + // Wait for rendering to complete + setTimeout(() => updateSettingTreeTabOrder(this.settingsTreeContainer), 0); + })); } private notifyNoSaveNeeded() { diff --git a/src/vs/workbench/contrib/preferences/browser/settingsTree.ts b/src/vs/workbench/contrib/preferences/browser/settingsTree.ts index dc5a734b6f6..df568849718 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsTree.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsTree.ts @@ -5,7 +5,6 @@ import { BrowserFeatures } from 'vs/base/browser/canIUse'; import * as DOM from 'vs/base/browser/dom'; -import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { renderMarkdown } from 'vs/base/browser/markdownRenderer'; import { IMouseEvent } from 'vs/base/browser/mouseEvent'; import { alert as ariaAlert } from 'vs/base/browser/ui/aria/aria'; @@ -16,7 +15,7 @@ import { CachedListVirtualDelegate } from 'vs/base/browser/ui/list/list'; import { DefaultStyleController } from 'vs/base/browser/ui/list/listWidget'; import { ISelectOptionItem, SelectBox } from 'vs/base/browser/ui/selectBox/selectBox'; import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar'; -import { IObjectTreeOptions, ObjectTree } from 'vs/base/browser/ui/tree/objectTree'; +import { IObjectTreeOptions } from 'vs/base/browser/ui/tree/objectTree'; import { ObjectTreeModel } from 'vs/base/browser/ui/tree/objectTreeModel'; import { ITreeFilter, ITreeModel, ITreeNode, ITreeRenderer, TreeFilterResult, TreeVisibility } from 'vs/base/browser/ui/tree/tree'; import { Action, IAction, Separator } from 'vs/base/common/actions'; @@ -43,7 +42,7 @@ import { ICssStyleCollector, IColorTheme, IThemeService, registerThemingParticip import { getIgnoredSettings } from 'vs/platform/userDataSync/common/settingsMerge'; import { ITOCEntry } from 'vs/workbench/contrib/preferences/browser/settingsLayout'; import { ISettingsEditorViewState, settingKeyToDisplayFormat, SettingsTreeElement, SettingsTreeGroupChild, SettingsTreeGroupElement, SettingsTreeNewExtensionsElement, SettingsTreeSettingElement } from 'vs/workbench/contrib/preferences/browser/settingsTreeModels'; -import { ExcludeSettingWidget, ISettingListChangeEvent, IListDataItem, ListSettingWidget, settingsHeaderForeground, settingsNumberInputBackground, settingsNumberInputBorder, settingsNumberInputForeground, settingsSelectBackground, settingsSelectBorder, settingsSelectForeground, settingsSelectListBorder, settingsTextInputBackground, settingsTextInputBorder, settingsTextInputForeground, ObjectSettingWidget, IObjectDataItem, IObjectEnumOption, ObjectValue, IObjectValueSuggester, IObjectKeySuggester } from 'vs/workbench/contrib/preferences/browser/settingsWidgets'; +import { ExcludeSettingWidget, ISettingListChangeEvent, IListDataItem, ListSettingWidget, settingsNumberInputBackground, settingsNumberInputBorder, settingsNumberInputForeground, settingsSelectBackground, settingsSelectBorder, settingsSelectForeground, settingsSelectListBorder, settingsTextInputBackground, settingsTextInputBorder, settingsTextInputForeground, ObjectSettingWidget, IObjectDataItem, IObjectEnumOption, ObjectValue, IObjectValueSuggester, IObjectKeySuggester, focusedRowBackground, focusedRowBorder, settingsHeaderForeground, rowHoverBackground } from 'vs/workbench/contrib/preferences/browser/settingsWidgets'; import { SETTINGS_EDITOR_COMMAND_SHOW_CONTEXT_MENU } from 'vs/workbench/contrib/preferences/common/preferences'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { ISetting, ISettingsGroup, SettingValueType } from 'vs/workbench/services/preferences/common/preferences'; @@ -53,6 +52,9 @@ import { Codicon } from 'vs/base/common/codicons'; import { CodiconLabel } from 'vs/base/browser/ui/codicons/codiconLabel'; import { IJSONSchema } from 'vs/base/common/jsonSchema'; import { IList } from 'vs/base/browser/ui/tree/indexTreeModel'; +import { IListService, WorkbenchObjectTree } from 'vs/platform/list/browser/listService'; +import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; const $ = DOM.$; @@ -451,6 +453,45 @@ export interface ISettingOverrideClickEvent { targetKey: string; } +function removeChildrenFromTabOrder(node: Element): void { + const focusableElements = node.querySelectorAll(` + [tabindex="0"], + input:not([tabindex="-1"]), + select:not([tabindex="-1"]), + textarea:not([tabindex="-1"]), + a:not([tabindex="-1"]), + button:not([tabindex="-1"]), + area:not([tabindex="-1"]) + `); + + focusableElements.forEach(element => { + element.setAttribute(AbstractSettingRenderer.ELEMENT_FOCUSABLE_ATTR, 'true'); + element.setAttribute('tabindex', '-1'); + }); +} + +function addChildrenToTabOrder(node: Element): void { + const focusableElements = node.querySelectorAll( + `[${AbstractSettingRenderer.ELEMENT_FOCUSABLE_ATTR}="true"]` + ); + + focusableElements.forEach(element => { + element.removeAttribute(AbstractSettingRenderer.ELEMENT_FOCUSABLE_ATTR); + element.setAttribute('tabindex', '0'); + }); +} + +export function updateSettingTreeTabOrder(container: Element): void { + const allRows = [...container.querySelectorAll(AbstractSettingRenderer.ALL_ROWS_SELECTOR)]; + const focusedRow = allRows.find(row => row.classList.contains('focused')); + + allRows.forEach(removeChildrenFromTabOrder); + + if (isDefined(focusedRow)) { + addChildrenToTabOrder(focusedRow); + } +} + export abstract class AbstractSettingRenderer extends Disposable implements ITreeRenderer { /** To override */ abstract get templateId(): string; @@ -459,9 +500,11 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre static readonly CONTROL_SELECTOR = '.' + AbstractSettingRenderer.CONTROL_CLASS; static readonly CONTENTS_CLASS = 'setting-item-contents'; static readonly CONTENTS_SELECTOR = '.' + AbstractSettingRenderer.CONTENTS_CLASS; + static readonly ALL_ROWS_SELECTOR = '.monaco-list-row'; static readonly SETTING_KEY_ATTR = 'data-key'; static readonly SETTING_ID_ATTR = 'data-id'; + static readonly ELEMENT_FOCUSABLE_ATTR = 'data-focusable'; private readonly _onDidClickOverrideElement = this._register(new Emitter()); readonly onDidClickOverrideElement: Event = this._onDidClickOverrideElement.event; @@ -607,7 +650,7 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre private fixToolbarIcon(toolbar: ToolBar): void { const button = toolbar.getElement().querySelector('.codicon-toolbar-more'); if (button) { - (button).tabIndex = -1; + (button).tabIndex = 0; // change icon from ellipsis to gear (button).classList.add('codicon-gear'); @@ -1248,6 +1291,15 @@ export class SettingTextRenderer extends AbstractSettingRenderer implements ITre })); common.toDispose.add(inputBox); inputBox.inputElement.classList.add(AbstractSettingRenderer.CONTROL_CLASS); + inputBox.inputElement.tabIndex = 0; + + // TODO@9at8: listWidget filters out all key events from input boxes, so we need to come up with a better way + // Disable ArrowUp and ArrowDown behaviour in favor of list navigation + common.toDispose.add(DOM.addStandardDisposableListener(inputBox.inputElement, DOM.EventType.KEY_DOWN, e => { + if (e.equals(KeyCode.UpArrow) || e.equals(KeyCode.DownArrow)) { + e.preventDefault(); + } + })); const template: ISettingTextItemTemplate = { ...common, @@ -1300,6 +1352,7 @@ export class SettingEnumRenderer extends AbstractSettingRenderer implements ITre const selectElement = common.controlElement.querySelector('select'); if (selectElement) { selectElement.classList.add(AbstractSettingRenderer.CONTROL_CLASS); + selectElement.tabIndex = 0; } common.toDispose.add( @@ -1392,6 +1445,7 @@ export class SettingNumberRenderer extends AbstractSettingRenderer implements IT })); common.toDispose.add(inputBox); inputBox.inputElement.classList.add(AbstractSettingRenderer.CONTROL_CLASS); + inputBox.inputElement.tabIndex = 0; const template: ISettingNumberItemTemplate = { ...common, @@ -1504,13 +1558,6 @@ export class SettingBoolRenderer extends AbstractSettingRenderer implements ITre // Prevent clicks from being handled by list toDispose.add(DOM.addDisposableListener(controlElement, 'mousedown', (e: IMouseEvent) => e.stopPropagation())); - - toDispose.add(DOM.addStandardDisposableListener(controlElement, 'keydown', (e: StandardKeyboardEvent) => { - if (e.keyCode === KeyCode.Escape) { - e.browserEvent.stopPropagation(); - } - })); - toDispose.add(DOM.addDisposableListener(titleElement, DOM.EventType.MOUSE_ENTER, e => container.classList.add('mouseover'))); toDispose.add(DOM.addDisposableListener(titleElement, DOM.EventType.MOUSE_LEAVE, e => container.classList.remove('mouseover'))); @@ -1834,11 +1881,7 @@ class SettingsTreeDelegate extends CachedListVirtualDelegate extends ObjectTreeModel { } } -export class SettingsTree extends ObjectTree { +export class SettingsTree extends WorkbenchObjectTree { constructor( container: HTMLElement, viewState: ISettingsEditorViewState, renderers: ITreeRenderer[], + @IContextKeyService contextKeyService: IContextKeyService, + @IListService listService: IListService, @IThemeService themeService: IThemeService, @IConfigurationService configurationService: IConfigurationService, + @IKeybindingService keybindingService: IKeybindingService, + @IAccessibilityService accessibilityService: IAccessibilityService, @IInstantiationService instantiationService: IInstantiationService, ) { super('SettingsTree', container, new SettingsTreeDelegate(), renderers, { + horizontalScrolling: false, supportDynamicHeights: true, identityProvider: { getId(e) { @@ -1875,9 +1923,6 @@ export class SettingsTree extends ObjectTree { } }, accessibilityProvider: { - getWidgetRole() { - return 'form'; - }, getAriaLabel() { // TODO@roblourens https://github.com/microsoft/vscode/issues/95862 return ''; @@ -1889,9 +1934,16 @@ export class SettingsTree extends ObjectTree { styleController: id => new DefaultStyleController(DOM.createStyleSheet(container), id), filter: instantiationService.createInstance(SettingsTreeFilter, viewState), smoothScrolling: configurationService.getValue('workbench.list.smoothScrolling'), - }); + multipleSelectionSupport: false, + }, + contextKeyService, + listService, + themeService, + configurationService, + keybindingService, + accessibilityService, + ); - this.disposables.clear(); this.disposables.add(registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) => { const activeBorderColor = theme.getColor(focusBorder); if (activeBorderColor) { @@ -1930,6 +1982,26 @@ export class SettingsTree extends ObjectTree { collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .setting-item.invalid-input .setting-item-control .monaco-inputbox.idle { outline-width: 0; border-style:solid; border-width: 1px; border-color: ${invalidInputBorder}; }`); } + const focusedRowBackgroundColor = theme.getColor(focusedRowBackground); + if (focusedRowBackgroundColor) { + collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .monaco-list-row.focused .setting-item-contents, + .settings-editor > .settings-body > .settings-tree-container .monaco-list-row.focused .settings-group-title-label { background-color: ${focusedRowBackgroundColor}; }`); + } + + const rowHoverBackgroundColor = theme.getColor(rowHoverBackground); + if (rowHoverBackgroundColor) { + collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .monaco-list-row .setting-item-contents:hover, + .settings-editor > .settings-body > .settings-tree-container .monaco-list-row .settings-group-title-label:hover { background-color: ${rowHoverBackgroundColor}; }`); + } + + const focusedRowBorderColor = theme.getColor(focusedRowBorder); + if (focusedRowBorderColor) { + collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .monaco-list:focus-within .monaco-list-row.focused .setting-item-contents::before, + .settings-editor > .settings-body > .settings-tree-container .monaco-list:focus-within .monaco-list-row.focused .setting-item-contents::after { border-top: 1px solid ${focusedRowBorderColor} }`); + collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .monaco-list:focus-within .monaco-list-row.focused .settings-group-title-label::before, + .settings-editor > .settings-body > .settings-tree-container .monaco-list:focus-within .monaco-list-row.focused .settings-group-title-label::after { border-top: 1px solid ${focusedRowBorderColor} }`); + } + const headerForegroundColor = theme.getColor(settingsHeaderForeground); if (headerForegroundColor) { collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .settings-group-title-label { color: ${headerForegroundColor}; }`); @@ -1940,6 +2012,12 @@ export class SettingsTree extends ObjectTree { if (focusBorderColor) { collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-markdown a:focus { outline-color: ${focusBorderColor} }`); } + + // const listActiveSelectionBackgroundColor = theme.getColor(listActiveSelectionBackground); + // if (listActiveSelectionBackgroundColor) { + // collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .monaco-list-row.selected .setting-item-contents .setting-item-title { background-color: ${listActiveSelectionBackgroundColor}; }`); + // collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .monaco-list-row.selected .settings-group-title-label { background-color: ${listActiveSelectionBackgroundColor}; }`); + // } })); this.getHTMLElement().classList.add('settings-editor-tree'); diff --git a/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts b/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts index d7f85b56922..5eaab66e56c 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts @@ -16,7 +16,7 @@ import { Disposable, DisposableStore } from 'vs/base/common/lifecycle'; import 'vs/css!./media/settingsWidgets'; import { localize } from 'vs/nls'; import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; -import { foreground, inputBackground, inputBorder, inputForeground, listActiveSelectionBackground, listActiveSelectionForeground, listHoverBackground, listHoverForeground, listInactiveSelectionBackground, listInactiveSelectionForeground, registerColor, selectBackground, selectBorder, selectForeground, textLinkForeground, textPreformatForeground, editorWidgetBorder, textLinkActiveForeground, simpleCheckboxBackground, simpleCheckboxForeground, simpleCheckboxBorder } from 'vs/platform/theme/common/colorRegistry'; +import { foreground, inputBorder, inputForeground, listActiveSelectionBackground, listActiveSelectionForeground, listHoverBackground, listHoverForeground, listInactiveSelectionBackground, listInactiveSelectionForeground, registerColor, selectBackground, selectBorder, selectForeground, textLinkForeground, textPreformatForeground, editorWidgetBorder, textLinkActiveForeground, simpleCheckboxBackground, simpleCheckboxForeground, simpleCheckboxBorder, listFocusBackground, transparent, focusBorder } from 'vs/platform/theme/common/colorRegistry'; import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler'; import { ICssStyleCollector, IColorTheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { disposableTimeout } from 'vs/base/common/async'; @@ -25,6 +25,7 @@ import { preferencesEditIcon } from 'vs/workbench/contrib/preferences/browser/pr import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox'; import { isIOS } from 'vs/base/common/platform'; import { BrowserFeatures } from 'vs/base/browser/canIUse'; +import { PANEL_BORDER } from 'vs/workbench/common/theme'; const $ = DOM.$; export const settingsHeaderForeground = registerColor('settings.headerForeground', { light: '#444444', dark: '#e7e7e7', hc: '#ffffff' }, localize('headerForeground', "The foreground color for a section header or active title.")); @@ -46,15 +47,33 @@ export const settingsCheckboxForeground = registerColor('settings.checkboxForegr export const settingsCheckboxBorder = registerColor('settings.checkboxBorder', { dark: simpleCheckboxBorder, light: simpleCheckboxBorder, hc: simpleCheckboxBorder }, localize('settingsCheckboxBorder', "Settings editor checkbox border.")); // Text control colors -export const settingsTextInputBackground = registerColor('settings.textInputBackground', { dark: inputBackground, light: inputBackground, hc: inputBackground }, localize('textInputBoxBackground', "Settings editor text input box background.")); +export const settingsTextInputBackground = settingsSelectBackground; //registerColor('settings.textInputBackground', { dark: inputBackground, light: inputBackground, hc: inputBackground }, localize('textInputBoxBackground', "Settings editor text input box background.")); export const settingsTextInputForeground = registerColor('settings.textInputForeground', { dark: inputForeground, light: inputForeground, hc: inputForeground }, localize('textInputBoxForeground', "Settings editor text input box foreground.")); export const settingsTextInputBorder = registerColor('settings.textInputBorder', { dark: inputBorder, light: inputBorder, hc: inputBorder }, localize('textInputBoxBorder', "Settings editor text input box border.")); // Number control colors -export const settingsNumberInputBackground = registerColor('settings.numberInputBackground', { dark: inputBackground, light: inputBackground, hc: inputBackground }, localize('numberInputBoxBackground', "Settings editor number input box background.")); +export const settingsNumberInputBackground = settingsSelectBackground; // registerColor('settings.numberInputBackground', { dark: inputBackground, light: inputBackground, hc: inputBackground }, localize('numberInputBoxBackground', "Settings editor number input box background.")); export const settingsNumberInputForeground = registerColor('settings.numberInputForeground', { dark: inputForeground, light: inputForeground, hc: inputForeground }, localize('numberInputBoxForeground', "Settings editor number input box foreground.")); export const settingsNumberInputBorder = registerColor('settings.numberInputBorder', { dark: inputBorder, light: inputBorder, hc: inputBorder }, localize('numberInputBoxBorder', "Settings editor number input box border.")); +export const focusedRowBackground = registerColor('settings.focusedRowBackground', { + dark: transparent(PANEL_BORDER, .4), + light: transparent(listFocusBackground, .4), + hc: null +}, localize('focusedRowBackground', "The background color of a cell when the row is focused.")); + +export const rowHoverBackground = registerColor('notebook.rowHoverBackground', { + dark: transparent(focusedRowBackground, .5), + light: transparent(focusedRowBackground, .7), + hc: null +}, localize('notebook.rowHoverBackground', "The background color of a row when the row is hovered.")); + +export const focusedRowBorder = registerColor('notebook.focusedRowBorder', { + dark: Color.white.transparent(0.12), + light: Color.black.transparent(0.12), + hc: focusBorder +}, localize('notebook.focusedRowBorder', "The color of the row's top and bottom border when the row is focused.")); + registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) => { const checkboxBackgroundColor = theme.getColor(settingsCheckboxBackground); if (checkboxBackgroundColor) { @@ -527,7 +546,7 @@ export class ListSettingWidget extends AbstractListSettingWidget valueInput.element.classList.add('setting-list-valueInput'); this.listDisposables.add(attachInputBoxStyler(valueInput, this.themeService, { - inputBackground: settingsTextInputBackground, + inputBackground: settingsSelectBackground, inputForeground: settingsTextInputForeground, inputBorder: settingsTextInputBorder })); @@ -546,7 +565,7 @@ export class ListSettingWidget extends AbstractListSettingWidget siblingInput.element.classList.add('setting-list-siblingInput'); this.listDisposables.add(siblingInput); this.listDisposables.add(attachInputBoxStyler(siblingInput, this.themeService, { - inputBackground: settingsTextInputBackground, + inputBackground: settingsSelectBackground, inputForeground: settingsTextInputForeground, inputBorder: settingsTextInputBorder })); @@ -908,7 +927,7 @@ export class ObjectSettingWidget extends AbstractListSettingWidget { +export class TOCTree extends WorkbenchObjectTree { constructor( container: HTMLElement, viewState: ISettingsEditorViewState, + @IContextKeyService contextKeyService: IContextKeyService, + @IListService listService: IListService, @IThemeService themeService: IThemeService, - @IInstantiationService instantiationService: IInstantiationService + @IConfigurationService configurationService: IConfigurationService, + @IKeybindingService keybindingService: IKeybindingService, + @IAccessibilityService accessibilityService: IAccessibilityService, + @IInstantiationService instantiationService: IInstantiationService, ) { // test open mode const filter = instantiationService.createInstance(SettingsTreeFilter, viewState); - const options: IObjectTreeOptions = { + const options: IWorkbenchObjectTreeOptions = { filter, multipleSelectionSupport: false, identityProvider: { @@ -207,13 +216,23 @@ export class TOCTree extends ObjectTree { }, styleController: id => new DefaultStyleController(DOM.createStyleSheet(container), id), accessibilityProvider: instantiationService.createInstance(SettingsAccessibilityProvider), - collapseByDefault: true + collapseByDefault: true, + horizontalScrolling: false }; - super('SettingsTOC', container, + super( + 'SettingsTOC', + container, new TOCTreeDelegate(), [new TOCRenderer()], - options); + options, + contextKeyService, + listService, + themeService, + configurationService, + keybindingService, + accessibilityService, + ); this.disposables.add(attachStyler(themeService, { listBackground: editorBackground, From 1893b55c25d979d008ea3f6955c58ac800e4ae99 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Wed, 16 Sep 2020 17:06:30 -0500 Subject: [PATCH 0034/1667] Skip smoketest #105330 --- test/smoke/src/areas/notebook/notebook.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/smoke/src/areas/notebook/notebook.test.ts b/test/smoke/src/areas/notebook/notebook.test.ts index 4ceb37250f3..4e946ffcbe1 100644 --- a/test/smoke/src/areas/notebook/notebook.test.ts +++ b/test/smoke/src/areas/notebook/notebook.test.ts @@ -63,7 +63,7 @@ export function setup() { await app.workbench.notebook.waitForActiveCellEditorContents('code()'); }); - it('cell action execution', async function () { + it.skip('cell action execution', async function () { const app = this.app as Application; await app.workbench.notebook.openNotebook(); await app.workbench.notebook.insertNotebookCell('code'); From 479971440393f87108ad93acbfaa99fa4240941b Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 16 Sep 2020 14:59:47 -0700 Subject: [PATCH 0035/1667] Remove extra awaits These functions return void so we don't need to await them --- extensions/vscode-api-tests/src/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/vscode-api-tests/src/utils.ts b/extensions/vscode-api-tests/src/utils.ts index 475fa6cfbf4..392d0be8461 100644 --- a/extensions/vscode-api-tests/src/utils.ts +++ b/extensions/vscode-api-tests/src/utils.ts @@ -22,13 +22,13 @@ export async function createRandomFile(contents = '', dir: vscode.Uri | undefine } else { fakeFile = vscode.Uri.parse(`${testFs.scheme}:/${rndName() + ext}`); } - await testFs.writeFile(fakeFile, Buffer.from(contents), { create: true, overwrite: true }); + testFs.writeFile(fakeFile, Buffer.from(contents), { create: true, overwrite: true }); return fakeFile; } export async function deleteFile(file: vscode.Uri): Promise { try { - await testFs.delete(file); + testFs.delete(file); return true; } catch { return false; From d29fc5038adfa343059c99cddaec13dd1da1ef33 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 16 Sep 2020 15:33:10 -0700 Subject: [PATCH 0036/1667] Make sure we dispose/track disposed webviews in webview views Fixes #106826 --- src/vs/workbench/api/common/extHostWebview.ts | 8 ++++++-- src/vs/workbench/api/common/extHostWebviewView.ts | 4 ++++ .../contrib/webviewView/browser/webviewViewPane.ts | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/api/common/extHostWebview.ts b/src/vs/workbench/api/common/extHostWebview.ts index e5dc3c670d5..1411775a7a8 100644 --- a/src/vs/workbench/api/common/extHostWebview.ts +++ b/src/vs/workbench/api/common/extHostWebview.ts @@ -54,6 +54,8 @@ export class ExtHostWebview implements vscode.Webview { /* internal */ readonly _onDidDispose: Event = this.#onDidDisposeEmitter.event; public dispose() { + this.#isDisposed = true; + this.#onDidDisposeEmitter.fire(); this.#onDidDisposeEmitter.dispose(); @@ -99,8 +101,10 @@ export class ExtHostWebview implements vscode.Webview { this.#options = newOptions; } - public postMessage(message: any): Promise { - this.assertNotDisposed(); + public async postMessage(message: any): Promise { + if (this.#isDisposed) { + return false; + } return this.#proxy.$postMessage(this.#handle, message); } diff --git a/src/vs/workbench/api/common/extHostWebviewView.ts b/src/vs/workbench/api/common/extHostWebviewView.ts index 9cbff1880d5..a9f3db59641 100644 --- a/src/vs/workbench/api/common/extHostWebviewView.ts +++ b/src/vs/workbench/api/common/extHostWebviewView.ts @@ -51,6 +51,8 @@ class ExtHostWebviewView extends Disposable implements vscode.WebviewView { this.#isDisposed = true; this.#onDidDispose.fire(); + this.#webview.dispose(); + super.dispose(); } @@ -186,6 +188,8 @@ export class ExtHostWebviewViews implements extHostProtocol.ExtHostWebviewViewsS const webviewView = this.getWebviewView(webviewHandle); this._webviewViews.delete(webviewHandle); webviewView.dispose(); + + this._extHostWebview.deleteWebview(webviewHandle); } private getWebviewView(handle: string): ExtHostWebviewView { diff --git a/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.ts b/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.ts index 8e2849173f7..c4b7399bdff 100644 --- a/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.ts +++ b/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.ts @@ -89,6 +89,8 @@ export class WebviewViewPane extends ViewPane { dispose() { this._onDispose.fire(); + this._webview?.dispose(); + super.dispose(); } From 480b18a8d3675c37c8d5313db82f801828544b4c Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 16 Sep 2020 15:36:14 -0700 Subject: [PATCH 0037/1667] debug: apply polish to auto attach switcher --- extensions/debug-auto-launch/src/extension.ts | 59 +++++++++++-------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/extensions/debug-auto-launch/src/extension.ts b/extensions/debug-auto-launch/src/extension.ts index cd00d9eed94..b8d23fc2142 100644 --- a/extensions/debug-auto-launch/src/extension.ts +++ b/extensions/debug-auto-launch/src/extension.ts @@ -11,6 +11,15 @@ const localize = nls.loadMessageBundle(); const TEXT_ALWAYS = localize('status.text.auto.attach.always', 'Auto Attach: Always'); const TEXT_SMART = localize('status.text.auto.attach.smart', 'Auto Attach: Smart'); const TEXT_WITH_FLAG = localize('status.text.auto.attach.withFlag', 'Auto Attach: With Flag'); +const TEXT_STATE_LABEL = { + [State.Disabled]: localize('debug.javascript.autoAttach.disabled.label', 'Disabled'), + [State.Always]: localize('debug.javascript.autoAttach.always.label', 'Always'), + [State.Smart]: localize('debug.javascript.autoAttach.smart.label', 'Smart'), + [State.OnlyWithFlag]: localize( + 'debug.javascript.autoAttach.onlyWithFlag.label', + 'Only With Flag', + ), +}; const TEXT_STATE_DESCRIPTION = { [State.Disabled]: localize( 'debug.javascript.autoAttach.disabled.description', @@ -29,6 +38,8 @@ const TEXT_STATE_DESCRIPTION = { 'Only auto attach when the `--inspect` flag is given', ), }; +const TEXT_TOGGLE_WORKSPACE = localize('scope.workspace', 'Toggle auto attach in this workspace'); +const TEXT_TOGGLE_GLOBAL = localize('scope.global', 'Toggle auto attach on this machine'); const TOGGLE_COMMAND = 'extension.node-debug.toggleAutoAttach'; const STORAGE_IPC = 'jsDebugIpcState'; @@ -82,11 +93,6 @@ export async function deactivate(): Promise { await destroyAttachServer(); } -type StatePickItem = - | (vscode.QuickPickItem & { state: State }) - | (vscode.QuickPickItem & { scope: vscode.ConfigurationTarget }) - | (vscode.QuickPickItem & { type: 'separator' }); - function getDefaultScope(info: ReturnType) { if (!info) { return vscode.ConfigurationTarget.Global; @@ -101,39 +107,44 @@ function getDefaultScope(info: ReturnType { const section = vscode.workspace.getConfiguration(SETTING_SECTION); scope = scope || getDefaultScope(section.inspect(SETTING_STATE)); - const stateItems = [State.Always, State.Smart, State.OnlyWithFlag, State.Disabled].map(state => ({ + const isGlobalScope = scope === vscode.ConfigurationTarget.Global; + const quickPick = vscode.window.createQuickPick(); + const current = readCurrentState(); + + quickPick.items = [State.Always, State.Smart, State.OnlyWithFlag, State.Disabled].map(state => ({ state, - label: state.slice(0, 1).toUpperCase() + state.slice(1), + label: TEXT_STATE_LABEL[state], description: TEXT_STATE_DESCRIPTION[state], alwaysShow: true, })); - const scopeItem = - scope === vscode.ConfigurationTarget.Global - ? { - label: localize('scope.workspace', 'Toggle in this workspace $(arrow-right)'), - scope: vscode.ConfigurationTarget.Workspace, - } - : { - label: localize('scope.global', 'Toggle for this machine $(arrow-right)'), - scope: vscode.ConfigurationTarget.Global, - }; - - const quickPick = vscode.window.createQuickPick(); - // todo: have a separator here, see https://github.com/microsoft/vscode/issues/74967 - quickPick.items = [...stateItems, scopeItem]; + quickPick.activeItems = quickPick.items.filter(i => i.state === current); + quickPick.title = isGlobalScope ? TEXT_TOGGLE_GLOBAL : TEXT_TOGGLE_WORKSPACE; + quickPick.buttons = [ + { + iconPath: new vscode.ThemeIcon(isGlobalScope ? 'folder' : 'globe'), + tooltip: isGlobalScope ? TEXT_TOGGLE_WORKSPACE : TEXT_TOGGLE_GLOBAL, + }, + ]; quickPick.show(); - const current = readCurrentState(); - quickPick.activeItems = stateItems.filter(i => i.state === current); - const result = await new Promise(resolve => { + const result = await new Promise(resolve => { quickPick.onDidAccept(() => resolve(quickPick.selectedItems[0])); quickPick.onDidHide(() => resolve()); + quickPick.onDidTriggerButton(() => { + resolve({ + scope: isGlobalScope + ? vscode.ConfigurationTarget.Workspace + : vscode.ConfigurationTarget.Global, + }); + }); }); quickPick.dispose(); From 2e10ab2a95cc9f380b871cca6ec99c6b05ee9aa9 Mon Sep 17 00:00:00 2001 From: Rachel Macfarlane Date: Wed, 16 Sep 2020 15:39:43 -0700 Subject: [PATCH 0038/1667] Possibly improve logging on token refresh fail --- extensions/microsoft-authentication/src/AADHelper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/microsoft-authentication/src/AADHelper.ts b/extensions/microsoft-authentication/src/AADHelper.ts index 6f437ca401a..7b14ad39c90 100644 --- a/extensions/microsoft-authentication/src/AADHelper.ts +++ b/extensions/microsoft-authentication/src/AADHelper.ts @@ -525,7 +525,7 @@ export class AzureActiveDirectoryService { Logger.info('Token refresh success'); return token; } else { - Logger.error('Refreshing token failed'); + Logger.error(`Refreshing token failed: ${result.statusText}`); throw new Error('Refreshing token failed.'); } } catch (e) { From 1e0080c9a2bc3600e1b1e18d3a20b32c23c92f2f Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Wed, 16 Sep 2020 17:40:41 -0500 Subject: [PATCH 0039/1667] Tweak quotes in setting description --- src/vs/editor/common/config/editorOptions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index ce4dda6a1db..61e1bdd8dd4 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -3830,7 +3830,7 @@ export const EditorOptions = { cursorSurroundingLines: register(new EditorIntOption( EditorOption.cursorSurroundingLines, 'cursorSurroundingLines', 0, 0, Constants.MAX_SAFE_SMALL_INTEGER, - { description: nls.localize('cursorSurroundingLines', "Controls the minimal number of visible leading and trailing lines surrounding the cursor. Known as 'scrollOff' or `scrollOffset` in some other editors.") } + { description: nls.localize('cursorSurroundingLines', "Controls the minimal number of visible leading and trailing lines surrounding the cursor. Known as 'scrollOff' or 'scrollOffset' in some other editors.") } )), cursorSurroundingLinesStyle: register(new EditorStringEnumOption( EditorOption.cursorSurroundingLinesStyle, 'cursorSurroundingLinesStyle', From 6663bb658ea24f4e182594d7e3669cfa8a526c2c Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 17 Sep 2020 00:41:24 +0200 Subject: [PATCH 0040/1667] Move switch settings sync service during turn on --- .../userDataSync/browser/userDataSync.ts | 113 +++++++----------- .../browser/userDataSyncWorkbenchService.ts | 28 +---- .../userDataSync/common/userDataSync.ts | 3 +- 3 files changed, 45 insertions(+), 99 deletions(-) diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts index ec3c96b7a56..52a0041eafa 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts @@ -30,7 +30,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IUserDataAutoSyncService, IUserDataSyncService, registerConfiguration, SyncResource, SyncStatus, UserDataSyncError, UserDataSyncErrorCode, USER_DATA_SYNC_SCHEME, IUserDataSyncResourceEnablementService, - getSyncResourceFromLocalPreview, IResourcePreview, IUserDataSyncStoreManagementService, UserDataSyncStoreType + getSyncResourceFromLocalPreview, IResourcePreview, IUserDataSyncStoreManagementService, UserDataSyncStoreType, IUserDataSyncStore } from 'vs/platform/userDataSync/common/userDataSync'; import { FloatingClickWidget } from 'vs/workbench/browser/parts/editor/editorWidgets'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; @@ -54,7 +54,6 @@ import { Codicon } from 'vs/base/common/codicons'; import { ViewContainerLocation, IViewContainersRegistry, Extensions, ViewContainer } from 'vs/workbench/common/views'; import { UserDataSyncViewPaneContainer, UserDataSyncDataViews } from 'vs/workbench/contrib/userDataSync/browser/userDataSyncViews'; import { IUserDataSyncWorkbenchService, getSyncAreaLabel, AccountStatus, CONTEXT_SYNC_STATE, CONTEXT_SYNC_ENABLEMENT, CONTEXT_ACCOUNT_STATE, CONFIGURE_SYNC_COMMAND_ID, SHOW_SYNC_LOG_COMMAND_ID, SYNC_VIEW_CONTAINER_ID, SYNC_TITLE } from 'vs/workbench/services/userDataSync/common/userDataSync'; -import { isNative } from 'vs/base/common/platform'; const CONTEXT_CONFLICTS_SOURCES = new RawContextKey('conflictsSources', ''); @@ -443,6 +442,9 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo if (!turnOn) { return; } + if (this.userDataSyncStoreManagementService.userDataSyncStore?.canSwitch) { + await this.selectSettingsSyncService(this.userDataSyncStoreManagementService.userDataSyncStore); + } await this.userDataSyncWorkbenchService.turnOn(); this.storageService.store('sync.donotAskPreviewConfirmation', true, StorageScope.GLOBAL); } catch (e) { @@ -674,52 +676,46 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo return this.outputService.showChannel(Constants.userDataSyncLogChannelId); } - private async switchSyncService(): Promise { - const userDataSyncStore = this.userDataSyncStoreManagementService.userDataSyncStore; - if (userDataSyncStore?.canSwitch && ![userDataSyncStore.insidersUrl, userDataSyncStore.stableUrl].includes(userDataSyncStore.url)) { - return new Promise((c, e) => { - const disposables: DisposableStore = new DisposableStore(); - const quickPick = disposables.add(this.quickInputService.createQuickPick<{ id: UserDataSyncStoreType, label: string, description?: string }>()); - quickPick.title = localize('switchSyncService.title', "Select Settings Sync Service..."); - quickPick.placeholder = localize('choose sync service', "Choose settings sync Service to use"); - quickPick.description = isNative ? - localize('choose sync service description', "Switching settings sync service requires restarting {0}", this.productService.nameLong) : - localize('choose sync service description web', "Switching settings sync service requires reloading {0}", this.productService.nameLong); - quickPick.hideInput = true; - const getDescription = (url: URI): string | undefined => { - const isCurrent = isEqual(url, userDataSyncStore.url); - const isDefault = isEqual(url, userDataSyncStore.defaultUrl); - if (isCurrent && isDefault) { - return localize('default and current', "Default & Current"); - } - if (isDefault) { - return localize('default', "Default"); - } - if (isCurrent) { - return localize('current', "Current"); - } - return undefined; - }; - quickPick.items = [ - { - id: 'insiders', - label: localize('insiders', "Insiders"), - description: getDescription(userDataSyncStore.insidersUrl!) - }, - { - id: 'stable', - label: localize('stable', "Stable"), - description: getDescription(userDataSyncStore.stableUrl!) - } - ]; - disposables.add(quickPick.onDidAccept(() => { - this.userDataSyncWorkbenchService.switchSyncService(quickPick.selectedItems[0].id); + private async selectSettingsSyncService(userDataSyncStore: IUserDataSyncStore): Promise { + return new Promise((c, e) => { + const disposables: DisposableStore = new DisposableStore(); + const quickPick = disposables.add(this.quickInputService.createQuickPick<{ id: UserDataSyncStoreType, label: string, description?: string }>()); + quickPick.title = localize('switchSyncService.title', "{0}: Select Service", SYNC_TITLE); + quickPick.description = localize('switchSyncService.description', "Ensure you are using the same settings sync service when syncing with multiple environments"); + quickPick.hideInput = true; + quickPick.ignoreFocusOut = true; + const getDescription = (url: URI): string | undefined => { + const isDefault = isEqual(url, userDataSyncStore.defaultUrl); + if (isDefault) { + return localize('default', "Default"); + } + return undefined; + }; + quickPick.items = [ + { + id: 'insiders', + label: localize('insiders', "Insiders"), + description: getDescription(userDataSyncStore.insidersUrl) + }, + { + id: 'stable', + label: localize('stable', "Stable"), + description: getDescription(userDataSyncStore.stableUrl) + } + ]; + disposables.add(quickPick.onDidAccept(async () => { + try { + await this.userDataSyncStoreManagementService.switch(quickPick.selectedItems[0].id); + c(); + } catch (error) { + e(error); + } finally { quickPick.hide(); - })); - disposables.add(quickPick.onDidHide(() => disposables.dispose())); - quickPick.show(); - }); - } + } + })); + disposables.add(quickPick.onDidHide(() => disposables.dispose())); + quickPick.show(); + }); } private registerActions(): void { @@ -738,7 +734,6 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo this.registerSyncNowAction(); this.registerConfigureSyncAction(); this.registerShowSettingsAction(); - this.registerSwitchSyncServiceAction(); this.registerShowLogAction(); } @@ -1117,28 +1112,6 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo })); } - private registerSwitchSyncServiceAction(): void { - const that = this; - const userDataSyncStore = this.userDataSyncStoreManagementService.userDataSyncStore; - if (userDataSyncStore?.canSwitch && ![userDataSyncStore.insidersUrl, userDataSyncStore.stableUrl].includes(userDataSyncStore.url)) { - this._register(registerAction2(class ShowSyncSettingsAction extends Action2 { - constructor() { - super({ - id: 'workbench.userDataSync.actions.switchSyncService', - title: { value: localize('workbench.userDataSync.actions.switchSyncService', "{0}: Select Service...", SYNC_TITLE), original: 'Settings Sync: Select Service...' }, - menu: { - id: MenuId.CommandPalette, - when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized)), - }, - }); - } - run(accessor: ServicesAccessor): any { - return that.switchSyncService(); - } - })); - } - } - private registerViews(): void { const container = this.registerViewContainer(); this.registerDataViews(container); diff --git a/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts b/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts index 1f4df831651..e8b4924fe5a 100644 --- a/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts +++ b/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IUserDataSyncService, IAuthenticationProvider, isAuthenticationProvider, IUserDataAutoSyncService, SyncResource, IResourcePreview, ISyncResourcePreview, Change, IManualSyncTask, IUserDataSyncStoreManagementService, UserDataSyncStoreType, SyncStatus } from 'vs/platform/userDataSync/common/userDataSync'; +import { IUserDataSyncService, IAuthenticationProvider, isAuthenticationProvider, IUserDataAutoSyncService, SyncResource, IResourcePreview, ISyncResourcePreview, Change, IManualSyncTask, IUserDataSyncStoreManagementService, SyncStatus } from 'vs/platform/userDataSync/common/userDataSync'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IUserDataSyncWorkbenchService, IUserDataSyncAccount, AccountStatus, CONTEXT_SYNC_ENABLEMENT, CONTEXT_SYNC_STATE, CONTEXT_ACCOUNT_STATE, SHOW_SYNC_LOG_COMMAND_ID, getSyncAreaLabel, IUserDataSyncPreview, IUserDataSyncResource, CONTEXT_ENABLE_SYNC_MERGES_VIEW, SYNC_MERGES_VIEW_ID, CONTEXT_ENABLE_ACTIVITY_VIEWS, SYNC_VIEW_CONTAINER_ID, SYNC_TITLE } from 'vs/workbench/services/userDataSync/common/userDataSync'; @@ -29,8 +29,6 @@ import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/ import { isEqual } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; import { IViewsService, ViewContainerLocation, IViewDescriptorService } from 'vs/workbench/common/views'; -import { isNative } from 'vs/base/common/platform'; -import { IHostService } from 'vs/workbench/services/host/browser/host'; import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; type UserAccountClassification = { @@ -108,7 +106,6 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat @IViewsService private readonly viewsService: IViewsService, @IViewDescriptorService private readonly viewDescriptorService: IViewDescriptorService, @IUserDataSyncStoreManagementService private readonly userDataSyncStoreManagementService: IUserDataSyncStoreManagementService, - @IHostService private readonly hostService: IHostService, @ILifecycleService private readonly lifecycleService: ILifecycleService, ) { super(); @@ -444,29 +441,6 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat await this.viewsService.openViewContainer(SYNC_VIEW_CONTAINER_ID); } - async switchSyncService(type: UserDataSyncStoreType): Promise { - if (!this.userDataSyncStoreManagementService.userDataSyncStore - || !this.userDataSyncStoreManagementService.userDataSyncStore.canSwitch) { - return; - } - await this.userDataSyncStoreManagementService.switch(type); - const res = await this.dialogService.confirm({ - type: 'info', - message: isNative ? - localize('relaunchMessage', "Switching settings sync service requires a restart to take effect.") : - localize('relaunchMessageWeb', "Switching settings sync service requires a reload to take effect."), - detail: isNative ? - localize('relaunchDetail', "Press the restart button to restart {0} and switch.", this.productService.nameLong) : - localize('relaunchDetailWeb', "Press the reload button to reload {0} and switch.", this.productService.nameLong), - primaryButton: isNative ? - localize('restart', "&&Restart") : - localize('restartWeb', "&&Reload"), - }); - if (res.confirmed) { - this.hostService.restart(); - } - } - private async waitForActiveSyncViews(): Promise { const viewContainer = this.viewDescriptorService.getViewContainerById(SYNC_VIEW_CONTAINER_ID); if (viewContainer) { diff --git a/src/vs/workbench/services/userDataSync/common/userDataSync.ts b/src/vs/workbench/services/userDataSync/common/userDataSync.ts index aaaad9acf40..4e0e54f6252 100644 --- a/src/vs/workbench/services/userDataSync/common/userDataSync.ts +++ b/src/vs/workbench/services/userDataSync/common/userDataSync.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -import { IAuthenticationProvider, SyncStatus, SyncResource, Change, MergeState, UserDataSyncStoreType } from 'vs/platform/userDataSync/common/userDataSync'; +import { IAuthenticationProvider, SyncStatus, SyncResource, Change, MergeState } from 'vs/platform/userDataSync/common/userDataSync'; import { Event } from 'vs/base/common/event'; import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { localize } from 'vs/nls'; @@ -58,7 +58,6 @@ export interface IUserDataSyncWorkbenchService { turnOn(): Promise; turnoff(everyWhere: boolean): Promise; signIn(): Promise; - switchSyncService(type: UserDataSyncStoreType): Promise; resetSyncedData(): Promise; showSyncActivity(): Promise; From e2929f662a8fc7eac0a6f04654457798a8cff3dc Mon Sep 17 00:00:00 2001 From: rebornix Date: Wed, 16 Sep 2020 15:52:30 -0700 Subject: [PATCH 0041/1667] cell decoration polish. --- .../notebook/browser/media/notebook.css | 6 + .../notebook/browser/notebookBrowser.ts | 1 + .../notebook/browser/notebookEditorWidget.ts | 110 +++++++++++++++++- .../browser/view/renderers/cellRenderer.ts | 42 ++++++- 4 files changed, 153 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/media/notebook.css b/src/vs/workbench/contrib/notebook/browser/media/notebook.css index 464cb0a6c22..073a939c282 100644 --- a/src/vs/workbench/contrib/notebook/browser/media/notebook.css +++ b/src/vs/workbench/contrib/notebook/browser/media/notebook.css @@ -838,3 +838,9 @@ margin: 5px 4px !important; cursor: none; } + +.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-decoration { + top: -6px; + position: absolute; + display: flex; +} diff --git a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts index a2b1ca0b949..0306ba95e4d 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts @@ -168,6 +168,7 @@ export interface INotebookCellDecorationOptions { className?: string; gutterClassName?: string; outputClassName?: string; + topClassName?: string; } export interface INotebookDeltaDecoration { diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts index 926fb957eb0..0888f79455e 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts @@ -5,6 +5,7 @@ import { getZoomLevel } from 'vs/base/browser/browser'; import * as DOM from 'vs/base/browser/dom'; +import * as strings from 'vs/base/common/strings'; import { IMouseWheelEvent, StandardMouseEvent } from 'vs/base/browser/mouseEvent'; import { IListContextMenuEvent } from 'vs/base/browser/ui/list/list'; import { IAction, Separator } from 'vs/base/common/actions'; @@ -22,7 +23,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { BareFontInfo } from 'vs/editor/common/config/fontInfo'; import { Range } from 'vs/editor/common/core/range'; -import { IEditor, isThemeColor } from 'vs/editor/common/editorCommon'; +import { IContentDecorationRenderOptions, IEditor, isThemeColor } from 'vs/editor/common/editorCommon'; import * as nls from 'vs/nls'; import { IMenuService, MenuId } from 'vs/platform/actions/common/actions'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -1266,7 +1267,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor const existingDecorations = this._decortionKeyToIds.get(key) || []; const newDecorations = this.viewModel.viewCells.slice(range.start, range.end).map(cell => ({ handle: cell.handle, - options: { className: decorationRule.className, outputClassName: decorationRule.className } + options: { className: decorationRule.className, outputClassName: decorationRule.className, topClassName: decorationRule.topClassName } })); this._decortionKeyToIds.set(key, this.deltaCellDecorations(existingDecorations, newDecorations)); @@ -2177,10 +2178,16 @@ interface ProviderArguments { class DecorationCSSRules { private _theme: IColorTheme; private _className: string; + private _topClassName: string; get className() { return this._className; } + + get topClassName() { + return this._topClassName; + } + constructor( private readonly _themeService: IThemeService, private readonly _styleSheet: RefCountedStyleSheet, @@ -2189,12 +2196,11 @@ class DecorationCSSRules { this._styleSheet.ref(); this._theme = this._themeService.getColorTheme(); this._className = CSSNameHelper.getClassName(this._providerArgs.key, CellDecorationCSSRuleType.ClassName); + this._topClassName = CSSNameHelper.getClassName(this._providerArgs.key, CellDecorationCSSRuleType.TopClassName); this._buildCSS(); } private _buildCSS() { - this._styleSheet.insertRule('.foo { color: red; }', 0); - if (this._providerArgs.options.backgroundColor) { const backgroundColor = this._resolveValue(this._providerArgs.options.backgroundColor); this._styleSheet.insertRule(`.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.${this.className} .cell-focus-indicator, @@ -2221,6 +2227,67 @@ class DecorationCSSRules { border-color: ${borderColor} !important; }`); } + + if (this._providerArgs.options.top) { + const unthemedCSS = this._getCSSTextForModelDecorationContentClassName(this._providerArgs.options.top); + this._styleSheet.insertRule(`.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.${this.className} .cell-decoration .${this.topClassName} { + height: 1rem; + display: block; + }`); + + this._styleSheet.insertRule(`.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.${this.className} .cell-decoration .${this.topClassName}::before { + display: block; + ${unthemedCSS} + }`); + } + } + + /** + * Build the CSS for decorations styled before or after content. + */ + private _getCSSTextForModelDecorationContentClassName(opts: IContentDecorationRenderOptions | undefined): string { + if (!opts) { + return ''; + } + const cssTextArr: string[] = []; + + if (typeof opts !== 'undefined') { + this._collectBorderSettingsCSSText(opts, cssTextArr); + if (typeof opts.contentIconPath !== 'undefined') { + cssTextArr.push(strings.format(_CSS_MAP.contentIconPath, DOM.asCSSUrl(URI.revive(opts.contentIconPath)))); + } + if (typeof opts.contentText === 'string') { + const truncated = opts.contentText.match(/^.*$/m)![0]; // only take first line + const escaped = truncated.replace(/['\\]/g, '\\$&'); + + cssTextArr.push(strings.format(_CSS_MAP.contentText, escaped)); + } + this._collectCSSText(opts, ['fontStyle', 'fontWeight', 'textDecoration', 'color', 'opacity', 'backgroundColor', 'margin'], cssTextArr); + if (this._collectCSSText(opts, ['width', 'height'], cssTextArr)) { + cssTextArr.push('display:inline-block;'); + } + } + + return cssTextArr.join(''); + } + + private _collectBorderSettingsCSSText(opts: any, cssTextArr: string[]): boolean { + if (this._collectCSSText(opts, ['border', 'borderColor', 'borderRadius', 'borderSpacing', 'borderStyle', 'borderWidth'], cssTextArr)) { + cssTextArr.push(strings.format('box-sizing: border-box;')); + return true; + } + return false; + } + + private _collectCSSText(opts: any, properties: string[], cssTextArr: string[]): boolean { + const lenBefore = cssTextArr.length; + for (let property of properties) { + const value = this._resolveValue(opts[property]); + if (typeof value === 'string') { + cssTextArr.push(strings.format(_CSS_MAP[property], value)); + } + } + return cssTextArr.length !== lenBefore; } private _resolveValue(value: string | ThemeColor): string { @@ -2239,8 +2306,43 @@ class DecorationCSSRules { } } +const _CSS_MAP: { [prop: string]: string; } = { + color: 'color:{0} !important;', + opacity: 'opacity:{0};', + backgroundColor: 'background-color:{0};', + + outline: 'outline:{0};', + outlineColor: 'outline-color:{0};', + outlineStyle: 'outline-style:{0};', + outlineWidth: 'outline-width:{0};', + + border: 'border:{0};', + borderColor: 'border-color:{0};', + borderRadius: 'border-radius:{0};', + borderSpacing: 'border-spacing:{0};', + borderStyle: 'border-style:{0};', + borderWidth: 'border-width:{0};', + + fontStyle: 'font-style:{0};', + fontWeight: 'font-weight:{0};', + textDecoration: 'text-decoration:{0};', + cursor: 'cursor:{0};', + letterSpacing: 'letter-spacing:{0};', + + gutterIconPath: 'background:{0} center center no-repeat;', + gutterIconSize: 'background-size:{0};', + + contentText: 'content:\'{0}\';', + contentIconPath: 'content:{0};', + margin: 'margin:{0};', + width: 'width:{0};', + height: 'height:{0};' +}; + + const enum CellDecorationCSSRuleType { ClassName = 0, + TopClassName = 0, } class CSSNameHelper { diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts index 2b37f5a624f..a30bdf629dc 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts @@ -393,7 +393,7 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR const container = DOM.append(rootContainer, DOM.$('.cell-inner-container')); const disposables = new DisposableStore(); const contextKeyService = disposables.add(this.contextKeyServiceProvider(container)); - const decorationContainer = DOM.append(container, $('.cell-decoration')); + const decorationContainer = DOM.append(rootContainer, $('.cell-decoration')); const titleToolbarContainer = DOM.append(container, $('.cell-title-toolbar')); const toolbar = disposables.add(this.createToolbar(titleToolbarContainer)); const deleteToolbar = disposables.add(this.createToolbar(titleToolbarContainer, 'cell-delete-toolbar')); @@ -483,6 +483,8 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR templateData.rootContainer.classList.remove(className); }); + templateData.decorationContainer.innerText = ''; + this.commonRenderElement(element, templateData); templateData.currentRenderedCell = element; @@ -496,6 +498,22 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR const elementDisposables = templateData.elementDisposables; + const generateCellTopDecorations = () => { + templateData.decorationContainer.innerText = ''; + + element.getCellDecorations().filter(options => options.topClassName !== undefined).forEach(options => { + templateData.decorationContainer.append(DOM.$(`.${options.topClassName!}`)); + }); + }; + + elementDisposables.add(element.onCellDecorationsChanged((e) => { + const modified = e.added.find(e => e.topClassName) || e.removed.find(e => e.topClassName); + + if (modified) { + generateCellTopDecorations(); + } + })); + elementDisposables.add(new CellContextKeyManager(templateData.contextKeyService, this.notebookEditor, this.notebookEditor.viewModel?.notebookDocument!, element)); // render toolbar first @@ -655,7 +673,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende const container = DOM.append(rootContainer, DOM.$('.cell-inner-container')); const disposables = new DisposableStore(); const contextKeyService = disposables.add(this.contextKeyServiceProvider(container)); - const decorationContainer = DOM.append(container, $('.cell-decoration')); + const decorationContainer = DOM.append(rootContainer, $('.cell-decoration')); DOM.append(container, $('.cell-focus-indicator.cell-focus-indicator-top')); const titleToolbarContainer = DOM.append(container, $('.cell-title-toolbar')); const toolbar = disposables.add(this.createToolbar(titleToolbarContainer)); @@ -831,6 +849,8 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende templateData.rootContainer.classList.remove(className); }); + templateData.decorationContainer.innerText = ''; + this.commonRenderElement(element, templateData); templateData.currentRenderedCell = element; @@ -843,6 +863,24 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende const elementDisposables = templateData.elementDisposables; + const generateCellTopDecorations = () => { + templateData.decorationContainer.innerText = ''; + + element.getCellDecorations().filter(options => options.topClassName !== undefined).forEach(options => { + templateData.decorationContainer.append(DOM.$(`.${options.topClassName!}`)); + }); + }; + + elementDisposables.add(element.onCellDecorationsChanged((e) => { + const modified = e.added.find(e => e.topClassName) || e.removed.find(e => e.topClassName); + + if (modified) { + generateCellTopDecorations(); + } + })); + + generateCellTopDecorations(); + elementDisposables.add(this.instantiationService.createInstance(CodeCell, this.notebookEditor, element, templateData)); this.renderedEditors.set(element, templateData.editor); From 3fe9fd9987aa5997744fea93975fa2b0078ada47 Mon Sep 17 00:00:00 2001 From: Jessica Petty Date: Wed, 16 Sep 2020 15:59:33 -0700 Subject: [PATCH 0042/1667] Add caching to Rich Navigation step to reuse node_modules --- .github/workflows/rich-navigation.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/rich-navigation.yml b/.github/workflows/rich-navigation.yml index 38afb0d7f49..bd2444b608b 100644 --- a/.github/workflows/rich-navigation.yml +++ b/.github/workflows/rich-navigation.yml @@ -10,10 +10,21 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v2 + + - uses: actions/cache@v2 + id: caching-stage + name: Cache VS Code dependencies + with: + path: node_modules + key: ${{ runner.os }}-dependencies-${{ hashfiles('yarn.lock') }} + restore-keys: ${{ runner.os }}-dependencies- + - name: Install dependencies + if: steps.caching-stage.outputs.cache-hit != 'true' run: yarn --frozen-lockfile env: CHILD_CONCURRENCY: 1 + - uses: microsoft/RichCodeNavIndexer@v0.1 with: languages: typescript From b50a5846d55a20e231c8e74187447fdd9c952863 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 17 Sep 2020 00:52:39 +0200 Subject: [PATCH 0043/1667] Simplify sync quick pick --- .../quickinput/browser/media/quickInput.css | 4 ++ .../parts/quickinput/browser/quickInput.ts | 41 ++++++++++++++----- .../parts/quickinput/common/quickInput.ts | 2 + .../userDataSync/browser/userDataSync.ts | 16 +++----- 4 files changed, 41 insertions(+), 22 deletions(-) diff --git a/src/vs/base/parts/quickinput/browser/media/quickInput.css b/src/vs/base/parts/quickinput/browser/media/quickInput.css index 547d47ba0b2..29a3f02bca7 100644 --- a/src/vs/base/parts/quickinput/browser/media/quickInput.css +++ b/src/vs/base/parts/quickinput/browser/media/quickInput.css @@ -49,6 +49,10 @@ margin: 6px; } +.quick-input-header .quick-input-description { + margin: 4px 2px; +} + .quick-input-header { display: flex; padding: 6px 6px 0px 6px; diff --git a/src/vs/base/parts/quickinput/browser/quickInput.ts b/src/vs/base/parts/quickinput/browser/quickInput.ts index 8dcfe3dc2c5..f7094eca3bd 100644 --- a/src/vs/base/parts/quickinput/browser/quickInput.ts +++ b/src/vs/base/parts/quickinput/browser/quickInput.ts @@ -84,7 +84,8 @@ interface QuickInputUI { leftActionBar: ActionBar; titleBar: HTMLElement; title: HTMLElement; - description: HTMLElement; + description1: HTMLElement; + description2: HTMLElement; rightActionBar: ActionBar; checkAll: HTMLInputElement; filterContainer: HTMLElement; @@ -119,6 +120,7 @@ type Visibilities = { description?: boolean; checkAll?: boolean; inputBox?: boolean; + checkBox?: boolean; visibleCount?: boolean; count?: boolean; message?: boolean; @@ -281,8 +283,11 @@ class QuickInput extends Disposable implements IQuickInput { this.ui.title.innerText = '\u00a0;'; } const description = this.getDescription(); - if (this.ui.description.textContent !== description) { - this.ui.description.textContent = description; + if (this.ui.description1.textContent !== description) { + this.ui.description1.textContent = description; + } + if (this.ui.description2.textContent !== description) { + this.ui.description2.textContent = description; } if (this.busy && !this.busyDelay) { this.busyDelay = new TimeoutTimer(); @@ -414,6 +419,7 @@ class QuickPick extends QuickInput implements IQuickPi private _customButtonHover: string | undefined; private _quickNavigate: IQuickNavigateConfiguration | undefined; private _hideInput: boolean | undefined; + private _hideCheckAll: boolean | undefined; get quickNavigate() { return this._quickNavigate; @@ -640,6 +646,15 @@ class QuickPick extends QuickInput implements IQuickPi this.update(); } + get hideCheckAll() { + return !!this._hideCheckAll; + } + + set hideCheckAll(hideCheckAll: boolean) { + this._hideCheckAll = hideCheckAll; + this.update(); + } + onDidChangeSelection = this.onDidChangeSelectionEmitter.event; onDidTriggerItemButton = this.onDidTriggerItemButtonEmitter.event; @@ -856,11 +871,12 @@ class QuickPick extends QuickInput implements IQuickPi hideInput = true; } } - this.ui.container.classList.toggle('hidden-input', hideInput); + this.ui.container.classList.toggle('hidden-input', hideInput && !this.description); const visibilities: Visibilities = { title: !!this.title || !!this.step || !!this.buttons.length, description: !!this.description, - checkAll: this.canSelectMany, + checkAll: this.canSelectMany && !this._hideCheckAll, + checkBox: this.canSelectMany, inputBox: !hideInput, progressBar: !hideInput, visibleCount: true, @@ -1153,8 +1169,7 @@ export class QuickInputController extends Disposable { const rightActionBar = this._register(new ActionBar(titleBar)); rightActionBar.domNode.classList.add('quick-input-right-action-bar'); - const description = dom.append(container, $('.quick-input-description')); - + const description1 = dom.append(container, $('.quick-input-description')); const headerContainer = dom.append(container, $('.quick-input-header')); const checkAll = dom.append(headerContainer, $('input.quick-input-check-all')); @@ -1169,6 +1184,7 @@ export class QuickInputController extends Disposable { } })); + const description2 = dom.append(headerContainer, $('.quick-input-description')); const extraContainer = dom.append(headerContainer, $('.quick-input-and-message')); const filterContainer = dom.append(extraContainer, $('.quick-input-filter')); @@ -1283,7 +1299,8 @@ export class QuickInputController extends Disposable { leftActionBar, titleBar, title, - description, + description1, + description2, rightActionBar, checkAll, filterContainer, @@ -1496,7 +1513,8 @@ export class QuickInputController extends Disposable { this.setEnabled(true); ui.leftActionBar.clear(); ui.title.textContent = ''; - ui.description.textContent = ''; + ui.description1.textContent = ''; + ui.description2.textContent = ''; ui.rightActionBar.clear(); ui.checkAll.checked = false; // ui.inputBox.value = ''; Avoid triggering an event. @@ -1527,7 +1545,8 @@ export class QuickInputController extends Disposable { private setVisibilities(visibilities: Visibilities) { const ui = this.getUI(); ui.title.style.display = visibilities.title ? '' : 'none'; - ui.description.style.display = visibilities.description ? '' : 'none'; + ui.description1.style.display = visibilities.description && (visibilities.inputBox || visibilities.checkAll) ? '' : 'none'; + ui.description2.style.display = visibilities.description && !(visibilities.inputBox || visibilities.checkAll) ? '' : 'none'; ui.checkAll.style.display = visibilities.checkAll ? '' : 'none'; ui.filterContainer.style.display = visibilities.inputBox ? '' : 'none'; ui.visibleCountContainer.style.display = visibilities.visibleCount ? '' : 'none'; @@ -1537,7 +1556,7 @@ export class QuickInputController extends Disposable { ui.message.style.display = visibilities.message ? '' : 'none'; ui.progressBar.getContainer().style.display = visibilities.progressBar ? '' : 'none'; ui.list.display(!!visibilities.list); - ui.container.classList[visibilities.checkAll ? 'add' : 'remove']('show-checkboxes'); + ui.container.classList[visibilities.checkBox ? 'add' : 'remove']('show-checkboxes'); this.updateLayout(); // TODO } diff --git a/src/vs/base/parts/quickinput/common/quickInput.ts b/src/vs/base/parts/quickinput/common/quickInput.ts index de7339e6757..5312368257c 100644 --- a/src/vs/base/parts/quickinput/common/quickInput.ts +++ b/src/vs/base/parts/quickinput/common/quickInput.ts @@ -275,6 +275,8 @@ export interface IQuickPick extends IQuickInput { * be presented. */ hideInput: boolean; + + hideCheckAll: boolean; } export interface IInputBox extends IQuickInput { diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts index ec3c96b7a56..fae3bcf50f9 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts @@ -513,19 +513,13 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo quickPick.title = SYNC_TITLE; quickPick.ok = false; quickPick.customButton = true; - if (this.userDataSyncWorkbenchService.all.length) { - quickPick.customLabel = localize('turn on', "Turn On"); - } else { - const orTerm = localize({ key: 'or', comment: ['Here is the context where it is used - Sign in with your A or B or C account to synchronize your data across devices.'] }, "or"); - const displayName = this.userDataSyncWorkbenchService.authenticationProviders.length === 1 - ? this.authenticationService.getLabel(this.userDataSyncWorkbenchService.authenticationProviders[0].id) - : this.userDataSyncWorkbenchService.authenticationProviders.map(({ id }) => this.authenticationService.getLabel(id)).join(` ${orTerm} `); - quickPick.description = localize('sign in and turn on sync detail', "Sign in with your {0} account to synchronize your data across devices.", displayName); - quickPick.customLabel = localize('sign in and turn on sync', "Sign in & Turn on"); - } - quickPick.placeholder = localize('configure sync placeholder', "Choose what to sync"); + quickPick.customLabel = localize('turn on', "Turn On"); + quickPick.description = localize('configure and turn on sync detail', "Please turn on to synchronize your data across devices."); quickPick.canSelectMany = true; quickPick.ignoreFocusOut = true; + quickPick.hideInput = true; + quickPick.hideCheckAll = true; + const items = this.getConfigureSyncQuickPickItems(); quickPick.items = items; quickPick.selectedItems = items.filter(item => this.userDataSyncResourceEnablementService.isResourceEnabled(item.id)); From fc8e84f7cb1218f60020ef57ada18467b2a620b8 Mon Sep 17 00:00:00 2001 From: rebornix Date: Wed, 16 Sep 2020 16:15:56 -0700 Subject: [PATCH 0044/1667] resolve notebook without explicit view type. --- .../notebook/browser/notebook.contribution.ts | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts index e13566c70d4..65a1a05ef00 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts @@ -447,19 +447,7 @@ class CellContentProvider implements ITextModelContentProvider { return null; } - const documentAlreadyOpened = this._notebookService.listNotebookDocuments().find(document => document.uri.toString() === data.notebook.toString()); - let viewType = documentAlreadyOpened?.viewType; - - if (!viewType) { - const info = getFirstNotebookInfo(this._notebookService, data.notebook); - viewType = info?.id; - } - - if (!viewType) { - return null; - } - - const ref = await this._notebookModelResolverService.resolve(data.notebook, viewType); + const ref = await this._notebookModelResolverService.resolve(data.notebook); let result: ITextModel | null = null; for (const cell of ref.object.notebook.cells) { From 0aad85cc0ec4af3ccda41f562f1c946180eb3707 Mon Sep 17 00:00:00 2001 From: rebornix Date: Wed, 16 Sep 2020 16:16:17 -0700 Subject: [PATCH 0045/1667] :lipstick: --- .../contrib/notebook/browser/notebook.contribution.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts index 65a1a05ef00..65c0b5ea811 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts @@ -201,10 +201,6 @@ Registry.as(EditorInputExtensions.EditorInputFactor NotebookDiffEditorFactory ); -function getFirstNotebookInfo(notebookService: INotebookService, uri: URI): NotebookProviderInfo | undefined { - return notebookService.getContributedNotebookProviders(uri)[0]; -} - export class NotebookContribution extends Disposable implements IWorkbenchContribution { constructor( @@ -426,7 +422,6 @@ class CellContentProvider implements ITextModelContentProvider { @ITextModelService textModelService: ITextModelService, @IModelService private readonly _modelService: IModelService, @IModeService private readonly _modeService: IModeService, - @INotebookService private readonly _notebookService: INotebookService, @INotebookEditorModelResolverService private readonly _notebookModelResolverService: INotebookEditorModelResolverService, ) { this._registration = textModelService.registerTextModelContentProvider(CellUri.scheme, this); From f3bc6412c77a8a5b404737d789df387b493b4400 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 16 Sep 2020 16:31:32 -0700 Subject: [PATCH 0046/1667] Define verified label --- .github/workflows/author-verified.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/author-verified.yml b/.github/workflows/author-verified.yml index 03cd7cedbef..03d389c5e64 100644 --- a/.github/workflows/author-verified.yml +++ b/.github/workflows/author-verified.yml @@ -36,4 +36,5 @@ jobs: token: ${{secrets.VSCODE_ISSUE_TRIAGE_BOT_PAT}} requestVerificationComment: "This bug has been fixed in to the latest release of [VS Code Insiders](https://code.visualstudio.com/insiders/)!\n\n@${author}, you can help us out by commenting `/verified` if things are now working as expected.\n\nIf things still don't seem right, please ensure you're on version ${commit} of Insiders (today's or later - you can use `Help: About` in the command pallette to check), and leave a comment letting us know what isn't working as expected.\n\nHappy Coding!" pendingReleaseLabel: awaiting-insiders-release + verifiedLabel: verified authorVerificationRequestedLabel: author-verification-requested From 1343efabed21e3a1114961ae18a7e984d3159fe4 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 16 Sep 2020 16:56:12 -0700 Subject: [PATCH 0047/1667] Add missing config entries --- .github/workflows/on-label.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/on-label.yml b/.github/workflows/on-label.yml index e51b9ac740f..60a9b09af01 100644 --- a/.github/workflows/on-label.yml +++ b/.github/workflows/on-label.yml @@ -30,6 +30,7 @@ jobs: appInsightsKey: ${{secrets.TRIAGE_ACTIONS_APP_INSIGHTS}} requestVerificationComment: "This bug has been fixed in to the latest release of [VS Code Insiders](https://code.visualstudio.com/insiders/)!\n\n@${author}, you can help us out by confirming things are working as expected in the latest Insiders release. If things look good, please leave a comment with the text `/verified` to let us know. If not, please ensure you're on version ${commit} of Insiders (today's or later - you can use `Help: About` in the command pallete to check), and leave a comment letting us know what isn't working as expected.\n\nHappy Coding!" pendingReleaseLabel: awaiting-insiders-release + verifiedLabel: verified authorVerificationRequestedLabel: author-verification-requested # source of truth in ./commands.yml From 5177f0d777468ce08a31670ff6fe55b70f9b4a8a Mon Sep 17 00:00:00 2001 From: chrisdias Date: Wed, 16 Sep 2020 18:10:20 -0700 Subject: [PATCH 0048/1667] update distro --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c53aa7e6efd..e9f62462ec8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.50.0", - "distro": "adae9f8fbaaab615a6f3b965732f2a871c3143a4", + "distro": "ca38dd035dd5ca3c9c09c5bdbe16e99f8e89ba75", "author": { "name": "Microsoft Corporation" }, From 6f96936ee49b8a5a55cc4166eb6ebf1a78c3058e Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 16 Sep 2020 18:40:10 -0700 Subject: [PATCH 0049/1667] Update distro --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e9f62462ec8..af9aeb2324e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.50.0", - "distro": "ca38dd035dd5ca3c9c09c5bdbe16e99f8e89ba75", + "distro": "1fd8b5f570e35db1741de35657e9164dfe81da7b", "author": { "name": "Microsoft Corporation" }, From af5dd228ed306861d4768d9772184aedc0cd510b Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 16 Sep 2020 19:49:14 -0700 Subject: [PATCH 0050/1667] Make sure we create a unique working copy resource for each custom editor resource Fixes #106547 This switching the working copy resource for custom editors to use an encoded path instead of the resource's original path. This fixes a few problems: - Fixes a bug where two resources with the same path (but different schemes or authorities) would be considered the same - Fixes a bug where windows style paths (`c:\path`) would cause issues. This is the root cause of #106547 - Fixes a bug where the viewType was used as the raw authority. If the view type contains invalid characters, this would have caused issues --- src/vs/workbench/api/browser/mainThreadCustomEditors.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadCustomEditors.ts b/src/vs/workbench/api/browser/mainThreadCustomEditors.ts index ca957970aa8..28727226932 100644 --- a/src/vs/workbench/api/browser/mainThreadCustomEditors.ts +++ b/src/vs/workbench/api/browser/mainThreadCustomEditors.ts @@ -346,10 +346,12 @@ class MainThreadCustomEditorModel extends Disposable implements ICustomEditorMod } private static toWorkingCopyResource(viewType: string, resource: URI) { + const authority = viewType.replace(/[^a-z0-9\-_]/gi, '-'); + const path = '/' + btoa(resource.with({ query: null, fragment: null }).toString(true)); return URI.from({ scheme: Schemas.vscodeCustomEditor, - authority: viewType, - path: resource.path, + authority: authority, + path: path, query: JSON.stringify(resource.toJSON()), }); } From d19c4ec92c4270d1778ba91c694097cd839adc10 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 16 Sep 2020 19:58:09 -0700 Subject: [PATCH 0051/1667] Fix TS 4.1 error --- extensions/debug-auto-launch/src/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/debug-auto-launch/src/extension.ts b/extensions/debug-auto-launch/src/extension.ts index b8d23fc2142..bbf8c8433f1 100644 --- a/extensions/debug-auto-launch/src/extension.ts +++ b/extensions/debug-auto-launch/src/extension.ts @@ -137,7 +137,7 @@ async function toggleAutoAttachSetting(scope?: vscode.ConfigurationTarget): Prom const result = await new Promise(resolve => { quickPick.onDidAccept(() => resolve(quickPick.selectedItems[0])); - quickPick.onDidHide(() => resolve()); + quickPick.onDidHide(() => resolve(undefined)); quickPick.onDidTriggerButton(() => { resolve({ scope: isGlobalScope From 05999d3f3079e45742ea4bdca8f6b7d03ee669ea Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 07:36:25 +0200 Subject: [PATCH 0052/1667] debt - use utility for diagnostics IPC and introduce real workbench diagnostics service (#106836) * debt - use utility for diagnostics IPC and introduce real workbench diagnostics service * address feedback * implement interface behind ts-ignore --- .../sharedProcess/sharedProcessMain.ts | 3 +- src/vs/code/electron-main/app.ts | 7 +-- src/vs/code/electron-main/main.ts | 4 +- .../diagnostics/node/diagnosticsIpc.ts | 58 ------------------- .../tags/electron-browser/workspaceTags.ts | 9 ++- .../electron-browser/diagnosticsService.ts | 23 ++++++++ src/vs/workbench/workbench.desktop.main.ts | 1 + 7 files changed, 33 insertions(+), 72 deletions(-) delete mode 100644 src/vs/platform/diagnostics/node/diagnosticsIpc.ts create mode 100644 src/vs/workbench/services/diagnostics/electron-browser/diagnosticsService.ts diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts index e884724db37..18cdd76fda9 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts @@ -43,7 +43,6 @@ import { LogsDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/ import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService'; import { SpdLogService } from 'vs/platform/log/node/spdlogService'; import { DiagnosticsService, IDiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService'; -import { DiagnosticsChannel } from 'vs/platform/diagnostics/node/diagnosticsIpc'; import { FileService } from 'vs/platform/files/common/fileService'; import { IFileService } from 'vs/platform/files/common/files'; import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider'; @@ -223,7 +222,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat server.registerChannel('localizations', localizationsChannel); const diagnosticsService = accessor.get(IDiagnosticsService); - const diagnosticsChannel = new DiagnosticsChannel(diagnosticsService); + const diagnosticsChannel = createChannelReceiver(diagnosticsService); server.registerChannel('diagnostics', diagnosticsChannel); const extensionTipsService = accessor.get(IExtensionTipsService); diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index 8fd9ded27b6..10fceadfc30 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -31,7 +31,7 @@ import { NullTelemetryService, combinedAppender, LogAppender } from 'vs/platform import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc'; import { TelemetryService, ITelemetryServiceConfig } from 'vs/platform/telemetry/common/telemetryService'; import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties'; -import { getDelayedChannel, StaticRouter, createChannelReceiver } from 'vs/base/parts/ipc/common/ipc'; +import { getDelayedChannel, StaticRouter, createChannelReceiver, createChannelSender } from 'vs/base/parts/ipc/common/ipc'; import product from 'vs/platform/product/common/product'; import { ProxyAuthHandler } from 'vs/code/electron-main/auth'; import { Disposable } from 'vs/base/common/lifecycle'; @@ -65,7 +65,6 @@ import { WorkspacesHistoryMainService, IWorkspacesHistoryMainService } from 'vs/ import { NativeURLService } from 'vs/platform/url/common/urlService'; import { WorkspacesMainService, IWorkspacesMainService } from 'vs/platform/workspaces/electron-main/workspacesMainService'; import { statSync } from 'fs'; -import { DiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsIpc'; import { IDiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService'; import { ExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/common/extensionHostDebugIpc'; import { ElectronExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/electron-main/extensionHostDebugIpc'; @@ -446,9 +445,7 @@ export class CodeApplication extends Disposable { services.set(IDialogMainService, new SyncDescriptor(DialogMainService)); services.set(ISharedProcessMainService, new SyncDescriptor(SharedProcessMainService, [sharedProcess])); services.set(ILaunchMainService, new SyncDescriptor(LaunchMainService)); - - const diagnosticsChannel = getDelayedChannel(sharedProcessReady.then(client => client.getChannel('diagnostics'))); - services.set(IDiagnosticsService, new SyncDescriptor(DiagnosticsService, [diagnosticsChannel])); + services.set(IDiagnosticsService, createChannelSender(getDelayedChannel(sharedProcessReady.then(client => client.getChannel('diagnostics'))))); services.set(IIssueMainService, new SyncDescriptor(IssueMainService, [machineId, this.userEnv])); services.set(IElectronMainService, new SyncDescriptor(ElectronMainService)); diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index d0ae1450567..a34a585ddcd 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -40,7 +40,7 @@ import { Client } from 'vs/base/parts/ipc/common/ipc.net'; import { once } from 'vs/base/common/functional'; import { ISignService } from 'vs/platform/sign/common/sign'; import { SignService } from 'vs/platform/sign/node/signService'; -import { DiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsIpc'; +import { IDiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService'; import { FileService } from 'vs/platform/files/common/fileService'; import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider'; import { Schemas } from 'vs/base/common/network'; @@ -298,7 +298,7 @@ class CodeMain { // Create a diagnostic service connected to the existing shared process const sharedProcessClient = await connect(environmentService.sharedIPCHandle, 'main'); const diagnosticsChannel = sharedProcessClient.getChannel('diagnostics'); - const diagnosticsService = new DiagnosticsService(diagnosticsChannel); + const diagnosticsService = createChannelSender(diagnosticsChannel); const mainProcessInfo = await launchService.getMainProcessInfo(); const remoteDiagnostics = await launchService.getRemoteDiagnostics({ includeProcesses: true, includeWorkspaceMetadata: true }); const diagnostics = await diagnosticsService.getDiagnostics(mainProcessInfo, remoteDiagnostics); diff --git a/src/vs/platform/diagnostics/node/diagnosticsIpc.ts b/src/vs/platform/diagnostics/node/diagnosticsIpc.ts deleted file mode 100644 index f43ae1f4ca3..00000000000 --- a/src/vs/platform/diagnostics/node/diagnosticsIpc.ts +++ /dev/null @@ -1,58 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { IServerChannel, IChannel } from 'vs/base/parts/ipc/common/ipc'; -import { IRemoteDiagnosticInfo, IRemoteDiagnosticError, SystemInfo, PerformanceInfo } from 'vs/platform/diagnostics/common/diagnostics'; -import { IDiagnosticsService } from './diagnosticsService'; -import { Event } from 'vs/base/common/event'; -import { IMainProcessInfo } from 'vs/platform/launch/common/launch'; -import { IWorkspace } from 'vs/platform/workspace/common/workspace'; - -export class DiagnosticsChannel implements IServerChannel { - - constructor(private service: IDiagnosticsService) { } - - listen(context: any, event: string): Event { - throw new Error('Invalid listen'); - } - - call(context: any, command: string, args?: any): Promise { - switch (command) { - case 'getDiagnostics': - return this.service.getDiagnostics(args[0], args[1]); - case 'getSystemInfo': - return this.service.getSystemInfo(args[0], args[1]); - case 'getPerformanceInfo': - return this.service.getPerformanceInfo(args[0], args[1]); - case 'reportWorkspaceStats': - return this.service.reportWorkspaceStats(args); - } - - throw new Error('Invalid call'); - } -} - -export class DiagnosticsService implements IDiagnosticsService { - - declare readonly _serviceBrand: undefined; - - constructor(private channel: IChannel) { } - - public getDiagnostics(mainProcessInfo: IMainProcessInfo, remoteInfo: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise { - return this.channel.call('getDiagnostics', [mainProcessInfo, remoteInfo]); - } - - public getSystemInfo(mainProcessInfo: IMainProcessInfo, remoteInfo: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise { - return this.channel.call('getSystemInfo', [mainProcessInfo, remoteInfo]); - } - - public getPerformanceInfo(mainProcessInfo: IMainProcessInfo, remoteInfo: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise { - return this.channel.call('getPerformanceInfo', [mainProcessInfo, remoteInfo]); - } - - public reportWorkspaceStats(workspace: IWorkspace): Promise { - return this.channel.call('reportWorkspaceStats', workspace); - } -} diff --git a/src/vs/workbench/contrib/tags/electron-browser/workspaceTags.ts b/src/vs/workbench/contrib/tags/electron-browser/workspaceTags.ts index 4737453d673..43cc4d58f3a 100644 --- a/src/vs/workbench/contrib/tags/electron-browser/workspaceTags.ts +++ b/src/vs/workbench/contrib/tags/electron-browser/workspaceTags.ts @@ -11,12 +11,12 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { ITextFileService, } from 'vs/workbench/services/textfile/common/textfiles'; -import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; import { IWorkspaceTagsService, Tags } from 'vs/workbench/contrib/tags/common/workspaceTags'; import { IWorkspaceInformation } from 'vs/platform/diagnostics/common/diagnostics'; import { IRequestService } from 'vs/platform/request/common/request'; import { isWindows } from 'vs/base/common/platform'; import { getRemotes, AllowedSecondLevelDomains, getDomainsOfRemotes } from 'vs/platform/extensionManagement/common/configRemotes'; +import { IDiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService'; export function getHashedRemotesFromConfig(text: string, stripEndingDotGit: boolean = false): string[] { return getRemotes(text, stripEndingDotGit).map(r => { @@ -32,8 +32,8 @@ export class WorkspaceTags implements IWorkbenchContribution { @ITelemetryService private readonly telemetryService: ITelemetryService, @IRequestService private readonly requestService: IRequestService, @ITextFileService private readonly textFileService: ITextFileService, - @ISharedProcessService private readonly sharedProcessService: ISharedProcessService, - @IWorkspaceTagsService private readonly workspaceTagsService: IWorkspaceTagsService + @IWorkspaceTagsService private readonly workspaceTagsService: IWorkspaceTagsService, + @IDiagnosticsService private readonly diagnosticsService: IDiagnosticsService ) { if (this.telemetryService.isOptedIn) { this.report(); @@ -53,8 +53,7 @@ export class WorkspaceTags implements IWorkbenchContribution { this.reportProxyStats(); - const diagnosticsChannel = this.sharedProcessService.getChannel('diagnostics'); - this.getWorkspaceInformation().then(stats => diagnosticsChannel.call('reportWorkspaceStats', stats)); + this.getWorkspaceInformation().then(stats => this.diagnosticsService.reportWorkspaceStats(stats)); } async reportWindowsEdition(): Promise { diff --git a/src/vs/workbench/services/diagnostics/electron-browser/diagnosticsService.ts b/src/vs/workbench/services/diagnostics/electron-browser/diagnosticsService.ts new file mode 100644 index 00000000000..0b5428fc855 --- /dev/null +++ b/src/vs/workbench/services/diagnostics/electron-browser/diagnosticsService.ts @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { createChannelSender } from 'vs/base/parts/ipc/common/ipc'; +import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; +import { IDiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService'; + +// @ts-ignore: interface is implemented via proxy +export class DiagnosticsService implements IDiagnosticsService { + + declare readonly _serviceBrand: undefined; + + constructor( + @ISharedProcessService sharedProcessService: ISharedProcessService + ) { + return createChannelSender(sharedProcessService.getChannel('diagnostics')); + } +} + +registerSingleton(IDiagnosticsService, DiagnosticsService, true); diff --git a/src/vs/workbench/workbench.desktop.main.ts b/src/vs/workbench/workbench.desktop.main.ts index 4654815024c..5fd2222b446 100644 --- a/src/vs/workbench/workbench.desktop.main.ts +++ b/src/vs/workbench/workbench.desktop.main.ts @@ -53,6 +53,7 @@ import 'vs/workbench/services/userDataSync/electron-browser/userDataSyncStoreMan import 'vs/workbench/services/userDataSync/electron-browser/userDataAutoSyncService'; import 'vs/workbench/services/sharedProcess/electron-browser/sharedProcessService'; import 'vs/workbench/services/localizations/electron-browser/localizationsService'; +import 'vs/workbench/services/diagnostics/electron-browser/diagnosticsService'; import 'vs/workbench/services/experiment/electron-browser/experimentService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; From 5e74ef9e69afc0cd8fad8d67a3f209bb513a7b4e Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 07:45:21 +0200 Subject: [PATCH 0053/1667] debt - let proxy IPC implement interface --- src/vs/platform/electron/electron-sandbox/electron.ts | 3 ++- .../workbench/services/issue/electron-sandbox/issueService.ts | 3 ++- .../localizations/electron-browser/localizationsService.ts | 3 ++- .../services/menubar/electron-sandbox/menubarService.ts | 3 ++- src/vs/workbench/services/url/electron-sandbox/urlService.ts | 2 +- .../services/workspaces/electron-sandbox/workspacesService.ts | 3 ++- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/vs/platform/electron/electron-sandbox/electron.ts b/src/vs/platform/electron/electron-sandbox/electron.ts index 25f193f372d..6b74e11cb18 100644 --- a/src/vs/platform/electron/electron-sandbox/electron.ts +++ b/src/vs/platform/electron/electron-sandbox/electron.ts @@ -12,7 +12,8 @@ export const IElectronService = createDecorator('electronServi export interface IElectronService extends ICommonElectronService { } -export class ElectronService { +// @ts-ignore: interface is implemented via proxy +export class ElectronService implements IElectronService { declare readonly _serviceBrand: undefined; diff --git a/src/vs/workbench/services/issue/electron-sandbox/issueService.ts b/src/vs/workbench/services/issue/electron-sandbox/issueService.ts index a2e5a256559..ce1f795ccbc 100644 --- a/src/vs/workbench/services/issue/electron-sandbox/issueService.ts +++ b/src/vs/workbench/services/issue/electron-sandbox/issueService.ts @@ -8,7 +8,8 @@ import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProces import { createChannelSender } from 'vs/base/parts/ipc/common/ipc'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -export class IssueService { +// @ts-ignore: interface is implemented via proxy +export class IssueService implements IIssueService { declare readonly _serviceBrand: undefined; diff --git a/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts b/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts index 44999bd842e..d7aefde89c7 100644 --- a/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts +++ b/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts @@ -8,7 +8,8 @@ import { ILocalizationsService } from 'vs/platform/localizations/common/localiza import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -export class LocalizationsService { +// @ts-ignore: interface is implemented via proxy +export class LocalizationsService implements ILocalizationsService { declare readonly _serviceBrand: undefined; diff --git a/src/vs/workbench/services/menubar/electron-sandbox/menubarService.ts b/src/vs/workbench/services/menubar/electron-sandbox/menubarService.ts index 0b321336879..c1356a21011 100644 --- a/src/vs/workbench/services/menubar/electron-sandbox/menubarService.ts +++ b/src/vs/workbench/services/menubar/electron-sandbox/menubarService.ts @@ -8,7 +8,8 @@ import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProces import { createChannelSender } from 'vs/base/parts/ipc/common/ipc'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -export class MenubarService { +// @ts-ignore: interface is implemented via proxy +export class MenubarService implements IMenubarService { declare readonly _serviceBrand: undefined; diff --git a/src/vs/workbench/services/url/electron-sandbox/urlService.ts b/src/vs/workbench/services/url/electron-sandbox/urlService.ts index 1cf519c5cc4..98591b49cc1 100644 --- a/src/vs/workbench/services/url/electron-sandbox/urlService.ts +++ b/src/vs/workbench/services/url/electron-sandbox/urlService.ts @@ -31,7 +31,7 @@ export class RelayURLService extends NativeURLService implements IURLHandler, IO ) { super(); - this.urlService = createChannelSender(mainProcessService.getChannel('url')); + this.urlService = createChannelSender(mainProcessService.getChannel('url')); mainProcessService.registerChannel('urlHandler', new URLHandlerChannel(this)); openerService.registerOpener(this); diff --git a/src/vs/workbench/services/workspaces/electron-sandbox/workspacesService.ts b/src/vs/workbench/services/workspaces/electron-sandbox/workspacesService.ts index 93b3f0d72ed..5af8998eaad 100644 --- a/src/vs/workbench/services/workspaces/electron-sandbox/workspacesService.ts +++ b/src/vs/workbench/services/workspaces/electron-sandbox/workspacesService.ts @@ -9,7 +9,8 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { createChannelSender } from 'vs/base/parts/ipc/common/ipc'; import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; -export class NativeWorkspacesService { +// @ts-ignore: interface is implemented via proxy +export class NativeWorkspacesService implements IWorkspacesService { declare readonly _serviceBrand: undefined; From d1f267742169584db010716d92addf50d4cd8139 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 07:46:15 +0200 Subject: [PATCH 0054/1667] remove unused import --- .../workbench/contrib/notebook/browser/notebook.contribution.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts index 65c0b5ea811..00758180339 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts @@ -31,7 +31,6 @@ import { NotebookEditorInput } from 'vs/workbench/contrib/notebook/browser/noteb import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService'; import { NotebookService } from 'vs/workbench/contrib/notebook/browser/notebookServiceImpl'; import { CellKind, CellToolbarLocKey, CellUri, DisplayOrderKey, getCellUndoRedoComparisonKey, NotebookDocumentBackupData, NotebookEditorPriority, NotebookTextDiffEditorPreview, ShowCellStatusBarKey } from 'vs/workbench/contrib/notebook/common/notebookCommon'; -import { NotebookProviderInfo } from 'vs/workbench/contrib/notebook/common/notebookProvider'; import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IEditorService, IOpenEditorOverride } from 'vs/workbench/services/editor/common/editorService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; From 74ad416ebc70b161d70df18f70ef4e7c2b6ca07d Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 17 Sep 2020 09:06:16 +0200 Subject: [PATCH 0055/1667] update doc comment and resolve logic --- src/vs/editor/contrib/codeAction/codeAction.ts | 3 +-- src/vs/vscode.proposed.d.ts | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/vs/editor/contrib/codeAction/codeAction.ts b/src/vs/editor/contrib/codeAction/codeAction.ts index eb0bdba64af..a488d79cae1 100644 --- a/src/vs/editor/contrib/codeAction/codeAction.ts +++ b/src/vs/editor/contrib/codeAction/codeAction.ts @@ -32,8 +32,7 @@ export class CodeActionItem { ) { } async resolve(token: CancellationToken): Promise { - // TODO@jrieken when is an item resolved already? - if (this.provider?.resolveCodeAction && !this.action.edit && !this.action.command) { + if (this.provider?.resolveCodeAction && !this.action.edit) { let action: modes.CodeAction | undefined | null; try { action = await this.provider.resolveCodeAction(this.action, token); diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 55e858830d7..8c7e69b22ac 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -19,8 +19,21 @@ declare module 'vscode' { //#region https://github.com/microsoft/vscode/issues/106410 export interface CodeActionProvider { - // TODO@jrieken make it clear that there is no support for commands, only code action - // TODO@jrieken only edit can be set + + /** + * Given a code action fill in its [`edit`](#CodeAction.edit)-property, changes to + * all other properties, like title, are ignored. A code action that has an edit + * will not be resolved. + * + * *Note* that a code action provider that returns commands, not code actions, cannot successfully + * implement this function. Returning commands is deprecated and instead code actions should be + * returned. + * + * @param codeAction A code action. + * @param token A cancellation token. + * @return The resolved code action or a thenable that resolve to such. It is OK to return the given + * `item`. When no result is returned, the given `item` will be used. + */ resolveCodeAction?(codeAction: T, token: CancellationToken): ProviderResult; } From 59e915161bf7c3252f74b3bc46a62eb6601f9723 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 09:06:42 +0200 Subject: [PATCH 0056/1667] sandbox - workaround for exposeInMainWorld accessing properties --- .../parts/sandbox/electron-browser/preload.js | 16 ++++++++++------ .../parts/sandbox/electron-sandbox/globals.ts | 2 +- .../code/electron-browser/workbench/workbench.js | 2 +- .../code/electron-sandbox/workbench/workbench.js | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/vs/base/parts/sandbox/electron-browser/preload.js b/src/vs/base/parts/sandbox/electron-browser/preload.js index 76d2c33b55a..9da47ccfde5 100644 --- a/src/vs/base/parts/sandbox/electron-browser/preload.js +++ b/src/vs/base/parts/sandbox/electron-browser/preload.js @@ -96,13 +96,17 @@ versions: process.versions, _whenEnvResolved: undefined, - get whenEnvResolved() { - if (!this._whenEnvResolved) { - this._whenEnvResolved = resolveEnv(); - } + whenEnvResolved: + /** + * @returns when the shell environment has been resolved. + */ + function () { + if (!this._whenEnvResolved) { + this._whenEnvResolved = resolveEnv(); + } - return this._whenEnvResolved; - }, + return this._whenEnvResolved; + }, getProcessMemoryInfo: /** diff --git a/src/vs/base/parts/sandbox/electron-sandbox/globals.ts b/src/vs/base/parts/sandbox/electron-sandbox/globals.ts index 35b3f1ffd87..0b3a1f205a0 100644 --- a/src/vs/base/parts/sandbox/electron-sandbox/globals.ts +++ b/src/vs/base/parts/sandbox/electron-sandbox/globals.ts @@ -90,7 +90,7 @@ export const process = (window as any).vscode.process as { * Allows to await resolving the full process environment by checking for the shell environment * of the OS in certain cases (e.g. when the app is started from the Dock on macOS). */ - whenEnvResolved: Promise; + whenEnvResolved(): Promise; /** * A listener on the process. Only a small subset of listener types are allowed. diff --git a/src/vs/code/electron-browser/workbench/workbench.js b/src/vs/code/electron-browser/workbench/workbench.js index 821e9b29253..473ffdad848 100644 --- a/src/vs/code/electron-browser/workbench/workbench.js +++ b/src/vs/code/electron-browser/workbench/workbench.js @@ -34,7 +34,7 @@ const bootstrapWindow = (() => { })(); // Load environment in parallel to workbench loading to avoid waterfall -const whenEnvResolved = bootstrapWindow.globals().process.whenEnvResolved; +const whenEnvResolved = bootstrapWindow.globals().process.whenEnvResolved(); // Load workbench main JS, CSS and NLS all in parallel. This is an // optimization to prevent a waterfall of loading to happen, because diff --git a/src/vs/code/electron-sandbox/workbench/workbench.js b/src/vs/code/electron-sandbox/workbench/workbench.js index bac5dd6d6e8..63279645fbe 100644 --- a/src/vs/code/electron-sandbox/workbench/workbench.js +++ b/src/vs/code/electron-sandbox/workbench/workbench.js @@ -34,7 +34,7 @@ const bootstrapWindow = (() => { })(); // Load environment in parallel to workbench loading to avoid waterfall -const whenEnvResolved = bootstrapWindow.globals().process.whenEnvResolved; +const whenEnvResolved = bootstrapWindow.globals().process.whenEnvResolved(); // Load workbench main JS, CSS and NLS all in parallel. This is an // optimization to prevent a waterfall of loading to happen, because From cb38e0c22a529e2f05eb8072f50e83990a188a90 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 17 Sep 2020 09:08:40 +0200 Subject: [PATCH 0057/1667] update jsdoc for internal API --- src/vs/editor/common/modes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/editor/common/modes.ts b/src/vs/editor/common/modes.ts index 492bab67897..2b864b92dd1 100644 --- a/src/vs/editor/common/modes.ts +++ b/src/vs/editor/common/modes.ts @@ -655,7 +655,7 @@ export interface CodeActionProvider { provideCodeActions(model: model.ITextModel, range: Range | Selection, context: CodeActionContext, token: CancellationToken): ProviderResult; /** - * Given a code action fill in the edit or command. Will only invoked when missing. + * Given a code action fill in the edit. Will only invoked when missing. */ resolveCodeAction?(codeAction: CodeAction, token: CancellationToken): ProviderResult; From 5c112a101b2d4c511d449fff6914531927c8b542 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Thu, 17 Sep 2020 09:59:53 +0200 Subject: [PATCH 0058/1667] Code server will throw an exception when the file argument to code was a 'number' in remote mode. Fixes #106617 --- src/vs/platform/environment/node/argv.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/platform/environment/node/argv.ts b/src/vs/platform/environment/node/argv.ts index 506d03750b5..fba8ce9fa29 100644 --- a/src/vs/platform/environment/node/argv.ts +++ b/src/vs/platform/environment/node/argv.ts @@ -173,8 +173,8 @@ export function parseArgs(args: string[], options: OptionDescriptions, err const cleanedArgs: any = {}; const remainingArgs: any = parsedArgs; - // https://github.com/microsoft/vscode/issues/58177 - cleanedArgs._ = parsedArgs._.filter(arg => String(arg).length > 0); + // https://github.com/microsoft/vscode/issues/58177, https://github.com/microsoft/vscode/issues/106617 + cleanedArgs._ = parsedArgs._.map(arg => String(arg)).filter(arg => arg.length > 0); delete remainingArgs._; From 55f071a72ffb518bf8f31e919d174570b59c6521 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 10:08:22 +0200 Subject: [PATCH 0059/1667] debt - more use of product service over product.ts --- .../workbench/api/node/extHostTerminalService.ts | 7 ++++--- src/vs/workbench/browser/web.main.ts | 8 ++++---- .../contrib/cli/node/cli.contribution.ts | 15 +++++++++------ .../electron-sandbox/configurationExportHelper.ts | 9 +++++---- src/vs/workbench/electron-browser/desktop.main.ts | 8 ++++---- .../electron-browser/backupFileService.test.ts | 3 ++- .../configurationEditingService.test.ts | 4 ++-- .../electron-browser/configurationService.test.ts | 6 +++--- .../configurationResolverService.test.ts | 4 ++-- .../environment/browser/environmentService.ts | 13 ++++++++----- .../electron-browser/environmentService.ts | 11 ++++++----- .../electron-browser/keybindingEditing.test.ts | 4 ++-- .../electron-browser/fileUserDataProvider.test.ts | 5 +++-- .../test/browser/workbenchTestServices.ts | 4 +++- .../electron-browser/workbenchTestServices.ts | 4 ++-- 15 files changed, 59 insertions(+), 46 deletions(-) diff --git a/src/vs/workbench/api/node/extHostTerminalService.ts b/src/vs/workbench/api/node/extHostTerminalService.ts index 54d99efad93..9c09dbd3746 100644 --- a/src/vs/workbench/api/node/extHostTerminalService.ts +++ b/src/vs/workbench/api/node/extHostTerminalService.ts @@ -4,7 +4,6 @@ *--------------------------------------------------------------------------------------------*/ import type * as vscode from 'vscode'; -import product from 'vs/platform/product/common/product'; import * as os from 'os'; import { URI, UriComponents } from 'vs/base/common/uri'; import * as platform from 'vs/base/common/platform'; @@ -23,6 +22,7 @@ import { getMainProcessParentEnv } from 'vs/workbench/contrib/terminal/node/term import { BaseExtHostTerminalService, ExtHostTerminal } from 'vs/workbench/api/common/extHostTerminalService'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { MergedEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariableCollection'; +import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; export class ExtHostTerminalService extends BaseExtHostTerminalService { @@ -37,7 +37,8 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService { @IExtHostConfiguration private _extHostConfiguration: ExtHostConfiguration, @IExtHostWorkspace private _extHostWorkspace: ExtHostWorkspace, @IExtHostDocumentsAndEditors private _extHostDocumentsAndEditors: ExtHostDocumentsAndEditors, - @ILogService private _logService: ILogService + @ILogService private _logService: ILogService, + @IExtHostInitDataService private _extHostInitDataService: IExtHostInitDataService ) { super(true, extHostRpc); this._updateLastActiveWorkspace(); @@ -187,7 +188,7 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService { envFromConfig, this._variableResolver, isWorkspaceShellAllowed, - product.version, + this._extHostInitDataService.version, terminalConfig.get<'auto' | 'off' | 'on'>('detectLocale', 'auto'), baseEnv ); diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts index ae322be46e8..7c13348069a 100644 --- a/src/vs/workbench/browser/web.main.ts +++ b/src/vs/workbench/browser/web.main.ts @@ -161,14 +161,14 @@ class BrowserMain extends Disposable { const payload = await this.resolveWorkspaceInitializationPayload(resourceIdentityService); - // Environment - const environmentService = new BrowserWorkbenchEnvironmentService({ workspaceId: payload.id, logsPath, ...this.configuration }); - serviceCollection.set(IWorkbenchEnvironmentService, environmentService); - // Product const productService: IProductService = { _serviceBrand: undefined, ...product, ...this.configuration.productConfiguration }; serviceCollection.set(IProductService, productService); + // Environment + const environmentService = new BrowserWorkbenchEnvironmentService({ workspaceId: payload.id, logsPath, ...this.configuration }, productService); + serviceCollection.set(IWorkbenchEnvironmentService, environmentService); + // Remote const remoteAuthorityResolverService = new RemoteAuthorityResolverService(this.configuration.resourceUriProvider); serviceCollection.set(IRemoteAuthorityResolverService, remoteAuthorityResolverService); diff --git a/src/vs/workbench/contrib/cli/node/cli.contribution.ts b/src/vs/workbench/contrib/cli/node/cli.contribution.ts index f2bc29f72fb..a0dfd14878a 100644 --- a/src/vs/workbench/contrib/cli/node/cli.contribution.ts +++ b/src/vs/workbench/contrib/cli/node/cli.contribution.ts @@ -20,6 +20,7 @@ import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import Severity from 'vs/base/common/severity'; import { ILogService } from 'vs/platform/log/common/log'; import { getPathFromAmdModule } from 'vs/base/common/amd'; +import { IProductService } from 'vs/platform/product/common/productService'; function ignore(code: string, value: T): (err: any) => Promise { return err => err.code === code ? Promise.resolve(value) : Promise.reject(err); @@ -48,13 +49,14 @@ class InstallAction extends Action { label: string, @INotificationService private readonly notificationService: INotificationService, @IDialogService private readonly dialogService: IDialogService, - @ILogService private readonly logService: ILogService + @ILogService private readonly logService: ILogService, + @IProductService private readonly productService: IProductService ) { super(id, label); } private get target(): string { - return `/usr/local/bin/${product.applicationName}`; + return `/usr/local/bin/${this.productService.applicationName}`; } run(): Promise { @@ -84,7 +86,7 @@ class InstallAction extends Action { }) .then(() => { this.logService.trace('cli#install', this.target); - this.notificationService.info(nls.localize('successIn', "Shell command '{0}' successfully installed in PATH.", product.applicationName)); + this.notificationService.info(nls.localize('successIn', "Shell command '{0}' successfully installed in PATH.", this.productService.applicationName)); }); }); } @@ -129,13 +131,14 @@ class UninstallAction extends Action { label: string, @INotificationService private readonly notificationService: INotificationService, @ILogService private readonly logService: ILogService, - @IDialogService private readonly dialogService: IDialogService + @IDialogService private readonly dialogService: IDialogService, + @IProductService private readonly productService: IProductService ) { super(id, label); } private get target(): string { - return `/usr/local/bin/${product.applicationName}`; + return `/usr/local/bin/${this.productService.applicationName}`; } run(): Promise { @@ -159,7 +162,7 @@ class UninstallAction extends Action { return Promise.reject(err); }).then(() => { this.logService.trace('cli#uninstall', this.target); - this.notificationService.info(nls.localize('successFrom', "Shell command '{0}' successfully uninstalled from PATH.", product.applicationName)); + this.notificationService.info(nls.localize('successFrom', "Shell command '{0}' successfully uninstalled from PATH.", this.productService.applicationName)); }); }); } diff --git a/src/vs/workbench/contrib/configExporter/electron-sandbox/configurationExportHelper.ts b/src/vs/workbench/contrib/configExporter/electron-sandbox/configurationExportHelper.ts index a18ff6b0cf6..4cc198e5f16 100644 --- a/src/vs/workbench/contrib/configExporter/electron-sandbox/configurationExportHelper.ts +++ b/src/vs/workbench/contrib/configExporter/electron-sandbox/configurationExportHelper.ts @@ -3,7 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import product from 'vs/platform/product/common/product'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -13,6 +12,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands'; import { IFileService } from 'vs/platform/files/common/files'; import { VSBuffer } from 'vs/base/common/buffer'; import { URI } from 'vs/base/common/uri'; +import { IProductService } from 'vs/platform/product/common/productService'; interface IExportedConfigurationNode { name: string; @@ -36,7 +36,8 @@ export class DefaultConfigurationExportHelper { @IWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, @IExtensionService private readonly extensionService: IExtensionService, @ICommandService private readonly commandService: ICommandService, - @IFileService private readonly fileService: IFileService + @IFileService private readonly fileService: IFileService, + @IProductService private readonly productService: IProductService ) { const exportDefaultConfigurationPath = environmentService.args['export-default-configuration']; if (exportDefaultConfigurationPath) { @@ -113,8 +114,8 @@ export class DefaultConfigurationExportHelper { const result: IConfigurationExport = { settings: settings.sort((a, b) => a.name.localeCompare(b.name)), buildTime: Date.now(), - commit: product.commit, - buildNumber: product.settingsSearchBuildId + commit: this.productService.commit, + buildNumber: this.productService.settingsSearchBuildId }; return result; diff --git a/src/vs/workbench/electron-browser/desktop.main.ts b/src/vs/workbench/electron-browser/desktop.main.ts index 16a091ed87e..222f1487515 100644 --- a/src/vs/workbench/electron-browser/desktop.main.ts +++ b/src/vs/workbench/electron-browser/desktop.main.ts @@ -52,7 +52,8 @@ import { IElectronService, ElectronService } from 'vs/platform/electron/electron class DesktopMain extends Disposable { - private readonly environmentService = new NativeWorkbenchEnvironmentService(this.configuration); + private readonly productService: IProductService = { _serviceBrand: undefined, ...product }; + private readonly environmentService = new NativeWorkbenchEnvironmentService(this.configuration, this.productService); constructor(private configuration: INativeWorkbenchConfiguration) { super(); @@ -175,8 +176,7 @@ class DesktopMain extends Disposable { serviceCollection.set(IWorkbenchEnvironmentService, this.environmentService); // Product - const productService: IProductService = { _serviceBrand: undefined, ...product }; - serviceCollection.set(IProductService, productService); + serviceCollection.set(IProductService, this.productService); // Log const logService = this._register(new NativeLogService(this.configuration.windowId, mainProcessService, this.environmentService)); @@ -191,7 +191,7 @@ class DesktopMain extends Disposable { serviceCollection.set(ISignService, signService); // Remote Agent - const remoteAgentService = this._register(new RemoteAgentService(this.environmentService, productService, remoteAuthorityResolverService, signService, logService)); + const remoteAgentService = this._register(new RemoteAgentService(this.environmentService, this.productService, remoteAuthorityResolverService, signService, logService)); serviceCollection.set(IRemoteAgentService, remoteAgentService); // Electron diff --git a/src/vs/workbench/services/backup/test/electron-browser/backupFileService.test.ts b/src/vs/workbench/services/backup/test/electron-browser/backupFileService.test.ts index 4da557d1732..80d03fe3ae6 100644 --- a/src/vs/workbench/services/backup/test/electron-browser/backupFileService.test.ts +++ b/src/vs/workbench/services/backup/test/electron-browser/backupFileService.test.ts @@ -27,6 +27,7 @@ import { hashPath, BackupFileService } from 'vs/workbench/services/backup/node/b import { FileUserDataProvider } from 'vs/workbench/services/userData/common/fileUserDataProvider'; import { VSBuffer } from 'vs/base/common/buffer'; import { TestWorkbenchConfiguration } from 'vs/workbench/test/electron-browser/workbenchTestServices'; +import { TestProductService } from 'vs/workbench/test/browser/workbenchTestServices'; const userdataDir = getRandomTestPath(os.tmpdir(), 'vsctests', 'backupfileservice'); const backupHome = path.join(userdataDir, 'Backups'); @@ -47,7 +48,7 @@ const untitledBackupPath = path.join(workspaceBackupPath, 'untitled', hashPath(u class TestWorkbenchEnvironmentService extends NativeWorkbenchEnvironmentService { constructor(backupPath: string) { - super({ ...TestWorkbenchConfiguration, backupPath, 'user-data-dir': userdataDir }); + super({ ...TestWorkbenchConfiguration, backupPath, 'user-data-dir': userdataDir }, TestProductService); } } diff --git a/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts b/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts index 40e66c9b1f4..4264e1dcd62 100644 --- a/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts +++ b/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts @@ -12,7 +12,7 @@ import * as json from 'vs/base/common/json'; import { Registry } from 'vs/platform/registry/common/platform'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; -import { workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices'; +import { TestProductService, workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices'; import { TestWorkbenchConfiguration, TestTextFileService } from 'vs/workbench/test/electron-browser/workbenchTestServices'; import * as uuid from 'vs/base/common/uuid'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry'; @@ -45,7 +45,7 @@ import { FileUserDataProvider } from 'vs/workbench/services/userData/common/file class TestWorkbenchEnvironmentService extends NativeWorkbenchEnvironmentService { constructor(private _appSettingsHome: URI) { - super(TestWorkbenchConfiguration); + super(TestWorkbenchConfiguration, TestProductService); } get appSettingsHome() { return this._appSettingsHome; } diff --git a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts index 88faa2af3c5..987810fce19 100644 --- a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts +++ b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts @@ -20,7 +20,7 @@ import { ConfigurationEditingErrorCode } from 'vs/workbench/services/configurati import { IFileService } from 'vs/platform/files/common/files'; import { IWorkspaceContextService, WorkbenchState, IWorkspaceFoldersChangeEvent } from 'vs/platform/workspace/common/workspace'; import { ConfigurationTarget, IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'; -import { workbenchInstantiationService, RemoteFileSystemProvider } from 'vs/workbench/test/browser/workbenchTestServices'; +import { workbenchInstantiationService, RemoteFileSystemProvider, TestProductService } from 'vs/workbench/test/browser/workbenchTestServices'; import { TestWorkbenchConfiguration, TestTextFileService } from 'vs/workbench/test/electron-browser/workbenchTestServices'; import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; @@ -56,7 +56,7 @@ import { BrowserWorkbenchEnvironmentService } from 'vs/workbench/services/enviro class TestWorkbenchEnvironmentService extends NativeWorkbenchEnvironmentService { constructor(private _appSettingsHome: URI) { - super(TestWorkbenchConfiguration); + super(TestWorkbenchConfiguration, TestProductService); } get appSettingsHome() { return this._appSettingsHome; } @@ -2094,7 +2094,7 @@ suite('ConfigurationService - Configuration Defaults', () => { function createConfiurationService(configurationDefaults: Record): IConfigurationService { const remoteAgentService = (workbenchInstantiationService()).createInstance(RemoteAgentService); - const environmentService = new BrowserWorkbenchEnvironmentService({ logsPath: URI.file(''), workspaceId: '', configurationDefaults }); + const environmentService = new BrowserWorkbenchEnvironmentService({ logsPath: URI.file(''), workspaceId: '', configurationDefaults }, TestProductService); const fileService = new FileService(new NullLogService()); return disposableStore.add(new WorkspaceService({ configurationCache: new BrowserConfigurationCache() }, environmentService, fileService, remoteAgentService)); } diff --git a/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts b/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts index 434c87b5da6..80818c1f705 100644 --- a/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts +++ b/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts @@ -13,7 +13,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands'; import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; import { BaseConfigurationResolverService } from 'vs/workbench/services/configurationResolver/browser/configurationResolverService'; import { Workspace, IWorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/workspace'; -import { TestEditorService } from 'vs/workbench/test/browser/workbenchTestServices'; +import { TestEditorService, TestProductService } from 'vs/workbench/test/browser/workbenchTestServices'; import { TestWorkbenchConfiguration } from 'vs/workbench/test/electron-browser/workbenchTestServices'; import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; import { Disposable, IDisposable } from 'vs/base/common/lifecycle'; @@ -719,6 +719,6 @@ class MockInputsConfigurationService extends TestConfigurationService { class MockWorkbenchEnvironmentService extends NativeWorkbenchEnvironmentService { constructor(public userEnv: platform.IProcessEnvironment) { - super({ ...TestWorkbenchConfiguration, userEnv }); + super({ ...TestWorkbenchConfiguration, userEnv }, TestProductService); } } diff --git a/src/vs/workbench/services/environment/browser/environmentService.ts b/src/vs/workbench/services/environment/browser/environmentService.ts index 11ff958e798..22f764f89af 100644 --- a/src/vs/workbench/services/environment/browser/environmentService.ts +++ b/src/vs/workbench/services/environment/browser/environmentService.ts @@ -11,7 +11,7 @@ import { IExtensionHostDebugParams } from 'vs/platform/environment/common/enviro import { IPath, IWindowConfiguration } from 'vs/platform/windows/common/windows'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IWorkbenchConstructionOptions as IWorkbenchOptions } from 'vs/workbench/workbench.web.api'; -import product from 'vs/platform/product/common/product'; +import { IProductService } from 'vs/platform/product/common/productService'; import { memoize } from 'vs/base/common/decorators'; import { onUnexpectedError } from 'vs/base/common/errors'; import { parseLineAndColumnAware } from 'vs/base/common/extpath'; @@ -103,7 +103,7 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment } @memoize - get isBuilt(): boolean { return !!product.commit; } + get isBuilt(): boolean { return !!this.productService.commit; } @memoize get logsPath(): string { return this.options.logsPath.path; } @@ -207,13 +207,13 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment get disableExtensions() { return this.payload?.get('disableExtensions') === 'true'; } private get webviewEndpoint(): string { - // TODO@matt: get fallback from product.json + // TODO@matt: get fallback from product service return this.options.webviewEndpoint || 'https://{{uuid}}.vscode-webview-test.com/{{commit}}'; } @memoize get webviewExternalEndpoint(): string { - return (this.webviewEndpoint).replace('{{commit}}', product.commit || '0d728c31ebdf03869d2687d9be0b017667c9ff37'); + return (this.webviewEndpoint).replace('{{commit}}', this.productService.commit || '0d728c31ebdf03869d2687d9be0b017667c9ff37'); } @memoize @@ -234,7 +234,10 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment private payload: Map | undefined; - constructor(readonly options: IBrowserWorkbenchOptions) { + constructor( + readonly options: IBrowserWorkbenchOptions, + private readonly productService: IProductService + ) { if (options.workspaceProvider && Array.isArray(options.workspaceProvider.payload)) { try { this.payload = new Map(options.workspaceProvider.payload); diff --git a/src/vs/workbench/services/environment/electron-browser/environmentService.ts b/src/vs/workbench/services/environment/electron-browser/environmentService.ts index 31b2a7a16ac..1d35f977a87 100644 --- a/src/vs/workbench/services/environment/electron-browser/environmentService.ts +++ b/src/vs/workbench/services/environment/electron-browser/environmentService.ts @@ -9,7 +9,7 @@ import { memoize } from 'vs/base/common/decorators'; import { URI } from 'vs/base/common/uri'; import { Schemas } from 'vs/base/common/network'; import { dirname, join } from 'vs/base/common/path'; -import product from 'vs/platform/product/common/product'; +import { IProductService } from 'vs/platform/product/common/productService'; import { isLinux, isWindows } from 'vs/base/common/platform'; export class NativeWorkbenchEnvironmentService extends EnvironmentService implements INativeWorkbenchEnvironmentService { @@ -20,7 +20,7 @@ export class NativeWorkbenchEnvironmentService extends EnvironmentService implem get webviewExternalEndpoint(): string { const baseEndpoint = 'https://{{uuid}}.vscode-webview-test.com/{{commit}}'; - return baseEndpoint.replace('{{commit}}', product.commit || '0d728c31ebdf03869d2687d9be0b017667c9ff37'); + return baseEndpoint.replace('{{commit}}', this.productService.commit || '0d728c31ebdf03869d2687d9be0b017667c9ff37'); } @memoize @@ -65,7 +65,8 @@ export class NativeWorkbenchEnvironmentService extends EnvironmentService implem readonly execPath = this.configuration.execPath; constructor( - readonly configuration: INativeWorkbenchConfiguration + readonly configuration: INativeWorkbenchConfiguration, + private readonly productService: IProductService ) { super(configuration); } @@ -75,7 +76,7 @@ export class NativeWorkbenchEnvironmentService extends EnvironmentService implem // Windows if (isWindows) { if (this.isBuilt) { - return join(dirname(this.execPath), 'bin', `${product.applicationName}.cmd`); + return join(dirname(this.execPath), 'bin', `${this.productService.applicationName}.cmd`); } return join(this.appRoot, 'scripts', 'code-cli.bat'); @@ -84,7 +85,7 @@ export class NativeWorkbenchEnvironmentService extends EnvironmentService implem // Linux if (isLinux) { if (this.isBuilt) { - return join(dirname(this.execPath), 'bin', `${product.applicationName}`); + return join(dirname(this.execPath), 'bin', `${this.productService.applicationName}`); } return join(this.appRoot, 'scripts', 'code-cli.sh'); diff --git a/src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts b/src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts index 4d10fd8fecc..30c1951cf4e 100644 --- a/src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts +++ b/src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts @@ -38,7 +38,7 @@ import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editor import { KeybindingsEditingService } from 'vs/workbench/services/keybinding/common/keybindingEditing'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { TextModelResolverService } from 'vs/workbench/services/textmodelResolver/common/textModelResolverService'; -import { TestBackupFileService, TestEditorGroupsService, TestEditorService, TestLifecycleService, TestPathService } from 'vs/workbench/test/browser/workbenchTestServices'; +import { TestBackupFileService, TestEditorGroupsService, TestEditorService, TestLifecycleService, TestPathService, TestProductService } from 'vs/workbench/test/browser/workbenchTestServices'; import { FileService } from 'vs/platform/files/common/fileService'; import { Schemas } from 'vs/base/common/network'; import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider'; @@ -64,7 +64,7 @@ import { UriIdentityService } from 'vs/workbench/services/uriIdentity/common/uri class TestWorkbenchEnvironmentService extends NativeWorkbenchEnvironmentService { constructor(private _appSettingsHome: URI) { - super(TestWorkbenchConfiguration); + super(TestWorkbenchConfiguration, TestProductService); } get appSettingsHome() { return this._appSettingsHome; } diff --git a/src/vs/workbench/services/userData/test/electron-browser/fileUserDataProvider.test.ts b/src/vs/workbench/services/userData/test/electron-browser/fileUserDataProvider.test.ts index 999fade0edd..c0f583b948f 100644 --- a/src/vs/workbench/services/userData/test/electron-browser/fileUserDataProvider.test.ts +++ b/src/vs/workbench/services/userData/test/electron-browser/fileUserDataProvider.test.ts @@ -21,6 +21,7 @@ import { BrowserWorkbenchEnvironmentService } from 'vs/workbench/services/enviro import { Emitter, Event } from 'vs/base/common/event'; import { timeout } from 'vs/base/common/async'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; +import { TestProductService } from 'vs/workbench/test/browser/workbenchTestServices'; suite('FileUserDataProvider', () => { @@ -42,7 +43,7 @@ suite('FileUserDataProvider', () => { disposables.add(testObject.registerProvider(Schemas.file, diskFileSystemProvider)); const workspaceId = 'workspaceId'; - environmentService = new BrowserWorkbenchEnvironmentService({ remoteAuthority: 'remote', workspaceId, logsPath: URI.file('logFile') }); + environmentService = new BrowserWorkbenchEnvironmentService({ remoteAuthority: 'remote', workspaceId, logsPath: URI.file('logFile') }, TestProductService); rootResource = URI.file(path.join(os.tmpdir(), 'vsctests', uuid.generateUuid())); userDataHomeOnDisk = joinPath(rootResource, 'user'); @@ -315,7 +316,7 @@ suite('FileUserDataProvider - Watching', () => { setup(() => { - environmentService = new BrowserWorkbenchEnvironmentService({ remoteAuthority: 'remote', workspaceId: 'workspaceId', logsPath: URI.file('logFile') }); + environmentService = new BrowserWorkbenchEnvironmentService({ remoteAuthority: 'remote', workspaceId: 'workspaceId', logsPath: URI.file('logFile') }, TestProductService); const rootResource = URI.file(path.join(os.tmpdir(), 'vsctests', uuid.generateUuid())); localUserDataResource = joinPath(rootResource, 'user'); diff --git a/src/vs/workbench/test/browser/workbenchTestServices.ts b/src/vs/workbench/test/browser/workbenchTestServices.ts index 123dae166b9..8a49fb31af7 100644 --- a/src/vs/workbench/test/browser/workbenchTestServices.ts +++ b/src/vs/workbench/test/browser/workbenchTestServices.ts @@ -308,7 +308,9 @@ class TestEnvironmentServiceWithArgs extends BrowserWorkbenchEnvironmentService args = []; } -export const TestEnvironmentService = new TestEnvironmentServiceWithArgs(Object.create(null)); +export const TestProductService = { _serviceBrand: undefined, ...product }; + +export const TestEnvironmentService = new TestEnvironmentServiceWithArgs(Object.create(null), TestProductService); export class TestProgressService implements IProgressService { diff --git a/src/vs/workbench/test/electron-browser/workbenchTestServices.ts b/src/vs/workbench/test/electron-browser/workbenchTestServices.ts index 98e3e4e2a52..40b0d08c3d9 100644 --- a/src/vs/workbench/test/electron-browser/workbenchTestServices.ts +++ b/src/vs/workbench/test/electron-browser/workbenchTestServices.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { workbenchInstantiationService as browserWorkbenchInstantiationService, ITestInstantiationService, TestLifecycleService, TestFilesConfigurationService, TestFileService, TestFileDialogService, TestPathService, TestEncodingOracle } from 'vs/workbench/test/browser/workbenchTestServices'; +import { workbenchInstantiationService as browserWorkbenchInstantiationService, ITestInstantiationService, TestLifecycleService, TestFilesConfigurationService, TestFileService, TestFileDialogService, TestPathService, TestEncodingOracle, TestProductService } from 'vs/workbench/test/browser/workbenchTestServices'; import { Event } from 'vs/base/common/event'; import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; import { NativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService'; @@ -58,7 +58,7 @@ export const TestWorkbenchConfiguration: INativeWorkbenchConfiguration = { ...parseArgs(process.argv, OPTIONS) }; -export const TestEnvironmentService = new NativeWorkbenchEnvironmentService(TestWorkbenchConfiguration); +export const TestEnvironmentService = new NativeWorkbenchEnvironmentService(TestWorkbenchConfiguration, TestProductService); export class TestTextFileService extends NativeTextFileService { private resolveTextContentError!: FileOperationError | null; From 58cee6b0f3acb1bc45968b57173fa5aefcf76877 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 10:14:02 +0200 Subject: [PATCH 0060/1667] sandbox - add note about support for get/set properties in preload script --- src/vs/base/parts/sandbox/electron-browser/preload.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/vs/base/parts/sandbox/electron-browser/preload.js b/src/vs/base/parts/sandbox/electron-browser/preload.js index 9da47ccfde5..91735d7d0ce 100644 --- a/src/vs/base/parts/sandbox/electron-browser/preload.js +++ b/src/vs/base/parts/sandbox/electron-browser/preload.js @@ -9,6 +9,13 @@ const { ipcRenderer, webFrame, crashReporter, contextBridge } = require('electron'); + // ####################################################################### + // ### ### + // ### !!! DO NOT USE GET/SET PROPERTIES ANYWHERE HERE !!! ### + // ### (https://github.com/electron/electron/issues/25516) ### + // ### ### + // ####################################################################### + const globals = { /** From e11081cf47af9baf93979974a8f6cfa0db0d2d15 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 10:28:31 +0200 Subject: [PATCH 0061/1667] sandbox - add a minimal product config --- src/vs/platform/product/common/product.ts | 24 ++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts index 81326838053..c33022d95a9 100644 --- a/src/vs/platform/product/common/product.ts +++ b/src/vs/platform/product/common/product.ts @@ -11,8 +11,8 @@ import { env } from 'vs/base/common/process'; let product: IProductConfiguration; -// Web -if (isWeb) { +// Web or Native (sandbox TODO@sandbox need to add all properties of product.json) +if (isWeb || typeof require === 'undefined' || typeof require.__$__nodeRequire !== 'function') { // Built time configuration (do NOT modify) product = { /*BUILD->INSERT_PRODUCT_CONFIGURATION*/ } as IProductConfiguration; @@ -21,10 +21,17 @@ if (isWeb) { if (Object.keys(product).length === 0) { Object.assign(product, { version: '1.50.0-dev', - nameLong: 'Visual Studio Code Web Dev', - nameShort: 'VSCode Web Dev', + nameShort: isWeb ? 'Code Web - OSS Dev' : 'Code - OSS Dev', + nameLong: isWeb ? 'Code Web - OSS Dev' : 'Code - OSS Dev', + applicationName: 'code-oss', + dataFolderName: '.vscode-oss', urlProtocol: 'code-oss', + reportIssueUrl: 'https://github.com/Microsoft/vscode/issues/new', + licenseName: 'MIT', + licenseUrl: 'https://github.com/Microsoft/vscode/blob/master/LICENSE.txt', extensionAllowedProposedApi: [ + 'ms-vscode.vscode-js-profile-flame', + 'ms-vscode.vscode-js-profile-table', 'ms-vscode.references-view', 'ms-vscode.github-browser' ], @@ -32,8 +39,8 @@ if (isWeb) { } } -// Node: AMD loader -else if (typeof require !== 'undefined' && typeof require.__$__nodeRequire === 'function') { +// Native (non-sandboxed) +else { // Obtain values from product.json and package.json const rootPath = path.dirname(getPathFromAmdModule(require, '')); @@ -55,9 +62,4 @@ else if (typeof require !== 'undefined' && typeof require.__$__nodeRequire === ' }); } -// Unknown -else { - throw new Error('Unable to resolve product configuration'); -} - export default product; From 3808cb3712e651cb96b4ccfe48c05d2fbd5f23cf Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Thu, 17 Sep 2020 10:53:46 +0200 Subject: [PATCH 0062/1667] Don't tildify paths in variable resolver Fixes #106877 --- .../services/configurationResolver/common/variableResolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/services/configurationResolver/common/variableResolver.ts b/src/vs/workbench/services/configurationResolver/common/variableResolver.ts index e0b143610a7..7d74f399e0a 100644 --- a/src/vs/workbench/services/configurationResolver/common/variableResolver.ts +++ b/src/vs/workbench/services/configurationResolver/common/variableResolver.ts @@ -144,7 +144,7 @@ export class AbstractVariableResolverService implements IConfigurationResolverSe } private fsPath(displayUri: uri): string { - return this._labelService ? this._labelService.getUriLabel(displayUri) : displayUri.fsPath; + return this._labelService ? this._labelService.getUriLabel(displayUri, { noPrefix: true }) : displayUri.fsPath; } private evaluateSingleVariable(match: string, variable: string, folderUri: uri | undefined, commandValueMapping: IStringDictionary | undefined): string { From 3118955ee8ec18cdd3eb0d8cd07990c8cdc3b9b2 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 17 Sep 2020 11:07:33 +0200 Subject: [PATCH 0063/1667] debug: when the alt key is pressed show regular editor hover and hide the debug hover #84561 --- .../debug/browser/debugEditorContribution.ts | 44 +++++++++++++++---- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts index a2c9b9a3164..d103567a26d 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts @@ -10,7 +10,7 @@ import { visit } from 'vs/base/common/json'; import { setProperty } from 'vs/base/common/jsonEdit'; import { Constants } from 'vs/base/common/uint'; import { KeyCode } from 'vs/base/common/keyCodes'; -import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; +import { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { StandardTokenType } from 'vs/editor/common/modes'; import { DEFAULT_WORD_REGEXP } from 'vs/editor/common/model/wordHelper'; import { ICodeEditor, IEditorMouseEvent, MouseTargetType, IPartialEditorMouseEvent } from 'vs/editor/browser/editorBrowser'; @@ -33,6 +33,7 @@ import { ITextModel } from 'vs/editor/common/model'; import { dispose, IDisposable } from 'vs/base/common/lifecycle'; import { EditOperation } from 'vs/editor/common/core/editOperation'; import { basename } from 'vs/base/common/path'; +import { domEvent } from 'vs/base/browser/event'; const HOVER_DELAY = 300; const LAUNCH_JSON_REGEX = /\.vscode\/launch\.json$/; @@ -171,8 +172,9 @@ export class DebugEditorContribution implements IDebugEditorContribution { private static readonly MEMOIZER = createMemoizer(); private exceptionWidget: ExceptionWidget | undefined; - private configurationWidget: FloatingClickWidget | undefined; + private altListener: IDisposable | undefined; + private altPressed = false; constructor( private editor: ICodeEditor, @@ -219,7 +221,7 @@ export class DebugEditorContribution implements IDebugEditorContribution { const stackFrame = this.debugService.getViewModel().focusedStackFrame; const model = this.editor.getModel(); if (model) { - this._applyHoverConfiguration(model, stackFrame); + this.applyHoverConfiguration(model, stackFrame); } this.toggleExceptionWidget(); this.hideHoverWidget(); @@ -240,14 +242,38 @@ export class DebugEditorContribution implements IDebugEditorContribution { return getWordToLineNumbersMap(this.editor.getModel()); } - private _applyHoverConfiguration(model: ITextModel, stackFrame: IStackFrame | undefined): void { + private applyHoverConfiguration(model: ITextModel, stackFrame: IStackFrame | undefined): void { if (stackFrame && model.uri.toString() === stackFrame.source.uri.toString()) { - this.editor.updateOptions({ - hover: { - enabled: false + if (this.altListener) { + this.altListener.dispose(); + } + // When the alt key is pressed show regular editor hover and hide the debug hover #84561 + this.altListener = domEvent(document, 'keydown')(keydownEvent => { + const standardKeyboardEvent = new StandardKeyboardEvent(keydownEvent); + if (standardKeyboardEvent.keyCode === KeyCode.Alt) { + this.altPressed = true; + this.hoverWidget.hide(); + this.enableEditorHover(); + const listener = domEvent(document, 'keyup')(keyupEvent => { + const standardKeyboardEvent = new StandardKeyboardEvent(keyupEvent); + if (standardKeyboardEvent.keyCode === KeyCode.Alt) { + this.altPressed = false; + this.editor.updateOptions({ hover: { enabled: false } }); + listener.dispose(); + } + }); } }); + + this.editor.updateOptions({ hover: { enabled: false } }); } else { + this.enableEditorHover(); + } + } + + private enableEditorHover(): void { + if (this.editor.hasModel()) { + const model = this.editor.getModel(); let overrides = { resource: model.uri, overrideIdentifier: model.getLanguageIdentifier().language @@ -266,7 +292,7 @@ export class DebugEditorContribution implements IDebugEditorContribution { async showHover(range: Range, focus: boolean): Promise { const sf = this.debugService.getViewModel().focusedStackFrame; const model = this.editor.getModel(); - if (sf && model && sf.source.uri.toString() === model.uri.toString()) { + if (sf && model && sf.source.uri.toString() === model.uri.toString() && !this.altPressed) { return this.hoverWidget.showAt(range, focus); } } @@ -274,7 +300,7 @@ export class DebugEditorContribution implements IDebugEditorContribution { private async onFocusStackFrame(sf: IStackFrame | undefined): Promise { const model = this.editor.getModel(); if (model) { - this._applyHoverConfiguration(model, sf); + this.applyHoverConfiguration(model, sf); if (sf && sf.source.uri.toString() === model.uri.toString()) { await this.toggleExceptionWidget(); } else { From 00a03f579755f76570762e04177be98737b450d2 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 11:13:44 +0200 Subject: [PATCH 0064/1667] sandbox - clear TODO that is no longer needed --- src/vs/code/electron-main/app.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index 10fceadfc30..1389595e48b 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -50,10 +50,10 @@ import { setUnexpectedErrorHandler, onUnexpectedError } from 'vs/base/common/err import { ElectronURLListener } from 'vs/platform/url/electron-main/electronUrlListener'; import { serve as serveDriver } from 'vs/platform/driver/electron-main/driver'; import { IMenubarMainService, MenubarMainService } from 'vs/platform/menubar/electron-main/menubarMainService'; -import { RunOnceScheduler, timeout } from 'vs/base/common/async'; +import { RunOnceScheduler } from 'vs/base/common/async'; import { registerContextMenuListener } from 'vs/base/parts/contextmenu/electron-main/contextmenu'; -import { homedir } from 'os'; -import { join, sep, posix } from 'vs/base/common/path'; +import { sep, posix } from 'vs/base/common/path'; +import { joinPath } from 'vs/base/common/resources'; import { localize } from 'vs/nls'; import { Schemas } from 'vs/base/common/network'; import { SnapUpdateService } from 'vs/platform/update/electron-main/updateService.snap'; @@ -269,11 +269,6 @@ export class CodeApplication extends Disposable { try { const shellEnv = await getShellEnvironment(this.logService, this.environmentService); - // TODO@sandbox workaround for https://github.com/electron/electron/issues/25119 - if (this.environmentService.sandbox) { - await timeout(100); - } - if (!webContents.isDestroyed()) { webContents.send('vscode:acceptShellEnv', shellEnv); } @@ -494,7 +489,7 @@ export class CodeApplication extends Disposable { recordingStopped = true; // only once - const path = await contentTracing.stopRecording(join(homedir(), `${product.applicationName}-${Math.random().toString(16).slice(-4)}.trace.txt`)); + const path = await contentTracing.stopRecording(joinPath(this.environmentService.userHome, `${product.applicationName}-${Math.random().toString(16).slice(-4)}.trace.txt`).fsPath); if (!timeout) { if (this.dialogMainService) { From 66c63c5d703cfc9163a604b0da70b3745f3278d1 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Thu, 17 Sep 2020 11:29:54 +0200 Subject: [PATCH 0065/1667] Update npm tasks when npm refresh is run Fixes #106780 --- extensions/npm/src/npmMain.ts | 21 ++++++++++++--------- extensions/npm/src/npmView.ts | 1 - 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/extensions/npm/src/npmMain.ts b/extensions/npm/src/npmMain.ts index a92f554b759..fc0f8a5c557 100644 --- a/extensions/npm/src/npmMain.ts +++ b/extensions/npm/src/npmMain.ts @@ -13,6 +13,14 @@ import { invalidateHoverScriptsCache, NpmScriptHoverProvider } from './scriptHov let treeDataProvider: NpmScriptsTreeDataProvider | undefined; +function invalidateScriptCaches() { + invalidateHoverScriptsCache(); + invalidateTasksCache(); + if (treeDataProvider) { + treeDataProvider.refresh(); + } +} + export async function activate(context: vscode.ExtensionContext): Promise { configureHttpRequest(); context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(e => { @@ -45,6 +53,10 @@ export async function activate(context: vscode.ExtensionContext): Promise context.subscriptions.push(vscode.commands.registerCommand('npm.runSelectedScript', runSelectedScript)); context.subscriptions.push(vscode.commands.registerCommand('npm.runScriptFromFolder', selectAndRunScriptFromFolder)); + context.subscriptions.push(vscode.commands.registerCommand('npm.refresh', () => { + invalidateScriptCaches(); + })); + } function canRunNpmInCurrentWorkspace() { @@ -55,15 +67,6 @@ function canRunNpmInCurrentWorkspace() { } function registerTaskProvider(context: vscode.ExtensionContext): vscode.Disposable | undefined { - - function invalidateScriptCaches() { - invalidateHoverScriptsCache(); - invalidateTasksCache(); - if (treeDataProvider) { - treeDataProvider.refresh(); - } - } - if (vscode.workspace.workspaceFolders) { let watcher = vscode.workspace.createFileSystemWatcher('**/package.json'); watcher.onDidChange((_e) => invalidateScriptCaches()); diff --git a/extensions/npm/src/npmView.ts b/extensions/npm/src/npmView.ts index c7c7835fa04..c1145d0806b 100644 --- a/extensions/npm/src/npmView.ts +++ b/extensions/npm/src/npmView.ts @@ -129,7 +129,6 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider { subscriptions.push(commands.registerCommand('npm.runScript', this.runScript, this)); subscriptions.push(commands.registerCommand('npm.debugScript', this.debugScript, this)); subscriptions.push(commands.registerCommand('npm.openScript', this.openScript, this)); - subscriptions.push(commands.registerCommand('npm.refresh', this.refresh, this)); subscriptions.push(commands.registerCommand('npm.runInstall', this.runInstall, this)); } From e8760a5d6c0e09ab692e5b3e414eca018745490f Mon Sep 17 00:00:00 2001 From: ChaseKnowlden Date: Tue, 15 Sep 2020 19:13:49 -0400 Subject: [PATCH 0066/1667] Fix capitalization of GitHub org --- .github/commands.json | 10 +++--- .github/pull_request_template.md | 6 ++-- .vscode/notebooks/inbox.github-issues | 4 +-- CONTRIBUTING.md | 12 +++---- README.md | 20 +++++------ ThirdPartyNotices.txt | 24 ++++++------- .../common/extract-telemetry.sh | 12 +++---- .../publish-types/update-types.ts | 4 +-- build/gulpfile.editor.js | 4 +-- build/lib/standalone.ts | 2 +- build/lib/typings/gulp-bom.d.ts | 2 +- build/lib/typings/gulp-cssnano.d.ts | 4 +-- build/lib/typings/gulp-flatmap.d.ts | 4 +-- build/lib/typings/vinyl.d.ts | 4 +-- build/monaco/README-npm.md | 6 ++-- build/monaco/package.json | 4 +-- cglicenses.json | 2 +- extensions/cgmanifest.json | 2 +- .../css-language-features/CONTRIBUTING.md | 10 +++--- extensions/css-language-features/README.md | 2 +- extensions/css-language-features/package.json | 2 +- .../css-language-features/package.nls.json | 2 +- .../schemas/package.schema.json | 2 +- extensions/emmet/CONTRIBUTING.md | 6 ++-- extensions/emmet/README.md | 2 +- extensions/emmet/package.json | 2 +- extensions/emmet/src/abbreviationActions.ts | 12 +++---- .../emmet/src/defaultCompletionProvider.ts | 2 +- .../emmet/src/test/updateImageSize.test.ts | 36 +++++++++---------- extensions/git/src/git.ts | 2 +- extensions/git/src/model.ts | 2 +- extensions/git/src/repository.ts | 2 +- extensions/git/src/staging.ts | 2 +- .../html-language-features/CONTRIBUTING.md | 12 +++---- extensions/html-language-features/README.md | 2 +- .../html-language-features/package.json | 2 +- .../html-language-features/package.nls.json | 2 +- .../schemas/package.schema.json | 2 +- extensions/javascript/cgmanifest.json | 6 ++-- .../syntaxes/JavaScript.tmLanguage.json | 6 ++-- .../syntaxes/JavaScriptReact.tmLanguage.json | 6 ++-- extensions/javascript/syntaxes/Readme.md | 2 +- .../json-language-features/CONTRIBUTING.md | 12 +++---- .../json-language-features/server/README.md | 10 +++--- extensions/json/build/update-grammars.js | 2 +- extensions/json/cgmanifest.json | 6 ++-- extensions/json/syntaxes/JSON.tmLanguage.json | 6 ++-- .../json/syntaxes/JSONC.tmLanguage.json | 6 ++-- extensions/php/build/update-grammar.js | 4 +-- extensions/sql/cgmanifest.json | 6 ++-- extensions/sql/package.json | 4 +-- extensions/sql/syntaxes/sql.tmLanguage.json | 6 ++-- .../build/update-grammars.js | 2 +- extensions/typescript-basics/cgmanifest.json | 6 ++-- .../typescript-basics/syntaxes/Readme.md | 2 +- .../syntaxes/TypeScript.tmLanguage.json | 6 ++-- .../syntaxes/TypeScriptReact.tmLanguage.json | 6 ++-- .../cgmanifest.json | 2 +- .../codeLens/implementationsCodeLens.ts | 2 +- .../src/languageFeatures/completions.ts | 10 +++--- .../src/languageFeatures/formatting.ts | 2 +- .../languageFeatures/languageConfiguration.ts | 2 +- .../src/typeScriptServiceClientHost.ts | 4 +-- .../src/utils/logger.ts | 2 +- .../src/singlefolder-tests/window.test.ts | 2 +- package.json | 4 +-- product.json | 16 ++++----- resources/win32/bin/code.sh | 4 +-- scripts/generate-definitelytyped.sh | 6 ++-- scripts/test.bat | 2 +- src/main.js | 4 +-- src/vs/base/browser/browser.ts | 2 +- src/vs/base/browser/dom.ts | 4 +-- src/vs/base/browser/ui/dropdown/dropdown.ts | 4 +-- .../base/browser/ui/iconLabel/iconlabel.css | 2 +- src/vs/base/browser/ui/list/listView.ts | 2 +- src/vs/base/browser/ui/menu/menu.ts | 2 +- src/vs/base/browser/ui/sash/sash.ts | 2 +- src/vs/base/browser/ui/splitview/paneview.ts | 2 +- src/vs/base/common/mime.ts | 4 +-- src/vs/base/common/objects.ts | 2 +- src/vs/base/common/worker/simpleWorker.ts | 2 +- src/vs/base/node/extpath.ts | 4 +-- src/vs/base/node/pfs.ts | 2 +- src/vs/base/node/watcher.ts | 2 +- .../contextmenu/electron-main/contextmenu.ts | 2 +- src/vs/base/parts/ipc/node/ipc.cp.ts | 2 +- src/vs/base/test/common/filters.test.ts | 2 +- src/vs/base/test/common/resources.test.ts | 2 +- src/vs/code/browser/workbench/workbench.ts | 2 +- src/vs/code/electron-main/app.ts | 2 +- src/vs/code/electron-main/main.ts | 4 +-- src/vs/code/electron-main/window.ts | 8 ++--- src/vs/code/node/cli.ts | 6 ++-- src/vs/code/node/shellEnv.ts | 2 +- src/vs/css.build.js | 2 +- src/vs/css.js | 2 +- .../editor/browser/controller/mouseTarget.ts | 4 +-- .../browser/controller/textAreaInput.ts | 8 ++--- .../editor/browser/services/openerService.ts | 2 +- .../browser/viewParts/lines/viewLine.ts | 2 +- src/vs/editor/common/config/editorOptions.ts | 2 +- .../common/controller/cursorTypeOperations.ts | 2 +- .../common/viewLayout/viewLineRenderer.ts | 2 +- .../gotoSymbol/link/clickLinkGesture.ts | 2 +- .../test/moveLinesCommand.test.ts | 4 +-- .../snippet/test/snippetVariables.test.ts | 2 +- .../standalone/common/monarch/monarchLexer.ts | 2 +- .../test/browser/simpleServices.test.ts | 2 +- .../browser/commands/shiftCommand.test.ts | 2 +- .../test/browser/controller/cursor.test.ts | 6 ++-- .../test/browser/controller/imeTester.html | 4 +-- .../services/decorationRenderOptions.test.ts | 4 +-- .../common/model/textModelWithTokens.test.ts | 4 +-- .../viewLayout/viewLineRenderer.test.ts | 2 +- src/vs/loader.js | 2 +- src/vs/nls.build.js | 2 +- src/vs/nls.js | 2 +- .../configuration/common/configuration.ts | 2 +- .../environment/node/environmentService.ts | 2 +- .../test/common/configRemotes.test.ts | 28 +++++++-------- src/vs/platform/files/common/files.ts | 2 +- .../files/node/diskFileSystemProvider.ts | 4 +-- .../node/watcher/nsfw/nsfwWatcherService.ts | 2 +- .../watcher/unix/chokidarWatcherService.ts | 4 +-- .../files/node/watcher/win32/CodeHelper.md | 4 +-- .../electron-browser/diskFileService.test.ts | 4 +-- .../markers/test/common/markerService.test.ts | 2 +- .../platform/menubar/electron-main/menubar.ts | 12 +++---- .../remote/common/remoteAuthorityResolver.ts | 2 +- src/vs/platform/windows/common/windows.ts | 2 +- .../electron-main/windowsMainService.ts | 4 +-- .../windows/electron-sandbox/window.ts | 2 +- .../workspacesHistoryMainService.ts | 2 +- .../workbench/api/common/extHostCommands.ts | 2 +- src/vs/workbench/api/common/extHostTypes.ts | 4 +-- .../browser/actions/textInputActions.ts | 2 +- src/vs/workbench/browser/dnd.ts | 2 +- src/vs/workbench/browser/media/style.css | 2 +- .../parts/activitybar/activitybarActions.ts | 2 +- .../browser/parts/editor/editorActions.ts | 2 +- .../browser/parts/editor/editorDropTarget.ts | 2 +- .../browser/parts/editor/editorPart.ts | 2 +- .../parts/editor/media/tabstitlecontrol.css | 10 +++--- .../parts/editor/noTabsTitleControl.ts | 2 +- .../browser/parts/editor/tabsTitleControl.ts | 14 ++++---- .../browser/parts/editor/titleControl.ts | 2 +- src/vs/workbench/common/actions.ts | 2 +- .../debug/browser/debugActionViewItems.ts | 2 +- .../editors/textFileSaveErrorHandler.ts | 2 +- .../files/browser/files.contribution.ts | 2 +- .../files/browser/views/openEditorsView.ts | 4 +-- .../browser/preferencesRenderers.ts | 2 +- .../preferences/browser/settingsEditor2.ts | 2 +- .../common/preferencesContribution.ts | 2 +- .../browser/relauncher.contribution.ts | 2 +- .../contrib/search/browser/replaceService.ts | 2 +- .../contrib/search/browser/searchView.ts | 2 +- .../contrib/search/common/queryBuilder.ts | 2 +- .../electron-browser/workspaceTags.test.ts | 8 ++--- .../contrib/tasks/common/problemCollectors.ts | 2 +- .../tasks/node/processRunnerDetector.ts | 10 +++--- .../contrib/update/browser/update.ts | 2 +- .../url/test/browser/trustedDomains.test.ts | 4 +-- .../contrib/webview/browser/pre/main.js | 2 +- .../webviewPanel/browser/webviewCommands.ts | 2 +- .../page/browser/vs_code_welcome_page.ts | 2 +- src/vs/workbench/electron-sandbox/window.ts | 2 +- .../electron-sandbox/contextmenuService.ts | 2 +- .../services/editor/browser/editorService.ts | 2 +- .../electron-browser/extensionService.ts | 2 +- .../node/extensionHostProcessSetup.ts | 2 +- .../services/history/browser/history.ts | 8 ++--- .../common/macLinuxKeyboardMapper.ts | 2 +- .../common/windowsKeyboardMapper.ts | 2 +- .../macLinuxKeyboardMapper.test.ts | 4 +-- .../outputChannelModelService.ts | 2 +- .../progress/browser/progressService.ts | 2 +- .../search/electron-browser/searchService.ts | 2 +- .../textfile/browser/textFileService.ts | 2 +- .../textfile/common/textFileEditorModel.ts | 6 ++-- .../common/textFileEditorModelManager.ts | 2 +- .../services/timer/browser/timerService.ts | 2 +- .../browser/parts/editor/editorGroups.test.ts | 2 +- test/smoke/Audit.md | 8 ++--- test/smoke/src/main.ts | 2 +- 186 files changed, 386 insertions(+), 386 deletions(-) diff --git a/.github/commands.json b/.github/commands.json index 1b2bc516842..12bff691c06 100644 --- a/.github/commands.json +++ b/.github/commands.json @@ -193,7 +193,7 @@ ], "action": "close", "addLabel": "*caused-by-extension", - "comment": "It looks like this is caused by the Python extension. Please file it with the repository [here](https://github.com/Microsoft/vscode-python). Make sure to check their issue reporting template and provide them relevant information such as the extension version you're using. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines for more information.\n\nHappy Coding!" + "comment": "It looks like this is caused by the Python extension. Please file it with the repository [here](https://github.com/microsoft/vscode-python). Make sure to check their issue reporting template and provide them relevant information such as the extension version you're using. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines for more information.\n\nHappy Coding!" }, { "type": "comment", @@ -206,7 +206,7 @@ ], "action": "close", "addLabel": "*caused-by-extension", - "comment": "It looks like this is caused by the C extension. Please file it with the repository [here](https://github.com/Microsoft/vscode-cpptools). Make sure to check their issue reporting template and provide them relevant information such as the extension version you're using. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines for more information.\n\nHappy Coding!" + "comment": "It looks like this is caused by the C extension. Please file it with the repository [here](https://github.com/microsoft/vscode-cpptools). Make sure to check their issue reporting template and provide them relevant information such as the extension version you're using. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines for more information.\n\nHappy Coding!" }, { "type": "comment", @@ -219,7 +219,7 @@ ], "action": "close", "addLabel": "*caused-by-extension", - "comment": "It looks like this is caused by the C++ extension. Please file it with the repository [here](https://github.com/Microsoft/vscode-cpptools). Make sure to check their issue reporting template and provide them relevant information such as the extension version you're using. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines for more information.\n\nHappy Coding!" + "comment": "It looks like this is caused by the C++ extension. Please file it with the repository [here](https://github.com/microsoft/vscode-cpptools). Make sure to check their issue reporting template and provide them relevant information such as the extension version you're using. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines for more information.\n\nHappy Coding!" }, { "type": "comment", @@ -232,7 +232,7 @@ ], "action": "close", "addLabel": "*caused-by-extension", - "comment": "It looks like this is caused by the C++ extension. Please file it with the repository [here](https://github.com/Microsoft/vscode-cpptools). Make sure to check their issue reporting template and provide them relevant information such as the extension version you're using. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines for more information.\n\nHappy Coding!" + "comment": "It looks like this is caused by the C++ extension. Please file it with the repository [here](https://github.com/microsoft/vscode-cpptools). Make sure to check their issue reporting template and provide them relevant information such as the extension version you're using. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines for more information.\n\nHappy Coding!" }, { "type": "comment", @@ -349,7 +349,7 @@ ], "action": "close", "addLabel": "*caused-by-extension", - "comment": "It looks like this is caused by the Java Debugger extension. Please file it with the repository [here](https://github.com/Microsoft/vscode-java-debug). Make sure to check their issue reporting template and provide them relevant information such as the extension version you're using. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines for more information.\n\nHappy Coding!" + "comment": "It looks like this is caused by the Java Debugger extension. Please file it with the repository [here](https://github.com/microsoft/vscode-java-debug). Make sure to check their issue reporting template and provide them relevant information such as the extension version you're using. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines for more information.\n\nHappy Coding!" }, { "type": "comment", diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 276121a227b..a2523237c79 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,9 +1,9 @@ - This PR fixes # diff --git a/.vscode/notebooks/inbox.github-issues b/.vscode/notebooks/inbox.github-issues index e2e9e8a1cbb..e30e34ee16a 100644 --- a/.vscode/notebooks/inbox.github-issues +++ b/.vscode/notebooks/inbox.github-issues @@ -20,7 +20,7 @@ { "kind": 1, "language": "markdown", - "value": "New issues or pull requests submitted by the community are initially triaged by an [automatic classification bot](https://github.com/microsoft/vscode-github-triage-actions/tree/master/classifier-deep). Issues that the bot does not correctly triage are then triaged by a team member. The team rotates the inbox tracker on a weekly basis.\n\nA [mirror](https://github.com/JacksonKearl/testissues/issues) of the VS Code issue stream is available with details about how the bot classifies issues, including feature-area classifications and confidence ratings. Per-category confidence thresholds and feature-area ownership data is maintained in [.github/classifier.json](https://github.com/microsoft/vscode/blob/master/.github/classifier.json). \n\n💡 The bot is being run through a GitHub action that runs every 30 minutes. Give the bot the opportunity to classify an issue before doing it manually.\n\n### Inbox Tracking\n\nThe inbox tracker is responsible for the [global inbox](https://github.com/Microsoft/vscode/issues?utf8=%E2%9C%93&q=is%3Aopen+no%3Aassignee+-label%3Afeature-request+-label%3Atestplan-item+-label%3Aplan-item) containing all **open issues and pull requests** that\n- are neither **feature requests** nor **test plan items** nor **plan items** and\n- have **no owner assignment**.\n\nThe **inbox tracker** may perform any step described in our [issue triaging documentation](https://github.com/microsoft/vscode/wiki/Issues-Triaging) but its main responsibility is to route issues to the actual feature area owner.\n\nFeature area owners track the **feature area inbox** containing all **open issues and pull requests** that\n- are personally assigned to them and are not assigned to any milestone\n- are labeled with their feature area label and are not assigned to any milestone.\nThis secondary triage may involve any of the steps described in our [issue triaging documentation](https://github.com/microsoft/vscode/wiki/Issues-Triaging) and results in a fully triaged or closed issue.\n\nThe [github triage extension](https://github.com/microsoft/vscode-github-triage-extension) can be used to assist with triaging — it provides a \"Command Palette\"-style list of triaging actions like assignment, labeling, and triggers for various bot actions.", + "value": "New issues or pull requests submitted by the community are initially triaged by an [automatic classification bot](https://github.com/microsoft/vscode-github-triage-actions/tree/master/classifier-deep). Issues that the bot does not correctly triage are then triaged by a team member. The team rotates the inbox tracker on a weekly basis.\n\nA [mirror](https://github.com/JacksonKearl/testissues/issues) of the VS Code issue stream is available with details about how the bot classifies issues, including feature-area classifications and confidence ratings. Per-category confidence thresholds and feature-area ownership data is maintained in [.github/classifier.json](https://github.com/microsoft/vscode/blob/master/.github/classifier.json). \n\n💡 The bot is being run through a GitHub action that runs every 30 minutes. Give the bot the opportunity to classify an issue before doing it manually.\n\n### Inbox Tracking\n\nThe inbox tracker is responsible for the [global inbox](https://github.com/microsoft/vscode/issues?utf8=%E2%9C%93&q=is%3Aopen+no%3Aassignee+-label%3Afeature-request+-label%3Atestplan-item+-label%3Aplan-item) containing all **open issues and pull requests** that\n- are neither **feature requests** nor **test plan items** nor **plan items** and\n- have **no owner assignment**.\n\nThe **inbox tracker** may perform any step described in our [issue triaging documentation](https://github.com/microsoft/vscode/wiki/Issues-Triaging) but its main responsibility is to route issues to the actual feature area owner.\n\nFeature area owners track the **feature area inbox** containing all **open issues and pull requests** that\n- are personally assigned to them and are not assigned to any milestone\n- are labeled with their feature area label and are not assigned to any milestone.\nThis secondary triage may involve any of the steps described in our [issue triaging documentation](https://github.com/microsoft/vscode/wiki/Issues-Triaging) and results in a fully triaged or closed issue.\n\nThe [github triage extension](https://github.com/microsoft/vscode-github-triage-extension) can be used to assist with triaging — it provides a \"Command Palette\"-style list of triaging actions like assignment, labeling, and triggers for various bot actions.", "editable": true }, { @@ -47,4 +47,4 @@ "value": "$inbox -label:emmet", "editable": true } -] \ No newline at end of file +] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b3eb18c2bc0..5d547535187 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,7 @@ The active community will be eager to assist you. Your well-worded question will Your comments and feedback are welcome, and the development team is available via a handful of different channels. -See the [Feedback Channels](https://github.com/Microsoft/vscode/wiki/Feedback-Channels) wiki page for details on how to share your thoughts. +See the [Feedback Channels](https://github.com/microsoft/vscode/wiki/Feedback-Channels) wiki page for details on how to share your thoughts. ## Reporting Issues @@ -22,15 +22,15 @@ Have you identified a reproducible problem in VS Code? Have a feature request? W ### Identify Where to Report -The VS Code project is distributed across multiple repositories. Try to file the issue against the correct repository. Check the list of [Related Projects](https://github.com/Microsoft/vscode/wiki/Related-Projects) if you aren't sure which repo is correct. +The VS Code project is distributed across multiple repositories. Try to file the issue against the correct repository. Check the list of [Related Projects](https://github.com/microsoft/vscode/wiki/Related-Projects) if you aren't sure which repo is correct. Can you recreate the issue even after [disabling all extensions](https://code.visualstudio.com/docs/editor/extension-gallery#_disable-an-extension)? If you find the issue is caused by an extension you have installed, please file an issue on the extension's repo directly. ### Look For an Existing Issue -Before you create a new issue, please do a search in [open issues](https://github.com/Microsoft/vscode/issues) to see if the issue or feature request has already been filed. +Before you create a new issue, please do a search in [open issues](https://github.com/microsoft/vscode/issues) to see if the issue or feature request has already been filed. -Be sure to scan through the [most popular](https://github.com/Microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc) feature requests. +Be sure to scan through the [most popular](https://github.com/microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc) feature requests. If you find your issue already exists, make relevant comments and add your [reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). Use a reaction in place of a "+1" comment: @@ -83,7 +83,7 @@ Don't feel bad if the developers can't reproduce the issue right away. They will ### Follow Your Issue -Once submitted, your report will go into the [issue tracking](https://github.com/Microsoft/vscode/wiki/Issue-Tracking) workflow. Be sure to understand what will happen next, so you know what to expect, and how to continue to assist throughout the process. +Once submitted, your report will go into the [issue tracking](https://github.com/microsoft/vscode/wiki/Issue-Tracking) workflow. Be sure to understand what will happen next, so you know what to expect, and how to continue to assist throughout the process. ## Automated Issue Management @@ -98,7 +98,7 @@ If you believe the bot got something wrong, please open a new issue and let us k ## Contributing Fixes If you are interested in writing code to fix issues, -please see [How to Contribute](https://github.com/Microsoft/vscode/wiki/How-to-Contribute) in the wiki. +please see [How to Contribute](https://github.com/microsoft/vscode/wiki/How-to-Contribute) in the wiki. # Thank You! diff --git a/README.md b/README.md index c095a1d190b..fb5d6bcd508 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Visual Studio Code - Open Source ("Code - OSS") [![Build Status](https://dev.azure.com/vscode/VSCode/_apis/build/status/VS%20Code?branchName=master)](https://aka.ms/vscode-builds) -[![Feature Requests](https://img.shields.io/github/issues/Microsoft/vscode/feature-request.svg)](https://github.com/Microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc) -[![Bugs](https://img.shields.io/github/issues/Microsoft/vscode/bug.svg)](https://github.com/Microsoft/vscode/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3Abug) +[![Feature Requests](https://img.shields.io/github/issues/vscode/feature-request.svg)](https://github.com/microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc) +[![Bugs](https://img.shields.io/github/issues/Microsoft/vscode/bug.svg)](https://github.com/microsoft/vscode/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3Abug) [![Gitter](https://img.shields.io/badge/chat-on%20gitter-yellow.svg)](https://gitter.im/Microsoft/vscode) ## The Repository @@ -29,12 +29,12 @@ There are many ways in which you can participate in the project, for example: * Review the [documentation](https://github.com/microsoft/vscode-docs) and make pull requests for anything from typos to new content If you are interested in fixing issues and contributing directly to the code base, -please see the document [How to Contribute](https://github.com/Microsoft/vscode/wiki/How-to-Contribute), which covers the following: +please see the document [How to Contribute](https://github.com/microsoft/vscode/wiki/How-to-Contribute), which covers the following: -* [How to build and run from source](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-and-run) -* [The development workflow, including debugging and running tests](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#debugging) -* [Coding guidelines](https://github.com/Microsoft/vscode/wiki/Coding-Guidelines) -* [Submitting pull requests](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#pull-requests) +* [How to build and run from source](https://github.com/microsoft/vscode/wiki/How-to-Contribute#build-and-run) +* [The development workflow, including debugging and running tests](https://github.com/microsoft/vscode/wiki/How-to-Contribute#debugging) +* [Coding guidelines](https://github.com/microsoft/vscode/wiki/Coding-Guidelines) +* [Submitting pull requests](https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests) * [Finding an issue to work on](https://github.com/microsoft/vscode/wiki/How-to-Contribute#where-to-contribute) * [Contributing to translations](https://aka.ms/vscodeloc) @@ -42,13 +42,13 @@ please see the document [How to Contribute](https://github.com/Microsoft/vscode/ * Ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/vscode) * [Request a new feature](CONTRIBUTING.md) -* Upvote [popular feature requests](https://github.com/Microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc) -* [File an issue](https://github.com/Microsoft/vscode/issues) +* Upvote [popular feature requests](https://github.com/microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc) +* [File an issue](https://github.com/microsoft/vscode/issues) * Follow [@code](https://twitter.com/code) and let us know what you think! ## Related Projects -Many of the core components and extensions to VS Code live in their own repositories on GitHub. For example, the [node debug adapter](https://github.com/microsoft/vscode-node-debug) and the [mono debug adapter](https://github.com/microsoft/vscode-mono-debug) have their own repositories. For a complete list, please visit the [Related Projects](https://github.com/Microsoft/vscode/wiki/Related-Projects) page on our [wiki](https://github.com/Microsoft/vscode/wiki). +Many of the core components and extensions to VS Code live in their own repositories on GitHub. For example, the [node debug adapter](https://github.com/microsoft/vscode-node-debug) and the [mono debug adapter](https://github.com/microsoft/vscode-mono-debug) have their own repositories. For a complete list, please visit the [Related Projects](https://github.com/microsoft/vscode/wiki/Related-Projects) page on our [wiki](https://github.com/microsoft/vscode/wiki). ## Bundled Extensions diff --git a/ThirdPartyNotices.txt b/ThirdPartyNotices.txt index 4cf2d042f80..082419f207c 100644 --- a/ThirdPartyNotices.txt +++ b/ThirdPartyNotices.txt @@ -38,9 +38,9 @@ This project incorporates components from the projects listed below. The origina 31. MagicStack/MagicPython version 1.1.1 (https://github.com/MagicStack/MagicPython) 32. marked version 0.6.2 (https://github.com/markedjs/marked) 33. mdn-data version 1.1.12 (https://github.com/mdn/data) -34. Microsoft/TypeScript-TmLanguage version 0.0.1 (https://github.com/Microsoft/TypeScript-TmLanguage) -35. Microsoft/vscode-JSON.tmLanguage (https://github.com/Microsoft/vscode-JSON.tmLanguage) -36. Microsoft/vscode-mssql version 1.9.0 (https://github.com/Microsoft/vscode-mssql) +34. microsoft/TypeScript-TmLanguage version 0.0.1 (https://microsoft/TypeScript-TmLanguage) +35. microsoft/vscode-JSON.tmLanguage (https://github.com/microsoft/vscode-JSON.tmLanguage) +36. microsoft/vscode-mssql version 1.9.0 (https://github.com/microsoft/vscode-mssql) 37. mmims/language-batchfile version 0.7.5 (https://github.com/mmims/language-batchfile) 38. octref/language-css version 0.42.11 (https://github.com/octref/language-css) 39. PowerShell/EditorSyntax version 1.0.0 (https://github.com/PowerShell/EditorSyntax) @@ -59,8 +59,8 @@ This project incorporates components from the projects listed below. The origina 52. textmate/perl.tmbundle (https://github.com/textmate/perl.tmbundle) 53. textmate/ruby.tmbundle (https://github.com/textmate/ruby.tmbundle) 54. textmate/yaml.tmbundle (https://github.com/textmate/yaml.tmbundle) -55. TypeScript-TmLanguage version 0.1.8 (https://github.com/Microsoft/TypeScript-TmLanguage) -56. TypeScript-TmLanguage version 1.0.0 (https://github.com/Microsoft/TypeScript-TmLanguage) +55. TypeScript-TmLanguage version 0.1.8 (https://github.com/microsoft/TypeScript-TmLanguage) +56. TypeScript-TmLanguage version 1.0.0 (https://github.com/microsoft/TypeScript-TmLanguage) 57. Unicode version 12.0.0 (https://home.unicode.org/) 58. vscode-codicons version 0.0.1 (https://github.com/microsoft/vscode-codicons) 59. vscode-logfile-highlighter version 2.8.0 (https://github.com/emilast/vscode-logfile-highlighter) @@ -1581,7 +1581,7 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice ========================================= END OF mdn-data NOTICES AND INFORMATION -%% Microsoft/TypeScript-TmLanguage NOTICES AND INFORMATION BEGIN HERE +%% microsoft/TypeScript-TmLanguage NOTICES AND INFORMATION BEGIN HERE ========================================= Copyright (c) Microsoft Corporation All rights reserved. @@ -1606,9 +1606,9 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ========================================= -END OF Microsoft/TypeScript-TmLanguage NOTICES AND INFORMATION +END OF microsoft/TypeScript-TmLanguage NOTICES AND INFORMATION -%% Microsoft/vscode-JSON.tmLanguage NOTICES AND INFORMATION BEGIN HERE +%% microsoft/vscode-JSON.tmLanguage NOTICES AND INFORMATION BEGIN HERE ========================================= vscode-JSON.tmLanguage @@ -1630,9 +1630,9 @@ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONIN THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ========================================= -END OF Microsoft/vscode-JSON.tmLanguage NOTICES AND INFORMATION +END OF microsoft/vscode-JSON.tmLanguage NOTICES AND INFORMATION -%% Microsoft/vscode-mssql NOTICES AND INFORMATION BEGIN HERE +%% microsoft/vscode-mssql NOTICES AND INFORMATION BEGIN HERE ========================================= ------------------------------------------ START OF LICENSE ----------------------------------------- vscode-mssql @@ -1645,7 +1645,7 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------- END OF LICENSE ----------------------------------------- ========================================= -END OF Microsoft/vscode-mssql NOTICES AND INFORMATION +END OF microsoft/vscode-mssql NOTICES AND INFORMATION %% mmims/language-batchfile NOTICES AND INFORMATION BEGIN HERE ========================================= @@ -2779,4 +2779,4 @@ Apache License See the License for the specific language governing permissions and limitations under the License. ========================================= -END OF Web Background Synchronization NOTICES AND INFORMATION \ No newline at end of file +END OF Web Background Synchronization NOTICES AND INFORMATION diff --git a/build/azure-pipelines/common/extract-telemetry.sh b/build/azure-pipelines/common/extract-telemetry.sh index 6436e93c8c1..03d80c1bbbd 100755 --- a/build/azure-pipelines/common/extract-telemetry.sh +++ b/build/azure-pipelines/common/extract-telemetry.sh @@ -4,12 +4,12 @@ set -e cd $BUILD_STAGINGDIRECTORY mkdir extraction cd extraction -git clone --depth 1 https://github.com/Microsoft/vscode-extension-telemetry.git -git clone --depth 1 https://github.com/Microsoft/vscode-chrome-debug-core.git -git clone --depth 1 https://github.com/Microsoft/vscode-node-debug2.git -git clone --depth 1 https://github.com/Microsoft/vscode-node-debug.git -git clone --depth 1 https://github.com/Microsoft/vscode-html-languageservice.git -git clone --depth 1 https://github.com/Microsoft/vscode-json-languageservice.git +git clone --depth 1 https://github.com/microsoft/vscode-extension-telemetry.git +git clone --depth 1 https://github.com/microsoft/vscode-chrome-debug-core.git +git clone --depth 1 https://github.com/microsoft/vscode-node-debug2.git +git clone --depth 1 https://github.com/microsoft/vscode-node-debug.git +git clone --depth 1 https://github.com/microsoft/vscode-html-languageservice.git +git clone --depth 1 https://github.com/microsoft/vscode-json-languageservice.git node $BUILD_SOURCESDIRECTORY/build/node_modules/.bin/vscode-telemetry-extractor --sourceDir $BUILD_SOURCESDIRECTORY --excludedDir $BUILD_SOURCESDIRECTORY/extensions --outputDir . --applyEndpoints node $BUILD_SOURCESDIRECTORY/build/node_modules/.bin/vscode-telemetry-extractor --config $BUILD_SOURCESDIRECTORY/build/azure-pipelines/common/telemetry-config.json -o . mkdir -p $BUILD_SOURCESDIRECTORY/.build/telemetry diff --git a/build/azure-pipelines/publish-types/update-types.ts b/build/azure-pipelines/publish-types/update-types.ts index 9603726bebf..bbce67221da 100644 --- a/build/azure-pipelines/publish-types/update-types.ts +++ b/build/azure-pipelines/publish-types/update-types.ts @@ -66,13 +66,13 @@ function getNewFileHeader(tag: string) { const header = [ `// Type definitions for Visual Studio Code ${shorttag}`, `// Project: https://github.com/microsoft/vscode`, - `// Definitions by: Visual Studio Code Team, Microsoft `, + `// Definitions by: Visual Studio Code Team, Microsoft `, `// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`, ``, `/*---------------------------------------------------------------------------------------------`, ` * Copyright (c) Microsoft Corporation. All rights reserved.`, ` * Licensed under the MIT License.`, - ` * See https://github.com/Microsoft/vscode/blob/master/LICENSE.txt for license information.`, + ` * See https://github.com/microsoft/vscode/blob/master/LICENSE.txt for license information.`, ` *--------------------------------------------------------------------------------------------*/`, ``, `/**`, diff --git a/build/gulpfile.editor.js b/build/gulpfile.editor.js index 6cb65c5a166..0c0e20d1fe6 100644 --- a/build/gulpfile.editor.js +++ b/build/gulpfile.editor.js @@ -51,7 +51,7 @@ let BUNDLED_FILE_HEADER = [ ' * Copyright (c) Microsoft Corporation. All rights reserved.', ' * Version: ' + headerVersion, ' * Released under the MIT license', - ' * https://github.com/Microsoft/vscode/blob/master/LICENSE.txt', + ' * https://github.com/microsoft/vscode/blob/master/LICENSE.txt', ' *-----------------------------------------------------------*/', '' ].join('\n'); @@ -281,7 +281,7 @@ const finalEditorResourcesTask = task.define('final-editor-resources', () => { // version.txt gulp.src('build/monaco/version.txt') .pipe(es.through(function (data) { - data.contents = Buffer.from(`monaco-editor-core: https://github.com/Microsoft/vscode/tree/${sha1}`); + data.contents = Buffer.from(`monaco-editor-core: https://github.com/microsoft/vscode/tree/${sha1}`); this.emit('data', data); })) .pipe(gulp.dest('out-monaco-editor-core')), diff --git a/build/lib/standalone.ts b/build/lib/standalone.ts index f80c611e6fc..336672b6420 100644 --- a/build/lib/standalone.ts +++ b/build/lib/standalone.ts @@ -292,7 +292,7 @@ function transportCSS(module: string, enqueue: (module: string) => void, write: const filename = path.join(SRC_DIR, module); const fileContents = fs.readFileSync(filename).toString(); - const inlineResources = 'base64'; // see https://github.com/Microsoft/monaco-editor/issues/148 + const inlineResources = 'base64'; // see https://github.com/microsoft/monaco-editor/issues/148 const newContents = _rewriteOrInlineUrls(fileContents, inlineResources === 'base64'); write(module, newContents); diff --git a/build/lib/typings/gulp-bom.d.ts b/build/lib/typings/gulp-bom.d.ts index 94dc5fd6d21..88525a7e9db 100644 --- a/build/lib/typings/gulp-bom.d.ts +++ b/build/lib/typings/gulp-bom.d.ts @@ -4,7 +4,7 @@ declare module "gulp-bom" { /** * This is required as per: - * https://github.com/Microsoft/TypeScript/issues/5073 + * https://github.com/microsoft/TypeScript/issues/5073 */ namespace f {} diff --git a/build/lib/typings/gulp-cssnano.d.ts b/build/lib/typings/gulp-cssnano.d.ts index 48f8cbf7165..97d3827641a 100644 --- a/build/lib/typings/gulp-cssnano.d.ts +++ b/build/lib/typings/gulp-cssnano.d.ts @@ -4,9 +4,9 @@ declare module "gulp-cssnano" { /** * This is required as per: - * https://github.com/Microsoft/TypeScript/issues/5073 + * https://github.com/microsoft/TypeScript/issues/5073 */ namespace f {} export = f; -} \ No newline at end of file +} diff --git a/build/lib/typings/gulp-flatmap.d.ts b/build/lib/typings/gulp-flatmap.d.ts index 82dd84e15b0..c99232c61cc 100644 --- a/build/lib/typings/gulp-flatmap.d.ts +++ b/build/lib/typings/gulp-flatmap.d.ts @@ -4,9 +4,9 @@ declare module 'gulp-flatmap' { /** * This is required as per: - * https://github.com/Microsoft/TypeScript/issues/5073 + * https://github.com/microsoft/TypeScript/issues/5073 */ namespace f {} export = f; -} \ No newline at end of file +} diff --git a/build/lib/typings/vinyl.d.ts b/build/lib/typings/vinyl.d.ts index a85632e172b..6be30a1eebf 100644 --- a/build/lib/typings/vinyl.d.ts +++ b/build/lib/typings/vinyl.d.ts @@ -103,10 +103,10 @@ declare module "vinyl" { /** * This is required as per: - * https://github.com/Microsoft/TypeScript/issues/5073 + * https://github.com/microsoft/TypeScript/issues/5073 */ namespace File {} export = File; -} \ No newline at end of file +} diff --git a/build/monaco/README-npm.md b/build/monaco/README-npm.md index 3174903eb53..ee0ffc6e95c 100644 --- a/build/monaco/README-npm.md +++ b/build/monaco/README-npm.md @@ -5,10 +5,10 @@ npm module and unless you are doing something special (e.g. authoring a monaco e and consumed independently), it is best to consume the [monaco-editor](https://www.npmjs.com/package/monaco-editor) module that contains this module and adds languages supports. -The Monaco Editor is the code editor that powers [VS Code](https://github.com/Microsoft/vscode), +The Monaco Editor is the code editor that powers [VS Code](https://github.com/microsoft/vscode), a good page describing the code editor's features is [here](https://code.visualstudio.com/docs/editor/editingevolved). -This npm module contains the core editor functionality, as it comes from the [vscode repository](https://github.com/Microsoft/vscode). +This npm module contains the core editor functionality, as it comes from the [vscode repository](https://github.com/microsoft/vscode). ## License -[MIT](https://github.com/Microsoft/vscode/blob/master/LICENSE.txt) +[MIT](https://github.com/microsoft/vscode/blob/master/LICENSE.txt) diff --git a/build/monaco/package.json b/build/monaco/package.json index 70021689eb4..5c1e142a1ad 100644 --- a/build/monaco/package.json +++ b/build/monaco/package.json @@ -9,9 +9,9 @@ "module": "./esm/vs/editor/editor.main.js", "repository": { "type": "git", - "url": "https://github.com/Microsoft/vscode" + "url": "https://github.com/microsoft/vscode" }, "bugs": { - "url": "https://github.com/Microsoft/vscode/issues" + "url": "https://github.com/microsoft/vscode/issues" } } diff --git a/cglicenses.json b/cglicenses.json index 0da22bd9f57..0c3b576a68b 100644 --- a/cglicenses.json +++ b/cglicenses.json @@ -19,7 +19,7 @@ ] }, { - // Reason: The license at https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt + // Reason: The license at https://github.com/microsoft/TypeScript/blob/master/LICENSE.txt // does not include a clear Copyright statement. "name": "typescript", "prependLicenseText": [ diff --git a/extensions/cgmanifest.json b/extensions/cgmanifest.json index 6c12dba86ad..03cf0cef986 100644 --- a/extensions/cgmanifest.json +++ b/extensions/cgmanifest.json @@ -5,7 +5,7 @@ "type": "git", "git": { "name": "typescript", - "repositoryUrl": "https://github.com/Microsoft/TypeScript", + "repositoryUrl": "https://github.com/microsoft/TypeScript", "commitHash": "54426a14f4c232da8e563d20ca8e71263e1c96b5" } }, diff --git a/extensions/css-language-features/CONTRIBUTING.md b/extensions/css-language-features/CONTRIBUTING.md index 38843f2fbaa..be9c9854b00 100644 --- a/extensions/css-language-features/CONTRIBUTING.md +++ b/extensions/css-language-features/CONTRIBUTING.md @@ -1,13 +1,13 @@ ## Setup -- Clone [Microsoft/vscode](https://github.com/microsoft/vscode) +- Clone [microsoft/vscode](https://github.com/microsoft/vscode) - Run `yarn` at `/`, this will install - Dependencies for `/extension/css-language-features/` - Dependencies for `/extension/css-language-features/server/` - devDependencies such as `gulp` - Open `/extensions/css-language-features/` as the workspace in VS Code -- Run the [`Launch Extension`](https://github.com/Microsoft/vscode/blob/master/extensions/css-language-features/.vscode/launch.json) debug target in the Debug View. This will: +- Run the [`Launch Extension`](https://github.com/microsoft/vscode/blob/master/extensions/css-language-features/.vscode/launch.json) debug target in the Debug View. This will: - Launch the `preLaunchTask` task to compile the extension - Launch a new VS Code instance with the `css-language-features` extension loaded - You should see a notification saying the development version of `css-language-features` overwrites the bundled version of `css-language-features` @@ -16,15 +16,15 @@ ### Contribute to vscode-css-languageservice -[Microsoft/vscode-css-languageservice](https://github.com/Microsoft/vscode-css-languageservice) contains the language smarts for CSS/SCSS/Less. +[microsoft/vscode-css-languageservice](https://github.com/microsoft/vscode-css-languageservice) contains the language smarts for CSS/SCSS/Less. This extension wraps the css language service into a Language Server for VS Code. -If you want to fix CSS/SCSS/Less issues or make improvements, you should make changes at [Microsoft/vscode-css-languageservice](https://github.com/Microsoft/vscode-css-languageservice). +If you want to fix CSS/SCSS/Less issues or make improvements, you should make changes at [microsoft/vscode-css-languageservice](https://github.com/microsoft/vscode-css-languageservice). However, within this extension, you can run a development version of `vscode-css-languageservice` to debug code or test language features interactively: #### Linking `vscode-css-languageservice` in `css-language-features/server/` -- Clone [Microsoft/vscode-css-languageservice](https://github.com/Microsoft/vscode-css-languageservice) +- Clone [microsoft/vscode-css-languageservice](https://github.com/microsoft/vscode-css-languageservice) - Run `yarn` in `vscode-css-languageservice` - Run `yarn link` in `vscode-css-languageservice`. This will compile and link `vscode-css-languageservice` - In `css-language-features/server/`, run `yarn link vscode-css-languageservice` diff --git a/extensions/css-language-features/README.md b/extensions/css-language-features/README.md index 5a3fad4948b..e3430c6a178 100644 --- a/extensions/css-language-features/README.md +++ b/extensions/css-language-features/README.md @@ -6,4 +6,4 @@ See [CSS, SCSS and Less in VS Code](https://code.visualstudio.com/docs/languages/css) to learn about the features of this extension. -Please read the [CONTRIBUTING.md](https://github.com/Microsoft/vscode/blob/master/extensions/css-language-features/CONTRIBUTING.md) file to learn how to contribute to this extension. \ No newline at end of file +Please read the [CONTRIBUTING.md](https://github.com/microsoft/vscode/blob/master/extensions/css-language-features/CONTRIBUTING.md) file to learn how to contribute to this extension. diff --git a/extensions/css-language-features/package.json b/extensions/css-language-features/package.json index 0b632903b52..29f056e4137 100644 --- a/extensions/css-language-features/package.json +++ b/extensions/css-language-features/package.json @@ -798,7 +798,7 @@ "jsonValidation": [ { "fileMatch": "*.css-data.json", - "url": "https://raw.githubusercontent.com/Microsoft/vscode-css-languageservice/master/docs/customData.schema.json" + "url": "https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/master/docs/customData.schema.json" }, { "fileMatch": "package.json", diff --git a/extensions/css-language-features/package.nls.json b/extensions/css-language-features/package.nls.json index 1517384b652..7f2ffb5c1d9 100644 --- a/extensions/css-language-features/package.nls.json +++ b/extensions/css-language-features/package.nls.json @@ -2,7 +2,7 @@ "displayName": "CSS Language Features", "description": "Provides rich language support for CSS, LESS and SCSS files.", "css.title": "CSS", - "css.customData.desc": "A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/Microsoft/vscode-css-languageservice/blob/master/docs/customData.md).\n\nVS Code loads custom data on startup to enhance its CSS support for the custom CSS properties, at directives, pseudo classes and pseudo elements you specify in the JSON files.\n\nThe file paths are relative to workspace and only workspace folder settings are considered.", + "css.customData.desc": "A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/microsoft/vscode-css-languageservice/blob/master/docs/customData.md).\n\nVS Code loads custom data on startup to enhance its CSS support for the custom CSS properties, at directives, pseudo classes and pseudo elements you specify in the JSON files.\n\nThe file paths are relative to workspace and only workspace folder settings are considered.", "css.completion.triggerPropertyValueCompletion.desc": "By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.", "css.completion.completePropertyWithSemicolon.desc": "Insert semicolon at end of line when completing CSS properties", "css.lint.argumentsInColorFunction.desc": "Invalid number of parameters.", diff --git a/extensions/css-language-features/schemas/package.schema.json b/extensions/css-language-features/schemas/package.schema.json index cf4193008ec..831149caa9e 100644 --- a/extensions/css-language-features/schemas/package.schema.json +++ b/extensions/css-language-features/schemas/package.schema.json @@ -8,7 +8,7 @@ "properties": { "css.customData": { "type": "array", - "markdownDescription": "A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/Microsoft/vscode-css-languageservice/blob/master/docs/customData.md).\n\nVS Code loads custom data on startup to enhance its CSS support for the custom CSS properties, at directives, pseudo classes and pseudo elements you specify in the JSON files.\n\nThe file paths are relative to workspace and only workspace folder settings are considered.", + "markdownDescription": "A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/microsoft/vscode-css-languageservice/blob/master/docs/customData.md).\n\nVS Code loads custom data on startup to enhance its CSS support for the custom CSS properties, at directives, pseudo classes and pseudo elements you specify in the JSON files.\n\nThe file paths are relative to workspace and only workspace folder settings are considered.", "items": { "type": "string", "description": "Relative path to a CSS custom data file" diff --git a/extensions/emmet/CONTRIBUTING.md b/extensions/emmet/CONTRIBUTING.md index c6c334828c3..f8757a530be 100644 --- a/extensions/emmet/CONTRIBUTING.md +++ b/extensions/emmet/CONTRIBUTING.md @@ -2,7 +2,7 @@ Read the basics about extension authoring from [Extending Visual Studio Code](https://code.visualstudio.com/docs/extensions/overview) -- Read [Build and Run VS Code from Source](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-and-run-from-source) to get a local dev set up running for VS Code +- Read [Build and Run VS Code from Source](https://github.com/microsoft/vscode/wiki/How-to-Contribute#build-and-run-from-source) to get a local dev set up running for VS Code - Open the `extensions/emmet` folder in the vscode repo in VS Code - Press F5 to start debugging @@ -10,5 +10,5 @@ Read the basics about extension authoring from [Extending Visual Studio Code](ht Tests for Emmet extension are run as integration tests as part of VS Code. -- Read [Build and Run VS Code from Source](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-and-run-from-source) to get a local dev set up running for VS Code -- Run `./scripts/test-integration.sh` to run all the integrations tests that include the Emmet tests. \ No newline at end of file +- Read [Build and Run VS Code from Source](https://github.com/microsoft/vscode/wiki/How-to-Contribute#build-and-run-from-source) to get a local dev set up running for VS Code +- Run `./scripts/test-integration.sh` to run all the integrations tests that include the Emmet tests. diff --git a/extensions/emmet/README.md b/extensions/emmet/README.md index b755345f787..e3a28931166 100644 --- a/extensions/emmet/README.md +++ b/extensions/emmet/README.md @@ -6,4 +6,4 @@ See [Emmet in Visual Studio Code](https://code.visualstudio.com/docs/editor/emmet) to learn about the features of this extension. -Please read the [CONTRIBUTING.md](https://github.com/Microsoft/vscode/blob/master/extensions/emmet/CONTRIBUTING.md) file to learn how to contribute to this extension. \ No newline at end of file +Please read the [CONTRIBUTING.md](https://github.com/microsoft/vscode/blob/master/extensions/emmet/CONTRIBUTING.md) file to learn how to contribute to this extension. diff --git a/extensions/emmet/package.json b/extensions/emmet/package.json index d02c19a78ac..79d19d92842 100644 --- a/extensions/emmet/package.json +++ b/extensions/emmet/package.json @@ -14,7 +14,7 @@ ], "repository": { "type": "git", - "url": "https://github.com/Microsoft/vscode-emmet" + "url": "https://github.com/microsoft/vscode-emmet" }, "activationEvents": [ "*", diff --git a/extensions/emmet/src/abbreviationActions.ts b/extensions/emmet/src/abbreviationActions.ts index aa1d2563dbf..6a2734cb9fa 100644 --- a/extensions/emmet/src/abbreviationActions.ts +++ b/extensions/emmet/src/abbreviationActions.ts @@ -403,7 +403,7 @@ export function isValidLocationForEmmetAbbreviation(document: vscode.TextDocumen return true; } - // Fix for https://github.com/Microsoft/vscode/issues/34162 + // Fix for https://github.com/microsoft/vscode/issues/34162 // Other than sass, stylus, we can make use of the terminator tokens to validate position if (syntax !== 'sass' && syntax !== 'stylus' && currentNode.type === 'property') { @@ -447,7 +447,7 @@ export function isValidLocationForEmmetAbbreviation(document: vscode.TextDocumen return true; } - // Workaround for https://github.com/Microsoft/vscode/30188 + // Workaround for https://github.com/microsoft/vscode/30188 // The line above the rule selector is considered as part of the selector by the css-parser // But we should assume it is a valid location for css properties under the parent rule if (currentCssNode.parent @@ -488,12 +488,12 @@ export function isValidLocationForEmmetAbbreviation(document: vscode.TextDocumen const innerRange = getInnerRange(currentHtmlNode); - // Fix for https://github.com/Microsoft/vscode/issues/28829 + // Fix for https://github.com/microsoft/vscode/issues/28829 if (!innerRange || !innerRange.contains(position)) { return false; } - // Fix for https://github.com/Microsoft/vscode/issues/35128 + // Fix for https://github.com/microsoft/vscode/issues/35128 // Find the position up till where we will backtrack looking for unescaped < or > // to decide if current position is valid for emmet expansion start = innerRange.start; @@ -536,7 +536,7 @@ export function isValidLocationForEmmetAbbreviation(document: vscode.TextDocumen i--; continue; } - // Fix for https://github.com/Microsoft/vscode/issues/55411 + // Fix for https://github.com/microsoft/vscode/issues/55411 // A space is not a valid character right after < in a tag name. if (/\s/.test(char) && textToBackTrack[i] === startAngle) { i--; @@ -640,7 +640,7 @@ function expandAbbr(input: ExpandAbbreviationInput): string | undefined { } expandOptions['text'] = input.textToWrap; - // Below fixes https://github.com/Microsoft/vscode/issues/29898 + // Below fixes https://github.com/microsoft/vscode/issues/29898 // With this, Emmet formats inline elements as block elements // ensuring the wrapped multi line text does not get merged to a single line if (!input.rangeToReplace.isSingleLine) { diff --git a/extensions/emmet/src/defaultCompletionProvider.ts b/extensions/emmet/src/defaultCompletionProvider.ts index 9e220583a2a..705c347d6dc 100644 --- a/extensions/emmet/src/defaultCompletionProvider.ts +++ b/extensions/emmet/src/defaultCompletionProvider.ts @@ -160,7 +160,7 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi let noiseCheckPromise: Thenable = Promise.resolve(); - // Fix for https://github.com/Microsoft/vscode/issues/32647 + // Fix for https://github.com/microsoft/vscode/issues/32647 // Check for document symbols in js/ts/jsx/tsx and avoid triggering emmet for abbreviations of the form symbolName.sometext // Presence of > or * or + in the abbreviation denotes valid abbreviation that should trigger emmet if (!isStyleSheet(syntax) && (document.languageId === 'javascript' || document.languageId === 'javascriptreact' || document.languageId === 'typescript' || document.languageId === 'typescriptreact')) { diff --git a/extensions/emmet/src/test/updateImageSize.test.ts b/extensions/emmet/src/test/updateImageSize.test.ts index ccf3d880925..63452786a0f 100644 --- a/extensions/emmet/src/test/updateImageSize.test.ts +++ b/extensions/emmet/src/test/updateImageSize.test.ts @@ -17,14 +17,14 @@ // .one { // margin: 10px; // padding: 10px; - // background-image: url(https://github.com/Microsoft/vscode/blob/master/resources/linux/code.png); + // background-image: url(https://github.com/microsoft/vscode/blob/master/resources/linux/code.png); // } // .two { - // background-image: url(https://github.com/Microsoft/vscode/blob/master/resources/linux/code.png); + // background-image: url(https://github.com/microsoft/vscode/blob/master/resources/linux/code.png); // height: 42px; // } // .three { - // background-image: url(https://github.com/Microsoft/vscode/blob/master/resources/linux/code.png); + // background-image: url(https://github.com/microsoft/vscode/blob/master/resources/linux/code.png); // width: 42px; // } // `; @@ -32,17 +32,17 @@ // .one { // margin: 10px; // padding: 10px; - // background-image: url(https://github.com/Microsoft/vscode/blob/master/resources/linux/code.png); + // background-image: url(https://github.com/microsoft/vscode/blob/master/resources/linux/code.png); // width: 32px; // height: 32px; // } // .two { - // background-image: url(https://github.com/Microsoft/vscode/blob/master/resources/linux/code.png); + // background-image: url(https://github.com/microsoft/vscode/blob/master/resources/linux/code.png); // width: 32px; // height: 32px; // } // .three { - // background-image: url(https://github.com/Microsoft/vscode/blob/master/resources/linux/code.png); + // background-image: url(https://github.com/microsoft/vscode/blob/master/resources/linux/code.png); // height: 32px; // width: 32px; // } @@ -68,14 +68,14 @@ // .one { // margin: 10px; // padding: 10px; - // background-image: url(https://github.com/Microsoft/vscode/blob/master/resources/linux/code.png); + // background-image: url(https://github.com/microsoft/vscode/blob/master/resources/linux/code.png); // } // .two { - // background-image: url(https://github.com/Microsoft/vscode/blob/master/resources/linux/code.png); + // background-image: url(https://github.com/microsoft/vscode/blob/master/resources/linux/code.png); // height: 42px; // } // .three { - // background-image: url(https://github.com/Microsoft/vscode/blob/master/resources/linux/code.png); + // background-image: url(https://github.com/microsoft/vscode/blob/master/resources/linux/code.png); // width: 42px; // } // @@ -87,17 +87,17 @@ // .one { // margin: 10px; // padding: 10px; - // background-image: url(https://github.com/Microsoft/vscode/blob/master/resources/linux/code.png); + // background-image: url(https://github.com/microsoft/vscode/blob/master/resources/linux/code.png); // width: 32px; // height: 32px; // } // .two { - // background-image: url(https://github.com/Microsoft/vscode/blob/master/resources/linux/code.png); + // background-image: url(https://github.com/microsoft/vscode/blob/master/resources/linux/code.png); // width: 32px; // height: 32px; // } // .three { - // background-image: url(https://github.com/Microsoft/vscode/blob/master/resources/linux/code.png); + // background-image: url(https://github.com/microsoft/vscode/blob/master/resources/linux/code.png); // height: 32px; // width: 32px; // } @@ -121,16 +121,16 @@ // test('update image size in img tag in html file with multiple cursors', () => { // const htmlwithimgtag = ` // - // - // - // + // + // + // // // `; // const expectedContents = ` // - // - // - // + // + // + // // // `; // return withRandomFileEditor(htmlwithimgtag, 'html', (editor, doc) => { diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index 84b0eb1e0a5..5331b02d6b3 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -1887,7 +1887,7 @@ export class Repository { remote.pushUrl = url; } - // https://github.com/Microsoft/vscode/issues/45271 + // https://github.com/microsoft/vscode/issues/45271 remote.isReadOnly = remote.pushUrl === undefined || remote.pushUrl === 'no_push'; } diff --git a/extensions/git/src/model.ts b/extensions/git/src/model.ts index b35c5a3b452..5b4b10c91f0 100644 --- a/extensions/git/src/model.ts +++ b/extensions/git/src/model.ts @@ -260,7 +260,7 @@ export class Model implements IRemoteSourceProviderRegistry, IPushErrorHandlerRe // This can happen whenever `path` has the wrong case sensitivity in // case insensitive file systems - // https://github.com/Microsoft/vscode/issues/33498 + // https://github.com/microsoft/vscode/issues/33498 const repositoryRoot = Uri.file(rawRoot).fsPath; if (this.getRepository(repositoryRoot)) { diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index edebe7e54c1..f5e8a5ccfb3 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -771,7 +771,7 @@ export class Repository implements Disposable { this.disposables.push(new AutoFetcher(this, globalState)); - // https://github.com/Microsoft/vscode/issues/39039 + // https://github.com/microsoft/vscode/issues/39039 const onSuccessfulPush = filterEvent(this.onDidRunOperation, e => e.operation === Operation.Push && !e.error); onSuccessfulPush(() => { const gitConfig = workspace.getConfiguration('git'); diff --git a/extensions/git/src/staging.ts b/extensions/git/src/staging.ts index eb963562a64..2db9bf84c9d 100644 --- a/extensions/git/src/staging.ts +++ b/extensions/git/src/staging.ts @@ -18,7 +18,7 @@ export function applyLineChanges(original: TextDocument, modified: TextDocument, // if this is a deletion at the very end of the document,then we need to account // for a newline at the end of the last line which may have been deleted - // https://github.com/Microsoft/vscode/issues/59670 + // https://github.com/microsoft/vscode/issues/59670 if (isDeletion && diff.originalEndLineNumber === original.lineCount) { endLine -= 1; endCharacter = original.lineAt(endLine).range.end.character; diff --git a/extensions/html-language-features/CONTRIBUTING.md b/extensions/html-language-features/CONTRIBUTING.md index 759abd46871..d4854024ee2 100644 --- a/extensions/html-language-features/CONTRIBUTING.md +++ b/extensions/html-language-features/CONTRIBUTING.md @@ -1,12 +1,12 @@ ## Setup -- Clone [Microsoft/vscode](https://github.com/microsoft/vscode) +- Clone [microsoft/vscode](https://github.com/microsoft/vscode) - Run `yarn` at `/`, this will install - Dependencies for `/extension/html-language-features/` - Dependencies for `/extension/html-language-features/server/` - devDependencies such as `gulp` - Open `/extensions/html-language-features/` as the workspace in VS Code -- Run the [`Launch Extension`](https://github.com/Microsoft/vscode/blob/master/extensions/html-language-features/.vscode/launch.json) debug target in the Debug View. This will: +- Run the [`Launch Extension`](https://github.com/microsoft/vscode/blob/master/extensions/html-language-features/.vscode/launch.json) debug target in the Debug View. This will: - Launch the `preLaunchTask` task to compile the extension - Launch a new VS Code instance with the `html-language-features` extension loaded - You should see a notification saying the development version of `html-language-features` overwrites the bundled version of `html-language-features` @@ -15,15 +15,15 @@ ### Contribute to vscode-html-languageservice -[Microsoft/vscode-html-languageservice](https://github.com/Microsoft/vscode-html-languageservice) contains the language smarts for html. +[microsoft/vscode-html-languageservice](https://github.com/microsoft/vscode-html-languageservice) contains the language smarts for html. This extension wraps the html language service into a Language Server for VS Code. -If you want to fix html issues or make improvements, you should make changes at [Microsoft/vscode-html-languageservice](https://github.com/Microsoft/vscode-html-languageservice). +If you want to fix html issues or make improvements, you should make changes at [microsoft/vscode-html-languageservice](https://github.com/microsoft/vscode-html-languageservice). However, within this extension, you can run a development version of `vscode-html-languageservice` to debug code or test language features interactively: #### Linking `vscode-html-languageservice` in `html-language-features/server/` -- Clone [Microsoft/vscode-html-languageservice](https://github.com/Microsoft/vscode-html-languageservice) +- Clone [microsoft/vscode-html-languageservice](https://github.com/microsoft/vscode-html-languageservice) - Run `yarn` in `vscode-html-languageservice` - Run `yarn link` in `vscode-html-languageservice`. This will compile and link `vscode-html-languageservice` - In `html-language-features/server/`, run `npm link vscode-html-languageservice` @@ -34,4 +34,4 @@ However, within this extension, you can run a development version of `vscode-htm - Run `yarn watch` at `html-languagefeatures/server/` to recompile this extension with the linked version of `vscode-html-languageservice` - Make some changes in `vscode-html-languageservice` - Now when you run `Launch Extension` debug target, the launched instance will use your development version of `vscode-html-languageservice`. You can interactively test the language features. -- You can also run the `Debug Extension and Language Server` debug target, which will launch the extension and attach the debugger to the language server. After successful attach, you should be able to hit breakpoints in both `vscode-html-languageservice` and `html-language-features/server/` \ No newline at end of file +- You can also run the `Debug Extension and Language Server` debug target, which will launch the extension and attach the debugger to the language server. After successful attach, you should be able to hit breakpoints in both `vscode-html-languageservice` and `html-language-features/server/` diff --git a/extensions/html-language-features/README.md b/extensions/html-language-features/README.md index d2e78da0be9..8d0b4b8f7f3 100644 --- a/extensions/html-language-features/README.md +++ b/extensions/html-language-features/README.md @@ -6,4 +6,4 @@ See [HTML in Visual Studio Code](https://code.visualstudio.com/docs/languages/html) to learn about the features of this extension. -Please read the [CONTRIBUTING.md](https://github.com/Microsoft/vscode/blob/master/extensions/html-language-features/CONTRIBUTING.md) file to learn how to contribute to this extension. +Please read the [CONTRIBUTING.md](https://github.com/microsoft/vscode/blob/master/extensions/html-language-features/CONTRIBUTING.md) file to learn how to contribute to this extension. diff --git a/extensions/html-language-features/package.json b/extensions/html-language-features/package.json index e3cf08de8ca..204ae49b1c1 100644 --- a/extensions/html-language-features/package.json +++ b/extensions/html-language-features/package.json @@ -193,7 +193,7 @@ "jsonValidation": [ { "fileMatch": "*.html-data.json", - "url": "https://raw.githubusercontent.com/Microsoft/vscode-html-languageservice/master/docs/customData.schema.json" + "url": "https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/master/docs/customData.schema.json" }, { "fileMatch": "package.json", diff --git a/extensions/html-language-features/package.nls.json b/extensions/html-language-features/package.nls.json index 90e4e73f568..ff581502952 100644 --- a/extensions/html-language-features/package.nls.json +++ b/extensions/html-language-features/package.nls.json @@ -1,7 +1,7 @@ { "displayName": "HTML Language Features", "description": "Provides rich language support for HTML and Handlebar files", - "html.customData.desc": "A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/Microsoft/vscode-html-languageservice/blob/master/docs/customData.md).\n\nVS Code loads custom data on startup to enhance its HTML support for the custom HTML tags, attributes and attribute values you specify in the JSON files.\n\nThe file paths are relative to workspace and only workspace folder settings are considered.", + "html.customData.desc": "A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/microsoft/vscode-html-languageservice/blob/master/docs/customData.md).\n\nVS Code loads custom data on startup to enhance its HTML support for the custom HTML tags, attributes and attribute values you specify in the JSON files.\n\nThe file paths are relative to workspace and only workspace folder settings are considered.", "html.format.enable.desc": "Enable/disable default HTML formatter.", "html.format.wrapLineLength.desc": "Maximum amount of characters per line (0 = disable).", "html.format.unformatted.desc": "List of tags, comma separated, that shouldn't be reformatted. `null` defaults to all tags listed at https://www.w3.org/TR/html5/dom.html#phrasing-content.", diff --git a/extensions/html-language-features/schemas/package.schema.json b/extensions/html-language-features/schemas/package.schema.json index a11810ef090..a4d8715b918 100644 --- a/extensions/html-language-features/schemas/package.schema.json +++ b/extensions/html-language-features/schemas/package.schema.json @@ -8,7 +8,7 @@ "properties": { "html.customData": { "type": "array", - "markdownDescription": "A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/Microsoft/vscode-html-languageservice/blob/master/docs/customData.md).\n\nVS Code loads custom data on startup to enhance its HTML support for the custom HTML tags, attributes and attribute values you specify in the JSON files.\n\nThe file paths are relative to workspace and only workspace folder settings are considered.", + "markdownDescription": "A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/microsoft/vscode-html-languageservice/blob/master/docs/customData.md).\n\nVS Code loads custom data on startup to enhance its HTML support for the custom HTML tags, attributes and attribute values you specify in the JSON files.\n\nThe file paths are relative to workspace and only workspace folder settings are considered.", "items": { "type": "string", "description": "Relative path to a HTML custom data file" diff --git a/extensions/javascript/cgmanifest.json b/extensions/javascript/cgmanifest.json index 7053443efe1..2d5d904f01c 100644 --- a/extensions/javascript/cgmanifest.json +++ b/extensions/javascript/cgmanifest.json @@ -4,14 +4,14 @@ "component": { "type": "git", "git": { - "name": "Microsoft/TypeScript-TmLanguage", - "repositoryUrl": "https://github.com/Microsoft/TypeScript-TmLanguage", + "name": "microsoft/TypeScript-TmLanguage", + "repositoryUrl": "https://github.com/microsoft/TypeScript-TmLanguage", "commitHash": "3133e3d914db9a2bb8812119f9273727a305f16b" } }, "license": "MIT", "version": "0.0.1", - "description": "The file syntaxes/JavaScript.tmLanguage.json was derived from TypeScriptReact.tmLanguage in https://github.com/Microsoft/TypeScript-TmLanguage." + "description": "The file syntaxes/JavaScript.tmLanguage.json was derived from TypeScriptReact.tmLanguage in https://github.com/microsoft/TypeScript-TmLanguage." }, { "component": { diff --git a/extensions/javascript/syntaxes/JavaScript.tmLanguage.json b/extensions/javascript/syntaxes/JavaScript.tmLanguage.json index a3daae76943..9a991cde03d 100644 --- a/extensions/javascript/syntaxes/JavaScript.tmLanguage.json +++ b/extensions/javascript/syntaxes/JavaScript.tmLanguage.json @@ -1,10 +1,10 @@ { "information_for_contributors": [ - "This file has been converted from https://github.com/Microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.tmLanguage", + "This file has been converted from https://github.com/microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.tmLanguage", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/fa4e0d3a918db0eab8e5c5be952f3bd649968456", + "version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/fa4e0d3a918db0eab8e5c5be952f3bd649968456", "name": "JavaScript (with React support)", "scopeName": "source.js", "patterns": [ @@ -5737,4 +5737,4 @@ "match": "\\S+" } } -} \ No newline at end of file +} diff --git a/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage.json b/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage.json index 6de57d8ba83..2ec5ce9d225 100644 --- a/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage.json +++ b/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage.json @@ -1,10 +1,10 @@ { "information_for_contributors": [ - "This file has been converted from https://github.com/Microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.tmLanguage", + "This file has been converted from https://github.com/microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.tmLanguage", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/fa4e0d3a918db0eab8e5c5be952f3bd649968456", + "version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/fa4e0d3a918db0eab8e5c5be952f3bd649968456", "name": "JavaScript (with React support)", "scopeName": "source.js.jsx", "patterns": [ @@ -5737,4 +5737,4 @@ "match": "\\S+" } } -} \ No newline at end of file +} diff --git a/extensions/javascript/syntaxes/Readme.md b/extensions/javascript/syntaxes/Readme.md index 3457a1f6334..bc29199fd73 100644 --- a/extensions/javascript/syntaxes/Readme.md +++ b/extensions/javascript/syntaxes/Readme.md @@ -1,4 +1,4 @@ -The file `JavaScript.tmLanguage.json` is derived from [TypeScriptReact.tmLanguage](https://github.com/Microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.tmLanguage). +The file `JavaScript.tmLanguage.json` is derived from [TypeScriptReact.tmLanguage](https://github.com/microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.tmLanguage). To update to the latest version: - `cd extensions/typescript` and run `npm run update-grammars` diff --git a/extensions/json-language-features/CONTRIBUTING.md b/extensions/json-language-features/CONTRIBUTING.md index 90367dec71e..7203d02e6f2 100644 --- a/extensions/json-language-features/CONTRIBUTING.md +++ b/extensions/json-language-features/CONTRIBUTING.md @@ -1,12 +1,12 @@ ## Setup -- Clone [Microsoft/vscode](https://github.com/microsoft/vscode) +- Clone [microsoft/vscode](https://github.com/microsoft/vscode) - Run `yarn` at `/`, this will install - Dependencies for `/extension/json-language-features/` - Dependencies for `/extension/json-language-features/server/` - devDependencies such as `gulp` - Open `/extensions/json-language-features/` as the workspace in VS Code -- Run the [`Launch Extension`](https://github.com/Microsoft/vscode/blob/master/extensions/json-language-features/.vscode/launch.json) debug target in the Debug View. This will: +- Run the [`Launch Extension`](https://github.com/microsoft/vscode/blob/master/extensions/json-language-features/.vscode/launch.json) debug target in the Debug View. This will: - Launch the `preLaunchTask` task to compile the extension - Launch a new VS Code instance with the `json-language-features` extension loaded - You should see a notification saying the development version of `json-language-features` overwrites the bundled version of `json-language-features` @@ -18,15 +18,15 @@ ### Contribute to vscode-json-languageservice -[Microsoft/vscode-json-languageservice](https://github.com/Microsoft/vscode-json-languageservice) is the library that implements the language smarts for JSON. +[microsoft/vscode-json-languageservice](https://github.com/microsoft/vscode-json-languageservice) is the library that implements the language smarts for JSON. The JSON language server forwards most the of requests to the service library. -If you want to fix JSON issues or make improvements, you should make changes at [Microsoft/vscode-json-languageservice](https://github.com/Microsoft/vscode-json-languageservice). +If you want to fix JSON issues or make improvements, you should make changes at [microsoft/vscode-json-languageservice](https://github.com/microsoft/vscode-json-languageservice). However, within this extension, you can run a development version of `vscode-json-languageservice` to debug code or test language features interactively: #### Linking `vscode-json-languageservice` in `json-language-features/server/` -- Clone [Microsoft/vscode-json-languageservice](https://github.com/Microsoft/vscode-json-languageservice) +- Clone [microsoft/vscode-json-languageservice](https://github.com/microsoft/vscode-json-languageservice) - Run `npm install` in `vscode-json-languageservice` - Run `npm link` in `vscode-json-languageservice`. This will compile and link `vscode-json-languageservice` - In `json-language-features/server/`, run `yarn link vscode-json-languageservice` @@ -36,4 +36,4 @@ However, within this extension, you can run a development version of `vscode-jso - Open both `vscode-json-languageservice` and this extension in a single workspace with [multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) feature - Run `yarn watch` at `json-languagefeatures/server/` to recompile this extension with the linked version of `vscode-json-languageservice` - Make some changes in `vscode-json-languageservice` -- Now when you run `Launch Extension` debug target, the launched instance will use your development version of `vscode-json-languageservice`. You can interactively test the language features. \ No newline at end of file +- Now when you run `Launch Extension` debug target, the launched instance will use your development version of `vscode-json-languageservice`. You can interactively test the language features. diff --git a/extensions/json-language-features/server/README.md b/extensions/json-language-features/server/README.md index a399a8d223c..3ff9899e298 100644 --- a/extensions/json-language-features/server/README.md +++ b/extensions/json-language-features/server/README.md @@ -214,14 +214,14 @@ To connect to the server from NodeJS, see Remy Suen's great write-up on [how to ## Participate -The source code of the JSON language server can be found in the [VSCode repository](https://github.com/Microsoft/vscode) at [extensions/json-language-features/server](https://github.com/Microsoft/vscode/tree/master/extensions/json-language-features/server). +The source code of the JSON language server can be found in the [VSCode repository](https://github.com/microsoft/vscode) at [extensions/json-language-features/server](https://github.com/microsoft/vscode/tree/master/extensions/json-language-features/server). -File issues and pull requests in the [VSCode GitHub Issues](https://github.com/Microsoft/vscode/issues). See the document [How to Contribute](https://github.com/Microsoft/vscode/wiki/How-to-Contribute) on how to build and run from source. +File issues and pull requests in the [VSCode GitHub Issues](https://github.com/microsoft/vscode/issues). See the document [How to Contribute](https://github.com/microsoft/vscode/wiki/How-to-Contribute) on how to build and run from source. Most of the functionality of the server is located in libraries: -- [jsonc-parser](https://github.com/Microsoft/node-jsonc-parser) contains the JSON parser and scanner. -- [vscode-json-languageservice](https://github.com/Microsoft/vscode-json-languageservice) contains the implementation of all features as a re-usable library. -- [vscode-languageserver-node](https://github.com/Microsoft/vscode-languageserver-node) contains the implementation of language server for NodeJS. +- [jsonc-parser](https://github.com/microsoft/node-jsonc-parser) contains the JSON parser and scanner. +- [vscode-json-languageservice](https://github.com/microsoft/vscode-json-languageservice) contains the implementation of all features as a re-usable library. +- [vscode-languageserver-node](https://github.com/microsoft/vscode-languageserver-node) contains the implementation of language server for NodeJS. Help on any of these projects is very welcome. diff --git a/extensions/json/build/update-grammars.js b/extensions/json/build/update-grammars.js index d7d92e18258..bf72e5290f0 100644 --- a/extensions/json/build/update-grammars.js +++ b/extensions/json/build/update-grammars.js @@ -31,7 +31,7 @@ function adaptJSON(grammar, replacementScope) { } } -var tsGrammarRepo = 'Microsoft/vscode-JSON.tmLanguage'; +var tsGrammarRepo = 'microsoft/vscode-JSON.tmLanguage'; updateGrammar.update(tsGrammarRepo, 'JSON.tmLanguage', './syntaxes/JSON.tmLanguage.json'); updateGrammar.update(tsGrammarRepo, 'JSON.tmLanguage', './syntaxes/JSONC.tmLanguage.json', grammar => adaptJSON(grammar, '.json.comments')); diff --git a/extensions/json/cgmanifest.json b/extensions/json/cgmanifest.json index fabb7a93aba..53db20003ba 100644 --- a/extensions/json/cgmanifest.json +++ b/extensions/json/cgmanifest.json @@ -4,8 +4,8 @@ "component": { "type": "git", "git": { - "name": "Microsoft/vscode-JSON.tmLanguage", - "repositoryUrl": "https://github.com/Microsoft/vscode-JSON.tmLanguage", + "name": "microsoft/vscode-JSON.tmLanguage", + "repositoryUrl": "https://github.com/microsoft/vscode-JSON.tmLanguage", "commitHash": "9bd83f1c252b375e957203f21793316203f61f70" } }, @@ -14,4 +14,4 @@ } ], "version": 1 -} \ No newline at end of file +} diff --git a/extensions/json/syntaxes/JSON.tmLanguage.json b/extensions/json/syntaxes/JSON.tmLanguage.json index 910045be39e..9454f0ed814 100644 --- a/extensions/json/syntaxes/JSON.tmLanguage.json +++ b/extensions/json/syntaxes/JSON.tmLanguage.json @@ -1,10 +1,10 @@ { "information_for_contributors": [ - "This file has been converted from https://github.com/Microsoft/vscode-JSON.tmLanguage/blob/master/JSON.tmLanguage", + "This file has been converted from https://github.com/microsoft/vscode-JSON.tmLanguage/blob/master/JSON.tmLanguage", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/Microsoft/vscode-JSON.tmLanguage/commit/9bd83f1c252b375e957203f21793316203f61f70", + "version": "https://github.com/microsoft/vscode-JSON.tmLanguage/commit/9bd83f1c252b375e957203f21793316203f61f70", "name": "JSON (Javascript Next)", "scopeName": "source.json", "patterns": [ @@ -210,4 +210,4 @@ ] } } -} \ No newline at end of file +} diff --git a/extensions/json/syntaxes/JSONC.tmLanguage.json b/extensions/json/syntaxes/JSONC.tmLanguage.json index 50028ef0f35..bf65fce9893 100644 --- a/extensions/json/syntaxes/JSONC.tmLanguage.json +++ b/extensions/json/syntaxes/JSONC.tmLanguage.json @@ -1,10 +1,10 @@ { "information_for_contributors": [ - "This file has been converted from https://github.com/Microsoft/vscode-JSON.tmLanguage/blob/master/JSON.tmLanguage", + "This file has been converted from https://github.com/microsoft/vscode-JSON.tmLanguage/blob/master/JSON.tmLanguage", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/Microsoft/vscode-JSON.tmLanguage/commit/9bd83f1c252b375e957203f21793316203f61f70", + "version": "https://github.com/microsoft/vscode-JSON.tmLanguage/commit/9bd83f1c252b375e957203f21793316203f61f70", "name": "JSON with comments", "scopeName": "source.json.comments", "patterns": [ @@ -210,4 +210,4 @@ ] } } -} \ No newline at end of file +} diff --git a/extensions/php/build/update-grammar.js b/extensions/php/build/update-grammar.js index 9de0d054233..18b4b33a854 100644 --- a/extensions/php/build/update-grammar.js +++ b/extensions/php/build/update-grammar.js @@ -29,8 +29,8 @@ function includeDerivativeHtml(grammar) { }); } -// Workaround for https://github.com/Microsoft/vscode/issues/40279 -// and https://github.com/Microsoft/vscode-textmate/issues/59 +// Workaround for https://github.com/microsoft/vscode/issues/40279 +// and https://github.com/microsoft/vscode-textmate/issues/59 function fixBadRegex(grammar) { function fail(msg) { throw new Error(`fixBadRegex callback couldn't patch ${msg}. It may be obsolete`); diff --git a/extensions/sql/cgmanifest.json b/extensions/sql/cgmanifest.json index 45e7c7f4e7b..110a300aff8 100644 --- a/extensions/sql/cgmanifest.json +++ b/extensions/sql/cgmanifest.json @@ -4,8 +4,8 @@ "component": { "type": "git", "git": { - "name": "Microsoft/vscode-mssql", - "repositoryUrl": "https://github.com/Microsoft/vscode-mssql", + "name": "microsoft/vscode-mssql", + "repositoryUrl": "https://github.com/microsoft/vscode-mssql", "commitHash": "61ae0eb21ac53883a23e09913a5ae77a59126ff9" } }, @@ -14,4 +14,4 @@ } ], "version": 1 -} \ No newline at end of file +} diff --git a/extensions/sql/package.json b/extensions/sql/package.json index 8c283e97246..5063c9d73e8 100644 --- a/extensions/sql/package.json +++ b/extensions/sql/package.json @@ -7,7 +7,7 @@ "license": "MIT", "engines": { "vscode": "*" }, "scripts": { - "update-grammar": "node ../../build/npm/update-grammar.js Microsoft/vscode-mssql syntaxes/SQL.plist ./syntaxes/sql.tmLanguage.json" + "update-grammar": "node ../../build/npm/update-grammar.js microsoft/vscode-mssql syntaxes/SQL.plist ./syntaxes/sql.tmLanguage.json" }, "contributes": { "languages": [{ @@ -22,4 +22,4 @@ "path": "./syntaxes/sql.tmLanguage.json" }] } -} \ No newline at end of file +} diff --git a/extensions/sql/syntaxes/sql.tmLanguage.json b/extensions/sql/syntaxes/sql.tmLanguage.json index de4dc029f80..446d200815e 100644 --- a/extensions/sql/syntaxes/sql.tmLanguage.json +++ b/extensions/sql/syntaxes/sql.tmLanguage.json @@ -1,10 +1,10 @@ { "information_for_contributors": [ - "This file has been converted from https://github.com/Microsoft/vscode-mssql/blob/master/syntaxes/SQL.plist", + "This file has been converted from https://github.com/microsoft/vscode-mssql/blob/master/syntaxes/SQL.plist", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/Microsoft/vscode-mssql/commit/61ae0eb21ac53883a23e09913a5ae77a59126ff9", + "version": "https://github.com/microsoft/vscode-mssql/commit/61ae0eb21ac53883a23e09913a5ae77a59126ff9", "name": "SQL", "scopeName": "source.sql", "patterns": [ @@ -516,4 +516,4 @@ ] } } -} \ No newline at end of file +} diff --git a/extensions/typescript-basics/build/update-grammars.js b/extensions/typescript-basics/build/update-grammars.js index a42b323ed14..b58a2f57d2e 100644 --- a/extensions/typescript-basics/build/update-grammars.js +++ b/extensions/typescript-basics/build/update-grammars.js @@ -77,7 +77,7 @@ function adaptToJavaScript(grammar, replacementScope) { } } -var tsGrammarRepo = 'Microsoft/TypeScript-TmLanguage'; +var tsGrammarRepo = 'microsoft/TypeScript-TmLanguage'; updateGrammar.update(tsGrammarRepo, 'TypeScript.tmLanguage', './syntaxes/TypeScript.tmLanguage.json', grammar => patchGrammar(grammar)); updateGrammar.update(tsGrammarRepo, 'TypeScriptReact.tmLanguage', './syntaxes/TypeScriptReact.tmLanguage.json', grammar => patchGrammar(grammar)); updateGrammar.update(tsGrammarRepo, 'TypeScriptReact.tmLanguage', '../javascript/syntaxes/JavaScript.tmLanguage.json', grammar => adaptToJavaScript(patchGrammar(grammar), '.js')); diff --git a/extensions/typescript-basics/cgmanifest.json b/extensions/typescript-basics/cgmanifest.json index 623873b2ce4..752a8371552 100644 --- a/extensions/typescript-basics/cgmanifest.json +++ b/extensions/typescript-basics/cgmanifest.json @@ -5,14 +5,14 @@ "type": "git", "git": { "name": "TypeScript-TmLanguage", - "repositoryUrl": "https://github.com/Microsoft/TypeScript-TmLanguage", + "repositoryUrl": "https://github.com/microsoft/TypeScript-TmLanguage", "commitHash": "fa4e0d3a918db0eab8e5c5be952f3bd649968456" } }, "license": "MIT", - "description": "The files syntaxes/TypeScript.tmLanguage.json and syntaxes/TypeScriptReact.tmLanguage.json were derived from TypeScript.tmLanguage and TypeScriptReact.tmLanguage in https://github.com/Microsoft/TypeScript-TmLanguage.", + "description": "The files syntaxes/TypeScript.tmLanguage.json and syntaxes/TypeScriptReact.tmLanguage.json were derived from TypeScript.tmLanguage and TypeScriptReact.tmLanguage in https://github.com/microsoft/TypeScript-TmLanguage.", "version": "1.0.0" } ], "version": 1 -} \ No newline at end of file +} diff --git a/extensions/typescript-basics/syntaxes/Readme.md b/extensions/typescript-basics/syntaxes/Readme.md index 3e1cf32a0e2..2f9c2b95ee2 100644 --- a/extensions/typescript-basics/syntaxes/Readme.md +++ b/extensions/typescript-basics/syntaxes/Readme.md @@ -1,4 +1,4 @@ -The file `TypeScript.tmLanguage.json` and `TypeScriptReact.tmLanguage.json` are derived from [TypeScript.tmLanguage](https://github.com/Microsoft/TypeScript-TmLanguage/blob/master/TypeScript.tmLanguage) and [TypeScriptReact.tmLanguage](https://github.com/Microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.tmLanguage). +The file `TypeScript.tmLanguage.json` and `TypeScriptReact.tmLanguage.json` are derived from [TypeScript.tmLanguage](https://github.com/microsoft/TypeScript-TmLanguage/blob/master/TypeScript.tmLanguage) and [TypeScriptReact.tmLanguage](https://github.com/microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.tmLanguage). To update to the latest version: - `cd extensions/typescript` and run `npm run update-grammars` diff --git a/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json b/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json index 10187a61673..e81346faced 100644 --- a/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json +++ b/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json @@ -1,10 +1,10 @@ { "information_for_contributors": [ - "This file has been converted from https://github.com/Microsoft/TypeScript-TmLanguage/blob/master/TypeScript.tmLanguage", + "This file has been converted from https://github.com/microsoft/TypeScript-TmLanguage/blob/master/TypeScript.tmLanguage", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/fa4e0d3a918db0eab8e5c5be952f3bd649968456", + "version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/fa4e0d3a918db0eab8e5c5be952f3bd649968456", "name": "TypeScript", "scopeName": "source.ts", "patterns": [ @@ -5484,4 +5484,4 @@ ] } } -} \ No newline at end of file +} diff --git a/extensions/typescript-basics/syntaxes/TypeScriptReact.tmLanguage.json b/extensions/typescript-basics/syntaxes/TypeScriptReact.tmLanguage.json index b95305e5e57..249236f4363 100644 --- a/extensions/typescript-basics/syntaxes/TypeScriptReact.tmLanguage.json +++ b/extensions/typescript-basics/syntaxes/TypeScriptReact.tmLanguage.json @@ -1,10 +1,10 @@ { "information_for_contributors": [ - "This file has been converted from https://github.com/Microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.tmLanguage", + "This file has been converted from https://github.com/microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.tmLanguage", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/fa4e0d3a918db0eab8e5c5be952f3bd649968456", + "version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/fa4e0d3a918db0eab8e5c5be952f3bd649968456", "name": "TypeScriptReact", "scopeName": "source.tsx", "patterns": [ @@ -5737,4 +5737,4 @@ "match": "\\S+" } } -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/cgmanifest.json b/extensions/typescript-language-features/cgmanifest.json index 3a011a77078..12f8e5ecacc 100644 --- a/extensions/typescript-language-features/cgmanifest.json +++ b/extensions/typescript-language-features/cgmanifest.json @@ -5,7 +5,7 @@ "type": "git", "git": { "name": "TypeScript-TmLanguage", - "repositoryUrl": "https://github.com/Microsoft/TypeScript-TmLanguage", + "repositoryUrl": "https://github.com/microsoft/TypeScript-TmLanguage", "commitHash": "3133e3d914db9a2bb8812119f9273727a305f16b" } }, diff --git a/extensions/typescript-language-features/src/languageFeatures/codeLens/implementationsCodeLens.ts b/extensions/typescript-language-features/src/languageFeatures/codeLens/implementationsCodeLens.ts index a340e21bed3..f06411ec5d8 100644 --- a/extensions/typescript-language-features/src/languageFeatures/codeLens/implementationsCodeLens.ts +++ b/extensions/typescript-language-features/src/languageFeatures/codeLens/implementationsCodeLens.ts @@ -35,7 +35,7 @@ export default class TypeScriptImplementationsCodeLensProvider extends TypeScrip const locations = response.body .map(reference => - // Only take first line on implementation: https://github.com/Microsoft/vscode/issues/23924 + // Only take first line on implementation: https://github.com/microsoft/vscode/issues/23924 new vscode.Location(this.client.toResource(reference.file), reference.start.line === reference.end.line ? typeConverters.Range.fromTextSpan(reference) diff --git a/extensions/typescript-language-features/src/languageFeatures/completions.ts b/extensions/typescript-language-features/src/languageFeatures/completions.ts index 96914bc83a7..3f994c3ac55 100644 --- a/extensions/typescript-language-features/src/languageFeatures/completions.ts +++ b/extensions/typescript-language-features/src/languageFeatures/completions.ts @@ -60,7 +60,7 @@ class MyCompletionItem extends vscode.CompletionItem { if (tsEntry.source) { // De-prioritze auto-imports - // https://github.com/Microsoft/vscode/issues/40311 + // https://github.com/microsoft/vscode/issues/40311 this.sortText = '\uffff' + tsEntry.sortText; } else { this.sortText = tsEntry.sortText; @@ -578,7 +578,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider< private getTsTriggerCharacter(context: vscode.CompletionContext): Proto.CompletionsTriggerCharacter | undefined { switch (context.triggerCharacter) { - case '@': // Workaround for https://github.com/Microsoft/TypeScript/issues/27321 + case '@': // Workaround for https://github.com/microsoft/TypeScript/issues/27321 return this.client.apiVersion.gte(API.v310) && this.client.apiVersion.lt(API.v320) ? undefined : '@'; case '#': // Workaround for https://github.com/microsoft/TypeScript/issues/36367 @@ -720,7 +720,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider< position: vscode.Position ): boolean { if (this.client.apiVersion.lt(API.v320)) { - // Workaround for https://github.com/Microsoft/TypeScript/issues/27742 + // Workaround for https://github.com/microsoft/TypeScript/issues/27742 // Only enable dot completions when previous character not a dot preceded by whitespace. // Prevents incorrectly completing while typing spread operators. if (position.character > 1) { @@ -793,7 +793,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider< document: vscode.TextDocument, token: vscode.CancellationToken ): Promise { - // Workaround for https://github.com/Microsoft/TypeScript/issues/12677 + // Workaround for https://github.com/microsoft/TypeScript/issues/12677 // Don't complete function calls inside of destructive assignments or imports try { const args: Proto.FileLocationRequestArgs = typeConverters.Position.toFileLocationRequestArgs(filepath, position); @@ -812,7 +812,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider< } // Don't complete function call if there is already something that looks like a function call - // https://github.com/Microsoft/vscode/issues/18131 + // https://github.com/microsoft/vscode/issues/18131 const after = document.lineAt(position.line).text.slice(position.character); return after.match(/^[a-z_$0-9]*\s*\(/gi) === null; } diff --git a/extensions/typescript-language-features/src/languageFeatures/formatting.ts b/extensions/typescript-language-features/src/languageFeatures/formatting.ts index cc2469774a5..cf19d59ab92 100644 --- a/extensions/typescript-language-features/src/languageFeatures/formatting.ts +++ b/extensions/typescript-language-features/src/languageFeatures/formatting.ts @@ -66,7 +66,7 @@ class TypeScriptFormattingProvider implements vscode.DocumentRangeFormattingEdit for (const edit of response.body) { const textEdit = typeConverters.TextEdit.fromCodeEdit(edit); const range = textEdit.range; - // Work around for https://github.com/Microsoft/TypeScript/issues/6700. + // Work around for https://github.com/microsoft/TypeScript/issues/6700. // Check if we have an edit at the beginning of the line which only removes white spaces and leaves // an empty line. Drop those edits if (range.start.character === 0 && range.start.line === range.end.line && textEdit.newText === '') { diff --git a/extensions/typescript-language-features/src/languageFeatures/languageConfiguration.ts b/extensions/typescript-language-features/src/languageFeatures/languageConfiguration.ts index e7f0af0ff9c..fc81cb57fbe 100644 --- a/extensions/typescript-language-features/src/languageFeatures/languageConfiguration.ts +++ b/extensions/typescript-language-features/src/languageFeatures/languageConfiguration.ts @@ -5,7 +5,7 @@ /* -------------------------------------------------------------------------------------------- * Includes code from typescript-sublime-plugin project, obtained from - * https://github.com/Microsoft/TypeScript-Sublime-Plugin/blob/master/TypeScript%20Indent.tmPreferences + * https://github.com/microsoft/TypeScript-Sublime-Plugin/blob/master/TypeScript%20Indent.tmPreferences * ------------------------------------------------------------------------------------------ */ import * as vscode from 'vscode'; diff --git a/extensions/typescript-language-features/src/typeScriptServiceClientHost.ts b/extensions/typescript-language-features/src/typeScriptServiceClientHost.ts index 908735a7f2d..d225ef60224 100644 --- a/extensions/typescript-language-features/src/typeScriptServiceClientHost.ts +++ b/extensions/typescript-language-features/src/typeScriptServiceClientHost.ts @@ -5,7 +5,7 @@ /* -------------------------------------------------------------------------------------------- * Includes code from typescript-sublime-plugin project, obtained from - * https://github.com/Microsoft/TypeScript-Sublime-Plugin/blob/master/TypeScript%20Indent.tmPreferences + * https://github.com/microsoft/TypeScript-Sublime-Plugin/blob/master/TypeScript%20Indent.tmPreferences * ------------------------------------------------------------------------------------------ */ import * as vscode from 'vscode'; @@ -229,7 +229,7 @@ export default class TypeScriptServiceClientHost extends Disposable { } private configFileDiagnosticsReceived(event: Proto.ConfigFileDiagnosticEvent): void { - // See https://github.com/Microsoft/TypeScript/issues/10384 + // See https://github.com/microsoft/TypeScript/issues/10384 const body = event.body; if (!body || !body.diagnostics || !body.configFile) { return; diff --git a/extensions/typescript-language-features/src/utils/logger.ts b/extensions/typescript-language-features/src/utils/logger.ts index 74b9fbcbf08..6afb44136d9 100644 --- a/extensions/typescript-language-features/src/utils/logger.ts +++ b/extensions/typescript-language-features/src/utils/logger.ts @@ -33,7 +33,7 @@ export class Logger { } public error(message: string, data?: any): void { - // See https://github.com/Microsoft/TypeScript/issues/10496 + // See https://github.com/microsoft/TypeScript/issues/10496 if (data && data.message === 'No content available.') { return; } diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts index 3f4fd2366ce..89f3dbb7259 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts @@ -466,7 +466,7 @@ suite('vscode API - window', () => { return unexpected; }); - test('showQuickPick, keep selection (Microsoft/vscode-azure-account#67)', async function () { + test('showQuickPick, keep selection (microsoft/vscode-azure-account#67)', async function () { const picks = window.showQuickPick([ { label: 'eins' }, { label: 'zwei', picked: true }, diff --git a/package.json b/package.json index af9aeb2324e..2244610ffb6 100644 --- a/package.json +++ b/package.json @@ -181,10 +181,10 @@ }, "repository": { "type": "git", - "url": "https://github.com/Microsoft/vscode.git" + "url": "https://github.com/microsoft/vscode.git" }, "bugs": { - "url": "https://github.com/Microsoft/vscode/issues" + "url": "https://github.com/microsoft/vscode/issues" }, "optionalDependencies": { "vscode-windows-ca-certs": "0.2.0", diff --git a/product.json b/product.json index d4e830aada9..0daf2d3b35e 100644 --- a/product.json +++ b/product.json @@ -5,7 +5,7 @@ "dataFolderName": ".vscode-oss", "win32MutexName": "vscodeoss", "licenseName": "MIT", - "licenseUrl": "https://github.com/Microsoft/vscode/blob/master/LICENSE.txt", + "licenseUrl": "https://github.com/microsoft/vscode/blob/master/LICENSE.txt", "win32DirName": "Microsoft Code OSS", "win32NameVersion": "Microsoft Code OSS", "win32RegValueName": "CodeOSS", @@ -20,7 +20,7 @@ "darwinBundleIdentifier": "com.visualstudio.code.oss", "linuxIconName": "com.visualstudio.code.oss", "licenseFileName": "LICENSE.txt", - "reportIssueUrl": "https://github.com/Microsoft/vscode/issues/new", + "reportIssueUrl": "https://github.com/microsoft/vscode/issues/new", "urlProtocol": "code-oss", "extensionAllowedProposedApi": [ "ms-vscode.vscode-js-profile-flame", @@ -32,7 +32,7 @@ { "name": "ms-vscode.node-debug", "version": "1.44.11", - "repo": "https://github.com/Microsoft/vscode-node-debug", + "repo": "https://github.com/microsoft/vscode-node-debug", "metadata": { "id": "b6ded8fb-a0a0-4c1c-acbd-ab2a3bc995a6", "publisherId": { @@ -47,7 +47,7 @@ { "name": "ms-vscode.node-debug2", "version": "1.42.5", - "repo": "https://github.com/Microsoft/vscode-node-debug2", + "repo": "https://github.com/microsoft/vscode-node-debug2", "metadata": { "id": "36d19e17-7569-4841-a001-947eb18602b2", "publisherId": { @@ -62,7 +62,7 @@ { "name": "ms-vscode.references-view", "version": "0.0.63", - "repo": "https://github.com/Microsoft/vscode-reference-view", + "repo": "https://github.com/microsoft/vscode-reference-view", "metadata": { "id": "dc489f46-520d-4556-ae85-1f9eab3c412d", "publisherId": { @@ -92,7 +92,7 @@ { "name": "ms-vscode.js-debug", "version": "1.49.8", - "repo": "https://github.com/Microsoft/vscode-js-debug", + "repo": "https://github.com/microsoft/vscode-js-debug", "metadata": { "id": "25629058-ddac-4e17-abba-74678e126c5d", "publisherId": { @@ -107,7 +107,7 @@ { "name": "ms-vscode.vscode-js-profile-table", "version": "0.0.6", - "repo": "https://github.com/Microsoft/vscode-js-debug", + "repo": "https://github.com/microsoft/vscode-js-debug", "metadata": { "id": "7e52b41b-71ad-457b-ab7e-0620f1fc4feb", "publisherId": { @@ -124,7 +124,7 @@ { "name": "ms-vscode.github-browser", "version": "0.0.8", - "repo": "https://github.com/Microsoft/vscode-github-browser", + "repo": "https://github.com/microsoft/vscode-github-browser", "metadata": { "id": "c1bcff4b-4ecb-466e-b8f6-b02788b5fb5a", "publisherId": { diff --git a/resources/win32/bin/code.sh b/resources/win32/bin/code.sh index d86b6e0574a..39b904ecd3f 100644 --- a/resources/win32/bin/code.sh +++ b/resources/win32/bin/code.sh @@ -28,8 +28,8 @@ else else # If running under older WSL, don't pass cli.js to Electron as # environment vars cannot be transferred from WSL to Windows - # See: https://github.com/Microsoft/BashOnWindows/issues/1363 - # https://github.com/Microsoft/BashOnWindows/issues/1494 + # See: https://github.com/microsoft/BashOnWindows/issues/1363 + # https://github.com/microsoft/BashOnWindows/issues/1494 "$ELECTRON" "$@" exit $? fi diff --git a/scripts/generate-definitelytyped.sh b/scripts/generate-definitelytyped.sh index 82de9124a07..c3de7a8576c 100755 --- a/scripts/generate-definitelytyped.sh +++ b/scripts/generate-definitelytyped.sh @@ -8,13 +8,13 @@ fi header="// Type definitions for Visual Studio Code ${1} // Project: https://github.com/microsoft/vscode -// Definitions by: Visual Studio Code Team, Microsoft +// Definitions by: Visual Studio Code Team, Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. - * See https://github.com/Microsoft/vscode/blob/master/LICENSE.txt for license information. + * See https://github.com/microsoft/vscode/blob/master/LICENSE.txt for license information. *--------------------------------------------------------------------------------------------*/ /** @@ -28,4 +28,4 @@ if [ -f ./src/vs/vscode.d.ts ]; then echo "Generated index.d.ts for version ${1}." else echo "Can't find ./src/vs/vscode.d.ts. Run this script at vscode root." -fi \ No newline at end of file +fi diff --git a/scripts/test.bat b/scripts/test.bat index 089973f9e38..b37aa32e0ad 100644 --- a/scripts/test.bat +++ b/scripts/test.bat @@ -24,7 +24,7 @@ popd endlocal :: app.exit(0) is exiting with code 255 in Electron 1.7.4. -:: See https://github.com/Microsoft/vscode/issues/28582 +:: See https://github.com/microsoft/vscode/issues/28582 echo errorlevel: %errorlevel% if %errorlevel% == 255 set errorlevel=0 diff --git a/src/main.js b/src/main.js index 322fae7aca4..a901a747b92 100644 --- a/src/main.js +++ b/src/main.js @@ -294,7 +294,7 @@ function readArgvConfigSync() { // Fallback to default if (!argvConfig) { argvConfig = { - 'disable-color-correct-rendering': true // Force pre-Chrome-60 color profile handling (for https://github.com/Microsoft/vscode/issues/51791) + 'disable-color-correct-rendering': true // Force pre-Chrome-60 color profile handling (for https://github.com/microsoft/vscode/issues/51791) }; } @@ -328,7 +328,7 @@ function createDefaultArgvConfigSync(argvConfigPath) { ' // "disable-hardware-acceleration": true,', '', ' // Enabled by default by VS Code to resolve color issues in the renderer', - ' // See https://github.com/Microsoft/vscode/issues/51791 for details', + ' // See https://github.com/microsoft/vscode/issues/51791 for details', ' "disable-color-correct-rendering": true', '}' ]; diff --git a/src/vs/base/browser/browser.ts b/src/vs/base/browser/browser.ts index 5f811db8d6b..6b369dd3df5 100644 --- a/src/vs/base/browser/browser.ts +++ b/src/vs/base/browser/browser.ts @@ -28,7 +28,7 @@ class WindowManager { } this._zoomLevel = zoomLevel; - // See https://github.com/Microsoft/vscode/issues/26151 + // See https://github.com/microsoft/vscode/issues/26151 this._lastZoomLevelChangeTime = isTrusted ? 0 : Date.now(); this._onDidChangeZoomLevel.fire(this._zoomLevel); } diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts index 7302f71f4de..d92f9ac5f1f 100644 --- a/src/vs/base/browser/dom.ts +++ b/src/vs/base/browser/dom.ts @@ -1196,7 +1196,7 @@ export function computeScreenAwareSize(cssPx: number): number { } /** - * See https://github.com/Microsoft/monaco-editor/issues/601 + * See https://github.com/microsoft/monaco-editor/issues/601 * To protect against malicious code in the linked site, particularly phishing attempts, * the window.opener should be set to null to prevent the linked site from having access * to change the location of the current page. @@ -1205,7 +1205,7 @@ export function computeScreenAwareSize(cssPx: number): number { export function windowOpenNoOpener(url: string): void { if (platform.isNative || browser.isEdgeWebView) { // In VSCode, window.open() always returns null... - // The same is true for a WebView (see https://github.com/Microsoft/monaco-editor/issues/628) + // The same is true for a WebView (see https://github.com/microsoft/monaco-editor/issues/628) window.open(url); } else { let newTab = window.open(); diff --git a/src/vs/base/browser/ui/dropdown/dropdown.ts b/src/vs/base/browser/ui/dropdown/dropdown.ts index c90add134d6..9abc9274c1f 100644 --- a/src/vs/base/browser/ui/dropdown/dropdown.ts +++ b/src/vs/base/browser/ui/dropdown/dropdown.ts @@ -57,7 +57,7 @@ export class BaseDropdown extends ActionRunner { for (const event of [EventType.MOUSE_DOWN, GestureEventType.Tap]) { this._register(addDisposableListener(this._label, event, e => { if (e instanceof MouseEvent && e.detail > 1) { - return; // prevent multiple clicks to open multiple context menus (https://github.com/Microsoft/vscode/issues/41363) + return; // prevent multiple clicks to open multiple context menus (https://github.com/microsoft/vscode/issues/41363) } if (this.visible) { @@ -71,7 +71,7 @@ export class BaseDropdown extends ActionRunner { this._register(addDisposableListener(this._label, EventType.KEY_UP, e => { const event = new StandardKeyboardEvent(e); if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) { - EventHelper.stop(e, true); // https://github.com/Microsoft/vscode/issues/57997 + EventHelper.stop(e, true); // https://github.com/microsoft/vscode/issues/57997 if (this.visible) { this.hide(); diff --git a/src/vs/base/browser/ui/iconLabel/iconlabel.css b/src/vs/base/browser/ui/iconLabel/iconlabel.css index 3175fd34959..9341febad27 100644 --- a/src/vs/base/browser/ui/iconLabel/iconlabel.css +++ b/src/vs/base/browser/ui/iconLabel/iconlabel.css @@ -28,7 +28,7 @@ -moz-osx-font-smoothing: grayscale; vertical-align: top; - flex-shrink: 0; /* fix for https://github.com/Microsoft/vscode/issues/13787 */ + flex-shrink: 0; /* fix for https://github.com/microsoft/vscode/issues/13787 */ } .monaco-icon-label > .monaco-icon-label-container { diff --git a/src/vs/base/browser/ui/list/listView.ts b/src/vs/base/browser/ui/list/listView.ts index eaa534d886c..c527ca29fa0 100644 --- a/src/vs/base/browser/ui/list/listView.ts +++ b/src/vs/base/browser/ui/list/listView.ts @@ -340,7 +340,7 @@ export class ListView implements ISpliceable, IDisposable { domEvent(this.rowsContainer, TouchEventType.Change)(this.onTouchChange, this, this.disposables); // Prevent the monaco-scrollable-element from scrolling - // https://github.com/Microsoft/vscode/issues/44181 + // https://github.com/microsoft/vscode/issues/44181 domEvent(this.scrollableElement.getDomNode(), 'scroll') (e => (e.target as HTMLElement).scrollTop = 0, null, this.disposables); diff --git a/src/vs/base/browser/ui/menu/menu.ts b/src/vs/base/browser/ui/menu/menu.ts index 6af2914dfcd..608b6db98d7 100644 --- a/src/vs/base/browser/ui/menu/menu.ts +++ b/src/vs/base/browser/ui/menu/menu.ts @@ -201,7 +201,7 @@ export class Menu extends ActionBar { scrollElement.style.position = ''; this._register(addDisposableListener(scrollElement, EventType.MOUSE_UP, e => { - // Absorb clicks in menu dead space https://github.com/Microsoft/vscode/issues/63575 + // Absorb clicks in menu dead space https://github.com/microsoft/vscode/issues/63575 // We do this on the scroll element so the scroll bar doesn't dismiss the menu either e.preventDefault(); })); diff --git a/src/vs/base/browser/ui/sash/sash.ts b/src/vs/base/browser/ui/sash/sash.ts index da4a1a8796a..3f7801ddb6a 100644 --- a/src/vs/base/browser/ui/sash/sash.ts +++ b/src/vs/base/browser/ui/sash/sash.ts @@ -241,7 +241,7 @@ export class Sash extends Disposable { this.el.classList.add('active'); this._onDidStart.fire(startEvent); - // fix https://github.com/Microsoft/vscode/issues/21675 + // fix https://github.com/microsoft/vscode/issues/21675 const style = createStyleSheet(this.el); const updateStyle = () => { let cursor = ''; diff --git a/src/vs/base/browser/ui/splitview/paneview.ts b/src/vs/base/browser/ui/splitview/paneview.ts index 7185380bf40..673094b0c57 100644 --- a/src/vs/base/browser/ui/splitview/paneview.ts +++ b/src/vs/base/browser/ui/splitview/paneview.ts @@ -298,7 +298,7 @@ class PaneDraggable extends Disposable { private static readonly DefaultDragOverBackgroundColor = new Color(new RGBA(128, 128, 128, 0.5)); - private dragOverCounter = 0; // see https://github.com/Microsoft/vscode/issues/14470 + private dragOverCounter = 0; // see https://github.com/microsoft/vscode/issues/14470 private _onDidDrop = this._register(new Emitter<{ from: Pane, to: Pane }>()); readonly onDidDrop = this._onDidDrop.event; diff --git a/src/vs/base/common/mime.ts b/src/vs/base/common/mime.ts index 73c8e05549d..dcaca6245b6 100644 --- a/src/vs/base/common/mime.ts +++ b/src/vs/base/common/mime.ts @@ -161,7 +161,7 @@ function guessMimeTypeByPath(path: string, filename: string, associations: IText let extensionMatch: ITextMimeAssociationItem | null = null; // We want to prioritize associations based on the order they are registered so that the last registered - // association wins over all other. This is for https://github.com/Microsoft/vscode/issues/20074 + // association wins over all other. This is for https://github.com/microsoft/vscode/issues/20074 for (let i = associations.length - 1; i >= 0; i--) { const association = associations[i]; @@ -217,7 +217,7 @@ function guessMimeTypeByFirstline(firstLine: string): string | null { if (firstLine.length > 0) { // We want to prioritize associations based on the order they are registered so that the last registered - // association wins over all other. This is for https://github.com/Microsoft/vscode/issues/20074 + // association wins over all other. This is for https://github.com/microsoft/vscode/issues/20074 for (let i = registeredAssociations.length - 1; i >= 0; i--) { const association = registeredAssociations[i]; if (!association.firstline) { diff --git a/src/vs/base/common/objects.ts b/src/vs/base/common/objects.ts index 99fb573fc52..080c6faaa29 100644 --- a/src/vs/base/common/objects.ts +++ b/src/vs/base/common/objects.ts @@ -10,7 +10,7 @@ export function deepClone(obj: T): T { return obj; } if (obj instanceof RegExp) { - // See https://github.com/Microsoft/TypeScript/issues/10990 + // See https://github.com/microsoft/TypeScript/issues/10990 return obj as any; } const result: any = Array.isArray(obj) ? [] : {}; diff --git a/src/vs/base/common/worker/simpleWorker.ts b/src/vs/base/common/worker/simpleWorker.ts index 479c2ceb32c..19f154a7943 100644 --- a/src/vs/base/common/worker/simpleWorker.ts +++ b/src/vs/base/common/worker/simpleWorker.ts @@ -31,7 +31,7 @@ export function logOnceWebWorkerWarning(err: any): void { } if (!webWorkerWarningLogged) { webWorkerWarningLogged = true; - console.warn('Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/Microsoft/monaco-editor#faq'); + console.warn('Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq'); } console.warn(err.message); } diff --git a/src/vs/base/node/extpath.ts b/src/vs/base/node/extpath.ts index b3b55b7aaee..0096544ada5 100644 --- a/src/vs/base/node/extpath.ts +++ b/src/vs/base/node/extpath.ts @@ -10,7 +10,7 @@ import { readdirSync } from 'vs/base/node/pfs'; import { promisify } from 'util'; /** - * Copied from: https://github.com/Microsoft/vscode-node-debug/blob/master/src/node/pathUtilities.ts#L83 + * Copied from: https://github.com/microsoft/vscode-node-debug/blob/master/src/node/pathUtilities.ts#L83 * * Given an absolute, normalized, and existing file path 'realcase' returns the exact path that the file has on disk. * On a case insensitive file system, the returned path might differ from the original path by character casing. @@ -88,4 +88,4 @@ export function realpathSync(path: string): string { function normalizePath(path: string): string { return rtrim(normalize(path), sep); -} \ No newline at end of file +} diff --git a/src/vs/base/node/pfs.ts b/src/vs/base/node/pfs.ts index b26e67c4b76..3a17bd3fc78 100644 --- a/src/vs/base/node/pfs.ts +++ b/src/vs/base/node/pfs.ts @@ -14,7 +14,7 @@ import { isRootOrDriveLetter } from 'vs/base/common/extpath'; import { generateUuid } from 'vs/base/common/uuid'; import { normalizeNFC } from 'vs/base/common/normalization'; -// See https://github.com/Microsoft/vscode/issues/30180 +// See https://github.com/microsoft/vscode/issues/30180 const WIN32_MAX_FILE_SIZE = 300 * 1024 * 1024; // 300 MB const GENERAL_MAX_FILE_SIZE = 16 * 1024 * 1024 * 1024; // 16 GB diff --git a/src/vs/base/node/watcher.ts b/src/vs/base/node/watcher.ts index b71a84a63f1..a15daf9ce1b 100644 --- a/src/vs/base/node/watcher.ts +++ b/src/vs/base/node/watcher.ts @@ -58,7 +58,7 @@ function doWatchNonRecursive(file: { path: string, isDirectory: boolean }, onCha // Normalize file name let changedFileName: string = ''; - if (raw) { // https://github.com/Microsoft/vscode/issues/38191 + if (raw) { // https://github.com/microsoft/vscode/issues/38191 changedFileName = raw.toString(); if (isMacintosh) { // Mac: uses NFD unicode form on disk, but we want NFC diff --git a/src/vs/base/parts/contextmenu/electron-main/contextmenu.ts b/src/vs/base/parts/contextmenu/electron-main/contextmenu.ts index a7fbfc81e6b..ebd389cfa9d 100644 --- a/src/vs/base/parts/contextmenu/electron-main/contextmenu.ts +++ b/src/vs/base/parts/contextmenu/electron-main/contextmenu.ts @@ -17,7 +17,7 @@ export function registerContextMenuListener(): void { y: options ? options.y : undefined, positioningItem: options ? options.positioningItem : undefined, callback: () => { - // Workaround for https://github.com/Microsoft/vscode/issues/72447 + // Workaround for https://github.com/microsoft/vscode/issues/72447 // It turns out that the menu gets GC'ed if not referenced anymore // As such we drag it into this scope so that it is not being GC'ed if (menu) { diff --git a/src/vs/base/parts/ipc/node/ipc.cp.ts b/src/vs/base/parts/ipc/node/ipc.cp.ts index 23263105d58..6733816b83c 100644 --- a/src/vs/base/parts/ipc/node/ipc.cp.ts +++ b/src/vs/base/parts/ipc/node/ipc.cp.ts @@ -71,7 +71,7 @@ export interface IIPCOptions { debugBrk?: number; /** - * See https://github.com/Microsoft/vscode/issues/27665 + * See https://github.com/microsoft/vscode/issues/27665 * Allows to pass in fresh execArgv to the forked process such that it doesn't inherit them from `process.execArgv`. * e.g. Launching the extension host process with `--inspect-brk=xxx` and then forking a process from the extension host * results in the forked process inheriting `--inspect-brk=xxx`. diff --git a/src/vs/base/test/common/filters.test.ts b/src/vs/base/test/common/filters.test.ts index ffbe5c89c87..17a3f681c73 100644 --- a/src/vs/base/test/common/filters.test.ts +++ b/src/vs/base/test/common/filters.test.ts @@ -67,7 +67,7 @@ suite('Filters', () => { filterNotOk(matchesPrefix, 'x', 'alpha'); filterOk(matchesPrefix, 'A', 'alpha', [{ start: 0, end: 1 }]); filterOk(matchesPrefix, 'AlPh', 'alPHA', [{ start: 0, end: 4 }]); - filterNotOk(matchesPrefix, 'T', '4'); // see https://github.com/Microsoft/vscode/issues/22401 + filterNotOk(matchesPrefix, 'T', '4'); // see https://github.com/microsoft/vscode/issues/22401 }); test('CamelCaseFilter', () => { diff --git a/src/vs/base/test/common/resources.test.ts b/src/vs/base/test/common/resources.test.ts index 1e0d4496e26..3bacb9e8155 100644 --- a/src/vs/base/test/common/resources.test.ts +++ b/src/vs/base/test/common/resources.test.ts @@ -64,7 +64,7 @@ suite('Resources', () => { assert.equal(dirname(URI.parse('foo://a/')).toString(), 'foo://a/'); assert.equal(dirname(URI.parse('foo://a')).toString(), 'foo://a'); - // does not explode (https://github.com/Microsoft/vscode/issues/41987) + // does not explode (https://github.com/microsoft/vscode/issues/41987) dirname(URI.from({ scheme: 'file', authority: '/users/someone/portal.h' })); assert.equal(dirname(URI.parse('foo://a/b/c?q')).toString(), 'foo://a/b?q'); diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts index d4f5eb1459b..baa23c73304 100644 --- a/src/vs/code/browser/workbench/workbench.ts +++ b/src/vs/code/browser/workbench/workbench.ts @@ -467,7 +467,7 @@ class WindowIndicator implements IWindowIndicator { // Home Indicator const homeIndicator: IHomeIndicator = { - href: 'https://github.com/Microsoft/vscode', + href: 'https://github.com/microsoft/vscode', icon: 'code', title: localize('home', "Home") }; diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index 1389595e48b..991a62169a7 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -340,7 +340,7 @@ export class CodeApplication extends Disposable { // "com.microsoft.", which breaks native tabs for VS Code when using this // identifier (from the official build). // Explicitly opt out of the patch here before creating any windows. - // See: https://github.com/Microsoft/vscode/issues/35361#issuecomment-399794085 + // See: https://github.com/microsoft/vscode/issues/35361#issuecomment-399794085 try { if (isMacintosh && this.configurationService.getValue('window.nativeTabs') === true && !systemPreferences.getUserDefault('NSUseImprovedLayoutPass', 'boolean')) { systemPreferences.setUserDefault('NSUseImprovedLayoutPass', 'boolean', true as any); diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index a34a585ddcd..51350c14d7a 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -102,7 +102,7 @@ class CodeMain { // We need to buffer the spdlog logs until we are sure // we are the only instance running, otherwise we'll have concurrent - // log file access on Windows (https://github.com/Microsoft/vscode/issues/41218) + // log file access on Windows (https://github.com/microsoft/vscode/issues/41218) const bufferLogService = new BufferLogService(); const [instantiationService, instanceEnvironment, environmentService] = this.createServices(args, bufferLogService); @@ -474,7 +474,7 @@ class CodeMain { // Trim trailing quotes if (isWindows) { - path = rtrim(path, '"'); // https://github.com/Microsoft/vscode/issues/1498 + path = rtrim(path, '"'); // https://github.com/microsoft/vscode/issues/1498 } // Trim whitespaces diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index 030f476fece..ebdfca8fe69 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -572,7 +572,7 @@ export class CodeWindow extends Disposable implements ICodeWindow { // Unresponsive if (error === WindowError.UNRESPONSIVE) { if (this.isExtensionDevelopmentHost || this.isExtensionTestHost || (this._win && this._win.webContents && this._win.webContents.isDevToolsOpened())) { - // TODO@Ben Workaround for https://github.com/Microsoft/vscode/issues/56994 + // TODO@Ben Workaround for https://github.com/microsoft/vscode/issues/56994 // In certain cases the window can report unresponsiveness because a breakpoint was hit // and the process is stopped executing. The most typical cases are: // - devtools are opened and debugging happens @@ -867,7 +867,7 @@ export class CodeWindow extends Disposable implements ICodeWindow { // Still carry over window dimensions from previous sessions // if we can compute it in fullscreen state. // does not seem possible in all cases on Linux for example - // (https://github.com/Microsoft/vscode/issues/58218) so we + // (https://github.com/microsoft/vscode/issues/58218) so we // fallback to the defaults in that case. width: this.windowState.width || defaultState.width, height: this.windowState.height || defaultState.height, @@ -1053,7 +1053,7 @@ export class CodeWindow extends Disposable implements ICodeWindow { private getWorkingArea(display: Display): Rectangle | undefined { // Prefer the working area of the display to account for taskbars on the - // desktop being positioned somewhere (https://github.com/Microsoft/vscode/issues/50830). + // desktop being positioned somewhere (https://github.com/microsoft/vscode/issues/50830). // // Linux X11 sessions sometimes report wrong display bounds, so we validate // the reported sizes are positive. @@ -1155,7 +1155,7 @@ export class CodeWindow extends Disposable implements ICodeWindow { if (visibility === 'hidden') { // for some weird reason that I have no explanation for, the menu bar is not hiding when calling - // this without timeout (see https://github.com/Microsoft/vscode/issues/19777). there seems to be + // this without timeout (see https://github.com/microsoft/vscode/issues/19777). there seems to be // a timing issue with us opening the first window and the menu bar getting created. somehow the // fact that we want to hide the menu without being able to bring it back via Alt key makes Electron // still show the menu. Unable to reproduce from a simple Hello World application though... diff --git a/src/vs/code/node/cli.ts b/src/vs/code/node/cli.ts index 1cdfe65520f..80aba3e754c 100644 --- a/src/vs/code/node/cli.ts +++ b/src/vs/code/node/cli.ts @@ -95,9 +95,9 @@ export async function main(argv: string[]): Promise { // On Windows we use a different strategy of saving the file // by first truncating the file and then writing with r+ mode. // This helps to save hidden files on Windows - // (see https://github.com/Microsoft/vscode/issues/931) and + // (see https://github.com/microsoft/vscode/issues/931) and // prevent removing alternate data streams - // (see https://github.com/Microsoft/vscode/issues/6363) + // (see https://github.com/microsoft/vscode/issues/6363) fs.truncateSync(target, 0); writeFileSync(target, data, { flag: 'r+' }); } else { @@ -154,7 +154,7 @@ export async function main(argv: string[]): Promise { // Read from stdin: we require a single "-" argument to be passed in order to start reading from // stdin. We do this because there is no reliable way to find out if data is piped to stdin. Just - // checking for stdin being connected to a TTY is not enough (https://github.com/Microsoft/vscode/issues/40351) + // checking for stdin being connected to a TTY is not enough (https://github.com/microsoft/vscode/issues/40351) if (args._.length === 0) { if (hasReadStdinArg) { diff --git a/src/vs/code/node/shellEnv.ts b/src/vs/code/node/shellEnv.ts index a089ffe4f84..619886d0fd3 100644 --- a/src/vs/code/node/shellEnv.ts +++ b/src/vs/code/node/shellEnv.ts @@ -66,7 +66,7 @@ function getUnixShellEnvironment(logService: ILogService): Promise lineWidth) { if (browser.isEdge && pos.column === 1) { - // See https://github.com/Microsoft/vscode/issues/10875 + // See https://github.com/microsoft/vscode/issues/10875 const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth); return request.fulfill(MouseTargetType.CONTENT_EMPTY, new Position(lineNumber, ctx.model.getLineMaxColumn(lineNumber)), undefined, detail); } diff --git a/src/vs/editor/browser/controller/textAreaInput.ts b/src/vs/editor/browser/controller/textAreaInput.ts index 7b2868aa701..9b7800918dd 100644 --- a/src/vs/editor/browser/controller/textAreaInput.ts +++ b/src/vs/editor/browser/controller/textAreaInput.ts @@ -252,7 +252,7 @@ export class TextAreaInput extends Disposable { }; const compositionDataInValid = (locale: string): boolean => { - // https://github.com/Microsoft/monaco-editor/issues/339 + // https://github.com/microsoft/monaco-editor/issues/339 // Multi-part Japanese compositions reset cursor in Edge/IE, Chinese and Korean IME don't have this issue. // The reason that we can't use this path for all CJK IME is IE and Edge behave differently when handling Korean IME, // which breaks this path of code. @@ -285,7 +285,7 @@ export class TextAreaInput extends Disposable { return; } if (compositionDataInValid(e.locale)) { - // https://github.com/Microsoft/monaco-editor/issues/339 + // https://github.com/microsoft/monaco-editor/issues/339 const [newState, typeInput] = deduceInputFromTextAreaValue(/*couldBeEmojiInput*/false); this._textAreaState = newState; this._onType.fire(typeInput); @@ -380,7 +380,7 @@ export class TextAreaInput extends Disposable { } private _installSelectionChangeListener(): IDisposable { - // See https://github.com/Microsoft/vscode/issues/27216 and https://github.com/microsoft/vscode/issues/98256 + // See https://github.com/microsoft/vscode/issues/27216 and https://github.com/microsoft/vscode/issues/98256 // When using a Braille display, it is possible for users to reposition the // system caret. This is reflected in Chrome as a `selectionchange` event. // @@ -708,7 +708,7 @@ class TextAreaWrapper extends Disposable implements ITextAreaWrapper { if (currentIsFocused && currentSelectionStart === selectionStart && currentSelectionEnd === selectionEnd) { // No change - // Firefox iframe bug https://github.com/Microsoft/monaco-editor/issues/643#issuecomment-367871377 + // Firefox iframe bug https://github.com/microsoft/monaco-editor/issues/643#issuecomment-367871377 if (browser.isFirefox && window.parent !== window) { textArea.focus(); } diff --git a/src/vs/editor/browser/services/openerService.ts b/src/vs/editor/browser/services/openerService.ts index 207e7a3bfa7..d898abd3006 100644 --- a/src/vs/editor/browser/services/openerService.ts +++ b/src/vs/editor/browser/services/openerService.ts @@ -70,7 +70,7 @@ class EditorOpener implements IOpener { } if (target.scheme === Schemas.file) { - target = normalizePath(target); // workaround for non-normalized paths (https://github.com/Microsoft/vscode/issues/12954) + target = normalizePath(target); // workaround for non-normalized paths (https://github.com/microsoft/vscode/issues/12954) } await this._editorService.openCodeEditor( diff --git a/src/vs/editor/browser/viewParts/lines/viewLine.ts b/src/vs/editor/browser/viewParts/lines/viewLine.ts index d75928f24ae..d80556fb9ee 100644 --- a/src/vs/editor/browser/viewParts/lines/viewLine.ts +++ b/src/vs/editor/browser/viewParts/lines/viewLine.ts @@ -259,7 +259,7 @@ export class ViewLine implements IVisibleLine { // rounding errors add up to an observable large number... // --- // Also see another example of rounding errors on Windows in - // https://github.com/Microsoft/vscode/issues/33178 + // https://github.com/microsoft/vscode/issues/33178 renderedViewLine = new FastRenderedViewLine( this._renderedViewLine ? this._renderedViewLine.domNode : null, renderLineInput, diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 61e1bdd8dd4..19f6b1a3281 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -2190,7 +2190,7 @@ export class EditorLayoutInfoComputer extends ComputedEditorOption ignore composition commands[i] = null; diff --git a/src/vs/editor/common/viewLayout/viewLineRenderer.ts b/src/vs/editor/common/viewLayout/viewLineRenderer.ts index 23640e0af3b..a531c10118c 100644 --- a/src/vs/editor/common/viewLayout/viewLineRenderer.ts +++ b/src/vs/editor/common/viewLayout/viewLineRenderer.ts @@ -521,7 +521,7 @@ const enum Constants { } /** - * See https://github.com/Microsoft/vscode/issues/6885. + * See https://github.com/microsoft/vscode/issues/6885. * It appears that having very large spans causes very slow reading of character positions. * So here we try to avoid that. */ diff --git a/src/vs/editor/contrib/gotoSymbol/link/clickLinkGesture.ts b/src/vs/editor/contrib/gotoSymbol/link/clickLinkGesture.ts index 19f2de625f8..986023ffac2 100644 --- a/src/vs/editor/contrib/gotoSymbol/link/clickLinkGesture.ts +++ b/src/vs/editor/contrib/gotoSymbol/link/clickLinkGesture.ts @@ -154,7 +154,7 @@ export class ClickLinkGesture extends Disposable { private _onDidChangeCursorSelection(e: ICursorSelectionChangedEvent): void { if (e.selection && e.selection.startColumn !== e.selection.endColumn) { - this._resetHandler(); // immediately stop this feature if the user starts to select (https://github.com/Microsoft/vscode/issues/7827) + this._resetHandler(); // immediately stop this feature if the user starts to select (https://github.com/microsoft/vscode/issues/7827) } } diff --git a/src/vs/editor/contrib/linesOperations/test/moveLinesCommand.test.ts b/src/vs/editor/contrib/linesOperations/test/moveLinesCommand.test.ts index b803557c63e..dd0a86ac066 100644 --- a/src/vs/editor/contrib/linesOperations/test/moveLinesCommand.test.ts +++ b/src/vs/editor/contrib/linesOperations/test/moveLinesCommand.test.ts @@ -277,7 +277,7 @@ suite('Editor contrib - Move Lines Command honors Indentation Rules', () => { unIndentedLinePattern: /^(?!.*([;{}]|\S:)\s*(\/\/.*|\/[*].*[*]\/\s*)?$)(?!.*(\{[^}"']*|\([^)"']*|\[[^\]"']*|^\s*(\{\}|\(\)|\[\]|(case\b.*|default):))\s*(\/\/.*|\/[*].*[*]\/\s*)?$)(?!^\s*((?!\S.*\/[*]).*[*]\/\s*)?[})\]]|^\s*(case\b.*|default):\s*(\/\/.*|\/[*].*[*]\/\s*)?$)(?!^\s*(for|while|if|else)\b(?!.*[;{}]\s*(\/\/.*|\/[*].*[*]\/\s*)?$))/ }; - // https://github.com/Microsoft/vscode/issues/28552#issuecomment-307862797 + // https://github.com/microsoft/vscode/issues/28552#issuecomment-307862797 test('first line indentation adjust to 0', () => { let mode = new IndentRulesMode(indentRules); @@ -300,7 +300,7 @@ suite('Editor contrib - Move Lines Command honors Indentation Rules', () => { mode.dispose(); }); - // https://github.com/Microsoft/vscode/issues/28552#issuecomment-307867717 + // https://github.com/microsoft/vscode/issues/28552#issuecomment-307867717 test('move lines across block', () => { let mode = new IndentRulesMode(indentRules); diff --git a/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts b/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts index 658039f8065..0bb4cfe347a 100644 --- a/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts +++ b/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts @@ -181,7 +181,7 @@ suite('Snippet Variables Resolver', function () { assertVariableResolve2('${ThisIsAVar/([A-Z]).*(Var)/$2-${1:/downcase}/}', 'Var-t'); assertVariableResolve2('${Foo/(.*)/${1:+Bar}/img}', 'Bar'); - //https://github.com/Microsoft/vscode/issues/33162 + //https://github.com/microsoft/vscode/issues/33162 assertVariableResolve2('export default class ${TM_FILENAME/(\\w+)\\.js/$1/g}', 'export default class FooFile', 'FooFile.js'); assertVariableResolve2('${foobarfoobar/(foo)/${1:+FAR}/g}', 'FARbarFARbar'); // global diff --git a/src/vs/editor/standalone/common/monarch/monarchLexer.ts b/src/vs/editor/standalone/common/monarch/monarchLexer.ts index f120b5383d7..e566f7589b0 100644 --- a/src/vs/editor/standalone/common/monarch/monarchLexer.ts +++ b/src/vs/editor/standalone/common/monarch/monarchLexer.ts @@ -563,7 +563,7 @@ export class MonarchTokenizer implements modes.ITokenizationSupport { } let groupMatching: GroupMatching | null = null; - // See https://github.com/Microsoft/monaco-editor/issues/1235: + // See https://github.com/microsoft/monaco-editor/issues/1235: // Evaluate rules at least once for an empty line let forceEvaluation = true; diff --git a/src/vs/editor/standalone/test/browser/simpleServices.test.ts b/src/vs/editor/standalone/test/browser/simpleServices.test.ts index 85e692e04e3..69fb7d8c709 100644 --- a/src/vs/editor/standalone/test/browser/simpleServices.test.ts +++ b/src/vs/editor/standalone/test/browser/simpleServices.test.ts @@ -19,7 +19,7 @@ suite('StandaloneKeybindingService', () => { } } - test('issue Microsoft/monaco-editor#167', () => { + test('issue microsoft/monaco-editor#167', () => { let serviceCollection = new ServiceCollection(); const instantiationService = new InstantiationService(serviceCollection, true); diff --git a/src/vs/editor/test/browser/commands/shiftCommand.test.ts b/src/vs/editor/test/browser/commands/shiftCommand.test.ts index 0a6ada7efbf..755aac5bc2d 100644 --- a/src/vs/editor/test/browser/commands/shiftCommand.test.ts +++ b/src/vs/editor/test/browser/commands/shiftCommand.test.ts @@ -836,7 +836,7 @@ suite('Editor Commands - ShiftCommand', () => { ); }); - test('issue Microsoft/monaco-editor#443: Indentation of a single row deletes selected text in some cases', () => { + test('issue microsoft/monaco-editor#443: Indentation of a single row deletes selected text in some cases', () => { testCommand( [ 'Hello world!', diff --git a/src/vs/editor/test/browser/controller/cursor.test.ts b/src/vs/editor/test/browser/controller/cursor.test.ts index 7f757690c16..a90e11dfdcf 100644 --- a/src/vs/editor/test/browser/controller/cursor.test.ts +++ b/src/vs/editor/test/browser/controller/cursor.test.ts @@ -1295,7 +1295,7 @@ class IndentRulesMode extends MockMode { suite('Editor Controller - Regression tests', () => { - test('issue Microsoft/monaco-editor#443: Indentation of a single row deletes selected text in some cases', () => { + test('issue microsoft/monaco-editor#443: Indentation of a single row deletes selected text in some cases', () => { let model = createTextModel( [ 'Hello world!', @@ -3572,7 +3572,7 @@ suite('Editor Controller - Indentation Rules', () => { }); }); - test('issue Microsoft/monaco-editor#108 part 1/2: Auto indentation on Enter with selection is half broken', () => { + test('issue microsoft/monaco-editor#108 part 1/2: Auto indentation on Enter with selection is half broken', () => { usingCursor({ text: [ 'function baz() {', @@ -3595,7 +3595,7 @@ suite('Editor Controller - Indentation Rules', () => { }); }); - test('issue Microsoft/monaco-editor#108 part 2/2: Auto indentation on Enter with selection is half broken', () => { + test('issue microsoft/monaco-editor#108 part 2/2: Auto indentation on Enter with selection is half broken', () => { usingCursor({ text: [ 'function baz() {', diff --git a/src/vs/editor/test/browser/controller/imeTester.html b/src/vs/editor/test/browser/controller/imeTester.html index efdf094d88b..eff232fac47 100644 --- a/src/vs/editor/test/browser/controller/imeTester.html +++ b/src/vs/editor/test/browser/controller/imeTester.html @@ -41,7 +41,7 @@ -

Detailed setup steps at https://github.com/Microsoft/vscode/wiki/IME-Test

+

Detailed setup steps at https://github.com/microsoft/vscode/wiki/IME-Test

- \ No newline at end of file + diff --git a/src/vs/editor/test/browser/services/decorationRenderOptions.test.ts b/src/vs/editor/test/browser/services/decorationRenderOptions.test.ts index faa5c581cc6..bc522416976 100644 --- a/src/vs/editor/test/browser/services/decorationRenderOptions.test.ts +++ b/src/vs/editor/test/browser/services/decorationRenderOptions.test.ts @@ -52,7 +52,7 @@ class TestGlobalStyleSheet extends GlobalStyleSheet { suite('Decoration Render Options', () => { let options: IDecorationRenderOptions = { - gutterIconPath: URI.parse('https://github.com/Microsoft/vscode/blob/master/resources/linux/code.png'), + gutterIconPath: URI.parse('https://github.com/microsoft/vscode/blob/master/resources/linux/code.png'), gutterIconSize: 'contain', backgroundColor: 'red', borderColor: 'yellow' @@ -79,7 +79,7 @@ suite('Decoration Render Options', () => { const s = new TestCodeEditorServiceImpl(themeServiceMock, styleSheet); s.registerDecorationType('example', options); const sheet = readStyleSheet(styleSheet); - assert(sheet.indexOf(`{background:url('https://github.com/Microsoft/vscode/blob/master/resources/linux/code.png') center center no-repeat;background-size:contain;}`) >= 0); + assert(sheet.indexOf(`{background:url('https://github.com/microsoft/vscode/blob/master/resources/linux/code.png') center center no-repeat;background-size:contain;}`) >= 0); assert(sheet.indexOf(`{background-color:red;border-color:yellow;box-sizing: border-box;}`) >= 0); }); diff --git a/src/vs/editor/test/common/model/textModelWithTokens.test.ts b/src/vs/editor/test/common/model/textModelWithTokens.test.ts index 815c8a073e4..efb1cf1de82 100644 --- a/src/vs/editor/test/common/model/textModelWithTokens.test.ts +++ b/src/vs/editor/test/common/model/textModelWithTokens.test.ts @@ -411,7 +411,7 @@ suite('TextModelWithTokens', () => { suite('TextModelWithTokens regression tests', () => { - test('Microsoft/monaco-editor#122: Unhandled Exception: TypeError: Unable to get property \'replace\' of undefined or null reference', () => { + test('microsoft/monaco-editor#122: Unhandled Exception: TypeError: Unable to get property \'replace\' of undefined or null reference', () => { function assertViewLineTokens(model: TextModel, lineNumber: number, forceTokenization: boolean, expected: ViewLineToken[]): void { if (forceTokenization) { model.forceTokenization(lineNumber); @@ -488,7 +488,7 @@ suite('TextModelWithTokens regression tests', () => { }); - test('Microsoft/monaco-editor#133: Error: Cannot read property \'modeId\' of undefined', () => { + test('microsoft/monaco-editor#133: Error: Cannot read property \'modeId\' of undefined', () => { const languageIdentifier = new LanguageIdentifier('testMode', LanguageId.PlainText); diff --git a/src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts b/src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts index 0e0dc7d3d63..e09b3d2f6f2 100644 --- a/src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts +++ b/src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts @@ -448,7 +448,7 @@ suite('viewLineRenderer.renderLine', () => { assertCharacterMapping2(actual.characterMapping, expectedCharacterMapping); }); - test('issue Microsoft/monaco-editor#280: Improved source code rendering for RTL languages', () => { + test('issue microsoft/monaco-editor#280: Improved source code rendering for RTL languages', () => { let lineText = 'var קודמות = \"מיותר קודמות צ\'ט של, אם לשון העברית שינויים ויש, אם\";'; let lineParts = createViewLineTokens([ diff --git a/src/vs/loader.js b/src/vs/loader.js index 3b71c723592..5a97ccfcc9a 100644 --- a/src/vs/loader.js +++ b/src/vs/loader.js @@ -12,7 +12,7 @@ *--------------------------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------- - * Please make sure to make edits in the .ts file at https://github.com/Microsoft/vscode-loader/ + * Please make sure to make edits in the .ts file at https://github.com/microsoft/vscode-loader/ *--------------------------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------- diff --git a/src/vs/nls.build.js b/src/vs/nls.build.js index d67cbad9479..768ebbd722d 100644 --- a/src/vs/nls.build.js +++ b/src/vs/nls.build.js @@ -7,7 +7,7 @@ *--------------------------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------- - * Please make sure to make edits in the .ts file at https://github.com/Microsoft/vscode-loader/ + * Please make sure to make edits in the .ts file at https://github.com/microsoft/vscode-loader/ *--------------------------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------- diff --git a/src/vs/nls.js b/src/vs/nls.js index 54b63cfb921..03f781a17a9 100644 --- a/src/vs/nls.js +++ b/src/vs/nls.js @@ -7,7 +7,7 @@ *--------------------------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------- - * Please make sure to make edits in the .ts file at https://github.com/Microsoft/vscode-loader/ + * Please make sure to make edits in the .ts file at https://github.com/microsoft/vscode-loader/ *--------------------------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------- diff --git a/src/vs/platform/configuration/common/configuration.ts b/src/vs/platform/configuration/common/configuration.ts index e09910f5458..7f14056f1d9 100644 --- a/src/vs/platform/configuration/common/configuration.ts +++ b/src/vs/platform/configuration/common/configuration.ts @@ -267,7 +267,7 @@ export function addToValueTree(settingsTreeRoot: any, key: string, value: any, c if (typeof curr === 'object' && curr !== null) { try { - curr[last] = value; // workaround https://github.com/Microsoft/vscode/issues/13606 + curr[last] = value; // workaround https://github.com/microsoft/vscode/issues/13606 } catch (e) { conflictReporter(`Ignoring ${key} as ${segments.join('.')} is ${JSON.stringify(curr)}`); } diff --git a/src/vs/platform/environment/node/environmentService.ts b/src/vs/platform/environment/node/environmentService.ts index 99b624aa04b..6357bb6e89d 100644 --- a/src/vs/platform/environment/node/environmentService.ts +++ b/src/vs/platform/environment/node/environmentService.ts @@ -231,7 +231,7 @@ export class EnvironmentService implements INativeEnvironmentService { } // Read this before there's any chance it is overwritten -// Related to https://github.com/Microsoft/vscode/issues/30624 +// Related to https://github.com/microsoft/vscode/issues/30624 export const xdgRuntimeDir = process.env['XDG_RUNTIME_DIR']; const safeIpcPathLengths: { [platform: number]: number } = { diff --git a/src/vs/platform/extensionManagement/test/common/configRemotes.test.ts b/src/vs/platform/extensionManagement/test/common/configRemotes.test.ts index 67b5beae330..cde1c634ac1 100644 --- a/src/vs/platform/extensionManagement/test/common/configRemotes.test.ts +++ b/src/vs/platform/extensionManagement/test/common/configRemotes.test.ts @@ -20,7 +20,7 @@ suite('Config Remotes', () => { ]; test('HTTPS remotes', function () { - assert.deepStrictEqual(getDomainsOfRemotes(remote('https://github.com/Microsoft/vscode.git'), allowedDomains), ['github.com']); + assert.deepStrictEqual(getDomainsOfRemotes(remote('https://github.com/microsoft/vscode.git'), allowedDomains), ['github.com']); assert.deepStrictEqual(getDomainsOfRemotes(remote('https://git.example.com/gitproject.git'), allowedDomains), ['example.com']); assert.deepStrictEqual(getDomainsOfRemotes(remote('https://username@github2.com/username/repository.git'), allowedDomains), ['github2.com']); assert.deepStrictEqual(getDomainsOfRemotes(remote('https://username:password@github3.com/username/repository.git'), allowedDomains), ['github3.com']); @@ -33,7 +33,7 @@ suite('Config Remotes', () => { }); test('SCP-like remotes', function () { - assert.deepStrictEqual(getDomainsOfRemotes(remote('git@github.com:Microsoft/vscode.git'), allowedDomains), ['github.com']); + assert.deepStrictEqual(getDomainsOfRemotes(remote('git@github.com:microsoft/vscode.git'), allowedDomains), ['github.com']); assert.deepStrictEqual(getDomainsOfRemotes(remote('user@git.server.org:project.git'), allowedDomains), ['server.org']); assert.deepStrictEqual(getDomainsOfRemotes(remote('git.server2.org:project.git'), allowedDomains), ['server2.org']); }); @@ -44,17 +44,17 @@ suite('Config Remotes', () => { }); test('Multiple remotes', function () { - const config = ['https://github.com/Microsoft/vscode.git', 'https://git.example.com/gitproject.git'].map(remote).join(''); + const config = ['https://github.com/microsoft/vscode.git', 'https://git.example.com/gitproject.git'].map(remote).join(''); assert.deepStrictEqual(getDomainsOfRemotes(config, allowedDomains).sort(), ['example.com', 'github.com']); }); test('Non allowed domains are anonymized', () => { - const config = ['https://github.com/Microsoft/vscode.git', 'https://git.foobar.com/gitproject.git'].map(remote).join(''); + const config = ['https://github.com/microsoft/vscode.git', 'https://git.foobar.com/gitproject.git'].map(remote).join(''); assert.deepStrictEqual(getDomainsOfRemotes(config, allowedDomains).sort(), ['aaaaaa.aaa', 'github.com']); }); test('HTTPS remotes to be hashed', function () { - assert.deepStrictEqual(getRemotes(remote('https://github.com/Microsoft/vscode.git')), ['github.com/Microsoft/vscode.git']); + assert.deepStrictEqual(getRemotes(remote('https://github.com/microsoft/vscode.git')), ['github.com/microsoft/vscode.git']); assert.deepStrictEqual(getRemotes(remote('https://git.example.com/gitproject.git')), ['git.example.com/gitproject.git']); assert.deepStrictEqual(getRemotes(remote('https://username@github2.com/username/repository.git')), ['github2.com/username/repository.git']); assert.deepStrictEqual(getRemotes(remote('https://username:password@github3.com/username/repository.git')), ['github3.com/username/repository.git']); @@ -62,7 +62,7 @@ suite('Config Remotes', () => { assert.deepStrictEqual(getRemotes(remote('https://example3.com:1234/username/repository.git')), ['example3.com/username/repository.git']); // Strip .git - assert.deepStrictEqual(getRemotes(remote('https://github.com/Microsoft/vscode.git'), true), ['github.com/Microsoft/vscode']); + assert.deepStrictEqual(getRemotes(remote('https://github.com/microsoft/vscode.git'), true), ['github.com/icrosoft/vscode']); assert.deepStrictEqual(getRemotes(remote('https://git.example.com/gitproject.git'), true), ['git.example.com/gitproject']); assert.deepStrictEqual(getRemotes(remote('https://username@github2.com/username/repository.git'), true), ['github2.com/username/repository']); assert.deepStrictEqual(getRemotes(remote('https://username:password@github3.com/username/repository.git'), true), ['github3.com/username/repository']); @@ -70,7 +70,7 @@ suite('Config Remotes', () => { assert.deepStrictEqual(getRemotes(remote('https://example3.com:1234/username/repository.git'), true), ['example3.com/username/repository']); // Compare Striped .git with no .git - assert.deepStrictEqual(getRemotes(remote('https://github.com/Microsoft/vscode.git'), true), getRemotes(remote('https://github.com/Microsoft/vscode'))); + assert.deepStrictEqual(getRemotes(remote('https://github.com/microsoft/vscode.git'), true), getRemotes(remote('https://github.com/microsoft/vscode'))); assert.deepStrictEqual(getRemotes(remote('https://git.example.com/gitproject.git'), true), getRemotes(remote('https://git.example.com/gitproject'))); assert.deepStrictEqual(getRemotes(remote('https://username@github2.com/username/repository.git'), true), getRemotes(remote('https://username@github2.com/username/repository'))); assert.deepStrictEqual(getRemotes(remote('https://username:password@github3.com/username/repository.git'), true), getRemotes(remote('https://username:password@github3.com/username/repository'))); @@ -89,17 +89,17 @@ suite('Config Remotes', () => { }); test('SCP-like remotes to be hashed', function () { - assert.deepStrictEqual(getRemotes(remote('git@github.com:Microsoft/vscode.git')), ['github.com/Microsoft/vscode.git']); + assert.deepStrictEqual(getRemotes(remote('git@github.com:microsoft/vscode.git')), ['github.com/microsoft/vscode.git']); assert.deepStrictEqual(getRemotes(remote('user@git.server.org:project.git')), ['git.server.org/project.git']); assert.deepStrictEqual(getRemotes(remote('git.server2.org:project.git')), ['git.server2.org/project.git']); // Strip .git - assert.deepStrictEqual(getRemotes(remote('git@github.com:Microsoft/vscode.git'), true), ['github.com/Microsoft/vscode']); + assert.deepStrictEqual(getRemotes(remote('git@github.com:microsoft/vscode.git'), true), ['github.com/microsoft/vscode']); assert.deepStrictEqual(getRemotes(remote('user@git.server.org:project.git'), true), ['git.server.org/project']); assert.deepStrictEqual(getRemotes(remote('git.server2.org:project.git'), true), ['git.server2.org/project']); // Compare Striped .git with no .git - assert.deepStrictEqual(getRemotes(remote('git@github.com:Microsoft/vscode.git'), true), getRemotes(remote('git@github.com:Microsoft/vscode'))); + assert.deepStrictEqual(getRemotes(remote('git@github.com:microsoft/vscode.git'), true), getRemotes(remote('git@github.com:microsoft/vscode'))); assert.deepStrictEqual(getRemotes(remote('user@git.server.org:project.git'), true), getRemotes(remote('user@git.server.org:project'))); assert.deepStrictEqual(getRemotes(remote('git.server2.org:project.git'), true), getRemotes(remote('git.server2.org:project'))); }); @@ -110,14 +110,14 @@ suite('Config Remotes', () => { }); test('Multiple remotes to be hashed', function () { - const config = ['https://github.com/Microsoft/vscode.git', 'https://git.example.com/gitproject.git'].map(remote).join(' '); - assert.deepStrictEqual(getRemotes(config), ['github.com/Microsoft/vscode.git', 'git.example.com/gitproject.git']); + const config = ['https://github.com/microsoft/vscode.git', 'https://git.example.com/gitproject.git'].map(remote).join(' '); + assert.deepStrictEqual(getRemotes(config), ['github.com/microsoft/vscode.git', 'git.example.com/gitproject.git']); // Strip .git - assert.deepStrictEqual(getRemotes(config, true), ['github.com/Microsoft/vscode', 'git.example.com/gitproject']); + assert.deepStrictEqual(getRemotes(config, true), ['github.com/microsoft/vscode', 'git.example.com/gitproject']); // Compare Striped .git with no .git - const noDotGitConfig = ['https://github.com/Microsoft/vscode', 'https://git.example.com/gitproject'].map(remote).join(' '); + const noDotGitConfig = ['https://github.com/microsoft/vscode', 'https://git.example.com/gitproject'].map(remote).join(' '); assert.deepStrictEqual(getRemotes(config, true), getRemotes(noDotGitConfig)); }); diff --git a/src/vs/platform/files/common/files.ts b/src/vs/platform/files/common/files.ts index bfbf6074d35..0926bff72bb 100644 --- a/src/vs/platform/files/common/files.ts +++ b/src/vs/platform/files/common/files.ts @@ -361,7 +361,7 @@ export function createFileSystemProviderError(error: Error | string, code: FileS export function ensureFileSystemProviderError(error?: Error): Error { if (!error) { - return createFileSystemProviderError(localize('unknownError', "Unknown Error"), FileSystemProviderErrorCode.Unknown); // https://github.com/Microsoft/vscode/issues/72798 + return createFileSystemProviderError(localize('unknownError', "Unknown Error"), FileSystemProviderErrorCode.Unknown); // https://github.com/microsoft/vscode/issues/72798 } return error; diff --git a/src/vs/platform/files/node/diskFileSystemProvider.ts b/src/vs/platform/files/node/diskFileSystemProvider.ts index c551bcac9c2..89408a3f93a 100644 --- a/src/vs/platform/files/node/diskFileSystemProvider.ts +++ b/src/vs/platform/files/node/diskFileSystemProvider.ts @@ -216,8 +216,8 @@ export class DiskFileSystemProvider extends Disposable implements try { // On Windows and if the file exists, we use a different strategy of saving the file // by first truncating the file and then writing with r+ flag. This helps to save hidden files on Windows - // (see https://github.com/Microsoft/vscode/issues/931) and prevent removing alternate data streams - // (see https://github.com/Microsoft/vscode/issues/6363) + // (see https://github.com/microsoft/vscode/issues/931) and prevent removing alternate data streams + // (see https://github.com/microsoft/vscode/issues/6363) await truncate(filePath, 0); // After a successful truncate() the flag can be set to 'r+' which will not truncate. diff --git a/src/vs/platform/files/node/watcher/nsfw/nsfwWatcherService.ts b/src/vs/platform/files/node/watcher/nsfw/nsfwWatcherService.ts index 2d5efc37bb3..51a4b1a6510 100644 --- a/src/vs/platform/files/node/watcher/nsfw/nsfwWatcherService.ts +++ b/src/vs/platform/files/node/watcher/nsfw/nsfwWatcherService.ts @@ -98,7 +98,7 @@ export class NsfwWatcherService extends Disposable implements IWatcherService { // the watcher consumes so many file descriptors that // we are running into a limit. We only want to warn // once in this case to avoid log spam. - // See https://github.com/Microsoft/vscode/issues/7950 + // See https://github.com/microsoft/vscode/issues/7950 if (e === 'Inotify limit reached' && !this.enospcErrorLogged) { this.enospcErrorLogged = true; this.error('Inotify limit reached (ENOSPC)'); diff --git a/src/vs/platform/files/node/watcher/unix/chokidarWatcherService.ts b/src/vs/platform/files/node/watcher/unix/chokidarWatcherService.ts index 8944c8423c8..1f88cadc07e 100644 --- a/src/vs/platform/files/node/watcher/unix/chokidarWatcherService.ts +++ b/src/vs/platform/files/node/watcher/unix/chokidarWatcherService.ts @@ -109,7 +109,7 @@ export class ChokidarWatcherService extends Disposable implements IWatcherServic interval: pollingInterval, // while not used in normal cases, if any error causes chokidar to fallback to polling, increase its intervals binaryInterval: pollingInterval, usePolling: usePolling, - disableGlobbing: true // fix https://github.com/Microsoft/vscode/issues/4586 + disableGlobbing: true // fix https://github.com/microsoft/vscode/issues/4586 }; const excludes: string[] = []; @@ -269,7 +269,7 @@ export class ChokidarWatcherService extends Disposable implements IWatcherServic // the watcher consumes so many file descriptors that // we are running into a limit. We only want to warn // once in this case to avoid log spam. - // See https://github.com/Microsoft/vscode/issues/7950 + // See https://github.com/microsoft/vscode/issues/7950 if (error.code === 'ENOSPC') { if (!this.enospcErrorLogged) { this.enospcErrorLogged = true; diff --git a/src/vs/platform/files/node/watcher/win32/CodeHelper.md b/src/vs/platform/files/node/watcher/win32/CodeHelper.md index 81e43c0951d..e63983bbc48 100644 --- a/src/vs/platform/files/node/watcher/win32/CodeHelper.md +++ b/src/vs/platform/files/node/watcher/win32/CodeHelper.md @@ -1,8 +1,8 @@ # Native File Watching for Windows using C# FileSystemWatcher -- Repository: https://github.com/Microsoft/vscode-filewatcher-windows +- Repository: https://github.com/microsoft/vscode-filewatcher-windows # Build - Build in "Release" config -- Copy CodeHelper.exe over into this folder \ No newline at end of file +- Copy CodeHelper.exe over into this folder diff --git a/src/vs/platform/files/test/electron-browser/diskFileService.test.ts b/src/vs/platform/files/test/electron-browser/diskFileService.test.ts index 3a290e0c0c1..4f7a0b94ccc 100644 --- a/src/vs/platform/files/test/electron-browser/diskFileService.test.ts +++ b/src/vs/platform/files/test/electron-browser/diskFileService.test.ts @@ -93,7 +93,7 @@ export class TestDiskFileSystemProvider extends DiskFileSystemProvider { const res = await super.stat(resource); if (this.invalidStatSize) { - res.size = String(res.size) as any; // for https://github.com/Microsoft/vscode/issues/72909 + res.size = String(res.size) as any; // for https://github.com/microsoft/vscode/issues/72909 } else if (this.smallStatSize) { res.size = 1; } @@ -1488,7 +1488,7 @@ suite('Disk File Service', function () { assert.equal(fileProvider.totalBytesRead, 0); } - test('readFile - FILE_NOT_MODIFIED_SINCE does not fire wrongly - https://github.com/Microsoft/vscode/issues/72909', async () => { + test('readFile - FILE_NOT_MODIFIED_SINCE does not fire wrongly - https://github.com/microsoft/vscode/issues/72909', async () => { fileProvider.setInvalidStatSize(true); const resource = URI.file(join(testDir, 'index.html')); diff --git a/src/vs/platform/markers/test/common/markerService.test.ts b/src/vs/platform/markers/test/common/markerService.test.ts index 2f8607c241c..ad6265fd61c 100644 --- a/src/vs/platform/markers/test/common/markerService.test.ts +++ b/src/vs/platform/markers/test/common/markerService.test.ts @@ -173,7 +173,7 @@ suite('Marker Service', () => { assert.equal(service.read({ owner: 'far' }).length, 1); }); - test('MapMap#remove returns bad values, https://github.com/Microsoft/vscode/issues/13548', () => { + test('MapMap#remove returns bad values, https://github.com/microsoft/vscode/issues/13548', () => { let service = new markerService.MarkerService(); service.changeOne('o', URI.parse('some:uri/1'), [randomMarkerData()]); diff --git a/src/vs/platform/menubar/electron-main/menubar.ts b/src/vs/platform/menubar/electron-main/menubar.ts index f285182942b..1e1e0e0bcc5 100644 --- a/src/vs/platform/menubar/electron-main/menubar.ts +++ b/src/vs/platform/menubar/electron-main/menubar.ts @@ -382,8 +382,8 @@ export class Menubar { const lastActiveWindow = this.windowsMainService.getLastActiveWindow(); if ( this.windowsMainService.getWindowCount() === 0 || // allow to quit when no more windows are open - !!BrowserWindow.getFocusedWindow() || // allow to quit when window has focus (fix for https://github.com/Microsoft/vscode/issues/39191) - lastActiveWindow?.isMinimized() // allow to quit when window has no focus but is minimized (https://github.com/Microsoft/vscode/issues/63000) + !!BrowserWindow.getFocusedWindow() || // allow to quit when window has focus (fix for https://github.com/microsoft/vscode/issues/39191) + lastActiveWindow?.isMinimized() // allow to quit when window has no focus but is minimized (https://github.com/microsoft/vscode/issues/63000) ) { this.electronMainService.quit(undefined); } @@ -727,10 +727,10 @@ export class Menubar { private runActionInRenderer(invocation: IMenuItemInvocation): void { // We make sure to not run actions when the window has no focus, this helps - // for https://github.com/Microsoft/vscode/issues/25907 and specifically for - // https://github.com/Microsoft/vscode/issues/11928 + // for https://github.com/microsoft/vscode/issues/25907 and specifically for + // https://github.com/microsoft/vscode/issues/11928 // Still allow to run when the last active window is minimized though for - // https://github.com/Microsoft/vscode/issues/63000 + // https://github.com/microsoft/vscode/issues/63000 let activeBrowserWindow = BrowserWindow.getFocusedWindow(); if (!activeBrowserWindow) { const lastActiveWindow = this.windowsMainService.getLastActiveWindow(); @@ -745,7 +745,7 @@ export class Menubar { if (isMacintosh && !this.environmentService.isBuilt && !activeWindow.isReady) { if ((invocation.type === 'commandId' && invocation.commandId === 'workbench.action.toggleDevTools') || (invocation.type !== 'commandId' && invocation.userSettingsLabel === 'alt+cmd+i')) { - // prevent this action from running twice on macOS (https://github.com/Microsoft/vscode/issues/62719) + // prevent this action from running twice on macOS (https://github.com/microsoft/vscode/issues/62719) // we already register a keybinding in bootstrap-window.js for opening developer tools in case something // goes wrong and that keybinding is only removed when the application has loaded (= window ready). return; diff --git a/src/vs/platform/remote/common/remoteAuthorityResolver.ts b/src/vs/platform/remote/common/remoteAuthorityResolver.ts index 075d086fd52..f50b3a60e0a 100644 --- a/src/vs/platform/remote/common/remoteAuthorityResolver.ts +++ b/src/vs/platform/remote/common/remoteAuthorityResolver.ts @@ -75,7 +75,7 @@ export class RemoteAuthorityResolverError extends Error { this.isHandled = (code === RemoteAuthorityResolverErrorCode.NotAvailable) && detail === true; // workaround when extending builtin objects and when compiling to ES5, see: - // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work + // https://github.com/microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work if (typeof (Object).setPrototypeOf === 'function') { (Object).setPrototypeOf(this, RemoteAuthorityResolverError.prototype); } diff --git a/src/vs/platform/windows/common/windows.ts b/src/vs/platform/windows/common/windows.ts index 60690f56c38..10a0bfabe3a 100644 --- a/src/vs/platform/windows/common/windows.ts +++ b/src/vs/platform/windows/common/windows.ts @@ -133,7 +133,7 @@ export function getTitleBarStyle(configurationService: IConfigurationService, en const useSimpleFullScreen = isMacintosh && configuration.nativeFullScreen === false; if (useSimpleFullScreen) { - return 'native'; // simple fullscreen does not work well with custom title style (https://github.com/Microsoft/vscode/issues/63291) + return 'native'; // simple fullscreen does not work well with custom title style (https://github.com/microsoft/vscode/issues/63291) } const style = configuration.titleBarStyle; diff --git a/src/vs/platform/windows/electron-main/windowsMainService.ts b/src/vs/platform/windows/electron-main/windowsMainService.ts index 10ecfbd55fa..f58a2c7b7b5 100644 --- a/src/vs/platform/windows/electron-main/windowsMainService.ts +++ b/src/vs/platform/windows/electron-main/windowsMainService.ts @@ -783,7 +783,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic private doOpenFolderOrWorkspace(openConfig: IOpenConfiguration, folderOrWorkspace: IPathToOpen, forceNewWindow: boolean, fileInputs: IFileInputs | undefined, windowToUse?: ICodeWindow): ICodeWindow { if (!forceNewWindow && !windowToUse && typeof openConfig.contextWindowId === 'number') { - windowToUse = this.getWindowById(openConfig.contextWindowId); // fix for https://github.com/Microsoft/vscode/issues/49587 + windowToUse = this.getWindowById(openConfig.contextWindowId); // fix for https://github.com/microsoft/vscode/issues/49587 } return this.openInBrowserWindow({ @@ -1576,7 +1576,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic } else if ((windowConfig.newWindowDimensions === 'inherit' || windowConfig.newWindowDimensions === 'offset') && lastActive) { const lastActiveState = lastActive.serializeWindowState(); if (lastActiveState.mode === WindowMode.Fullscreen) { - state.mode = WindowMode.Fullscreen; // only take mode (fixes https://github.com/Microsoft/vscode/issues/19331) + state.mode = WindowMode.Fullscreen; // only take mode (fixes https://github.com/microsoft/vscode/issues/19331) } else { state = lastActiveState; } diff --git a/src/vs/platform/windows/electron-sandbox/window.ts b/src/vs/platform/windows/electron-sandbox/window.ts index 5659fa20d7d..c42c94bcd0c 100644 --- a/src/vs/platform/windows/electron-sandbox/window.ts +++ b/src/vs/platform/windows/electron-sandbox/window.ts @@ -16,7 +16,7 @@ export function applyZoom(zoomLevel: number): void { setZoomFactor(zoomLevelToZoomFactor(zoomLevel)); // Cannot be trusted because the webFrame might take some time // until it really applies the new zoom level - // See https://github.com/Microsoft/vscode/issues/26151 + // See https://github.com/microsoft/vscode/issues/26151 setZoomLevel(zoomLevel, false /* isTrusted */); } diff --git a/src/vs/platform/workspaces/electron-main/workspacesHistoryMainService.ts b/src/vs/platform/workspaces/electron-main/workspacesHistoryMainService.ts index c618ba30af6..e5cbe9a8def 100644 --- a/src/vs/platform/workspaces/electron-main/workspacesHistoryMainService.ts +++ b/src/vs/platform/workspaces/electron-main/workspacesHistoryMainService.ts @@ -335,7 +335,7 @@ export class WorkspacesHistoryMainService extends Disposable implements IWorkspa // The user might have meanwhile removed items from the jump list and we have to respect that // so we need to update our list of recent paths with the choice of the user to not add them again // Also: Windows will not show our custom category at all if there is any entry which was removed - // by the user! See https://github.com/Microsoft/vscode/issues/15052 + // by the user! See https://github.com/microsoft/vscode/issues/15052 let toRemove: URI[] = []; for (let item of app.getJumpListSettings().removedItems) { const args = item.args; diff --git a/src/vs/workbench/api/common/extHostCommands.ts b/src/vs/workbench/api/common/extHostCommands.ts index 8dc69cb7abd..c20a7a42ba7 100644 --- a/src/vs/workbench/api/common/extHostCommands.ts +++ b/src/vs/workbench/api/common/extHostCommands.ts @@ -58,7 +58,7 @@ export class ExtHostCommands implements ExtHostCommandsShape { { processArgument(arg) { return cloneAndChange(arg, function (obj) { - // Reverse of https://github.com/Microsoft/vscode/blob/1f28c5fc681f4c01226460b6d1c7e91b8acb4a5b/src/vs/workbench/api/node/extHostCommands.ts#L112-L127 + // Reverse of https://github.com/microsoft/vscode/blob/1f28c5fc681f4c01226460b6d1c7e91b8acb4a5b/src/vs/workbench/api/node/extHostCommands.ts#L112-L127 if (Range.isIRange(obj)) { return extHostTypeConverter.Range.to(obj); } diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index 503512e25c7..43dd6f16057 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -469,7 +469,7 @@ export class RemoteAuthorityResolverError extends Error { this._detail = detail; // workaround when extending builtin objects and when compiling to ES5, see: - // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work + // https://github.com/microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work if (typeof (Object).setPrototypeOf === 'function') { (Object).setPrototypeOf(this, RemoteAuthorityResolverError.prototype); } @@ -2409,7 +2409,7 @@ export class FileSystemError extends Error { markAsFileSystemProviderError(this, code); // workaround when extending builtin objects and when compiling to ES5, see: - // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work + // https://github.com/microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work if (typeof (Object).setPrototypeOf === 'function') { (Object).setPrototypeOf(this, FileSystemError.prototype); } diff --git a/src/vs/workbench/browser/actions/textInputActions.ts b/src/vs/workbench/browser/actions/textInputActions.ts index da382fb4df2..33856f6f6cf 100644 --- a/src/vs/workbench/browser/actions/textInputActions.ts +++ b/src/vs/workbench/browser/actions/textInputActions.ts @@ -89,7 +89,7 @@ export class TextInputActionsProvider extends Disposable implements IWorkbenchCo getAnchor: () => e, getActions: () => this.textInputActions, getActionsContext: () => target, - onHide: () => target.focus() // fixes https://github.com/Microsoft/vscode/issues/52948 + onHide: () => target.focus() // fixes https://github.com/microsoft/vscode/issues/52948 }); } } diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts index f6072200140..38ca25dd768 100644 --- a/src/vs/workbench/browser/dnd.ts +++ b/src/vs/workbench/browser/dnd.ts @@ -446,7 +446,7 @@ export interface IDragAndDropObserverCallbacks { export class DragAndDropObserver extends Disposable { // A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE - // calls see https://github.com/Microsoft/vscode/issues/14470 + // calls see https://github.com/microsoft/vscode/issues/14470 // when the element has child elements where the events are fired // repeadedly. private counter: number = 0; diff --git a/src/vs/workbench/browser/media/style.css b/src/vs/workbench/browser/media/style.css index 9d2fe752921..b3271863264 100644 --- a/src/vs/workbench/browser/media/style.css +++ b/src/vs/workbench/browser/media/style.css @@ -229,7 +229,7 @@ body.web { } .monaco-workbench.mac select:focus { - border-color: transparent; /* outline is a square, but border has a radius, so we avoid this glitch when focused (https://github.com/Microsoft/vscode/issues/26045) */ + border-color: transparent; /* outline is a square, but border has a radius, so we avoid this glitch when focused (https://github.com/microsoft/vscode/issues/26045) */ } .monaco-workbench .monaco-list:not(.element-focused):focus:before { diff --git a/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts b/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts index 6b079117b33..afbc1b0a20a 100644 --- a/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts +++ b/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts @@ -74,7 +74,7 @@ export class ViewContainerActivityAction extends ActivityAction { // prevent accident trigger on a doubleclick (to help nervous people) const now = Date.now(); - if (now > this.lastRun /* https://github.com/Microsoft/vscode/issues/25830 */ && now - this.lastRun < ViewContainerActivityAction.preventDoubleClickDelay) { + if (now > this.lastRun /* https://github.com/microsoft/vscode/issues/25830 */ && now - this.lastRun < ViewContainerActivityAction.preventDoubleClickDelay) { return; } this.lastRun = now; diff --git a/src/vs/workbench/browser/parts/editor/editorActions.ts b/src/vs/workbench/browser/parts/editor/editorActions.ts index 8054628b701..d19c8783396 100644 --- a/src/vs/workbench/browser/parts/editor/editorActions.ts +++ b/src/vs/workbench/browser/parts/editor/editorActions.ts @@ -778,7 +778,7 @@ export class BaseMoveGroupAction extends Action { // Allow the target group to be in alternative locations to support more // scenarios of moving the group to the taret location. - // Helps for https://github.com/Microsoft/vscode/issues/50741 + // Helps for https://github.com/microsoft/vscode/issues/50741 switch (this.direction) { case GroupDirection.LEFT: case GroupDirection.RIGHT: diff --git a/src/vs/workbench/browser/parts/editor/editorDropTarget.ts b/src/vs/workbench/browser/parts/editor/editorDropTarget.ts index 63c0375c95d..066fb21db21 100644 --- a/src/vs/workbench/browser/parts/editor/editorDropTarget.ts +++ b/src/vs/workbench/browser/parts/editor/editorDropTarget.ts @@ -580,7 +580,7 @@ export class EditorDropTarget extends Themable { if ( !this.editorTransfer.hasData(DraggedEditorIdentifier.prototype) && !this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype) && - event.dataTransfer && !event.dataTransfer.types.length // see https://github.com/Microsoft/vscode/issues/25789 + event.dataTransfer && !event.dataTransfer.types.length // see https://github.com/microsoft/vscode/issues/25789 ) { event.dataTransfer.dropEffect = 'none'; return; // unsupported transfer diff --git a/src/vs/workbench/browser/parts/editor/editorPart.ts b/src/vs/workbench/browser/parts/editor/editorPart.ts index 49eeb6a47ee..8b577f47ef9 100644 --- a/src/vs/workbench/browser/parts/editor/editorPart.ts +++ b/src/vs/workbench/browser/parts/editor/editorPart.ts @@ -427,7 +427,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro layout.orientation, this.isTwoDimensionalGrid() ? this.gridWidget.orientation : // preserve original orientation for 2-dimensional grids - orthogonal(this.gridWidget.orientation) // otherwise flip (fix https://github.com/Microsoft/vscode/issues/52975) + orthogonal(this.gridWidget.orientation) // otherwise flip (fix https://github.com/microsoft/vscode/issues/52975) ), groups: layout.groups }); diff --git a/src/vs/workbench/browser/parts/editor/media/tabstitlecontrol.css b/src/vs/workbench/browser/parts/editor/media/tabstitlecontrol.css index bb1e1184271..0cc584ca166 100644 --- a/src/vs/workbench/browser/parts/editor/media/tabstitlecontrol.css +++ b/src/vs/workbench/browser/parts/editor/media/tabstitlecontrol.css @@ -132,7 +132,7 @@ content: ''; display: flex; flex: 0; - width: 5px; /* Reserve space to hide tab fade when close button is left or off (fixes https://github.com/Microsoft/vscode/issues/45728) */ + width: 5px; /* Reserve space to hide tab fade when close button is left or off (fixes https://github.com/microsoft/vscode/issues/45728) */ } .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink.tab-actions-left { @@ -141,11 +141,11 @@ } .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dragged { - transform: translate3d(0px, 0px, 0px); /* forces tab to be drawn on a separate layer (fixes https://github.com/Microsoft/vscode/issues/18733) */ + transform: translate3d(0px, 0px, 0px); /* forces tab to be drawn on a separate layer (fixes https://github.com/microsoft/vscode/issues/18733) */ } .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dragged-over div { - pointer-events: none; /* prevents cursor flickering (fixes https://github.com/Microsoft/vscode/issues/38753) */ + pointer-events: none; /* prevents cursor flickering (fixes https://github.com/microsoft/vscode/issues/38753) */ } .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.tab-actions-left { @@ -213,7 +213,7 @@ } .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink:focus > .tab-label::after { - opacity: 0; /* when tab has the focus this shade breaks the tab border (fixes https://github.com/Microsoft/vscode/issues/57819) */ + opacity: 0; /* when tab has the focus this shade breaks the tab border (fixes https://github.com/microsoft/vscode/issues/57819) */ } .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sticky-compact:not(.has-icon) .monaco-icon-label { @@ -222,7 +222,7 @@ .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-fit .monaco-icon-label, .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-fit .monaco-icon-label > .monaco-icon-label-container { - overflow: visible; /* fixes https://github.com/Microsoft/vscode/issues/20182 */ + overflow: visible; /* fixes https://github.com/microsoft/vscode/issues/20182 */ } .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink > .monaco-icon-label > .monaco-icon-label-container { diff --git a/src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts b/src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts index 165a3a3d024..1ccbc86d42f 100644 --- a/src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts +++ b/src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts @@ -100,7 +100,7 @@ export class NoTabsTitleControl extends TitleControl { private onTitleAuxClick(e: MouseEvent): void { if (e.button === 1 /* Middle Button */ && this.group.activeEditor) { - EventHelper.stop(e, true /* for https://github.com/Microsoft/vscode/issues/56715 */); + EventHelper.stop(e, true /* for https://github.com/microsoft/vscode/issues/56715 */); this.group.closeEditor(this.group.activeEditor); } diff --git a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts index a08c7ba99c9..e1aefd09281 100644 --- a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts +++ b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts @@ -238,7 +238,7 @@ export class TabsTitleControl extends TitleControl { })); }); - // Prevent auto-scrolling (https://github.com/Microsoft/vscode/issues/16690) + // Prevent auto-scrolling (https://github.com/microsoft/vscode/issues/16690) this._register(addDisposableListener(tabsContainer, EventType.MOUSE_DOWN, (e: MouseEvent) => { if (e.button === 1) { e.preventDefault(); @@ -254,7 +254,7 @@ export class TabsTitleControl extends TitleControl { // Return if the target is not on the tabs container if (e.target !== tabsContainer) { - this.updateDropFeedback(tabsContainer, false); // fixes https://github.com/Microsoft/vscode/issues/52093 + this.updateDropFeedback(tabsContainer, false); // fixes https://github.com/microsoft/vscode/issues/52093 return; } @@ -610,7 +610,7 @@ export class TabsTitleControl extends TitleControl { if (e instanceof MouseEvent && e.button !== 0) { if (e.button === 1) { - e.preventDefault(); // required to prevent auto-scrolling (https://github.com/Microsoft/vscode/issues/16690) + e.preventDefault(); // required to prevent auto-scrolling (https://github.com/microsoft/vscode/issues/16690) } return undefined; // only for left mouse click @@ -657,7 +657,7 @@ export class TabsTitleControl extends TitleControl { // Close on mouse middle click disposables.add(addDisposableListener(tab, EventType.AUXCLICK, (e: MouseEvent) => { if (e.button === 1 /* Middle Button*/) { - EventHelper.stop(e, true /* for https://github.com/Microsoft/vscode/issues/56715 */); + EventHelper.stop(e, true /* for https://github.com/microsoft/vscode/issues/56715 */); this.blockRevealActiveTabOnce(); this.closeEditorAction.run({ groupId: this.group.id, editorIndex: index }); @@ -748,7 +748,7 @@ export class TabsTitleControl extends TitleControl { if (input) { this.onContextMenu(input, e, tab); } - }, true /* use capture to fix https://github.com/Microsoft/vscode/issues/19145 */)); + }, true /* use capture to fix https://github.com/microsoft/vscode/issues/19145 */)); // Drag support disposables.add(addDisposableListener(tab, EventType.DRAG_START, (e: DragEvent) => { @@ -766,7 +766,7 @@ export class TabsTitleControl extends TitleControl { // Apply some datatransfer types to allow for dragging the element outside of the application this.doFillResourceDataTransfers(editor, e); - // Fixes https://github.com/Microsoft/vscode/issues/18733 + // Fixes https://github.com/microsoft/vscode/issues/18733 tab.classList.add('dragged'); scheduleAtNextAnimationFrame(() => tab.classList.remove('dragged')); })); @@ -857,7 +857,7 @@ export class TabsTitleControl extends TitleControl { } if (e.dataTransfer && e.dataTransfer.types.length > 0) { - return true; // optimistically allow external data (// see https://github.com/Microsoft/vscode/issues/25789) + return true; // optimistically allow external data (// see https://github.com/microsoft/vscode/issues/25789) } return false; diff --git a/src/vs/workbench/browser/parts/editor/titleControl.ts b/src/vs/workbench/browser/parts/editor/titleControl.ts index 4468dfa211f..b659deea0de 100644 --- a/src/vs/workbench/browser/parts/editor/titleControl.ts +++ b/src/vs/workbench/browser/parts/editor/titleControl.ts @@ -193,7 +193,7 @@ export abstract class TitleControl extends Themable { !arrays.equals(primaryEditorActionIds, this.currentPrimaryEditorActionIds) || !arrays.equals(secondaryEditorActionIds, this.currentSecondaryEditorActionIds) || primaryEditorActions.some(action => action instanceof ExecuteCommandAction) || // execute command actions can have the same ID but different arguments - secondaryEditorActions.some(action => action instanceof ExecuteCommandAction) // see also https://github.com/Microsoft/vscode/issues/16298 + secondaryEditorActions.some(action => action instanceof ExecuteCommandAction) // see also https://github.com/microsoft/vscode/issues/16298 ) { const editorActionsToolbar = assertIsDefined(this.editorActionsToolbar); editorActionsToolbar.setActions(primaryEditorActions, secondaryEditorActions); diff --git a/src/vs/workbench/common/actions.ts b/src/vs/workbench/common/actions.ts index 25080ac61a0..6b016e016a0 100644 --- a/src/vs/workbench/common/actions.ts +++ b/src/vs/workbench/common/actions.ts @@ -58,7 +58,7 @@ Registry.add(Extensions.WorkbenchActions, new class implements IWorkbenchActionR // menu item // TODO@Rob slightly weird if-check required because of - // https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/contrib/search/electron-browser/search.contribution.ts#L266 + // https://github.com/microsoft/vscode/blob/master/src/vs/workbench/contrib/search/electron-browser/search.contribution.ts#L266 if (descriptor.label) { let idx = alias.indexOf(': '); diff --git a/src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts b/src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts index bc844638297..2772c78afac 100644 --- a/src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts +++ b/src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts @@ -106,7 +106,7 @@ export class StartDebugActionViewItem implements IActionViewItem { if (shouldBeSelected) { this.selected = e.index; } else { - // Some select options should not remain selected https://github.com/Microsoft/vscode/issues/31526 + // Some select options should not remain selected https://github.com/microsoft/vscode/issues/31526 this.selectBox.select(this.selected); } })); diff --git a/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts b/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts index ab7a78c8b07..c8f36021526 100644 --- a/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts +++ b/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts @@ -142,7 +142,7 @@ export class TextFileSaveErrorHandler extends Disposable implements ISaveErrorHa const isReadonly = fileOperationError.fileOperationResult === FileOperationResult.FILE_READ_ONLY; const triedToMakeWriteable = isReadonly && fileOperationError.options && (fileOperationError.options as IWriteTextFileOptions).overwriteReadonly; const isPermissionDenied = fileOperationError.fileOperationResult === FileOperationResult.FILE_PERMISSION_DENIED; - const canHandlePermissionOrReadonlyErrors = resource.scheme === Schemas.file; // https://github.com/Microsoft/vscode/issues/48659 + const canHandlePermissionOrReadonlyErrors = resource.scheme === Schemas.file; // https://github.com/microsoft/vscode/issues/48659 // Save Elevated if (canHandlePermissionOrReadonlyErrors && (isPermissionDenied || triedToMakeWriteable)) { diff --git a/src/vs/workbench/contrib/files/browser/files.contribution.ts b/src/vs/workbench/contrib/files/browser/files.contribution.ts index 7be3b5c9b81..59cc9c6afce 100644 --- a/src/vs/workbench/contrib/files/browser/files.contribution.ts +++ b/src/vs/workbench/contrib/files/browser/files.contribution.ts @@ -314,7 +314,7 @@ configurationRegistry.registerConfiguration({ }, 'files.watcherExclude': { 'type': 'object', - 'default': platform.isWindows /* https://github.com/Microsoft/vscode/issues/23954 */ ? { '**/.git/objects/**': true, '**/.git/subtree-cache/**': true, '**/node_modules/*/**': true, '**/.hg/store/**': true } : { '**/.git/objects/**': true, '**/.git/subtree-cache/**': true, '**/node_modules/**': true, '**/.hg/store/**': true }, + 'default': platform.isWindows /* https://github.com/microsoft/vscode/issues/23954 */ ? { '**/.git/objects/**': true, '**/.git/subtree-cache/**': true, '**/node_modules/*/**': true, '**/.hg/store/**': true } : { '**/.git/objects/**': true, '**/.git/subtree-cache/**': true, '**/node_modules/**': true, '**/.hg/store/**': true }, 'description': nls.localize('watcherExclude', "Configure glob patterns of file paths to exclude from file watching. Patterns must match on absolute paths (i.e. prefix with ** or the full path to match properly). Changing this setting requires a restart. When you experience Code consuming lots of CPU time on startup, you can exclude large folders to reduce the initial load."), 'scope': ConfigurationScope.RESOURCE }, diff --git a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts index 35589586946..7bbdaa69a66 100644 --- a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts +++ b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts @@ -364,9 +364,9 @@ export class OpenEditorsView extends ViewPane { if (element) { this.telemetryService.publicLog2('workbenchActionExecuted', { id: 'workbench.files.openFile', from: 'openEditors' }); - const preserveActivateGroup = options.sideBySide && options.preserveFocus; // needed for https://github.com/Microsoft/vscode/issues/42399 + const preserveActivateGroup = options.sideBySide && options.preserveFocus; // needed for https://github.com/microsoft/vscode/issues/42399 if (!preserveActivateGroup) { - this.editorGroupService.activateGroup(element.group); // needed for https://github.com/Microsoft/vscode/issues/6672 + this.editorGroupService.activateGroup(element.group); // needed for https://github.com/microsoft/vscode/issues/6672 } this.editorService.openEditor(element.editor, options, options.sideBySide ? SIDE_GROUP : element.group); } diff --git a/src/vs/workbench/contrib/preferences/browser/preferencesRenderers.ts b/src/vs/workbench/contrib/preferences/browser/preferencesRenderers.ts index 3829f930aad..11b57be4178 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferencesRenderers.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferencesRenderers.ts @@ -761,7 +761,7 @@ class EditSettingRenderer extends Disposable { if (configurationNode) { if (this.isDefaultSettings()) { if (setting.key === 'launch') { - // Do not show because of https://github.com/Microsoft/vscode/issues/32593 + // Do not show because of https://github.com/microsoft/vscode/issues/32593 return false; } return true; diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts index f551e44afaa..7892c7c160f 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts @@ -1059,7 +1059,7 @@ export class SettingsEditor2 extends EditorPane { if (key) { const elements = this.currentSettingsModel.getElementsByName(key); if (elements && elements.length) { - // TODO https://github.com/Microsoft/vscode/issues/57360 + // TODO https://github.com/microsoft/vscode/issues/57360 this.refreshTree(); } else { // Refresh requested for a key that we don't know about diff --git a/src/vs/workbench/contrib/preferences/common/preferencesContribution.ts b/src/vs/workbench/contrib/preferences/common/preferencesContribution.ts index 1873c7bdc83..3e8ec4fb646 100644 --- a/src/vs/workbench/contrib/preferences/common/preferencesContribution.ts +++ b/src/vs/workbench/contrib/preferences/common/preferencesContribution.ts @@ -76,7 +76,7 @@ export class PreferencesContribution implements IWorkbenchContribution { // If the resource was already opened before in the group, do not prevent // the opening of that resource. Otherwise we would have the same settings - // opened twice (https://github.com/Microsoft/vscode/issues/36447) + // opened twice (https://github.com/microsoft/vscode/issues/36447) if (group.isOpened(editor)) { return undefined; } diff --git a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts index 70e0e6a2137..29a125e206f 100644 --- a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts +++ b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts @@ -143,7 +143,7 @@ export class WorkspaceChangeExtHostRelauncher extends Disposable implements IWor this.extensionHostRestarter = this._register(new RunOnceScheduler(() => { if (!!environmentService.extensionTestsLocationURI) { - return; // no restart when in tests: see https://github.com/Microsoft/vscode/issues/66936 + return; // no restart when in tests: see https://github.com/microsoft/vscode/issues/66936 } if (environmentService.configuration.remoteAuthority) { diff --git a/src/vs/workbench/contrib/search/browser/replaceService.ts b/src/vs/workbench/contrib/search/browser/replaceService.ts index ba13946ada5..83a6db8d711 100644 --- a/src/vs/workbench/contrib/search/browser/replaceService.ts +++ b/src/vs/workbench/contrib/search/browser/replaceService.ts @@ -72,7 +72,7 @@ class ReplacePreviewModel extends Disposable { const replacePreviewModel = this.modelService.createModel(createTextBufferFactoryFromSnapshot(sourceModel.createSnapshot()), this.modeService.create(sourceModelModeId), replacePreviewUri); this._register(fileMatch.onChange(({ forceUpdateModel }) => this.update(sourceModel, replacePreviewModel, fileMatch, forceUpdateModel))); this._register(this.searchWorkbenchService.searchModel.onReplaceTermChanged(() => this.update(sourceModel, replacePreviewModel, fileMatch))); - this._register(fileMatch.onDispose(() => replacePreviewModel.dispose())); // TODO@Sandeep we should not dispose a model directly but rather the reference (depends on https://github.com/Microsoft/vscode/issues/17073) + this._register(fileMatch.onDispose(() => replacePreviewModel.dispose())); // TODO@Sandeep we should not dispose a model directly but rather the reference (depends on https://github.com/microsoft/vscode/issues/17073) this._register(replacePreviewModel.onWillDispose(() => this.dispose())); this._register(sourceModel.onWillDispose(() => this.dispose())); return replacePreviewModel; diff --git a/src/vs/workbench/contrib/search/browser/searchView.ts b/src/vs/workbench/contrib/search/browser/searchView.ts index 7e2f15d238f..7f50bf10765 100644 --- a/src/vs/workbench/contrib/search/browser/searchView.ts +++ b/src/vs/workbench/contrib/search/browser/searchView.ts @@ -1317,7 +1317,7 @@ export class SearchView extends ViewPane { // Need the full match line to correctly calculate replace text, if this is a search/replace with regex group references ($1, $2, ...). // 10000 chars is enough to avoid sending huge amounts of text around, if you do a replace with a longer match, it may or may not resolve the group refs correctly. - // https://github.com/Microsoft/vscode/issues/58374 + // https://github.com/microsoft/vscode/issues/58374 const charsPerLine = content.isRegExp ? 10000 : 1000; const options: ITextQueryBuilderOptions = { diff --git a/src/vs/workbench/contrib/search/common/queryBuilder.ts b/src/vs/workbench/contrib/search/common/queryBuilder.ts index 47885cbfad0..7a99e055745 100644 --- a/src/vs/workbench/contrib/search/common/queryBuilder.ts +++ b/src/vs/workbench/contrib/search/common/queryBuilder.ts @@ -493,7 +493,7 @@ function splitGlobPattern(pattern: string): string[] { } /** - * Note - we used {} here previously but ripgrep can't handle nested {} patterns. See https://github.com/Microsoft/vscode/issues/32761 + * Note - we used {} here previously but ripgrep can't handle nested {} patterns. See https://github.com/microsoft/vscode/issues/32761 */ function expandGlobalGlob(pattern: string): string[] { const patterns = [ diff --git a/src/vs/workbench/contrib/tags/test/electron-browser/workspaceTags.test.ts b/src/vs/workbench/contrib/tags/test/electron-browser/workspaceTags.test.ts index e9aec24827a..ed3c428daa4 100644 --- a/src/vs/workbench/contrib/tags/test/electron-browser/workspaceTags.test.ts +++ b/src/vs/workbench/contrib/tags/test/electron-browser/workspaceTags.test.ts @@ -33,14 +33,14 @@ suite('Telemetry - WorkspaceTags', () => { }); test('Multiple remotes hashed', function () { - const config = ['https://github.com/Microsoft/vscode.git', 'https://git.example.com/gitproject.git'].map(remote).join(' '); - assert.deepStrictEqual(getHashedRemotesFromConfig(config), [hash('github.com/Microsoft/vscode.git'), hash('git.example.com/gitproject.git')]); + const config = ['https://github.com/microsoft/vscode.git', 'https://git.example.com/gitproject.git'].map(remote).join(' '); + assert.deepStrictEqual(getHashedRemotesFromConfig(config), [hash('github.com/microsoft/vscode.git'), hash('git.example.com/gitproject.git')]); // Strip .git - assert.deepStrictEqual(getHashedRemotesFromConfig(config, true), [hash('github.com/Microsoft/vscode'), hash('git.example.com/gitproject')]); + assert.deepStrictEqual(getHashedRemotesFromConfig(config, true), [hash('github.com/microsoft/vscode'), hash('git.example.com/gitproject')]); // Compare Striped .git with no .git - const noDotGitConfig = ['https://github.com/Microsoft/vscode', 'https://git.example.com/gitproject'].map(remote).join(' '); + const noDotGitConfig = ['https://github.com/microsoft/vscode', 'https://git.example.com/gitproject'].map(remote).join(' '); assert.deepStrictEqual(getHashedRemotesFromConfig(config, true), getHashedRemotesFromConfig(noDotGitConfig)); }); diff --git a/src/vs/workbench/contrib/tasks/common/problemCollectors.ts b/src/vs/workbench/contrib/tasks/common/problemCollectors.ts index 3a6610a6ee8..46574e02250 100644 --- a/src/vs/workbench/contrib/tasks/common/problemCollectors.ts +++ b/src/vs/workbench/contrib/tasks/common/problemCollectors.ts @@ -398,7 +398,7 @@ export class WatchingProblemCollector extends AbstractProblemCollector implement private problemMatchers: ProblemMatcher[]; private backgroundPatterns: BackgroundPatterns[]; - // workaround for https://github.com/Microsoft/vscode/issues/44018 + // workaround for https://github.com/microsoft/vscode/issues/44018 private _activeBackgroundMatchers: Set; // Current State diff --git a/src/vs/workbench/contrib/tasks/node/processRunnerDetector.ts b/src/vs/workbench/contrib/tasks/node/processRunnerDetector.ts index e95e72a460c..a90fce79a5f 100644 --- a/src/vs/workbench/contrib/tasks/node/processRunnerDetector.ts +++ b/src/vs/workbench/contrib/tasks/node/processRunnerDetector.ts @@ -218,7 +218,7 @@ export class ProcessRunnerDetector { } private resolveCommandOptions(workspaceFolder: IWorkspaceFolder, options: CommandOptions): CommandOptions { - // TODO@Dirk adopt new configuration resolver service https://github.com/Microsoft/vscode/issues/31365 + // TODO@Dirk adopt new configuration resolver service https://github.com/microsoft/vscode/issues/31365 let result = Objects.deepClone(options); if (result.cwd) { result.cwd = this.configurationResolverService.resolve(workspaceFolder, result.cwd); @@ -230,7 +230,7 @@ export class ProcessRunnerDetector { } private tryDetectGulp(workspaceFolder: IWorkspaceFolder, list: boolean): Promise { - return Promise.resolve(this.fileService.resolve(workspaceFolder.toResource('gulpfile.js'))).then((stat) => { // TODO@Dirk (https://github.com/Microsoft/vscode/issues/29454) + return Promise.resolve(this.fileService.resolve(workspaceFolder.toResource('gulpfile.js'))).then((stat) => { // TODO@Dirk (https://github.com/microsoft/vscode/issues/29454) let config = ProcessRunnerDetector.detectorConfig('gulp'); let process = new LineProcess('gulp', [config.arg, '--no-color'], true, { cwd: this._cwd }); return this.runDetection(process, 'gulp', true, config.matcher, ProcessRunnerDetector.DefaultProblemMatchers, list); @@ -240,7 +240,7 @@ export class ProcessRunnerDetector { } private tryDetectGrunt(workspaceFolder: IWorkspaceFolder, list: boolean): Promise { - return Promise.resolve(this.fileService.resolve(workspaceFolder.toResource('Gruntfile.js'))).then((stat) => { // TODO@Dirk (https://github.com/Microsoft/vscode/issues/29454) + return Promise.resolve(this.fileService.resolve(workspaceFolder.toResource('Gruntfile.js'))).then((stat) => { // TODO@Dirk (https://github.com/microsoft/vscode/issues/29454) let config = ProcessRunnerDetector.detectorConfig('grunt'); let process = new LineProcess('grunt', [config.arg, '--no-color'], true, { cwd: this._cwd }); return this.runDetection(process, 'grunt', true, config.matcher, ProcessRunnerDetector.DefaultProblemMatchers, list); @@ -255,10 +255,10 @@ export class ProcessRunnerDetector { let process = new LineProcess('jake', [config.arg], true, { cwd: this._cwd }); return this.runDetection(process, 'jake', true, config.matcher, ProcessRunnerDetector.DefaultProblemMatchers, list); }; - return Promise.resolve(this.fileService.resolve(workspaceFolder.toResource('Jakefile'))).then((stat) => { // TODO@Dirk (https://github.com/Microsoft/vscode/issues/29454) + return Promise.resolve(this.fileService.resolve(workspaceFolder.toResource('Jakefile'))).then((stat) => { // TODO@Dirk (https://github.com/microsoft/vscode/issues/29454) return run(); }, (err: any) => { - return this.fileService.resolve(workspaceFolder.toResource('Jakefile.js')).then((stat) => { // TODO@Dirk (https://github.com/Microsoft/vscode/issues/29454) + return this.fileService.resolve(workspaceFolder.toResource('Jakefile.js')).then((stat) => { // TODO@Dirk (https://github.com/microsoft/vscode/issues/29454) return run(); }, (err: any) => { return null; diff --git a/src/vs/workbench/contrib/update/browser/update.ts b/src/vs/workbench/contrib/update/browser/update.ts index 8c45b22c10a..0fb62d6e25a 100644 --- a/src/vs/workbench/contrib/update/browser/update.ts +++ b/src/vs/workbench/contrib/update/browser/update.ts @@ -268,7 +268,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu } private onError(error: string): void { - error = error.replace(/See https:\/\/github\.com\/Squirrel\/Squirrel\.Mac\/issues\/182 for more information/, 'See [this link](https://github.com/Microsoft/vscode/issues/7426#issuecomment-425093469) for more information'); + error = error.replace(/See https:\/\/github\.com\/Squirrel\/Squirrel\.Mac\/issues\/182 for more information/, 'See [this link](https://github.com/microsoft/vscode/issues/7426#issuecomment-425093469) for more information'); this.notificationService.notify({ severity: Severity.Error, diff --git a/src/vs/workbench/contrib/url/test/browser/trustedDomains.test.ts b/src/vs/workbench/contrib/url/test/browser/trustedDomains.test.ts index fc84ad42ff8..8f314d5a134 100644 --- a/src/vs/workbench/contrib/url/test/browser/trustedDomains.test.ts +++ b/src/vs/workbench/contrib/url/test/browser/trustedDomains.test.ts @@ -104,7 +104,7 @@ suite('Link protection domain matching', () => { test('case normalization', () => { // https://github.com/microsoft/vscode/issues/99294 - linkAllowedByRules('https://github.com/Microsoft/vscode/issues/new', ['https://github.com/microsoft']); - linkAllowedByRules('https://github.com/microsoft/vscode/issues/new', ['https://github.com/Microsoft']); + linkAllowedByRules('https://github.com/microsoft/vscode/issues/new', ['https://github.com/microsoft']); + linkAllowedByRules('https://github.com/microsoft/vscode/issues/new', ['https://github.com/microsoft']); }); }); diff --git a/src/vs/workbench/contrib/webview/browser/pre/main.js b/src/vs/workbench/contrib/webview/browser/pre/main.js index 0aede20701c..366abaf3519 100644 --- a/src/vs/workbench/contrib/webview/browser/pre/main.js +++ b/src/vs/workbench/contrib/webview/browser/pre/main.js @@ -554,7 +554,7 @@ */ const onLoad = (contentDocument, contentWindow) => { if (contentDocument && contentDocument.body) { - // Workaround for https://github.com/Microsoft/vscode/issues/12865 + // Workaround for https://github.com/microsoft/vscode/issues/12865 // check new scrollY and reset if necessary setInitialScrollPosition(contentDocument.body, contentWindow); } diff --git a/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.ts b/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.ts index dfd9123db22..61a49a949d9 100644 --- a/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.ts +++ b/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.ts @@ -14,7 +14,7 @@ import { WebviewEditor } from 'vs/workbench/contrib/webviewPanel/browser/webview import { WebviewInput } from 'vs/workbench/contrib/webviewPanel/browser/webviewEditorInput'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -const webviewActiveContextKeyExpr = ContextKeyExpr.and(ContextKeyExpr.equals('activeEditor', WebviewEditor.ID), ContextKeyExpr.not('editorFocus') /* https://github.com/Microsoft/vscode/issues/58668 */)!; +const webviewActiveContextKeyExpr = ContextKeyExpr.and(ContextKeyExpr.equals('activeEditor', WebviewEditor.ID), ContextKeyExpr.not('editorFocus') /* https://github.com/microsoft/vscode/issues/58668 */)!; export class ShowWebViewEditorFindWidgetAction extends Action2 { public static readonly ID = 'editor.action.webvieweditor.showFind'; diff --git a/src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts b/src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts index 7b6e2e716b8..6af6a4b7f42 100644 --- a/src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts +++ b/src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts @@ -39,7 +39,7 @@ export default () => `
  • ${escape(localize('welcomePage.introductoryVideos', "Introductory videos"))}
  • ${escape(localize('welcomePage.tipsAndTricks', "Tips and Tricks"))}
  • ${escape(localize('welcomePage.productDocumentation', "Product documentation"))}
  • -
  • ${escape(localize('welcomePage.gitHubRepository', "GitHub repository"))}
  • +
  • ${escape(localize('welcomePage.gitHubRepository', "GitHub repository"))}
  • ${escape(localize('welcomePage.stackOverflow', "Stack Overflow"))}
  • ${escape(localize('welcomePage.newsletterSignup', "Join our Newsletter"))}
  • diff --git a/src/vs/workbench/electron-sandbox/window.ts b/src/vs/workbench/electron-sandbox/window.ts index 59270cd9ddb..9d0bef938f4 100644 --- a/src/vs/workbench/electron-sandbox/window.ts +++ b/src/vs/workbench/electron-sandbox/window.ts @@ -307,7 +307,7 @@ export class NativeWindow extends Disposable { if (windowConfig.window && typeof windowConfig.window.zoomLevel === 'number') { configuredZoomLevel = windowConfig.window.zoomLevel; - // Leave early if the configured zoom level did not change (https://github.com/Microsoft/vscode/issues/1536) + // Leave early if the configured zoom level did not change (https://github.com/microsoft/vscode/issues/1536) if (this.previousConfiguredZoomLevel === configuredZoomLevel) { return; } diff --git a/src/vs/workbench/services/contextmenu/electron-sandbox/contextmenuService.ts b/src/vs/workbench/services/contextmenu/electron-sandbox/contextmenuService.ts index 861d178a11b..2ea6e902612 100644 --- a/src/vs/workbench/services/contextmenu/electron-sandbox/contextmenuService.ts +++ b/src/vs/workbench/services/contextmenu/electron-sandbox/contextmenuService.ts @@ -168,7 +168,7 @@ class NativeContextMenuService extends Disposable implements IContextMenuService // To preserve pre-electron-2.x behaviour, we first trigger // the onHide callback and then the action. - // Fixes https://github.com/Microsoft/vscode/issues/45601 + // Fixes https://github.com/microsoft/vscode/issues/45601 onHide(); // Run action which will close the menu diff --git a/src/vs/workbench/services/editor/browser/editorService.ts b/src/vs/workbench/services/editor/browser/editorService.ts index be65afb3a83..f77babe9411 100644 --- a/src/vs/workbench/services/editor/browser/editorService.ts +++ b/src/vs/workbench/services/editor/browser/editorService.ts @@ -344,7 +344,7 @@ export class EditorService extends Disposable implements EditorServiceImpl { } // We have received reports of users seeing delete events even though the file still - // exists (network shares issue: https://github.com/Microsoft/vscode/issues/13665). + // exists (network shares issue: https://github.com/microsoft/vscode/issues/13665). // Since we do not want to close an editor without reason, we have to check if the // file is really gone and not just a faulty file event. // This only applies to external file events, so we need to check for the isExternal diff --git a/src/vs/workbench/services/extensions/electron-browser/extensionService.ts b/src/vs/workbench/services/extensions/electron-browser/extensionService.ts index 4e8ba098202..e8ae25e7800 100644 --- a/src/vs/workbench/services/extensions/electron-browser/extensionService.ts +++ b/src/vs/workbench/services/extensions/electron-browser/extensionService.ts @@ -132,7 +132,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten // extension host more (LifecyclePhase.Restored) because // some editors require the extension host to restore // and this would result in a deadlock - // see https://github.com/Microsoft/vscode/issues/41322 + // see https://github.com/microsoft/vscode/issues/41322 this._lifecycleService.when(LifecyclePhase.Ready).then(() => { // reschedule to ensure this runs after restoring viewlets, panels, and editors runWhenIdle(() => { diff --git a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts index 49542eda74c..4eb8204bf5a 100644 --- a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts +++ b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts @@ -300,7 +300,7 @@ export async function startExtensionHostProcess(): Promise { const renderer = await connectToRenderer(protocol); const { initData } = renderer; // setup things - patchProcess(!!initData.environment.extensionTestsLocationURI); // to support other test frameworks like Jasmin that use process.exit (https://github.com/Microsoft/vscode/issues/37708) + patchProcess(!!initData.environment.extensionTestsLocationURI); // to support other test frameworks like Jasmin that use process.exit (https://github.com/microsoft/vscode/issues/37708) initData.environment.useHostProxy = args.useHostProxy !== undefined ? args.useHostProxy !== 'false' : undefined; // host abstraction diff --git a/src/vs/workbench/services/history/browser/history.ts b/src/vs/workbench/services/history/browser/history.ts index 2e8712e142b..b3d33f213d2 100644 --- a/src/vs/workbench/services/history/browser/history.ts +++ b/src/vs/workbench/services/history/browser/history.ts @@ -136,7 +136,7 @@ export class HistoryService extends Disposable implements IHistoryService { // if the service is created late enough that an editor is already opened // make sure to trigger the onActiveEditorChanged() to track the editor - // properly (fixes https://github.com/Microsoft/vscode/issues/59908) + // properly (fixes https://github.com/microsoft/vscode/issues/59908) if (this.editorService.activeEditorPane) { this.onActiveEditorChanged(); } @@ -596,7 +596,7 @@ export class HistoryService extends Disposable implements IHistoryService { } if (this.layoutService.isRestored() && !this.fileService.canHandleResource(inputResource)) { - return false; // make sure to only check this when workbench has restored (for https://github.com/Microsoft/vscode/issues/48275) + return false; // make sure to only check this when workbench has restored (for https://github.com/microsoft/vscode/issues/48275) } return extUri.isEqual(inputResource, resource); @@ -699,7 +699,7 @@ export class HistoryService extends Disposable implements IHistoryService { // If no editor was opened, try with the next one if (!editorPane) { - // Fix for https://github.com/Microsoft/vscode/issues/67882 + // Fix for https://github.com/microsoft/vscode/issues/67882 // If opening of the editor fails, make sure to try the next one // but make sure to remove this one from the list to prevent // endless loops. @@ -888,7 +888,7 @@ export class HistoryService extends Disposable implements IHistoryService { try { return this.safeLoadHistoryEntry(entry); } catch (error) { - return undefined; // https://github.com/Microsoft/vscode/issues/60960 + return undefined; // https://github.com/microsoft/vscode/issues/60960 } })); } diff --git a/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts b/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts index 855d0ddfd3a..86f63f04b56 100644 --- a/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts +++ b/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts @@ -1016,7 +1016,7 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper { || (keyCode === KeyCode.PageUp) ) { // "Dispatch" on keyCode for these key codes to workaround issues with remote desktoping software - // where the scan codes appear to be incorrect (see https://github.com/Microsoft/vscode/issues/24107) + // where the scan codes appear to be incorrect (see https://github.com/microsoft/vscode/issues/24107) const immutableScanCode = IMMUTABLE_KEY_CODE_TO_CODE[keyCode]; if (immutableScanCode !== -1) { code = immutableScanCode; diff --git a/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts b/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts index 95de5471a40..23ec12fc594 100644 --- a/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts +++ b/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts @@ -503,7 +503,7 @@ export class WindowsKeyboardMapper implements IKeyboardMapper { // See https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx -// See https://github.com/Microsoft/node-native-keymap/blob/master/deps/chromium/keyboard_codes_win.h +// See https://github.com/microsoft/node-native-keymap/blob/master/deps/chromium/keyboard_codes_win.h function _getNativeMap() { return { VK_BACK: KeyCode.Backspace, diff --git a/src/vs/workbench/services/keybinding/test/electron-browser/macLinuxKeyboardMapper.test.ts b/src/vs/workbench/services/keybinding/test/electron-browser/macLinuxKeyboardMapper.test.ts index 4576fec3d30..3f675346f0f 100644 --- a/src/vs/workbench/services/keybinding/test/electron-browser/macLinuxKeyboardMapper.test.ts +++ b/src/vs/workbench/services/keybinding/test/electron-browser/macLinuxKeyboardMapper.test.ts @@ -1318,7 +1318,7 @@ suite('keyboardMapper', () => { ); } - // https://github.com/Microsoft/vscode/issues/24107#issuecomment-292318497 + // https://github.com/microsoft/vscode/issues/24107#issuecomment-292318497 assertKeyboardEvent(KeyCode.UpArrow, 'Lang3', 'UpArrow', 'Up', 'up', '[ArrowUp]'); assertKeyboardEvent(KeyCode.DownArrow, 'NumpadEnter', 'DownArrow', 'Down', 'down', '[ArrowDown]'); assertKeyboardEvent(KeyCode.LeftArrow, 'Convert', 'LeftArrow', 'Left', 'left', '[ArrowLeft]'); @@ -1330,7 +1330,7 @@ suite('keyboardMapper', () => { assertKeyboardEvent(KeyCode.PageDown, 'ControlRight', 'PageDown', 'PageDown', 'pagedown', '[PageDown]'); assertKeyboardEvent(KeyCode.PageUp, 'Lang4', 'PageUp', 'PageUp', 'pageup', '[PageUp]'); - // https://github.com/Microsoft/vscode/issues/24107#issuecomment-292323924 + // https://github.com/microsoft/vscode/issues/24107#issuecomment-292323924 assertKeyboardEvent(KeyCode.PageDown, 'ControlRight', 'PageDown', 'PageDown', 'pagedown', '[PageDown]'); assertKeyboardEvent(KeyCode.PageUp, 'Lang4', 'PageUp', 'PageUp', 'pageup', '[PageUp]'); assertKeyboardEvent(KeyCode.End, '', 'End', 'End', 'end', '[End]'); diff --git a/src/vs/workbench/services/output/electron-browser/outputChannelModelService.ts b/src/vs/workbench/services/output/electron-browser/outputChannelModelService.ts index be7708a7185..5620ed98ca1 100644 --- a/src/vs/workbench/services/output/electron-browser/outputChannelModelService.ts +++ b/src/vs/workbench/services/output/electron-browser/outputChannelModelService.ts @@ -168,7 +168,7 @@ class DelegatedOutputChannelModel extends Disposable implements IOutputChannelMo const file = resources.joinPath(outputDir, `${id}.log`); outputChannelModel = this.instantiationService.createInstance(OutputChannelBackedByFile, id, modelUri, mimeType, file); } catch (e) { - // Do not crash if spdlog rotating logger cannot be loaded (workaround for https://github.com/Microsoft/vscode/issues/47883) + // Do not crash if spdlog rotating logger cannot be loaded (workaround for https://github.com/microsoft/vscode/issues/47883) this.logService.error(e); this.telemetryService.publicLog2('output.channel.creation.error'); outputChannelModel = this.instantiationService.createInstance(BufferredOutputChannel, modelUri, mimeType); diff --git a/src/vs/workbench/services/progress/browser/progressService.ts b/src/vs/workbench/services/progress/browser/progressService.ts index 89f4eafc97e..597aaf8c80c 100644 --- a/src/vs/workbench/services/progress/browser/progressService.ts +++ b/src/vs/workbench/services/progress/browser/progressService.ts @@ -348,7 +348,7 @@ export class ProgressService extends Disposable implements IProgressService { // full message (inital or update) if (step?.message && options.title) { - titleAndMessage = `${options.title}: ${step.message}`; // always prefix with overall title if we have it (https://github.com/Microsoft/vscode/issues/50932) + titleAndMessage = `${options.title}: ${step.message}`; // always prefix with overall title if we have it (https://github.com/microsoft/vscode/issues/50932) } else { titleAndMessage = options.title || step?.message; } diff --git a/src/vs/workbench/services/search/electron-browser/searchService.ts b/src/vs/workbench/services/search/electron-browser/searchService.ts index cdf3110cbf7..b95e8836e69 100644 --- a/src/vs/workbench/services/search/electron-browser/searchService.ts +++ b/src/vs/workbench/services/search/electron-browser/searchService.ts @@ -62,7 +62,7 @@ export class DiskSearch implements ISearchResultProvider { serverName: 'Search', timeout, args: ['--type=searchService'], - // See https://github.com/Microsoft/vscode/issues/27665 + // See https://github.com/microsoft/vscode/issues/27665 // Pass in fresh execArgv to the forked process such that it doesn't inherit them from `process.execArgv`. // e.g. Launching the extension host process with `--inspect-brk=xxx` and then forking a process from the extension host // results in the forked process inheriting `--inspect-brk=xxx`. diff --git a/src/vs/workbench/services/textfile/browser/textFileService.ts b/src/vs/workbench/services/textfile/browser/textFileService.ts index 79da11af10e..37f9c4dfb05 100644 --- a/src/vs/workbench/services/textfile/browser/textFileService.ts +++ b/src/vs/workbench/services/textfile/browser/textFileService.ts @@ -347,7 +347,7 @@ export abstract class AbstractTextFileService extends Disposable implements ITex // Confirm to overwrite if we have an untitled file with associated file where // the file actually exists on disk and we are instructed to save to that file // path. This can happen if the file was created after the untitled file was opened. - // See https://github.com/Microsoft/vscode/issues/67946 + // See https://github.com/microsoft/vscode/issues/67946 let write: boolean; if (sourceModel instanceof UntitledTextEditorModel && sourceModel.hasAssociatedFilePath && targetExists && this.uriIdentityService.extUri.isEqual(target, toLocalResource(sourceModel.resource, this.environmentService.configuration.remoteAuthority, this.pathService.defaultUriScheme))) { write = await this.confirmOverwrite(target); diff --git a/src/vs/workbench/services/textfile/common/textFileEditorModel.ts b/src/vs/workbench/services/textfile/common/textFileEditorModel.ts index b8b41c83741..a6a60d5883b 100644 --- a/src/vs/workbench/services/textfile/common/textFileEditorModel.ts +++ b/src/vs/workbench/services/textfile/common/textFileEditorModel.ts @@ -141,7 +141,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil let newInOrphanModeValidated: boolean = false; if (newInOrphanModeGuess) { // We have received reports of users seeing delete events even though the file still - // exists (network shares issue: https://github.com/Microsoft/vscode/issues/13665). + // exists (network shares issue: https://github.com/microsoft/vscode/issues/13665). // Since we do not want to mark the model as orphaned, we have to check if the // file is really gone and not just a faulty file event. await timeout(100); @@ -447,7 +447,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil private installModelListeners(model: ITextModel): void { - // See https://github.com/Microsoft/vscode/issues/30189 + // See https://github.com/microsoft/vscode/issues/30189 // This code has been extracted to a different method because it caused a memory leak // where `value` was captured in the content change listener closure scope. @@ -694,7 +694,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil // was triggerd followed by a dispose() operation right after without waiting. Typically we cannot // be disposed if we are dirty, but if we are not dirty, save() and dispose() can still be triggered // one after the other without waiting for the save() to complete. If we are disposed(), we risk - // saving contents to disk that are stale (see https://github.com/Microsoft/vscode/issues/50942). + // saving contents to disk that are stale (see https://github.com/microsoft/vscode/issues/50942). // To fix this issue, we will not store the contents to disk when we got disposed. if (this.isDisposed()) { return; diff --git a/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts b/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts index 316dbdf5510..7da4ac71968 100644 --- a/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts +++ b/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts @@ -151,7 +151,7 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE const resource = model.resource; if (extUri.isEqualOrParent(resource, target)) { - // EXPLICITLY do not ignorecase, see https://github.com/Microsoft/vscode/issues/56384 + // EXPLICITLY do not ignorecase, see https://github.com/microsoft/vscode/issues/56384 targetModels.push(model); } diff --git a/src/vs/workbench/services/timer/browser/timerService.ts b/src/vs/workbench/services/timer/browser/timerService.ts index f7e60ff8f31..e60685ebd95 100644 --- a/src/vs/workbench/services/timer/browser/timerService.ts +++ b/src/vs/workbench/services/timer/browser/timerService.ts @@ -98,7 +98,7 @@ export interface IStartupMetrics { readonly didUseCachedData: boolean; /** - * How/why the window was created. See https://github.com/Microsoft/vscode/blob/d1f57d871722f4d6ba63e4ef6f06287121ceb045/src/vs/platform/lifecycle/common/lifecycle.ts#L50 + * How/why the window was created. See https://github.com/microsoft/vscode/blob/d1f57d871722f4d6ba63e4ef6f06287121ceb045/src/vs/platform/lifecycle/common/lifecycle.ts#L50 */ readonly windowKind: number; diff --git a/src/vs/workbench/test/browser/parts/editor/editorGroups.test.ts b/src/vs/workbench/test/browser/parts/editor/editorGroups.test.ts index 5c399799eaf..a06dce40d02 100644 --- a/src/vs/workbench/test/browser/parts/editor/editorGroups.test.ts +++ b/src/vs/workbench/test/browser/parts/editor/editorGroups.test.ts @@ -1513,7 +1513,7 @@ suite('Workbench editor groups', () => { assert.ok(group1Listener.disposed[1].matches(input3)); }); - test('Preview tab does not have a stable position (https://github.com/Microsoft/vscode/issues/8245)', function () { + test('Preview tab does not have a stable position (https://github.com/microsoft/vscode/issues/8245)', function () { const group1 = createGroup(); const input1 = input(); diff --git a/test/smoke/Audit.md b/test/smoke/Audit.md index 2503fcdc35d..4ec76567e9c 100644 --- a/test/smoke/Audit.md +++ b/test/smoke/Audit.md @@ -1,13 +1,13 @@ # VS Code Smoke Tests Failures History This file contains a history of smoke test failures which could be avoided if particular techniques were used in the test (e.g. binding test elements with HTML5 `data-*` attribute). -To better understand what can be employed in smoke test to ensure its stability, it is important to understand patterns that led to smoke test breakage. This markdown is a result of work on [this issue](https://github.com/Microsoft/vscode/issues/27906). +To better understand what can be employed in smoke test to ensure its stability, it is important to understand patterns that led to smoke test breakage. This markdown is a result of work on [this issue](https://github.com/microsoft/vscode/issues/27906). # Log 1. This following change led to the smoke test failure because DOM element's attribute `a[title]` was changed: - [eac49a3](https://github.com/Microsoft/vscode/commit/eac49a321b84cb9828430e9dcd3f34243a3480f7) + [eac49a3](https://github.com/microsoft/vscode/commit/eac49a321b84cb9828430e9dcd3f34243a3480f7) This attribute was used in the smoke test to grab the contents of SCM part in status bar: - [0aec2d6](https://github.com/Microsoft/vscode/commit/0aec2d6838b5e65cc74c33b853ffbd9fa191d636) + [0aec2d6](https://github.com/microsoft/vscode/commit/0aec2d6838b5e65cc74c33b853ffbd9fa191d636) -2. To be continued... \ No newline at end of file +2. To be continued... diff --git a/test/smoke/src/main.ts b/test/smoke/src/main.ts index 51c085de716..6bd6204c6e5 100644 --- a/test/smoke/src/main.ts +++ b/test/smoke/src/main.ts @@ -64,7 +64,7 @@ const opts = minimist(args, { } }); -const testRepoUrl = 'https://github.com/Microsoft/vscode-smoketest-express'; +const testRepoUrl = 'https://github.com/microsoft/vscode-smoketest-express'; const workspacePath = path.join(testDataPath, 'vscode-smoketest-express'); const extensionsPath = path.join(testDataPath, 'extensions-dir'); mkdirp.sync(extensionsPath); From 85c800158e9febbcd0eba704414dcf34fc57b574 Mon Sep 17 00:00:00 2001 From: ChaseKnowlden Date: Tue, 15 Sep 2020 19:34:12 -0400 Subject: [PATCH 0067/1667] more capital fixes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fb5d6bcd508..e1e9290d277 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Visual Studio Code - Open Source ("Code - OSS") [![Build Status](https://dev.azure.com/vscode/VSCode/_apis/build/status/VS%20Code?branchName=master)](https://aka.ms/vscode-builds) -[![Feature Requests](https://img.shields.io/github/issues/vscode/feature-request.svg)](https://github.com/microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc) -[![Bugs](https://img.shields.io/github/issues/Microsoft/vscode/bug.svg)](https://github.com/microsoft/vscode/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3Abug) +[![Feature Requests](https://img.shields.io/github/issues/microsoft/vscode/feature-request.svg)](https://github.com/microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc) +[![Bugs](https://img.shields.io/github/issues/microsoft/vscode/bug.svg)](https://github.com/microsoft/vscode/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3Abug) [![Gitter](https://img.shields.io/badge/chat-on%20gitter-yellow.svg)](https://gitter.im/Microsoft/vscode) ## The Repository From 1273f7e1b734bc3707c2a300d8811f42a87cc873 Mon Sep 17 00:00:00 2001 From: ChaseKnowlden Date: Wed, 16 Sep 2020 14:43:12 -0400 Subject: [PATCH 0068/1667] fix m --- .../extensionManagement/test/common/configRemotes.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/platform/extensionManagement/test/common/configRemotes.test.ts b/src/vs/platform/extensionManagement/test/common/configRemotes.test.ts index cde1c634ac1..c5ed11d8e1b 100644 --- a/src/vs/platform/extensionManagement/test/common/configRemotes.test.ts +++ b/src/vs/platform/extensionManagement/test/common/configRemotes.test.ts @@ -62,7 +62,7 @@ suite('Config Remotes', () => { assert.deepStrictEqual(getRemotes(remote('https://example3.com:1234/username/repository.git')), ['example3.com/username/repository.git']); // Strip .git - assert.deepStrictEqual(getRemotes(remote('https://github.com/microsoft/vscode.git'), true), ['github.com/icrosoft/vscode']); + assert.deepStrictEqual(getRemotes(remote('https://github.com/microsoft/vscode.git'), true), ['github.com/microsoft/vscode']); assert.deepStrictEqual(getRemotes(remote('https://git.example.com/gitproject.git'), true), ['git.example.com/gitproject']); assert.deepStrictEqual(getRemotes(remote('https://username@github2.com/username/repository.git'), true), ['github2.com/username/repository']); assert.deepStrictEqual(getRemotes(remote('https://username:password@github3.com/username/repository.git'), true), ['github3.com/username/repository']); From 9da1f82a39b988f15313d85c1c860e6c902567ac Mon Sep 17 00:00:00 2001 From: ChaseKnowlden Date: Wed, 16 Sep 2020 14:47:16 -0400 Subject: [PATCH 0069/1667] add github.com link --- ThirdPartyNotices.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThirdPartyNotices.txt b/ThirdPartyNotices.txt index 082419f207c..bf0005f520b 100644 --- a/ThirdPartyNotices.txt +++ b/ThirdPartyNotices.txt @@ -38,7 +38,7 @@ This project incorporates components from the projects listed below. The origina 31. MagicStack/MagicPython version 1.1.1 (https://github.com/MagicStack/MagicPython) 32. marked version 0.6.2 (https://github.com/markedjs/marked) 33. mdn-data version 1.1.12 (https://github.com/mdn/data) -34. microsoft/TypeScript-TmLanguage version 0.0.1 (https://microsoft/TypeScript-TmLanguage) +34. microsoft/TypeScript-TmLanguage version 0.0.1 (https://github.com/microsoft/TypeScript-TmLanguage) 35. microsoft/vscode-JSON.tmLanguage (https://github.com/microsoft/vscode-JSON.tmLanguage) 36. microsoft/vscode-mssql version 1.9.0 (https://github.com/microsoft/vscode-mssql) 37. mmims/language-batchfile version 0.7.5 (https://github.com/mmims/language-batchfile) From 8c91bd827848f1710d055c39d80d04c59bb55463 Mon Sep 17 00:00:00 2001 From: ChaseKnowlden Date: Wed, 16 Sep 2020 15:00:00 -0400 Subject: [PATCH 0070/1667] Fix Unnecessary change --- extensions/json-language-features/CONTRIBUTING.md | 1 - 1 file changed, 1 deletion(-) diff --git a/extensions/json-language-features/CONTRIBUTING.md b/extensions/json-language-features/CONTRIBUTING.md index 7203d02e6f2..ecb606d9bff 100644 --- a/extensions/json-language-features/CONTRIBUTING.md +++ b/extensions/json-language-features/CONTRIBUTING.md @@ -36,4 +36,3 @@ However, within this extension, you can run a development version of `vscode-jso - Open both `vscode-json-languageservice` and this extension in a single workspace with [multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) feature - Run `yarn watch` at `json-languagefeatures/server/` to recompile this extension with the linked version of `vscode-json-languageservice` - Make some changes in `vscode-json-languageservice` -- Now when you run `Launch Extension` debug target, the launched instance will use your development version of `vscode-json-languageservice`. You can interactively test the language features. From f65e2fbd80234449d7abf8f15ee880d894a03b9a Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 11:50:53 +0200 Subject: [PATCH 0071/1667] sandbox - make common/process fit for sandbox --- src/vs/base/common/process.ts | 34 ++++++++++++++----- .../parts/sandbox/electron-browser/preload.js | 21 ++++++++++++ .../parts/sandbox/electron-sandbox/globals.ts | 26 ++++++++++---- .../electron-sandbox/extensionTipsService.ts | 12 +++---- 4 files changed, 72 insertions(+), 21 deletions(-) diff --git a/src/vs/base/common/process.ts b/src/vs/base/common/process.ts index bd23d743d3e..1513edad802 100644 --- a/src/vs/base/common/process.ts +++ b/src/vs/base/common/process.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { isWindows, isMacintosh, setImmediate, IProcessEnvironment } from 'vs/base/common/platform'; +import { isWindows, isMacintosh, setImmediate, IProcessEnvironment, globals } from 'vs/base/common/platform'; -interface IProcess { - platform: string; +export interface IProcess { + platform: 'win32' | 'linux' | 'darwin'; env: IProcessEnvironment; cwd(): string; @@ -14,12 +14,28 @@ interface IProcess { } declare const process: IProcess; -const safeProcess: IProcess = (typeof process === 'undefined') ? { - cwd(): string { return '/'; }, - env: Object.create(null), - get platform(): string { return isWindows ? 'win32' : isMacintosh ? 'darwin' : 'linux'; }, - nextTick(callback: (...args: any[]) => void): void { return setImmediate(callback); } -} : process; + +let safeProcess: IProcess; + +// Native node.js environment +if (typeof process !== 'undefined') { + safeProcess = process; +} + +// Native sandbox environment +else if (typeof globals.vscode !== 'undefined') { + safeProcess = globals.vscode.process; +} + +// Web environment +else { + safeProcess = { + cwd(): string { return '/'; }, + env: Object.create(null), + get platform(): 'win32' | 'linux' | 'darwin' { return isWindows ? 'win32' : isMacintosh ? 'darwin' : 'linux'; }, + nextTick(callback: (...args: any[]) => void): void { return setImmediate(callback); } + }; +} export const cwd = safeProcess.cwd; export const env = safeProcess.env; diff --git a/src/vs/base/parts/sandbox/electron-browser/preload.js b/src/vs/base/parts/sandbox/electron-browser/preload.js index 91735d7d0ce..fd56497a42a 100644 --- a/src/vs/base/parts/sandbox/electron-browser/preload.js +++ b/src/vs/base/parts/sandbox/electron-browser/preload.js @@ -115,6 +115,27 @@ return this._whenEnvResolved; }, + nextTick: + /** + * Adds callback to the "next tick queue". This queue is fully drained + * after the current operation on the JavaScript stack runs to completion + * and before the event loop is allowed to continue. + * + * @param {Function} callback + * @param {any[]} args + */ + function nextTick(callback, ...args) { + return process.nextTick(callback, ...args); + }, + + cwd: + /** + * @returns the current working directory. + */ + function () { + return process.cwd(); + }, + getProcessMemoryInfo: /** * @returns {Promise} diff --git a/src/vs/base/parts/sandbox/electron-sandbox/globals.ts b/src/vs/base/parts/sandbox/electron-sandbox/globals.ts index 0b3a1f205a0..194b5746da6 100644 --- a/src/vs/base/parts/sandbox/electron-sandbox/globals.ts +++ b/src/vs/base/parts/sandbox/electron-sandbox/globals.ts @@ -3,9 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ProcessMemoryInfo } from 'vs/base/parts/sandbox/common/electronTypes'; +import type { ProcessMemoryInfo } from 'vs/base/parts/sandbox/common/electronTypes'; +import type { IProcess } from 'vs/base/common/process'; +import { globals } from 'vs/base/common/platform'; -export const ipcRenderer = (window as any).vscode.ipcRenderer as { +export const ipcRenderer = globals.vscode.ipcRenderer as { /** * Listens to `channel`, when a new message arrives `listener` would be called with @@ -41,7 +43,7 @@ export const ipcRenderer = (window as any).vscode.ipcRenderer as { send(channel: string, ...args: any[]): void; }; -export const webFrame = (window as any).vscode.webFrame as { +export const webFrame = globals.vscode.webFrame as { /** * Changes the zoom level to the specified level. The original size is 0 and each @@ -51,7 +53,7 @@ export const webFrame = (window as any).vscode.webFrame as { setZoomLevel(level: number): void; }; -export const crashReporter = (window as any).vscode.crashReporter as { +export const crashReporter = globals.vscode.crashReporter as { /** * Set an extra parameter to be sent with the crash report. The values specified @@ -73,7 +75,7 @@ export const crashReporter = (window as any).vscode.crashReporter as { addExtraParameter(key: string, value: string): void; }; -export const process = (window as any).vscode.process as { +export const process = globals.vscode.process as IProcess & { /** * The process.platform property returns a string identifying the operating system platform @@ -86,12 +88,24 @@ export const process = (window as any).vscode.process as { */ env: { [key: string]: string | undefined }; + /** + * The current working directory. + */ + cwd(): string; + /** * Allows to await resolving the full process environment by checking for the shell environment * of the OS in certain cases (e.g. when the app is started from the Dock on macOS). */ whenEnvResolved(): Promise; + /** + * Adds callback to the "next tick queue". This queue is fully drained + * after the current operation on the JavaScript stack runs to completion + * and before the event loop is allowed to continue. + */ + nextTick(callback: (...args: any[]) => void, ...args: any[]): void; + /** * A listener on the process. Only a small subset of listener types are allowed. */ @@ -118,7 +132,7 @@ export const process = (window as any).vscode.process as { versions: { [key: string]: string | undefined }; }; -export const context = (window as any).vscode.context as { +export const context = globals.vscode.context as { /** * Wether the renderer runs with `sandbox` enabled or not. diff --git a/src/vs/platform/extensionManagement/electron-sandbox/extensionTipsService.ts b/src/vs/platform/extensionManagement/electron-sandbox/extensionTipsService.ts index 654ec69b7ea..273704b6081 100644 --- a/src/vs/platform/extensionManagement/electron-sandbox/extensionTipsService.ts +++ b/src/vs/platform/extensionManagement/electron-sandbox/extensionTipsService.ts @@ -7,7 +7,7 @@ import { URI } from 'vs/base/common/uri'; import { join, } from 'vs/base/common/path'; import { IProductService } from 'vs/platform/product/common/productService'; import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; -import { env as processEnv } from 'vs/base/common/process'; +import { process } from 'vs/base/parts/sandbox/electron-sandbox/globals'; import { IFileService } from 'vs/platform/files/common/files'; import { isWindows } from 'vs/base/common/platform'; import { isNonEmptyArray } from 'vs/base/common/arrays'; @@ -80,11 +80,11 @@ export class ExtensionTipsService extends BaseExtensionTipsService { const exePaths: string[] = []; if (isWindows) { if (extensionTip.windowsPath) { - exePaths.push(extensionTip.windowsPath.replace('%USERPROFILE%', processEnv['USERPROFILE']!) - .replace('%ProgramFiles(x86)%', processEnv['ProgramFiles(x86)']!) - .replace('%ProgramFiles%', processEnv['ProgramFiles']!) - .replace('%APPDATA%', processEnv['APPDATA']!) - .replace('%WINDIR%', processEnv['WINDIR']!)); + exePaths.push(extensionTip.windowsPath.replace('%USERPROFILE%', process.env['USERPROFILE']!) + .replace('%ProgramFiles(x86)%', process.env['ProgramFiles(x86)']!) + .replace('%ProgramFiles%', process.env['ProgramFiles']!) + .replace('%APPDATA%', process.env['APPDATA']!) + .replace('%WINDIR%', process.env['WINDIR']!)); } } else { exePaths.push(join('/usr/local/bin', exeName)); From 76b73311624e1ce8c3cdc79273c60be8ac4c98f8 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 12:30:59 +0200 Subject: [PATCH 0072/1667] sandbox - make platform.ts fit for sandbox usages --- src/vs/base/common/platform.ts | 47 +++++++++++++------ src/vs/base/common/process.ts | 25 +++++----- .../parts/sandbox/electron-browser/preload.js | 17 +++++-- .../parts/sandbox/electron-sandbox/globals.ts | 27 +++++++---- .../sandbox.simpleservices.ts | 2 +- 5 files changed, 76 insertions(+), 42 deletions(-) diff --git a/src/vs/base/common/platform.ts b/src/vs/base/common/platform.ts index 0bbc5d6ef91..3361d83be5b 100644 --- a/src/vs/base/common/platform.ts +++ b/src/vs/base/common/platform.ts @@ -26,15 +26,16 @@ export interface IProcessEnvironment { [key: string]: string; } -interface INodeProcess { - platform: string; +export interface INodeProcess { + platform: 'win32' | 'linux' | 'darwin'; env: IProcessEnvironment; - getuid(): number; nextTick: Function; versions?: { electron?: string; }; type?: string; + getuid(): number; + cwd(): string; } declare const process: INodeProcess; declare const global: any; @@ -47,9 +48,20 @@ interface INavigator { declare const navigator: INavigator; declare const self: any; -const isElectronRenderer = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions.electron !== 'undefined' && process.type === 'renderer'); +const _globals = (typeof self === 'object' ? self : typeof global === 'object' ? global : {} as any); -// OS detection +let nodeProcess: INodeProcess | undefined = undefined; +if (typeof process !== 'undefined') { + // Native environment (non-sandboxed) + nodeProcess = process; +} else if (typeof _globals.vscode !== 'undefined') { + // Native envionment (sandboxed) + nodeProcess = _globals.vscode.process; +} + +const isElectronRenderer = typeof nodeProcess?.versions?.electron === 'string' && nodeProcess.type === 'renderer'; + +// Web environment if (typeof navigator === 'object' && !isElectronRenderer) { _userAgent = navigator.userAgent; _isWindows = _userAgent.indexOf('Windows') >= 0; @@ -59,13 +71,16 @@ if (typeof navigator === 'object' && !isElectronRenderer) { _isWeb = true; _locale = navigator.language; _language = _locale; -} else if (typeof process === 'object') { - _isWindows = (process.platform === 'win32'); - _isMacintosh = (process.platform === 'darwin'); - _isLinux = (process.platform === 'linux'); +} + +// Native environment +else if (typeof nodeProcess === 'object') { + _isWindows = (nodeProcess.platform === 'win32'); + _isMacintosh = (nodeProcess.platform === 'darwin'); + _isLinux = (nodeProcess.platform === 'linux'); _locale = LANGUAGE_DEFAULT; _language = LANGUAGE_DEFAULT; - const rawNlsConfig = process.env['VSCODE_NLS_CONFIG']; + const rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG']; if (rawNlsConfig) { try { const nlsConfig: NLSConfig = JSON.parse(rawNlsConfig); @@ -80,6 +95,11 @@ if (typeof navigator === 'object' && !isElectronRenderer) { _isNative = true; } +// Unknown environment +else { + console.error('Unable to resolve platform.'); +} + export const enum Platform { Web, Mac, @@ -114,7 +134,7 @@ export const platform = _platform; export const userAgent = _userAgent; export function isRootUser(): boolean { - return _isNative && !_isWindows && (process.getuid() === 0); + return !!nodeProcess && !_isWindows && (nodeProcess.getuid() === 0); } /** @@ -157,7 +177,6 @@ export const locale = _locale; */ export const translationsConfigFile = _translationsConfigFile; -const _globals = (typeof self === 'object' ? self : typeof global === 'object' ? global : {} as any); export const globals: any = _globals; interface ISetImmediate { @@ -196,8 +215,8 @@ export const setImmediate: ISetImmediate = (function defineSetImmediate() { globals.postMessage({ vscodeSetImmediateId: myId }, '*'); }; } - if (typeof process !== 'undefined' && typeof process.nextTick === 'function') { - return process.nextTick.bind(process); + if (nodeProcess) { + return nodeProcess.nextTick.bind(nodeProcess); } const _promise = Promise.resolve(); return (callback: (...args: any[]) => void) => _promise.then(callback); diff --git a/src/vs/base/common/process.ts b/src/vs/base/common/process.ts index 1513edad802..5e85d672116 100644 --- a/src/vs/base/common/process.ts +++ b/src/vs/base/common/process.ts @@ -3,19 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { isWindows, isMacintosh, setImmediate, IProcessEnvironment, globals } from 'vs/base/common/platform'; +import { isWindows, isMacintosh, setImmediate, globals, INodeProcess } from 'vs/base/common/platform'; -export interface IProcess { - platform: 'win32' | 'linux' | 'darwin'; - env: IProcessEnvironment; +declare const process: INodeProcess; - cwd(): string; - nextTick(callback: (...args: any[]) => void): void; -} - -declare const process: IProcess; - -let safeProcess: IProcess; +let safeProcess: INodeProcess; // Native node.js environment if (typeof process !== 'undefined') { @@ -30,10 +22,15 @@ else if (typeof globals.vscode !== 'undefined') { // Web environment else { safeProcess = { - cwd(): string { return '/'; }, - env: Object.create(null), + + // Supported get platform(): 'win32' | 'linux' | 'darwin' { return isWindows ? 'win32' : isMacintosh ? 'darwin' : 'linux'; }, - nextTick(callback: (...args: any[]) => void): void { return setImmediate(callback); } + nextTick(callback: (...args: any[]) => void): void { return setImmediate(callback); }, + + // Unsupported + get env() { return Object.create(null); }, + cwd(): string { return '/'; }, + getuid(): number { return -1; } }; } diff --git a/src/vs/base/parts/sandbox/electron-browser/preload.js b/src/vs/base/parts/sandbox/electron-browser/preload.js index fd56497a42a..9be3747b0a8 100644 --- a/src/vs/base/parts/sandbox/electron-browser/preload.js +++ b/src/vs/base/parts/sandbox/electron-browser/preload.js @@ -98,9 +98,10 @@ * Support for a subset of access to node.js global `process`. */ process: { - platform: process.platform, - env: process.env, - versions: process.versions, + get platform() { return process.platform; }, + get env() { return process.env; }, + get versions() { return process.versions; }, + get type() { return 'renderer'; }, _whenEnvResolved: undefined, whenEnvResolved: @@ -136,6 +137,14 @@ return process.cwd(); }, + getuid: + /** + * @returns the numeric user identity of the process + */ + function () { + return process.getuid(); + }, + getProcessMemoryInfo: /** * @returns {Promise} @@ -160,7 +169,7 @@ * Some information about the context we are running in. */ context: { - sandbox: process.argv.includes('--enable-sandbox') + get sandbox() { return process.argv.includes('--enable-sandbox'); } } }; diff --git a/src/vs/base/parts/sandbox/electron-sandbox/globals.ts b/src/vs/base/parts/sandbox/electron-sandbox/globals.ts index 194b5746da6..0fc95f894ff 100644 --- a/src/vs/base/parts/sandbox/electron-sandbox/globals.ts +++ b/src/vs/base/parts/sandbox/electron-sandbox/globals.ts @@ -4,8 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import type { ProcessMemoryInfo } from 'vs/base/parts/sandbox/common/electronTypes'; -import type { IProcess } from 'vs/base/common/process'; -import { globals } from 'vs/base/common/platform'; +import { globals, INodeProcess } from 'vs/base/common/platform'; export const ipcRenderer = globals.vscode.ipcRenderer as { @@ -75,7 +74,7 @@ export const crashReporter = globals.vscode.crashReporter as { addExtraParameter(key: string, value: string): void; }; -export const process = globals.vscode.process as IProcess & { +export const process = globals.vscode.process as INodeProcess & { /** * The process.platform property returns a string identifying the operating system platform @@ -84,7 +83,17 @@ export const process = globals.vscode.process as IProcess & { platform: 'win32' | 'linux' | 'darwin'; /** - * The process.env property returns an object containing the user environment. See environ(7). + * The type will always be Electron renderer. + */ + type: 'renderer'; + + /** + * A list of versions for the current node.js/electron configuration. + */ + versions: { [key: string]: string | undefined }; + + /** + * The process.env property returns an object containing the user environment. */ env: { [key: string]: string | undefined }; @@ -93,6 +102,11 @@ export const process = globals.vscode.process as IProcess & { */ cwd(): string; + /** + * Returns the numeric user identity of the process. + */ + getuid(): number; + /** * Allows to await resolving the full process environment by checking for the shell environment * of the OS in certain cases (e.g. when the app is started from the Dock on macOS). @@ -125,11 +139,6 @@ export const process = globals.vscode.process as IProcess & { * process on macOS. */ getProcessMemoryInfo: () => Promise; - - /** - * A list of versions for the current node.js/electron configuration. - */ - versions: { [key: string]: string | undefined }; }; export const context = globals.vscode.context as { diff --git a/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts b/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts index d6f8e16fbf7..0872bd69433 100644 --- a/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts +++ b/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts @@ -91,6 +91,7 @@ export class SimpleWorkbenchEnvironmentService implements INativeWorkbenchEnviro get userDataSyncHome(): URI { return joinPath(this.userRoamingDataHome, 'syncHome'); } get tmpDir(): URI { return joinPath(this.userRoamingDataHome, 'tmp'); } get backupWorkspaceHome(): URI { return joinPath(this.userRoamingDataHome, 'Backups', 'workspace'); } + get logsPath(): string { return joinPath(this.userRoamingDataHome, 'logs').path; } options?: IWorkbenchConstructionOptions | undefined; logExtensionHostCommunication?: boolean | undefined; @@ -107,7 +108,6 @@ export class SimpleWorkbenchEnvironmentService implements INativeWorkbenchEnviro disableExtensions: boolean | string[] = []; extensionDevelopmentLocationURI?: URI[] | undefined; extensionTestsLocationURI?: URI | undefined; - logsPath: string = undefined!; logLevel?: string | undefined; args: NativeParsedArgs = Object.create(null); From 99b13b8fbfea262f03d4ec818c857003b463c7b2 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 12:45:22 +0200 Subject: [PATCH 0073/1667] sandbox - update electron types --- .../base/parts/sandbox/common/electronTypes.ts | 16 ++++++++++------ .../parts/sandbox/electron-browser/preload.js | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/vs/base/parts/sandbox/common/electronTypes.ts b/src/vs/base/parts/sandbox/common/electronTypes.ts index bfd996a31da..e67112f5122 100644 --- a/src/vs/base/parts/sandbox/common/electronTypes.ts +++ b/src/vs/base/parts/sandbox/common/electronTypes.ts @@ -7,7 +7,7 @@ // ####################################################################### // ### ### // ### electron.d.ts types we need in a common layer for reuse ### -// ### (copied from Electron 7.x) ### +// ### (copied from Electron 9.x) ### // ### ### // ####################################################################### @@ -132,6 +132,7 @@ export interface SaveDialogOptions { * @platform darwin */ showsTagField?: boolean; + properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>; /** * Create a security scoped bookmark when packaged for the Mac App Store. If this * option is enabled and the file doesn't already exist a blank file will be @@ -155,7 +156,7 @@ export interface OpenDialogOptions { * Contains which features the dialog should use. The following values are * supported: */ - properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory'>; + properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>; /** * Message to display above input boxes. * @@ -222,11 +223,11 @@ export interface InputEvent { // Docs: http://electronjs.org/docs/api/structures/input-event /** - * An array of modifiers of the event, can be `shift`, `control`, `alt`, `meta`, - * `isKeypad`, `isAutoRepeat`, `leftButtonDown`, `middleButtonDown`, - * `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`. + * An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`, + * `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`, + * `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`. */ - modifiers: Array<'shift' | 'control' | 'alt' | 'meta' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right'>; + modifiers?: Array<'shift' | 'control' | 'ctrl' | 'alt' | 'meta' | 'command' | 'cmd' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right'>; } export interface MouseInputEvent extends InputEvent { @@ -311,6 +312,9 @@ export interface CrashReporterStartOptions { } export interface ProcessMemoryInfo { + + // Docs: http://electronjs.org/docs/api/structures/process-memory-info + /** * The amount of memory not shared by other processes, such as JS heap or HTML * content in Kilobytes. diff --git a/src/vs/base/parts/sandbox/electron-browser/preload.js b/src/vs/base/parts/sandbox/electron-browser/preload.js index 9be3747b0a8..d0cb6d4286b 100644 --- a/src/vs/base/parts/sandbox/electron-browser/preload.js +++ b/src/vs/base/parts/sandbox/electron-browser/preload.js @@ -12,6 +12,7 @@ // ####################################################################### // ### ### // ### !!! DO NOT USE GET/SET PROPERTIES ANYWHERE HERE !!! ### + // ### !!! UNLESS THE ACCESS IS WITHOUT SIDE EFFECTS !!! ### // ### (https://github.com/electron/electron/issues/25516) ### // ### ### // ####################################################################### From b03e0cb72fda78f6b545b93900244576b782dc4b Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Thu, 17 Sep 2020 11:46:11 +0200 Subject: [PATCH 0074/1667] revert line deletion in json CONTRIBUTING --- extensions/json-language-features/CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/json-language-features/CONTRIBUTING.md b/extensions/json-language-features/CONTRIBUTING.md index ecb606d9bff..7203d02e6f2 100644 --- a/extensions/json-language-features/CONTRIBUTING.md +++ b/extensions/json-language-features/CONTRIBUTING.md @@ -36,3 +36,4 @@ However, within this extension, you can run a development version of `vscode-jso - Open both `vscode-json-languageservice` and this extension in a single workspace with [multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) feature - Run `yarn watch` at `json-languagefeatures/server/` to recompile this extension with the linked version of `vscode-json-languageservice` - Make some changes in `vscode-json-languageservice` +- Now when you run `Launch Extension` debug target, the launched instance will use your development version of `vscode-json-languageservice`. You can interactively test the language features. From 567eb97c83bae22a16c92b4a3e786a8b4a845130 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 13:11:00 +0200 Subject: [PATCH 0075/1667] sandbox - move some types to electronTypes --- .../parts/sandbox/common/electronTypes.ts | 81 --------- .../sandbox/electron-sandbox/electronTypes.ts | 159 ++++++++++++++++++ .../parts/sandbox/electron-sandbox/globals.ts | 88 ++-------- .../localProcessExtensionHost.ts | 2 +- 4 files changed, 173 insertions(+), 157 deletions(-) create mode 100644 src/vs/base/parts/sandbox/electron-sandbox/electronTypes.ts diff --git a/src/vs/base/parts/sandbox/common/electronTypes.ts b/src/vs/base/parts/sandbox/common/electronTypes.ts index e67112f5122..cff3caccfaf 100644 --- a/src/vs/base/parts/sandbox/common/electronTypes.ts +++ b/src/vs/base/parts/sandbox/common/electronTypes.ts @@ -251,84 +251,3 @@ export interface MouseInputEvent extends InputEvent { x: number; y: number; } - -export interface CrashReporterStartOptions { - /** - * URL that crash reports will be sent to as POST. - */ - submitURL: string; - /** - * Defaults to `app.name`. - */ - productName?: string; - /** - * Deprecated alias for `{ globalExtra: { _companyName: ... } }`. - * - * @deprecated - */ - companyName?: string; - /** - * Whether crash reports should be sent to the server. If false, crash reports will - * be collected and stored in the crashes directory, but not uploaded. Default is - * `true`. - */ - uploadToServer?: boolean; - /** - * If true, crashes generated in the main process will not be forwarded to the - * system crash handler. Default is `false`. - */ - ignoreSystemCrashHandler?: boolean; - /** - * If true, limit the number of crashes uploaded to 1/hour. Default is `false`. - * - * @platform darwin,win32 - */ - rateLimit?: boolean; - /** - * If true, crash reports will be compressed and uploaded with `Content-Encoding: - * gzip`. Not all collection servers support compressed payloads. Default is - * `false`. - * - * @platform darwin,win32 - */ - compress?: boolean; - /** - * Extra string key/value annotations that will be sent along with crash reports - * that are generated in the main process. Only string values are supported. - * Crashes generated in child processes will not contain these extra parameters to - * crash reports generated from child processes, call `addExtraParameter` from the - * child process. - */ - extra?: Record; - /** - * Extra string key/value annotations that will be sent along with any crash - * reports generated in any process. These annotations cannot be changed once the - * crash reporter has been started. If a key is present in both the global extra - * parameters and the process-specific extra parameters, then the global one will - * take precedence. By default, `productName` and the app version are included, as - * well as the Electron version. - */ - globalExtra?: Record; -} - -export interface ProcessMemoryInfo { - - // Docs: http://electronjs.org/docs/api/structures/process-memory-info - - /** - * The amount of memory not shared by other processes, such as JS heap or HTML - * content in Kilobytes. - */ - private: number; - /** - * The amount of memory currently pinned to actual physical RAM in Kilobytes. - * - * @platform linux,win32 - */ - residentSet: number; - /** - * The amount of memory shared between processes, typically memory consumed by the - * Electron code itself in Kilobytes. - */ - shared: number; -} diff --git a/src/vs/base/parts/sandbox/electron-sandbox/electronTypes.ts b/src/vs/base/parts/sandbox/electron-sandbox/electronTypes.ts new file mode 100644 index 00000000000..04ceac3bff6 --- /dev/null +++ b/src/vs/base/parts/sandbox/electron-sandbox/electronTypes.ts @@ -0,0 +1,159 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + + +// ####################################################################### +// ### ### +// ### electron.d.ts types we expose from electron-sandbox ### +// ### (copied from Electron 9.x) ### +// ### ### +// ####################################################################### + + +export interface IpcRenderer { + /** + * Listens to `channel`, when a new message arrives `listener` would be called with + * `listener(event, args...)`. + */ + on(channel: string, listener: (event: unknown, ...args: any[]) => void): void; + + /** + * Adds a one time `listener` function for the event. This `listener` is invoked + * only the next time a message is sent to `channel`, after which it is removed. + */ + once(channel: string, listener: (event: unknown, ...args: any[]) => void): void; + + /** + * Removes the specified `listener` from the listener array for the specified + * `channel`. + */ + removeListener(channel: string, listener: (event: unknown, ...args: any[]) => void): void; + + /** + * Send an asynchronous message to the main process via `channel`, along with + * arguments. Arguments will be serialized with the Structured Clone Algorithm, + * just like `postMessage`, so prototype chains will not be included. Sending + * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception. + * + * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special + * Electron objects is deprecated, and will begin throwing an exception starting + * with Electron 9. + * + * The main process handles it by listening for `channel` with the `ipcMain` + * module. + */ + send(channel: string, ...args: any[]): void; +} + +export interface WebFrame { + /** + * Changes the zoom level to the specified level. The original size is 0 and each + * increment above or below represents zooming 20% larger or smaller to default + * limits of 300% and 50% of original size, respectively. + */ + setZoomLevel(level: number): void; +} + +export interface CrashReporter { + /** + * Set an extra parameter to be sent with the crash report. The values specified + * here will be sent in addition to any values set via the `extra` option when + * `start` was called. + * + * Parameters added in this fashion (or via the `extra` parameter to + * `crashReporter.start`) are specific to the calling process. Adding extra + * parameters in the main process will not cause those parameters to be sent along + * with crashes from renderer or other child processes. Similarly, adding extra + * parameters in a renderer process will not result in those parameters being sent + * with crashes that occur in other renderer processes or in the main process. + * + * **Note:** Parameters have limits on the length of the keys and values. Key names + * must be no longer than 39 bytes, and values must be no longer than 127 bytes. + * Keys with names longer than the maximum will be silently ignored. Key values + * longer than the maximum length will be truncated. + */ + addExtraParameter(key: string, value: string): void; +} + +export interface ProcessMemoryInfo { + + // Docs: http://electronjs.org/docs/api/structures/process-memory-info + + /** + * The amount of memory not shared by other processes, such as JS heap or HTML + * content in Kilobytes. + */ + private: number; + /** + * The amount of memory currently pinned to actual physical RAM in Kilobytes. + * + * @platform linux,win32 + */ + residentSet: number; + /** + * The amount of memory shared between processes, typically memory consumed by the + * Electron code itself in Kilobytes. + */ + shared: number; +} + +export interface CrashReporterStartOptions { + /** + * URL that crash reports will be sent to as POST. + */ + submitURL: string; + /** + * Defaults to `app.name`. + */ + productName?: string; + /** + * Deprecated alias for `{ globalExtra: { _companyName: ... } }`. + * + * @deprecated + */ + companyName?: string; + /** + * Whether crash reports should be sent to the server. If false, crash reports will + * be collected and stored in the crashes directory, but not uploaded. Default is + * `true`. + */ + uploadToServer?: boolean; + /** + * If true, crashes generated in the main process will not be forwarded to the + * system crash handler. Default is `false`. + */ + ignoreSystemCrashHandler?: boolean; + /** + * If true, limit the number of crashes uploaded to 1/hour. Default is `false`. + * + * @platform darwin,win32 + */ + rateLimit?: boolean; + /** + * If true, crash reports will be compressed and uploaded with `Content-Encoding: + * gzip`. Not all collection servers support compressed payloads. Default is + * `false`. + * + * @platform darwin,win32 + */ + compress?: boolean; + /** + * Extra string key/value annotations that will be sent along with crash reports + * that are generated in the main process. Only string values are supported. + * Crashes generated in child processes will not contain these extra parameters to + * crash reports generated from child processes, call `addExtraParameter` from the + * child process. + */ + extra?: Record; + /** + * Extra string key/value annotations that will be sent along with any crash + * reports generated in any process. These annotations cannot be changed once the + * crash reporter has been started. If a key is present in both the global extra + * parameters and the process-specific extra parameters, then the global one will + * take precedence. By default, `productName` and the app version are included, as + * well as the Electron version. + */ + globalExtra?: Record; +} diff --git a/src/vs/base/parts/sandbox/electron-sandbox/globals.ts b/src/vs/base/parts/sandbox/electron-sandbox/globals.ts index 0fc95f894ff..923383b48db 100644 --- a/src/vs/base/parts/sandbox/electron-sandbox/globals.ts +++ b/src/vs/base/parts/sandbox/electron-sandbox/globals.ts @@ -3,78 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { ProcessMemoryInfo } from 'vs/base/parts/sandbox/common/electronTypes'; -import { globals, INodeProcess } from 'vs/base/common/platform'; +import { globals, INodeProcess, IProcessEnvironment } from 'vs/base/common/platform'; +import { ProcessMemoryInfo, CrashReporter, IpcRenderer, WebFrame } from 'vs/base/parts/sandbox/electron-sandbox/electronTypes'; -export const ipcRenderer = globals.vscode.ipcRenderer as { - - /** - * Listens to `channel`, when a new message arrives `listener` would be called with - * `listener(event, args...)`. - */ - on(channel: string, listener: (event: unknown, ...args: any[]) => void): void; - - /** - * Adds a one time `listener` function for the event. This `listener` is invoked - * only the next time a message is sent to `channel`, after which it is removed. - */ - once(channel: string, listener: (event: unknown, ...args: any[]) => void): void; - - /** - * Removes the specified `listener` from the listener array for the specified - * `channel`. - */ - removeListener(channel: string, listener: (event: unknown, ...args: any[]) => void): void; - - /** - * Send an asynchronous message to the main process via `channel`, along with - * arguments. Arguments will be serialized with the Structured Clone Algorithm, - * just like `postMessage`, so prototype chains will not be included. Sending - * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception. - * - * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special - * Electron objects is deprecated, and will begin throwing an exception starting - * with Electron 9. - * - * The main process handles it by listening for `channel` with the `ipcMain` - * module. - */ - send(channel: string, ...args: any[]): void; -}; - -export const webFrame = globals.vscode.webFrame as { - - /** - * Changes the zoom level to the specified level. The original size is 0 and each - * increment above or below represents zooming 20% larger or smaller to default - * limits of 300% and 50% of original size, respectively. - */ - setZoomLevel(level: number): void; -}; - -export const crashReporter = globals.vscode.crashReporter as { - - /** - * Set an extra parameter to be sent with the crash report. The values specified - * here will be sent in addition to any values set via the `extra` option when - * `start` was called. - * - * Parameters added in this fashion (or via the `extra` parameter to - * `crashReporter.start`) are specific to the calling process. Adding extra - * parameters in the main process will not cause those parameters to be sent along - * with crashes from renderer or other child processes. Similarly, adding extra - * parameters in a renderer process will not result in those parameters being sent - * with crashes that occur in other renderer processes or in the main process. - * - * **Note:** Parameters have limits on the length of the keys and values. Key names - * must be no longer than 39 bytes, and values must be no longer than 127 bytes. - * Keys with names longer than the maximum will be silently ignored. Key values - * longer than the maximum length will be truncated. - */ - addExtraParameter(key: string, value: string): void; -}; - -export const process = globals.vscode.process as INodeProcess & { +export interface ISandboxNodeProcess extends INodeProcess { /** * The process.platform property returns a string identifying the operating system platform @@ -95,7 +27,7 @@ export const process = globals.vscode.process as INodeProcess & { /** * The process.env property returns an object containing the user environment. */ - env: { [key: string]: string | undefined }; + env: IProcessEnvironment; /** * The current working directory. @@ -139,12 +71,18 @@ export const process = globals.vscode.process as INodeProcess & { * process on macOS. */ getProcessMemoryInfo: () => Promise; -}; +} -export const context = globals.vscode.context as { +export interface ISandboxContext { /** * Wether the renderer runs with `sandbox` enabled or not. */ sandbox: boolean; -}; +} + +export const ipcRenderer: IpcRenderer = globals.vscode.ipcRenderer; +export const webFrame: WebFrame = globals.vscode.webFrame; +export const crashReporter: CrashReporter = globals.vscode.crashReporter; +export const process: ISandboxNodeProcess = globals.vscode.process; +export const context: ISandboxContext = globals.vscode.context; diff --git a/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts b/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts index eb28be32c1f..120cc71a351 100644 --- a/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts +++ b/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts @@ -6,7 +6,7 @@ import * as nls from 'vs/nls'; import { ChildProcess, fork } from 'child_process'; import { Server, Socket, createServer } from 'net'; -import { CrashReporterStartOptions } from 'vs/base/parts/sandbox/common/electronTypes'; +import { CrashReporterStartOptions } from 'vs/base/parts/sandbox/electron-sandbox/electronTypes'; import { getPathFromAmdModule } from 'vs/base/common/amd'; import { timeout } from 'vs/base/common/async'; import { toErrorMessage } from 'vs/base/common/errorMessage'; From 5bed818ae026649ca8585347ced34df9e52ad562 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Thu, 17 Sep 2020 13:10:57 +0200 Subject: [PATCH 0076/1667] Use lowercase microsoft --- src/vs/platform/product/common/product.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts index c33022d95a9..55567d4b537 100644 --- a/src/vs/platform/product/common/product.ts +++ b/src/vs/platform/product/common/product.ts @@ -26,9 +26,9 @@ if (isWeb || typeof require === 'undefined' || typeof require.__$__nodeRequire ! applicationName: 'code-oss', dataFolderName: '.vscode-oss', urlProtocol: 'code-oss', - reportIssueUrl: 'https://github.com/Microsoft/vscode/issues/new', + reportIssueUrl: 'https://github.com/microsoft/vscode/issues/new', licenseName: 'MIT', - licenseUrl: 'https://github.com/Microsoft/vscode/blob/master/LICENSE.txt', + licenseUrl: 'https://github.com/microsoft/vscode/blob/master/LICENSE.txt', extensionAllowedProposedApi: [ 'ms-vscode.vscode-js-profile-flame', 'ms-vscode.vscode-js-profile-table', From 437260c606ef0ea0404bf25be33d62629b6d2356 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 17 Sep 2020 13:37:26 +0200 Subject: [PATCH 0077/1667] #106934 log error while validating --- src/vs/workbench/browser/web.main.ts | 2 +- .../workbench/electron-browser/desktop.main.ts | 2 +- .../browser/configurationService.ts | 13 +++++++++++-- .../configurationEditingService.test.ts | 2 +- .../configurationService.test.ts | 16 ++++++++-------- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts index 7c13348069a..40d643f7b3e 100644 --- a/src/vs/workbench/browser/web.main.ts +++ b/src/vs/workbench/browser/web.main.ts @@ -296,7 +296,7 @@ class BrowserMain extends Disposable { } private async createWorkspaceService(payload: IWorkspaceInitializationPayload, environmentService: IWorkbenchEnvironmentService, fileService: FileService, remoteAgentService: IRemoteAgentService, logService: ILogService): Promise { - const workspaceService = new WorkspaceService({ remoteAuthority: this.configuration.remoteAuthority, configurationCache: new ConfigurationCache() }, environmentService, fileService, remoteAgentService); + const workspaceService = new WorkspaceService({ remoteAuthority: this.configuration.remoteAuthority, configurationCache: new ConfigurationCache() }, environmentService, fileService, remoteAgentService, logService); try { await workspaceService.initialize(payload); diff --git a/src/vs/workbench/electron-browser/desktop.main.ts b/src/vs/workbench/electron-browser/desktop.main.ts index 222f1487515..4bc5d024dc7 100644 --- a/src/vs/workbench/electron-browser/desktop.main.ts +++ b/src/vs/workbench/electron-browser/desktop.main.ts @@ -287,7 +287,7 @@ class DesktopMain extends Disposable { } private async createWorkspaceService(payload: IWorkspaceInitializationPayload, fileService: FileService, remoteAgentService: IRemoteAgentService, logService: ILogService): Promise { - const workspaceService = new WorkspaceService({ remoteAuthority: this.environmentService.configuration.remoteAuthority, configurationCache: new ConfigurationCache(this.environmentService) }, this.environmentService, fileService, remoteAgentService); + const workspaceService = new WorkspaceService({ remoteAuthority: this.environmentService.configuration.remoteAuthority, configurationCache: new ConfigurationCache(this.environmentService) }, this.environmentService, fileService, remoteAgentService, logService); try { await workspaceService.initialize(payload); diff --git a/src/vs/workbench/services/configuration/browser/configurationService.ts b/src/vs/workbench/services/configuration/browser/configurationService.ts index fb63eeb6fa8..9648a6f5124 100644 --- a/src/vs/workbench/services/configuration/browser/configurationService.ts +++ b/src/vs/workbench/services/configuration/browser/configurationService.ts @@ -30,6 +30,7 @@ import { IFileService } from 'vs/platform/files/common/files'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; +import { ILogService } from 'vs/platform/log/common/log'; export class WorkspaceService extends Disposable implements IConfigurationService, IWorkspaceContextService { @@ -47,6 +48,7 @@ export class WorkspaceService extends Disposable implements IConfigurationServic private cachedFolderConfigs: ResourceMap; private workspaceEditingQueue: Queue; + private readonly logService: ILogService; private readonly fileService: IFileService; protected readonly _onDidChangeConfiguration: Emitter = this._register(new Emitter()); @@ -71,7 +73,8 @@ export class WorkspaceService extends Disposable implements IConfigurationServic { remoteAuthority, configurationCache }: { remoteAuthority?: string, configurationCache: IConfigurationCache }, environmentService: IWorkbenchEnvironmentService, fileService: IFileService, - remoteAgentService: IRemoteAgentService + remoteAgentService: IRemoteAgentService, + logService: ILogService, ) { super(); @@ -86,6 +89,7 @@ export class WorkspaceService extends Disposable implements IConfigurationServic this.defaultConfiguration = new DefaultConfigurationModel(); this.configurationCache = configurationCache; this.fileService = fileService; + this.logService = logService; this._configuration = new Configuration(this.defaultConfiguration, new ConfigurationModel(), new ConfigurationModel(), new ConfigurationModel(), new ResourceMap(), new ConfigurationModel(), new ResourceMap(), this.workspace); this.cachedFolderConfigs = new ResourceMap(); this.localUserConfiguration = this._register(new UserConfiguration(environmentService.settingsResource, remoteAuthority ? LOCAL_MACHINE_SCOPES : undefined, fileService)); @@ -639,6 +643,8 @@ export class WorkspaceService extends Disposable implements IConfigurationServic } } + // Filter out workspace folders which are files (not directories) + // Workspace folders those cannot be resolved are not filtered because they are handled by the Explorer. private async toValidWorkspaceFolders(workspaceFolders: WorkspaceFolder[]): Promise { const validWorkspaceFolders: WorkspaceFolder[] = []; for (const workspaceFolder of workspaceFolders) { @@ -647,7 +653,10 @@ export class WorkspaceService extends Disposable implements IConfigurationServic if (!result.isDirectory) { continue; } - } catch (e) { /* Ignore */ } + } catch (e) { + // Ignore Error + this.logService.error(e); + } validWorkspaceFolders.push(workspaceFolder); } return validWorkspaceFolders; diff --git a/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts b/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts index 4264e1dcd62..f9f3adb5329 100644 --- a/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts +++ b/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts @@ -113,7 +113,7 @@ suite('ConfigurationEditingService', () => { fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, undefined, diskFileSystemProvider, environmentService, new NullLogService())); instantiationService.stub(IFileService, fileService); instantiationService.stub(IRemoteAgentService, remoteAgentService); - const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService); + const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService, new NullLogService()); instantiationService.stub(IWorkspaceContextService, workspaceService); return workspaceService.initialize(noWorkspace ? { id: '' } : { folder: URI.file(workspaceDir), id: createHash('md5').update(URI.file(workspaceDir).toString()).digest('hex') }).then(() => { instantiationService.stub(IConfigurationService, workspaceService); diff --git a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts index 987810fce19..8d94d0dceac 100644 --- a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts +++ b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts @@ -114,7 +114,7 @@ suite('WorkspaceContextService - Folder', () => { const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService()); fileService.registerProvider(Schemas.file, diskFileSystemProvider); fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, undefined, new DiskFileSystemProvider(new NullLogService()), environmentService, new NullLogService())); - workspaceContextService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, new RemoteAgentService(environmentService, { _serviceBrand: undefined, ...product }, new RemoteAuthorityResolverService(), new SignService(undefined), new NullLogService())); + workspaceContextService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, new RemoteAgentService(environmentService, { _serviceBrand: undefined, ...product }, new RemoteAuthorityResolverService(), new SignService(undefined), new NullLogService()), new NullLogService()); return (workspaceContextService).initialize(convertToWorkspacePayload(URI.file(folderDir))); }); }); @@ -180,7 +180,7 @@ suite('WorkspaceContextService - Workspace', () => { const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService()); fileService.registerProvider(Schemas.file, diskFileSystemProvider); fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, undefined, diskFileSystemProvider, environmentService, new NullLogService())); - const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService); + const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService, new NullLogService()); instantiationService.stub(IWorkspaceContextService, workspaceService); instantiationService.stub(IConfigurationService, workspaceService); @@ -240,7 +240,7 @@ suite('WorkspaceContextService - Workspace Editing', () => { const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService()); fileService.registerProvider(Schemas.file, diskFileSystemProvider); fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, undefined, diskFileSystemProvider, environmentService, new NullLogService())); - const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService); + const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService, new NullLogService()); instantiationService.stub(IWorkspaceContextService, workspaceService); instantiationService.stub(IConfigurationService, workspaceService); @@ -501,7 +501,7 @@ suite('WorkspaceService - Initialization', () => { const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService()); fileService.registerProvider(Schemas.file, diskFileSystemProvider); fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, undefined, diskFileSystemProvider, environmentService, new NullLogService())); - const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService); + const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService, new NullLogService()); instantiationService.stub(IWorkspaceContextService, workspaceService); instantiationService.stub(IConfigurationService, workspaceService); instantiationService.stub(IEnvironmentService, environmentService); @@ -778,7 +778,7 @@ suite('WorkspaceConfigurationService - Folder', () => { const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService()); fileService.registerProvider(Schemas.file, diskFileSystemProvider); fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, undefined, diskFileSystemProvider, environmentService, new NullLogService())); - workspaceService = disposableStore.add(new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService)); + workspaceService = disposableStore.add(new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService, new NullLogService())); instantiationService.stub(IWorkspaceContextService, workspaceService); instantiationService.stub(IConfigurationService, workspaceService); instantiationService.stub(IEnvironmentService, environmentService); @@ -1287,7 +1287,7 @@ suite('WorkspaceConfigurationService-Multiroot', () => { const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService()); fileService.registerProvider(Schemas.file, diskFileSystemProvider); fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, undefined, diskFileSystemProvider, environmentService, new NullLogService())); - const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService); + const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService, new NullLogService()); instantiationService.stub(IWorkspaceContextService, workspaceService); instantiationService.stub(IConfigurationService, workspaceService); @@ -1890,7 +1890,7 @@ suite('WorkspaceConfigurationService - Remote Folder', () => { fileService.registerProvider(Schemas.file, diskFileSystemProvider); fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, undefined, diskFileSystemProvider, environmentService, new NullLogService())); const configurationCache: IConfigurationCache = { read: () => Promise.resolve(''), write: () => Promise.resolve(), remove: () => Promise.resolve() }; - testObject = new WorkspaceService({ configurationCache, remoteAuthority }, environmentService, fileService, remoteAgentService); + testObject = new WorkspaceService({ configurationCache, remoteAuthority }, environmentService, fileService, remoteAgentService, new NullLogService()); instantiationService.stub(IWorkspaceContextService, testObject); instantiationService.stub(IConfigurationService, testObject); instantiationService.stub(IEnvironmentService, environmentService); @@ -2096,7 +2096,7 @@ suite('ConfigurationService - Configuration Defaults', () => { const remoteAgentService = (workbenchInstantiationService()).createInstance(RemoteAgentService); const environmentService = new BrowserWorkbenchEnvironmentService({ logsPath: URI.file(''), workspaceId: '', configurationDefaults }, TestProductService); const fileService = new FileService(new NullLogService()); - return disposableStore.add(new WorkspaceService({ configurationCache: new BrowserConfigurationCache() }, environmentService, fileService, remoteAgentService)); + return disposableStore.add(new WorkspaceService({ configurationCache: new BrowserConfigurationCache() }, environmentService, fileService, remoteAgentService, new NullLogService())); } }); From afbaf2cfea5d667030a23f6f467370a1225fd5be Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 17 Sep 2020 14:36:10 +0200 Subject: [PATCH 0078/1667] missing compile --- build/lib/standalone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/lib/standalone.js b/build/lib/standalone.js index 531194c35fd..082d5f7c2eb 100644 --- a/build/lib/standalone.js +++ b/build/lib/standalone.js @@ -252,7 +252,7 @@ function transportCSS(module, enqueue, write) { } const filename = path.join(SRC_DIR, module); const fileContents = fs.readFileSync(filename).toString(); - const inlineResources = 'base64'; // see https://github.com/Microsoft/monaco-editor/issues/148 + const inlineResources = 'base64'; // see https://github.com/microsoft/monaco-editor/issues/148 const newContents = _rewriteOrInlineUrls(fileContents, inlineResources === 'base64'); write(module, newContents); return true; From 6fd30f962c93504feabfc6928a80315dd0e1b9e8 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 17 Sep 2020 14:45:50 +0200 Subject: [PATCH 0079/1667] add ability to list fs provider capabilities so that we can sync them to the extension hosts --- src/vs/platform/files/common/fileService.ts | 5 +++++ src/vs/platform/files/common/files.ts | 5 +++++ src/vs/workbench/api/browser/mainThreadFileSystem.ts | 3 +++ src/vs/workbench/test/browser/workbenchTestServices.ts | 7 +++++++ 4 files changed, 20 insertions(+) diff --git a/src/vs/platform/files/common/fileService.ts b/src/vs/platform/files/common/fileService.ts index fc4e543c263..2677be6e8fa 100644 --- a/src/vs/platform/files/common/fileService.ts +++ b/src/vs/platform/files/common/fileService.ts @@ -19,6 +19,7 @@ import { Queue } from 'vs/base/common/async'; import { CancellationTokenSource, CancellationToken } from 'vs/base/common/cancellation'; import { Schemas } from 'vs/base/common/network'; import { readFileIntoStream } from 'vs/platform/files/common/io'; +import { Iterable } from 'vs/base/common/iterator'; export class FileService extends Disposable implements IFileService { @@ -101,6 +102,10 @@ export class FileService extends Disposable implements IFileService { return !!(provider && (provider.capabilities & capability)); } + listCapabilities(): Iterable<{ scheme: string, capabilities: FileSystemProviderCapabilities }> { + return Iterable.map(this.provider, ([scheme, provider]) => ({ scheme, capabilities: provider.capabilities })); + } + protected async withProvider(resource: URI): Promise { // Assert path is absolute diff --git a/src/vs/platform/files/common/files.ts b/src/vs/platform/files/common/files.ts index 0926bff72bb..b807bce9b5c 100644 --- a/src/vs/platform/files/common/files.ts +++ b/src/vs/platform/files/common/files.ts @@ -59,6 +59,11 @@ export interface IFileService { */ hasCapability(resource: URI, capability: FileSystemProviderCapabilities): boolean; + /** + * List the schemes and capabilies for registered file system providers + */ + listCapabilities(): Iterable<{ scheme: string, capabilities: FileSystemProviderCapabilities }> + /** * Allows to listen for file changes. The event will fire for every file within the opened workspace * (if any) as well as all files that have been watched explicitly using the #watch() API. diff --git a/src/vs/workbench/api/browser/mainThreadFileSystem.ts b/src/vs/workbench/api/browser/mainThreadFileSystem.ts index dc0aa294b70..b71e2e7ed45 100644 --- a/src/vs/workbench/api/browser/mainThreadFileSystem.ts +++ b/src/vs/workbench/api/browser/mainThreadFileSystem.ts @@ -26,6 +26,9 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape { const infoProxy = extHostContext.getProxy(ExtHostContext.ExtHostFileSystemInfo); + for (let entry of _fileService.listCapabilities()) { + infoProxy.$acceptProviderInfos(entry.scheme, entry.capabilities); + } this._disposables.add(_fileService.onDidChangeFileSystemProviderRegistrations(e => infoProxy.$acceptProviderInfos(e.scheme, e.provider?.capabilities ?? null))); this._disposables.add(_fileService.onDidChangeFileSystemProviderCapabilities(e => infoProxy.$acceptProviderInfos(e.scheme, e.provider.capabilities))); } diff --git a/src/vs/workbench/test/browser/workbenchTestServices.ts b/src/vs/workbench/test/browser/workbenchTestServices.ts index 8a49fb31af7..2f5e8dd39b2 100644 --- a/src/vs/workbench/test/browser/workbenchTestServices.ts +++ b/src/vs/workbench/test/browser/workbenchTestServices.ts @@ -114,6 +114,7 @@ import { newWriteableStream, ReadableStreamEvents } from 'vs/base/common/stream' import { EncodingOracle, IEncodingOverride } from 'vs/workbench/services/textfile/browser/textFileService'; import { UTF16le, UTF16be, UTF8_with_bom } from 'vs/workbench/services/textfile/common/encoding'; import { ColorScheme } from 'vs/platform/theme/common/theme'; +import { Iterable } from 'vs/base/common/iterator'; export function createFileEditorInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput { return instantiationService.createInstance(FileEditorInput, resource, undefined, undefined, undefined); @@ -850,6 +851,12 @@ export class TestFileService implements IFileService { activateProvider(_scheme: string): Promise { throw new Error('not implemented'); } canHandleResource(resource: URI): boolean { return resource.scheme === 'file' || this.providers.has(resource.scheme); } + listCapabilities() { + return [ + { scheme: 'file', capabilities: FileSystemProviderCapabilities.FileOpenReadWriteClose }, + ...Iterable.map(this.providers, ([scheme, p]) => { return { scheme, capabilities: p.capabilities }; }) + ]; + } hasCapability(resource: URI, capability: FileSystemProviderCapabilities): boolean { if (capability === FileSystemProviderCapabilities.PathCaseSensitive && isLinux) { return true; From 82d30d49b25f734b62cc9bca5d173603bb05bd2d Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 15:43:15 +0200 Subject: [PATCH 0080/1667] sandbox - add electron service to layers checker --- build/lib/layersChecker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/lib/layersChecker.ts b/build/lib/layersChecker.ts index 5d620c79db0..32290edf277 100644 --- a/build/lib/layersChecker.ts +++ b/build/lib/layersChecker.ts @@ -60,7 +60,8 @@ const CORE_TYPES = [ const NATIVE_TYPES = [ 'NativeParsedArgs', 'INativeEnvironmentService', - 'INativeWindowConfiguration' + 'INativeWindowConfiguration', + 'ICommonElectronService' ]; const RULES = [ From 01472963d7b9f963feb5932d7a9276f4dc085619 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 16:20:23 +0200 Subject: [PATCH 0081/1667] sandbox - rename electron service => native host service --- build/lib/layersChecker.js | 13 +++++- build/lib/layersChecker.ts | 13 +++++- .../sharedProcess/sharedProcessMain.ts | 6 +-- src/vs/code/electron-main/app.ts | 14 +++---- .../issue/issueReporterMain.ts | 10 ++--- .../processExplorer/processExplorerMain.ts | 16 ++++---- .../driver/electron-browser/driver.ts | 10 ++--- .../platform/driver/electron-main/driver.ts | 6 +-- .../diskFileSystemProvider.ts | 6 +-- .../platform/menubar/electron-main/menubar.ts | 14 +++---- .../electron.ts => native/common/native.ts} | 2 +- .../electron-main/nativeHostMainService.ts} | 8 ++-- .../electron-sandbox/native.ts} | 10 ++--- .../userDataAutoSyncService.ts | 8 ++-- .../windows/electron-main/windowTracker.ts | 8 ++-- .../backup/electron-sandbox/backupTracker.ts | 6 +-- .../electron-browser/backupTracker.test.ts | 8 ++-- .../sleepResumeRepaintMinimap.ts | 6 +-- .../extensionProfileService.ts | 6 +-- .../runtimeExtensionsEditor.ts | 20 +++++----- .../electron-sandbox/extensionsActions.ts | 6 +-- .../electron-sandbox/extensionsSlowActions.ts | 6 +-- .../fileActions.contribution.ts | 6 +-- .../files/electron-sandbox/fileCommands.ts | 8 ++-- .../files/electron-sandbox/textFileEditor.ts | 6 +-- .../logs/electron-sandbox/logsActions.ts | 10 ++--- .../electron-browser/startupProfiler.ts | 10 ++--- .../electron-browser/startupTimings.ts | 10 ++--- .../partsSplash.contribution.ts | 6 +-- .../terminalNativeContribution.ts | 6 +-- .../userDataSync.contribution.ts | 6 +-- .../electron-sandbox/resourceLoading.ts | 6 +-- .../electron-sandbox/telemetryOptOut.ts | 6 +-- .../electron-browser/desktop.main.ts | 10 ++--- .../actions/developerActions.ts | 6 +-- .../electron-sandbox/actions/windowActions.ts | 40 +++++++++---------- .../electron-sandbox/desktop.contribution.ts | 10 ++--- .../electron-sandbox/desktop.main.ts | 8 ++-- .../parts/titlebar/titlebarPart.ts | 16 ++++---- src/vs/workbench/electron-sandbox/window.ts | 32 +++++++-------- .../electron-sandbox/clipboardService.ts | 18 ++++----- .../dialogs/electron-sandbox/dialogService.ts | 16 ++++---- .../electron-sandbox/fileDialogService.ts | 18 ++++----- .../electron-browser/extensionService.ts | 10 ++--- .../localProcessExtensionHost.ts | 6 +-- .../electron-sandbox/nativeHostService.ts | 24 +++++------ .../electron-sandbox/lifecycleService.ts | 6 +-- .../outputChannelModelService.ts | 6 +-- .../electron-sandbox/requestService.ts | 6 +-- .../electron-browser/sharedProcessService.ts | 6 +-- .../nativeHostColorSchemeService.ts | 6 +-- .../timer/electron-sandbox/timerService.ts | 12 +++--- .../url/electron-sandbox/urlService.ts | 10 ++--- .../workspaceEditingService.ts | 8 ++-- .../electron-sandbox/workspacesService.ts | 6 +-- .../electron-browser/workbenchTestServices.ts | 10 ++--- 56 files changed, 297 insertions(+), 275 deletions(-) rename src/vs/platform/{electron/common/electron.ts => native/common/native.ts} (99%) rename src/vs/platform/{electron/electron-main/electronMainService.ts => native/electron-main/nativeHostMainService.ts} (97%) rename src/vs/platform/{electron/electron-sandbox/electron.ts => native/electron-sandbox/native.ts} (71%) diff --git a/build/lib/layersChecker.js b/build/lib/layersChecker.js index 864c47f6ca3..c4e806c4efd 100644 --- a/build/lib/layersChecker.js +++ b/build/lib/layersChecker.js @@ -58,7 +58,8 @@ const CORE_TYPES = [ const NATIVE_TYPES = [ 'NativeParsedArgs', 'INativeEnvironmentService', - 'INativeWindowConfiguration' + 'INativeWindowConfiguration', + 'ICommonNativeHostService' ]; const RULES = [ // Tests: skip @@ -111,6 +112,16 @@ const RULES = [ '@types/node' // no node.js ] }, + // Common: vs/platform/native/common/native.ts + { + target: '**/vs/platform/native/common/native.ts', + disallowedTypes: [ /* Ignore native types that are defined from here */], + allowedTypes: CORE_TYPES, + disallowedDefinitions: [ + 'lib.dom.d.ts', + '@types/node' // no node.js + ] + }, // Common: vs/workbench/api/common/extHostExtensionService.ts { target: '**/vs/workbench/api/common/extHostExtensionService.ts', diff --git a/build/lib/layersChecker.ts b/build/lib/layersChecker.ts index 32290edf277..cd3b1d3b1cb 100644 --- a/build/lib/layersChecker.ts +++ b/build/lib/layersChecker.ts @@ -61,7 +61,7 @@ const NATIVE_TYPES = [ 'NativeParsedArgs', 'INativeEnvironmentService', 'INativeWindowConfiguration', - 'ICommonElectronService' + 'ICommonNativeHostService' ]; const RULES = [ @@ -122,6 +122,17 @@ const RULES = [ ] }, + // Common: vs/platform/native/common/native.ts + { + target: '**/vs/platform/native/common/native.ts', + disallowedTypes: [/* Ignore native types that are defined from here */], + allowedTypes: CORE_TYPES, + disallowedDefinitions: [ + 'lib.dom.d.ts', // no DOM + '@types/node' // no node.js + ] + }, + // Common: vs/workbench/api/common/extHostExtensionService.ts { target: '**/vs/workbench/api/common/extHostExtensionService.ts', diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts index 18cdd76fda9..f7664e308c3 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts @@ -52,7 +52,7 @@ import { IUserDataSyncService, IUserDataSyncStoreService, registerConfiguration, import { UserDataSyncService } from 'vs/platform/userDataSync/common/userDataSyncService'; import { UserDataSyncStoreService, UserDataSyncStoreManagementService } from 'vs/platform/userDataSync/common/userDataSyncStoreService'; import { UserDataSyncChannel, UserDataSyncUtilServiceClient, UserDataAutoSyncChannel, StorageKeysSyncRegistryChannelClient, UserDataSyncMachinesServiceChannel, UserDataSyncAccountServiceChannel, UserDataSyncStoreManagementServiceChannel } from 'vs/platform/userDataSync/common/userDataSyncIpc'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { LoggerService } from 'vs/platform/log/node/loggerService'; import { UserDataSyncLogService } from 'vs/platform/userDataSync/common/userDataSyncLog'; import { ICredentialsService } from 'vs/platform/credentials/common/credentials'; @@ -154,8 +154,8 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat services.set(IRequestService, new SyncDescriptor(RequestService)); services.set(ILoggerService, new SyncDescriptor(LoggerService)); - const electronService = createChannelSender(mainProcessService.getChannel('electron'), { context: configuration.windowId }); - services.set(IElectronService, electronService); + const nativeHostService = createChannelSender(mainProcessService.getChannel('nativeHost'), { context: configuration.windowId }); + services.set(INativeHostService, nativeHostService); services.set(IDownloadService, new SyncDescriptor(DownloadService)); diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index 991a62169a7..647b22749d2 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -68,7 +68,7 @@ import { statSync } from 'fs'; import { IDiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService'; import { ExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/common/extensionHostDebugIpc'; import { ElectronExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/electron-main/extensionHostDebugIpc'; -import { IElectronMainService, ElectronMainService } from 'vs/platform/electron/electron-main/electronMainService'; +import { INativeHostMainService, NativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService'; import { ISharedProcessMainService, SharedProcessMainService } from 'vs/platform/ipc/electron-main/sharedProcessMainService'; import { IDialogMainService, DialogMainService } from 'vs/platform/dialogs/electron-main/dialogs'; import { withNullAsUndefined } from 'vs/base/common/types'; @@ -443,7 +443,7 @@ export class CodeApplication extends Disposable { services.set(IDiagnosticsService, createChannelSender(getDelayedChannel(sharedProcessReady.then(client => client.getChannel('diagnostics'))))); services.set(IIssueMainService, new SyncDescriptor(IssueMainService, [machineId, this.userEnv])); - services.set(IElectronMainService, new SyncDescriptor(ElectronMainService)); + services.set(INativeHostMainService, new SyncDescriptor(NativeHostMainService)); services.set(IWebviewManagerService, new SyncDescriptor(WebviewMainService)); services.set(IWorkspacesService, new SyncDescriptor(WorkspacesService)); services.set(IMenubarMainService, new SyncDescriptor(MenubarMainService)); @@ -531,10 +531,10 @@ export class CodeApplication extends Disposable { const issueChannel = createChannelReceiver(issueMainService); electronIpcServer.registerChannel('issue', issueChannel); - const electronMainService = accessor.get(IElectronMainService); - const electronChannel = createChannelReceiver(electronMainService); - electronIpcServer.registerChannel('electron', electronChannel); - sharedProcessClient.then(client => client.registerChannel('electron', electronChannel)); + const nativeHostMainService = accessor.get(INativeHostMainService); + const nativeHostChannel = createChannelReceiver(nativeHostMainService); + electronIpcServer.registerChannel('nativeHost', nativeHostChannel); + sharedProcessClient.then(client => client.registerChannel('nativeHost', nativeHostChannel)); const sharedProcessMainService = accessor.get(ISharedProcessMainService); const sharedProcessChannel = createChannelReceiver(sharedProcessMainService); @@ -657,7 +657,7 @@ export class CodeApplication extends Disposable { }); // Create a URL handler which forwards to the last active window - const activeWindowManager = new ActiveWindowManager(electronMainService); + const activeWindowManager = new ActiveWindowManager(nativeHostMainService); const activeWindowRouter = new StaticRouter(ctx => activeWindowManager.getActiveClientId().then(id => ctx === id)); const urlHandlerRouter = new URLHandlerRouter(activeWindowRouter); const urlHandlerChannel = electronIpcServer.getChannel('urlHandler', urlHandlerRouter); diff --git a/src/vs/code/electron-sandbox/issue/issueReporterMain.ts b/src/vs/code/electron-sandbox/issue/issueReporterMain.ts index 108f02d1abd..27db658d34d 100644 --- a/src/vs/code/electron-sandbox/issue/issueReporterMain.ts +++ b/src/vs/code/electron-sandbox/issue/issueReporterMain.ts @@ -5,7 +5,7 @@ import 'vs/css!./media/issueReporter'; import 'vs/base/browser/ui/codicons/codiconStyles'; // make sure codicon css is loaded -import { ElectronService, IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { NativeHostService, INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { ipcRenderer, process } from 'vs/base/parts/sandbox/electron-sandbox/globals'; import { applyZoom, zoomIn, zoomOut } from 'vs/platform/windows/electron-sandbox/window'; import { $, reset, windowOpenNoOpener, addClass } from 'vs/base/browser/dom'; @@ -65,7 +65,7 @@ export function startup(configuration: IssueReporterConfiguration) { } export class IssueReporter extends Disposable { - private electronService!: IElectronService; + private nativeHostService!: INativeHostService; private readonly issueReporterModel: IssueReporterModel; private numberOfSearchResultsDisplayed = 0; private receivedSystemInfo = false; @@ -267,8 +267,8 @@ export class IssueReporter extends Disposable { const mainProcessService = new MainProcessService(configuration.windowId); serviceCollection.set(IMainProcessService, mainProcessService); - this.electronService = new ElectronService(configuration.windowId, mainProcessService) as IElectronService; - serviceCollection.set(IElectronService, this.electronService); + this.nativeHostService = new NativeHostService(configuration.windowId, mainProcessService) as INativeHostService; + serviceCollection.set(INativeHostService, this.nativeHostService); } private setEventHandlers(): void { @@ -827,7 +827,7 @@ export class IssueReporter extends Disposable { return new Promise((resolve, reject) => { ipcRenderer.once('vscode:issueReporterClipboardResponse', async (event: unknown, shouldWrite: boolean) => { if (shouldWrite) { - await this.electronService.writeClipboardText(issueBody); + await this.nativeHostService.writeClipboardText(issueBody); resolve(baseUrl + `&body=${encodeURIComponent(localize('pasteData', "We have written the needed data into your clipboard because it was too large to send. Please paste."))}`); } else { reject(); diff --git a/src/vs/code/electron-sandbox/processExplorer/processExplorerMain.ts b/src/vs/code/electron-sandbox/processExplorer/processExplorerMain.ts index ff5d62a5a53..2f2c915524d 100644 --- a/src/vs/code/electron-sandbox/processExplorer/processExplorerMain.ts +++ b/src/vs/code/electron-sandbox/processExplorer/processExplorerMain.ts @@ -5,7 +5,7 @@ import 'vs/css!./media/processExplorer'; import 'vs/base/browser/ui/codicons/codiconStyles'; // make sure codicon css is loaded -import { ElectronService, IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { NativeHostService, INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals'; import { localize } from 'vs/nls'; import { ProcessExplorerStyles, ProcessExplorerData } from 'vs/platform/issue/common/issue'; @@ -40,11 +40,11 @@ class ProcessExplorer { private listeners = new DisposableStore(); - private electronService: IElectronService; + private nativeHostService: INativeHostService; constructor(windowId: number, private data: ProcessExplorerData) { const mainProcessService = new MainProcessService(windowId); - this.electronService = new ElectronService(windowId, mainProcessService) as IElectronService; + this.nativeHostService = new NativeHostService(windowId, mainProcessService) as INativeHostService; this.applyStyles(data.styles); @@ -293,7 +293,7 @@ class ProcessExplorer { container.append(tableHead); const hasMultipleMachines = Object.keys(processLists).length > 1; - const { totalmem } = await this.electronService.getOSStatistics(); + const { totalmem } = await this.nativeHostService.getOSStatistics(); processLists.forEach((remote, i) => { const isLocal = i === 0; if (isRemoteDiagnosticError(remote.rootProcess)) { @@ -339,14 +339,14 @@ class ProcessExplorer { items.push({ label: localize('killProcess', "Kill Process"), click: () => { - this.electronService.killProcess(pid, 'SIGTERM'); + this.nativeHostService.killProcess(pid, 'SIGTERM'); } }); items.push({ label: localize('forceKillProcess', "Force Kill Process"), click: () => { - this.electronService.killProcess(pid, 'SIGKILL'); + this.nativeHostService.killProcess(pid, 'SIGKILL'); } }); @@ -360,7 +360,7 @@ class ProcessExplorer { click: () => { const row = document.getElementById(pid.toString()); if (row) { - this.electronService.writeClipboardText(row.innerText); + this.nativeHostService.writeClipboardText(row.innerText); } } }); @@ -370,7 +370,7 @@ class ProcessExplorer { click: () => { const processList = document.getElementById('process-list'); if (processList) { - this.electronService.writeClipboardText(processList.innerText); + this.nativeHostService.writeClipboardText(processList.innerText); } } }); diff --git a/src/vs/platform/driver/electron-browser/driver.ts b/src/vs/platform/driver/electron-browser/driver.ts index f0d350d392e..a06299b41c4 100644 --- a/src/vs/platform/driver/electron-browser/driver.ts +++ b/src/vs/platform/driver/electron-browser/driver.ts @@ -9,12 +9,12 @@ import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiati import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService'; import { timeout } from 'vs/base/common/async'; import { BaseWindowDriver } from 'vs/platform/driver/browser/baseDriver'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; class WindowDriver extends BaseWindowDriver { constructor( - @IElectronService private readonly electronService: IElectronService + @INativeHostService private readonly nativeHostService: INativeHostService ) { super(); } @@ -31,15 +31,15 @@ class WindowDriver extends BaseWindowDriver { private async _click(selector: string, clickCount: number, offset?: { x: number, y: number }): Promise { const { x, y } = await this._getElementXY(selector, offset); - await this.electronService.sendInputEvent({ type: 'mouseDown', x, y, button: 'left', clickCount } as any); + await this.nativeHostService.sendInputEvent({ type: 'mouseDown', x, y, button: 'left', clickCount } as any); await timeout(10); - await this.electronService.sendInputEvent({ type: 'mouseUp', x, y, button: 'left', clickCount } as any); + await this.nativeHostService.sendInputEvent({ type: 'mouseUp', x, y, button: 'left', clickCount } as any); await timeout(100); } async openDevTools(): Promise { - await this.electronService.openDevTools({ mode: 'detach' }); + await this.nativeHostService.openDevTools({ mode: 'detach' }); } } diff --git a/src/vs/platform/driver/electron-main/driver.ts b/src/vs/platform/driver/electron-main/driver.ts index 0cfe2f7732a..21cbd2d9e41 100644 --- a/src/vs/platform/driver/electron-main/driver.ts +++ b/src/vs/platform/driver/electron-main/driver.ts @@ -19,7 +19,7 @@ import { KeybindingParser } from 'vs/base/common/keybindingParser'; import { timeout } from 'vs/base/common/async'; import { IDriver, IElement, IWindowDriver } from 'vs/platform/driver/common/driver'; import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService'; -import { IElectronMainService } from 'vs/platform/electron/electron-main/electronMainService'; +import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService'; function isSilentKeyCode(keyCode: KeyCode) { return keyCode < KeyCode.KEY_0; @@ -38,7 +38,7 @@ export class Driver implements IDriver, IWindowDriverRegistry { private options: IDriverOptions, @IWindowsMainService private readonly windowsMainService: IWindowsMainService, @ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService, - @IElectronMainService private readonly electronMainService: IElectronMainService + @INativeHostMainService private readonly nativeHostMainService: INativeHostMainService ) { } async registerWindowDriver(windowId: number): Promise { @@ -82,7 +82,7 @@ export class Driver implements IDriver, IWindowDriverRegistry { } async exitApplication(): Promise { - return this.electronMainService.quit(undefined); + return this.nativeHostMainService.quit(undefined); } async dispatchKeybinding(windowId: number, keybinding: string): Promise { diff --git a/src/vs/platform/files/electron-browser/diskFileSystemProvider.ts b/src/vs/platform/files/electron-browser/diskFileSystemProvider.ts index 1ba8c20f3e4..a2db35c4e04 100644 --- a/src/vs/platform/files/electron-browser/diskFileSystemProvider.ts +++ b/src/vs/platform/files/electron-browser/diskFileSystemProvider.ts @@ -9,13 +9,13 @@ import { isWindows } from 'vs/base/common/platform'; import { localize } from 'vs/nls'; import { basename } from 'vs/base/common/path'; import { ILogService } from 'vs/platform/log/common/log'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; export class DiskFileSystemProvider extends NodeDiskFileSystemProvider { constructor( logService: ILogService, - private readonly electronService: IElectronService, + private readonly nativeHostService: INativeHostService, options?: IDiskFileSystemProviderOptions ) { super(logService, options); @@ -34,7 +34,7 @@ export class DiskFileSystemProvider extends NodeDiskFileSystemProvider { return super.doDelete(filePath, opts); } - const result = await this.electronService.moveItemToTrash(filePath); + const result = await this.nativeHostService.moveItemToTrash(filePath); if (!result) { throw new Error(isWindows ? localize('binFailed', "Failed to move '{0}' to the recycle bin", basename(filePath)) : localize('trashFailed', "Failed to move '{0}' to the trash", basename(filePath))); } diff --git a/src/vs/platform/menubar/electron-main/menubar.ts b/src/vs/platform/menubar/electron-main/menubar.ts index 1e1e0e0bcc5..e83ada7a5ac 100644 --- a/src/vs/platform/menubar/electron-main/menubar.ts +++ b/src/vs/platform/menubar/electron-main/menubar.ts @@ -23,7 +23,7 @@ import { URI } from 'vs/base/common/uri'; import { IStateService } from 'vs/platform/state/node/state'; import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService'; import { WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification } from 'vs/base/common/actions'; -import { IElectronMainService } from 'vs/platform/electron/electron-main/electronMainService'; +import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService'; const telemetryFrom = 'menu'; @@ -73,7 +73,7 @@ export class Menubar { @IStateService private readonly stateService: IStateService, @ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService, @ILogService private readonly logService: ILogService, - @IElectronMainService private readonly electronMainService: IElectronMainService + @INativeHostMainService private readonly nativeHostMainService: INativeHostMainService ) { this.menuUpdater = new RunOnceScheduler(() => this.doUpdateMenu(), 0); @@ -116,8 +116,8 @@ export class Menubar { // File Menu Items this.fallbackMenuHandlers['workbench.action.files.newUntitledFile'] = (menuItem, win, event) => this.windowsMainService.openEmptyWindow({ context: OpenContext.MENU, contextWindowId: win?.id }); this.fallbackMenuHandlers['workbench.action.newWindow'] = (menuItem, win, event) => this.windowsMainService.openEmptyWindow({ context: OpenContext.MENU, contextWindowId: win?.id }); - this.fallbackMenuHandlers['workbench.action.files.openFileFolder'] = (menuItem, win, event) => this.electronMainService.pickFileFolderAndOpen(undefined, { forceNewWindow: this.isOptionClick(event), telemetryExtraData: { from: telemetryFrom } }); - this.fallbackMenuHandlers['workbench.action.openWorkspace'] = (menuItem, win, event) => this.electronMainService.pickWorkspaceAndOpen(undefined, { forceNewWindow: this.isOptionClick(event), telemetryExtraData: { from: telemetryFrom } }); + this.fallbackMenuHandlers['workbench.action.files.openFileFolder'] = (menuItem, win, event) => this.nativeHostMainService.pickFileFolderAndOpen(undefined, { forceNewWindow: this.isOptionClick(event), telemetryExtraData: { from: telemetryFrom } }); + this.fallbackMenuHandlers['workbench.action.openWorkspace'] = (menuItem, win, event) => this.nativeHostMainService.pickWorkspaceAndOpen(undefined, { forceNewWindow: this.isOptionClick(event), telemetryExtraData: { from: telemetryFrom } }); // Recent Menu Items this.fallbackMenuHandlers['workbench.action.clearRecentFiles'] = () => this.workspacesHistoryMainService.clearRecentlyOpened(); @@ -169,8 +169,8 @@ export class Menubar { // // Listen to some events from window service to update menu this.windowsMainService.onWindowsCountChanged(e => this.onWindowsCountChanged(e)); - this.electronMainService.onWindowBlur(() => this.onWindowFocusChange()); - this.electronMainService.onWindowFocus(() => this.onWindowFocusChange()); + this.nativeHostMainService.onWindowBlur(() => this.onWindowFocusChange()); + this.nativeHostMainService.onWindowFocus(() => this.onWindowFocusChange()); } private get currentEnableMenuBarMnemonics(): boolean { @@ -385,7 +385,7 @@ export class Menubar { !!BrowserWindow.getFocusedWindow() || // allow to quit when window has focus (fix for https://github.com/microsoft/vscode/issues/39191) lastActiveWindow?.isMinimized() // allow to quit when window has no focus but is minimized (https://github.com/microsoft/vscode/issues/63000) ) { - this.electronMainService.quit(undefined); + this.nativeHostMainService.quit(undefined); } } })); diff --git a/src/vs/platform/electron/common/electron.ts b/src/vs/platform/native/common/native.ts similarity index 99% rename from src/vs/platform/electron/common/electron.ts rename to src/vs/platform/native/common/native.ts index e3bf0a2be09..f9e86140edc 100644 --- a/src/vs/platform/electron/common/electron.ts +++ b/src/vs/platform/native/common/native.ts @@ -29,7 +29,7 @@ export interface IOSStatistics { loadavg: number[]; } -export interface ICommonElectronService { +export interface ICommonNativeHostService { readonly _serviceBrand: undefined; diff --git a/src/vs/platform/electron/electron-main/electronMainService.ts b/src/vs/platform/native/electron-main/nativeHostMainService.ts similarity index 97% rename from src/vs/platform/electron/electron-main/electronMainService.ts rename to src/vs/platform/native/electron-main/nativeHostMainService.ts index 08fff59cdc0..a292f57a80b 100644 --- a/src/vs/platform/electron/electron-main/electronMainService.ts +++ b/src/vs/platform/native/electron-main/nativeHostMainService.ts @@ -11,7 +11,7 @@ import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifec import { IOpenedWindow, IOpenWindowOptions, IWindowOpenable, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows'; import { INativeOpenDialogOptions } from 'vs/platform/dialogs/common/dialogs'; import { isMacintosh, isWindows, isRootUser } from 'vs/base/common/platform'; -import { ICommonElectronService, IOSProperties, IOSStatistics } from 'vs/platform/electron/common/electron'; +import { ICommonNativeHostService, IOSProperties, IOSStatistics } from 'vs/platform/native/common/native'; import { ISerializableCommandAction } from 'vs/platform/actions/common/actions'; import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { AddFirstParameterToFunctions } from 'vs/base/common/types'; @@ -25,11 +25,11 @@ import { arch, totalmem, release, platform, type, loadavg, freemem, cpus } from import { ColorScheme } from 'vs/platform/theme/common/theme'; import { virtualMachineHint } from 'vs/base/node/id'; -export interface IElectronMainService extends AddFirstParameterToFunctions /* only methods, not events */, number | undefined /* window ID */> { } +export interface INativeHostMainService extends AddFirstParameterToFunctions /* only methods, not events */, number | undefined /* window ID */> { } -export const IElectronMainService = createDecorator('electronMainService'); +export const INativeHostMainService = createDecorator('nativeHostMainService'); -export class ElectronMainService implements IElectronMainService { +export class NativeHostMainService implements INativeHostMainService { declare readonly _serviceBrand: undefined; diff --git a/src/vs/platform/electron/electron-sandbox/electron.ts b/src/vs/platform/native/electron-sandbox/native.ts similarity index 71% rename from src/vs/platform/electron/electron-sandbox/electron.ts rename to src/vs/platform/native/electron-sandbox/native.ts index 6b74e11cb18..5172e5d6f85 100644 --- a/src/vs/platform/electron/electron-sandbox/electron.ts +++ b/src/vs/platform/native/electron-sandbox/native.ts @@ -4,16 +4,16 @@ *--------------------------------------------------------------------------------------------*/ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -import { ICommonElectronService } from 'vs/platform/electron/common/electron'; +import { ICommonNativeHostService } from 'vs/platform/native/common/native'; import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService'; import { createChannelSender } from 'vs/base/parts/ipc/common/ipc'; -export const IElectronService = createDecorator('electronService'); +export const INativeHostService = createDecorator('nativeHostService'); -export interface IElectronService extends ICommonElectronService { } +export interface INativeHostService extends ICommonNativeHostService { } // @ts-ignore: interface is implemented via proxy -export class ElectronService implements IElectronService { +export class NativeHostService implements INativeHostService { declare readonly _serviceBrand: undefined; @@ -21,7 +21,7 @@ export class ElectronService implements IElectronService { readonly windowId: number, @IMainProcessService mainProcessService: IMainProcessService ) { - return createChannelSender(mainProcessService.getChannel('electron'), { + return createChannelSender(mainProcessService.getChannel('nativeHost'), { context: windowId, properties: (() => { const properties = new Map(); diff --git a/src/vs/platform/userDataSync/electron-sandbox/userDataAutoSyncService.ts b/src/vs/platform/userDataSync/electron-sandbox/userDataAutoSyncService.ts index c9d8acebb91..e40f3872167 100644 --- a/src/vs/platform/userDataSync/electron-sandbox/userDataAutoSyncService.ts +++ b/src/vs/platform/userDataSync/electron-sandbox/userDataAutoSyncService.ts @@ -5,7 +5,7 @@ // import { IUserDataSyncService, IUserDataSyncLogService, IUserDataSyncResourceEnablementService, IUserDataSyncStoreService, IUserDataSyncStoreManagementService } from 'vs/platform/userDataSync/common/userDataSync'; import { Event } from 'vs/base/common/event'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { UserDataAutoSyncService as BaseUserDataAutoSyncService } from 'vs/platform/userDataSync/common/userDataAutoSyncService'; import { IUserDataSyncAccountService } from 'vs/platform/userDataSync/common/userDataSyncAccount'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; @@ -20,7 +20,7 @@ export class UserDataAutoSyncService extends BaseUserDataAutoSyncService { @IUserDataSyncStoreService userDataSyncStoreService: IUserDataSyncStoreService, @IUserDataSyncResourceEnablementService userDataSyncResourceEnablementService: IUserDataSyncResourceEnablementService, @IUserDataSyncService userDataSyncService: IUserDataSyncService, - @IElectronService electronService: IElectronService, + @INativeHostService nativeHostService: INativeHostService, @IUserDataSyncLogService logService: IUserDataSyncLogService, @IUserDataSyncAccountService authTokenService: IUserDataSyncAccountService, @ITelemetryService telemetryService: ITelemetryService, @@ -31,8 +31,8 @@ export class UserDataAutoSyncService extends BaseUserDataAutoSyncService { super(userDataSyncStoreManagementService, userDataSyncStoreService, userDataSyncResourceEnablementService, userDataSyncService, logService, authTokenService, telemetryService, userDataSyncMachinesService, storageService, environmentService); this._register(Event.debounce(Event.any( - Event.map(electronService.onWindowFocus, () => 'windowFocus'), - Event.map(electronService.onWindowOpen, () => 'windowOpen'), + Event.map(nativeHostService.onWindowFocus, () => 'windowFocus'), + Event.map(nativeHostService.onWindowOpen, () => 'windowOpen'), ), (last, source) => last ? [...last, source] : [source], 1000)(sources => this.triggerSync(sources, true, false))); } diff --git a/src/vs/platform/windows/electron-main/windowTracker.ts b/src/vs/platform/windows/electron-main/windowTracker.ts index f9c5c9fe055..42b586f81b9 100644 --- a/src/vs/platform/windows/electron-main/windowTracker.ts +++ b/src/vs/platform/windows/electron-main/windowTracker.ts @@ -6,7 +6,7 @@ import { Event } from 'vs/base/common/event'; import { Disposable, DisposableStore } from 'vs/base/common/lifecycle'; import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async'; -import { IElectronMainService } from 'vs/platform/electron/electron-main/electronMainService'; +import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService'; export class ActiveWindowManager extends Disposable { @@ -15,15 +15,15 @@ export class ActiveWindowManager extends Disposable { private activeWindowId: number | undefined; - constructor(@IElectronMainService electronService: IElectronMainService) { + constructor(@INativeHostMainService nativeHostMainService: INativeHostMainService) { super(); // remember last active window id upon events - const onActiveWindowChange = Event.latch(Event.any(electronService.onWindowOpen, electronService.onWindowFocus)); + const onActiveWindowChange = Event.latch(Event.any(nativeHostMainService.onWindowOpen, nativeHostMainService.onWindowFocus)); onActiveWindowChange(this.setActiveWindow, this, this.disposables); // resolve current active window - this.firstActiveWindowIdPromise = createCancelablePromise(() => electronService.getActiveWindowId(-1)); + this.firstActiveWindowIdPromise = createCancelablePromise(() => nativeHostMainService.getActiveWindowId(-1)); (async () => { try { const windowId = await this.firstActiveWindowIdPromise; diff --git a/src/vs/workbench/contrib/backup/electron-sandbox/backupTracker.ts b/src/vs/workbench/contrib/backup/electron-sandbox/backupTracker.ts index e6321a3035c..403322f11e2 100644 --- a/src/vs/workbench/contrib/backup/electron-sandbox/backupTracker.ts +++ b/src/vs/workbench/contrib/backup/electron-sandbox/backupTracker.ts @@ -14,7 +14,7 @@ import Severity from 'vs/base/common/severity'; import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { isMacintosh } from 'vs/base/common/platform'; import { HotExitConfiguration } from 'vs/platform/files/common/files'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { BackupTracker } from 'vs/workbench/contrib/backup/common/backupTracker'; import { ILogService } from 'vs/platform/log/common/log'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; @@ -31,7 +31,7 @@ export class NativeBackupTracker extends BackupTracker implements IWorkbenchCont @IFileDialogService private readonly fileDialogService: IFileDialogService, @IDialogService private readonly dialogService: IDialogService, @IWorkspaceContextService private readonly contextService: IWorkspaceContextService, - @IElectronService private readonly electronService: IElectronService, + @INativeHostService private readonly nativeHostService: INativeHostService, @ILogService logService: ILogService, @IEditorService private readonly editorService: IEditorService, @IEnvironmentService private readonly environmentService: IEnvironmentService @@ -128,7 +128,7 @@ export class NativeBackupTracker extends BackupTracker implements IWorkbenchCont case ShutdownReason.CLOSE: if (this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY && this.filesConfigurationService.hotExitConfiguration === HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE) { doBackup = true; // backup if a folder is open and onExitAndWindowClose is configured - } else if (await this.electronService.getWindowCount() > 1 || isMacintosh) { + } else if (await this.nativeHostService.getWindowCount() > 1 || isMacintosh) { doBackup = false; // do not backup if a window is closed that does not cause quitting of the application } else { doBackup = true; // backup if last window is closed on win/linux where the application quits right after diff --git a/src/vs/workbench/contrib/backup/test/electron-browser/backupTracker.test.ts b/src/vs/workbench/contrib/backup/test/electron-browser/backupTracker.test.ts index 485390ddab3..ea1b812671f 100644 --- a/src/vs/workbench/contrib/backup/test/electron-browser/backupTracker.test.ts +++ b/src/vs/workbench/contrib/backup/test/electron-browser/backupTracker.test.ts @@ -34,7 +34,7 @@ import { HotExitConfiguration } from 'vs/platform/files/common/files'; import { ShutdownReason, ILifecycleService, BeforeShutdownEvent } from 'vs/platform/lifecycle/common/lifecycle'; import { IFileDialogService, ConfirmResult, IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { IWorkspaceContextService, Workspace } from 'vs/platform/workspace/common/workspace'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { BackupTracker } from 'vs/workbench/contrib/backup/common/backupTracker'; import { workbenchInstantiationService, TestServiceAccessor } from 'vs/workbench/test/electron-browser/workbenchTestServices'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; @@ -63,12 +63,12 @@ class TestBackupTracker extends NativeBackupTracker { @IFileDialogService fileDialogService: IFileDialogService, @IDialogService dialogService: IDialogService, @IWorkspaceContextService contextService: IWorkspaceContextService, - @IElectronService electronService: IElectronService, + @INativeHostService nativeHostService: INativeHostService, @ILogService logService: ILogService, @IEditorService editorService: IEditorService, @IEnvironmentService environmentService: IEnvironmentService ) { - super(backupFileService, filesConfigurationService, workingCopyService, lifecycleService, fileDialogService, dialogService, contextService, electronService, logService, editorService, environmentService); + super(backupFileService, filesConfigurationService, workingCopyService, lifecycleService, fileDialogService, dialogService, contextService, nativeHostService, logService, editorService, environmentService); // Reduce timeout for tests BackupTracker.BACKUP_FROM_CONTENT_CHANGE_DELAY = 10; @@ -450,7 +450,7 @@ suite('BackupTracker', () => { // Set multiple windows if required if (multipleWindows) { - accessor.electronService.windowCount = Promise.resolve(2); + accessor.nativeHostService.windowCount = Promise.resolve(2); } // Set cancel to force a veto if hot exit does not trigger diff --git a/src/vs/workbench/contrib/codeEditor/electron-sandbox/sleepResumeRepaintMinimap.ts b/src/vs/workbench/contrib/codeEditor/electron-sandbox/sleepResumeRepaintMinimap.ts index e5cec611df9..bb4f7968ca4 100644 --- a/src/vs/workbench/contrib/codeEditor/electron-sandbox/sleepResumeRepaintMinimap.ts +++ b/src/vs/workbench/contrib/codeEditor/electron-sandbox/sleepResumeRepaintMinimap.ts @@ -7,18 +7,18 @@ import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { Registry } from 'vs/platform/registry/common/platform'; import { Extensions as WorkbenchExtensions, IWorkbenchContribution, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { Disposable } from 'vs/base/common/lifecycle'; class SleepResumeRepaintMinimap extends Disposable implements IWorkbenchContribution { constructor( @ICodeEditorService codeEditorService: ICodeEditorService, - @IElectronService electronService: IElectronService + @INativeHostService nativeHostService: INativeHostService ) { super(); - this._register(electronService.onOSResume(() => { + this._register(nativeHostService.onOSResume(() => { codeEditorService.listCodeEditors().forEach(editor => editor.render(true)); })); } diff --git a/src/vs/workbench/contrib/extensions/electron-browser/extensionProfileService.ts b/src/vs/workbench/contrib/extensions/electron-browser/extensionProfileService.ts index 7e4d16d09d8..858879813dd 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/extensionProfileService.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/extensionProfileService.ts @@ -12,7 +12,7 @@ import { onUnexpectedError } from 'vs/base/common/errors'; import { StatusbarAlignment, IStatusbarService, IStatusbarEntryAccessor, IStatusbarEntry } from 'vs/workbench/services/statusbar/common/statusbar'; import { IExtensionHostProfileService, ProfileSessionState } from 'vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { randomPort } from 'vs/base/node/ports'; import { IProductService } from 'vs/platform/product/common/productService'; @@ -46,7 +46,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio @IExtensionService private readonly _extensionService: IExtensionService, @IEditorService private readonly _editorService: IEditorService, @IInstantiationService private readonly _instantiationService: IInstantiationService, - @IElectronService private readonly _electronService: IElectronService, + @INativeHostService private readonly _nativeHostService: INativeHostService, @IDialogService private readonly _dialogService: IDialogService, @IStatusbarService private readonly _statusbarService: IStatusbarService, @IProductService private readonly _productService: IProductService @@ -124,7 +124,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio secondaryButton: nls.localize('cancel', "Cancel") }).then(res => { if (res.confirmed) { - this._electronService.relaunch({ addArgs: [`--inspect-extensions=${randomPort()}`] }); + this._nativeHostService.relaunch({ addArgs: [`--inspect-extensions=${randomPort()}`] }); } }); } diff --git a/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts b/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts index e7a94a76525..5b1e7777be3 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts @@ -23,7 +23,7 @@ import { RunOnceScheduler } from 'vs/base/common/async'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { EnablementState } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { memoize } from 'vs/base/common/decorators'; import { isNonEmptyArray } from 'vs/base/common/arrays'; import { Event } from 'vs/base/common/event'; @@ -127,7 +127,7 @@ export class RuntimeExtensionsEditor extends EditorPane { @IOpenerService private readonly _openerService: IOpenerService, @IClipboardService private readonly _clipboardService: IClipboardService, @IProductService private readonly _productService: IProductService, - @IElectronService private readonly _electronService: IElectronService + @INativeHostService private readonly _nativeHostService: INativeHostService ) { super(RuntimeExtensionsEditor.ID, telemetryService, themeService, storageService); @@ -353,7 +353,7 @@ export class RuntimeExtensionsEditor extends EditorPane { data.actionbar.push(this._instantiationService.createInstance(SlowExtensionAction, element.description, element.unresponsiveProfile), { icon: true, label: true }); } if (isNonEmptyArray(element.status.runtimeErrors)) { - data.actionbar.push(new ReportExtensionIssueAction(element, this._openerService, this._clipboardService, this._productService, this._electronService), { icon: true, label: true }); + data.actionbar.push(new ReportExtensionIssueAction(element, this._openerService, this._clipboardService, this._productService, this._nativeHostService), { icon: true, label: true }); } let title: string; @@ -468,7 +468,7 @@ export class RuntimeExtensionsEditor extends EditorPane { const actions: IAction[] = []; - actions.push(new ReportExtensionIssueAction(e.element, this._openerService, this._clipboardService, this._productService, this._electronService)); + actions.push(new ReportExtensionIssueAction(e.element, this._openerService, this._clipboardService, this._productService, this._nativeHostService)); actions.push(new Separator()); actions.push(new Action('runtimeExtensionsEditor.action.disableWorkspace', nls.localize('disable workspace', "Disable (Workspace)"), undefined, true, () => this._extensionsWorkbenchService.setEnablement(e.element!.marketplaceInfo, EnablementState.DisabledWorkspace))); @@ -535,7 +535,7 @@ export class ReportExtensionIssueAction extends Action { @IOpenerService private readonly openerService: IOpenerService, @IClipboardService private readonly clipboardService: IClipboardService, @IProductService private readonly productService: IProductService, - @IElectronService private readonly electronService: IElectronService + @INativeHostService private readonly nativeHostService: INativeHostService ) { super(ReportExtensionIssueAction._id, ReportExtensionIssueAction._label, 'extension-action report-issue'); this.enabled = extension.marketplaceInfo @@ -568,7 +568,7 @@ export class ReportExtensionIssueAction extends Action { let message = ':warning: We have written the needed data into your clipboard. Please paste! :warning:'; this.clipboardService.writeText('```json \n' + JSON.stringify(extension.status, null, '\t') + '\n```'); - const os = await this.electronService.getOSProperties(); + const os = await this.nativeHostService.getOSProperties(); const osVersion = `${os.type} ${os.arch} ${os.release}`; const queryStringPrefix = baseUrl.indexOf('?') === -1 ? '?' : '&'; const body = encodeURIComponent( @@ -590,7 +590,7 @@ export class DebugExtensionHostAction extends Action { constructor( @IDebugService private readonly _debugService: IDebugService, - @IElectronService private readonly _electronService: IElectronService, + @INativeHostService private readonly _nativeHostService: INativeHostService, @IDialogService private readonly _dialogService: IDialogService, @IExtensionService private readonly _extensionService: IExtensionService, @IProductService private readonly productService: IProductService @@ -610,7 +610,7 @@ export class DebugExtensionHostAction extends Action { secondaryButton: nls.localize('cancel', "Cancel") }); if (res.confirmed) { - await this._electronService.relaunch({ addArgs: [`--inspect-extensions=${randomPort()}`] }); + await this._nativeHostService.relaunch({ addArgs: [`--inspect-extensions=${randomPort()}`] }); } return; @@ -666,7 +666,7 @@ export class SaveExtensionHostProfileAction extends Action { constructor( id: string = SaveExtensionHostProfileAction.ID, label: string = SaveExtensionHostProfileAction.LABEL, - @IElectronService private readonly _electronService: IElectronService, + @INativeHostService private readonly _nativeHostService: INativeHostService, @IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService, @IExtensionHostProfileService private readonly _extensionHostProfileService: IExtensionHostProfileService, @IFileService private readonly _fileService: IFileService @@ -682,7 +682,7 @@ export class SaveExtensionHostProfileAction extends Action { } private async _asyncRun(): Promise { - let picked = await this._electronService.showSaveDialog({ + let picked = await this._nativeHostService.showSaveDialog({ title: 'Save Extension Host Profile', buttonLabel: 'Save', defaultPath: `CPU-${new Date().toISOString().replace(/[\-:]/g, '')}.cpuprofile`, diff --git a/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsActions.ts b/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsActions.ts index 2df5b00fd45..a24fb6882b8 100644 --- a/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsActions.ts +++ b/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsActions.ts @@ -9,7 +9,7 @@ import { IFileService } from 'vs/platform/files/common/files'; import { URI } from 'vs/base/common/uri'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { Schemas } from 'vs/base/common/network'; export class OpenExtensionsFolderAction extends Action { @@ -20,7 +20,7 @@ export class OpenExtensionsFolderAction extends Action { constructor( id: string, label: string, - @IElectronService private readonly electronService: IElectronService, + @INativeHostService private readonly nativeHostService: INativeHostService, @IFileService private readonly fileService: IFileService, @IWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService ) { @@ -40,7 +40,7 @@ export class OpenExtensionsFolderAction extends Action { } if (itemToShow.scheme === Schemas.file) { - return this.electronService.showItemInFolder(itemToShow.fsPath); + return this.nativeHostService.showItemInFolder(itemToShow.fsPath); } } } diff --git a/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsSlowActions.ts b/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsSlowActions.ts index fb26edac909..ab09ba5a258 100644 --- a/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsSlowActions.ts +++ b/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsSlowActions.ts @@ -17,7 +17,7 @@ import { onUnexpectedError } from 'vs/base/common/errors'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import Severity from 'vs/base/common/severity'; import { IOpenerService } from 'vs/platform/opener/common/opener'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; @@ -122,7 +122,7 @@ class ReportExtensionSlowAction extends Action { @IDialogService private readonly _dialogService: IDialogService, @IOpenerService private readonly _openerService: IOpenerService, @IProductService private readonly _productService: IProductService, - @IElectronService private readonly _electronService: IElectronService, + @INativeHostService private readonly _nativeHostService: INativeHostService, @IWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService ) { super('report.slow', localize('cmd.report', "Report Issue")); @@ -137,7 +137,7 @@ class ReportExtensionSlowAction extends Action { await profiler.writeProfile(data, path).then(undefined, onUnexpectedError); // build issue - const os = await this._electronService.getOSProperties(); + const os = await this._nativeHostService.getOSProperties(); const title = encodeURIComponent('Extension causes high cpu load'); const osVersion = `${os.type} ${os.arch} ${os.release}`; const message = `:warning: Make sure to **attach** this file from your *home*-directory:\n:warning:\`${path}\`\n\nFind more details here: https://github.com/microsoft/vscode/wiki/Explain-extension-causes-high-cpu-load`; diff --git a/src/vs/workbench/contrib/files/electron-sandbox/fileActions.contribution.ts b/src/vs/workbench/contrib/files/electron-sandbox/fileActions.contribution.ts index a335946a0d5..ce2717a4f2a 100644 --- a/src/vs/workbench/contrib/files/electron-sandbox/fileActions.contribution.ts +++ b/src/vs/workbench/contrib/files/electron-sandbox/fileActions.contribution.ts @@ -9,7 +9,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace import { isWindows, isMacintosh } from 'vs/base/common/platform'; import { Schemas } from 'vs/base/common/network'; import { INotificationService } from 'vs/platform/notification/common/notification'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { KeyMod, KeyCode, KeyChord } from 'vs/base/common/keyCodes'; @@ -36,7 +36,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ }, handler: (accessor: ServicesAccessor, resource: URI | object) => { const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IExplorerService)); - revealResourcesInOS(resources, accessor.get(IElectronService), accessor.get(INotificationService), accessor.get(IWorkspaceContextService)); + revealResourcesInOS(resources, accessor.get(INativeHostService), accessor.get(INotificationService), accessor.get(IWorkspaceContextService)); } }); @@ -50,7 +50,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const activeInput = editorService.activeEditor; const resource = activeInput ? activeInput.resource : null; const resources = resource ? [resource] : []; - revealResourcesInOS(resources, accessor.get(IElectronService), accessor.get(INotificationService), accessor.get(IWorkspaceContextService)); + revealResourcesInOS(resources, accessor.get(INativeHostService), accessor.get(INotificationService), accessor.get(IWorkspaceContextService)); } }); diff --git a/src/vs/workbench/contrib/files/electron-sandbox/fileCommands.ts b/src/vs/workbench/contrib/files/electron-sandbox/fileCommands.ts index e941d1ece27..eb9b881a113 100644 --- a/src/vs/workbench/contrib/files/electron-sandbox/fileCommands.ts +++ b/src/vs/workbench/contrib/files/electron-sandbox/fileCommands.ts @@ -9,21 +9,21 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace import { sequence } from 'vs/base/common/async'; import { Schemas } from 'vs/base/common/network'; import { INotificationService } from 'vs/platform/notification/common/notification'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; // Commands -export function revealResourcesInOS(resources: URI[], electronService: IElectronService, notificationService: INotificationService, workspaceContextService: IWorkspaceContextService): void { +export function revealResourcesInOS(resources: URI[], nativeHostService: INativeHostService, notificationService: INotificationService, workspaceContextService: IWorkspaceContextService): void { if (resources.length) { sequence(resources.map(r => async () => { if (r.scheme === Schemas.file || r.scheme === Schemas.userData) { - electronService.showItemInFolder(r.fsPath); + nativeHostService.showItemInFolder(r.fsPath); } })); } else if (workspaceContextService.getWorkspace().folders.length) { const uri = workspaceContextService.getWorkspace().folders[0].uri; if (uri.scheme === Schemas.file) { - electronService.showItemInFolder(uri.fsPath); + nativeHostService.showItemInFolder(uri.fsPath); } } else { notificationService.info(nls.localize('openFileToReveal', "Open a file first to reveal")); diff --git a/src/vs/workbench/contrib/files/electron-sandbox/textFileEditor.ts b/src/vs/workbench/contrib/files/electron-sandbox/textFileEditor.ts index 258de1884e8..c6655f26307 100644 --- a/src/vs/workbench/contrib/files/electron-sandbox/textFileEditor.ts +++ b/src/vs/workbench/contrib/files/electron-sandbox/textFileEditor.ts @@ -22,7 +22,7 @@ import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editor import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences'; import { IExplorerService } from 'vs/workbench/contrib/files/common/files'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity'; /** @@ -42,7 +42,7 @@ export class NativeTextFileEditor extends TextFileEditor { @IThemeService themeService: IThemeService, @IEditorGroupsService editorGroupService: IEditorGroupsService, @ITextFileService textFileService: ITextFileService, - @IElectronService private readonly electronService: IElectronService, + @INativeHostService private readonly nativeHostService: INativeHostService, @IPreferencesService private readonly preferencesService: IPreferencesService, @IExplorerService explorerService: IExplorerService, @IUriIdentityService uriIdentityService: IUriIdentityService @@ -59,7 +59,7 @@ export class NativeTextFileEditor extends TextFileEditor { throw createErrorWithActions(nls.localize('fileTooLargeForHeapError', "To open a file of this size, you need to restart and allow it to use more memory"), { actions: [ new Action('workbench.window.action.relaunchWithIncreasedMemoryLimit', nls.localize('relaunchWithIncreasedMemoryLimit', "Restart with {0} MB", memoryLimit), undefined, true, () => { - return this.electronService.relaunch({ + return this.nativeHostService.relaunch({ addArgs: [ `--max-memory=${memoryLimit}` ] diff --git a/src/vs/workbench/contrib/logs/electron-sandbox/logsActions.ts b/src/vs/workbench/contrib/logs/electron-sandbox/logsActions.ts index f27b568eaab..1d44de823f7 100644 --- a/src/vs/workbench/contrib/logs/electron-sandbox/logsActions.ts +++ b/src/vs/workbench/contrib/logs/electron-sandbox/logsActions.ts @@ -7,7 +7,7 @@ import { Action } from 'vs/base/common/actions'; import { join } from 'vs/base/common/path'; import { URI } from 'vs/base/common/uri'; import * as nls from 'vs/nls'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { IFileService } from 'vs/platform/files/common/files'; @@ -19,13 +19,13 @@ export class OpenLogsFolderAction extends Action { constructor(id: string, label: string, @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, - @IElectronService private readonly electronService: IElectronService, + @INativeHostService private readonly nativeHostService: INativeHostService, ) { super(id, label); } run(): Promise { - return this.electronService.showItemInFolder(URI.file(join(this.environmentService.logsPath, 'main.log')).fsPath); + return this.nativeHostService.showItemInFolder(URI.file(join(this.environmentService.logsPath, 'main.log')).fsPath); } } @@ -37,7 +37,7 @@ export class OpenExtensionLogsFolderAction extends Action { constructor(id: string, label: string, @IWorkbenchEnvironmentService private readonly environmentSerice: INativeWorkbenchEnvironmentService, @IFileService private readonly fileService: IFileService, - @IElectronService private readonly electronService: IElectronService + @INativeHostService private readonly nativeHostService: INativeHostService ) { super(id, label); } @@ -45,7 +45,7 @@ export class OpenExtensionLogsFolderAction extends Action { async run(): Promise { const folderStat = await this.fileService.resolve(this.environmentSerice.extHostLogsPath); if (folderStat.children && folderStat.children[0]) { - return this.electronService.showItemInFolder(folderStat.children[0].resource.fsPath); + return this.nativeHostService.showItemInFolder(folderStat.children[0].resource.fsPath); } } } diff --git a/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts b/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts index 3e8c73d7e28..65c5d58ee32 100644 --- a/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts +++ b/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts @@ -17,7 +17,7 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { URI } from 'vs/base/common/uri'; import { IOpenerService } from 'vs/platform/opener/common/opener'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { IProductService } from 'vs/platform/product/common/productService'; export class StartupProfiler implements IWorkbenchContribution { @@ -30,7 +30,7 @@ export class StartupProfiler implements IWorkbenchContribution { @ILifecycleService lifecycleService: ILifecycleService, @IExtensionService extensionService: IExtensionService, @IOpenerService private readonly _openerService: IOpenerService, - @IElectronService private readonly _electronService: IElectronService, + @INativeHostService private readonly _nativeHostService: INativeHostService, @IProductService private readonly _productService: IProductService ) { // wait for everything to be ready @@ -83,7 +83,7 @@ export class StartupProfiler implements IWorkbenchContribution { }).then(res => { if (res.confirmed) { Promise.all([ - this._electronService.showItemInFolder(URI.file(join(dir, files[0])).fsPath), + this._nativeHostService.showItemInFolder(URI.file(join(dir, files[0])).fsPath), this._createPerfIssue(files) ]).then(() => { // keep window stable until restart is selected @@ -95,13 +95,13 @@ export class StartupProfiler implements IWorkbenchContribution { secondaryButton: undefined }).then(() => { // now we are ready to restart - this._electronService.relaunch({ removeArgs }); + this._nativeHostService.relaunch({ removeArgs }); }); }); } else { // simply restart - this._electronService.relaunch({ removeArgs }); + this._nativeHostService.relaunch({ removeArgs }); } }); }); diff --git a/src/vs/workbench/contrib/performance/electron-browser/startupTimings.ts b/src/vs/workbench/contrib/performance/electron-browser/startupTimings.ts index 5798ad547a7..c27db170167 100644 --- a/src/vs/workbench/contrib/performance/electron-browser/startupTimings.ts +++ b/src/vs/workbench/contrib/performance/electron-browser/startupTimings.ts @@ -14,7 +14,7 @@ import { ILifecycleService, StartupKind, StartupKindToString } from 'vs/platform import { IProductService } from 'vs/platform/product/common/productService'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IUpdateService } from 'vs/platform/update/common/update'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import * as files from 'vs/workbench/contrib/files/common/files'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; @@ -27,7 +27,7 @@ export class StartupTimings implements IWorkbenchContribution { constructor( @ITimerService private readonly _timerService: ITimerService, - @IElectronService private readonly _electronService: IElectronService, + @INativeHostService private readonly _nativeHostService: INativeHostService, @IEditorService private readonly _editorService: IEditorService, @IViewletService private readonly _viewletService: IViewletService, @IPanelService private readonly _panelService: IPanelService, @@ -61,10 +61,10 @@ export class StartupTimings implements IWorkbenchContribution { ]).then(([startupMetrics]) => { return promisify(appendFile)(appendTo, `${startupMetrics.ellapsed}\t${this._productService.nameShort}\t${(this._productService.commit || '').slice(0, 10) || '0000000000'}\t${sessionId}\t${standardStartupError === undefined ? 'standard_start' : 'NO_standard_start : ' + standardStartupError}\n`); }).then(() => { - this._electronService.quit(); + this._nativeHostService.quit(); }).catch(err => { console.error(err); - this._electronService.quit(); + this._nativeHostService.quit(); }); } @@ -78,7 +78,7 @@ export class StartupTimings implements IWorkbenchContribution { if (this._lifecycleService.startupKind !== StartupKind.NewWindow) { return StartupKindToString(this._lifecycleService.startupKind); } - const windowCount = await this._electronService.getWindowCount(); + const windowCount = await this._nativeHostService.getWindowCount(); if (windowCount !== 1) { return 'Expected window count : 1, Actual : ' + windowCount; } diff --git a/src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts b/src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts index b2176a69a59..d60ad762cdf 100644 --- a/src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts +++ b/src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts @@ -26,7 +26,7 @@ import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editor import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import * as perf from 'vs/base/common/performance'; import { assertIsDefined } from 'vs/base/common/types'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; class PartsSplash { @@ -46,7 +46,7 @@ class PartsSplash { @ILifecycleService lifecycleService: ILifecycleService, @IEditorGroupsService editorGroupsService: IEditorGroupsService, @IConfigurationService configService: IConfigurationService, - @IElectronService private readonly _electronService: IElectronService + @INativeHostService private readonly _nativeHostService: INativeHostService ) { lifecycleService.when(LifecyclePhase.Restored).then(_ => { this._removePartsSplash(); @@ -114,7 +114,7 @@ class PartsSplash { // the color needs to be in hex const backgroundColor = this._themeService.getColorTheme().getColor(editorBackground) || themes.WORKBENCH_BACKGROUND(this._themeService.getColorTheme()); const payload = JSON.stringify({ baseTheme, background: Color.Format.CSS.formatHex(backgroundColor) }); - ipcRenderer.send('vscode:changeColorTheme', this._electronService.windowId, payload); + ipcRenderer.send('vscode:changeColorTheme', this._nativeHostService.windowId, payload); } } diff --git a/src/vs/workbench/contrib/terminal/electron-browser/terminalNativeContribution.ts b/src/vs/workbench/contrib/terminal/electron-browser/terminalNativeContribution.ts index 0181e504903..b5b3f648414 100644 --- a/src/vs/workbench/contrib/terminal/electron-browser/terminalNativeContribution.ts +++ b/src/vs/workbench/contrib/terminal/electron-browser/terminalNativeContribution.ts @@ -13,7 +13,7 @@ import { execFile } from 'child_process'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { registerRemoteContributions } from 'vs/workbench/contrib/terminal/electron-browser/terminalRemote'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { Disposable } from 'vs/base/common/lifecycle'; import { ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; @@ -26,12 +26,12 @@ export class TerminalNativeContribution extends Disposable implements IWorkbench @ITerminalService private readonly _terminalService: ITerminalService, @IInstantiationService readonly instantiationService: IInstantiationService, @IRemoteAgentService readonly remoteAgentService: IRemoteAgentService, - @IElectronService readonly electronService: IElectronService + @INativeHostService readonly nativeHostService: INativeHostService ) { super(); ipcRenderer.on('vscode:openFiles', (_: unknown, request: INativeOpenFileRequest) => this._onOpenFileRequest(request)); - this._register(electronService.onOSResume(() => this._onOsResume())); + this._register(nativeHostService.onOSResume(() => this._onOsResume())); this._terminalService.setLinuxDistro(linuxDistro); this._terminalService.setNativeWindowsDelegate({ diff --git a/src/vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution.ts b/src/vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution.ts index 2186c7ee0a4..1f199d19b0a 100644 --- a/src/vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution.ts +++ b/src/vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution.ts @@ -14,7 +14,7 @@ import { localize } from 'vs/nls'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IFileService } from 'vs/platform/files/common/files'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; import { Action } from 'vs/base/common/actions'; import { IWorkbenchIssueService } from 'vs/workbench/contrib/issue/electron-sandbox/issue'; @@ -84,13 +84,13 @@ registerAction2(class OpenSyncBackupsFolder extends Action2 { } async run(accessor: ServicesAccessor): Promise { const syncHome = accessor.get(IEnvironmentService).userDataSyncHome; - const electronService = accessor.get(IElectronService); + const nativeHostService = accessor.get(INativeHostService); const fileService = accessor.get(IFileService); const notificationService = accessor.get(INotificationService); if (await fileService.exists(syncHome)) { const folderStat = await fileService.resolve(syncHome); const item = folderStat.children && folderStat.children[0] ? folderStat.children[0].resource : syncHome; - return electronService.showItemInFolder(item.fsPath); + return nativeHostService.showItemInFolder(item.fsPath); } else { notificationService.info(localize('no backups', "Local backups folder does not exist")); } diff --git a/src/vs/workbench/contrib/webview/electron-sandbox/resourceLoading.ts b/src/vs/workbench/contrib/webview/electron-sandbox/resourceLoading.ts index 4f62d6314fa..6f9ff94676d 100644 --- a/src/vs/workbench/contrib/webview/electron-sandbox/resourceLoading.ts +++ b/src/vs/workbench/contrib/webview/electron-sandbox/resourceLoading.ts @@ -11,7 +11,7 @@ import { URI, UriComponents } from 'vs/base/common/uri'; import { createChannelSender } from 'vs/base/parts/ipc/common/ipc'; import { ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals'; import * as modes from 'vs/editor/common/modes'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { IFileService } from 'vs/platform/files/common/files'; import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService'; import { ILogService } from 'vs/platform/log/common/log'; @@ -62,7 +62,7 @@ export class WebviewResourceRequestManager extends Disposable { @IRemoteAuthorityResolverService remoteAuthorityResolverService: IRemoteAuthorityResolverService, @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, @IMainProcessService mainProcessService: IMainProcessService, - @IElectronService electronService: IElectronService, + @INativeHostService nativeHostService: INativeHostService, @IFileService fileService: IFileService, @IRequestService requestService: IRequestService, ) { @@ -79,7 +79,7 @@ export class WebviewResourceRequestManager extends Disposable { const remoteConnectionData = remoteAuthority ? remoteAuthorityResolverService.getConnectionData(remoteAuthority) : null; this._logService.debug(`WebviewResourceRequestManager(${this.id}): did-start-loading`); - this._ready = this._webviewManagerService.registerWebview(this.id, electronService.windowId, { + this._ready = this._webviewManagerService.registerWebview(this.id, nativeHostService.windowId, { extensionLocation: this.extension?.location.toJSON(), localResourceRoots: this._localResourceRoots.map(x => x.toJSON()), remoteConnectionData: remoteConnectionData, diff --git a/src/vs/workbench/contrib/welcome/telemetryOptOut/electron-sandbox/telemetryOptOut.ts b/src/vs/workbench/contrib/welcome/telemetryOptOut/electron-sandbox/telemetryOptOut.ts index c5daf374c69..60c4fcfa34c 100644 --- a/src/vs/workbench/contrib/welcome/telemetryOptOut/electron-sandbox/telemetryOptOut.ts +++ b/src/vs/workbench/contrib/welcome/telemetryOptOut/electron-sandbox/telemetryOptOut.ts @@ -15,7 +15,7 @@ import { IHostService } from 'vs/workbench/services/host/browser/host'; import { AbstractTelemetryOptOut } from 'vs/workbench/contrib/welcome/telemetryOptOut/browser/telemetryOptOut'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IJSONEditingService } from 'vs/workbench/services/configuration/common/jsonEditing'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys'; export class NativeTelemetryOptOut extends AbstractTelemetryOptOut { @@ -33,7 +33,7 @@ export class NativeTelemetryOptOut extends AbstractTelemetryOptOut { @IProductService productService: IProductService, @IEnvironmentService environmentService: IEnvironmentService, @IJSONEditingService jsonEditingService: IJSONEditingService, - @IElectronService private readonly electronService: IElectronService + @INativeHostService private readonly nativeHostService: INativeHostService ) { super(storageService, storageKeysSyncRegistryService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService, environmentService, jsonEditingService); @@ -41,6 +41,6 @@ export class NativeTelemetryOptOut extends AbstractTelemetryOptOut { } protected getWindowCount(): Promise { - return this.electronService.getWindowCount(); + return this.nativeHostService.getWindowCount(); } } diff --git a/src/vs/workbench/electron-browser/desktop.main.ts b/src/vs/workbench/electron-browser/desktop.main.ts index 4bc5d024dc7..348c5f27394 100644 --- a/src/vs/workbench/electron-browser/desktop.main.ts +++ b/src/vs/workbench/electron-browser/desktop.main.ts @@ -48,7 +48,7 @@ import product from 'vs/platform/product/common/product'; import { NativeResourceIdentityService } from 'vs/platform/resource/node/resourceIdentityServiceImpl'; import { IResourceIdentityService } from 'vs/platform/resource/common/resourceIdentityService'; import { NativeLogService } from 'vs/workbench/services/log/electron-browser/logService'; -import { IElectronService, ElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService, NativeHostService } from 'vs/platform/native/electron-sandbox/native'; class DesktopMain extends Disposable { @@ -194,15 +194,15 @@ class DesktopMain extends Disposable { const remoteAgentService = this._register(new RemoteAgentService(this.environmentService, this.productService, remoteAuthorityResolverService, signService, logService)); serviceCollection.set(IRemoteAgentService, remoteAgentService); - // Electron - const electronService = new ElectronService(this.configuration.windowId, mainProcessService) as IElectronService; - serviceCollection.set(IElectronService, electronService); + // Native Host + const nativeHostService = new NativeHostService(this.configuration.windowId, mainProcessService) as INativeHostService; + serviceCollection.set(INativeHostService, nativeHostService); // Files const fileService = this._register(new FileService(logService)); serviceCollection.set(IFileService, fileService); - const diskFileSystemProvider = this._register(new DiskFileSystemProvider(logService, electronService)); + const diskFileSystemProvider = this._register(new DiskFileSystemProvider(logService, nativeHostService)); fileService.registerProvider(Schemas.file, diskFileSystemProvider); // User Data Provider diff --git a/src/vs/workbench/electron-sandbox/actions/developerActions.ts b/src/vs/workbench/electron-sandbox/actions/developerActions.ts index 6c20467143d..1753e42e604 100644 --- a/src/vs/workbench/electron-sandbox/actions/developerActions.ts +++ b/src/vs/workbench/electron-sandbox/actions/developerActions.ts @@ -5,7 +5,7 @@ import { Action } from 'vs/base/common/actions'; import * as nls from 'vs/nls'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; @@ -17,13 +17,13 @@ export class ToggleDevToolsAction extends Action { constructor( id: string, label: string, - @IElectronService private readonly electronService: IElectronService + @INativeHostService private readonly nativeHostService: INativeHostService ) { super(id, label); } run(): Promise { - return this.electronService.toggleDevTools(); + return this.nativeHostService.toggleDevTools(); } } diff --git a/src/vs/workbench/electron-sandbox/actions/windowActions.ts b/src/vs/workbench/electron-sandbox/actions/windowActions.ts index 480474191f9..57b01d68e98 100644 --- a/src/vs/workbench/electron-sandbox/actions/windowActions.ts +++ b/src/vs/workbench/electron-sandbox/actions/windowActions.ts @@ -19,7 +19,7 @@ import { getIconClasses } from 'vs/editor/common/services/getIconClasses'; import { ICommandHandler } from 'vs/platform/commands/common/commands'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { Codicon } from 'vs/base/common/codicons'; export class CloseCurrentWindowAction extends Action { @@ -30,13 +30,13 @@ export class CloseCurrentWindowAction extends Action { constructor( id: string, label: string, - @IElectronService private readonly electronService: IElectronService + @INativeHostService private readonly nativeHostService: INativeHostService ) { super(id, label); } async run(): Promise { - this.electronService.closeWindow(); + this.nativeHostService.closeWindow(); } } @@ -130,13 +130,13 @@ export class ReloadWindowWithExtensionsDisabledAction extends Action { constructor( id: string, label: string, - @IElectronService private readonly electronService: IElectronService + @INativeHostService private readonly nativeHostService: INativeHostService ) { super(id, label); } async run(): Promise { - await this.electronService.reload({ disableExtensions: true }); + await this.nativeHostService.reload({ disableExtensions: true }); return true; } @@ -162,7 +162,7 @@ export abstract class BaseSwitchWindow extends Action { private readonly keybindingService: IKeybindingService, private readonly modelService: IModelService, private readonly modeService: IModeService, - private readonly electronService: IElectronService + private readonly nativeHostService: INativeHostService ) { super(id, label); } @@ -170,9 +170,9 @@ export abstract class BaseSwitchWindow extends Action { protected abstract isQuickNavigate(): boolean; async run(): Promise { - const currentWindowId = this.electronService.windowId; + const currentWindowId = this.nativeHostService.windowId; - const windows = await this.electronService.getWindows(); + const windows = await this.nativeHostService.getWindows(); const placeHolder = nls.localize('switchWindowPlaceHolder', "Select a window to switch to"); const picks = windows.map(win => { const resource = win.filename ? URI.file(win.filename) : win.folderUri ? win.folderUri : win.workspace ? win.workspace.configPath : undefined; @@ -194,13 +194,13 @@ export abstract class BaseSwitchWindow extends Action { placeHolder, quickNavigate: this.isQuickNavigate() ? { keybindings: this.keybindingService.lookupKeybindings(this.id) } : undefined, onDidTriggerItemButton: async context => { - await this.electronService.closeWindowById(context.item.payload); + await this.nativeHostService.closeWindowById(context.item.payload); context.removeItem(); } }); if (pick) { - this.electronService.focusWindow({ windowId: pick.payload }); + this.nativeHostService.focusWindow({ windowId: pick.payload }); } } } @@ -217,9 +217,9 @@ export class SwitchWindow extends BaseSwitchWindow { @IKeybindingService keybindingService: IKeybindingService, @IModelService modelService: IModelService, @IModeService modeService: IModeService, - @IElectronService electronService: IElectronService + @INativeHostService nativeHostService: INativeHostService ) { - super(id, label, quickInputService, keybindingService, modelService, modeService, electronService); + super(id, label, quickInputService, keybindingService, modelService, modeService, nativeHostService); } protected isQuickNavigate(): boolean { @@ -239,9 +239,9 @@ export class QuickSwitchWindow extends BaseSwitchWindow { @IKeybindingService keybindingService: IKeybindingService, @IModelService modelService: IModelService, @IModeService modeService: IModeService, - @IElectronService electronService: IElectronService + @INativeHostService nativeHostService: INativeHostService ) { - super(id, label, quickInputService, keybindingService, modelService, modeService, electronService); + super(id, label, quickInputService, keybindingService, modelService, modeService, nativeHostService); } protected isQuickNavigate(): boolean { @@ -250,25 +250,25 @@ export class QuickSwitchWindow extends BaseSwitchWindow { } export const NewWindowTabHandler: ICommandHandler = function (accessor: ServicesAccessor) { - return accessor.get(IElectronService).newWindowTab(); + return accessor.get(INativeHostService).newWindowTab(); }; export const ShowPreviousWindowTabHandler: ICommandHandler = function (accessor: ServicesAccessor) { - return accessor.get(IElectronService).showPreviousWindowTab(); + return accessor.get(INativeHostService).showPreviousWindowTab(); }; export const ShowNextWindowTabHandler: ICommandHandler = function (accessor: ServicesAccessor) { - return accessor.get(IElectronService).showNextWindowTab(); + return accessor.get(INativeHostService).showNextWindowTab(); }; export const MoveWindowTabToNewWindowHandler: ICommandHandler = function (accessor: ServicesAccessor) { - return accessor.get(IElectronService).moveWindowTabToNewWindow(); + return accessor.get(INativeHostService).moveWindowTabToNewWindow(); }; export const MergeWindowTabsHandlerHandler: ICommandHandler = function (accessor: ServicesAccessor) { - return accessor.get(IElectronService).mergeAllWindowTabs(); + return accessor.get(INativeHostService).mergeAllWindowTabs(); }; export const ToggleWindowTabsBarHandler: ICommandHandler = function (accessor: ServicesAccessor) { - return accessor.get(IElectronService).toggleWindowTabsBar(); + return accessor.get(INativeHostService).toggleWindowTabsBar(); }; diff --git a/src/vs/workbench/electron-sandbox/desktop.contribution.ts b/src/vs/workbench/electron-sandbox/desktop.contribution.ts index 38ccac63b5c..7c3ff5ecb61 100644 --- a/src/vs/workbench/electron-sandbox/desktop.contribution.ts +++ b/src/vs/workbench/electron-sandbox/desktop.contribution.ts @@ -18,7 +18,7 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IsDevelopmentContext, IsMacContext } from 'vs/platform/contextkey/common/contextkeys'; import { EditorsVisibleContext, SingleEditorGroupsContext } from 'vs/workbench/common/editor'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry'; import product from 'vs/platform/product/common/product'; import { IJSONSchema } from 'vs/base/common/jsonSchema'; @@ -48,8 +48,8 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema'; when: ContextKeyExpr.and(EditorsVisibleContext.toNegated(), SingleEditorGroupsContext), primary: KeyMod.CtrlCmd | KeyCode.KEY_W, handler: accessor => { - const electronService = accessor.get(IElectronService); - electronService.closeWindow(); + const nativeHostService = accessor.get(INativeHostService); + nativeHostService.closeWindow(); } }); @@ -57,8 +57,8 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema'; id: 'workbench.action.quit', weight: KeybindingWeight.WorkbenchContrib, handler(accessor: ServicesAccessor) { - const electronService = accessor.get(IElectronService); - electronService.quit(); + const nativeHostService = accessor.get(INativeHostService); + nativeHostService.quit(); }, when: undefined, mac: { primary: KeyMod.CtrlCmd | KeyCode.KEY_Q }, diff --git a/src/vs/workbench/electron-sandbox/desktop.main.ts b/src/vs/workbench/electron-sandbox/desktop.main.ts index b0ba3af6356..c8c882cb5f8 100644 --- a/src/vs/workbench/electron-sandbox/desktop.main.ts +++ b/src/vs/workbench/electron-sandbox/desktop.main.ts @@ -30,7 +30,7 @@ import { FileUserDataProvider } from 'vs/workbench/services/userData/common/file import { IProductService } from 'vs/platform/product/common/productService'; import product from 'vs/platform/product/common/product'; import { IResourceIdentityService } from 'vs/platform/resource/common/resourceIdentityService'; -import { IElectronService, ElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService, NativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { SimpleConfigurationService, simpleFileSystemProvider, SimpleLogService, SimpleRemoteAgentService, SimpleResourceIdentityService, SimpleSignService, SimpleStorageService, SimpleWorkbenchEnvironmentService, SimpleWorkspaceService } from 'vs/workbench/electron-sandbox/sandbox.simpleservices'; import { INativeWorkbenchConfiguration } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { RemoteAuthorityResolverService } from 'vs/platform/remote/electron-sandbox/remoteAuthorityResolverService'; @@ -171,9 +171,9 @@ class DesktopMain extends Disposable { const remoteAgentService = new SimpleRemoteAgentService(); serviceCollection.set(IRemoteAgentService, remoteAgentService); - // Electron - const electronService = new ElectronService(this.configuration.windowId, mainProcessService) as IElectronService; - serviceCollection.set(IElectronService, electronService); + // Native Host + const nativeHostService = new NativeHostService(this.configuration.windowId, mainProcessService) as INativeHostService; + serviceCollection.set(INativeHostService, nativeHostService); // Files const fileService = this._register(new FileService(logService)); diff --git a/src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts b/src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts index 9408a9d94a6..7002cb2880a 100644 --- a/src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts @@ -20,7 +20,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import { IProductService } from 'vs/platform/product/common/productService'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { getTitleBarStyle } from 'vs/platform/windows/common/windows'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { Codicon } from 'vs/base/common/codicons'; @@ -47,7 +47,7 @@ export class TitlebarPart extends BrowserTitleBarPart { @IContextKeyService contextKeyService: IContextKeyService, @IHostService hostService: IHostService, @IProductService productService: IProductService, - @IElectronService private readonly electronService: IElectronService + @INativeHostService private readonly nativeHostService: INativeHostService ) { super(contextMenuService, configurationService, editorService, environmentService, contextService, instantiationService, themeService, labelService, storageService, layoutService, menuService, contextKeyService, hostService, productService); } @@ -159,7 +159,7 @@ export class TitlebarPart extends BrowserTitleBarPart { this.onUpdateAppIconDragBehavior(); this._register(DOM.addDisposableListener(this.appIcon, DOM.EventType.DBLCLICK, (e => { - this.electronService.closeWindow(); + this.nativeHostService.closeWindow(); }))); } @@ -173,24 +173,24 @@ export class TitlebarPart extends BrowserTitleBarPart { // Minimize const minimizeIcon = DOM.append(this.windowControls, DOM.$('div.window-icon.window-minimize' + Codicon.chromeMinimize.cssSelector)); this._register(DOM.addDisposableListener(minimizeIcon, DOM.EventType.CLICK, e => { - this.electronService.minimizeWindow(); + this.nativeHostService.minimizeWindow(); })); // Restore this.maxRestoreControl = DOM.append(this.windowControls, DOM.$('div.window-icon.window-max-restore')); this._register(DOM.addDisposableListener(this.maxRestoreControl, DOM.EventType.CLICK, async e => { - const maximized = await this.electronService.isMaximized(); + const maximized = await this.nativeHostService.isMaximized(); if (maximized) { - return this.electronService.unmaximizeWindow(); + return this.nativeHostService.unmaximizeWindow(); } - return this.electronService.maximizeWindow(); + return this.nativeHostService.maximizeWindow(); })); // Close const closeIcon = DOM.append(this.windowControls, DOM.$('div.window-icon.window-close' + Codicon.chromeClose.cssSelector)); this._register(DOM.addDisposableListener(closeIcon, DOM.EventType.CLICK, e => { - this.electronService.closeWindow(); + this.nativeHostService.closeWindow(); })); // Resizer diff --git a/src/vs/workbench/electron-sandbox/window.ts b/src/vs/workbench/electron-sandbox/window.ts index 9d0bef938f4..3a89efaeff6 100644 --- a/src/vs/workbench/electron-sandbox/window.ts +++ b/src/vs/workbench/electron-sandbox/window.ts @@ -51,7 +51,7 @@ import { IMenubarService } from 'vs/platform/menubar/electron-sandbox/menubar'; import { withNullAsUndefined, assertIsDefined } from 'vs/base/common/types'; import { IOpenerService, OpenOptions } from 'vs/platform/opener/common/opener'; import { Schemas } from 'vs/base/common/network'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { posix, dirname } from 'vs/base/common/path'; import { getBaseLabel } from 'vs/base/common/labels'; import { ITunnelService, extractLocalHostUriMetaDataForPortMapping } from 'vs/platform/remote/common/tunnel'; @@ -100,7 +100,7 @@ export class NativeWindow extends Disposable { @IWorkspaceContextService private readonly contextService: IWorkspaceContextService, @IInstantiationService private readonly instantiationService: IInstantiationService, @IOpenerService private readonly openerService: IOpenerService, - @IElectronService private readonly electronService: IElectronService, + @INativeHostService private readonly nativeHostService: INativeHostService, @ITunnelService private readonly tunnelService: ITunnelService, @IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService, @IWorkingCopyService private readonly workingCopyService: IWorkingCopyService, @@ -242,7 +242,7 @@ export class NativeWindow extends Disposable { this._register(DOM.addDisposableListener(titlePart, DOM.EventType.DBLCLICK, e => { DOM.EventHelper.stop(e); - this.electronService.handleTitleDoubleClick(); + this.nativeHostService.handleTitleDoubleClick(); })); } @@ -260,8 +260,8 @@ export class NativeWindow extends Disposable { // Detect minimize / maximize this._register(Event.any( - Event.map(Event.filter(this.electronService.onWindowMaximize, id => id === this.electronService.windowId), () => true), - Event.map(Event.filter(this.electronService.onWindowUnmaximize, id => id === this.electronService.windowId), () => false) + Event.map(Event.filter(this.nativeHostService.onWindowMaximize, id => id === this.nativeHostService.windowId), () => true), + Event.map(Event.filter(this.nativeHostService.onWindowUnmaximize, id => id === this.nativeHostService.windowId), () => false) )(e => this.onDidChangeMaximized(e))); this.onDidChangeMaximized(this.environmentService.configuration.maximized ?? false); @@ -271,7 +271,7 @@ export class NativeWindow extends Disposable { if ((!this.isDocumentedEdited && isDirty) || (this.isDocumentedEdited && !isDirty)) { this.isDocumentedEdited = isDirty; - this.electronService.setDocumentEdited(isDirty); + this.nativeHostService.setDocumentEdited(isDirty); } } @@ -296,7 +296,7 @@ export class NativeWindow extends Disposable { private onAllEditorsClosed(): void { const visibleEditorPanes = this.editorService.visibleEditorPanes.length; if (visibleEditorPanes === 0) { - this.electronService.closeWindow(); + this.nativeHostService.closeWindow(); } } @@ -321,7 +321,7 @@ export class NativeWindow extends Disposable { } private updateRepresentedFilename(filePath: string | undefined): void { - this.electronService.setRepresentedFilename(filePath ? filePath : ''); + this.nativeHostService.setRepresentedFilename(filePath ? filePath : ''); } private provideCustomTitleContextMenu(filePath: string | undefined): void { @@ -354,7 +354,7 @@ export class NativeWindow extends Disposable { } const commandId = `workbench.action.revealPathInFinder${i}`; - this.customTitleContextMenuDisposable.add(CommandsRegistry.registerCommand(commandId, () => this.electronService.showItemInFolder(path))); + this.customTitleContextMenuDisposable.add(CommandsRegistry.registerCommand(commandId, () => this.nativeHostService.showItemInFolder(path))); this.customTitleContextMenuDisposable.add(MenuRegistry.appendMenuItem(MenuId.TitleBarContext, { command: { id: commandId, title: label || posix.sep }, order: -i })); } } @@ -370,14 +370,14 @@ export class NativeWindow extends Disposable { this.setupOpenHandlers(); // Notify main side when window ready - this.lifecycleService.when(LifecyclePhase.Ready).then(() => this.electronService.notifyReady()); + this.lifecycleService.when(LifecyclePhase.Ready).then(() => this.nativeHostService.notifyReady()); // Integrity warning this.integrityService.isPure().then(res => this.titleService.updateProperties({ isPure: res.isPure })); // Root warning this.lifecycleService.when(LifecyclePhase.Restored).then(async () => { - const isAdmin = await this.electronService.isAdmin(); + const isAdmin = await this.nativeHostService.isAdmin(); // Update title this.titleService.updateProperties({ isAdmin }); @@ -402,12 +402,12 @@ export class NativeWindow extends Disposable { // Handle external open() calls this.openerService.setExternalOpener({ openExternal: async (href: string) => { - const success = await this.electronService.openExternal(href); + const success = await this.nativeHostService.openExternal(href); if (!success) { const fileCandidate = URI.parse(href); if (fileCandidate.scheme === Schemas.file) { // if opening failed, and this is a file, we can still try to reveal it - await this.electronService.showItemInFolder(fileCandidate.fsPath); + await this.nativeHostService.showItemInFolder(fileCandidate.fsPath); } } @@ -503,7 +503,7 @@ export class NativeWindow extends Disposable { // Only update if the actions have changed if (!equals(this.lastInstalledTouchedBar, items)) { this.lastInstalledTouchedBar = items; - this.electronService.updateTouchBar(items); + this.nativeHostService.updateTouchBar(items); } } @@ -597,7 +597,7 @@ class NativeMenubarControl extends MenubarControl { @IAccessibilityService accessibilityService: IAccessibilityService, @IMenubarService private readonly menubarService: IMenubarService, @IHostService hostService: IHostService, - @IElectronService private readonly electronService: IElectronService + @INativeHostService private readonly nativeHostService: INativeHostService ) { super( menuService, @@ -646,7 +646,7 @@ class NativeMenubarControl extends MenubarControl { // Send menus to main process to be rendered by Electron const menubarData = { menus: {}, keybindings: {} }; if (this.getMenubarMenus(menubarData)) { - this.menubarService.updateMenubar(this.electronService.windowId, menubarData); + this.menubarService.updateMenubar(this.nativeHostService.windowId, menubarData); } } diff --git a/src/vs/workbench/services/clipboard/electron-sandbox/clipboardService.ts b/src/vs/workbench/services/clipboard/electron-sandbox/clipboardService.ts index 3df04d9e4cf..8e3f25df564 100644 --- a/src/vs/workbench/services/clipboard/electron-sandbox/clipboardService.ts +++ b/src/vs/workbench/services/clipboard/electron-sandbox/clipboardService.ts @@ -7,7 +7,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService import { URI } from 'vs/base/common/uri'; import { isMacintosh } from 'vs/base/common/platform'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { VSBuffer } from 'vs/base/common/buffer'; export class NativeClipboardService implements IClipboardService { @@ -17,20 +17,20 @@ export class NativeClipboardService implements IClipboardService { declare readonly _serviceBrand: undefined; constructor( - @IElectronService private readonly electronService: IElectronService + @INativeHostService private readonly nativeHostService: INativeHostService ) { } async writeText(text: string, type?: 'selection' | 'clipboard'): Promise { - return this.electronService.writeClipboardText(text, type); + return this.nativeHostService.writeClipboardText(text, type); } async readText(type?: 'selection' | 'clipboard'): Promise { - return this.electronService.readClipboardText(type); + return this.nativeHostService.readClipboardText(type); } async readFindText(): Promise { if (isMacintosh) { - return this.electronService.readClipboardFindText(); + return this.nativeHostService.readClipboardFindText(); } return ''; @@ -38,22 +38,22 @@ export class NativeClipboardService implements IClipboardService { async writeFindText(text: string): Promise { if (isMacintosh) { - return this.electronService.writeClipboardFindText(text); + return this.nativeHostService.writeClipboardFindText(text); } } async writeResources(resources: URI[]): Promise { if (resources.length) { - return this.electronService.writeClipboardBuffer(NativeClipboardService.FILE_FORMAT, this.resourcesToBuffer(resources)); + return this.nativeHostService.writeClipboardBuffer(NativeClipboardService.FILE_FORMAT, this.resourcesToBuffer(resources)); } } async readResources(): Promise { - return this.bufferToResources(await this.electronService.readClipboardBuffer(NativeClipboardService.FILE_FORMAT)); + return this.bufferToResources(await this.nativeHostService.readClipboardBuffer(NativeClipboardService.FILE_FORMAT)); } async hasResources(): Promise { - return this.electronService.hasClipboard(NativeClipboardService.FILE_FORMAT); + return this.nativeHostService.hasClipboard(NativeClipboardService.FILE_FORMAT); } private resourcesToBuffer(resources: URI[]): Uint8Array { diff --git a/src/vs/workbench/services/dialogs/electron-sandbox/dialogService.ts b/src/vs/workbench/services/dialogs/electron-sandbox/dialogService.ts index 4165ad54471..0d6c4ed646a 100644 --- a/src/vs/workbench/services/dialogs/electron-sandbox/dialogService.ts +++ b/src/vs/workbench/services/dialogs/electron-sandbox/dialogService.ts @@ -17,7 +17,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IProductService } from 'vs/platform/product/common/productService'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { MessageBoxOptions } from 'vs/base/parts/sandbox/common/electronTypes'; import { fromNow } from 'vs/base/common/date'; import { process } from 'vs/base/parts/sandbox/electron-sandbox/globals'; @@ -52,10 +52,10 @@ export class DialogService implements IDialogService { @IKeybindingService keybindingService: IKeybindingService, @IProductService productService: IProductService, @IClipboardService clipboardService: IClipboardService, - @IElectronService electronService: IElectronService + @INativeHostService nativeHostService: INativeHostService ) { this.customImpl = new HTMLDialogService(logService, layoutService, themeService, keybindingService, productService, clipboardService); - this.nativeImpl = new NativeDialogService(logService, electronService, productService, clipboardService); + this.nativeImpl = new NativeDialogService(logService, nativeHostService, productService, clipboardService); } private get useCustomDialog(): boolean { @@ -89,7 +89,7 @@ class NativeDialogService implements IDialogService { constructor( @ILogService private readonly logService: ILogService, - @IElectronService private readonly electronService: IElectronService, + @INativeHostService private readonly nativeHostService: INativeHostService, @IProductService private readonly productService: IProductService, @IClipboardService private readonly clipboardService: IClipboardService ) { @@ -100,7 +100,7 @@ class NativeDialogService implements IDialogService { const { options, buttonIndexMap } = this.massageMessageBoxOptions(this.getConfirmOptions(confirmation)); - const result = await this.electronService.showMessageBox(options); + const result = await this.nativeHostService.showMessageBox(options); return { confirmed: buttonIndexMap[result.response] === 0 ? true : false, checkboxChecked: result.checkboxChecked @@ -157,7 +157,7 @@ class NativeDialogService implements IDialogService { checkboxChecked: dialogOptions && dialogOptions.checkbox ? dialogOptions.checkbox.checked : undefined }); - const result = await this.electronService.showMessageBox(options); + const result = await this.nativeHostService.showMessageBox(options); return { choice: buttonIndexMap[result.response], checkboxChecked: result.checkboxChecked }; } @@ -212,7 +212,7 @@ class NativeDialogService implements IDialogService { } const isSnap = process.platform === 'linux' && process.env.SNAP && process.env.SNAP_REVISION; - const osProps = await this.electronService.getOSProperties(); + const osProps = await this.nativeHostService.getOSProperties(); const detailString = (useAgo: boolean): string => { return nls.localize('aboutDetail', @@ -240,7 +240,7 @@ class NativeDialogService implements IDialogService { buttons = [ok, copy]; } - const result = await this.electronService.showMessageBox({ + const result = await this.nativeHostService.showMessageBox({ title: this.productService.nameLong, type: 'info', message: this.productService.nameLong, diff --git a/src/vs/workbench/services/dialogs/electron-sandbox/fileDialogService.ts b/src/vs/workbench/services/dialogs/electron-sandbox/fileDialogService.ts index 54c9b7475b2..79b5ea23dc2 100644 --- a/src/vs/workbench/services/dialogs/electron-sandbox/fileDialogService.ts +++ b/src/vs/workbench/services/dialogs/electron-sandbox/fileDialogService.ts @@ -15,7 +15,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IFileService } from 'vs/platform/files/common/files'; import { IOpenerService } from 'vs/platform/opener/common/opener'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { AbstractFileDialogService } from 'vs/workbench/services/dialogs/browser/abstractFileDialogService'; import { Schemas } from 'vs/base/common/network'; import { IModeService } from 'vs/editor/common/services/modeService'; @@ -36,7 +36,7 @@ export class FileDialogService extends AbstractFileDialogService implements IFil @IConfigurationService configurationService: IConfigurationService, @IFileService fileService: IFileService, @IOpenerService openerService: IOpenerService, - @IElectronService private readonly electronService: IElectronService, + @INativeHostService private readonly nativeHostService: INativeHostService, @IDialogService dialogService: IDialogService, @IModeService modeService: IModeService, @IWorkspacesService workspacesService: IWorkspacesService, @@ -72,7 +72,7 @@ export class FileDialogService extends AbstractFileDialogService implements IFil if (shouldUseSimplified.useSimplified) { return this.pickFileFolderAndOpenSimplified(schema, options, shouldUseSimplified.isSetting); } - return this.electronService.pickFileFolderAndOpen(this.toNativeOpenDialogOptions(options)); + return this.nativeHostService.pickFileFolderAndOpen(this.toNativeOpenDialogOptions(options)); } async pickFileAndOpen(options: IPickAndOpenOptions): Promise { @@ -86,7 +86,7 @@ export class FileDialogService extends AbstractFileDialogService implements IFil if (shouldUseSimplified.useSimplified) { return this.pickFileAndOpenSimplified(schema, options, shouldUseSimplified.isSetting); } - return this.electronService.pickFileAndOpen(this.toNativeOpenDialogOptions(options)); + return this.nativeHostService.pickFileAndOpen(this.toNativeOpenDialogOptions(options)); } async pickFolderAndOpen(options: IPickAndOpenOptions): Promise { @@ -99,7 +99,7 @@ export class FileDialogService extends AbstractFileDialogService implements IFil if (this.shouldUseSimplified(schema).useSimplified) { return this.pickFolderAndOpenSimplified(schema, options); } - return this.electronService.pickFolderAndOpen(this.toNativeOpenDialogOptions(options)); + return this.nativeHostService.pickFolderAndOpen(this.toNativeOpenDialogOptions(options)); } async pickWorkspaceAndOpen(options: IPickAndOpenOptions): Promise { @@ -112,7 +112,7 @@ export class FileDialogService extends AbstractFileDialogService implements IFil if (this.shouldUseSimplified(schema).useSimplified) { return this.pickWorkspaceAndOpenSimplified(schema, options); } - return this.electronService.pickWorkspaceAndOpen(this.toNativeOpenDialogOptions(options)); + return this.nativeHostService.pickWorkspaceAndOpen(this.toNativeOpenDialogOptions(options)); } async pickFileToSave(defaultUri: URI, availableFileSystems?: string[]): Promise { @@ -121,7 +121,7 @@ export class FileDialogService extends AbstractFileDialogService implements IFil if (this.shouldUseSimplified(schema).useSimplified) { return this.pickFileToSaveSimplified(schema, options); } else { - const result = await this.electronService.showSaveDialog(this.toNativeSaveDialogOptions(options)); + const result = await this.nativeHostService.showSaveDialog(this.toNativeSaveDialogOptions(options)); if (result && !result.canceled && result.filePath) { return URI.file(result.filePath); } @@ -145,7 +145,7 @@ export class FileDialogService extends AbstractFileDialogService implements IFil return this.showSaveDialogSimplified(schema, options); } - const result = await this.electronService.showSaveDialog(this.toNativeSaveDialogOptions(options)); + const result = await this.nativeHostService.showSaveDialog(this.toNativeSaveDialogOptions(options)); if (result && !result.canceled && result.filePath) { return URI.file(result.filePath); } @@ -183,7 +183,7 @@ export class FileDialogService extends AbstractFileDialogService implements IFil newOptions.properties.push('multiSelections'); } - const result = await this.electronService.showOpenDialog(newOptions); + const result = await this.nativeHostService.showOpenDialog(newOptions); return result && Array.isArray(result.filePaths) && result.filePaths.length > 0 ? result.filePaths.map(URI.file) : undefined; } diff --git a/src/vs/workbench/services/extensions/electron-browser/extensionService.ts b/src/vs/workbench/services/extensions/electron-browser/extensionService.ts index e8ae25e7800..04d2093d79c 100644 --- a/src/vs/workbench/services/extensions/electron-browser/extensionService.ts +++ b/src/vs/workbench/services/extensions/electron-browser/extensionService.ts @@ -31,7 +31,7 @@ import { PersistentConnectionEventType } from 'vs/platform/remote/common/remoteA import { IProductService } from 'vs/platform/product/common/productService'; import { Logger } from 'vs/workbench/services/extensions/common/extensionPoints'; import { flatten } from 'vs/base/common/arrays'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { IRemoteExplorerService } from 'vs/workbench/services/remote/common/remoteExplorerService'; import { Action2, registerAction2 } from 'vs/platform/actions/common/actions'; import { getRemoteName } from 'vs/platform/remote/common/remoteHosts'; @@ -71,7 +71,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten @IConfigurationService private readonly _configurationService: IConfigurationService, @ILifecycleService private readonly _lifecycleService: ILifecycleService, @IWebExtensionsScannerService private readonly _webExtensionsScannerService: IWebExtensionsScannerService, - @IElectronService private readonly _electronService: IElectronService, + @INativeHostService private readonly _nativeHostService: INativeHostService, @IHostService private readonly _hostService: IHostService, @IRemoteExplorerService private readonly _remoteExplorerService: IRemoteExplorerService, @IExtensionGalleryService private readonly _extensionGalleryService: IExtensionGalleryService, @@ -459,7 +459,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten this._notificationService.prompt(Severity.Error, nls.localize('extensionService.crash', "Extension host terminated unexpectedly."), [{ label: nls.localize('devTools', "Open Developer Tools"), - run: () => this._electronService.openDevTools() + run: () => this._nativeHostService.openDevTools() }, { label: nls.localize('restart', "Restart Extension Host"), @@ -628,10 +628,10 @@ export class ExtensionService extends AbstractExtensionService implements IExten public _onExtensionHostExit(code: number): void { if (this._isExtensionDevTestFromCli) { // When CLI testing make sure to exit with proper exit code - this._electronService.exit(code); + this._nativeHostService.exit(code); } else { // Expected development extension termination: When the extension host goes down we also shutdown the window - this._electronService.closeWindow(); + this._nativeHostService.closeWindow(); } } diff --git a/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts b/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts index 120cc71a351..a0a5e9a1a39 100644 --- a/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts +++ b/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts @@ -29,7 +29,7 @@ import { ILogService } from 'vs/platform/log/common/log'; import { IProductService } from 'vs/platform/product/common/productService'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IInitData, UIKind } from 'vs/workbench/api/common/extHost.protocol'; import { MessageType, createMessageOfType, isMessageOfType } from 'vs/workbench/services/extensions/common/extensionHostProtocol'; @@ -90,7 +90,7 @@ export class LocalProcessExtensionHost implements IExtensionHost { private readonly _initDataProvider: ILocalProcessExtensionHostDataProvider, @IWorkspaceContextService private readonly _contextService: IWorkspaceContextService, @INotificationService private readonly _notificationService: INotificationService, - @IElectronService private readonly _electronService: IElectronService, + @INativeHostService private readonly _nativeHostService: INativeHostService, @ILifecycleService private readonly _lifecycleService: ILifecycleService, @IWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService, @ITelemetryService private readonly _telemetryService: ITelemetryService, @@ -122,7 +122,7 @@ export class LocalProcessExtensionHost implements IExtensionHost { this._toDispose.add(this._lifecycleService.onShutdown(reason => this.terminate())); this._toDispose.add(this._extensionHostDebugService.onClose(event => { if (this._isExtensionDevHost && this._environmentService.debugExtensionHost.debugId === event.sessionId) { - this._electronService.closeWindow(); + this._nativeHostService.closeWindow(); } })); this._toDispose.add(this._extensionHostDebugService.onReload(event => { diff --git a/src/vs/workbench/services/host/electron-sandbox/nativeHostService.ts b/src/vs/workbench/services/host/electron-sandbox/nativeHostService.ts index 94a0121afd1..c6cb68a0213 100644 --- a/src/vs/workbench/services/host/electron-sandbox/nativeHostService.ts +++ b/src/vs/workbench/services/host/electron-sandbox/nativeHostService.ts @@ -5,7 +5,7 @@ import { Event } from 'vs/base/common/event'; import { IHostService } from 'vs/workbench/services/host/browser/host'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { ILabelService } from 'vs/platform/label/common/label'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; @@ -17,7 +17,7 @@ export class NativeHostService extends Disposable implements IHostService { declare readonly _serviceBrand: undefined; constructor( - @IElectronService private readonly electronService: IElectronService, + @INativeHostService private readonly nativeHostService: INativeHostService, @ILabelService private readonly labelService: ILabelService, @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService ) { @@ -28,8 +28,8 @@ export class NativeHostService extends Disposable implements IHostService { get onDidChangeFocus(): Event { return this._onDidChangeFocus; } private _onDidChangeFocus: Event = Event.latch(Event.any( - Event.map(Event.filter(this.electronService.onWindowFocus, id => id === this.electronService.windowId), () => this.hasFocus), - Event.map(Event.filter(this.electronService.onWindowBlur, id => id === this.electronService.windowId), () => this.hasFocus) + Event.map(Event.filter(this.nativeHostService.onWindowFocus, id => id === this.nativeHostService.windowId), () => this.hasFocus), + Event.map(Event.filter(this.nativeHostService.onWindowBlur, id => id === this.nativeHostService.windowId), () => this.hasFocus) )); get hasFocus(): boolean { @@ -37,13 +37,13 @@ export class NativeHostService extends Disposable implements IHostService { } async hadLastFocus(): Promise { - const activeWindowId = await this.electronService.getActiveWindowId(); + const activeWindowId = await this.nativeHostService.getActiveWindowId(); if (typeof activeWindowId === 'undefined') { return false; } - return activeWindowId === this.electronService.windowId; + return activeWindowId === this.nativeHostService.windowId; } //#endregion @@ -66,7 +66,7 @@ export class NativeHostService extends Disposable implements IHostService { toOpen.forEach(openable => openable.label = openable.label || this.getRecentLabel(openable)); } - return this.electronService.openWindow(toOpen, options); + return this.nativeHostService.openWindow(toOpen, options); } private getRecentLabel(openable: IWindowOpenable): string { @@ -82,11 +82,11 @@ export class NativeHostService extends Disposable implements IHostService { } private doOpenEmptyWindow(options?: IOpenEmptyWindowOptions): Promise { - return this.electronService.openWindow(options); + return this.nativeHostService.openWindow(options); } toggleFullScreen(): Promise { - return this.electronService.toggleFullScreen(); + return this.nativeHostService.toggleFullScreen(); } //#endregion @@ -95,15 +95,15 @@ export class NativeHostService extends Disposable implements IHostService { //#region Lifecycle focus(options?: { force: boolean }): Promise { - return this.electronService.focusWindow(options); + return this.nativeHostService.focusWindow(options); } restart(): Promise { - return this.electronService.relaunch(); + return this.nativeHostService.relaunch(); } reload(): Promise { - return this.electronService.reload(); + return this.nativeHostService.reload(); } //#endregion diff --git a/src/vs/workbench/services/lifecycle/electron-sandbox/lifecycleService.ts b/src/vs/workbench/services/lifecycle/electron-sandbox/lifecycleService.ts index 883af93ee8e..1d92faacfc8 100644 --- a/src/vs/workbench/services/lifecycle/electron-sandbox/lifecycleService.ts +++ b/src/vs/workbench/services/lifecycle/electron-sandbox/lifecycleService.ts @@ -14,7 +14,7 @@ import { onUnexpectedError } from 'vs/base/common/errors'; import { AbstractLifecycleService } from 'vs/platform/lifecycle/common/lifecycleService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import Severity from 'vs/base/common/severity'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; export class NativeLifecycleService extends AbstractLifecycleService { @@ -26,7 +26,7 @@ export class NativeLifecycleService extends AbstractLifecycleService { constructor( @INotificationService private readonly notificationService: INotificationService, - @IElectronService private readonly electronService: IElectronService, + @INativeHostService private readonly nativeHostService: INativeHostService, @IStorageService readonly storageService: IStorageService, @ILogService readonly logService: ILogService ) { @@ -56,7 +56,7 @@ export class NativeLifecycleService extends AbstractLifecycleService { } private registerListeners(): void { - const windowId = this.electronService.windowId; + const windowId = this.nativeHostService.windowId; // Main side indicates that window is about to unload, check for vetos ipcRenderer.on('vscode:onBeforeUnload', (event: unknown, reply: { okChannel: string, cancelChannel: string, reason: ShutdownReason }) => { diff --git a/src/vs/workbench/services/output/electron-browser/outputChannelModelService.ts b/src/vs/workbench/services/output/electron-browser/outputChannelModelService.ts index 5620ed98ca1..fdc63aae93b 100644 --- a/src/vs/workbench/services/output/electron-browser/outputChannelModelService.ts +++ b/src/vs/workbench/services/output/electron-browser/outputChannelModelService.ts @@ -21,7 +21,7 @@ import { toLocalISOString } from 'vs/base/common/date'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { Emitter, Event } from 'vs/base/common/event'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; class OutputChannelBackedByFile extends AbstractFileOutputChannelModel implements IOutputChannelModel { @@ -205,7 +205,7 @@ export class OutputChannelModelService extends AsbtractOutputChannelModelService @IInstantiationService instantiationService: IInstantiationService, @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, @IFileService private readonly fileService: IFileService, - @IElectronService private readonly electronService: IElectronService + @INativeHostService private readonly nativeHostService: INativeHostService ) { super(instantiationService); } @@ -218,7 +218,7 @@ export class OutputChannelModelService extends AsbtractOutputChannelModelService private _outputDir: Promise | null = null; private get outputDir(): Promise { if (!this._outputDir) { - const outputDir = URI.file(join(this.environmentService.logsPath, `output_${this.electronService.windowId}_${toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, '')}`)); + const outputDir = URI.file(join(this.environmentService.logsPath, `output_${this.nativeHostService.windowId}_${toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, '')}`)); this._outputDir = this.fileService.createFolder(outputDir).then(() => outputDir); } return this._outputDir; diff --git a/src/vs/workbench/services/request/electron-sandbox/requestService.ts b/src/vs/workbench/services/request/electron-sandbox/requestService.ts index 18ee94b099c..86d4700ef05 100644 --- a/src/vs/workbench/services/request/electron-sandbox/requestService.ts +++ b/src/vs/workbench/services/request/electron-sandbox/requestService.ts @@ -8,20 +8,20 @@ import { ILogService } from 'vs/platform/log/common/log'; import { RequestService } from 'vs/platform/request/browser/requestService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IRequestService } from 'vs/platform/request/common/request'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; export class NativeRequestService extends RequestService { constructor( @IConfigurationService configurationService: IConfigurationService, @ILogService logService: ILogService, - @IElectronService private electronService: IElectronService + @INativeHostService private nativeHostService: INativeHostService ) { super(configurationService, logService); } async resolveProxy(url: string): Promise { - return this.electronService.resolveProxy(url); + return this.nativeHostService.resolveProxy(url); } } diff --git a/src/vs/workbench/services/sharedProcess/electron-browser/sharedProcessService.ts b/src/vs/workbench/services/sharedProcess/electron-browser/sharedProcessService.ts index 5b41e11b697..aec7dc7c5d7 100644 --- a/src/vs/workbench/services/sharedProcess/electron-browser/sharedProcessService.ts +++ b/src/vs/workbench/services/sharedProcess/electron-browser/sharedProcessService.ts @@ -11,7 +11,7 @@ import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedPr import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; export class SharedProcessService implements ISharedProcessService { @@ -22,13 +22,13 @@ export class SharedProcessService implements ISharedProcessService { constructor( @IMainProcessService mainProcessService: IMainProcessService, - @IElectronService electronService: IElectronService, + @INativeHostService nativeHostService: INativeHostService, @IWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService ) { this.sharedProcessMainChannel = mainProcessService.getChannel('sharedProcess'); this.withSharedProcessConnection = this.whenSharedProcessReady() - .then(() => connect(environmentService.sharedIPCHandle, `window:${electronService.windowId}`)); + .then(() => connect(environmentService.sharedIPCHandle, `window:${nativeHostService.windowId}`)); } whenSharedProcessReady(): Promise { diff --git a/src/vs/workbench/services/themes/electron-sandbox/nativeHostColorSchemeService.ts b/src/vs/workbench/services/themes/electron-sandbox/nativeHostColorSchemeService.ts index 988e308f228..f495c43e617 100644 --- a/src/vs/workbench/services/themes/electron-sandbox/nativeHostColorSchemeService.ts +++ b/src/vs/workbench/services/themes/electron-sandbox/nativeHostColorSchemeService.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { Emitter } from 'vs/base/common/event'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { Disposable } from 'vs/base/common/lifecycle'; @@ -16,7 +16,7 @@ export class NativeHostColorSchemeService extends Disposable implements IHostCol declare readonly _serviceBrand: undefined; constructor( - @IElectronService private readonly electronService: IElectronService, + @INativeHostService private readonly nativeHostService: INativeHostService, @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService ) { super(); @@ -27,7 +27,7 @@ export class NativeHostColorSchemeService extends Disposable implements IHostCol private registerListeners(): void { // Color Scheme - this._register(this.electronService.onColorSchemeChange(scheme => { + this._register(this.nativeHostService.onColorSchemeChange(scheme => { this._colorScheme = scheme; this._onDidChangeColorScheme.fire(); diff --git a/src/vs/workbench/services/timer/electron-sandbox/timerService.ts b/src/vs/workbench/services/timer/electron-sandbox/timerService.ts index 1dda0744c08..beeb3bf7c57 100644 --- a/src/vs/workbench/services/timer/electron-sandbox/timerService.ts +++ b/src/vs/workbench/services/timer/electron-sandbox/timerService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; @@ -21,7 +21,7 @@ import { context, process } from 'vs/base/parts/sandbox/electron-sandbox/globals export class TimerService extends AbstractTimerService { constructor( - @IElectronService private readonly _electronService: IElectronService, + @INativeHostService private readonly _nativeHostService: INativeHostService, @IWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService, @ILifecycleService lifecycleService: ILifecycleService, @IWorkspaceContextService contextService: IWorkspaceContextService, @@ -43,15 +43,15 @@ export class TimerService extends AbstractTimerService { return didUseCachedData(); } protected _getWindowCount(): Promise { - return this._electronService.getWindowCount(); + return this._nativeHostService.getWindowCount(); } protected async _extendStartupInfo(info: Writeable): Promise { try { const [osProperties, osStatistics, virtualMachineHint] = await Promise.all([ - this._electronService.getOSProperties(), - this._electronService.getOSStatistics(), - this._electronService.getOSVirtualMachineHint() + this._nativeHostService.getOSProperties(), + this._nativeHostService.getOSStatistics(), + this._nativeHostService.getOSVirtualMachineHint() ]); info.totalmem = osStatistics.totalmem; diff --git a/src/vs/workbench/services/url/electron-sandbox/urlService.ts b/src/vs/workbench/services/url/electron-sandbox/urlService.ts index 98591b49cc1..90f842f7d47 100644 --- a/src/vs/workbench/services/url/electron-sandbox/urlService.ts +++ b/src/vs/workbench/services/url/electron-sandbox/urlService.ts @@ -11,7 +11,7 @@ import { IOpenerService, IOpener, matchesScheme } from 'vs/platform/opener/commo import { IProductService } from 'vs/platform/product/common/productService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { createChannelSender } from 'vs/base/parts/ipc/common/ipc'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { NativeURLService } from 'vs/platform/url/common/urlService'; export interface IRelayOpenURLOptions extends IOpenURLOptions { @@ -26,7 +26,7 @@ export class RelayURLService extends NativeURLService implements IURLHandler, IO constructor( @IMainProcessService mainProcessService: IMainProcessService, @IOpenerService openerService: IOpenerService, - @IElectronService private readonly electronService: IElectronService, + @INativeHostService private readonly nativeHostService: INativeHostService, @IProductService private readonly productService: IProductService ) { super(); @@ -42,9 +42,9 @@ export class RelayURLService extends NativeURLService implements IURLHandler, IO let query = uri.query; if (!query) { - query = `windowId=${encodeURIComponent(this.electronService.windowId)}`; + query = `windowId=${encodeURIComponent(this.nativeHostService.windowId)}`; } else { - query += `&windowId=${encodeURIComponent(this.electronService.windowId)}`; + query += `&windowId=${encodeURIComponent(this.nativeHostService.windowId)}`; } return uri.with({ query }); @@ -66,7 +66,7 @@ export class RelayURLService extends NativeURLService implements IURLHandler, IO const result = await super.open(uri, options); if (result) { - await this.electronService.focusWindow({ force: true /* Application may not be active */ }); + await this.nativeHostService.focusWindow({ force: true /* Application may not be active */ }); } return result; diff --git a/src/vs/workbench/services/workspaces/electron-sandbox/workspaceEditingService.ts b/src/vs/workbench/services/workspaces/electron-sandbox/workspaceEditingService.ts index a03c1809c8d..7dae23c1b2e 100644 --- a/src/vs/workbench/services/workspaces/electron-sandbox/workspaceEditingService.ts +++ b/src/vs/workbench/services/workspaces/electron-sandbox/workspaceEditingService.ts @@ -27,7 +27,7 @@ import { ILabelService } from 'vs/platform/label/common/label'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { IHostService } from 'vs/workbench/services/host/browser/host'; import { AbstractWorkspaceEditingService } from 'vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { isMacintosh } from 'vs/base/common/platform'; import { mnemonicButtonLabel } from 'vs/base/common/labels'; import { BackupFileService } from 'vs/workbench/services/backup/common/backupFileService'; @@ -40,7 +40,7 @@ export class NativeWorkspaceEditingService extends AbstractWorkspaceEditingServi constructor( @IJSONEditingService jsonEditingService: IJSONEditingService, @IWorkspaceContextService contextService: WorkspaceService, - @IElectronService private electronService: IElectronService, + @INativeHostService private nativeHostService: INativeHostService, @IConfigurationService configurationService: IConfigurationService, @IStorageService private storageService: IStorageService, @IExtensionService private extensionService: IExtensionService, @@ -82,7 +82,7 @@ export class NativeWorkspaceEditingService extends AbstractWorkspaceEditingServi return false; // only care about untitled workspaces to ask for saving } - const windowCount = await this.electronService.getWindowCount(); + const windowCount = await this.nativeHostService.getWindowCount(); if (reason === ShutdownReason.CLOSE && !isMacintosh && windowCount === 1) { return false; // Windows/Linux: quits when last window is closed, so do not ask then } @@ -144,7 +144,7 @@ export class NativeWorkspaceEditingService extends AbstractWorkspaceEditingServi } async isValidTargetWorkspacePath(path: URI): Promise { - const windows = await this.electronService.getWindows(); + const windows = await this.nativeHostService.getWindows(); // Prevent overwriting a workspace that is currently opened in another window if (windows.some(window => !!window.workspace && this.uriIdentityService.extUri.isEqual(window.workspace.configPath, path))) { diff --git a/src/vs/workbench/services/workspaces/electron-sandbox/workspacesService.ts b/src/vs/workbench/services/workspaces/electron-sandbox/workspacesService.ts index 5af8998eaad..f3dd9b34f70 100644 --- a/src/vs/workbench/services/workspaces/electron-sandbox/workspacesService.ts +++ b/src/vs/workbench/services/workspaces/electron-sandbox/workspacesService.ts @@ -7,7 +7,7 @@ import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces'; import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { createChannelSender } from 'vs/base/parts/ipc/common/ipc'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; // @ts-ignore: interface is implemented via proxy export class NativeWorkspacesService implements IWorkspacesService { @@ -16,9 +16,9 @@ export class NativeWorkspacesService implements IWorkspacesService { constructor( @IMainProcessService mainProcessService: IMainProcessService, - @IElectronService electronService: IElectronService + @INativeHostService nativeHostService: INativeHostService ) { - return createChannelSender(mainProcessService.getChannel('workspaces'), { context: electronService.windowId }); + return createChannelSender(mainProcessService.getChannel('workspaces'), { context: nativeHostService.windowId }); } } diff --git a/src/vs/workbench/test/electron-browser/workbenchTestServices.ts b/src/vs/workbench/test/electron-browser/workbenchTestServices.ts index 40b0d08c3d9..a89fe2a3325 100644 --- a/src/vs/workbench/test/electron-browser/workbenchTestServices.ts +++ b/src/vs/workbench/test/electron-browser/workbenchTestServices.ts @@ -8,7 +8,7 @@ import { Event } from 'vs/base/common/event'; import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; import { NativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService'; import { NativeTextFileService, } from 'vs/workbench/services/textfile/electron-browser/nativeTextFileService'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { FileOperationError, IFileService } from 'vs/platform/files/common/files'; import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService'; import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; @@ -40,7 +40,7 @@ import { TestContextService } from 'vs/workbench/test/common/workbenchTestServic import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity'; import { MouseInputEvent } from 'vs/base/parts/sandbox/common/electronTypes'; import { IModeService } from 'vs/editor/common/services/modeService'; -import { IOSProperties, IOSStatistics } from 'vs/platform/electron/common/electron'; +import { IOSProperties, IOSStatistics } from 'vs/platform/native/common/native'; import { ColorScheme } from 'vs/platform/theme/common/theme'; export const TestWorkbenchConfiguration: INativeWorkbenchConfiguration = { @@ -155,7 +155,7 @@ export class TestSharedProcessService implements ISharedProcessService { async whenSharedProcessReady(): Promise { } } -export class TestElectronService implements IElectronService { +export class TestNativeHostService implements INativeHostService { declare readonly _serviceBrand: undefined; @@ -238,7 +238,7 @@ export function workbenchInstantiationService(): ITestInstantiationService { pathService: insta => insta.createInstance(TestNativePathService) }); - instantiationService.stub(IElectronService, new TestElectronService()); + instantiationService.stub(INativeHostService, new TestNativeHostService()); return instantiationService; } @@ -251,7 +251,7 @@ export class TestServiceAccessor { @IWorkspaceContextService public contextService: TestContextService, @IModelService public modelService: ModelServiceImpl, @IFileService public fileService: TestFileService, - @IElectronService public electronService: TestElectronService, + @INativeHostService public nativeHostService: TestNativeHostService, @IFileDialogService public fileDialogService: TestFileDialogService, @IBackupFileService public backupFileService: NodeTestBackupFileService, @IWorkingCopyService public workingCopyService: IWorkingCopyService, From 5bc5d315a3a554f5779250c5bb069378778e6c82 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 16:35:21 +0200 Subject: [PATCH 0082/1667] sandbox - separate native host service implementation from interfaces --- .../issue/issueReporterMain.ts | 3 +- .../processExplorer/processExplorerMain.ts | 3 +- .../native/electron-sandbox/native.ts | 23 --------------- .../electron-sandbox/nativeHostService.ts | 29 +++++++++++++++++++ .../electron-browser/desktop.main.ts | 3 +- .../electron-sandbox/desktop.main.ts | 3 +- 6 files changed, 37 insertions(+), 27 deletions(-) create mode 100644 src/vs/platform/native/electron-sandbox/nativeHostService.ts diff --git a/src/vs/code/electron-sandbox/issue/issueReporterMain.ts b/src/vs/code/electron-sandbox/issue/issueReporterMain.ts index 27db658d34d..1a9ef9e5776 100644 --- a/src/vs/code/electron-sandbox/issue/issueReporterMain.ts +++ b/src/vs/code/electron-sandbox/issue/issueReporterMain.ts @@ -5,7 +5,8 @@ import 'vs/css!./media/issueReporter'; import 'vs/base/browser/ui/codicons/codiconStyles'; // make sure codicon css is loaded -import { NativeHostService, INativeHostService } from 'vs/platform/native/electron-sandbox/native'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; +import { NativeHostService } from 'vs/platform/native/electron-sandbox/nativeHostService'; import { ipcRenderer, process } from 'vs/base/parts/sandbox/electron-sandbox/globals'; import { applyZoom, zoomIn, zoomOut } from 'vs/platform/windows/electron-sandbox/window'; import { $, reset, windowOpenNoOpener, addClass } from 'vs/base/browser/dom'; diff --git a/src/vs/code/electron-sandbox/processExplorer/processExplorerMain.ts b/src/vs/code/electron-sandbox/processExplorer/processExplorerMain.ts index 2f2c915524d..e93807545af 100644 --- a/src/vs/code/electron-sandbox/processExplorer/processExplorerMain.ts +++ b/src/vs/code/electron-sandbox/processExplorer/processExplorerMain.ts @@ -5,7 +5,8 @@ import 'vs/css!./media/processExplorer'; import 'vs/base/browser/ui/codicons/codiconStyles'; // make sure codicon css is loaded -import { NativeHostService, INativeHostService } from 'vs/platform/native/electron-sandbox/native'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; +import { NativeHostService } from 'vs/platform/native/electron-sandbox/nativeHostService'; import { ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals'; import { localize } from 'vs/nls'; import { ProcessExplorerStyles, ProcessExplorerData } from 'vs/platform/issue/common/issue'; diff --git a/src/vs/platform/native/electron-sandbox/native.ts b/src/vs/platform/native/electron-sandbox/native.ts index 5172e5d6f85..e8b4d4adfb8 100644 --- a/src/vs/platform/native/electron-sandbox/native.ts +++ b/src/vs/platform/native/electron-sandbox/native.ts @@ -5,30 +5,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { ICommonNativeHostService } from 'vs/platform/native/common/native'; -import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService'; -import { createChannelSender } from 'vs/base/parts/ipc/common/ipc'; export const INativeHostService = createDecorator('nativeHostService'); export interface INativeHostService extends ICommonNativeHostService { } - -// @ts-ignore: interface is implemented via proxy -export class NativeHostService implements INativeHostService { - - declare readonly _serviceBrand: undefined; - - constructor( - readonly windowId: number, - @IMainProcessService mainProcessService: IMainProcessService - ) { - return createChannelSender(mainProcessService.getChannel('nativeHost'), { - context: windowId, - properties: (() => { - const properties = new Map(); - properties.set('windowId', windowId); - - return properties; - })() - }); - } -} diff --git a/src/vs/platform/native/electron-sandbox/nativeHostService.ts b/src/vs/platform/native/electron-sandbox/nativeHostService.ts new file mode 100644 index 00000000000..2175c479423 --- /dev/null +++ b/src/vs/platform/native/electron-sandbox/nativeHostService.ts @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; +import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService'; +import { createChannelSender } from 'vs/base/parts/ipc/common/ipc'; + +// @ts-ignore: interface is implemented via proxy +export class NativeHostService implements INativeHostService { + + declare readonly _serviceBrand: undefined; + + constructor( + readonly windowId: number, + @IMainProcessService mainProcessService: IMainProcessService + ) { + return createChannelSender(mainProcessService.getChannel('nativeHost'), { + context: windowId, + properties: (() => { + const properties = new Map(); + properties.set('windowId', windowId); + + return properties; + })() + }); + } +} diff --git a/src/vs/workbench/electron-browser/desktop.main.ts b/src/vs/workbench/electron-browser/desktop.main.ts index 348c5f27394..a4b74123f65 100644 --- a/src/vs/workbench/electron-browser/desktop.main.ts +++ b/src/vs/workbench/electron-browser/desktop.main.ts @@ -48,7 +48,8 @@ import product from 'vs/platform/product/common/product'; import { NativeResourceIdentityService } from 'vs/platform/resource/node/resourceIdentityServiceImpl'; import { IResourceIdentityService } from 'vs/platform/resource/common/resourceIdentityService'; import { NativeLogService } from 'vs/workbench/services/log/electron-browser/logService'; -import { INativeHostService, NativeHostService } from 'vs/platform/native/electron-sandbox/native'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; +import { NativeHostService } from 'vs/platform/native/electron-sandbox/nativeHostService'; class DesktopMain extends Disposable { diff --git a/src/vs/workbench/electron-sandbox/desktop.main.ts b/src/vs/workbench/electron-sandbox/desktop.main.ts index c8c882cb5f8..a9003c14794 100644 --- a/src/vs/workbench/electron-sandbox/desktop.main.ts +++ b/src/vs/workbench/electron-sandbox/desktop.main.ts @@ -30,7 +30,8 @@ import { FileUserDataProvider } from 'vs/workbench/services/userData/common/file import { IProductService } from 'vs/platform/product/common/productService'; import product from 'vs/platform/product/common/product'; import { IResourceIdentityService } from 'vs/platform/resource/common/resourceIdentityService'; -import { INativeHostService, NativeHostService } from 'vs/platform/native/electron-sandbox/native'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; +import { NativeHostService } from 'vs/platform/native/electron-sandbox/nativeHostService'; import { SimpleConfigurationService, simpleFileSystemProvider, SimpleLogService, SimpleRemoteAgentService, SimpleResourceIdentityService, SimpleSignService, SimpleStorageService, SimpleWorkbenchEnvironmentService, SimpleWorkspaceService } from 'vs/workbench/electron-sandbox/sandbox.simpleservices'; import { INativeWorkbenchConfiguration } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { RemoteAuthorityResolverService } from 'vs/platform/remote/electron-sandbox/remoteAuthorityResolverService'; From 20e5950f545943d4b7febe981fa99339b8564c86 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 16:49:27 +0200 Subject: [PATCH 0083/1667] sandbox - :lipstick: --- src/vs/platform/diagnostics/node/diagnosticsService.ts | 2 +- src/vs/platform/launch/electron-main/launchMainService.ts | 2 +- src/vs/platform/launch/{common => node}/launch.ts | 0 src/vs/platform/native/electron-sandbox/native.ts | 7 +++++++ src/vs/platform/sign/browser/signService.ts | 2 +- src/vs/platform/{ => theme}/browser/checkbox.ts | 0 .../contrib/preferences/browser/keybindingsEditor.ts | 2 +- src/vs/workbench/services/host/browser/host.ts | 6 ++++++ 8 files changed, 17 insertions(+), 4 deletions(-) rename src/vs/platform/launch/{common => node}/launch.ts (100%) rename src/vs/platform/{ => theme}/browser/checkbox.ts (100%) diff --git a/src/vs/platform/diagnostics/node/diagnosticsService.ts b/src/vs/platform/diagnostics/node/diagnosticsService.ts index a858b96f5b7..4f26ad098d6 100644 --- a/src/vs/platform/diagnostics/node/diagnosticsService.ts +++ b/src/vs/platform/diagnostics/node/diagnosticsService.ts @@ -14,7 +14,7 @@ import { repeat, pad } from 'vs/base/common/strings'; import { isWindows, isLinux } from 'vs/base/common/platform'; import { URI } from 'vs/base/common/uri'; import { ProcessItem } from 'vs/base/common/processes'; -import { IMainProcessInfo } from 'vs/platform/launch/common/launch'; +import { IMainProcessInfo } from 'vs/platform/launch/node/launch'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { Iterable } from 'vs/base/common/iterator'; diff --git a/src/vs/platform/launch/electron-main/launchMainService.ts b/src/vs/platform/launch/electron-main/launchMainService.ts index 83bb6c6660b..e646cc854c4 100644 --- a/src/vs/platform/launch/electron-main/launchMainService.ts +++ b/src/vs/platform/launch/electron-main/launchMainService.ts @@ -18,7 +18,7 @@ import { URI } from 'vs/base/common/uri'; import { BrowserWindow, ipcMain, Event as IpcEvent, app } from 'electron'; import { coalesce } from 'vs/base/common/arrays'; import { IDiagnosticInfoOptions, IDiagnosticInfo, IRemoteDiagnosticInfo, IRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics'; -import { IMainProcessInfo, IWindowInfo } from 'vs/platform/launch/common/launch'; +import { IMainProcessInfo, IWindowInfo } from 'vs/platform/launch/node/launch'; export const ID = 'launchMainService'; export const ILaunchMainService = createDecorator(ID); diff --git a/src/vs/platform/launch/common/launch.ts b/src/vs/platform/launch/node/launch.ts similarity index 100% rename from src/vs/platform/launch/common/launch.ts rename to src/vs/platform/launch/node/launch.ts diff --git a/src/vs/platform/native/electron-sandbox/native.ts b/src/vs/platform/native/electron-sandbox/native.ts index e8b4d4adfb8..bb3f6bc715c 100644 --- a/src/vs/platform/native/electron-sandbox/native.ts +++ b/src/vs/platform/native/electron-sandbox/native.ts @@ -8,4 +8,11 @@ import { ICommonNativeHostService } from 'vs/platform/native/common/native'; export const INativeHostService = createDecorator('nativeHostService'); +/** + * A set of methods specific to a native host, i.e. unsupported in web + * environments. + * + * @see `IHostService` for methods that can be used in native and web + * hosts. + */ export interface INativeHostService extends ICommonNativeHostService { } diff --git a/src/vs/platform/sign/browser/signService.ts b/src/vs/platform/sign/browser/signService.ts index a8605ecbd82..a0e555cef7f 100644 --- a/src/vs/platform/sign/browser/signService.ts +++ b/src/vs/platform/sign/browser/signService.ts @@ -16,6 +16,6 @@ export class SignService implements ISignService { } async sign(value: string): Promise { - return Promise.resolve(this._tkn || ''); + return this._tkn || ''; } } diff --git a/src/vs/platform/browser/checkbox.ts b/src/vs/platform/theme/browser/checkbox.ts similarity index 100% rename from src/vs/platform/browser/checkbox.ts rename to src/vs/platform/theme/browser/checkbox.ts diff --git a/src/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts b/src/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts index de11973bf42..08273a27764 100644 --- a/src/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts +++ b/src/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts @@ -46,7 +46,7 @@ import { IListAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget'; import { preferencesEditIcon } from 'vs/workbench/contrib/preferences/browser/preferencesWidgets'; import { Color, RGBA } from 'vs/base/common/color'; import { WORKBENCH_BACKGROUND } from 'vs/workbench/common/theme'; -import { ThemableCheckboxActionViewItem } from 'vs/platform/browser/checkbox'; +import { ThemableCheckboxActionViewItem } from 'vs/platform/theme/browser/checkbox'; const $ = DOM.$; diff --git a/src/vs/workbench/services/host/browser/host.ts b/src/vs/workbench/services/host/browser/host.ts index 25f16cf7b07..222da33fcde 100644 --- a/src/vs/workbench/services/host/browser/host.ts +++ b/src/vs/workbench/services/host/browser/host.ts @@ -9,6 +9,12 @@ import { IWindowOpenable, IOpenWindowOptions, IOpenEmptyWindowOptions } from 'vs export const IHostService = createDecorator('hostService'); +/** + * A set of methods supported in both web and native environments. + * + * @see `INativeHostService` for methods that are specific to native + * environments. + */ export interface IHostService { readonly _serviceBrand: undefined; From 55476af3b00ecfee88dc684738232c9cbda40785 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 17:13:02 +0200 Subject: [PATCH 0084/1667] sandbox - make native workbench environment service a real one --- .../codeEditor/electron-browser/startDebugTextMate.ts | 3 +-- .../configurationExportHelper.contribution.ts | 3 +-- .../electron-sandbox/configurationExportHelper.ts | 3 +-- .../extensions/electron-browser/extensions.contribution.ts | 5 ++--- .../extensions/electron-browser/extensionsAutoProfiler.ts | 3 +-- .../extensions/electron-sandbox/extensionsActions.ts | 3 +-- .../extensions/electron-sandbox/extensionsSlowActions.ts | 5 ++--- .../test/electron-browser/extensionsActions.test.ts | 7 +++---- .../test/electron-browser/extensionsViews.test.ts | 3 +-- .../contrib/issue/electron-sandbox/issueService.ts | 3 +-- .../workbench/contrib/logs/electron-sandbox/logsActions.ts | 5 ++--- .../performance/electron-browser/startupProfiler.ts | 3 +-- .../contrib/performance/electron-browser/startupTimings.ts | 5 ++--- .../contrib/remote/electron-sandbox/remote.contribution.ts | 3 +-- .../splash/electron-browser/partsSplash.contribution.ts | 7 +++---- src/vs/workbench/electron-browser/desktop.main.ts | 3 ++- src/vs/workbench/electron-sandbox/desktop.main.ts | 7 ++++--- .../workbench/electron-sandbox/sandbox.simpleservices.ts | 2 +- src/vs/workbench/electron-sandbox/window.ts | 2 +- .../accessibility/electron-sandbox/accessibilityService.ts | 2 +- .../electron-sandbox/configurationResolverService.ts | 3 +-- .../environment/electron-sandbox/environmentService.ts | 3 +++ .../electron-browser/extensionManagementServerService.ts | 3 +-- .../electron-sandbox/extensionManagementService.ts | 3 +-- .../electron-sandbox/remoteExtensionManagementService.ts | 3 +-- .../extensions/electron-browser/cachedExtensionScanner.ts | 3 +-- .../electron-browser/localProcessExtensionHost.ts | 3 +-- .../services/path/electron-sandbox/pathService.ts | 3 +-- .../services/search/electron-browser/searchService.ts | 3 +-- .../sharedProcess/electron-browser/sharedProcessService.ts | 3 +-- .../telemetry/electron-browser/telemetryService.ts | 3 +-- .../textfile/electron-browser/nativeTextFileService.ts | 3 +-- .../services/timer/electron-sandbox/timerService.ts | 3 +-- .../workspaces/electron-sandbox/workspaceEditingService.ts | 3 +-- .../test/electron-browser/workbenchTestServices.ts | 5 ++--- 35 files changed, 50 insertions(+), 74 deletions(-) diff --git a/src/vs/workbench/contrib/codeEditor/electron-browser/startDebugTextMate.ts b/src/vs/workbench/contrib/codeEditor/electron-browser/startDebugTextMate.ts index 178364c7dac..066f1c3b032 100644 --- a/src/vs/workbench/contrib/codeEditor/electron-browser/startDebugTextMate.ts +++ b/src/vs/workbench/contrib/codeEditor/electron-browser/startDebugTextMate.ts @@ -21,7 +21,6 @@ import { Constants } from 'vs/base/common/uint'; import { IHostService } from 'vs/workbench/services/host/browser/host'; import { join } from 'vs/base/common/path'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; class StartDebugTextMate extends Action { @@ -38,7 +37,7 @@ class StartDebugTextMate extends Action { @IEditorService private readonly _editorService: IEditorService, @ICodeEditorService private readonly _codeEditorService: ICodeEditorService, @IHostService private readonly _hostService: IHostService, - @IWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService + @INativeWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService ) { super(id, label); } diff --git a/src/vs/workbench/contrib/configExporter/electron-sandbox/configurationExportHelper.contribution.ts b/src/vs/workbench/contrib/configExporter/electron-sandbox/configurationExportHelper.contribution.ts index 1ad6c0c9130..8d2753c0d3b 100644 --- a/src/vs/workbench/contrib/configExporter/electron-sandbox/configurationExportHelper.contribution.ts +++ b/src/vs/workbench/contrib/configExporter/electron-sandbox/configurationExportHelper.contribution.ts @@ -7,7 +7,6 @@ import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as import { Registry } from 'vs/platform/registry/common/platform'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { DefaultConfigurationExportHelper } from 'vs/workbench/contrib/configExporter/electron-sandbox/configurationExportHelper'; @@ -15,7 +14,7 @@ export class ExtensionPoints implements IWorkbenchContribution { constructor( @IInstantiationService instantiationService: IInstantiationService, - @IWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService + @INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService ) { // Config Exporter if (environmentService.configuration['export-default-configuration']) { diff --git a/src/vs/workbench/contrib/configExporter/electron-sandbox/configurationExportHelper.ts b/src/vs/workbench/contrib/configExporter/electron-sandbox/configurationExportHelper.ts index 4cc198e5f16..a8e8e6f3de8 100644 --- a/src/vs/workbench/contrib/configExporter/electron-sandbox/configurationExportHelper.ts +++ b/src/vs/workbench/contrib/configExporter/electron-sandbox/configurationExportHelper.ts @@ -3,7 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { Registry } from 'vs/platform/registry/common/platform'; import { IConfigurationNode, IConfigurationRegistry, Extensions, IConfigurationPropertySchema } from 'vs/platform/configuration/common/configurationRegistry'; @@ -33,7 +32,7 @@ interface IConfigurationExport { export class DefaultConfigurationExportHelper { constructor( - @IWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, @IExtensionService private readonly extensionService: IExtensionService, @ICommandService private readonly commandService: ICommandService, @IFileService private readonly fileService: IFileService, diff --git a/src/vs/workbench/contrib/extensions/electron-browser/extensions.contribution.ts b/src/vs/workbench/contrib/extensions/electron-browser/extensions.contribution.ts index 24315638575..7a7c43e3749 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/extensions.contribution.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/extensions.contribution.ts @@ -20,7 +20,6 @@ import { ExtensionHostProfileService } from 'vs/workbench/contrib/extensions/ele import { RuntimeExtensionsInput } from 'vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsInput'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { ExtensionsAutoProfiler } from 'vs/workbench/contrib/extensions/electron-browser/extensionsAutoProfiler'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { OpenExtensionsFolderAction } from 'vs/workbench/contrib/extensions/electron-sandbox/extensionsActions'; import { ExtensionsLabel } from 'vs/platform/extensionManagement/common/extensionManagement'; @@ -68,9 +67,9 @@ actionRegistry.registerWorkbenchAction(SyncActionDescriptor.from(ShowRuntimeExte class ExtensionsContributions implements IWorkbenchContribution { constructor( - @IWorkbenchEnvironmentService workbenchEnvironmentService: INativeWorkbenchEnvironmentService + @INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService ) { - if (workbenchEnvironmentService.extensionsPath) { + if (environmentService.extensionsPath) { const openExtensionsFolderActionDescriptor = SyncActionDescriptor.from(OpenExtensionsFolderAction); actionRegistry.registerWorkbenchAction(openExtensionsFolderActionDescriptor, 'Extensions: Open Extensions Folder', ExtensionsLabel); } diff --git a/src/vs/workbench/contrib/extensions/electron-browser/extensionsAutoProfiler.ts b/src/vs/workbench/contrib/extensions/electron-browser/extensionsAutoProfiler.ts index 05b303f6cc3..226a0bc8e8d 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/extensionsAutoProfiler.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/extensionsAutoProfiler.ts @@ -22,7 +22,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { createSlowExtensionAction } from 'vs/workbench/contrib/extensions/electron-sandbox/extensionsSlowActions'; import { ExtensionHostProfiler } from 'vs/workbench/services/extensions/electron-browser/extensionHostProfiler'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; export class ExtensionsAutoProfiler extends Disposable implements IWorkbenchContribution { @@ -37,7 +36,7 @@ export class ExtensionsAutoProfiler extends Disposable implements IWorkbenchCont @INotificationService private readonly _notificationService: INotificationService, @IEditorService private readonly _editorService: IEditorService, @IInstantiationService private readonly _instantiationService: IInstantiationService, - @IWorkbenchEnvironmentService private readonly _environmentServie: INativeWorkbenchEnvironmentService + @INativeWorkbenchEnvironmentService private readonly _environmentServie: INativeWorkbenchEnvironmentService ) { super(); this._register(_extensionService.onDidChangeResponsiveChange(this._onDidChangeResponsiveChange, this)); diff --git a/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsActions.ts b/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsActions.ts index a24fb6882b8..369d6a1bf0b 100644 --- a/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsActions.ts +++ b/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsActions.ts @@ -7,7 +7,6 @@ import { localize } from 'vs/nls'; import { Action } from 'vs/base/common/actions'; import { IFileService } from 'vs/platform/files/common/files'; import { URI } from 'vs/base/common/uri'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { Schemas } from 'vs/base/common/network'; @@ -22,7 +21,7 @@ export class OpenExtensionsFolderAction extends Action { label: string, @INativeHostService private readonly nativeHostService: INativeHostService, @IFileService private readonly fileService: IFileService, - @IWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService + @INativeWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService ) { super(id, label, undefined, true); } diff --git a/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsSlowActions.ts b/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsSlowActions.ts index ab09ba5a258..55547a8c67a 100644 --- a/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsSlowActions.ts +++ b/src/vs/workbench/contrib/extensions/electron-sandbox/extensionsSlowActions.ts @@ -19,7 +19,6 @@ import Severity from 'vs/base/common/severity'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; abstract class RepoInfo { abstract get base(): string; @@ -123,7 +122,7 @@ class ReportExtensionSlowAction extends Action { @IOpenerService private readonly _openerService: IOpenerService, @IProductService private readonly _productService: IProductService, @INativeHostService private readonly _nativeHostService: INativeHostService, - @IWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService + @INativeWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService ) { super('report.slow', localize('cmd.report', "Report Issue")); } @@ -167,7 +166,7 @@ class ShowExtensionSlowAction extends Action { readonly profile: IExtensionHostProfile, @IDialogService private readonly _dialogService: IDialogService, @IOpenerService private readonly _openerService: IOpenerService, - @IWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService + @INativeWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService ) { super('show.slow', localize('cmd.show', "Show Issues")); } diff --git a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts index cb9e6551b27..56367c96042 100644 --- a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts +++ b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts @@ -40,7 +40,6 @@ import { ILabelService, IFormatterChangeEvent } from 'vs/platform/label/common/l import { ExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService'; import { IProductService } from 'vs/platform/product/common/productService'; import { Schemas } from 'vs/base/common/network'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IProgressService } from 'vs/platform/progress/common/progress'; import { ProgressService } from 'vs/workbench/services/progress/browser/progressService'; import { IStorageKeysSyncRegistryService, StorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys'; @@ -100,7 +99,7 @@ async function setupTest() { instantiationService.stub(IExtensionManagementServerService, new class extends ExtensionManagementServerService { #localExtensionManagementServer: IExtensionManagementServer = { extensionManagementService: instantiationService.get(IExtensionManagementService), label: 'local', id: 'vscode-local' }; constructor() { - super(instantiationService.get(ISharedProcessService), instantiationService.get(IRemoteAgentService), instantiationService.get(ILabelService), instantiationService.get(IExtensionGalleryService), instantiationService.get(IProductService), instantiationService.get(IConfigurationService), instantiationService.get(ILogService), instantiationService.get(IWorkbenchEnvironmentService) as INativeWorkbenchEnvironmentService); + super(instantiationService.get(ISharedProcessService), instantiationService.get(IRemoteAgentService), instantiationService.get(ILabelService), instantiationService.get(IExtensionGalleryService), instantiationService.get(IProductService), instantiationService.get(IConfigurationService), instantiationService.get(ILogService), instantiationService.get(INativeWorkbenchEnvironmentService)); } get localExtensionManagementServer(): IExtensionManagementServer { return this.#localExtensionManagementServer; } set localExtensionManagementServer(server: IExtensionManagementServer) { } @@ -1904,7 +1903,7 @@ suite('RemoteInstallAction', () => { // multi server setup const localWorkspaceExtension = aLocalExtension('a', { extensionKind: ['workspace'] }, { location: URI.file(`pub.a`) }); const extensionManagementServerService = aMultiExtensionManagementServerService(instantiationService, createExtensionManagementService([localWorkspaceExtension])); - instantiationService.stub(IWorkbenchEnvironmentService, { disableExtensions: true } as IWorkbenchEnvironmentService); + instantiationService.stub(INativeWorkbenchEnvironmentService, { disableExtensions: true } as INativeWorkbenchEnvironmentService); instantiationService.stub(IExtensionManagementServerService, extensionManagementServerService); instantiationService.stub(IWorkbenchExtensionEnablementService, new TestExtensionEnablementService(instantiationService)); const workbenchService: IExtensionsWorkbenchService = instantiationService.createInstance(ExtensionsWorkbenchService); @@ -2283,7 +2282,7 @@ suite('LocalInstallAction', () => { test('Test local install action is disabled for remote ui extension which is disabled in env', async () => { // multi server setup const remoteUIExtension = aLocalExtension('a', { extensionKind: ['ui'] }, { location: URI.file(`pub.a`).with({ scheme: Schemas.vscodeRemote }) }); - instantiationService.stub(IWorkbenchEnvironmentService, { disableExtensions: true } as IWorkbenchEnvironmentService); + instantiationService.stub(INativeWorkbenchEnvironmentService, { disableExtensions: true } as INativeWorkbenchEnvironmentService); const extensionManagementServerService = aMultiExtensionManagementServerService(instantiationService, createExtensionManagementService(), createExtensionManagementService([remoteUIExtension])); instantiationService.stub(IExtensionManagementServerService, extensionManagementServerService); instantiationService.stub(IWorkbenchExtensionEnablementService, new TestExtensionEnablementService(instantiationService)); diff --git a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsViews.test.ts b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsViews.test.ts index d8b01827eeb..207156d2592 100644 --- a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsViews.test.ts +++ b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsViews.test.ts @@ -45,7 +45,6 @@ import { IMenuService } from 'vs/platform/actions/common/actions'; import { TestContextService } from 'vs/workbench/test/common/workbenchTestServices'; import { IViewDescriptorService, ViewContainerLocation } from 'vs/workbench/common/views'; import { IProductService } from 'vs/platform/product/common/productService'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; suite('ExtensionsListView Tests', () => { @@ -106,7 +105,7 @@ suite('ExtensionsListView Tests', () => { instantiationService.stub(IExtensionManagementServerService, new class extends ExtensionManagementServerService { #localExtensionManagementServer: IExtensionManagementServer = { extensionManagementService: instantiationService.get(IExtensionManagementService), label: 'local', id: 'vscode-local' }; constructor() { - super(instantiationService.get(ISharedProcessService), instantiationService.get(IRemoteAgentService), instantiationService.get(ILabelService), instantiationService.get(IExtensionGalleryService), instantiationService.get(IProductService), instantiationService.get(IConfigurationService), instantiationService.get(ILogService), instantiationService.get(IWorkbenchEnvironmentService) as INativeWorkbenchEnvironmentService); + super(instantiationService.get(ISharedProcessService), instantiationService.get(IRemoteAgentService), instantiationService.get(ILabelService), instantiationService.get(IExtensionGalleryService), instantiationService.get(IProductService), instantiationService.get(IConfigurationService), instantiationService.get(ILogService), instantiationService.get(INativeWorkbenchEnvironmentService)); } get localExtensionManagementServer(): IExtensionManagementServer { return this.#localExtensionManagementServer; } set localExtensionManagementServer(server: IExtensionManagementServer) { } diff --git a/src/vs/workbench/contrib/issue/electron-sandbox/issueService.ts b/src/vs/workbench/contrib/issue/electron-sandbox/issueService.ts index 3170c44ef64..d9f97523635 100644 --- a/src/vs/workbench/contrib/issue/electron-sandbox/issueService.ts +++ b/src/vs/workbench/contrib/issue/electron-sandbox/issueService.ts @@ -12,7 +12,6 @@ import { IExtensionManagementService } from 'vs/platform/extensionManagement/com import { IWorkbenchExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; import { getZoomLevel } from 'vs/base/browser/browser'; import { IWorkbenchIssueService } from 'vs/workbench/contrib/issue/electron-sandbox/issue'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { ExtensionType } from 'vs/platform/extensions/common/extensions'; import { platform, PlatformToString } from 'vs/base/common/platform'; @@ -26,7 +25,7 @@ export class WorkbenchIssueService implements IWorkbenchIssueService { @IThemeService private readonly themeService: IThemeService, @IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService, @IWorkbenchExtensionEnablementService private readonly extensionEnablementService: IWorkbenchExtensionEnablementService, - @IWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService, @IProductService private readonly productService: IProductService ) { } diff --git a/src/vs/workbench/contrib/logs/electron-sandbox/logsActions.ts b/src/vs/workbench/contrib/logs/electron-sandbox/logsActions.ts index 1d44de823f7..cd377536bf7 100644 --- a/src/vs/workbench/contrib/logs/electron-sandbox/logsActions.ts +++ b/src/vs/workbench/contrib/logs/electron-sandbox/logsActions.ts @@ -8,7 +8,6 @@ import { join } from 'vs/base/common/path'; import { URI } from 'vs/base/common/uri'; import * as nls from 'vs/nls'; import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { IFileService } from 'vs/platform/files/common/files'; @@ -18,7 +17,7 @@ export class OpenLogsFolderAction extends Action { static readonly LABEL = nls.localize('openLogsFolder', "Open Logs Folder"); constructor(id: string, label: string, - @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService, @INativeHostService private readonly nativeHostService: INativeHostService, ) { super(id, label); @@ -35,7 +34,7 @@ export class OpenExtensionLogsFolderAction extends Action { static readonly LABEL = nls.localize('openExtensionLogsFolder', "Open Extension Logs Folder"); constructor(id: string, label: string, - @IWorkbenchEnvironmentService private readonly environmentSerice: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService private readonly environmentSerice: INativeWorkbenchEnvironmentService, @IFileService private readonly fileService: IFileService, @INativeHostService private readonly nativeHostService: INativeHostService ) { diff --git a/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts b/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts index 65c5d58ee32..d79a11a8937 100644 --- a/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts +++ b/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts @@ -8,7 +8,6 @@ import { exists, readdir, readFile, rimraf } from 'vs/base/node/pfs'; import { ITextModelService } from 'vs/editor/common/services/resolverService'; import { localize } from 'vs/nls'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; @@ -24,7 +23,7 @@ export class StartupProfiler implements IWorkbenchContribution { constructor( @IDialogService private readonly _dialogService: IDialogService, - @IWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService, @ITextModelService private readonly _textModelResolverService: ITextModelService, @IClipboardService private readonly _clipboardService: IClipboardService, @ILifecycleService lifecycleService: ILifecycleService, diff --git a/src/vs/workbench/contrib/performance/electron-browser/startupTimings.ts b/src/vs/workbench/contrib/performance/electron-browser/startupTimings.ts index c27db170167..99db644f386 100644 --- a/src/vs/workbench/contrib/performance/electron-browser/startupTimings.ts +++ b/src/vs/workbench/contrib/performance/electron-browser/startupTimings.ts @@ -8,7 +8,6 @@ import { timeout } from 'vs/base/common/async'; import { promisify } from 'util'; import { onUnexpectedError } from 'vs/base/common/errors'; import { isCodeEditor } from 'vs/editor/browser/editorBrowser'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { ILifecycleService, StartupKind, StartupKindToString } from 'vs/platform/lifecycle/common/lifecycle'; import { IProductService } from 'vs/platform/product/common/productService'; @@ -34,7 +33,7 @@ export class StartupTimings implements IWorkbenchContribution { @ITelemetryService private readonly _telemetryService: ITelemetryService, @ILifecycleService private readonly _lifecycleService: ILifecycleService, @IUpdateService private readonly _updateService: IUpdateService, - @IWorkbenchEnvironmentService private readonly _envService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService, @IProductService private readonly _productService: IProductService ) { // @@ -47,7 +46,7 @@ export class StartupTimings implements IWorkbenchContribution { } private async _appendStartupTimes(standardStartupError: string | undefined) { - const appendTo = this._envService.args['prof-append-timers']; + const appendTo = this._environmentService.args['prof-append-timers']; if (!appendTo) { // nothing to do return; diff --git a/src/vs/workbench/contrib/remote/electron-sandbox/remote.contribution.ts b/src/vs/workbench/contrib/remote/electron-sandbox/remote.contribution.ts index 83baf2d6e70..aa526471694 100644 --- a/src/vs/workbench/contrib/remote/electron-sandbox/remote.contribution.ts +++ b/src/vs/workbench/contrib/remote/electron-sandbox/remote.contribution.ts @@ -21,7 +21,6 @@ import { DownloadServiceChannel } from 'vs/platform/download/common/downloadIpc' import { LoggerChannel } from 'vs/platform/log/common/logIpc'; import { ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals'; import { IDiagnosticInfoOptions, IRemoteDiagnosticInfo } from 'vs/platform/diagnostics/common/diagnostics'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { PersistentConnectionEventType } from 'vs/platform/remote/common/remoteAgentConnection'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -121,7 +120,7 @@ class RemoteTelemetryEnablementUpdater extends Disposable implements IWorkbenchC class RemoteEmptyWorkbenchPresentation extends Disposable implements IWorkbenchContribution { constructor( - @IWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, @IRemoteAuthorityResolverService remoteAuthorityResolverService: IRemoteAuthorityResolverService, @IConfigurationService configurationService: IConfigurationService, @ICommandService commandService: ICommandService, diff --git a/src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts b/src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts index d60ad762cdf..1777327a092 100644 --- a/src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts +++ b/src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts @@ -18,7 +18,6 @@ import { DEFAULT_EDITOR_MIN_DIMENSIONS } from 'vs/workbench/browser/parts/editor import { Extensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions'; import * as themes from 'vs/workbench/common/theme'; import { IWorkbenchLayoutService, Parts, Position } from 'vs/workbench/services/layout/browser/layoutService'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { URI } from 'vs/base/common/uri'; @@ -42,7 +41,7 @@ class PartsSplash { @IThemeService private readonly _themeService: IThemeService, @IWorkbenchLayoutService private readonly _layoutService: IWorkbenchLayoutService, @ITextFileService private readonly _textFileService: ITextFileService, - @IWorkbenchEnvironmentService private readonly _envService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService, @ILifecycleService lifecycleService: ILifecycleService, @IEditorGroupsService editorGroupsService: IEditorGroupsService, @IConfigurationService configService: IConfigurationService, @@ -96,7 +95,7 @@ class PartsSplash { windowBorderRadius: this._layoutService.getWindowBorderRadius() }; this._textFileService.write( - URI.file(join(this._envService.userDataPath, 'rapid_render.json')), + URI.file(join(this._environmentService.userDataPath, 'rapid_render.json')), JSON.stringify({ id: PartsSplash._splashElementId, colorInfo, @@ -125,7 +124,7 @@ class PartsSplash { } private _shouldSaveLayoutInfo(): boolean { - return !isFullscreen() && !this._envService.isExtensionDevelopment && !this._didChangeTitleBarStyle; + return !isFullscreen() && !this._environmentService.isExtensionDevelopment && !this._didChangeTitleBarStyle; } private _removePartsSplash(): void { diff --git a/src/vs/workbench/electron-browser/desktop.main.ts b/src/vs/workbench/electron-browser/desktop.main.ts index a4b74123f65..8326d04ea80 100644 --- a/src/vs/workbench/electron-browser/desktop.main.ts +++ b/src/vs/workbench/electron-browser/desktop.main.ts @@ -16,7 +16,7 @@ import { URI } from 'vs/base/common/uri'; import { WorkspaceService } from 'vs/workbench/services/configuration/browser/configurationService'; import { NativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; -import { INativeWorkbenchConfiguration } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; +import { INativeWorkbenchConfiguration, INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { ISingleFolderWorkspaceIdentifier, IWorkspaceInitializationPayload, ISingleFolderWorkspaceInitializationPayload, reviveWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces'; import { ILogService } from 'vs/platform/log/common/log'; @@ -175,6 +175,7 @@ class DesktopMain extends Disposable { // Environment serviceCollection.set(IWorkbenchEnvironmentService, this.environmentService); + serviceCollection.set(INativeWorkbenchEnvironmentService, this.environmentService); // Product serviceCollection.set(IProductService, this.productService); diff --git a/src/vs/workbench/electron-sandbox/desktop.main.ts b/src/vs/workbench/electron-sandbox/desktop.main.ts index a9003c14794..670fae19c84 100644 --- a/src/vs/workbench/electron-sandbox/desktop.main.ts +++ b/src/vs/workbench/electron-sandbox/desktop.main.ts @@ -32,13 +32,13 @@ import product from 'vs/platform/product/common/product'; import { IResourceIdentityService } from 'vs/platform/resource/common/resourceIdentityService'; import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { NativeHostService } from 'vs/platform/native/electron-sandbox/nativeHostService'; -import { SimpleConfigurationService, simpleFileSystemProvider, SimpleLogService, SimpleRemoteAgentService, SimpleResourceIdentityService, SimpleSignService, SimpleStorageService, SimpleWorkbenchEnvironmentService, SimpleWorkspaceService } from 'vs/workbench/electron-sandbox/sandbox.simpleservices'; -import { INativeWorkbenchConfiguration } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; +import { SimpleConfigurationService, simpleFileSystemProvider, SimpleLogService, SimpleRemoteAgentService, SimpleResourceIdentityService, SimpleSignService, SimpleStorageService, SimpleNativeWorkbenchEnvironmentService, SimpleWorkspaceService } from 'vs/workbench/electron-sandbox/sandbox.simpleservices'; +import { INativeWorkbenchConfiguration, INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { RemoteAuthorityResolverService } from 'vs/platform/remote/electron-sandbox/remoteAuthorityResolverService'; class DesktopMain extends Disposable { - private readonly environmentService = new SimpleWorkbenchEnvironmentService(this.configuration); + private readonly environmentService = new SimpleNativeWorkbenchEnvironmentService(this.configuration); constructor(private configuration: INativeWorkbenchConfiguration) { super(); @@ -151,6 +151,7 @@ class DesktopMain extends Disposable { // Environment serviceCollection.set(IWorkbenchEnvironmentService, this.environmentService); + serviceCollection.set(INativeWorkbenchEnvironmentService, this.environmentService); // Product const productService: IProductService = { _serviceBrand: undefined, ...product }; diff --git a/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts b/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts index 0872bd69433..2a920acf445 100644 --- a/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts +++ b/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts @@ -69,7 +69,7 @@ import { Schemas } from 'vs/base/common/network'; //#region Environment -export class SimpleWorkbenchEnvironmentService implements INativeWorkbenchEnvironmentService { +export class SimpleNativeWorkbenchEnvironmentService implements INativeWorkbenchEnvironmentService { declare readonly _serviceBrand: undefined; diff --git a/src/vs/workbench/electron-sandbox/window.ts b/src/vs/workbench/electron-sandbox/window.ts index 3a89efaeff6..eed9747c35e 100644 --- a/src/vs/workbench/electron-sandbox/window.ts +++ b/src/vs/workbench/electron-sandbox/window.ts @@ -95,7 +95,7 @@ export class NativeWindow extends Disposable { @IMenuService private readonly menuService: IMenuService, @ILifecycleService private readonly lifecycleService: ILifecycleService, @IIntegrityService private readonly integrityService: IIntegrityService, - @IWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService, @IAccessibilityService private readonly accessibilityService: IAccessibilityService, @IWorkspaceContextService private readonly contextService: IWorkspaceContextService, @IInstantiationService private readonly instantiationService: IInstantiationService, diff --git a/src/vs/workbench/services/accessibility/electron-sandbox/accessibilityService.ts b/src/vs/workbench/services/accessibility/electron-sandbox/accessibilityService.ts index 1cdeadaf906..3228a27ed43 100644 --- a/src/vs/workbench/services/accessibility/electron-sandbox/accessibilityService.ts +++ b/src/vs/workbench/services/accessibility/electron-sandbox/accessibilityService.ts @@ -31,7 +31,7 @@ export class NativeAccessibilityService extends AccessibilityService implements private didSendTelemetry = false; constructor( - @IWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, @IContextKeyService contextKeyService: IContextKeyService, @IConfigurationService configurationService: IConfigurationService, @ITelemetryService private readonly _telemetryService: ITelemetryService diff --git a/src/vs/workbench/services/configurationResolver/electron-sandbox/configurationResolverService.ts b/src/vs/workbench/services/configurationResolver/electron-sandbox/configurationResolverService.ts index a22d0c7cad8..ad20347865d 100644 --- a/src/vs/workbench/services/configurationResolver/electron-sandbox/configurationResolverService.ts +++ b/src/vs/workbench/services/configurationResolver/electron-sandbox/configurationResolverService.ts @@ -3,7 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ICommandService } from 'vs/platform/commands/common/commands'; @@ -21,7 +20,7 @@ export class ConfigurationResolverService extends BaseConfigurationResolverServi constructor( @IEditorService editorService: IEditorService, - @IWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, @IConfigurationService configurationService: IConfigurationService, @ICommandService commandService: ICommandService, @IWorkspaceContextService workspaceContextService: IWorkspaceContextService, diff --git a/src/vs/workbench/services/environment/electron-sandbox/environmentService.ts b/src/vs/workbench/services/environment/electron-sandbox/environmentService.ts index b75dd5fdd9e..7a5b7e1c5ef 100644 --- a/src/vs/workbench/services/environment/electron-sandbox/environmentService.ts +++ b/src/vs/workbench/services/environment/electron-sandbox/environmentService.ts @@ -7,6 +7,9 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/ import { INativeWindowConfiguration, IWindowConfiguration } from 'vs/platform/windows/common/windows'; import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { URI } from 'vs/base/common/uri'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; + +export const INativeWorkbenchEnvironmentService = createDecorator('nativeEnvironmentService'); export interface INativeWorkbenchConfiguration extends IWindowConfiguration, INativeWindowConfiguration { } diff --git a/src/vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService.ts b/src/vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService.ts index 03d6d8e5975..cdd94f1c0ef 100644 --- a/src/vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService.ts +++ b/src/vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService.ts @@ -18,7 +18,6 @@ import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common import { IProductService } from 'vs/platform/product/common/productService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ILogService } from 'vs/platform/log/common/log'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; export class ExtensionManagementServerService implements IExtensionManagementServerService { @@ -38,7 +37,7 @@ export class ExtensionManagementServerService implements IExtensionManagementSer @IProductService productService: IProductService, @IConfigurationService configurationService: IConfigurationService, @ILogService logService: ILogService, - @IWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService + @INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService ) { const localExtensionManagementService = new ExtensionManagementChannelClient(sharedProcessService.getChannel('extensions')); diff --git a/src/vs/workbench/services/extensionManagement/electron-sandbox/extensionManagementService.ts b/src/vs/workbench/services/extensionManagement/electron-sandbox/extensionManagementService.ts index 3972db8693f..e005befccac 100644 --- a/src/vs/workbench/services/extensionManagement/electron-sandbox/extensionManagementService.ts +++ b/src/vs/workbench/services/extensionManagement/electron-sandbox/extensionManagementService.ts @@ -13,7 +13,6 @@ import { Schemas } from 'vs/base/common/network'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IDownloadService } from 'vs/platform/download/common/download'; import { IProductService } from 'vs/platform/product/common/productService'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { joinPath } from 'vs/base/common/resources'; @@ -25,7 +24,7 @@ export class ExtensionManagementService extends BaseExtensionManagementService { @IConfigurationService configurationService: IConfigurationService, @IProductService productService: IProductService, @IDownloadService downloadService: IDownloadService, - @IWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService + @INativeWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService ) { super(extensionManagementServerService, extensionGalleryService, configurationService, productService, downloadService); } diff --git a/src/vs/workbench/services/extensionManagement/electron-sandbox/remoteExtensionManagementService.ts b/src/vs/workbench/services/extensionManagement/electron-sandbox/remoteExtensionManagementService.ts index 41e064cd673..46f638667c0 100644 --- a/src/vs/workbench/services/extensionManagement/electron-sandbox/remoteExtensionManagementService.ts +++ b/src/vs/workbench/services/extensionManagement/electron-sandbox/remoteExtensionManagementService.ts @@ -21,7 +21,6 @@ import { joinPath } from 'vs/base/common/resources'; import { WebRemoteExtensionManagementService } from 'vs/workbench/services/extensionManagement/common/remoteExtensionManagementService'; import { IExtensionManagementServer } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; export class NativeRemoteExtensionManagementService extends WebRemoteExtensionManagementService implements IExtensionManagementService { @@ -34,7 +33,7 @@ export class NativeRemoteExtensionManagementService extends WebRemoteExtensionMa @IExtensionGalleryService galleryService: IExtensionGalleryService, @IConfigurationService configurationService: IConfigurationService, @IProductService productService: IProductService, - @IWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService + @INativeWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService ) { super(channel, galleryService, configurationService, productService); this.localExtensionManagementService = localExtensionManagementServer.extensionManagementService; diff --git a/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts b/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts index 4bf0517ccde..600361d6275 100644 --- a/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts +++ b/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts @@ -13,7 +13,6 @@ import * as platform from 'vs/base/common/platform'; import { joinPath, originalFSPath } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; import * as pfs from 'vs/base/node/pfs'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { IWorkbenchExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; import { BUILTIN_MANIFEST_CACHE_FILE, MANIFEST_CACHE_FOLDER, USER_MANIFEST_CACHE_FILE, ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions'; @@ -53,7 +52,7 @@ export class CachedExtensionScanner { constructor( @INotificationService private readonly _notificationService: INotificationService, - @IWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService, @IWorkbenchExtensionEnablementService private readonly _extensionEnablementService: IWorkbenchExtensionEnablementService, @IHostService private readonly _hostService: IHostService, @IProductService private readonly _productService: IProductService diff --git a/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts b/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts index a0a5e9a1a39..fcb8ffa9a05 100644 --- a/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts +++ b/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts @@ -21,7 +21,6 @@ import { findFreePort } from 'vs/base/node/ports'; import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc'; import { PersistentProtocol } from 'vs/base/parts/ipc/common/ipc.net'; import { generateRandomPipeName, NodeSocket } from 'vs/base/parts/ipc/node/ipc.net'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { ILabelService } from 'vs/platform/label/common/label'; import { ILifecycleService, WillShutdownEvent } from 'vs/platform/lifecycle/common/lifecycle'; @@ -92,7 +91,7 @@ export class LocalProcessExtensionHost implements IExtensionHost { @INotificationService private readonly _notificationService: INotificationService, @INativeHostService private readonly _nativeHostService: INativeHostService, @ILifecycleService private readonly _lifecycleService: ILifecycleService, - @IWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService, @ITelemetryService private readonly _telemetryService: ITelemetryService, @ILogService private readonly _logService: ILogService, @ILabelService private readonly _labelService: ILabelService, diff --git a/src/vs/workbench/services/path/electron-sandbox/pathService.ts b/src/vs/workbench/services/path/electron-sandbox/pathService.ts index 28c0ccdcfa1..31d6efdaa79 100644 --- a/src/vs/workbench/services/path/electron-sandbox/pathService.ts +++ b/src/vs/workbench/services/path/electron-sandbox/pathService.ts @@ -5,7 +5,6 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { IPathService, AbstractPathService } from 'vs/workbench/services/path/common/pathService'; import { Schemas } from 'vs/base/common/network'; @@ -16,7 +15,7 @@ export class NativePathService extends AbstractPathService { constructor( @IRemoteAgentService remoteAgentService: IRemoteAgentService, - @IWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService + @INativeWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService ) { super(environmentService.userHome, remoteAgentService); } diff --git a/src/vs/workbench/services/search/electron-browser/searchService.ts b/src/vs/workbench/services/search/electron-browser/searchService.ts index b95e8836e69..45ed77c6a42 100644 --- a/src/vs/workbench/services/search/electron-browser/searchService.ts +++ b/src/vs/workbench/services/search/electron-browser/searchService.ts @@ -13,7 +13,6 @@ import { getNextTickChannel } from 'vs/base/parts/ipc/common/ipc'; import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IDebugParams } from 'vs/platform/environment/common/environment'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { parseSearchPort } from 'vs/platform/environment/node/environmentService'; import { IFileService } from 'vs/platform/files/common/files'; @@ -36,7 +35,7 @@ export class LocalSearchService extends SearchService { @ILogService logService: ILogService, @IExtensionService extensionService: IExtensionService, @IFileService fileService: IFileService, - @IWorkbenchEnvironmentService readonly environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService readonly environmentService: INativeWorkbenchEnvironmentService, @IInstantiationService readonly instantiationService: IInstantiationService ) { super(modelService, editorService, telemetryService, logService, extensionService, fileService); diff --git a/src/vs/workbench/services/sharedProcess/electron-browser/sharedProcessService.ts b/src/vs/workbench/services/sharedProcess/electron-browser/sharedProcessService.ts index aec7dc7c5d7..07a248a9a14 100644 --- a/src/vs/workbench/services/sharedProcess/electron-browser/sharedProcessService.ts +++ b/src/vs/workbench/services/sharedProcess/electron-browser/sharedProcessService.ts @@ -9,7 +9,6 @@ import { IChannel, IServerChannel, getDelayedChannel } from 'vs/base/parts/ipc/c import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService'; import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; @@ -23,7 +22,7 @@ export class SharedProcessService implements ISharedProcessService { constructor( @IMainProcessService mainProcessService: IMainProcessService, @INativeHostService nativeHostService: INativeHostService, - @IWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService + @INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService ) { this.sharedProcessMainChannel = mainProcessService.getChannel('sharedProcess'); diff --git a/src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts b/src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts index 3e56766afa9..93a14e89918 100644 --- a/src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts +++ b/src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts @@ -7,7 +7,6 @@ import { ITelemetryService, ITelemetryInfo, ITelemetryData } from 'vs/platform/t import { NullTelemetryService, combinedAppender, LogAppender } from 'vs/platform/telemetry/common/telemetryUtils'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { Disposable } from 'vs/base/common/lifecycle'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { IProductService } from 'vs/platform/product/common/productService'; import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; @@ -27,7 +26,7 @@ export class TelemetryService extends Disposable implements ITelemetryService { public readonly sendErrorTelemetry: boolean; constructor( - @IWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, @IProductService productService: IProductService, @ISharedProcessService sharedProcessService: ISharedProcessService, @ILogService logService: ILogService, diff --git a/src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts b/src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts index b0801d00af7..d4a474ff52f 100644 --- a/src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts +++ b/src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts @@ -21,7 +21,6 @@ import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/commo import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IModelService } from 'vs/editor/common/services/modelService'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { IDialogService, IFileDialogService } from 'vs/platform/dialogs/common/dialogs'; import { IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService'; @@ -41,7 +40,7 @@ export class NativeTextFileService extends AbstractTextFileService { @ILifecycleService lifecycleService: ILifecycleService, @IInstantiationService instantiationService: IInstantiationService, @IModelService modelService: IModelService, - @IWorkbenchEnvironmentService protected environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService protected environmentService: INativeWorkbenchEnvironmentService, @IDialogService dialogService: IDialogService, @IFileDialogService fileDialogService: IFileDialogService, @ITextResourceConfigurationService textResourceConfigurationService: ITextResourceConfigurationService, diff --git a/src/vs/workbench/services/timer/electron-sandbox/timerService.ts b/src/vs/workbench/services/timer/electron-sandbox/timerService.ts index beeb3bf7c57..fd16b7da21c 100644 --- a/src/vs/workbench/services/timer/electron-sandbox/timerService.ts +++ b/src/vs/workbench/services/timer/electron-sandbox/timerService.ts @@ -4,7 +4,6 @@ *--------------------------------------------------------------------------------------------*/ import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; @@ -22,7 +21,7 @@ export class TimerService extends AbstractTimerService { constructor( @INativeHostService private readonly _nativeHostService: INativeHostService, - @IWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService private readonly _environmentService: INativeWorkbenchEnvironmentService, @ILifecycleService lifecycleService: ILifecycleService, @IWorkspaceContextService contextService: IWorkspaceContextService, @IExtensionService extensionService: IExtensionService, diff --git a/src/vs/workbench/services/workspaces/electron-sandbox/workspaceEditingService.ts b/src/vs/workbench/services/workspaces/electron-sandbox/workspaceEditingService.ts index 7dae23c1b2e..ed293b30fff 100644 --- a/src/vs/workbench/services/workspaces/electron-sandbox/workspaceEditingService.ts +++ b/src/vs/workbench/services/workspaces/electron-sandbox/workspaceEditingService.ts @@ -17,7 +17,6 @@ import { ICommandService } from 'vs/platform/commands/common/commands'; import { basename } from 'vs/base/common/resources'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; import { IFileService } from 'vs/platform/files/common/files'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { ILifecycleService, ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle'; import { IFileDialogService, IDialogService } from 'vs/platform/dialogs/common/dialogs'; @@ -50,7 +49,7 @@ export class NativeWorkspaceEditingService extends AbstractWorkspaceEditingServi @IFileService fileService: IFileService, @ITextFileService textFileService: ITextFileService, @IWorkspacesService workspacesService: IWorkspacesService, - @IWorkbenchEnvironmentService protected environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService protected environmentService: INativeWorkbenchEnvironmentService, @IFileDialogService fileDialogService: IFileDialogService, @IDialogService protected dialogService: IDialogService, @ILifecycleService private readonly lifecycleService: ILifecycleService, diff --git a/src/vs/workbench/test/electron-browser/workbenchTestServices.ts b/src/vs/workbench/test/electron-browser/workbenchTestServices.ts index a89fe2a3325..86c07a75153 100644 --- a/src/vs/workbench/test/electron-browser/workbenchTestServices.ts +++ b/src/vs/workbench/test/electron-browser/workbenchTestServices.ts @@ -14,7 +14,6 @@ import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/commo import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IModelService } from 'vs/editor/common/services/modelService'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchConfiguration, INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { IDialogService, IFileDialogService, INativeOpenDialogOptions } from 'vs/platform/dialogs/common/dialogs'; import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService'; @@ -69,7 +68,7 @@ export class TestTextFileService extends NativeTextFileService { @ILifecycleService lifecycleService: ILifecycleService, @IInstantiationService instantiationService: IInstantiationService, @IModelService modelService: IModelService, - @IWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, @IDialogService dialogService: IDialogService, @IFileDialogService fileDialogService: IFileDialogService, @ITextResourceConfigurationService textResourceConfigurationService: ITextResourceConfigurationService, @@ -264,7 +263,7 @@ export class TestNativePathService extends TestPathService { declare readonly _serviceBrand: undefined; - constructor(@IWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService) { + constructor(@INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService) { super(environmentService.userHome); } } From bd30762848cbd03ed429019b429a62c0acc55435 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 17:24:57 +0200 Subject: [PATCH 0085/1667] fix tests --- .../test/electron-browser/extensionsActions.test.ts | 3 +++ .../test/electron-browser/configurationService.test.ts | 2 ++ src/vs/workbench/test/common/workbenchTestServices.ts | 6 +++--- .../test/electron-browser/workbenchTestServices.ts | 6 ++++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts index 56367c96042..9e78ab54b8e 100644 --- a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts +++ b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts @@ -50,6 +50,7 @@ import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; import { TestLifecycleService } from 'vs/workbench/test/browser/workbenchTestServices'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; let instantiationService: TestInstantiationService; let installEvent: Emitter, @@ -1903,6 +1904,7 @@ suite('RemoteInstallAction', () => { // multi server setup const localWorkspaceExtension = aLocalExtension('a', { extensionKind: ['workspace'] }, { location: URI.file(`pub.a`) }); const extensionManagementServerService = aMultiExtensionManagementServerService(instantiationService, createExtensionManagementService([localWorkspaceExtension])); + instantiationService.stub(IWorkbenchEnvironmentService, { disableExtensions: true } as IWorkbenchEnvironmentService); instantiationService.stub(INativeWorkbenchEnvironmentService, { disableExtensions: true } as INativeWorkbenchEnvironmentService); instantiationService.stub(IExtensionManagementServerService, extensionManagementServerService); instantiationService.stub(IWorkbenchExtensionEnablementService, new TestExtensionEnablementService(instantiationService)); @@ -2282,6 +2284,7 @@ suite('LocalInstallAction', () => { test('Test local install action is disabled for remote ui extension which is disabled in env', async () => { // multi server setup const remoteUIExtension = aLocalExtension('a', { extensionKind: ['ui'] }, { location: URI.file(`pub.a`).with({ scheme: Schemas.vscodeRemote }) }); + instantiationService.stub(IWorkbenchEnvironmentService, { disableExtensions: true } as IWorkbenchEnvironmentService); instantiationService.stub(INativeWorkbenchEnvironmentService, { disableExtensions: true } as INativeWorkbenchEnvironmentService); const extensionManagementServerService = aMultiExtensionManagementServerService(instantiationService, createExtensionManagementService(), createExtensionManagementService([remoteUIExtension])); instantiationService.stub(IExtensionManagementServerService, extensionManagementServerService); diff --git a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts index 8d94d0dceac..ae676109465 100644 --- a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts +++ b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts @@ -52,6 +52,7 @@ import { VSBuffer } from 'vs/base/common/buffer'; import { DisposableStore } from 'vs/base/common/lifecycle'; import product from 'vs/platform/product/common/product'; import { BrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService'; +import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; class TestWorkbenchEnvironmentService extends NativeWorkbenchEnvironmentService { @@ -1292,6 +1293,7 @@ suite('WorkspaceConfigurationService-Multiroot', () => { instantiationService.stub(IWorkspaceContextService, workspaceService); instantiationService.stub(IConfigurationService, workspaceService); instantiationService.stub(IWorkbenchEnvironmentService, environmentService); + instantiationService.stub(INativeWorkbenchEnvironmentService, environmentService); return workspaceService.initialize(getWorkspaceIdentifier(configPath)).then(() => { instantiationService.stub(IFileService, fileService); diff --git a/src/vs/workbench/test/common/workbenchTestServices.ts b/src/vs/workbench/test/common/workbenchTestServices.ts index 3dda9efc00d..866a0fda122 100644 --- a/src/vs/workbench/test/common/workbenchTestServices.ts +++ b/src/vs/workbench/test/common/workbenchTestServices.ts @@ -8,7 +8,7 @@ import * as resources from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; import { Event, Emitter } from 'vs/base/common/event'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IWorkspaceContextService, IWorkspace as IWorkbenchWorkspace, WorkbenchState, IWorkspaceFolder, IWorkspaceFoldersChangeEvent, Workspace } from 'vs/platform/workspace/common/workspace'; +import { IWorkspaceContextService, IWorkspace, WorkbenchState, IWorkspaceFolder, IWorkspaceFoldersChangeEvent, Workspace } from 'vs/platform/workspace/common/workspace'; import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace'; import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces'; import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService'; @@ -79,11 +79,11 @@ export class TestContextService implements IWorkspaceContextService { return WorkbenchState.EMPTY; } - getCompleteWorkspace(): Promise { + getCompleteWorkspace(): Promise { return Promise.resolve(this.getWorkspace()); } - getWorkspace(): IWorkbenchWorkspace { + getWorkspace(): IWorkspace { return this.workspace; } diff --git a/src/vs/workbench/test/electron-browser/workbenchTestServices.ts b/src/vs/workbench/test/electron-browser/workbenchTestServices.ts index 86c07a75153..27879201c65 100644 --- a/src/vs/workbench/test/electron-browser/workbenchTestServices.ts +++ b/src/vs/workbench/test/electron-browser/workbenchTestServices.ts @@ -41,6 +41,7 @@ import { MouseInputEvent } from 'vs/base/parts/sandbox/common/electronTypes'; import { IModeService } from 'vs/editor/common/services/modeService'; import { IOSProperties, IOSStatistics } from 'vs/platform/native/common/native'; import { ColorScheme } from 'vs/platform/theme/common/theme'; +import { homedir } from 'os'; export const TestWorkbenchConfiguration: INativeWorkbenchConfiguration = { windowId: 0, @@ -238,6 +239,7 @@ export function workbenchInstantiationService(): ITestInstantiationService { }); instantiationService.stub(INativeHostService, new TestNativeHostService()); + instantiationService.stub(INativeWorkbenchEnvironmentService, TestEnvironmentService); return instantiationService; } @@ -263,7 +265,7 @@ export class TestNativePathService extends TestPathService { declare readonly _serviceBrand: undefined; - constructor(@INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService) { - super(environmentService.userHome); + constructor() { + super(URI.file(homedir())); } } From 86ed8976c00ad69b00eb3786c7e5c2f56fc94d4d Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 17 Sep 2020 16:15:12 +0200 Subject: [PATCH 0086/1667] #106934 Clean up marking workspace complete code. - Do not validate if workspace was not initialized --- .../configuration/browser/configuration.ts | 20 +++--- .../browser/configurationService.ts | 65 ++++++++++--------- 2 files changed, 46 insertions(+), 39 deletions(-) diff --git a/src/vs/workbench/services/configuration/browser/configuration.ts b/src/vs/workbench/services/configuration/browser/configuration.ts index 461195a59e9..af4aa6f9a1f 100644 --- a/src/vs/workbench/services/configuration/browser/configuration.ts +++ b/src/vs/workbench/services/configuration/browser/configuration.ts @@ -402,9 +402,8 @@ export class WorkspaceConfiguration extends Disposable { private readonly _onDidUpdateConfiguration: Emitter = this._register(new Emitter()); public readonly onDidUpdateConfiguration: Event = this._onDidUpdateConfiguration.event; - private _loaded: boolean = false; - get loaded(): boolean { return this._loaded; } - + private _initialized: boolean = false; + get initialized(): boolean { return this._initialized; } constructor( configurationCache: IConfigurationCache, fileService: IFileService @@ -414,7 +413,7 @@ export class WorkspaceConfiguration extends Disposable { this._workspaceConfiguration = this._cachedConfiguration = new CachedWorkspaceConfiguration(configurationCache); } - async load(workspaceIdentifier: IWorkspaceIdentifier): Promise { + async initialize(workspaceIdentifier: IWorkspaceIdentifier): Promise { this._workspaceIdentifier = workspaceIdentifier; if (!(this._workspaceConfiguration instanceof FileServiceBasedWorkspaceConfiguration)) { if (this._workspaceIdentifier.configPath.scheme === Schemas.file) { @@ -423,12 +422,15 @@ export class WorkspaceConfiguration extends Disposable { this.waitAndSwitch(this._workspaceIdentifier); } } - this._loaded = this._workspaceConfiguration instanceof FileServiceBasedWorkspaceConfiguration; - await this._workspaceConfiguration.load(this._workspaceIdentifier); + this._initialized = this._workspaceConfiguration instanceof FileServiceBasedWorkspaceConfiguration; + await this.reload(); + return this.initialized; } - reload(): Promise { - return this._workspaceIdentifier ? this.load(this._workspaceIdentifier) : Promise.resolve(); + async reload(): Promise { + if (this._workspaceIdentifier) { + await this._workspaceConfiguration.load(this._workspaceIdentifier); + } } getFolders(): IStoredWorkspaceFolder[] { @@ -458,7 +460,7 @@ export class WorkspaceConfiguration extends Disposable { const fileServiceBasedWorkspaceConfiguration = this._register(new FileServiceBasedWorkspaceConfiguration(this._fileService)); await fileServiceBasedWorkspaceConfiguration.load(workspaceIdentifier); this.switch(fileServiceBasedWorkspaceConfiguration); - this._loaded = true; + this._initialized = true; this.onDidWorkspaceConfigurationChange(false); } } diff --git a/src/vs/workbench/services/configuration/browser/configurationService.ts b/src/vs/workbench/services/configuration/browser/configurationService.ts index 9648a6f5124..81d2558bc44 100644 --- a/src/vs/workbench/services/configuration/browser/configurationService.ts +++ b/src/vs/workbench/services/configuration/browser/configurationService.ts @@ -10,7 +10,7 @@ import { equals } from 'vs/base/common/objects'; import { Disposable } from 'vs/base/common/lifecycle'; import { Queue, Barrier, runWhenIdle } from 'vs/base/common/async'; import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry'; -import { IWorkspaceContextService, Workspace, WorkbenchState, IWorkspaceFolder, toWorkspaceFolders, IWorkspaceFoldersChangeEvent, WorkspaceFolder, toWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; +import { IWorkspaceContextService, Workspace as BaseWorkspace, WorkbenchState, IWorkspaceFolder, toWorkspaceFolders, IWorkspaceFoldersChangeEvent, WorkspaceFolder, toWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { ConfigurationModel, DefaultConfigurationModel, ConfigurationChangeEvent, AllKeysConfigurationChangeEvent, mergeChanges } from 'vs/platform/configuration/common/configurationModels'; import { IConfigurationChangeEvent, ConfigurationTarget, IConfigurationOverrides, keyFromOverrideIdentifier, isConfigurationOverrides, IConfigurationData, IConfigurationService, IConfigurationValue, IConfigurationChange } from 'vs/platform/configuration/common/configuration'; import { Configuration } from 'vs/workbench/services/configuration/common/configurationModels'; @@ -31,6 +31,11 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/ import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { ILogService } from 'vs/platform/log/common/log'; +import { toErrorMessage } from 'vs/base/common/errorMessage'; + +class Workspace extends BaseWorkspace { + initialized: boolean = false; +} export class WorkspaceService extends Disposable implements IConfigurationService, IWorkspaceContextService { @@ -101,9 +106,8 @@ export class WorkspaceService extends Disposable implements IConfigurationServic this.workspaceConfiguration = this._register(new WorkspaceConfiguration(configurationCache, fileService)); this._register(this.workspaceConfiguration.onDidUpdateConfiguration(() => { this.onWorkspaceConfigurationChanged().then(() => { - if (this.workspaceConfiguration.loaded) { - this.releaseWorkspaceBarrier(); - } + this.workspace.initialized = this.workspaceConfiguration.initialized; + this.checkAndMarkWorkspaceComplete(); }); })); @@ -303,12 +307,14 @@ export class WorkspaceService extends Disposable implements IConfigurationServic return this._configuration.keys(); } - initialize(arg: IWorkspaceInitializationPayload): Promise { + async initialize(arg: IWorkspaceInitializationPayload): Promise { mark('willInitWorkspaceService'); - return this.createWorkspace(arg) - .then(workspace => this.updateWorkspaceAndInitializeConfiguration(workspace)).then(() => { - mark('didInitWorkspaceService'); - }); + + const workspace = await this.createWorkspace(arg); + await this.updateWorkspaceAndInitializeConfiguration(workspace); + this.checkAndMarkWorkspaceComplete(); + + mark('didInitWorkspaceService'); } acquireInstantiationService(instantiationService: IInstantiationService): void { @@ -335,34 +341,33 @@ export class WorkspaceService extends Disposable implements IConfigurationServic } private createMultiFolderWorkspace(workspaceIdentifier: IWorkspaceIdentifier): Promise { - return this.workspaceConfiguration.load({ id: workspaceIdentifier.id, configPath: workspaceIdentifier.configPath }) + return this.workspaceConfiguration.initialize({ id: workspaceIdentifier.id, configPath: workspaceIdentifier.configPath }) .then(() => { const workspaceConfigPath = workspaceIdentifier.configPath; const workspaceFolders = toWorkspaceFolders(this.workspaceConfiguration.getFolders(), workspaceConfigPath); const workspaceId = workspaceIdentifier.id; const workspace = new Workspace(workspaceId, workspaceFolders, workspaceConfigPath); - if (this.workspaceConfiguration.loaded) { - this.releaseWorkspaceBarrier(); - } + workspace.initialized = this.workspaceConfiguration.initialized; return workspace; }); } private createSingleFolderWorkspace(singleFolder: ISingleFolderWorkspaceInitializationPayload): Promise { const workspace = new Workspace(singleFolder.id, [toWorkspaceFolder(singleFolder.folder)]); - this.releaseWorkspaceBarrier(); // Release barrier as workspace is complete because it is single folder. + workspace.initialized = true; return Promise.resolve(workspace); } private createEmptyWorkspace(emptyWorkspace: IEmptyWorkspaceInitializationPayload): Promise { const workspace = new Workspace(emptyWorkspace.id); - this.releaseWorkspaceBarrier(); // Release barrier as workspace is complete because it is an empty workspace. + workspace.initialized = true; return Promise.resolve(workspace); } - private releaseWorkspaceBarrier(): void { - if (!this.completeWorkspaceBarrier.isOpen()) { + private checkAndMarkWorkspaceComplete(): void { + if (!this.completeWorkspaceBarrier.isOpen() && this.workspace.initialized) { this.completeWorkspaceBarrier.open(); + this.validateWorkspaceFoldersAndReload(); } } @@ -400,9 +405,6 @@ export class WorkspaceService extends Disposable implements IConfigurationServic this._onDidChangeWorkspaceFolders.fire(folderChanges); } - } else { - // Not waiting on this validation to unblock start up - this.validateWorkspaceFoldersAndReload(); } if (!this.localUserConfiguration.hasTasksLoaded) { @@ -557,15 +559,19 @@ export class WorkspaceService extends Disposable implements IConfigurationServic private async onWorkspaceConfigurationChanged(): Promise { if (this.workspace && this.workspace.configuration) { let newFolders = toWorkspaceFolders(this.workspaceConfiguration.getFolders(), this.workspace.configuration); - const { added, removed, changed } = this.compareFolders(this.workspace.folders, newFolders); - /* If changed validate new folders */ - if (added.length || removed.length || changed.length) { - newFolders = await this.toValidWorkspaceFolders(newFolders); - } - /* Otherwise use existing */ - else { - newFolders = this.workspace.folders; + // Validate only if workspace is initialized + if (this.workspace.initialized) { + const { added, removed, changed } = this.compareFolders(this.workspace.folders, newFolders); + + /* If changed validate new folders */ + if (added.length || removed.length || changed.length) { + newFolders = await this.toValidWorkspaceFolders(newFolders); + } + /* Otherwise use existing */ + else { + newFolders = this.workspace.folders; + } } await this.updateWorkspaceConfiguration(newFolders, this.workspaceConfiguration.getConfiguration()); @@ -654,8 +660,7 @@ export class WorkspaceService extends Disposable implements IConfigurationServic continue; } } catch (e) { - // Ignore Error - this.logService.error(e); + this.logService.warn(`Ignoring the error while validating workspace folder ${workspaceFolder.uri.toString()} - ${toErrorMessage(e)}`); } validWorkspaceFolders.push(workspaceFolder); } From e3f0a1bea54381eee3c4122a0ef30a4f765456a8 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 17 Sep 2020 17:28:07 +0200 Subject: [PATCH 0087/1667] Fix #106934 --- .../configuration/browser/configuration.ts | 41 +++++++++---------- .../browser/configurationCache.ts | 7 ++++ .../configuration/common/configuration.ts | 2 + .../electron-browser/configurationCache.ts | 7 ++++ .../configurationService.test.ts | 2 +- 5 files changed, 37 insertions(+), 22 deletions(-) diff --git a/src/vs/workbench/services/configuration/browser/configuration.ts b/src/vs/workbench/services/configuration/browser/configuration.ts index af4aa6f9a1f..4fa0814a475 100644 --- a/src/vs/workbench/services/configuration/browser/configuration.ts +++ b/src/vs/workbench/services/configuration/browser/configuration.ts @@ -19,7 +19,6 @@ import { WorkbenchState, IWorkspaceFolder } from 'vs/platform/workspace/common/w import { ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry'; import { join } from 'vs/base/common/path'; import { equals } from 'vs/base/common/objects'; -import { Schemas } from 'vs/base/common/network'; import { IConfigurationModel } from 'vs/platform/configuration/common/configuration'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; import { hash } from 'vs/base/common/hash'; @@ -405,7 +404,7 @@ export class WorkspaceConfiguration extends Disposable { private _initialized: boolean = false; get initialized(): boolean { return this._initialized; } constructor( - configurationCache: IConfigurationCache, + private readonly configurationCache: IConfigurationCache, fileService: IFileService ) { super(); @@ -413,18 +412,17 @@ export class WorkspaceConfiguration extends Disposable { this._workspaceConfiguration = this._cachedConfiguration = new CachedWorkspaceConfiguration(configurationCache); } - async initialize(workspaceIdentifier: IWorkspaceIdentifier): Promise { + async initialize(workspaceIdentifier: IWorkspaceIdentifier): Promise { this._workspaceIdentifier = workspaceIdentifier; - if (!(this._workspaceConfiguration instanceof FileServiceBasedWorkspaceConfiguration)) { - if (this._workspaceIdentifier.configPath.scheme === Schemas.file) { - this.switch(new FileServiceBasedWorkspaceConfiguration(this._fileService)); + if (!this._initialized) { + if (this.configurationCache.needsCaching(this._workspaceIdentifier.configPath)) { + this._workspaceConfiguration = this._cachedConfiguration; + this.waitAndInitialize(this._workspaceIdentifier); } else { - this.waitAndSwitch(this._workspaceIdentifier); + this.doInitialize(new FileServiceBasedWorkspaceConfiguration(this._fileService)); } } - this._initialized = this._workspaceConfiguration instanceof FileServiceBasedWorkspaceConfiguration; await this.reload(); - return this.initialized; } async reload(): Promise { @@ -454,22 +452,22 @@ export class WorkspaceConfiguration extends Disposable { return this.getConfiguration(); } - private async waitAndSwitch(workspaceIdentifier: IWorkspaceIdentifier): Promise { + private async waitAndInitialize(workspaceIdentifier: IWorkspaceIdentifier): Promise { await whenProviderRegistered(workspaceIdentifier.configPath, this._fileService); if (!(this._workspaceConfiguration instanceof FileServiceBasedWorkspaceConfiguration)) { const fileServiceBasedWorkspaceConfiguration = this._register(new FileServiceBasedWorkspaceConfiguration(this._fileService)); await fileServiceBasedWorkspaceConfiguration.load(workspaceIdentifier); - this.switch(fileServiceBasedWorkspaceConfiguration); - this._initialized = true; + this.doInitialize(fileServiceBasedWorkspaceConfiguration); this.onDidWorkspaceConfigurationChange(false); } } - private switch(fileServiceBasedWorkspaceConfiguration: FileServiceBasedWorkspaceConfiguration): void { + private doInitialize(fileServiceBasedWorkspaceConfiguration: FileServiceBasedWorkspaceConfiguration): void { this._workspaceConfiguration.dispose(); this._workspaceConfigurationChangeDisposable.dispose(); this._workspaceConfiguration = this._register(fileServiceBasedWorkspaceConfiguration); this._workspaceConfigurationChangeDisposable = this._register(this._workspaceConfiguration.onDidChange(e => this.onDidWorkspaceConfigurationChange(true))); + this._initialized = true; } private async onDidWorkspaceConfigurationChange(reload: boolean): Promise { @@ -481,7 +479,7 @@ export class WorkspaceConfiguration extends Disposable { } private updateCache(): Promise { - if (this._workspaceIdentifier && this._workspaceIdentifier.configPath.scheme !== Schemas.file && this._workspaceConfiguration instanceof FileServiceBasedWorkspaceConfiguration) { + if (this._workspaceIdentifier && this.configurationCache.needsCaching(this._workspaceIdentifier.configPath) && this._workspaceConfiguration instanceof FileServiceBasedWorkspaceConfiguration) { return this._workspaceConfiguration.load(this._workspaceIdentifier) .then(() => this._cachedConfiguration.updateWorkspace(this._workspaceIdentifier!, this._workspaceConfiguration.getConfigurationModel())); } @@ -722,16 +720,14 @@ export class FolderConfiguration extends Disposable implements IFolderConfigurat configFolderRelativePath: string, private readonly workbenchState: WorkbenchState, fileService: IFileService, - configurationCache: IConfigurationCache + private readonly configurationCache: IConfigurationCache ) { super(); this.configurationFolder = resources.joinPath(workspaceFolder.uri, configFolderRelativePath); - this.folderConfiguration = this.cachedFolderConfiguration = new CachedFolderConfiguration(workspaceFolder.uri, configFolderRelativePath, configurationCache); - if (workspaceFolder.uri.scheme === Schemas.file) { - this.folderConfiguration = this.createFileServiceBasedConfiguration(fileService); - this.folderConfigurationDisposable = this._register(this.folderConfiguration.onDidChange(e => this.onDidFolderConfigurationChange())); - } else { + this.cachedFolderConfiguration = new CachedFolderConfiguration(workspaceFolder.uri, configFolderRelativePath, configurationCache); + if (this.configurationCache.needsCaching(workspaceFolder.uri)) { + this.folderConfiguration = this.cachedFolderConfiguration; whenProviderRegistered(workspaceFolder.uri, fileService) .then(() => { this.folderConfiguration.dispose(); @@ -740,6 +736,9 @@ export class FolderConfiguration extends Disposable implements IFolderConfigurat this._register(this.folderConfiguration.onDidChange(e => this.onDidFolderConfigurationChange())); this.onDidFolderConfigurationChange(); }); + } else { + this.folderConfiguration = this.createFileServiceBasedConfiguration(fileService); + this.folderConfigurationDisposable = this._register(this.folderConfiguration.onDidChange(e => this.onDidFolderConfigurationChange())); } } @@ -763,7 +762,7 @@ export class FolderConfiguration extends Disposable implements IFolderConfigurat } private updateCache(): Promise { - if (this.configurationFolder.scheme !== Schemas.file && this.folderConfiguration instanceof FileServiceBasedConfiguration) { + if (this.configurationCache.needsCaching(this.configurationFolder) && this.folderConfiguration instanceof FileServiceBasedConfiguration) { return this.folderConfiguration.loadConfiguration() .then(configurationModel => this.cachedFolderConfiguration.updateConfiguration(configurationModel)); } diff --git a/src/vs/workbench/services/configuration/browser/configurationCache.ts b/src/vs/workbench/services/configuration/browser/configurationCache.ts index 25d29786a1f..a05ffc4d3c6 100644 --- a/src/vs/workbench/services/configuration/browser/configurationCache.ts +++ b/src/vs/workbench/services/configuration/browser/configurationCache.ts @@ -4,9 +4,16 @@ *--------------------------------------------------------------------------------------------*/ import { IConfigurationCache, ConfigurationKey } from 'vs/workbench/services/configuration/common/configuration'; +import { Schemas } from 'vs/base/common/network'; +import { URI } from 'vs/base/common/uri'; export class ConfigurationCache implements IConfigurationCache { + needsCaching(resource: URI): boolean { + // Cache all non user data resources + return resource.scheme !== Schemas.userData; + } + async read(key: ConfigurationKey): Promise { return ''; } diff --git a/src/vs/workbench/services/configuration/common/configuration.ts b/src/vs/workbench/services/configuration/common/configuration.ts index 630086370ba..edec7c0032b 100644 --- a/src/vs/workbench/services/configuration/common/configuration.ts +++ b/src/vs/workbench/services/configuration/common/configuration.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry'; +import { URI } from 'vs/base/common/uri'; export const FOLDER_CONFIG_FOLDER_NAME = '.vscode'; export const FOLDER_SETTINGS_NAME = 'settings'; @@ -35,6 +36,7 @@ export type ConfigurationKey = { type: 'user' | 'workspaces' | 'folder', key: st export interface IConfigurationCache { + needsCaching(resource: URI): boolean; read(key: ConfigurationKey): Promise; write(key: ConfigurationKey, content: string): Promise; remove(key: ConfigurationKey): Promise; diff --git a/src/vs/workbench/services/configuration/electron-browser/configurationCache.ts b/src/vs/workbench/services/configuration/electron-browser/configurationCache.ts index 779f7470177..970ef48c7e9 100644 --- a/src/vs/workbench/services/configuration/electron-browser/configurationCache.ts +++ b/src/vs/workbench/services/configuration/electron-browser/configurationCache.ts @@ -7,6 +7,8 @@ import * as pfs from 'vs/base/node/pfs'; import { join } from 'vs/base/common/path'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { IConfigurationCache, ConfigurationKey } from 'vs/workbench/services/configuration/common/configuration'; +import { URI } from 'vs/base/common/uri'; +import { Schemas } from 'vs/base/common/network'; export class ConfigurationCache implements IConfigurationCache { @@ -15,6 +17,11 @@ export class ConfigurationCache implements IConfigurationCache { constructor(private readonly environmentService: INativeWorkbenchEnvironmentService) { } + needsCaching(resource: URI): boolean { + // Cache all non native resources + return ![Schemas.file, Schemas.userData].includes(resource.scheme); + } + read(key: ConfigurationKey): Promise { return this.getCachedConfiguration(key).read(); } diff --git a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts index ae676109465..7692bb61260 100644 --- a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts +++ b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts @@ -1891,7 +1891,7 @@ suite('WorkspaceConfigurationService - Remote Folder', () => { const fileService = new FileService(new NullLogService()); fileService.registerProvider(Schemas.file, diskFileSystemProvider); fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, undefined, diskFileSystemProvider, environmentService, new NullLogService())); - const configurationCache: IConfigurationCache = { read: () => Promise.resolve(''), write: () => Promise.resolve(), remove: () => Promise.resolve() }; + const configurationCache: IConfigurationCache = { read: () => Promise.resolve(''), write: () => Promise.resolve(), remove: () => Promise.resolve(), needsCaching: () => false }; testObject = new WorkspaceService({ configurationCache, remoteAuthority }, environmentService, fileService, remoteAgentService, new NullLogService()); instantiationService.stub(IWorkspaceContextService, testObject); instantiationService.stub(IConfigurationService, testObject); From c12ec27f44b9c13895d9d860584e3c7ca63dd71a Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 17 Sep 2020 18:18:28 +0200 Subject: [PATCH 0088/1667] fix compilation --- .../contrib/search/test/electron-browser/queryBuilder.test.ts | 2 +- .../services/label/test/electron-browser/label.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/search/test/electron-browser/queryBuilder.test.ts b/src/vs/workbench/contrib/search/test/electron-browser/queryBuilder.test.ts index c2aa4aba84e..92b450d2266 100644 --- a/src/vs/workbench/contrib/search/test/electron-browser/queryBuilder.test.ts +++ b/src/vs/workbench/contrib/search/test/electron-browser/queryBuilder.test.ts @@ -40,7 +40,7 @@ suite('QueryBuilder', () => { instantiationService.stub(IWorkspaceContextService, mockContextService); instantiationService.stub(IEnvironmentService, TestEnvironmentService); - instantiationService.stub(IPathService, new TestNativePathService(TestEnvironmentService)); + instantiationService.stub(IPathService, new TestNativePathService()); queryBuilder = instantiationService.createInstance(QueryBuilder); await new Promise(resolve => setTimeout(resolve, 5)); // Wait for IPathService.userHome to resolve diff --git a/src/vs/workbench/services/label/test/electron-browser/label.test.ts b/src/vs/workbench/services/label/test/electron-browser/label.test.ts index 342841c21cc..bb467cb48f1 100644 --- a/src/vs/workbench/services/label/test/electron-browser/label.test.ts +++ b/src/vs/workbench/services/label/test/electron-browser/label.test.ts @@ -17,7 +17,7 @@ suite('URI Label', () => { let labelService: LabelService; setup(() => { - labelService = new LabelService(TestEnvironmentService, new TestContextService(), new TestNativePathService(TestEnvironmentService)); + labelService = new LabelService(TestEnvironmentService, new TestContextService(), new TestNativePathService()); }); test('file scheme', function () { From 3156f1fbfcbb7bdd5f7aa24b4cde71526d1980c8 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 17 Sep 2020 18:44:02 +0200 Subject: [PATCH 0089/1667] fixes #106865 --- src/vs/workbench/contrib/debug/browser/debugHover.ts | 11 +++++------ .../contrib/debug/browser/media/debugHover.css | 5 +++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugHover.ts b/src/vs/workbench/contrib/debug/browser/debugHover.ts index 72a879b493e..6b01278714a 100644 --- a/src/vs/workbench/contrib/debug/browser/debugHover.ts +++ b/src/vs/workbench/contrib/debug/browser/debugHover.ts @@ -34,7 +34,6 @@ import { EvaluatableExpressionProviderRegistry } from 'vs/editor/common/modes'; import { CancellationToken } from 'vs/base/common/cancellation'; const $ = dom.$; -const MAX_TREE_HEIGHT = 324; async function doFindExpression(container: IExpressionContainer, namesToFind: string[]): Promise { if (!container) { @@ -140,7 +139,7 @@ export class DebugHoverWidget implements IContentWidget { this.domNode.style.color = ''; } })); - this.toDispose.push(this.tree.onDidChangeContentHeight(() => this.layoutTreeAndContainer())); + this.toDispose.push(this.tree.onDidChangeContentHeight(() => this.layoutTreeAndContainer(false))); this.registerListeners(); this.editor.addContentWidget(this); @@ -285,7 +284,7 @@ export class DebugHoverWidget implements IContentWidget { await this.tree.setInput(expression); this.complexValueTitle.textContent = expression.value; this.complexValueTitle.title = expression.value; - this.layoutTreeAndContainer(); + this.layoutTreeAndContainer(true); this.editor.layoutContentWidget(this); this.scrollbar.scanDomNode(); this.tree.scrollTop = 0; @@ -298,11 +297,11 @@ export class DebugHoverWidget implements IContentWidget { } } - private layoutTreeAndContainer(): void { + private layoutTreeAndContainer(initialLayout: boolean): void { const scrollBarHeight = 8; - const treeHeight = Math.min(MAX_TREE_HEIGHT, this.tree.contentHeight + scrollBarHeight); + const treeHeight = Math.min(this.editor.getScrollHeight() / 2, this.tree.contentHeight + scrollBarHeight); this.treeContainer.style.height = `${treeHeight}px`; - this.tree.layout(treeHeight, 324); + this.tree.layout(treeHeight, initialLayout ? 400 : undefined); } hide(): void { diff --git a/src/vs/workbench/contrib/debug/browser/media/debugHover.css b/src/vs/workbench/contrib/debug/browser/media/debugHover.css index 0ec21e70d7e..6c48d940b3b 100644 --- a/src/vs/workbench/contrib/debug/browser/media/debugHover.css +++ b/src/vs/workbench/contrib/debug/browser/media/debugHover.css @@ -16,7 +16,7 @@ } .monaco-editor .debug-hover-widget .complex-value { - width: 324px; + max-width: 700px; } .monaco-editor .debug-hover-widget .complex-value .title { @@ -57,12 +57,13 @@ background-color: rgba(173, 214, 255, 0.15); } -.monaco-editor .debug-hover-widget .value { +.monaco-editor .debug-hover-widget > .monaco-scrollable-element > .value { color: rgba(108, 108, 108, 0.8); overflow: auto; font-family: var(--monaco-monospace-font); max-height: 500px; padding: 4px 5px; + white-space: pre-wrap; } .monaco-editor.vs-dark .debugHoverHighlight, From 40ebb1a8530fdf976b3dd204fef5698c5ac9f7ed Mon Sep 17 00:00:00 2001 From: rebornix Date: Thu, 17 Sep 2020 09:50:47 -0700 Subject: [PATCH 0090/1667] content provider registration without static contribution. --- src/vs/vscode.proposed.d.ts | 7 ++++- .../api/browser/mainThreadNotebook.ts | 10 +++++-- .../workbench/api/common/extHost.protocol.ts | 8 +++-- .../workbench/api/common/extHostNotebook.ts | 10 ++++++- .../notebook/browser/notebook.contribution.ts | 2 +- .../notebook/browser/notebookServiceImpl.ts | 26 ++++++++++++++++- .../contrib/notebook/common/notebookCommon.ts | 2 +- .../notebookEditorModelResolverService.ts | 9 +++++- .../notebook/common/notebookProvider.ts | 29 +++++++++++++++++-- .../notebook/common/notebookService.ts | 4 ++- 10 files changed, 93 insertions(+), 14 deletions(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 5623fae8254..a647a562840 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1791,7 +1791,12 @@ declare module 'vscode' { * Controls if a meetadata property change will trigger notebook document content change and if it will be used in the diff editor * Default to false. If the content provider doesn't persisit a metadata property in the file document, it should be set to true. */ - transientMetadata: { [K in keyof NotebookCellMetadata]?: boolean } + transientMetadata: { [K in keyof NotebookCellMetadata]?: boolean }; + + /** + * Not ready for production or development use yet. + */ + viewOptions?: { displayName: string; filenamePattern: GlobPattern | { include: GlobPattern; exclude: GlobPattern; }; exclusive?: boolean; }; } ): Disposable; diff --git a/src/vs/workbench/api/browser/mainThreadNotebook.ts b/src/vs/workbench/api/browser/mainThreadNotebook.ts index 0691d5d3cc0..728d07e9630 100644 --- a/src/vs/workbench/api/browser/mainThreadNotebook.ts +++ b/src/vs/workbench/api/browser/mainThreadNotebook.ts @@ -6,6 +6,7 @@ import * as DOM from 'vs/base/browser/dom'; import { CancellationToken } from 'vs/base/common/cancellation'; import { Emitter } from 'vs/base/common/event'; +import { IRelativePattern } from 'vs/base/common/glob'; import { combinedDisposable, Disposable, DisposableStore, IDisposable } from 'vs/base/common/lifecycle'; import { ResourceMap } from 'vs/base/common/map'; import { Schemas } from 'vs/base/common/network'; @@ -18,7 +19,7 @@ import { INotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookB import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel'; import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel'; import { INotebookCellStatusBarService } from 'vs/workbench/contrib/notebook/common/notebookCellStatusBarService'; -import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, CellEditType, DisplayOrderKey, ICellEditOperation, ICellRange, IEditor, IMainCellDto, INotebookDecorationRenderOptions, INotebookDocumentFilter, NotebookCellOutputsSplice, NotebookCellsChangeType, NOTEBOOK_DISPLAY_ORDER, TransientMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, CellEditType, DisplayOrderKey, ICellEditOperation, ICellRange, IEditor, IMainCellDto, INotebookDecorationRenderOptions, INotebookDocumentFilter, INotebookExclusiveDocumentFilter, NotebookCellOutputsSplice, NotebookCellsChangeType, NOTEBOOK_DISPLAY_ORDER, TransientMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { IMainNotebookController, INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService'; @@ -443,10 +444,15 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo // } } - async $registerNotebookProvider(extension: NotebookExtensionDescription, viewType: string, supportBackup: boolean, options: { transientOutputs: boolean; transientMetadata: TransientMetadata }): Promise { + async $registerNotebookProvider(extension: NotebookExtensionDescription, viewType: string, supportBackup: boolean, options: { + transientOutputs: boolean; + transientMetadata: TransientMetadata; + viewOptions?: { displayName: string; filenamePattern: string | IRelativePattern | INotebookExclusiveDocumentFilter; exclusive: boolean; }; + }): Promise { const controller: IMainNotebookController = { supportBackup, options, + viewOptions: options.viewOptions, reloadNotebook: async (mainthreadTextModel: NotebookTextModel) => { const data = await this._proxy.$resolveNotebookData(viewType, mainthreadTextModel.uri); mainthreadTextModel.updateLanguages(data.languages); diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 2252959b6cc..8fc8c4501cf 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -51,7 +51,7 @@ import { TunnelDto } from 'vs/workbench/api/common/extHostTunnelService'; import { TunnelOptions } from 'vs/platform/remote/common/tunnel'; import { Timeline, TimelineChangeEvent, TimelineOptions, TimelineProviderDescriptor, InternalTimelineOptions } from 'vs/workbench/contrib/timeline/common/timeline'; import { revive } from 'vs/base/common/marshalling'; -import { IProcessedOutput, INotebookDisplayOrder, NotebookCellMetadata, NotebookDocumentMetadata, ICellEditOperation, NotebookCellsChangedEventDto, NotebookDataDto, IMainCellDto, INotebookDocumentFilter, INotebookKernelInfoDto2, TransientMetadata, INotebookCellStatusBarEntry, ICellRange, INotebookDecorationRenderOptions } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { IProcessedOutput, INotebookDisplayOrder, NotebookCellMetadata, NotebookDocumentMetadata, ICellEditOperation, NotebookCellsChangedEventDto, NotebookDataDto, IMainCellDto, INotebookDocumentFilter, INotebookKernelInfoDto2, TransientMetadata, INotebookCellStatusBarEntry, ICellRange, INotebookDecorationRenderOptions, INotebookExclusiveDocumentFilter } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { CallHierarchyItem } from 'vs/workbench/contrib/callHierarchy/common/callHierarchy'; import { Dto } from 'vs/base/common/types'; import { ISerializableEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariable'; @@ -735,7 +735,11 @@ export enum NotebookEditorRevealType { export type INotebookCellStatusBarEntryDto = Dto; export interface MainThreadNotebookShape extends IDisposable { - $registerNotebookProvider(extension: NotebookExtensionDescription, viewType: string, supportBackup: boolean, options: { transientOutputs: boolean; transientMetadata: TransientMetadata }): Promise; + $registerNotebookProvider(extension: NotebookExtensionDescription, viewType: string, supportBackup: boolean, options: { + transientOutputs: boolean; + transientMetadata: TransientMetadata; + viewOptions?: { displayName: string; filenamePattern: string | IRelativePattern | INotebookExclusiveDocumentFilter; exclusive: boolean; }; + }): Promise; $unregisterNotebookProvider(viewType: string): Promise; $registerNotebookKernelProvider(extension: NotebookExtensionDescription, handle: number, documentFilter: INotebookDocumentFilter): Promise; $unregisterNotebookKernelProvider(handle: number): Promise; diff --git a/src/vs/workbench/api/common/extHostNotebook.ts b/src/vs/workbench/api/common/extHostNotebook.ts index 9be0944abe3..aaeb430bef7 100644 --- a/src/vs/workbench/api/common/extHostNotebook.ts +++ b/src/vs/workbench/api/common/extHostNotebook.ts @@ -304,6 +304,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN options?: { transientOutputs: boolean; transientMetadata: { [K in keyof NotebookCellMetadata]?: boolean }; + viewOptions?: { displayName: string; filenamePattern: vscode.GlobPattern | { include: vscode.GlobPattern; exclude: vscode.GlobPattern }; exclusive?: boolean; }; } ): vscode.Disposable { @@ -332,7 +333,14 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN const supportBackup = !!provider.backupNotebook; - this._proxy.$registerNotebookProvider({ id: extension.identifier, location: extension.extensionLocation, description: extension.description }, viewType, supportBackup, { transientOutputs: options?.transientOutputs || false, transientMetadata: options?.transientMetadata || {} }); + const viewOptionsFilenamePattern = typeConverters.NotebookExclusiveDocumentPattern.from(options?.viewOptions?.filenamePattern); + console.warn(`Notebook content provider view options file name pattern is valid ${options?.viewOptions?.filenamePattern}`); + + this._proxy.$registerNotebookProvider({ id: extension.identifier, location: extension.extensionLocation, description: extension.description }, viewType, supportBackup, { + transientOutputs: options?.transientOutputs || false, + transientMetadata: options?.transientMetadata || {}, + viewOptions: options?.viewOptions && viewOptionsFilenamePattern ? { displayName: options.viewOptions.displayName, filenamePattern: viewOptionsFilenamePattern, exclusive: options.viewOptions.exclusive || false } : undefined + }); return new extHostTypes.Disposable(() => { listener.dispose(); diff --git a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts index 00758180339..593022037f4 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts @@ -344,7 +344,7 @@ export class NotebookContribution extends Disposable implements IWorkbenchContri } const infos = this.notebookService.getContributedNotebookProviders(notebookUri); - let info = infos.find(info => !id || info.id === id); + let info = infos.find(info => (!id || info.id === id) && info.exclusive) || infos.find(info => !id || info.id === id); if (!info && id !== undefined) { info = this.notebookService.getContributedNotebookProvider(id); diff --git a/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts b/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts index b7c97df0df7..00db1427e49 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts @@ -121,7 +121,9 @@ export class NotebookProviderInfoStore extends Disposable { providerExtensionId: extension.description.identifier.value, providerDescription: extension.description.description, providerDisplayName: extension.description.isBuiltin ? nls.localize('builtinProviderDisplayName', "Built-in") : extension.description.displayName || extension.description.identifier.value, - providerExtensionLocation: extension.description.extensionLocation + providerExtensionLocation: extension.description.extensionLocation, + dynamicContribution: false, + exclusive: false })); } } @@ -175,6 +177,10 @@ export class NotebookProviderInfoStore extends Disposable { return; } this._contributedEditors.set(info.id, info); + + const mementoObject = this._memento.getMemento(StorageScope.GLOBAL); + mementoObject[NotebookProviderInfoStore.CUSTOM_EDITORS_ENTRY_ID] = Array.from(this._contributedEditors.values()); + this._memento.saveMemento(); } getContributedNotebook(resource: URI): readonly NotebookProviderInfo[] { @@ -550,6 +556,7 @@ export class NotebookService extends Disposable implements INotebookService, ICu if (!this._notebookProviders.has(viewType)) { await this._extensionService.whenInstalledExtensionsRegistered(); // notebook providers/kernels/renderers might use `*` as activation event. + // TODO, only activate by `*` if this._notebookProviders.get(viewType).dynamicContribution === true await this._extensionService.activateByEvent(`*`); // this awaits full activation of all matching extensions await this._extensionService.activateByEvent(`onNotebook:${viewType}`); @@ -562,6 +569,23 @@ export class NotebookService extends Disposable implements INotebookService, ICu registerNotebookController(viewType: string, extensionData: NotebookExtensionDescription, controller: IMainNotebookController): IDisposable { this._notebookProviders.set(viewType, { extensionData, controller }); + + if (controller.viewOptions && !this.notebookProviderInfoStore.get(viewType)) { + // register this content provider to the static contribution, if it does not exist + this.notebookProviderInfoStore.add(new NotebookProviderInfo({ + displayName: controller.viewOptions.displayName, + id: viewType, + priority: NotebookEditorPriority.default, + selector: [{ filenamePattern: controller.viewOptions.filenamePattern }], + providerExtensionId: extensionData.id.value, + providerDescription: extensionData.description, + providerDisplayName: extensionData.id.value, + providerExtensionLocation: URI.revive(extensionData.location), + dynamicContribution: true, + exclusive: controller.viewOptions.exclusive + })); + } + this._onDidChangeViewTypes.fire(); return toDisposable(() => { this._notebookProviders.delete(viewType); diff --git a/src/vs/workbench/contrib/notebook/common/notebookCommon.ts b/src/vs/workbench/contrib/notebook/common/notebookCommon.ts index ce10e2148a1..b48010c800d 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookCommon.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookCommon.ts @@ -778,7 +778,7 @@ export interface INotebookDocumentFilter { //TODO@rebornix test -function isDocumentExcludePattern(filenamePattern: string | glob.IRelativePattern | INotebookExclusiveDocumentFilter): filenamePattern is { include: string | glob.IRelativePattern; exclude: string | glob.IRelativePattern; } { +export function isDocumentExcludePattern(filenamePattern: string | glob.IRelativePattern | INotebookExclusiveDocumentFilter): filenamePattern is { include: string | glob.IRelativePattern; exclude: string | glob.IRelativePattern; } { const arg = filenamePattern as INotebookExclusiveDocumentFilter; if ((typeof arg.include === 'string' || glob.isRelativePattern(arg.include)) diff --git a/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService.ts b/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService.ts index fa256db854c..d68e4142faf 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService.ts @@ -64,8 +64,15 @@ export class NotebookModelResolverService implements INotebookEditorModelResolve const existingViewType = this._notebookService.getNotebookTextModel(resource)?.viewType; if (!viewType) { - viewType = existingViewType ?? this._notebookService.getContributedNotebookProviders(resource)[0]?.id; + if (existingViewType) { + viewType = existingViewType; + } else { + const providers = this._notebookService.getContributedNotebookProviders(resource); + const exclusiveProvider = providers.find(provider => provider.exclusive); + viewType = exclusiveProvider?.id || providers[0]?.id; + } } + if (!viewType) { throw new Error(`Missing viewType for '${resource}'`); } diff --git a/src/vs/workbench/contrib/notebook/common/notebookProvider.ts b/src/vs/workbench/contrib/notebook/common/notebookProvider.ts index 3649b54141c..7465b9e1be5 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookProvider.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookProvider.ts @@ -6,10 +6,10 @@ import * as glob from 'vs/base/common/glob'; import { URI } from 'vs/base/common/uri'; import { basename } from 'vs/base/common/path'; -import { NotebookEditorPriority } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { INotebookExclusiveDocumentFilter, isDocumentExcludePattern, NotebookEditorPriority } from 'vs/workbench/contrib/notebook/common/notebookCommon'; export interface NotebookSelector { - readonly filenamePattern?: string; + readonly filenamePattern?: string | glob.IRelativePattern | INotebookExclusiveDocumentFilter; readonly excludeFileNamePattern?: string; } @@ -22,6 +22,8 @@ export interface NotebookEditorDescriptor { readonly providerDescription?: string; readonly providerDisplayName: string; readonly providerExtensionLocation: URI; + readonly dynamicContribution: boolean; + readonly exclusive: boolean; } export class NotebookProviderInfo implements NotebookEditorDescriptor { @@ -35,6 +37,8 @@ export class NotebookProviderInfo implements NotebookEditorDescriptor { readonly providerDescription?: string; readonly providerDisplayName: string; readonly providerExtensionLocation: URI; + readonly dynamicContribution: boolean; + readonly exclusive: boolean; constructor(descriptor: NotebookEditorDescriptor) { this.id = descriptor.id; @@ -45,6 +49,8 @@ export class NotebookProviderInfo implements NotebookEditorDescriptor { this.providerDescription = descriptor.providerDescription; this.providerDisplayName = descriptor.providerDisplayName; this.providerExtensionLocation = descriptor.providerExtensionLocation; + this.dynamicContribution = descriptor.dynamicContribution; + this.exclusive = descriptor.exclusive; } matches(resource: URI): boolean { @@ -52,7 +58,11 @@ export class NotebookProviderInfo implements NotebookEditorDescriptor { } static selectorMatches(selector: NotebookSelector, resource: URI): boolean { - if (selector.filenamePattern) { + if (!selector.filenamePattern) { + return false; + } + + if (typeof selector.filenamePattern === 'string') { if (glob.match(selector.filenamePattern.toLowerCase(), basename(resource.fsPath).toLowerCase())) { if (selector.excludeFileNamePattern) { if (glob.match(selector.excludeFileNamePattern.toLowerCase(), basename(resource.fsPath).toLowerCase())) { @@ -64,6 +74,19 @@ export class NotebookProviderInfo implements NotebookEditorDescriptor { return true; } } + + let filenamePattern = isDocumentExcludePattern(selector.filenamePattern) ? selector.filenamePattern.include : (selector.filenamePattern as string | glob.IRelativePattern); + let excludeFilenamePattern = isDocumentExcludePattern(selector.filenamePattern) ? selector.filenamePattern.exclude : undefined; + + if (glob.match(filenamePattern, basename(resource.fsPath).toLowerCase())) { + if (excludeFilenamePattern) { + if (glob.match(excludeFilenamePattern, basename(resource.fsPath).toLowerCase())) { + return false; + } + } + return true; + } + return false; } } diff --git a/src/vs/workbench/contrib/notebook/common/notebookService.ts b/src/vs/workbench/contrib/notebook/common/notebookService.ts index b05db598a5d..aa00ccd018d 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookService.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookService.ts @@ -10,19 +10,21 @@ import { NotebookExtensionDescription } from 'vs/workbench/api/common/extHost.pr import { Event } from 'vs/base/common/event'; import { INotebookTextModel, INotebookRendererInfo, - IEditor, ICellEditOperation, NotebookCellOutputsSplice, INotebookKernelProvider, INotebookKernelInfo2, TransientMetadata, NotebookDataDto, TransientOptions, INotebookDecorationRenderOptions + IEditor, ICellEditOperation, NotebookCellOutputsSplice, INotebookKernelProvider, INotebookKernelInfo2, TransientMetadata, NotebookDataDto, TransientOptions, INotebookDecorationRenderOptions, INotebookExclusiveDocumentFilter } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel'; import { CancellationToken } from 'vs/base/common/cancellation'; import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel'; import { IDisposable } from 'vs/base/common/lifecycle'; import { NotebookOutputRendererInfo } from 'vs/workbench/contrib/notebook/common/notebookOutputRenderer'; +import { IRelativePattern } from 'vs/base/common/glob'; export const INotebookService = createDecorator('notebookService'); export interface IMainNotebookController { supportBackup: boolean; + viewOptions?: { displayName: string; filenamePattern: string | IRelativePattern | INotebookExclusiveDocumentFilter; exclusive: boolean; }; options: { transientOutputs: boolean; transientMetadata: TransientMetadata; }; resolveNotebookDocument(viewType: string, uri: URI, backupId?: string): Promise<{ data: NotebookDataDto, transientOptions: TransientOptions }>; reloadNotebook(mainthreadTextModel: NotebookTextModel): Promise; From 39bc865422976b858a43a52e787b224be1a07fe0 Mon Sep 17 00:00:00 2001 From: rebornix Date: Thu, 17 Sep 2020 10:09:46 -0700 Subject: [PATCH 0091/1667] :lipstick: --- src/vs/workbench/api/common/extHostNotebook.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/api/common/extHostNotebook.ts b/src/vs/workbench/api/common/extHostNotebook.ts index aaeb430bef7..5213e6b7adf 100644 --- a/src/vs/workbench/api/common/extHostNotebook.ts +++ b/src/vs/workbench/api/common/extHostNotebook.ts @@ -334,7 +334,9 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN const supportBackup = !!provider.backupNotebook; const viewOptionsFilenamePattern = typeConverters.NotebookExclusiveDocumentPattern.from(options?.viewOptions?.filenamePattern); - console.warn(`Notebook content provider view options file name pattern is valid ${options?.viewOptions?.filenamePattern}`); + if (!viewOptionsFilenamePattern) { + console.warn(`Notebook content provider view options file name pattern is invalid ${options?.viewOptions?.filenamePattern}`); + } this._proxy.$registerNotebookProvider({ id: extension.identifier, location: extension.extensionLocation, description: extension.description }, viewType, supportBackup, { transientOutputs: options?.transientOutputs || false, From f98288e82de0c96409f54dc546be3682f40b8b52 Mon Sep 17 00:00:00 2001 From: sana-ajani Date: Thu, 17 Sep 2020 13:14:00 -0400 Subject: [PATCH 0092/1667] update distro --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2244610ffb6..3531114db97 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.50.0", - "distro": "1fd8b5f570e35db1741de35657e9164dfe81da7b", + "distro": "8d78341175414dcfde7cd493d481064cd4bf96d4", "author": { "name": "Microsoft Corporation" }, From 20a6e1f5a251b1b6a625ceb468cc6c09be6e5faa Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 17 Sep 2020 20:20:07 +0200 Subject: [PATCH 0093/1667] update sync url on change --- .../common/userDataAutoSyncService.ts | 15 +++++++++- .../userDataSync/common/userDataSync.ts | 1 + .../userDataSync/common/userDataSyncIpc.ts | 3 ++ .../common/userDataSyncStoreService.ts | 29 ++++++++++++------- .../sandbox.simpleservices.ts | 2 ++ .../userDataSyncStoreManagementService.ts | 1 + 6 files changed, 40 insertions(+), 11 deletions(-) diff --git a/src/vs/platform/userDataSync/common/userDataAutoSyncService.ts b/src/vs/platform/userDataSync/common/userDataAutoSyncService.ts index 9574d24e419..82df24ea01f 100644 --- a/src/vs/platform/userDataSync/common/userDataAutoSyncService.ts +++ b/src/vs/platform/userDataSync/common/userDataAutoSyncService.ts @@ -114,10 +114,23 @@ export class UserDataAutoSyncService extends UserDataAutoSyncEnablementService i ) { super(storageService, environmentService, userDataSyncStoreManagementService); this.syncTriggerDelayer = this._register(new Delayer(0)); + this.lastSyncUrl = this.syncUrl; this.syncUrl = userDataSyncStoreManagementService.userDataSyncStore?.url; - if (userDataSyncStoreManagementService.userDataSyncStore) { + if (this.syncUrl) { + + this.logService.info('Using settings sync service', this.syncUrl.toString()); + this._register(userDataSyncStoreManagementService.onDidChangeUserDataSyncStore(() => { + if (!isEqual(this.syncUrl, userDataSyncStoreManagementService.userDataSyncStore?.url)) { + this.lastSyncUrl = this.syncUrl; + this.syncUrl = userDataSyncStoreManagementService.userDataSyncStore?.url; + if (this.syncUrl) { + this.logService.info('Using settings sync service', this.syncUrl.toString()); + } + } + })); + if (this.isEnabled()) { this.logService.info('Auto Sync is enabled.'); } else { diff --git a/src/vs/platform/userDataSync/common/userDataSync.ts b/src/vs/platform/userDataSync/common/userDataSync.ts index 642c49800e5..f98181038df 100644 --- a/src/vs/platform/userDataSync/common/userDataSync.ts +++ b/src/vs/platform/userDataSync/common/userDataSync.ts @@ -158,6 +158,7 @@ export type UserDataSyncStoreType = 'insiders' | 'stable'; export const IUserDataSyncStoreManagementService = createDecorator('IUserDataSyncStoreManagementService'); export interface IUserDataSyncStoreManagementService { readonly _serviceBrand: undefined; + readonly onDidChangeUserDataSyncStore: Event; readonly userDataSyncStore: IUserDataSyncStore | undefined; switch(type: UserDataSyncStoreType): Promise; getPreviousUserDataSyncStore(): Promise; diff --git a/src/vs/platform/userDataSync/common/userDataSyncIpc.ts b/src/vs/platform/userDataSync/common/userDataSyncIpc.ts index 08a8243bb42..aaa4a8543f1 100644 --- a/src/vs/platform/userDataSync/common/userDataSyncIpc.ts +++ b/src/vs/platform/userDataSync/common/userDataSyncIpc.ts @@ -271,6 +271,9 @@ export class UserDataSyncStoreManagementServiceChannel implements IServerChannel constructor(private readonly service: IUserDataSyncStoreManagementService) { } listen(_: unknown, event: string): Event { + switch (event) { + case 'onDidChangeUserDataSyncStore': return this.service.onDidChangeUserDataSyncStore; + } throw new Error(`Event not found: ${event}`); } diff --git a/src/vs/platform/userDataSync/common/userDataSyncStoreService.ts b/src/vs/platform/userDataSync/common/userDataSyncStoreService.ts index 20ffff9cffd..59e8d8fb0d2 100644 --- a/src/vs/platform/userDataSync/common/userDataSyncStoreService.ts +++ b/src/vs/platform/userDataSync/common/userDataSyncStoreService.ts @@ -36,7 +36,10 @@ export abstract class AbstractUserDataSyncStoreManagementService extends Disposa _serviceBrand: any; - readonly userDataSyncStore: UserDataSyncStore | undefined; + private readonly _onDidChangeUserDataSyncStore = this._register(new Emitter()); + readonly onDidChangeUserDataSyncStore = this._onDidChangeUserDataSyncStore.event; + private _userDataSyncStore: UserDataSyncStore | undefined; + get userDataSyncStore(): UserDataSyncStore | undefined { return this._userDataSyncStore; } constructor( @IProductService protected readonly productService: IProductService, @@ -44,7 +47,12 @@ export abstract class AbstractUserDataSyncStoreManagementService extends Disposa @IStorageService protected readonly storageService: IStorageService, ) { super(); - this.userDataSyncStore = this.toUserDataSyncStore(productService[CONFIGURATION_SYNC_STORE_KEY], configurationService.getValue(CONFIGURATION_SYNC_STORE_KEY)); + this.updateUserDataSyncStore(); + } + + protected updateUserDataSyncStore(): void { + this._userDataSyncStore = this.toUserDataSyncStore(this.productService[CONFIGURATION_SYNC_STORE_KEY], this.configurationService.getValue(CONFIGURATION_SYNC_STORE_KEY)); + this._onDidChangeUserDataSyncStore.fire(); } protected toUserDataSyncStore(productStore: ConfigurationSyncStore | undefined, configuredStore?: ConfigurationSyncStore): UserDataSyncStore | undefined { @@ -69,7 +77,7 @@ export abstract class AbstractUserDataSyncStoreManagementService extends Disposa defaultUrl: URI.parse(syncStore.url), stableUrl: URI.parse(syncStore.stableUrl), insidersUrl: URI.parse(syncStore.insidersUrl), - canSwitch: !!syncStore.canSwitch, + canSwitch: !!syncStore.canSwitch && !configuredStore?.url, authenticationProviders: Object.keys(syncStore.authenticationProviders).reduce((result, id) => { result.push({ id, scopes: syncStore!.authenticationProviders[id].scopes }); return result; @@ -92,7 +100,6 @@ export class UserDataSyncStoreManagementService extends AbstractUserDataSyncStor @IProductService productService: IProductService, @IConfigurationService configurationService: IConfigurationService, @IStorageService storageService: IStorageService, - @IUserDataSyncLogService logService: IUserDataSyncLogService, ) { super(productService, configurationService, storageService); @@ -107,10 +114,6 @@ export class UserDataSyncStoreManagementService extends AbstractUserDataSyncStor } else { this.storageService.remove(SYNC_PREVIOUS_STORE, StorageScope.GLOBAL); } - - if (this.userDataSyncStore) { - logService.info('Using settings sync service', this.userDataSyncStore.url.toString()); - } } async switch(type: UserDataSyncStoreType): Promise { @@ -120,6 +123,7 @@ export class UserDataSyncStoreManagementService extends AbstractUserDataSyncStor } else { this.storageService.store(SYNC_SERVICE_URL_TYPE, type, StorageScope.GLOBAL); } + this.updateUserDataSyncStore(); } } @@ -130,7 +134,7 @@ export class UserDataSyncStoreManagementService extends AbstractUserDataSyncStor export class UserDataSyncStoreClient extends Disposable implements IUserDataSyncStoreClient { - private readonly userDataSyncStoreUrl: URI | undefined; + private userDataSyncStoreUrl: URI | undefined; private authToken: { token: string, type: string } | undefined; private readonly commonHeadersPromise: Promise<{ [key: string]: string; }>; @@ -157,7 +161,7 @@ export class UserDataSyncStoreClient extends Disposable implements IUserDataSync @IStorageService private readonly storageService: IStorageService, ) { super(); - this.userDataSyncStoreUrl = userDataSyncStoreUrl ? joinPath(userDataSyncStoreUrl, 'v1') : undefined; + this.updateUserDataSyncStoreUrl(userDataSyncStoreUrl); this.commonHeadersPromise = getServiceMachineId(environmentService, fileService, storageService) .then(uuid => { const headers: IHeaders = { @@ -180,6 +184,10 @@ export class UserDataSyncStoreClient extends Disposable implements IUserDataSync this.authToken = { token, type }; } + protected updateUserDataSyncStoreUrl(userDataSyncStoreUrl: URI | undefined): void { + this.userDataSyncStoreUrl = userDataSyncStoreUrl ? joinPath(userDataSyncStoreUrl, 'v1') : undefined; + } + private initDonotMakeRequestsUntil(): void { const donotMakeRequestsUntil = this.storageService.getNumber(DONOT_MAKE_REQUESTS_UNTIL_KEY, StorageScope.GLOBAL); if (donotMakeRequestsUntil && Date.now() < donotMakeRequestsUntil) { @@ -465,6 +473,7 @@ export class UserDataSyncStoreService extends UserDataSyncStoreClient implements @IStorageService storageService: IStorageService, ) { super(userDataSyncStoreManagementService.userDataSyncStore?.url, productService, requestService, logService, environmentService, fileService, storageService); + this._register(userDataSyncStoreManagementService.onDidChangeUserDataSyncStore(() => this.updateUserDataSyncStoreUrl(userDataSyncStoreManagementService.userDataSyncStore?.url))); } } diff --git a/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts b/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts index d6f8e16fbf7..157ba284876 100644 --- a/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts +++ b/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts @@ -752,6 +752,8 @@ class SimpleIUserDataSyncStoreManagementService implements IUserDataSyncStoreMan declare readonly _serviceBrand: undefined; + onDidChangeUserDataSyncStore = Event.None; + userDataSyncStore: IUserDataSyncStore | undefined = undefined; async switch(type: UserDataSyncStoreType): Promise { } diff --git a/src/vs/workbench/services/userDataSync/electron-browser/userDataSyncStoreManagementService.ts b/src/vs/workbench/services/userDataSync/electron-browser/userDataSyncStoreManagementService.ts index d5df2210df5..7b2e238f684 100644 --- a/src/vs/workbench/services/userDataSync/electron-browser/userDataSyncStoreManagementService.ts +++ b/src/vs/workbench/services/userDataSync/electron-browser/userDataSyncStoreManagementService.ts @@ -25,6 +25,7 @@ class UserDataSyncStoreManagementService extends AbstractUserDataSyncStoreManage ) { super(productService, configurationService, storageService); this.channel = sharedProcessService.getChannel('userDataSyncStoreManagement'); + this._register(this.channel.listen('onDidChangeUserDataSyncStore')(() => this.updateUserDataSyncStore())); } async switch(type: UserDataSyncStoreType): Promise { From 5f1997e0b5da7b96eb5ede38fb08bcf1a7d3acfb Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 17 Sep 2020 21:10:50 +0200 Subject: [PATCH 0094/1667] fixes: - focus the first element by default - tweak wordings --- src/vs/base/parts/quickinput/browser/quickInput.ts | 5 +++++ .../workbench/contrib/userDataSync/browser/userDataSync.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/vs/base/parts/quickinput/browser/quickInput.ts b/src/vs/base/parts/quickinput/browser/quickInput.ts index f7094eca3bd..0a4c9f1ba53 100644 --- a/src/vs/base/parts/quickinput/browser/quickInput.ts +++ b/src/vs/base/parts/quickinput/browser/quickInput.ts @@ -975,6 +975,11 @@ class QuickPick extends QuickInput implements IQuickPi // we need to move focus into the tree to detect keybindings // properly when the input box is not visible (quick nav) this.ui.list.domFocus(); + + // Focus the first element in the list if multiselect is enabled + if (this.canSelectMany) { + this.ui.list.focus(QuickInputListFocus.First); + } } } } diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts index b84ba52a81f..1ad860e5e49 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts @@ -515,8 +515,8 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo quickPick.title = SYNC_TITLE; quickPick.ok = false; quickPick.customButton = true; - quickPick.customLabel = localize('turn on', "Turn On"); - quickPick.description = localize('configure and turn on sync detail', "Please turn on to synchronize your data across devices."); + quickPick.customLabel = localize('sign in and turn on', "Sign in & Turn on"); + quickPick.description = localize('configure and turn on sync detail', "Please sign in to synchronize your data across devices."); quickPick.canSelectMany = true; quickPick.ignoreFocusOut = true; quickPick.hideInput = true; From d9680b9d05b9526bd44cee8084c80788e7ab7010 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 17 Sep 2020 21:14:13 +0200 Subject: [PATCH 0095/1667] :lipstick: --- .../userDataSync/browser/userDataSyncWorkbenchService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts b/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts index e8b4924fe5a..9d97faa76f5 100644 --- a/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts +++ b/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts @@ -499,7 +499,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat quickPick.title = SYNC_TITLE; quickPick.ok = false; - quickPick.placeholder = localize('choose account placeholder', "Select an account"); + quickPick.placeholder = localize('choose account placeholder', "Select an account to sign in"); quickPick.ignoreFocusOut = true; quickPick.items = this.createQuickpickItems(); From e42a46ab35b612e907eb641cec580ccc78a31c27 Mon Sep 17 00:00:00 2001 From: rebornix Date: Thu, 17 Sep 2020 17:06:55 -0700 Subject: [PATCH 0096/1667] Notebook document content options. --- src/vs/vscode.proposed.d.ts | 28 +++++++++++-------- .../api/browser/mainThreadNotebook.ts | 1 + .../workbench/api/common/extHost.protocol.ts | 1 + .../workbench/api/common/extHostNotebook.ts | 2 +- .../api/common/extHostNotebookDocument.ts | 2 ++ .../test/browser/api/extHostNotebook.test.ts | 1 + .../api/extHostNotebookConcatDocument.test.ts | 1 + 7 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index a647a562840..b3f9fd91adf 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1367,6 +1367,20 @@ declare module 'vscode' { runState?: NotebookRunState; } + export interface NotebookDocumentContentOptions { + /** + * Controls if outputs change will trigger notebook document content change and if it will be used in the diff editor + * Default to false. If the content provider doesn't persisit the outputs in the file document, this should be set to true. + */ + transientOutputs: boolean; + + /** + * Controls if a meetadata property change will trigger notebook document content change and if it will be used in the diff editor + * Default to false. If the content provider doesn't persisit a metadata property in the file document, it should be set to true. + */ + transientMetadata: { [K in keyof NotebookCellMetadata]?: boolean }; + } + export interface NotebookDocument { readonly uri: Uri; readonly version: number; @@ -1375,6 +1389,7 @@ declare module 'vscode' { readonly isDirty: boolean; readonly isUntitled: boolean; readonly cells: ReadonlyArray; + readonly contentOptions: NotebookDocumentContentOptions; languages: string[]; metadata: NotebookDocumentMetadata; } @@ -1781,18 +1796,7 @@ declare module 'vscode' { export function registerNotebookContentProvider( notebookType: string, provider: NotebookContentProvider, - options?: { - /** - * Controls if outputs change will trigger notebook document content change and if it will be used in the diff editor - * Default to false. If the content provider doesn't persisit the outputs in the file document, this should be set to true. - */ - transientOutputs: boolean; - /** - * Controls if a meetadata property change will trigger notebook document content change and if it will be used in the diff editor - * Default to false. If the content provider doesn't persisit a metadata property in the file document, it should be set to true. - */ - transientMetadata: { [K in keyof NotebookCellMetadata]?: boolean }; - + options?: NotebookDocumentContentOptions & { /** * Not ready for production or development use yet. */ diff --git a/src/vs/workbench/api/browser/mainThreadNotebook.ts b/src/vs/workbench/api/browser/mainThreadNotebook.ts index 728d07e9630..e7f9cd2462b 100644 --- a/src/vs/workbench/api/browser/mainThreadNotebook.ts +++ b/src/vs/workbench/api/browser/mainThreadNotebook.ts @@ -105,6 +105,7 @@ class DocumentAndEditorState { outputs: cell.outputs, metadata: cell.metadata })), + contentOptions: e.transientOptions, // attachedEditor: editorId ? { // id: editorId, // selections: document.textModel.selections diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 8fc8c4501cf..bc67d3f4500 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1667,6 +1667,7 @@ export interface INotebookModelAddedData { viewType: string; metadata?: NotebookDocumentMetadata; attachedEditor?: { id: string; selections: number[]; visibleRanges: ICellRange[] } + contentOptions: { transientOutputs: boolean; transientMetadata: TransientMetadata; } } export interface INotebookEditorAddData { diff --git a/src/vs/workbench/api/common/extHostNotebook.ts b/src/vs/workbench/api/common/extHostNotebook.ts index 5213e6b7adf..b9f298258e4 100644 --- a/src/vs/workbench/api/common/extHostNotebook.ts +++ b/src/vs/workbench/api/common/extHostNotebook.ts @@ -729,7 +729,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN emitDocumentMetadataChange(event: vscode.NotebookDocumentMetadataChangeEvent): void { that._onDidChangeNotebookDocumentMetadata.fire(event); } - }, viewType, { ...notebookDocumentMetadataDefaults, ...modelData.metadata }, uri, storageRoot); + }, viewType, modelData.contentOptions, { ...notebookDocumentMetadataDefaults, ...modelData.metadata }, uri, storageRoot); document.acceptModelChanged({ versionId: modelData.versionId, diff --git a/src/vs/workbench/api/common/extHostNotebookDocument.ts b/src/vs/workbench/api/common/extHostNotebookDocument.ts index c881d9a5d36..e67332a4033 100644 --- a/src/vs/workbench/api/common/extHostNotebookDocument.ts +++ b/src/vs/workbench/api/common/extHostNotebookDocument.ts @@ -236,6 +236,7 @@ export class ExtHostNotebookDocument extends Disposable { private readonly _mainThreadBulkEdits: MainThreadBulkEditsShape, private readonly _emitter: INotebookEventEmitter, private readonly _viewType: string, + private readonly _contentOptions: vscode.NotebookDocumentContentOptions, metadata: Required, public readonly uri: URI, private readonly _storagePath: URI | undefined @@ -301,6 +302,7 @@ export class ExtHostNotebookDocument extends Disposable { set languages(value: string[]) { that._trySetLanguages(value); }, get metadata() { return that._metadata; }, set metadata(value: Required) { that._updateMetadata(value); }, + get contentOptions() { return that._contentOptions; } }); } return this._notebook; diff --git a/src/vs/workbench/test/browser/api/extHostNotebook.test.ts b/src/vs/workbench/test/browser/api/extHostNotebook.test.ts index 1bdb68cac39..9b3a4c2ec2a 100644 --- a/src/vs/workbench/test/browser/api/extHostNotebook.test.ts +++ b/src/vs/workbench/test/browser/api/extHostNotebook.test.ts @@ -77,6 +77,7 @@ suite('NotebookCell#Document', function () { cellKind: CellKind.Code, outputs: [], }], + contentOptions: { transientMetadata: {}, transientOutputs: false } }], addedEditors: [{ documentUri: notebookUri, diff --git a/src/vs/workbench/test/browser/api/extHostNotebookConcatDocument.test.ts b/src/vs/workbench/test/browser/api/extHostNotebookConcatDocument.test.ts index e8d91576683..e49a0c930ef 100644 --- a/src/vs/workbench/test/browser/api/extHostNotebookConcatDocument.test.ts +++ b/src/vs/workbench/test/browser/api/extHostNotebookConcatDocument.test.ts @@ -68,6 +68,7 @@ suite('NotebookConcatDocument', function () { cellKind: CellKind.Markdown, outputs: [], }], + contentOptions: { transientOutputs: false, transientMetadata: {} }, versionId: 0 }], addedEditors: [ From 403a6895f401c397933ec5c4f7d89432a33509b6 Mon Sep 17 00:00:00 2001 From: Rachel Macfarlane Date: Thu, 17 Sep 2020 19:39:09 -0700 Subject: [PATCH 0097/1667] #106321, Don't retry token refresh if the response was not ok --- .../microsoft-authentication/src/AADHelper.ts | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/extensions/microsoft-authentication/src/AADHelper.ts b/extensions/microsoft-authentication/src/AADHelper.ts index 7b14ad39c90..0f3ff17b9f8 100644 --- a/extensions/microsoft-authentication/src/AADHelper.ts +++ b/extensions/microsoft-authentication/src/AADHelper.ts @@ -13,8 +13,11 @@ import { v4 as uuid } from 'uuid'; import { keychain } from './keychain'; import Logger from './logger'; import { toBase64UrlEncoding } from './utils'; -import fetch from 'node-fetch'; +import fetch, { Response } from 'node-fetch'; import { sha256 } from './env/node/sha256'; +import * as nls from 'vscode-nls'; + +const localize = nls.loadMessageBundle(); const redirectUrl = 'https://vscode-redirect.azurewebsites.net/'; const loginEndpointUrl = 'https://login.microsoftonline.com/'; @@ -500,16 +503,17 @@ export class AzureActiveDirectoryService { } private async refreshToken(refreshToken: string, scope: string, sessionId: string): Promise { - try { - Logger.info('Refreshing token...'); - const postData = querystring.stringify({ - refresh_token: refreshToken, - client_id: clientId, - grant_type: 'refresh_token', - scope: scope - }); + Logger.info('Refreshing token...'); + const postData = querystring.stringify({ + refresh_token: refreshToken, + client_id: clientId, + grant_type: 'refresh_token', + scope: scope + }); - const result = await fetch(`https://login.microsoftonline.com/${tenant}/oauth2/v2.0/token`, { + let result: Response; + try { + result = await fetch(`https://login.microsoftonline.com/${tenant}/oauth2/v2.0/token`, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', @@ -517,7 +521,12 @@ export class AzureActiveDirectoryService { }, body: postData }); + } catch (e) { + Logger.error('Refreshing token failed'); + throw new Error(REFRESH_NETWORK_FAILURE); + } + try { if (result.ok) { const json = await result.json(); const token = this.getTokenFromResponse(json, scope, sessionId); @@ -525,12 +534,12 @@ export class AzureActiveDirectoryService { Logger.info('Token refresh success'); return token; } else { - Logger.error(`Refreshing token failed: ${result.statusText}`); - throw new Error('Refreshing token failed.'); + throw new Error('Bad request.'); } } catch (e) { - Logger.error('Refreshing token failed'); - throw new Error(REFRESH_NETWORK_FAILURE); + vscode.window.showErrorMessage(localize('signOut', "You have been signed out because reading stored authentication information failed.")); + Logger.error(`Refreshing token failed: ${result.statusText}`); + throw new Error('Refreshing token failed'); } } From 75e55d195fc7ddc764b2b720244fe788bbce39ba Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Thu, 17 Sep 2020 22:42:06 -0700 Subject: [PATCH 0098/1667] debug: update js-debug --- product.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product.json b/product.json index 0daf2d3b35e..278b075336a 100644 --- a/product.json +++ b/product.json @@ -91,7 +91,7 @@ }, { "name": "ms-vscode.js-debug", - "version": "1.49.8", + "version": "1.50.0", "repo": "https://github.com/microsoft/vscode-js-debug", "metadata": { "id": "25629058-ddac-4e17-abba-74678e126c5d", From 8e79cf7d399e71fcacd2986030a68d8c05c2a579 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Fri, 18 Sep 2020 01:02:24 -0500 Subject: [PATCH 0099/1667] Implement generic invokeWithinContext for all editor panes (#104947) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implement generic invokeWithinContext for all editor panes Continues PR #104694 * - Remove "invokeWithinContext" from groups and panes, only expose context key service - Implement this correctly for composite editors - Fix tests * Rename and simplify things * Fix build error * Fix EditorService unit test * Update src/vs/workbench/browser/parts/editor/textDiffEditor.ts Co-authored-by: Benjamin Pasero * 💄 PR #104947 * :lipstick: Co-authored-by: Benjamin Pasero --- .../test/common/mockKeybindingService.ts | 9 ++++ .../browser/parts/editor/editorGroupView.ts | 45 ++++++++++--------- .../browser/parts/editor/editorPane.ts | 6 +++ .../browser/parts/editor/textDiffEditor.ts | 13 ++++++ .../browser/parts/editor/textEditor.ts | 5 +++ .../browser/parts/editor/titleControl.ts | 5 +-- src/vs/workbench/common/editor.ts | 8 +++- .../notebook/browser/notebookEditor.ts | 4 ++ .../notebook/browser/notebookEditorWidget.ts | 26 +++++------ .../browser/commandsQuickAccess.ts | 12 +++-- src/vs/workbench/electron-sandbox/window.ts | 5 ++- .../services/editor/browser/editorService.ts | 22 +-------- .../editor/common/editorGroupsService.ts | 13 +++--- .../services/editor/common/editorService.ts | 7 +-- .../test/browser/editorGroupsService.test.ts | 22 ++++----- .../editor/test/browser/editorService.test.ts | 21 ++++----- .../test/browser/workbenchTestServices.ts | 21 ++++++--- 17 files changed, 132 insertions(+), 112 deletions(-) diff --git a/src/vs/platform/keybinding/test/common/mockKeybindingService.ts b/src/vs/platform/keybinding/test/common/mockKeybindingService.ts index bb987bac3bd..bc03b1feabc 100644 --- a/src/vs/platform/keybinding/test/common/mockKeybindingService.ts +++ b/src/vs/platform/keybinding/test/common/mockKeybindingService.ts @@ -71,6 +71,15 @@ export class MockContextKeyService implements IContextKeyService { } } +export class MockScopableContextKeyService extends MockContextKeyService { + /** + * Don't implement this for all tests since we rarely depend on this behavior and it isn't implemented fully + */ + public createScoped(domNote: HTMLElement): IContextKeyService { + return new MockContextKeyService(); + } +} + export class MockKeybindingService implements IKeybindingService { public _serviceBrand: undefined; diff --git a/src/vs/workbench/browser/parts/editor/editorGroupView.ts b/src/vs/workbench/browser/parts/editor/editorGroupView.ts index 27403a6749a..5ac0ef7a945 100644 --- a/src/vs/workbench/browser/parts/editor/editorGroupView.ts +++ b/src/vs/workbench/browser/parts/editor/editorGroupView.ts @@ -7,7 +7,7 @@ import 'vs/css!./media/editorgroupview'; import { EditorGroup, IEditorOpenOptions, EditorCloseEvent, ISerializedEditorGroup, isSerializedEditorGroup } from 'vs/workbench/common/editor/editorGroup'; import { EditorInput, EditorOptions, GroupIdentifier, SideBySideEditorInput, CloseDirection, IEditorCloseEvent, ActiveEditorDirtyContext, IEditorPane, EditorGroupEditorsCountContext, SaveReason, IEditorPartOptionsChangeEvent, EditorsOrder, IVisibleEditorPane, ActiveEditorStickyContext, ActiveEditorPinnedContext, Deprecated_EditorPinnedContext, Deprecated_EditorDirtyContext } from 'vs/workbench/common/editor'; import { Event, Emitter, Relay } from 'vs/base/common/event'; -import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { Dimension, trackFocus, addDisposableListener, EventType, EventHelper, findParentWithClass, clearNode, isAncestor } from 'vs/base/browser/dom'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; @@ -71,6 +71,11 @@ export class EditorGroupView extends Themable implements IEditorGroupView { //#endregion + /** + * Access to the context key service scoped to this editor group. + */ + readonly scopedContextKeyService: IContextKeyService; + //#region events private readonly _onDidFocus = this._register(new Emitter()); @@ -97,23 +102,22 @@ export class EditorGroupView extends Themable implements IEditorGroupView { //#endregion private readonly _group: EditorGroup; - private _disposed = false; private active: boolean | undefined; private dimension: Dimension | undefined; - private _whenRestored: Promise; + private readonly _whenRestored: Promise; private isRestored = false; - private scopedInstantiationService: IInstantiationService; + private readonly scopedInstantiationService: IInstantiationService; - private titleContainer: HTMLElement; + private readonly titleContainer: HTMLElement; private titleAreaControl: TitleControl; - private progressBar: ProgressBar; + private readonly progressBar: ProgressBar; - private editorContainer: HTMLElement; - private editorControl: EditorControl; + private readonly editorContainer: HTMLElement; + private readonly editorControl: EditorControl; private readonly disposedEditorsWorker = this._register(new RunOnceWorker(editors => this.handleDisposedEditors(editors), 0)); @@ -172,14 +176,14 @@ export class EditorGroupView extends Themable implements IEditorGroupView { this.progressBar.hide(); // Scoped services - const scopedContextKeyService = this._register(this.contextKeyService.createScoped(this.element)); + this.scopedContextKeyService = this._register(this.contextKeyService.createScoped(this.element)); this.scopedInstantiationService = this.instantiationService.createChild(new ServiceCollection( - [IContextKeyService, scopedContextKeyService], + [IContextKeyService, this.scopedContextKeyService], [IEditorProgressService, this._register(new EditorProgressIndicator(this.progressBar, this))] )); // Context keys - this.handleGroupContextKeys(scopedContextKeyService); + this.handleGroupContextKeys(); // Title container this.titleContainer = document.createElement('div'); @@ -216,13 +220,13 @@ export class EditorGroupView extends Themable implements IEditorGroupView { this.registerListeners(); } - private handleGroupContextKeys(contextKeyService: IContextKeyService): void { - const groupActiveEditorDirtyContext = ActiveEditorDirtyContext.bindTo(contextKeyService); - const deprecatedGroupActiveEditorDirtyContext = Deprecated_EditorDirtyContext.bindTo(contextKeyService); - const groupActiveEditorPinnedContext = ActiveEditorPinnedContext.bindTo(contextKeyService); - const deprecatedGroupActiveEditorPinnedContext = Deprecated_EditorPinnedContext.bindTo(contextKeyService); - const groupActiveEditorStickyContext = ActiveEditorStickyContext.bindTo(contextKeyService); - const groupEditorsCountContext = EditorGroupEditorsCountContext.bindTo(contextKeyService); + private handleGroupContextKeys(): void { + const groupActiveEditorDirtyContext = ActiveEditorDirtyContext.bindTo(this.scopedContextKeyService); + const deprecatedGroupActiveEditorDirtyContext = Deprecated_EditorDirtyContext.bindTo(this.scopedContextKeyService); + const groupActiveEditorPinnedContext = ActiveEditorPinnedContext.bindTo(this.scopedContextKeyService); + const deprecatedGroupActiveEditorPinnedContext = Deprecated_EditorPinnedContext.bindTo(this.scopedContextKeyService); + const groupActiveEditorStickyContext = ActiveEditorStickyContext.bindTo(this.scopedContextKeyService); + const groupEditorsCountContext = EditorGroupEditorsCountContext.bindTo(this.scopedContextKeyService); const activeEditorListener = new MutableDisposable(); @@ -700,6 +704,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView { return localize('groupAriaLabel', "Editor Group {0}", this._index + 1); } + private _disposed = false; get disposed(): boolean { return this._disposed; } @@ -869,10 +874,6 @@ export class EditorGroupView extends Themable implements IEditorGroupView { } } - invokeWithinContext(fn: (accessor: ServicesAccessor) => T): T { - return this.scopedInstantiationService.invokeFunction(fn); - } - //#endregion //#region openEditor() diff --git a/src/vs/workbench/browser/parts/editor/editorPane.ts b/src/vs/workbench/browser/parts/editor/editorPane.ts index e5e48349b04..ea8599d49d6 100644 --- a/src/vs/workbench/browser/parts/editor/editorPane.ts +++ b/src/vs/workbench/browser/parts/editor/editorPane.ts @@ -19,6 +19,7 @@ import { MementoObject } from 'vs/workbench/common/memento'; import { joinPath, IExtUri } from 'vs/base/common/resources'; import { indexOfPath } from 'vs/base/common/extpath'; import { IDisposable } from 'vs/base/common/lifecycle'; +import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; /** * The base class of editors in the workbench. Editors register themselves for specific editor inputs. @@ -61,6 +62,11 @@ export abstract class EditorPane extends Composite implements IEditorPane { private _group: IEditorGroup | undefined; get group(): IEditorGroup | undefined { return this._group; } + /** + * Should be overridden by editors that have their own ScopedContextKeyService + */ + get scopedContextKeyService(): IContextKeyService | undefined { return undefined; } + constructor( id: string, telemetryService: ITelemetryService, diff --git a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts index 22f107c6c88..1e67845ff8e 100644 --- a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts +++ b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts @@ -29,6 +29,7 @@ import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editor import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService'; import { CancellationToken } from 'vs/base/common/cancellation'; import { EditorActivation, IEditorOptions } from 'vs/platform/editor/common/editor'; +import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; /** * The text editor that leverages the diff text editor for the editing experience. @@ -40,6 +41,18 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditorPan private diffNavigator: DiffNavigator | undefined; private readonly diffNavigatorDisposables = this._register(new DisposableStore()); + get scopedContextKeyService(): IContextKeyService | undefined { + const control = this.getControl(); + if (!control) { + return undefined; + } + + const originalEditor = control.getOriginalEditor(); + const modifiedEditor = control.getModifiedEditor(); + + return (originalEditor.hasTextFocus() ? originalEditor : modifiedEditor).invokeWithinContext(accessor => accessor.get(IContextKeyService)); + } + constructor( @ITelemetryService telemetryService: ITelemetryService, @IInstantiationService instantiationService: IInstantiationService, diff --git a/src/vs/workbench/browser/parts/editor/textEditor.ts b/src/vs/workbench/browser/parts/editor/textEditor.ts index f420982dd27..81efca9d137 100644 --- a/src/vs/workbench/browser/parts/editor/textEditor.ts +++ b/src/vs/workbench/browser/parts/editor/textEditor.ts @@ -25,6 +25,7 @@ import { CancellationToken } from 'vs/base/common/cancellation'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IExtUri } from 'vs/base/common/resources'; import { MutableDisposable } from 'vs/base/common/lifecycle'; +import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; export interface IEditorConfiguration { editor: object; @@ -51,6 +52,10 @@ export abstract class BaseTextEditor extends EditorPane implements ITextEditorPa protected get instantiationService(): IInstantiationService { return this._instantiationService; } protected set instantiationService(value: IInstantiationService) { this._instantiationService = value; } + get scopedContextKeyService(): IContextKeyService | undefined { + return isCodeEditor(this.editorControl) ? this.editorControl.invokeWithinContext(accessor => accessor.get(IContextKeyService)) : undefined; + } + constructor( id: string, @ITelemetryService telemetryService: ITelemetryService, diff --git a/src/vs/workbench/browser/parts/editor/titleControl.ts b/src/vs/workbench/browser/parts/editor/titleControl.ts index b659deea0de..533965441ba 100644 --- a/src/vs/workbench/browser/parts/editor/titleControl.ts +++ b/src/vs/workbench/browser/parts/editor/titleControl.ts @@ -13,7 +13,7 @@ import { IAction, IRunEvent, WorkbenchActionExecutedEvent, WorkbenchActionExecut import * as arrays from 'vs/base/common/arrays'; import { ResolvedKeybinding } from 'vs/base/common/keyCodes'; import { dispose, DisposableStore } from 'vs/base/common/lifecycle'; -import { getCodeEditor, isCodeEditor } from 'vs/editor/browser/editorBrowser'; +import { isCodeEditor } from 'vs/editor/browser/editorBrowser'; import { localize } from 'vs/nls'; import { createAndFillInActionBarActions, createAndFillInContextMenuActions, MenuEntryActionViewItem, SubmenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem'; import { ExecuteCommandAction, IMenu, IMenuService, MenuId, MenuItemAction, SubmenuItemAction } from 'vs/platform/actions/common/actions'; @@ -237,8 +237,7 @@ export abstract class TitleControl extends Themable { // Editor actions require the editor control to be there, so we retrieve it via service const activeEditorPane = this.group.activeEditorPane; if (activeEditorPane instanceof EditorPane) { - const codeEditor = getCodeEditor(activeEditorPane.getControl()); - const scopedContextKeyService = codeEditor?.invokeWithinContext(accessor => accessor.get(IContextKeyService)) || this.contextKeyService; + const scopedContextKeyService = activeEditorPane.scopedContextKeyService ?? this.contextKeyService; const titleBarMenu = this.menuService.createMenu(MenuId.EditorTitle, scopedContextKeyService); this.editorToolBarMenuDisposables.add(titleBarMenu); this.editorToolBarMenuDisposables.add(titleBarMenu.onDidChange(() => { diff --git a/src/vs/workbench/common/editor.ts b/src/vs/workbench/common/editor.ts index 4cf6492ee2e..29b10b27ac8 100644 --- a/src/vs/workbench/common/editor.ts +++ b/src/vs/workbench/common/editor.ts @@ -11,7 +11,7 @@ import { IDisposable, Disposable, toDisposable } from 'vs/base/common/lifecycle' import { IEditor, IEditorViewState, ScrollType, IDiffEditor } from 'vs/editor/common/editorCommon'; import { IEditorModel, IEditorOptions, ITextEditorOptions, IBaseResourceEditorInput, IResourceEditorInput, EditorActivation, EditorOpenContext, ITextEditorSelection, TextEditorSelectionRevealType } from 'vs/platform/editor/common/editor'; import { IInstantiationService, IConstructorSignature0, ServicesAccessor, BrandedService } from 'vs/platform/instantiation/common/instantiation'; -import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; +import { IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { Registry } from 'vs/platform/registry/common/platform'; import { ITextModel } from 'vs/editor/common/model'; import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService'; @@ -112,6 +112,12 @@ export interface IEditorPane extends IComposite { */ readonly onDidSizeConstraintsChange: Event<{ width: number; height: number; } | undefined>; + /** + * The context key service for this editor. Should be overridden by + * editors that have their own ScopedContextKeyService + */ + readonly scopedContextKeyService: IContextKeyService | undefined; + /** * Returns the underlying control of this editor. Callers need to cast * the control to a specific instance as needed, e.g. by using the diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts index f83de212cdf..d0e14035885 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts @@ -88,6 +88,10 @@ export class NotebookEditor extends EditorPane { return true; } + get scopedContextKeyService(): IContextKeyService | undefined { + return this._widget.value?.scopedContextKeyService; + } + protected createEditor(parent: HTMLElement): void { this._rootElement = DOM.append(parent, DOM.$('.notebook-editor')); diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts index 0888f79455e..8056bfcf63b 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts @@ -229,7 +229,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor readonly isEmbedded: boolean; - private readonly contextKeyService: IContextKeyService; + public readonly scopedContextKeyService: IContextKeyService; private readonly instantiationService: IInstantiationService; constructor( @@ -249,8 +249,8 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor this.isEmbedded = creationOptions.isEmbedded || false; this._overlayContainer = document.createElement('div'); - this.contextKeyService = contextKeyService.createScoped(this._overlayContainer); - this.instantiationService = instantiationService.createChild(new ServiceCollection([IContextKeyService, this.contextKeyService])); + this.scopedContextKeyService = contextKeyService.createScoped(this._overlayContainer); + this.instantiationService = instantiationService.createChild(new ServiceCollection([IContextKeyService, this.scopedContextKeyService])); this._memento = new Memento(NotebookEditorWidget.ID, storageService); this._activeKernelMemento = new Memento(NotebookEditorActiveKernelCache, storageService); @@ -391,15 +391,15 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor this.layoutService.container.appendChild(this._overlayContainer); this._createBody(this._overlayContainer); this._generateFontInfo(); - this._editorFocus = NOTEBOOK_EDITOR_FOCUSED.bindTo(this.contextKeyService); + this._editorFocus = NOTEBOOK_EDITOR_FOCUSED.bindTo(this.scopedContextKeyService); this._isVisible = true; - this._outputFocus = NOTEBOOK_OUTPUT_FOCUSED.bindTo(this.contextKeyService); - this._editorEditable = NOTEBOOK_EDITOR_EDITABLE.bindTo(this.contextKeyService); + this._outputFocus = NOTEBOOK_OUTPUT_FOCUSED.bindTo(this.scopedContextKeyService); + this._editorEditable = NOTEBOOK_EDITOR_EDITABLE.bindTo(this.scopedContextKeyService); this._editorEditable.set(true); - this._editorRunnable = NOTEBOOK_EDITOR_RUNNABLE.bindTo(this.contextKeyService); + this._editorRunnable = NOTEBOOK_EDITOR_RUNNABLE.bindTo(this.scopedContextKeyService); this._editorRunnable.set(true); - this._notebookExecuting = NOTEBOOK_EDITOR_EXECUTING_NOTEBOOK.bindTo(this.contextKeyService); - this._notebookHasMultipleKernels = NOTEBOOK_HAS_MULTIPLE_KERNELS.bindTo(this.contextKeyService); + this._notebookExecuting = NOTEBOOK_EDITOR_EXECUTING_NOTEBOOK.bindTo(this.scopedContextKeyService); + this._notebookHasMultipleKernels = NOTEBOOK_HAS_MULTIPLE_KERNELS.bindTo(this.scopedContextKeyService); this._notebookHasMultipleKernels.set(false); let contributions: INotebookEditorContributionDescription[]; @@ -455,7 +455,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor this._body, this.instantiationService.createInstance(NotebookCellListDelegate), renderers, - this.contextKeyService, + this.scopedContextKeyService, { setRowLineHeight: false, setRowHeight: false, @@ -563,7 +563,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor this.contextMenuService.showContextMenu({ getActions: () => { const result: IAction[] = []; - const menu = this.menuService.createMenu(MenuId.NotebookCellTitle, this.contextKeyService); + const menu = this.menuService.createMenu(MenuId.NotebookCellTitle, this.scopedContextKeyService); const groups = menu.getActions(); menu.dispose(); @@ -642,7 +642,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor } setParentContextKeyService(parentContextKeyService: IContextKeyService): void { - this.contextKeyService.updateParent(parentContextKeyService); + this.scopedContextKeyService.updateParent(parentContextKeyService); } async setModel(textModel: NotebookTextModel, viewState: INotebookEditorViewState | undefined): Promise { @@ -675,7 +675,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor const focused = this._list!.getFocusedElements()[0]; if (focused) { if (!this._cellContextKeyManager) { - this._cellContextKeyManager = this._localStore.add(new CellContextKeyManager(this.contextKeyService, this, textModel, focused as CellViewModel)); + this._cellContextKeyManager = this._localStore.add(new CellContextKeyManager(this.scopedContextKeyService, this, textModel, focused as CellViewModel)); } this._cellContextKeyManager.updateForElement(focused as CellViewModel); diff --git a/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts b/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts index 85b04f7bd17..d24b9139c2a 100644 --- a/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts +++ b/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts @@ -10,7 +10,6 @@ import { IMenuService, MenuId, MenuItemAction, SubmenuItemAction, Action2 } from import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { CancellationToken } from 'vs/base/common/cancellation'; import { timeout } from 'vs/base/common/async'; -import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { DisposableStore, toDisposable, dispose } from 'vs/base/common/lifecycle'; import { AbstractEditorCommandsQuickAccessProvider } from 'vs/editor/contrib/quickAccess/commandsQuickAccess'; import { IEditor } from 'vs/editor/common/editorCommon'; @@ -28,6 +27,7 @@ import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; import { IStorageService } from 'vs/platform/storage/common/storage'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeyMod, KeyCode } from 'vs/base/common/keyCodes'; +import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; export class CommandsQuickAccessProvider extends AbstractEditorCommandsQuickAccessProvider { @@ -59,7 +59,8 @@ export class CommandsQuickAccessProvider extends AbstractEditorCommandsQuickAcce @ICommandService commandService: ICommandService, @ITelemetryService telemetryService: ITelemetryService, @INotificationService notificationService: INotificationService, - @IConfigurationService private readonly configurationService: IConfigurationService + @IConfigurationService private readonly configurationService: IConfigurationService, + @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService ) { super({ showAlias: !Language.isDefaultVariant(), @@ -95,11 +96,8 @@ export class CommandsQuickAccessProvider extends AbstractEditorCommandsQuickAcce private getGlobalCommandPicks(disposables: DisposableStore): ICommandQuickPick[] { const globalCommandPicks: ICommandQuickPick[] = []; - - const globalCommandsMenu = this.editorService.invokeWithinEditorContext(accessor => - this.menuService.createMenu(MenuId.CommandPalette, accessor.get(IContextKeyService)) - ); - + const scopedContextKeyService = this.editorService.activeEditorPane?.scopedContextKeyService || this.editorGroupService.activeGroup.scopedContextKeyService; + const globalCommandsMenu = this.menuService.createMenu(MenuId.CommandPalette, scopedContextKeyService); const globalCommandsMenuActions = globalCommandsMenu.getActions() .reduce((r, [, actions]) => [...r, ...actions], >[]) .filter(action => action instanceof MenuItemAction) as MenuItemAction[]; diff --git a/src/vs/workbench/electron-sandbox/window.ts b/src/vs/workbench/electron-sandbox/window.ts index eed9747c35e..33f4346e7fe 100644 --- a/src/vs/workbench/electron-sandbox/window.ts +++ b/src/vs/workbench/electron-sandbox/window.ts @@ -63,6 +63,7 @@ import { Event } from 'vs/base/common/event'; import { clearAllFontInfos } from 'vs/editor/browser/config/configuration'; import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver'; import { IAddressProvider, IAddress } from 'vs/platform/remote/common/remoteAgentConnection'; +import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; export class NativeWindow extends Disposable { @@ -83,6 +84,7 @@ export class NativeWindow extends Disposable { constructor( @IEditorService private readonly editorService: IEditorService, + @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService, @IConfigurationService private readonly configurationService: IConfigurationService, @ITitleService private readonly titleService: ITitleService, @IWorkbenchThemeService protected themeService: IWorkbenchThemeService, @@ -457,7 +459,8 @@ export class NativeWindow extends Disposable { private doUpdateTouchbarMenu(scheduler: RunOnceScheduler): void { if (!this.touchBarMenu) { - this.touchBarMenu = this.editorService.invokeWithinEditorContext(accessor => this.menuService.createMenu(MenuId.TouchBarContext, accessor.get(IContextKeyService))); + const scopedContextKeyService = this.editorService.activeEditorPane?.scopedContextKeyService || this.editorGroupService.activeGroup.scopedContextKeyService; + this.touchBarMenu = this.menuService.createMenu(MenuId.TouchBarContext, scopedContextKeyService); this.touchBarDisposables.add(this.touchBarMenu); this.touchBarDisposables.add(this.touchBarMenu.onDidChange(() => scheduler.schedule())); } diff --git a/src/vs/workbench/services/editor/browser/editorService.ts b/src/vs/workbench/services/editor/browser/editorService.ts index f77babe9411..9473ea6b91a 100644 --- a/src/vs/workbench/services/editor/browser/editorService.ts +++ b/src/vs/workbench/services/editor/browser/editorService.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as nls from 'vs/nls'; -import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IResourceEditorInput, ITextEditorOptions, IEditorOptions, EditorActivation } from 'vs/platform/editor/common/editor'; import { SideBySideEditor, IEditorInput, IEditorPane, GroupIdentifier, IFileEditorInput, IUntitledTextResourceEditorInput, IResourceDiffEditorInput, IEditorInputFactoryRegistry, Extensions as EditorExtensions, EditorInput, SideBySideEditorInput, IEditorInputWithOptions, isEditorInputWithOptions, EditorOptions, TextEditorOptions, IEditorIdentifier, IEditorCloseEvent, ITextEditorPane, ITextDiffEditorPane, IRevertOptions, SaveReason, EditorsOrder, isTextEditorPane, IWorkbenchEditorConfiguration, toResource, IVisibleEditorPane } from 'vs/workbench/common/editor'; import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput'; @@ -787,24 +787,6 @@ export class EditorService extends Disposable implements EditorServiceImpl { //#endregion - //#region invokeWithinEditorContext() - - invokeWithinEditorContext(fn: (accessor: ServicesAccessor) => T): T { - const activeTextEditorControl = this.activeTextEditorControl; - if (isCodeEditor(activeTextEditorControl)) { - return activeTextEditorControl.invokeWithinContext(fn); - } - - const activeGroup = this.editorGroupService.activeGroup; - if (activeGroup) { - return activeGroup.invokeWithinContext(fn); - } - - return this.instantiationService.invokeFunction(fn); - } - - //#endregion - //#region createEditorInput() private readonly editorInputCache = new ResourceMap(); @@ -1351,8 +1333,6 @@ export class DelegatingEditorService implements IEditorService { overrideOpenEditor(handler: IOpenEditorOverrideHandler): IDisposable { return this.editorService.overrideOpenEditor(handler); } getEditorOverrides(resource: URI, options: IEditorOptions | undefined, group: IEditorGroup | undefined) { return this.editorService.getEditorOverrides(resource, options, group); } - invokeWithinEditorContext(fn: (accessor: ServicesAccessor) => T): T { return this.editorService.invokeWithinEditorContext(fn); } - createEditorInput(input: IResourceEditorInputType): IEditorInput { return this.editorService.createEditorInput(input); } save(editors: IEditorIdentifier | IEditorIdentifier[], options?: ISaveEditorsOptions): Promise { return this.editorService.save(editors, options); } diff --git a/src/vs/workbench/services/editor/common/editorGroupsService.ts b/src/vs/workbench/services/editor/common/editorGroupsService.ts index c2433a8015b..851734c7d2e 100644 --- a/src/vs/workbench/services/editor/common/editorGroupsService.ts +++ b/src/vs/workbench/services/editor/common/editorGroupsService.ts @@ -4,12 +4,13 @@ *--------------------------------------------------------------------------------------------*/ import { Event } from 'vs/base/common/event'; -import { createDecorator, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IEditorInput, IEditorPane, GroupIdentifier, IEditorInputWithOptions, CloseDirection, IEditorPartOptions, IEditorPartOptionsChangeEvent, EditorsOrder, IVisibleEditorPane, IEditorCloseEvent } from 'vs/workbench/common/editor'; import { IEditorOptions, ITextEditorOptions } from 'vs/platform/editor/common/editor'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IDimension } from 'vs/editor/common/editorCommon'; import { IDisposable } from 'vs/base/common/lifecycle'; +import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; export const IEditorGroupsService = createDecorator('editorGroupsService'); @@ -450,6 +451,11 @@ export interface IEditorGroup { */ readonly editors: ReadonlyArray; + /** + * The scoped context key service for this group. + */ + readonly scopedContextKeyService: IContextKeyService; + /** * Get all editors that are currently opened in the group. * @@ -588,9 +594,4 @@ export interface IEditorGroup { * Move keyboard focus into the group. */ focus(): void; - - /** - * Invoke a function in the context of the services of this group. - */ - invokeWithinContext(fn: (accessor: ServicesAccessor) => T): T; } diff --git a/src/vs/workbench/services/editor/common/editorService.ts b/src/vs/workbench/services/editor/common/editorService.ts index acf29c20162..73542a7a14d 100644 --- a/src/vs/workbench/services/editor/common/editorService.ts +++ b/src/vs/workbench/services/editor/common/editorService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IResourceEditorInput, IEditorOptions, ITextEditorOptions } from 'vs/platform/editor/common/editor'; import { IEditorInput, IEditorPane, GroupIdentifier, IEditorInputWithOptions, IUntitledTextResourceEditorInput, IResourceDiffEditorInput, ITextEditorPane, ITextDiffEditorPane, IEditorIdentifier, ISaveOptions, IRevertOptions, EditorsOrder, IVisibleEditorPane, IEditorCloseEvent } from 'vs/workbench/common/editor'; import { Event } from 'vs/base/common/event'; @@ -252,11 +252,6 @@ export interface IEditorService { */ registerCustomEditorViewTypesHandler(source: string, handler: ICustomEditorViewTypesHandler): IDisposable; - /** - * Invoke a function in the context of the services of the active editor. - */ - invokeWithinEditorContext(fn: (accessor: ServicesAccessor) => T): T; - /** * Converts a lightweight input to a workbench editor input. */ diff --git a/src/vs/workbench/services/editor/test/browser/editorGroupsService.test.ts b/src/vs/workbench/services/editor/test/browser/editorGroupsService.test.ts index b74c4cb5358..2f178891264 100644 --- a/src/vs/workbench/services/editor/test/browser/editorGroupsService.test.ts +++ b/src/vs/workbench/services/editor/test/browser/editorGroupsService.test.ts @@ -7,11 +7,11 @@ import * as assert from 'assert'; import { Event } from 'vs/base/common/event'; import { workbenchInstantiationService, registerTestEditor, TestFileEditorInput, TestEditorPart, ITestInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices'; import { GroupDirection, GroupsOrder, MergeGroupMode, GroupOrientation, GroupChangeKind, GroupLocation, OpenEditorContext } from 'vs/workbench/services/editor/common/editorGroupsService'; -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { EditorOptions, CloseDirection, IEditorPartOptions, EditorsOrder } from 'vs/workbench/common/editor'; import { URI } from 'vs/base/common/uri'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; +import { MockScopableContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService'; const TEST_EDITOR_ID = 'MyFileEditorForEditorGroupService'; const TEST_EDITOR_INPUT_ID = 'testEditorInputForEditorGroupService'; @@ -38,7 +38,8 @@ suite('EditorGroupsService', () => { } test('groups basics', async function () { - const [part] = createPart(); + const instantiationService = workbenchInstantiationService({ contextKeyService: instantiationService => instantiationService.createInstance(MockScopableContextKeyService) }); + const [part] = createPart(instantiationService); let activeGroupChangeCounter = 0; const activeGroupChangeListener = part.onDidActiveGroupChange(() => { @@ -161,19 +162,12 @@ suite('EditorGroupsService', () => { assert.equal(mru[0], rightGroup); assert.equal(mru[1], rootGroup); - let rightGroupInstantiator!: IInstantiationService; - part.activeGroup.invokeWithinContext(accessor => { - rightGroupInstantiator = accessor.get(IInstantiationService); - }); + const rightGroupContextKeyService = part.activeGroup.scopedContextKeyService; + const rootGroupContextKeyService = rootGroup.scopedContextKeyService; - let rootGroupInstantiator!: IInstantiationService; - rootGroup.invokeWithinContext(accessor => { - rootGroupInstantiator = accessor.get(IInstantiationService); - }); - - assert.ok(rightGroupInstantiator); - assert.ok(rootGroupInstantiator); - assert.ok(rightGroupInstantiator !== rootGroupInstantiator); + assert.ok(rightGroupContextKeyService); + assert.ok(rootGroupContextKeyService); + assert.ok(rightGroupContextKeyService !== rootGroupContextKeyService); part.removeGroup(rightGroup); assert.equal(groupRemovedCounter, 2); diff --git a/src/vs/workbench/services/editor/test/browser/editorService.test.ts b/src/vs/workbench/services/editor/test/browser/editorService.test.ts index 3f8b9cba412..c315aa1b897 100644 --- a/src/vs/workbench/services/editor/test/browser/editorService.test.ts +++ b/src/vs/workbench/services/editor/test/browser/editorService.test.ts @@ -9,7 +9,7 @@ import { URI } from 'vs/base/common/uri'; import { Event } from 'vs/base/common/event'; import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane'; import { EditorInput, EditorsOrder, SideBySideEditorInput } from 'vs/workbench/common/editor'; -import { workbenchInstantiationService, TestServiceAccessor, registerTestEditor, TestFileEditorInput } from 'vs/workbench/test/browser/workbenchTestServices'; +import { workbenchInstantiationService, TestServiceAccessor, registerTestEditor, TestFileEditorInput, ITestInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices'; import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput'; import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService'; import { EditorService, DelegatingEditorService } from 'vs/workbench/services/editor/browser/editorService'; @@ -29,6 +29,7 @@ import { NullFileSystemProvider } from 'vs/platform/files/test/common/nullFileSy import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput'; import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServices'; import { isLinux } from 'vs/base/common/platform'; +import { MockScopableContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService'; const TEST_EDITOR_ID = 'MyTestEditorForEditorService'; const TEST_EDITOR_INPUT_ID = 'testEditorInputForEditorService'; @@ -54,9 +55,7 @@ suite('EditorService', () => { disposables = []; }); - function createEditorService(): [EditorPart, EditorService, TestServiceAccessor] { - const instantiationService = workbenchInstantiationService(); - + function createEditorService(instantiationService: ITestInstantiationService = workbenchInstantiationService()): [EditorPart, EditorService, TestServiceAccessor] { const part = instantiationService.createInstance(EditorPart); part.create(document.createElement('div')); part.layout(400, 300); @@ -1027,8 +1026,9 @@ suite('EditorService', () => { part.dispose(); }); - test('invokeWithinEditorContext', async function () { - const [part, service] = createEditorService(); + test('activeEditorPane scopedContextKeyService', async function () { + const instantiationService = workbenchInstantiationService({ contextKeyService: instantiationService => instantiationService.createInstance(MockScopableContextKeyService) }); + const [part, service] = createEditorService(instantiationService); const input1 = new TestFileEditorInput(URI.parse('file://resource1'), TEST_EDITOR_INPUT_ID); new TestFileEditorInput(URI.parse('file://resource2'), TEST_EDITOR_INPUT_ID); @@ -1037,12 +1037,9 @@ suite('EditorService', () => { await service.openEditor(input1, { pinned: true }); - let hasAccessor = false; - service.invokeWithinEditorContext(accessor => { - hasAccessor = true; - }); - - assert.ok(hasAccessor); + const editorContextKeyService = service.activeEditorPane?.scopedContextKeyService; + assert.ok(!!editorContextKeyService); + assert.strictEqual(editorContextKeyService, part.activeGroup.activeEditorPane?.scopedContextKeyService); part.dispose(); }); diff --git a/src/vs/workbench/test/browser/workbenchTestServices.ts b/src/vs/workbench/test/browser/workbenchTestServices.ts index 2f5e8dd39b2..77e578e55dc 100644 --- a/src/vs/workbench/test/browser/workbenchTestServices.ts +++ b/src/vs/workbench/test/browser/workbenchTestServices.ts @@ -30,7 +30,7 @@ import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl'; import { IResourceEncoding, ITextFileService, IReadTextFileOptions, ITextFileStreamContent } from 'vs/workbench/services/textfile/common/textfiles'; import { IModeService } from 'vs/editor/common/services/modeService'; import { IHistoryService } from 'vs/workbench/services/history/common/history'; -import { IInstantiationService, ServicesAccessor, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; import { MenuBarVisibility, IWindowOpenable, IOpenWindowOptions, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows'; import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace'; @@ -127,13 +127,14 @@ export interface ITestInstantiationService extends IInstantiationService { export function workbenchInstantiationService(overrides?: { textFileService?: (instantiationService: IInstantiationService) => ITextFileService pathService?: (instantiationService: IInstantiationService) => IPathService, - editorService?: (instantiationService: IInstantiationService) => IEditorService + editorService?: (instantiationService: IInstantiationService) => IEditorService, + contextKeyService?: (instantiationService: IInstantiationService) => IContextKeyService, }): ITestInstantiationService { const instantiationService = new TestInstantiationService(new ServiceCollection([ILifecycleService, new TestLifecycleService()])); instantiationService.stub(IWorkingCopyService, new TestWorkingCopyService()); instantiationService.stub(IEnvironmentService, TestEnvironmentService); - const contextKeyService = instantiationService.createInstance(MockContextKeyService); + const contextKeyService = overrides?.contextKeyService ? overrides.contextKeyService(instantiationService) : instantiationService.createInstance(MockContextKeyService); instantiationService.stub(IContextKeyService, contextKeyService); instantiationService.stub(IProgressService, new TestProgressService()); const workspaceContextService = new TestContextService(TestWorkspace); @@ -633,7 +634,7 @@ export class TestEditorGroupView implements IEditorGroupView { stickEditor(editor?: IEditorInput | undefined): void { } unstickEditor(editor?: IEditorInput | undefined): void { } focus(): void { } - invokeWithinContext(fn: (accessor: ServicesAccessor) => T): T { throw new Error('not implemented'); } + get scopedContextKeyService(): IContextKeyService { throw new Error('not implemented'); } setActive(_isActive: boolean): void { } notifyIndexChanged(_index: number): void { } dispose(): void { } @@ -715,7 +716,6 @@ export class TestEditorService implements EditorServiceImpl { openEditors(_editors: any, _group?: any): Promise { throw new Error('not implemented'); } isOpen(_editor: IEditorInput | IResourceEditorInput): boolean { return false; } replaceEditors(_editors: any, _group: any) { return Promise.resolve(undefined); } - invokeWithinEditorContext(fn: (accessor: ServicesAccessor) => T): T { throw new Error('not implemented'); } createEditorInput(_input: IResourceEditorInput | IUntitledTextResourceEditorInput | IResourceDiffEditorInput): EditorInput { throw new Error('not implemented'); } save(editors: IEditorIdentifier[], options?: ISaveEditorsOptions): Promise { throw new Error('Method not implemented.'); } saveAll(options?: ISaveEditorsOptions): Promise { throw new Error('Method not implemented.'); } @@ -1083,7 +1083,12 @@ export class TestEditorInput extends EditorInput { export function registerTestEditor(id: string, inputs: SyncDescriptor[], factoryInputId?: string): IDisposable { class TestEditor extends EditorPane { - constructor() { super(id, NullTelemetryService, new TestThemeService(), new TestStorageService()); } + private _scopedContextKeyService: IContextKeyService; + + constructor() { + super(id, NullTelemetryService, new TestThemeService(), new TestStorageService()); + this._scopedContextKeyService = new MockContextKeyService(); + } async setInput(input: EditorInput, options: EditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise { super.setInput(input, options, context, token); @@ -1094,6 +1099,10 @@ export function registerTestEditor(id: string, inputs: SyncDescriptor Date: Fri, 18 Sep 2020 09:29:41 +0200 Subject: [PATCH 0100/1667] pinned tabs - change sizing to normal by default --- src/vs/workbench/browser/parts/editor/editor.ts | 2 +- src/vs/workbench/browser/parts/editor/tabsTitleControl.ts | 4 ++-- src/vs/workbench/browser/workbench.contribution.ts | 8 ++++---- src/vs/workbench/common/editor.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/editor.ts b/src/vs/workbench/browser/parts/editor/editor.ts index 6452a712aef..8d335bb6298 100644 --- a/src/vs/workbench/browser/parts/editor/editor.ts +++ b/src/vs/workbench/browser/parts/editor/editor.ts @@ -30,7 +30,7 @@ export const DEFAULT_EDITOR_PART_OPTIONS: IEditorPartOptions = { highlightModifiedTabs: false, tabCloseButton: 'right', tabSizing: 'fit', - pinnedTabSizing: 'shrink', + pinnedTabSizing: 'normal', titleScrollbarSizing: 'default', focusRecentEditorAfterClose: true, showIcons: true, diff --git a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts index e1aefd09281..9223a04e0dd 100644 --- a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts +++ b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts @@ -1055,8 +1055,8 @@ export class TabsTitleControl extends TitleControl { tabContainer.classList.remove('has-icon'); } - ['compact', 'shrink', 'normal'].forEach(option => { - tabContainer.classList.toggle(`sticky-${option}`, isTabSticky && !!options.pinnedTabSizing); + ['normal', 'compact', 'shrink'].forEach(option => { + tabContainer.classList.toggle(`sticky-${option}`, isTabSticky && options.pinnedTabSizing === option); }); // Sticky compact/shrink tabs need a position to remain at their location diff --git a/src/vs/workbench/browser/workbench.contribution.ts b/src/vs/workbench/browser/workbench.contribution.ts index 6f7e0de009b..4fd7297cd59 100644 --- a/src/vs/workbench/browser/workbench.contribution.ts +++ b/src/vs/workbench/browser/workbench.contribution.ts @@ -88,12 +88,12 @@ import { workbenchConfigurationNodeBase } from 'vs/workbench/common/configuratio }, 'workbench.editor.pinnedTabSizing': { 'type': 'string', - 'enum': ['compact', 'shrink', 'normal'], - 'default': 'shrink', + 'enum': ['normal', 'compact', 'shrink'], + 'default': 'normal', 'enumDescriptions': [ + nls.localize('workbench.editor.pinnedTabSizing.normal', "A pinned tab inherits the look of non pinned tabs."), nls.localize('workbench.editor.pinnedTabSizing.compact', "A pinned tab will show in a compact form with only icon or first letter of the editor name."), - nls.localize('workbench.editor.pinnedTabSizing.shrink', "A pinned tab shrinks to a compact fixed size showing parts of the editor name."), - nls.localize('workbench.editor.pinnedTabSizing.normal', "A pinned tab inherits the look of non pinned tabs.") + nls.localize('workbench.editor.pinnedTabSizing.shrink', "A pinned tab shrinks to a compact fixed size showing parts of the editor name.") ], 'markdownDescription': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'pinnedTabSizing' }, "Controls the sizing of pinned editor tabs. Pinned tabs are sorted to the begining of all opened tabs and typically do not close until unpinned. This value is ignored when `#workbench.editor.showTabs#` is `false`.") }, diff --git a/src/vs/workbench/common/editor.ts b/src/vs/workbench/common/editor.ts index 29b10b27ac8..c4da1e0b2e2 100644 --- a/src/vs/workbench/common/editor.ts +++ b/src/vs/workbench/common/editor.ts @@ -1229,7 +1229,7 @@ interface IEditorPartConfiguration { highlightModifiedTabs?: boolean; tabCloseButton?: 'left' | 'right' | 'off'; tabSizing?: 'fit' | 'shrink'; - pinnedTabSizing?: 'compact' | 'shrink' | 'normal'; + pinnedTabSizing?: 'normal' | 'compact' | 'shrink'; titleScrollbarSizing?: 'default' | 'large'; focusRecentEditorAfterClose?: boolean; showIcons?: boolean; From ae6e3bcb4943eeb736afb11f781a17e3fdefd791 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 18 Sep 2020 09:49:32 +0200 Subject: [PATCH 0101/1667] debt - introduce native environment service descriptor --- .../sharedProcess/contrib/languagePackCachedDataCleaner.ts | 4 ++-- .../sharedProcess/contrib/nodeCachedDataCleaner.ts | 4 ++-- .../sharedProcess/contrib/storageDataCleaner.ts | 4 ++-- .../electron-browser/sharedProcess/sharedProcessMain.ts | 4 +++- src/vs/code/electron-main/app.ts | 4 ++-- src/vs/code/electron-main/main.ts | 1 + src/vs/code/electron-main/sharedProcess.ts | 4 ++-- src/vs/code/electron-main/window.ts | 4 ++-- src/vs/code/node/cliProcessMain.ts | 2 ++ src/vs/platform/backup/electron-main/backupMainService.ts | 4 ++-- src/vs/platform/environment/common/environment.ts | 1 + src/vs/platform/issue/electron-main/issueMainService.ts | 4 ++-- src/vs/platform/menubar/electron-main/menubar.ts | 4 ++-- .../platform/native/electron-main/nativeHostMainService.ts | 4 ++-- .../platform/update/electron-main/abstractUpdateService.ts | 4 ++-- .../platform/update/electron-main/updateService.darwin.ts | 4 ++-- src/vs/platform/update/electron-main/updateService.linux.ts | 4 ++-- src/vs/platform/update/electron-main/updateService.snap.ts | 6 +++--- src/vs/platform/update/electron-main/updateService.win32.ts | 4 ++-- src/vs/platform/windows/electron-main/windowsMainService.ts | 4 ++-- .../electron-main/workspacesHistoryMainService.ts | 4 ++-- .../workspaces/electron-main/workspacesMainService.ts | 4 ++-- 22 files changed, 44 insertions(+), 38 deletions(-) diff --git a/src/vs/code/electron-browser/sharedProcess/contrib/languagePackCachedDataCleaner.ts b/src/vs/code/electron-browser/sharedProcess/contrib/languagePackCachedDataCleaner.ts index 38ee201e341..e060bcc6a01 100644 --- a/src/vs/code/electron-browser/sharedProcess/contrib/languagePackCachedDataCleaner.ts +++ b/src/vs/code/electron-browser/sharedProcess/contrib/languagePackCachedDataCleaner.ts @@ -10,7 +10,7 @@ import product from 'vs/platform/product/common/product'; import { Disposable, toDisposable } from 'vs/base/common/lifecycle'; import { onUnexpectedError } from 'vs/base/common/errors'; import { ILogService } from 'vs/platform/log/common/log'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; interface ExtensionEntry { version: string; @@ -32,7 +32,7 @@ interface LanguagePackFile { export class LanguagePackCachedDataCleaner extends Disposable { constructor( - @IEnvironmentService private readonly _environmentService: INativeEnvironmentService, + @INativeEnvironmentService private readonly _environmentService: INativeEnvironmentService, @ILogService private readonly _logService: ILogService ) { super(); diff --git a/src/vs/code/electron-browser/sharedProcess/contrib/nodeCachedDataCleaner.ts b/src/vs/code/electron-browser/sharedProcess/contrib/nodeCachedDataCleaner.ts index f115dbab0a6..319f8254e33 100644 --- a/src/vs/code/electron-browser/sharedProcess/contrib/nodeCachedDataCleaner.ts +++ b/src/vs/code/electron-browser/sharedProcess/contrib/nodeCachedDataCleaner.ts @@ -7,7 +7,7 @@ import { basename, dirname, join } from 'vs/base/common/path'; import { onUnexpectedError } from 'vs/base/common/errors'; import { toDisposable, DisposableStore } from 'vs/base/common/lifecycle'; import { readdir, rimraf, stat } from 'vs/base/node/pfs'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import product from 'vs/platform/product/common/product'; export class NodeCachedDataCleaner { @@ -19,7 +19,7 @@ export class NodeCachedDataCleaner { private readonly _disposables = new DisposableStore(); constructor( - @IEnvironmentService private readonly _environmentService: INativeEnvironmentService + @INativeEnvironmentService private readonly _environmentService: INativeEnvironmentService ) { this._manageCachedDataSoon(); } diff --git a/src/vs/code/electron-browser/sharedProcess/contrib/storageDataCleaner.ts b/src/vs/code/electron-browser/sharedProcess/contrib/storageDataCleaner.ts index e15f9b08aa8..ac8a7fc175c 100644 --- a/src/vs/code/electron-browser/sharedProcess/contrib/storageDataCleaner.ts +++ b/src/vs/code/electron-browser/sharedProcess/contrib/storageDataCleaner.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { join } from 'vs/base/common/path'; import { readdir, readFile, rimraf } from 'vs/base/node/pfs'; import { onUnexpectedError } from 'vs/base/common/errors'; @@ -16,7 +16,7 @@ export class StorageDataCleaner extends Disposable { private static readonly NON_EMPTY_WORKSPACE_ID_LENGTH = 128 / 4; constructor( - @IEnvironmentService private readonly environmentService: INativeEnvironmentService + @INativeEnvironmentService private readonly environmentService: INativeEnvironmentService ) { super(); diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts index f7664e308c3..2d996284c39 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts @@ -10,7 +10,7 @@ import { serve, Server, connect } from 'vs/base/parts/ipc/node/ipc.net'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { NativeParsedArgs } from 'vs/platform/environment/common/argv'; import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; import { ExtensionManagementChannel, ExtensionTipsChannel } from 'vs/platform/extensionManagement/common/extensionManagementIpc'; @@ -148,6 +148,8 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat services.set(IStorageKeysSyncRegistryService, new StorageKeysSyncRegistryChannelClient(mainProcessService.getChannel('storageKeysSyncRegistryService'))); services.set(IEnvironmentService, environmentService); + services.set(INativeEnvironmentService, environmentService); + services.set(IProductService, { _serviceBrand: undefined, ...product }); services.set(ILogService, logService); services.set(IConfigurationService, configurationService); diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index 647b22749d2..e02f90b0f47 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -22,7 +22,7 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { ILogService } from 'vs/platform/log/common/log'; import { IStateService } from 'vs/platform/state/node/state'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IURLService } from 'vs/platform/url/common/url'; import { URLHandlerChannelClient, URLHandlerRouter } from 'vs/platform/url/common/urlIpc'; @@ -92,7 +92,7 @@ export class CodeApplication extends Disposable { private readonly userEnv: IProcessEnvironment, @IInstantiationService private readonly instantiationService: IInstantiationService, @ILogService private readonly logService: ILogService, - @IEnvironmentService private readonly environmentService: INativeEnvironmentService, + @INativeEnvironmentService private readonly environmentService: INativeEnvironmentService, @ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService, @IConfigurationService private readonly configurationService: IConfigurationService, @IStateService private readonly stateService: IStateService diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index 51350c14d7a..ecbd3ad0b38 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -152,6 +152,7 @@ class CodeMain { const environmentService = new EnvironmentService(args); const instanceEnvironment = this.patchEnvironment(environmentService); // Patch `process.env` with the instance's environment services.set(IEnvironmentService, environmentService); + services.set(INativeEnvironmentService, environmentService); const logService = new MultiplexLogService([new ConsoleLogMainService(getLogLevel(environmentService)), bufferLogService]); process.once('exit', () => logService.dispose()); diff --git a/src/vs/code/electron-main/sharedProcess.ts b/src/vs/code/electron-main/sharedProcess.ts index 86ebb7ff932..9b7a12ac060 100644 --- a/src/vs/code/electron-main/sharedProcess.ts +++ b/src/vs/code/electron-main/sharedProcess.ts @@ -5,7 +5,7 @@ import { URI } from 'vs/base/common/uri'; import { memoize } from 'vs/base/common/decorators'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { BrowserWindow, ipcMain, WebContents, Event as ElectronEvent } from 'electron'; import { ISharedProcess } from 'vs/platform/ipc/electron-main/sharedProcessMainService'; import { Barrier } from 'vs/base/common/async'; @@ -26,7 +26,7 @@ export class SharedProcess implements ISharedProcess { constructor( private readonly machineId: string, private userEnv: NodeJS.ProcessEnv, - @IEnvironmentService private readonly environmentService: INativeEnvironmentService, + @INativeEnvironmentService private readonly environmentService: INativeEnvironmentService, @ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService, @ILogService private readonly logService: ILogService, @IThemeMainService private readonly themeMainService: IThemeMainService diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index ebdfca8fe69..5403dc9667b 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -9,7 +9,7 @@ import * as nls from 'vs/nls'; import { Emitter } from 'vs/base/common/event'; import { URI } from 'vs/base/common/uri'; import { screen, BrowserWindow, systemPreferences, app, TouchBar, nativeImage, Rectangle, Display, TouchBarSegmentedControl, NativeImage, BrowserWindowConstructorOptions, SegmentedControlSegment, nativeTheme, Event, Details } from 'electron'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { ILogService } from 'vs/platform/log/common/log'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv'; @@ -125,7 +125,7 @@ export class CodeWindow extends Disposable implements ICodeWindow { constructor( config: IWindowCreationOptions, @ILogService private readonly logService: ILogService, - @IEnvironmentService private readonly environmentService: INativeEnvironmentService, + @INativeEnvironmentService private readonly environmentService: INativeEnvironmentService, @IFileService private readonly fileService: IFileService, @IStorageMainService private readonly storageService: IStorageMainService, @IConfigurationService private readonly configurationService: IConfigurationService, diff --git a/src/vs/code/node/cliProcessMain.ts b/src/vs/code/node/cliProcessMain.ts index a3928092c23..ddd97ea8d85 100644 --- a/src/vs/code/node/cliProcessMain.ts +++ b/src/vs/code/node/cliProcessMain.ts @@ -321,6 +321,8 @@ export async function main(argv: NativeParsedArgs): Promise { await configurationService.initialize(); services.set(IEnvironmentService, environmentService); + services.set(INativeEnvironmentService, environmentService); + services.set(ILogService, logService); services.set(IConfigurationService, configurationService); services.set(IStateService, new SyncDescriptor(StateService)); diff --git a/src/vs/platform/backup/electron-main/backupMainService.ts b/src/vs/platform/backup/electron-main/backupMainService.ts index 98467412ab0..7ec91776da3 100644 --- a/src/vs/platform/backup/electron-main/backupMainService.ts +++ b/src/vs/platform/backup/electron-main/backupMainService.ts @@ -10,7 +10,7 @@ import * as platform from 'vs/base/common/platform'; import { writeFileSync, writeFile, readFile, readdir, exists, rimraf, rename, RimRafMode } from 'vs/base/node/pfs'; import { IBackupMainService, IWorkspaceBackupInfo, isWorkspaceBackupInfo } from 'vs/platform/backup/electron-main/backup'; import { IBackupWorkspacesFormat, IEmptyWindowBackupInfo } from 'vs/platform/backup/node/backup'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IFilesConfiguration, HotExitConfiguration } from 'vs/platform/files/common/files'; import { ILogService } from 'vs/platform/log/common/log'; @@ -38,7 +38,7 @@ export class BackupMainService implements IBackupMainService { private readonly backupPathComparer = { isEqual: (pathA: string, pathB: string) => isEqual(pathA, pathB, !platform.isLinux) }; constructor( - @IEnvironmentService environmentService: INativeEnvironmentService, + @INativeEnvironmentService environmentService: INativeEnvironmentService, @IConfigurationService private readonly configurationService: IConfigurationService, @ILogService private readonly logService: ILogService ) { diff --git a/src/vs/platform/environment/common/environment.ts b/src/vs/platform/environment/common/environment.ts index ff73b827084..60472d4e19a 100644 --- a/src/vs/platform/environment/common/environment.ts +++ b/src/vs/platform/environment/common/environment.ts @@ -8,6 +8,7 @@ import { URI } from 'vs/base/common/uri'; import { NativeParsedArgs } from 'vs/platform/environment/common/argv'; export const IEnvironmentService = createDecorator('environmentService'); +export const INativeEnvironmentService = createDecorator('nativeEnvironmentService'); export interface IDebugParams { port: number | null; diff --git a/src/vs/platform/issue/electron-main/issueMainService.ts b/src/vs/platform/issue/electron-main/issueMainService.ts index 8a447859fb0..eb7da71418a 100644 --- a/src/vs/platform/issue/electron-main/issueMainService.ts +++ b/src/vs/platform/issue/electron-main/issueMainService.ts @@ -12,7 +12,7 @@ import { BrowserWindow, ipcMain, screen, IpcMainEvent, Display, shell } from 'el import { ILaunchMainService } from 'vs/platform/launch/electron-main/launchMainService'; import { PerformanceInfo, isRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics'; import { IDiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { isMacintosh, IProcessEnvironment } from 'vs/base/common/platform'; import { ILogService } from 'vs/platform/log/common/log'; import { IWindowState } from 'vs/platform/windows/electron-main/windows'; @@ -38,7 +38,7 @@ export class IssueMainService implements ICommonIssueService { constructor( private machineId: string, private userEnv: IProcessEnvironment, - @IEnvironmentService private readonly environmentService: INativeEnvironmentService, + @INativeEnvironmentService private readonly environmentService: INativeEnvironmentService, @ILaunchMainService private readonly launchMainService: ILaunchMainService, @ILogService private readonly logService: ILogService, @IDiagnosticsService private readonly diagnosticsService: IDiagnosticsService, diff --git a/src/vs/platform/menubar/electron-main/menubar.ts b/src/vs/platform/menubar/electron-main/menubar.ts index e83ada7a5ac..1bec83c2d55 100644 --- a/src/vs/platform/menubar/electron-main/menubar.ts +++ b/src/vs/platform/menubar/electron-main/menubar.ts @@ -5,7 +5,7 @@ import * as nls from 'vs/nls'; import { isMacintosh, language } from 'vs/base/common/platform'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { app, shell, Menu, MenuItem, BrowserWindow, MenuItemConstructorOptions, WebContents, Event, KeyboardEvent } from 'electron'; import { getTitleBarStyle, INativeRunActionInWindowRequest, INativeRunKeybindingInWindowRequest, IWindowOpenable } from 'vs/platform/windows/common/windows'; import { OpenContext } from 'vs/platform/windows/node/window'; @@ -67,7 +67,7 @@ export class Menubar { @IUpdateService private readonly updateService: IUpdateService, @IConfigurationService private readonly configurationService: IConfigurationService, @IWindowsMainService private readonly windowsMainService: IWindowsMainService, - @IEnvironmentService private readonly environmentService: INativeEnvironmentService, + @INativeEnvironmentService private readonly environmentService: INativeEnvironmentService, @ITelemetryService private readonly telemetryService: ITelemetryService, @IWorkspacesHistoryMainService private readonly workspacesHistoryMainService: IWorkspacesHistoryMainService, @IStateService private readonly stateService: IStateService, diff --git a/src/vs/platform/native/electron-main/nativeHostMainService.ts b/src/vs/platform/native/electron-main/nativeHostMainService.ts index a292f57a80b..fbe0e31ada4 100644 --- a/src/vs/platform/native/electron-main/nativeHostMainService.ts +++ b/src/vs/platform/native/electron-main/nativeHostMainService.ts @@ -13,7 +13,7 @@ import { INativeOpenDialogOptions } from 'vs/platform/dialogs/common/dialogs'; import { isMacintosh, isWindows, isRootUser } from 'vs/base/common/platform'; import { ICommonNativeHostService, IOSProperties, IOSStatistics } from 'vs/platform/native/common/native'; import { ISerializableCommandAction } from 'vs/platform/actions/common/actions'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { AddFirstParameterToFunctions } from 'vs/base/common/types'; import { IDialogMainService } from 'vs/platform/dialogs/electron-main/dialogs'; import { dirExists } from 'vs/base/node/pfs'; @@ -37,7 +37,7 @@ export class NativeHostMainService implements INativeHostMainService { @IWindowsMainService private readonly windowsMainService: IWindowsMainService, @IDialogMainService private readonly dialogMainService: IDialogMainService, @ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService, - @IEnvironmentService private readonly environmentService: INativeEnvironmentService, + @INativeEnvironmentService private readonly environmentService: INativeEnvironmentService, @ITelemetryService private readonly telemetryService: ITelemetryService ) { this.registerListeners(); diff --git a/src/vs/platform/update/electron-main/abstractUpdateService.ts b/src/vs/platform/update/electron-main/abstractUpdateService.ts index 8677fb052a7..1c57c2ce027 100644 --- a/src/vs/platform/update/electron-main/abstractUpdateService.ts +++ b/src/vs/platform/update/electron-main/abstractUpdateService.ts @@ -9,7 +9,7 @@ import { IConfigurationService, getMigratedSettingValue } from 'vs/platform/conf import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService'; import product from 'vs/platform/product/common/product'; import { IUpdateService, State, StateType, AvailableForDownload, UpdateType } from 'vs/platform/update/common/update'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { ILogService } from 'vs/platform/log/common/log'; import { IRequestService } from 'vs/platform/request/common/request'; import { CancellationToken } from 'vs/base/common/cancellation'; @@ -46,7 +46,7 @@ export abstract class AbstractUpdateService implements IUpdateService { constructor( @ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService, @IConfigurationService protected configurationService: IConfigurationService, - @IEnvironmentService private readonly environmentService: INativeEnvironmentService, + @INativeEnvironmentService private readonly environmentService: INativeEnvironmentService, @IRequestService protected requestService: IRequestService, @ILogService protected logService: ILogService, ) { } diff --git a/src/vs/platform/update/electron-main/updateService.darwin.ts b/src/vs/platform/update/electron-main/updateService.darwin.ts index e0e02c3f344..e8a43fef02d 100644 --- a/src/vs/platform/update/electron-main/updateService.darwin.ts +++ b/src/vs/platform/update/electron-main/updateService.darwin.ts @@ -11,7 +11,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService'; import { State, IUpdate, StateType, UpdateType } from 'vs/platform/update/common/update'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { ILogService } from 'vs/platform/log/common/log'; import { AbstractUpdateService, createUpdateURL, UpdateNotAvailableClassification } from 'vs/platform/update/electron-main/abstractUpdateService'; import { IRequestService } from 'vs/platform/request/common/request'; @@ -31,7 +31,7 @@ export class DarwinUpdateService extends AbstractUpdateService { @ILifecycleMainService lifecycleMainService: ILifecycleMainService, @IConfigurationService configurationService: IConfigurationService, @ITelemetryService private readonly telemetryService: ITelemetryService, - @IEnvironmentService environmentService: INativeEnvironmentService, + @INativeEnvironmentService environmentService: INativeEnvironmentService, @IRequestService requestService: IRequestService, @ILogService logService: ILogService ) { diff --git a/src/vs/platform/update/electron-main/updateService.linux.ts b/src/vs/platform/update/electron-main/updateService.linux.ts index c03e1fbecc9..236aa3f40db 100644 --- a/src/vs/platform/update/electron-main/updateService.linux.ts +++ b/src/vs/platform/update/electron-main/updateService.linux.ts @@ -8,7 +8,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService'; import { State, IUpdate, AvailableForDownload, UpdateType } from 'vs/platform/update/common/update'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { ILogService } from 'vs/platform/log/common/log'; import { createUpdateURL, AbstractUpdateService, UpdateNotAvailableClassification } from 'vs/platform/update/electron-main/abstractUpdateService'; import { IRequestService, asJson } from 'vs/platform/request/common/request'; @@ -23,7 +23,7 @@ export class LinuxUpdateService extends AbstractUpdateService { @ILifecycleMainService lifecycleMainService: ILifecycleMainService, @IConfigurationService configurationService: IConfigurationService, @ITelemetryService private readonly telemetryService: ITelemetryService, - @IEnvironmentService environmentService: INativeEnvironmentService, + @INativeEnvironmentService environmentService: INativeEnvironmentService, @IRequestService requestService: IRequestService, @ILogService logService: ILogService ) { diff --git a/src/vs/platform/update/electron-main/updateService.snap.ts b/src/vs/platform/update/electron-main/updateService.snap.ts index 38a3c80baae..fe1fd23099f 100644 --- a/src/vs/platform/update/electron-main/updateService.snap.ts +++ b/src/vs/platform/update/electron-main/updateService.snap.ts @@ -7,7 +7,7 @@ import { Event, Emitter } from 'vs/base/common/event'; import { timeout } from 'vs/base/common/async'; import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService'; import { IUpdateService, State, StateType, AvailableForDownload, UpdateType } from 'vs/platform/update/common/update'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { ILogService } from 'vs/platform/log/common/log'; import * as path from 'vs/base/common/path'; import { realpath, watch } from 'fs'; @@ -36,7 +36,7 @@ abstract class AbstractUpdateService2 implements IUpdateService { constructor( @ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService, - @IEnvironmentService environmentService: INativeEnvironmentService, + @INativeEnvironmentService environmentService: INativeEnvironmentService, @ILogService protected logService: ILogService, ) { if (environmentService.disableUpdates) { @@ -140,7 +140,7 @@ export class SnapUpdateService extends AbstractUpdateService2 { private snap: string, private snapRevision: string, @ILifecycleMainService lifecycleMainService: ILifecycleMainService, - @IEnvironmentService environmentService: INativeEnvironmentService, + @INativeEnvironmentService environmentService: INativeEnvironmentService, @ILogService logService: ILogService, @ITelemetryService private readonly telemetryService: ITelemetryService ) { diff --git a/src/vs/platform/update/electron-main/updateService.win32.ts b/src/vs/platform/update/electron-main/updateService.win32.ts index 3505dc06e68..a0fad1214c8 100644 --- a/src/vs/platform/update/electron-main/updateService.win32.ts +++ b/src/vs/platform/update/electron-main/updateService.win32.ts @@ -12,7 +12,7 @@ import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifec import product from 'vs/platform/product/common/product'; import { State, IUpdate, StateType, AvailableForDownload, UpdateType } from 'vs/platform/update/common/update'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { ILogService } from 'vs/platform/log/common/log'; import { createUpdateURL, AbstractUpdateService, UpdateNotAvailableClassification } from 'vs/platform/update/electron-main/abstractUpdateService'; import { IRequestService, asJson } from 'vs/platform/request/common/request'; @@ -63,7 +63,7 @@ export class Win32UpdateService extends AbstractUpdateService { @ILifecycleMainService lifecycleMainService: ILifecycleMainService, @IConfigurationService configurationService: IConfigurationService, @ITelemetryService private readonly telemetryService: ITelemetryService, - @IEnvironmentService environmentService: INativeEnvironmentService, + @INativeEnvironmentService environmentService: INativeEnvironmentService, @IRequestService requestService: IRequestService, @ILogService logService: ILogService, @IFileService private readonly fileService: IFileService diff --git a/src/vs/platform/windows/electron-main/windowsMainService.ts b/src/vs/platform/windows/electron-main/windowsMainService.ts index f58a2c7b7b5..4699064afc9 100644 --- a/src/vs/platform/windows/electron-main/windowsMainService.ts +++ b/src/vs/platform/windows/electron-main/windowsMainService.ts @@ -10,7 +10,7 @@ import * as arrays from 'vs/base/common/arrays'; import { mixin } from 'vs/base/common/objects'; import { IBackupMainService } from 'vs/platform/backup/electron-main/backup'; import { IEmptyWindowBackupInfo } from 'vs/platform/backup/node/backup'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { NativeParsedArgs } from 'vs/platform/environment/common/argv'; import { IStateService } from 'vs/platform/state/node/state'; import { CodeWindow, defaultWindowState } from 'vs/code/electron-main/window'; @@ -174,7 +174,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic private readonly initialUserEnv: IProcessEnvironment, @ILogService private readonly logService: ILogService, @IStateService private readonly stateService: IStateService, - @IEnvironmentService private readonly environmentService: INativeEnvironmentService, + @INativeEnvironmentService private readonly environmentService: INativeEnvironmentService, @ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService, @IBackupMainService private readonly backupMainService: IBackupMainService, @IConfigurationService private readonly configurationService: IConfigurationService, diff --git a/src/vs/platform/workspaces/electron-main/workspacesHistoryMainService.ts b/src/vs/platform/workspaces/electron-main/workspacesHistoryMainService.ts index e5cbe9a8def..4a9094f80dd 100644 --- a/src/vs/platform/workspaces/electron-main/workspacesHistoryMainService.ts +++ b/src/vs/platform/workspaces/electron-main/workspacesHistoryMainService.ts @@ -17,7 +17,7 @@ import { ThrottledDelayer } from 'vs/base/common/async'; import { isEqual, dirname, originalFSPath, basename, extUriBiasedIgnorePathCase } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; import { Schemas } from 'vs/base/common/network'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { exists } from 'vs/base/node/pfs'; import { ILifecycleMainService, LifecycleMainPhase } from 'vs/platform/lifecycle/electron-main/lifecycleMainService'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; @@ -66,7 +66,7 @@ export class WorkspacesHistoryMainService extends Disposable implements IWorkspa @IStateService private readonly stateService: IStateService, @ILogService private readonly logService: ILogService, @IWorkspacesMainService private readonly workspacesMainService: IWorkspacesMainService, - @IEnvironmentService private readonly environmentService: INativeEnvironmentService, + @INativeEnvironmentService private readonly environmentService: INativeEnvironmentService, @ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService ) { super(); diff --git a/src/vs/platform/workspaces/electron-main/workspacesMainService.ts b/src/vs/platform/workspaces/electron-main/workspacesMainService.ts index 72411c7dc69..fdad65d7d41 100644 --- a/src/vs/platform/workspaces/electron-main/workspacesMainService.ts +++ b/src/vs/platform/workspaces/electron-main/workspacesMainService.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { IWorkspaceIdentifier, hasWorkspaceFileExtension, UNTITLED_WORKSPACE_NAME, IResolvedWorkspace, IStoredWorkspaceFolder, isStoredWorkspaceFolder, IWorkspaceFolderCreationData, IUntitledWorkspaceInfo, getStoredWorkspaceFolder, IEnterWorkspaceResult, isUntitledWorkspace } from 'vs/platform/workspaces/common/workspaces'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { join, dirname } from 'vs/base/common/path'; import { mkdirp, writeFile, rimrafSync, readdirSync, writeFileSync } from 'vs/base/node/pfs'; import { readFileSync, existsSync, mkdirSync } from 'fs'; @@ -75,7 +75,7 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain readonly onWorkspaceEntered: Event = this._onWorkspaceEntered.event; constructor( - @IEnvironmentService private readonly environmentService: INativeEnvironmentService, + @IEnvironmentService private readonly environmentService: IEnvironmentService, @ILogService private readonly logService: ILogService, @IBackupMainService private readonly backupMainService: IBackupMainService, @IDialogMainService private readonly dialogMainService: IDialogMainService From a60bbd1f0d0c7b53ef911ad01033c1e5fd2b15e8 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 18 Sep 2020 09:51:08 +0200 Subject: [PATCH 0102/1667] environmentService => nativeEnvironmentService --- .../code/electron-browser/sharedProcess/sharedProcessMain.ts | 4 ++-- src/vs/code/electron-main/main.ts | 4 ++-- src/vs/code/node/cliProcessMain.ts | 4 ++-- .../backup/test/electron-main/backupMainService.test.ts | 4 ++-- src/vs/platform/environment/node/environmentService.ts | 2 +- .../test/node/extensionGalleryService.test.ts | 4 ++-- src/vs/platform/storage/test/node/storageService.test.ts | 4 ++-- .../test/electron-main/workspacesMainService.test.ts | 4 ++-- .../environment/electron-browser/environmentService.ts | 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts index 2d996284c39..e71a0ace313 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts @@ -12,7 +12,7 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { NativeParsedArgs } from 'vs/platform/environment/common/argv'; -import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; +import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; import { ExtensionManagementChannel, ExtensionTipsChannel } from 'vs/platform/extensionManagement/common/extensionManagementIpc'; import { IExtensionManagementService, IExtensionGalleryService, IGlobalExtensionEnablementService, IExtensionTipsService } from 'vs/platform/extensionManagement/common/extensionManagement'; import { ExtensionManagementService } from 'vs/platform/extensionManagement/node/extensionManagementService'; @@ -115,7 +115,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat disposables.add(server); - const environmentService = new EnvironmentService(initData.args); + const environmentService = new NativeEnvironmentService(initData.args); const mainRouter = new StaticRouter(ctx => ctx === 'main'); const loggerClient = new LoggerChannelClient(server.getChannel('logger', mainRouter)); diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index ecbd3ad0b38..c0729b964ed 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -24,7 +24,7 @@ import { StateService } from 'vs/platform/state/node/stateService'; import { IStateService } from 'vs/platform/state/node/state'; import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { NativeParsedArgs } from 'vs/platform/environment/common/argv'; -import { EnvironmentService, xdgRuntimeDir } from 'vs/platform/environment/node/environmentService'; +import { NativeEnvironmentService, xdgRuntimeDir } from 'vs/platform/environment/node/environmentService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ConfigurationService } from 'vs/platform/configuration/common/configurationService'; import { IRequestService } from 'vs/platform/request/common/request'; @@ -149,7 +149,7 @@ class CodeMain { private createServices(args: NativeParsedArgs, bufferLogService: BufferLogService): [IInstantiationService, IProcessEnvironment, INativeEnvironmentService] { const services = new ServiceCollection(); - const environmentService = new EnvironmentService(args); + const environmentService = new NativeEnvironmentService(args); const instanceEnvironment = this.patchEnvironment(environmentService); // Patch `process.env` with the instance's environment services.set(IEnvironmentService, environmentService); services.set(INativeEnvironmentService, environmentService); diff --git a/src/vs/code/node/cliProcessMain.ts b/src/vs/code/node/cliProcessMain.ts index ddd97ea8d85..9d101e8ca3c 100644 --- a/src/vs/code/node/cliProcessMain.ts +++ b/src/vs/code/node/cliProcessMain.ts @@ -13,7 +13,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { NativeParsedArgs } from 'vs/platform/environment/common/argv'; -import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; +import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; import { IExtensionManagementService, IExtensionGalleryService, IGalleryExtension, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement'; import { ExtensionManagementService } from 'vs/platform/extensionManagement/node/extensionManagementService'; import { ExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionGalleryService'; @@ -299,7 +299,7 @@ export async function main(argv: NativeParsedArgs): Promise { const services = new ServiceCollection(); const disposables = new DisposableStore(); - const environmentService = new EnvironmentService(argv); + const environmentService = new NativeEnvironmentService(argv); const logService: ILogService = new SpdLogService('cli', environmentService.logsPath, getLogLevel(environmentService)); process.once('exit', () => logService.dispose()); logService.info('main', argv); diff --git a/src/vs/platform/backup/test/electron-main/backupMainService.test.ts b/src/vs/platform/backup/test/electron-main/backupMainService.test.ts index c03aba9ede0..bfe03bb8bea 100644 --- a/src/vs/platform/backup/test/electron-main/backupMainService.test.ts +++ b/src/vs/platform/backup/test/electron-main/backupMainService.test.ts @@ -10,7 +10,7 @@ import * as os from 'os'; import * as path from 'vs/base/common/path'; import * as pfs from 'vs/base/node/pfs'; import { URI } from 'vs/base/common/uri'; -import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; +import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv'; import { BackupMainService } from 'vs/platform/backup/electron-main/backupMainService'; import { IWorkspaceBackupInfo } from 'vs/platform/backup/electron-main/backup'; @@ -34,7 +34,7 @@ suite('BackupMainService', () => { const backupHome = path.join(parentDir, 'Backups'); const backupWorkspacesPath = path.join(backupHome, 'workspaces.json'); - const environmentService = new EnvironmentService(parseArgs(process.argv, OPTIONS)); + const environmentService = new NativeEnvironmentService(parseArgs(process.argv, OPTIONS)); class TestBackupMainService extends BackupMainService { diff --git a/src/vs/platform/environment/node/environmentService.ts b/src/vs/platform/environment/node/environmentService.ts index 6357bb6e89d..84a4bead69b 100644 --- a/src/vs/platform/environment/node/environmentService.ts +++ b/src/vs/platform/environment/node/environmentService.ts @@ -17,7 +17,7 @@ import { isWindows, Platform, platform } from 'vs/base/common/platform'; import { getPathFromAmdModule } from 'vs/base/common/amd'; import { URI } from 'vs/base/common/uri'; -export class EnvironmentService implements INativeEnvironmentService { +export class NativeEnvironmentService implements INativeEnvironmentService { declare readonly _serviceBrand: undefined; diff --git a/src/vs/platform/extensionManagement/test/node/extensionGalleryService.test.ts b/src/vs/platform/extensionManagement/test/node/extensionGalleryService.test.ts index 964913233d0..e2a7ed43a35 100644 --- a/src/vs/platform/extensionManagement/test/node/extensionGalleryService.test.ts +++ b/src/vs/platform/extensionManagement/test/node/extensionGalleryService.test.ts @@ -5,7 +5,7 @@ import * as assert from 'assert'; import * as os from 'os'; -import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; +import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv'; import { getRandomTestPath } from 'vs/base/test/node/testUtils'; import { join } from 'vs/base/common/path'; @@ -53,7 +53,7 @@ suite('Extension Gallery Service', () => { test('marketplace machine id', () => { const args = ['--user-data-dir', marketplaceHome]; - const environmentService = new EnvironmentService(parseArgs(args, OPTIONS)); + const environmentService = new NativeEnvironmentService(parseArgs(args, OPTIONS)); const storageService: IStorageService = new TestStorageService(); return resolveMarketplaceHeaders(product.version, environmentService, fileService, storageService).then(headers => { diff --git a/src/vs/platform/storage/test/node/storageService.test.ts b/src/vs/platform/storage/test/node/storageService.test.ts index db37af25774..41e3394f6e9 100644 --- a/src/vs/platform/storage/test/node/storageService.test.ts +++ b/src/vs/platform/storage/test/node/storageService.test.ts @@ -11,7 +11,7 @@ import { join } from 'vs/base/common/path'; import { tmpdir } from 'os'; import { mkdirp, rimraf, RimRafMode } from 'vs/base/node/pfs'; import { NullLogService } from 'vs/platform/log/common/log'; -import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; +import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv'; import { InMemoryStorageDatabase } from 'vs/base/parts/storage/common/storage'; import { URI } from 'vs/base/common/uri'; @@ -84,7 +84,7 @@ suite('StorageService', () => { } test('Migrate Data', async () => { - class StorageTestEnvironmentService extends EnvironmentService { + class StorageTestEnvironmentService extends NativeEnvironmentService { constructor(private workspaceStorageFolderPath: URI, private _extensionsPath: string) { super(parseArgs(process.argv, OPTIONS)); diff --git a/src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts b/src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts index 1bea8eaa1ce..d2c3a1c06b3 100644 --- a/src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts +++ b/src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts @@ -8,7 +8,7 @@ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'vs/base/common/path'; import * as pfs from 'vs/base/node/pfs'; -import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; +import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv'; import { WorkspacesMainService, IStoredWorkspace } from 'vs/platform/workspaces/electron-main/workspacesMainService'; import { WORKSPACE_EXTENSION, IRawFileWorkspaceFolder, IWorkspaceFolderCreationData, IRawUriWorkspaceFolder, rewriteWorkspaceFileForNewLocation, IWorkspaceIdentifier, IStoredWorkspaceFolder } from 'vs/platform/workspaces/common/workspaces'; @@ -108,7 +108,7 @@ suite('WorkspacesMainService', () => { const parentDir = getRandomTestPath(os.tmpdir(), 'vsctests', 'workspacesservice'); const untitledWorkspacesHomePath = path.join(parentDir, 'Workspaces'); - class TestEnvironmentService extends EnvironmentService { + class TestEnvironmentService extends NativeEnvironmentService { get untitledWorkspacesHome(): URI { return URI.file(untitledWorkspacesHomePath); } diff --git a/src/vs/workbench/services/environment/electron-browser/environmentService.ts b/src/vs/workbench/services/environment/electron-browser/environmentService.ts index 1d35f977a87..59eed90ddd6 100644 --- a/src/vs/workbench/services/environment/electron-browser/environmentService.ts +++ b/src/vs/workbench/services/environment/electron-browser/environmentService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; +import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; import { INativeWorkbenchConfiguration, INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { memoize } from 'vs/base/common/decorators'; import { URI } from 'vs/base/common/uri'; @@ -12,7 +12,7 @@ import { dirname, join } from 'vs/base/common/path'; import { IProductService } from 'vs/platform/product/common/productService'; import { isLinux, isWindows } from 'vs/base/common/platform'; -export class NativeWorkbenchEnvironmentService extends EnvironmentService implements INativeWorkbenchEnvironmentService { +export class NativeWorkbenchEnvironmentService extends NativeEnvironmentService implements INativeWorkbenchEnvironmentService { declare readonly _serviceBrand: undefined; From e5d104b3a8aeb80400361713f735f5665a11d5f5 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Fri, 18 Sep 2020 09:51:32 +0200 Subject: [PATCH 0103/1667] Remote: Disallow saving workspace locally. Fixes #106990 --- .../services/dialogs/browser/abstractFileDialogService.ts | 2 +- .../workspaces/browser/abstractWorkspaceEditingService.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts b/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts index 295af5938e4..269025864aa 100644 --- a/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts +++ b/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts @@ -78,7 +78,7 @@ export abstract class AbstractFileDialogService implements IFileDialogService { // Check for current workspace config file first... if (this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE) { const configuration = this.contextService.getWorkspace().configuration; - if (configuration && !isUntitledWorkspace(configuration, this.environmentService)) { + if (configuration && configuration.scheme === schemeFilter && !isUntitledWorkspace(configuration, this.environmentService)) { return resources.dirname(configuration) || undefined; } } diff --git a/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts b/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts index 479d04fbade..1c504281caa 100644 --- a/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts +++ b/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts @@ -52,7 +52,8 @@ export abstract class AbstractWorkspaceEditingService implements IWorkspaceEditi saveLabel: mnemonicButtonLabel(nls.localize('save', "Save")), title: nls.localize('saveWorkspace', "Save Workspace"), filters: WORKSPACE_FILTER, - defaultUri: this.fileDialogService.defaultWorkspacePath() + defaultUri: this.fileDialogService.defaultWorkspacePath(), + availableFileSystems: this.environmentService.configuration.remoteAuthority ? [Schemas.vscodeRemote] : undefined }); if (!workspacePath) { From 4af670c2041a1e7eb35ca2707693c3943770eb27 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 18 Sep 2020 09:58:43 +0200 Subject: [PATCH 0104/1667] debt - more native environment service adoption --- src/vs/code/node/cliProcessMain.ts | 2 +- .../electron-sandbox/extensionTipsService.ts | 4 ++-- .../extensionManagement/node/extensionDownloader.ts | 4 ++-- .../extensionManagement/node/extensionManagementService.ts | 4 ++-- .../platform/extensionManagement/node/extensionsScanner.ts | 4 ++-- src/vs/platform/localizations/node/localizations.ts | 6 +++--- src/vs/platform/state/node/stateService.ts | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/vs/code/node/cliProcessMain.ts b/src/vs/code/node/cliProcessMain.ts index 9d101e8ca3c..44627409ae8 100644 --- a/src/vs/code/node/cliProcessMain.ts +++ b/src/vs/code/node/cliProcessMain.ts @@ -74,7 +74,7 @@ export class Main { constructor( @IInstantiationService private readonly instantiationService: IInstantiationService, - @IEnvironmentService private readonly environmentService: INativeEnvironmentService, + @INativeEnvironmentService private readonly environmentService: INativeEnvironmentService, @IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService, @IExtensionGalleryService private readonly extensionGalleryService: IExtensionGalleryService ) { } diff --git a/src/vs/platform/extensionManagement/electron-sandbox/extensionTipsService.ts b/src/vs/platform/extensionManagement/electron-sandbox/extensionTipsService.ts index 273704b6081..4366dc4fdfc 100644 --- a/src/vs/platform/extensionManagement/electron-sandbox/extensionTipsService.ts +++ b/src/vs/platform/extensionManagement/electron-sandbox/extensionTipsService.ts @@ -6,7 +6,7 @@ import { URI } from 'vs/base/common/uri'; import { join, } from 'vs/base/common/path'; import { IProductService } from 'vs/platform/product/common/productService'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { process } from 'vs/base/parts/sandbox/electron-sandbox/globals'; import { IFileService } from 'vs/platform/files/common/files'; import { isWindows } from 'vs/base/common/platform'; @@ -31,7 +31,7 @@ export class ExtensionTipsService extends BaseExtensionTipsService { private readonly allOtherExecutableTips: Map = new Map(); constructor( - @IEnvironmentService private readonly environmentService: INativeEnvironmentService, + @INativeEnvironmentService private readonly environmentService: INativeEnvironmentService, @IFileService fileService: IFileService, @IProductService productService: IProductService, @IRequestService requestService: IRequestService, diff --git a/src/vs/platform/extensionManagement/node/extensionDownloader.ts b/src/vs/platform/extensionManagement/node/extensionDownloader.ts index 88f7afdd7ab..84503ccadcf 100644 --- a/src/vs/platform/extensionManagement/node/extensionDownloader.ts +++ b/src/vs/platform/extensionManagement/node/extensionDownloader.ts @@ -6,7 +6,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { IFileService, IFileStatWithMetadata } from 'vs/platform/files/common/files'; import { IExtensionGalleryService, IGalleryExtension, InstallOperation } from 'vs/platform/extensionManagement/common/extensionManagement'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { URI } from 'vs/base/common/uri'; import { joinPath } from 'vs/base/common/resources'; import { ExtensionIdentifierWithVersion, groupByExtension } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; @@ -23,7 +23,7 @@ export class ExtensionsDownloader extends Disposable { private readonly cleanUpPromise: Promise; constructor( - @IEnvironmentService environmentService: INativeEnvironmentService, + @INativeEnvironmentService environmentService: INativeEnvironmentService, @IFileService private readonly fileService: IFileService, @IExtensionGalleryService private readonly extensionGalleryService: IExtensionGalleryService, @ILogService private readonly logService: ILogService, diff --git a/src/vs/platform/extensionManagement/node/extensionManagementService.ts b/src/vs/platform/extensionManagement/node/extensionManagementService.ts index f86feef0789..da3821283f3 100644 --- a/src/vs/platform/extensionManagement/node/extensionManagementService.ts +++ b/src/vs/platform/extensionManagement/node/extensionManagementService.ts @@ -22,7 +22,7 @@ import { ExtensionManagementError } from 'vs/platform/extensionManagement/common/extensionManagement'; import { areSameExtensions, getGalleryExtensionId, getMaliciousExtensionsSet, getGalleryExtensionTelemetryData, getLocalExtensionTelemetryData, ExtensionIdentifierWithVersion } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { createCancelablePromise, CancelablePromise } from 'vs/base/common/async'; import { Event, Emitter } from 'vs/base/common/event'; import * as semver from 'semver-umd'; @@ -83,7 +83,7 @@ export class ExtensionManagementService extends Disposable implements IExtension onDidUninstallExtension: Event = this._onDidUninstallExtension.event; constructor( - @IEnvironmentService private readonly environmentService: INativeEnvironmentService, + @INativeEnvironmentService private readonly environmentService: INativeEnvironmentService, @IExtensionGalleryService private readonly galleryService: IExtensionGalleryService, @ILogService private readonly logService: ILogService, @optional(IDownloadService) private downloadService: IDownloadService, diff --git a/src/vs/platform/extensionManagement/node/extensionsScanner.ts b/src/vs/platform/extensionManagement/node/extensionsScanner.ts index 40218225f3e..a2c840c049b 100644 --- a/src/vs/platform/extensionManagement/node/extensionsScanner.ts +++ b/src/vs/platform/extensionManagement/node/extensionsScanner.ts @@ -13,7 +13,7 @@ import { ExtensionType, IExtensionManifest, IExtensionIdentifier } from 'vs/plat import { areSameExtensions, ExtensionIdentifierWithVersion, groupByExtension, getGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { Limiter, Queue } from 'vs/base/common/async'; import { URI } from 'vs/base/common/uri'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { getPathFromAmdModule } from 'vs/base/common/amd'; import { localizeManifest } from 'vs/platform/extensionManagement/common/extensionNls'; import { localize } from 'vs/nls'; @@ -43,7 +43,7 @@ export class ExtensionsScanner extends Disposable { constructor( private readonly beforeRemovingExtension: (e: ILocalExtension) => Promise, @ILogService private readonly logService: ILogService, - @IEnvironmentService private readonly environmentService: INativeEnvironmentService, + @INativeEnvironmentService private readonly environmentService: INativeEnvironmentService, @IProductService private readonly productService: IProductService, ) { super(); diff --git a/src/vs/platform/localizations/node/localizations.ts b/src/vs/platform/localizations/node/localizations.ts index d42b7909d65..8b0897540a9 100644 --- a/src/vs/platform/localizations/node/localizations.ts +++ b/src/vs/platform/localizations/node/localizations.ts @@ -7,7 +7,7 @@ import * as pfs from 'vs/base/node/pfs'; import { createHash } from 'crypto'; import { IExtensionManagementService, ILocalExtension, IExtensionIdentifier } from 'vs/platform/extensionManagement/common/extensionManagement'; import { Disposable } from 'vs/base/common/lifecycle'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { Queue } from 'vs/base/common/async'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { ILogService } from 'vs/platform/log/common/log'; @@ -37,7 +37,7 @@ export class LocalizationsService extends Disposable implements ILocalizationsSe constructor( @IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService, - @IEnvironmentService environmentService: INativeEnvironmentService, + @INativeEnvironmentService environmentService: INativeEnvironmentService, @ILogService private readonly logService: ILogService ) { super(); @@ -88,7 +88,7 @@ class LanguagePacksCache extends Disposable { private initializedCache: boolean | undefined; constructor( - @IEnvironmentService environmentService: INativeEnvironmentService, + @INativeEnvironmentService environmentService: INativeEnvironmentService, @ILogService private readonly logService: ILogService ) { super(); diff --git a/src/vs/platform/state/node/stateService.ts b/src/vs/platform/state/node/stateService.ts index a11d2fc6981..0def1cf9c62 100644 --- a/src/vs/platform/state/node/stateService.ts +++ b/src/vs/platform/state/node/stateService.ts @@ -5,7 +5,7 @@ import * as path from 'vs/base/common/path'; import * as fs from 'fs'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { writeFileSync, readFile } from 'vs/base/node/pfs'; import { isUndefined, isUndefinedOrNull } from 'vs/base/common/types'; import { IStateService } from 'vs/platform/state/node/state'; @@ -132,7 +132,7 @@ export class StateService implements IStateService { private fileStorage: FileStorage; constructor( - @IEnvironmentService environmentService: INativeEnvironmentService, + @INativeEnvironmentService environmentService: INativeEnvironmentService, @ILogService logService: ILogService ) { this.fileStorage = new FileStorage(path.join(environmentService.userDataPath, StateService.STATE_FILE), error => logService.error(error)); From b38b758032747deea69134185d47a19e22e53005 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 18 Sep 2020 09:58:50 +0200 Subject: [PATCH 0105/1667] :up: distro --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3531114db97..998e7866fea 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.50.0", - "distro": "8d78341175414dcfde7cd493d481064cd4bf96d4", + "distro": "2d37a6f06b11ba2a64023c81eb7f32e271bca756", "author": { "name": "Microsoft Corporation" }, From b83df9da4b8e822a163ffdaa47591dfedcfda401 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 18 Sep 2020 10:24:20 +0200 Subject: [PATCH 0106/1667] :lipstick: --- src/vs/workbench/electron-sandbox/window.ts | 3 +-- .../accessibility/electron-sandbox/accessibilityService.ts | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/electron-sandbox/window.ts b/src/vs/workbench/electron-sandbox/window.ts index 33f4346e7fe..0ce996b5395 100644 --- a/src/vs/workbench/electron-sandbox/window.ts +++ b/src/vs/workbench/electron-sandbox/window.ts @@ -34,7 +34,6 @@ import { isWindows, isMacintosh } from 'vs/base/common/platform'; import { IProductService } from 'vs/platform/product/common/productService'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { IAccessibilityService, AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility'; import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; @@ -596,7 +595,7 @@ class NativeMenubarControl extends MenubarControl { @IStorageService storageService: IStorageService, @INotificationService notificationService: INotificationService, @IPreferencesService preferencesService: IPreferencesService, - @IWorkbenchEnvironmentService protected readonly environmentService: IWorkbenchEnvironmentService, + @INativeWorkbenchEnvironmentService protected readonly environmentService: INativeWorkbenchEnvironmentService, @IAccessibilityService accessibilityService: IAccessibilityService, @IMenubarService private readonly menubarService: IMenubarService, @IHostService hostService: IHostService, diff --git a/src/vs/workbench/services/accessibility/electron-sandbox/accessibilityService.ts b/src/vs/workbench/services/accessibility/electron-sandbox/accessibilityService.ts index 3228a27ed43..3bdc5475c05 100644 --- a/src/vs/workbench/services/accessibility/electron-sandbox/accessibilityService.ts +++ b/src/vs/workbench/services/accessibility/electron-sandbox/accessibilityService.ts @@ -5,7 +5,6 @@ import { IAccessibilityService, AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility'; import { isWindows, isLinux } from 'vs/base/common/platform'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -74,7 +73,7 @@ class LinuxAccessibilityContribution implements IWorkbenchContribution { constructor( @IJSONEditingService jsonEditingService: IJSONEditingService, @IAccessibilityService accessibilityService: IAccessibilityService, - @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService + @INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService ) { const forceRendererAccessibility = () => { if (accessibilityService.isScreenReaderOptimized()) { From 2b83b6ca82cacaf6066ce55ba2e44de1fd9bfc5a Mon Sep 17 00:00:00 2001 From: isidor Date: Fri, 18 Sep 2020 10:34:48 +0200 Subject: [PATCH 0107/1667] fixes #106439 --- .../browser/parts/activitybar/activitybarPart.ts | 12 ++++++------ .../workbench/browser/parts/compositeBarActions.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts index 359db4d5491..688c92ae6ed 100644 --- a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts +++ b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts @@ -472,7 +472,7 @@ export class ActivitybarPart extends Part implements IActivityBarService { if (this.homeBarContainer) { this.keyboardNavigationDisposables.add(addDisposableListener(this.homeBarContainer, EventType.KEY_DOWN, e => { const kbEvent = new StandardKeyboardEvent(e); - if (kbEvent.equals(KeyCode.DownArrow)) { + if (kbEvent.equals(KeyCode.DownArrow) || kbEvent.equals(KeyCode.RightArrow)) { if (this.menuBar) { this.menuBar.toggleFocus(); } else if (this.compositeBar) { @@ -486,11 +486,11 @@ export class ActivitybarPart extends Part implements IActivityBarService { if (this.menuBarContainer) { this.keyboardNavigationDisposables.add(addDisposableListener(this.menuBarContainer, EventType.KEY_DOWN, e => { const kbEvent = new StandardKeyboardEvent(e); - if (kbEvent.equals(KeyCode.DownArrow)) { + if (kbEvent.equals(KeyCode.DownArrow) || kbEvent.equals(KeyCode.RightArrow)) { if (this.compositeBar) { this.compositeBar.focus(); } - } else if (kbEvent.equals(KeyCode.UpArrow)) { + } else if (kbEvent.equals(KeyCode.UpArrow) || kbEvent.equals(KeyCode.LeftArrow)) { if (this.homeBar) { this.homeBar.focus(); } @@ -502,11 +502,11 @@ export class ActivitybarPart extends Part implements IActivityBarService { if (this.compositeBarContainer) { this.keyboardNavigationDisposables.add(addDisposableListener(this.compositeBarContainer, EventType.KEY_DOWN, e => { const kbEvent = new StandardKeyboardEvent(e); - if (kbEvent.equals(KeyCode.DownArrow)) { + if (kbEvent.equals(KeyCode.DownArrow) || kbEvent.equals(KeyCode.RightArrow)) { if (this.globalActivityActionBar) { this.globalActivityActionBar.focus(true); } - } else if (kbEvent.equals(KeyCode.UpArrow)) { + } else if (kbEvent.equals(KeyCode.UpArrow) || kbEvent.equals(KeyCode.LeftArrow)) { if (this.menuBar) { this.menuBar.toggleFocus(); } else if (this.homeBar) { @@ -520,7 +520,7 @@ export class ActivitybarPart extends Part implements IActivityBarService { if (this.globalActivitiesContainer) { this.keyboardNavigationDisposables.add(addDisposableListener(this.globalActivitiesContainer, EventType.KEY_DOWN, e => { const kbEvent = new StandardKeyboardEvent(e); - if (kbEvent.equals(KeyCode.UpArrow)) { + if (kbEvent.equals(KeyCode.UpArrow) || kbEvent.equals(KeyCode.LeftArrow)) { if (this.compositeBar) { this.compositeBar.focus(this.getVisibleViewContainerIds().length - 1); } diff --git a/src/vs/workbench/browser/parts/compositeBarActions.ts b/src/vs/workbench/browser/parts/compositeBarActions.ts index 397964bded1..01a0c16c51b 100644 --- a/src/vs/workbench/browser/parts/compositeBarActions.ts +++ b/src/vs/workbench/browser/parts/compositeBarActions.ts @@ -647,7 +647,7 @@ export class CompositeActionViewItem extends ActivityActionViewItem { protected updateChecked(): void { if (this.getAction().checked) { this.container.classList.add('checked'); - this.container.setAttribute('aria-label', nls.localize('compositeActive', "{0} active", this.container.title)); + this.container.setAttribute('aria-label', this.container.title); this.container.setAttribute('aria-expanded', 'true'); this.container.setAttribute('aria-selected', 'true'); } else { From 8338e6a01337c4d8756f87928b03cfe0af3260ca Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Fri, 18 Sep 2020 10:39:25 +0200 Subject: [PATCH 0108/1667] Fix remaining tildified path in variable resolving Fixes #106988 --- .../browser/configurationResolverService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts b/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts index 86f3644cf6f..680b8a562f6 100644 --- a/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts +++ b/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts @@ -60,7 +60,7 @@ export abstract class BaseConfigurationResolverService extends AbstractVariableR if (!fileResource) { return undefined; } - return this.labelService.getUriLabel(fileResource); + return this.labelService.getUriLabel(fileResource, { noPrefix: true }); }, getSelectedText: (): string | undefined => { const activeTextEditorControl = editorService.activeTextEditorControl; From ff7a107e41be9e258b5b20d85f86db25c9e1541a Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 18 Sep 2020 10:47:37 +0200 Subject: [PATCH 0109/1667] update search file --- .vscode/searches/es6.code-search | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/searches/es6.code-search b/.vscode/searches/es6.code-search index 7b8a30e8dba..daf6485e981 100644 --- a/.vscode/searches/es6.code-search +++ b/.vscode/searches/es6.code-search @@ -4,7 +4,7 @@ 10 results - 2 files -monaco • src/vs/base/browser/dom.ts: +src/vs/base/browser/dom.ts: 83 }; 84 85: /** @deprecated ES6 - use classList*/ @@ -21,7 +21,7 @@ monaco • src/vs/base/browser/dom.ts: 96 export function toggleClass(node: HTMLElement | SVGElement, className: string, shouldHaveIt?: boolean): void { return _classList.toggleClass(node, className, shouldHaveIt); } 97 -monaco • src/vs/base/common/strings.ts: +src/vs/base/common/strings.ts: 15 16 /** 17: * @deprecated ES6: use `String.padStart` From 9c0ca0428699cb4c2bd5944e73375a1be549d32a Mon Sep 17 00:00:00 2001 From: isidor Date: Fri, 18 Sep 2020 10:52:51 +0200 Subject: [PATCH 0110/1667] debug: smoother toggle between debug and editor hover fixes #84561 --- .../contrib/debug/browser/debugEditorContribution.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts index d103567a26d..4d5a546c021 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts @@ -34,6 +34,8 @@ import { dispose, IDisposable } from 'vs/base/common/lifecycle'; import { EditOperation } from 'vs/editor/common/core/editOperation'; import { basename } from 'vs/base/common/path'; import { domEvent } from 'vs/base/browser/event'; +import { ModesHoverController } from 'vs/editor/contrib/hover/hover'; +import { HoverStartMode } from 'vs/editor/contrib/hover/hoverOperation'; const HOVER_DELAY = 300; const LAUNCH_JSON_REGEX = /\.vscode\/launch\.json$/; @@ -252,14 +254,24 @@ export class DebugEditorContribution implements IDebugEditorContribution { const standardKeyboardEvent = new StandardKeyboardEvent(keydownEvent); if (standardKeyboardEvent.keyCode === KeyCode.Alt) { this.altPressed = true; + const debugHoverWasVisible = this.hoverWidget.isVisible(); this.hoverWidget.hide(); this.enableEditorHover(); + if (debugHoverWasVisible && this.hoverRange) { + // If the debug hover was visible immediately show the editor hover for the alt transition to be smooth + const hoverController = this.editor.getContribution(ModesHoverController.ID); + hoverController.showContentHover(this.hoverRange, HoverStartMode.Immediate, false); + } + const listener = domEvent(document, 'keyup')(keyupEvent => { const standardKeyboardEvent = new StandardKeyboardEvent(keyupEvent); if (standardKeyboardEvent.keyCode === KeyCode.Alt) { this.altPressed = false; this.editor.updateOptions({ hover: { enabled: false } }); listener.dispose(); + if (this.hoverRange && debugHoverWasVisible) { + this.showHover(this.hoverRange, false); + } } }); } From cca934db91ff8a4fa660710b5892c4014577fba9 Mon Sep 17 00:00:00 2001 From: isidor Date: Fri, 18 Sep 2020 10:59:27 +0200 Subject: [PATCH 0111/1667] fixes #84561 --- .../workbench/contrib/debug/browser/debugEditorContribution.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts index 4d5a546c021..b542a23788f 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts @@ -279,6 +279,7 @@ export class DebugEditorContribution implements IDebugEditorContribution { this.editor.updateOptions({ hover: { enabled: false } }); } else { + this.altListener?.dispose(); this.enableEditorHover(); } } From 26f6d2bdfd163d6e145a1c8c76907fee6d58a0a7 Mon Sep 17 00:00:00 2001 From: isidor Date: Fri, 18 Sep 2020 11:37:23 +0200 Subject: [PATCH 0112/1667] fixes #71315 --- .../workbench/contrib/files/browser/views/explorerView.ts | 7 ++++++- src/vs/workbench/contrib/files/common/explorerService.ts | 2 +- src/vs/workbench/contrib/files/common/files.ts | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/files/browser/views/explorerView.ts b/src/vs/workbench/contrib/files/browser/views/explorerView.ts index 72e20cee13d..df7c870fee2 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerView.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerView.ts @@ -588,10 +588,15 @@ export class ExplorerView extends ViewPane { return this.tree.updateChildren(toRefresh, recursive); } - focusNextIfItemFocused(item: ExplorerItem): void { + focusNeighbourIfItemFocused(item: ExplorerItem): void { const focus = this.tree.getFocus(); if (focus.length === 1 && focus[0] === item) { this.tree.focusNext(); + const newFocus = this.tree.getFocus(); + if (newFocus.length === 1 && newFocus[0] === item) { + // There was no next item to focus, focus the previous one + this.tree.focusPrevious(); + } } } diff --git a/src/vs/workbench/contrib/files/common/explorerService.ts b/src/vs/workbench/contrib/files/common/explorerService.ts index 32a1b2fbe4d..27da4f1effe 100644 --- a/src/vs/workbench/contrib/files/common/explorerService.ts +++ b/src/vs/workbench/contrib/files/common/explorerService.ts @@ -278,7 +278,7 @@ export class ExplorerService implements IExplorerService { const parent = element.parent; // Remove Element from Parent (Model) parent.removeChild(element); - this.view?.focusNextIfItemFocused(element); + this.view?.focusNeighbourIfItemFocused(element); // Refresh Parent (View) await this.view?.refresh(false, parent); } diff --git a/src/vs/workbench/contrib/files/common/files.ts b/src/vs/workbench/contrib/files/common/files.ts index 87d64214cab..4de94e9698d 100644 --- a/src/vs/workbench/contrib/files/common/files.ts +++ b/src/vs/workbench/contrib/files/common/files.ts @@ -65,7 +65,7 @@ export interface IExplorerView { setTreeInput(): Promise; itemsCopied(tats: ExplorerItem[], cut: boolean, previousCut: ExplorerItem[] | undefined): void; setEditable(stat: ExplorerItem, isEditing: boolean): Promise; - focusNextIfItemFocused(item: ExplorerItem): void; + focusNeighbourIfItemFocused(item: ExplorerItem): void; } export const IExplorerService = createDecorator('explorerService'); From 16ff0ce22a331e653a03fee308c6cf1f94a6c832 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Fri, 18 Sep 2020 11:36:25 +0200 Subject: [PATCH 0113/1667] Disable syncing extensions in Web --- .../userDataSyncResourceEnablementService.ts | 6 +++- .../userDataSyncResourceEnablementService.ts | 33 +++++++++++++++++++ src/vs/workbench/workbench.common.main.ts | 3 -- src/vs/workbench/workbench.desktop.main.ts | 3 ++ src/vs/workbench/workbench.web.main.ts | 1 + 5 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 src/vs/workbench/services/userDataSync/browser/userDataSyncResourceEnablementService.ts diff --git a/src/vs/platform/userDataSync/common/userDataSyncResourceEnablementService.ts b/src/vs/platform/userDataSync/common/userDataSyncResourceEnablementService.ts index 0ca0decce1c..9b9a0dbe213 100644 --- a/src/vs/platform/userDataSync/common/userDataSyncResourceEnablementService.ts +++ b/src/vs/platform/userDataSync/common/userDataSyncResourceEnablementService.ts @@ -32,7 +32,7 @@ export class UserDataSyncResourceEnablementService extends Disposable implements } isResourceEnabled(resource: SyncResource): boolean { - return this.storageService.getBoolean(getEnablementKey(resource), StorageScope.GLOBAL, true); + return this.storageService.getBoolean(getEnablementKey(resource), StorageScope.GLOBAL, this.getDefaultResourceEnablementValue(resource)); } setResourceEnablement(resource: SyncResource, enabled: boolean): void { @@ -53,4 +53,8 @@ export class UserDataSyncResourceEnablementService extends Disposable implements } } + protected getDefaultResourceEnablementValue(resource: SyncResource): boolean { + return true; + } + } diff --git a/src/vs/workbench/services/userDataSync/browser/userDataSyncResourceEnablementService.ts b/src/vs/workbench/services/userDataSync/browser/userDataSyncResourceEnablementService.ts new file mode 100644 index 00000000000..bda46ffbecc --- /dev/null +++ b/src/vs/workbench/services/userDataSync/browser/userDataSyncResourceEnablementService.ts @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { IUserDataSyncResourceEnablementService, SyncResource } from 'vs/platform/userDataSync/common/userDataSync'; +import { IStorageService } from 'vs/platform/storage/common/storage'; +import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import { UserDataSyncResourceEnablementService } from 'vs/platform/userDataSync/common/userDataSyncResourceEnablementService'; +import { IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; + +export class WebUserDataSyncResourceEnablementService extends UserDataSyncResourceEnablementService implements IUserDataSyncResourceEnablementService { + + constructor( + @IStorageService storageService: IStorageService, + @ITelemetryService telemetryService: ITelemetryService, + @IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService, + ) { + super(storageService, telemetryService); + } + + protected getDefaultResourceEnablementValue(resource: SyncResource): boolean { + if (resource === SyncResource.Extensions) { + // In Web, disable syncing extensions by default when there is a remote server + return !this.extensionManagementServerService.remoteExtensionManagementServer; + } + return super.getDefaultResourceEnablementValue(resource); + } + +} + +registerSingleton(IUserDataSyncResourceEnablementService, WebUserDataSyncResourceEnablementService); diff --git a/src/vs/workbench/workbench.common.main.ts b/src/vs/workbench/workbench.common.main.ts index fd7d340e46c..5285bb3ed76 100644 --- a/src/vs/workbench/workbench.common.main.ts +++ b/src/vs/workbench/workbench.common.main.ts @@ -112,10 +112,7 @@ import { IDownloadService } from 'vs/platform/download/common/download'; import { DownloadService } from 'vs/platform/download/common/downloadService'; import { OpenerService } from 'vs/editor/browser/services/openerService'; import { IOpenerService } from 'vs/platform/opener/common/opener'; -import { IUserDataSyncResourceEnablementService } from 'vs/platform/userDataSync/common/userDataSync'; -import { UserDataSyncResourceEnablementService } from 'vs/platform/userDataSync/common/userDataSyncResourceEnablementService'; -registerSingleton(IUserDataSyncResourceEnablementService, UserDataSyncResourceEnablementService); registerSingleton(IGlobalExtensionEnablementService, GlobalExtensionEnablementService); registerSingleton(IExtensionGalleryService, ExtensionGalleryService, true); registerSingleton(IContextViewService, ContextViewService, true); diff --git a/src/vs/workbench/workbench.desktop.main.ts b/src/vs/workbench/workbench.desktop.main.ts index 5fd2222b446..4cba33ba087 100644 --- a/src/vs/workbench/workbench.desktop.main.ts +++ b/src/vs/workbench/workbench.desktop.main.ts @@ -62,9 +62,12 @@ import { KeytarCredentialsService } from 'vs/platform/credentials/node/credentia import { ITunnelService } from 'vs/platform/remote/common/tunnel'; import { TunnelService } from 'vs/platform/remote/node/tunnelService'; import { IUserDataInitializationService, UserDataInitializationService } from 'vs/workbench/services/userData/browser/userDataInit'; +import { IUserDataSyncResourceEnablementService } from 'vs/platform/userDataSync/common/userDataSync'; +import { UserDataSyncResourceEnablementService } from 'vs/platform/userDataSync/common/userDataSyncResourceEnablementService'; registerSingleton(ICredentialsService, KeytarCredentialsService, true); registerSingleton(ITunnelService, TunnelService); +registerSingleton(IUserDataSyncResourceEnablementService, UserDataSyncResourceEnablementService); registerSingleton(IUserDataInitializationService, UserDataInitializationService); //#endregion diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts index 014b8e33684..936e9b0b78a 100644 --- a/src/vs/workbench/workbench.web.main.ts +++ b/src/vs/workbench/workbench.web.main.ts @@ -51,6 +51,7 @@ import 'vs/workbench/services/clipboard/browser/clipboardService'; import 'vs/workbench/services/extensionResourceLoader/browser/extensionResourceLoaderService'; import 'vs/workbench/services/path/browser/pathService'; import 'vs/workbench/services/themes/browser/browserHostColorSchemeService'; +import 'vs/workbench/services/userDataSync/browser/userDataSyncResourceEnablementService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; From 65e00e81688c0e500ac792c7145a1bdaf684913d Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Fri, 18 Sep 2020 12:18:00 +0200 Subject: [PATCH 0114/1667] - Remove acitivating account extension as getSessions does it. - Add logging during initialization --- .../browser/userDataSyncWorkbenchService.ts | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts b/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts index 9d97faa76f5..f55d666cf75 100644 --- a/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts +++ b/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts @@ -11,7 +11,7 @@ import { AuthenticationSession, AuthenticationSessionsChangeEvent } from 'vs/edi import { Disposable, DisposableStore } from 'vs/base/common/lifecycle'; import { Emitter, Event } from 'vs/base/common/event'; import { flatten, equals } from 'vs/base/common/arrays'; -import { getAuthenticationProviderActivationEvent, getCurrentAuthenticationSessionInfo, IAuthenticationService } from 'vs/workbench/services/authentication/browser/authenticationService'; +import { getCurrentAuthenticationSessionInfo, IAuthenticationService } from 'vs/workbench/services/authentication/browser/authenticationService'; import { IUserDataSyncAccountService } from 'vs/platform/userDataSync/common/userDataSyncAccount'; import { IQuickInputService, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput'; import { IStorageService, IWorkspaceStorageChangeEvent, StorageScope } from 'vs/platform/storage/common/storage'; @@ -134,23 +134,22 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat } private async waitAndInitialize(): Promise { + /* wait */ await this.extensionService.whenInstalledExtensionsRegistered(); - this.updateAuthenticationProviders(); - - /* activate unregistered providers */ - const unregisteredProviders = this.authenticationProviders.filter(({ id }) => !this.authenticationService.isAuthenticationProviderRegistered(id)); - if (unregisteredProviders.length) { - await Promise.all(unregisteredProviders.map(({ id }) => this.extensionService.activateByEvent(getAuthenticationProviderActivationEvent(id)))); - } - - /* wait until all providers are registered */ - if (this.authenticationProviders.some(({ id }) => !this.authenticationService.isAuthenticationProviderRegistered(id))) { - await Event.toPromise(Event.filter(this.authenticationService.onDidRegisterAuthenticationProvider, () => this.authenticationProviders.every(({ id }) => this.authenticationService.isAuthenticationProviderRegistered(id)))); - } - /* initialize */ - await this.initialize(); + try { + this.logService.trace('Settings Sync: Initializing accounts'); + await this.initialize(); + } catch (error) { + this.logService.error(error); + } + + if (this.accountStatus === AccountStatus.Uninitialized) { + this.logService.warn('Settings Sync: Accounts are not initialized'); + } else { + this.logService.trace('Settings Sync: Accounts are initialized'); + } } private async initialize(): Promise { @@ -185,8 +184,10 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat const allAccounts: Map = new Map(); for (const { id } of this.authenticationProviders) { + this.logService.trace('Settings Sync: Getting accounts for', id); const accounts = await this.getAccounts(id); allAccounts.set(id, accounts); + this.logService.trace('Settings Sync: Updated accounts for', id); } this._all = allAccounts; @@ -234,7 +235,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat private updateAccountStatus(accountStatus: AccountStatus): void { if (this._accountStatus !== accountStatus) { const previous = this._accountStatus; - this.logService.debug('Sync account status changed', previous, accountStatus); + this.logService.trace(`Settings Sync: Account status changed from ${previous} to ${accountStatus}`); this._accountStatus = accountStatus; this.accountStatusContext.set(accountStatus); From 9f9ba405e4d1855161a22d86da8b705753147089 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 18 Sep 2020 12:10:02 +0200 Subject: [PATCH 0115/1667] remove isFree-check and rely on the renderer throwing errors --- .../workbench/api/browser/mainThreadFileSystem.ts | 2 +- src/vs/workbench/api/common/extHost.api.impl.ts | 4 ++-- src/vs/workbench/api/common/extHost.protocol.ts | 2 +- src/vs/workbench/api/common/extHostFileSystem.ts | 13 ++++++++----- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadFileSystem.ts b/src/vs/workbench/api/browser/mainThreadFileSystem.ts index b71e2e7ed45..286f1e540da 100644 --- a/src/vs/workbench/api/browser/mainThreadFileSystem.ts +++ b/src/vs/workbench/api/browser/mainThreadFileSystem.ts @@ -39,7 +39,7 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape { this._fileProvider.clear(); } - $registerFileSystemProvider(handle: number, scheme: string, capabilities: FileSystemProviderCapabilities): void { + async $registerFileSystemProvider(handle: number, scheme: string, capabilities: FileSystemProviderCapabilities): Promise { this._fileProvider.set(handle, new RemoteFileSystemProvider(this._fileService, scheme, capabilities, handle, this._proxy)); } diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 2233c434ff7..000b8a27af5 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -138,7 +138,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I const extHostEditorInsets = rpcProtocol.set(ExtHostContext.ExtHostEditorInsets, new ExtHostEditorInsets(rpcProtocol.getProxy(MainContext.MainThreadEditorInsets), extHostEditors, initData.environment)); const extHostDiagnostics = rpcProtocol.set(ExtHostContext.ExtHostDiagnostics, new ExtHostDiagnostics(rpcProtocol, extHostLogService)); const extHostLanguageFeatures = rpcProtocol.set(ExtHostContext.ExtHostLanguageFeatures, new ExtHostLanguageFeatures(rpcProtocol, uriTransformer, extHostDocuments, extHostCommands, extHostDiagnostics, extHostLogService, extHostApiDeprecation)); - const extHostFileSystem = rpcProtocol.set(ExtHostContext.ExtHostFileSystem, new ExtHostFileSystem(rpcProtocol, extHostLanguageFeatures, extHostFileSystemInfo)); + const extHostFileSystem = rpcProtocol.set(ExtHostContext.ExtHostFileSystem, new ExtHostFileSystem(rpcProtocol, extHostLanguageFeatures)); const extHostFileSystemEvent = rpcProtocol.set(ExtHostContext.ExtHostFileSystemEventService, new ExtHostFileSystemEventService(rpcProtocol, extHostLogService, extHostDocumentsAndEditors)); const extHostQuickOpen = rpcProtocol.set(ExtHostContext.ExtHostQuickOpen, new ExtHostQuickOpen(rpcProtocol, extHostWorkspace, extHostCommands)); const extHostSCM = rpcProtocol.set(ExtHostContext.ExtHostSCM, new ExtHostSCM(rpcProtocol, extHostCommands, extHostLogService)); @@ -758,7 +758,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I return extHostTask.registerTaskProvider(extension, type, provider); }, registerFileSystemProvider(scheme, provider, options) { - return extHostFileSystem.registerFileSystemProvider(scheme, provider, options); + return extHostFileSystem.registerFileSystemProvider(extension.identifier, scheme, provider, options); }, get fs() { return extHostConsumerFileSystem; diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 9ac62ca199f..7796c24e46a 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -786,7 +786,7 @@ export interface IFileChangeDto { } export interface MainThreadFileSystemShape extends IDisposable { - $registerFileSystemProvider(handle: number, scheme: string, capabilities: files.FileSystemProviderCapabilities): void; + $registerFileSystemProvider(handle: number, scheme: string, capabilities: files.FileSystemProviderCapabilities): Promise; $unregisterProvider(handle: number): void; $onFileSystemChange(handle: number, resource: IFileChangeDto[]): void; diff --git a/src/vs/workbench/api/common/extHostFileSystem.ts b/src/vs/workbench/api/common/extHostFileSystem.ts index a854c16f5c0..462f181ba5b 100644 --- a/src/vs/workbench/api/common/extHostFileSystem.ts +++ b/src/vs/workbench/api/common/extHostFileSystem.ts @@ -15,7 +15,7 @@ import { State, StateMachine, LinkComputer, Edge } from 'vs/editor/common/modes/ import { commonPrefixLength } from 'vs/base/common/strings'; import { CharCode } from 'vs/base/common/charCode'; import { VSBuffer } from 'vs/base/common/buffer'; -import { IExtHostFileSystemInfo } from 'vs/workbench/api/common/extHostFileSystemInfo'; +import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; class FsLinkProvider { @@ -119,7 +119,7 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape { private _linkProviderRegistration?: IDisposable; private _handlePool: number = 0; - constructor(mainContext: IMainContext, private _extHostLanguageFeatures: ExtHostLanguageFeatures, private _extHostFileSystemInfo: IExtHostFileSystemInfo) { + constructor(mainContext: IMainContext, private _extHostLanguageFeatures: ExtHostLanguageFeatures) { this._proxy = mainContext.getProxy(MainContext.MainThreadFileSystem); } @@ -133,9 +133,9 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape { } } - registerFileSystemProvider(scheme: string, provider: vscode.FileSystemProvider, options: { isCaseSensitive?: boolean, isReadonly?: boolean } = {}) { + registerFileSystemProvider(extension: ExtensionIdentifier, scheme: string, provider: vscode.FileSystemProvider, options: { isCaseSensitive?: boolean, isReadonly?: boolean } = {}) { - if (this._registeredSchemes.has(scheme) || !this._extHostFileSystemInfo.isFreeScheme(scheme)) { + if (this._registeredSchemes.has(scheme)) { throw new Error(`a provider for the scheme '${scheme}' is already registered`); } @@ -163,7 +163,10 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape { capabilities += files.FileSystemProviderCapabilities.FileOpenReadWriteClose; } - this._proxy.$registerFileSystemProvider(handle, scheme, capabilities); + this._proxy.$registerFileSystemProvider(handle, scheme, capabilities).catch(err => { + console.error(`FAILED to register filesystem provider of ${extension.value}-extension for the scheme ${scheme}`); + console.error(err); + }); const subscription = provider.onDidChangeFile(event => { const mapped: IFileChangeDto[] = []; From aa2a14c6dd9c6882af9e61d22fd675206c279306 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 18 Sep 2020 13:07:48 +0200 Subject: [PATCH 0116/1667] Loader config for node modules when running with sandbox --- src/bootstrap-window.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/bootstrap-window.js b/src/bootstrap-window.js index 9d1ddc5a957..436f7b50758 100644 --- a/src/bootstrap-window.js +++ b/src/bootstrap-window.js @@ -104,9 +104,24 @@ const loaderConfig = { baseUrl: `${uriFromPath(configuration.appRoot)}/out`, 'vs/nls': nlsConfig, - amdModulesPattern: /^vs\//, }; + if (sandbox) { + loaderConfig.paths = { + 'vscode-textmate': `../node_modules/vscode-textmate/release/main`, + 'vscode-oniguruma': `../node_modules/vscode-oniguruma/release/main`, + 'xterm': `../node_modules/xterm/lib/xterm.js`, + 'xterm-addon-search': `../node_modules/xterm-addon-search/lib/xterm-addon-search.js`, + 'xterm-addon-unicode11': `../node_modules/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`, + 'xterm-addon-webgl': `../node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`, + 'semver-umd': `../node_modules/semver-umd/lib/semver-umd.js`, + 'iconv-lite-umd': `../node_modules/iconv-lite-umd/lib/iconv-lite-umd.js`, + 'jschardet': `../node_modules/jschardet/dist/jschardet.min.js`, + }; + } else { + loaderConfig.amdModulesPattern = /^vs\//; + } + // cached data config if (configuration.nodeCachedDataDir) { loaderConfig.nodeCachedData = { From b9750d050e02de28c21324558bd1837e869d8993 Mon Sep 17 00:00:00 2001 From: isidor Date: Fri, 18 Sep 2020 13:09:35 +0200 Subject: [PATCH 0117/1667] DAP sources are case sensitive on insensitive filesystems fixes #106382 --- .../contrib/debug/browser/breakpointsView.ts | 10 ++++------ .../contrib/debug/browser/callStackView.ts | 6 ++---- .../contrib/debug/browser/debugActions.ts | 6 ++---- .../contrib/debug/browser/debugCommands.ts | 3 +-- .../debug/browser/debugEditorActions.ts | 4 +--- .../contrib/debug/browser/debugService.ts | 6 ++---- .../contrib/debug/browser/debugSession.ts | 15 ++++++--------- .../contrib/debug/browser/loadedScriptsView.ts | 6 ++---- .../contrib/debug/browser/replViewer.ts | 6 ++---- src/vs/workbench/contrib/debug/common/debug.ts | 3 +-- .../contrib/debug/common/debugModel.ts | 14 ++++++++------ .../contrib/debug/common/debugSource.ts | 18 +++++++++--------- .../contrib/debug/common/debugStorage.ts | 6 ++++-- .../debug/test/browser/baseDebugView.test.ts | 2 +- .../debug/test/browser/breakpoints.test.ts | 12 +++--------- .../debug/test/browser/callStack.test.ts | 14 +++++++------- .../debug/test/browser/debugHover.test.ts | 4 ++-- .../{common => browser}/debugSource.test.ts | 5 +++-- .../{common => browser}/debugUtils.test.ts | 0 .../{common => browser}/debugViewModel.test.ts | 4 ++-- .../test/{common => browser}/mockDebug.ts | 9 +++++++-- .../rawDebugSession.test.ts | 2 +- .../contrib/debug/test/browser/repl.test.ts | 2 +- .../debug/test/browser/telemetry.test.ts | 8 ++++---- .../contrib/debug/test/browser/watch.test.ts | 2 +- .../electron-browser/debugANSIHandling.test.ts | 4 ++-- 26 files changed, 78 insertions(+), 93 deletions(-) rename src/vs/workbench/contrib/debug/test/{common => browser}/debugSource.test.ts (93%) rename src/vs/workbench/contrib/debug/test/{common => browser}/debugUtils.test.ts (100%) rename src/vs/workbench/contrib/debug/test/{common => browser}/debugViewModel.test.ts (92%) rename src/vs/workbench/contrib/debug/test/{common => browser}/mockDebug.ts (97%) rename src/vs/workbench/contrib/debug/test/{common => browser}/rawDebugSession.test.ts (98%) diff --git a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts index 060c4a64229..97636b20cc8 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts @@ -37,7 +37,6 @@ import { IOpenerService } from 'vs/platform/opener/common/opener'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { Orientation } from 'vs/base/browser/ui/splitview/splitview'; import { IListAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget'; -import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity'; const $ = dom.$; @@ -78,7 +77,6 @@ export class BreakpointsView extends ViewPane { @IOpenerService openerService: IOpenerService, @ITelemetryService telemetryService: ITelemetryService, @ILabelService private readonly labelService: ILabelService, - @IUriIdentityService private readonly uriIdentityService: IUriIdentityService ) { super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService); @@ -135,7 +133,7 @@ export class BreakpointsView extends ViewPane { const element = this.list.element(e.element); if (element instanceof Breakpoint) { - openBreakpointSource(element, e.sideBySide, e.editorOptions.preserveFocus || false, this.debugService, this.editorService, this.uriIdentityService); + openBreakpointSource(element, e.sideBySide, e.editorOptions.preserveFocus || false, this.debugService, this.editorService); } if (e.browserEvent instanceof MouseEvent && e.browserEvent.detail === 2 && element instanceof FunctionBreakpoint && element !== this.debugService.getViewModel().getSelectedFunctionBreakpoint()) { // double click @@ -194,7 +192,7 @@ export class BreakpointsView extends ViewPane { if (element instanceof Breakpoint || element instanceof FunctionBreakpoint) { actions.push(new Action('workbench.action.debug.openEditorAndEditBreakpoint', nls.localize('editBreakpoint', "Edit {0}...", breakpointType), '', true, async () => { if (element instanceof Breakpoint) { - const editor = await openBreakpointSource(element, false, false, this.debugService, this.editorService, this.uriIdentityService); + const editor = await openBreakpointSource(element, false, false, this.debugService, this.editorService); if (editor) { const codeEditor = editor.getControl(); if (isCodeEditor(codeEditor)) { @@ -673,7 +671,7 @@ class BreakpointsAccessibilityProvider implements IListAccessibilityProvider { +export function openBreakpointSource(breakpoint: IBreakpoint, sideBySide: boolean, preserveFocus: boolean, debugService: IDebugService, editorService: IEditorService): Promise { if (breakpoint.uri.scheme === DEBUG_SCHEME && debugService.state === State.Inactive) { return Promise.resolve(undefined); } @@ -691,7 +689,7 @@ export function openBreakpointSource(breakpoint: IBreakpoint, sideBySide: boolea }; return editorService.openEditor({ - resource: uriIdentityService.asCanonicalUri(breakpoint.uri), + resource: breakpoint.uri, options: { preserveFocus, selection, diff --git a/src/vs/workbench/contrib/debug/browser/callStackView.ts b/src/vs/workbench/contrib/debug/browser/callStackView.ts index 2acdb87e77f..98c9981b6e0 100644 --- a/src/vs/workbench/contrib/debug/browser/callStackView.ts +++ b/src/vs/workbench/contrib/debug/browser/callStackView.ts @@ -46,7 +46,6 @@ import { posix } from 'vs/base/common/path'; import { ITreeCompressionDelegate } from 'vs/base/browser/ui/tree/asyncDataTree'; import { ICompressibleTreeRenderer } from 'vs/base/browser/ui/tree/objectTree'; import { ICompressedTreeNode } from 'vs/base/browser/ui/tree/compressedObjectTreeModel'; -import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity'; const $ = dom.$; @@ -138,8 +137,7 @@ export class CallStackView extends ViewPane { @IContextKeyService readonly contextKeyService: IContextKeyService, @IOpenerService openerService: IOpenerService, @IThemeService themeService: IThemeService, - @ITelemetryService telemetryService: ITelemetryService, - @IUriIdentityService private readonly uriIdentityService: IUriIdentityService + @ITelemetryService telemetryService: ITelemetryService ) { super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService); this.callStackItemType = CONTEXT_CALLSTACK_ITEM_TYPE.bindTo(contextKeyService); @@ -291,7 +289,7 @@ export class CallStackView extends ViewPane { const element = e.element; if (element instanceof StackFrame) { focusStackFrame(element, element.thread, element.thread.session); - element.openInEditor(this.editorService, this.uriIdentityService, e.editorOptions.preserveFocus, e.sideBySide, e.editorOptions.pinned); + element.openInEditor(this.editorService, e.editorOptions.preserveFocus, e.sideBySide, e.editorOptions.pinned); } if (element instanceof Thread) { focusStackFrame(undefined, element, element.session); diff --git a/src/vs/workbench/contrib/debug/browser/debugActions.ts b/src/vs/workbench/contrib/debug/browser/debugActions.ts index ead80a45b2b..3f3e09c959a 100644 --- a/src/vs/workbench/contrib/debug/browser/debugActions.ts +++ b/src/vs/workbench/contrib/debug/browser/debugActions.ts @@ -14,7 +14,6 @@ import { INotificationService } from 'vs/platform/notification/common/notificati import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; import { deepClone } from 'vs/base/common/objects'; -import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity'; export abstract class AbstractDebugAction extends Action { @@ -370,8 +369,7 @@ export class FocusSessionAction extends AbstractDebugAction { constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService, - @IEditorService private readonly editorService: IEditorService, - @IUriIdentityService private readonly uriIdentityService: IUriIdentityService + @IEditorService private readonly editorService: IEditorService ) { super(id, label, '', debugService, keybindingService); } @@ -380,7 +378,7 @@ export class FocusSessionAction extends AbstractDebugAction { await this.debugService.focusStackFrame(undefined, undefined, session, true); const stackFrame = this.debugService.getViewModel().focusedStackFrame; if (stackFrame) { - await stackFrame.openInEditor(this.editorService, this.uriIdentityService, true); + await stackFrame.openInEditor(this.editorService, true); } } } diff --git a/src/vs/workbench/contrib/debug/browser/debugCommands.ts b/src/vs/workbench/contrib/debug/browser/debugCommands.ts index a7fff262b3e..d857ef4326b 100644 --- a/src/vs/workbench/contrib/debug/browser/debugCommands.ts +++ b/src/vs/workbench/contrib/debug/browser/debugCommands.ts @@ -29,7 +29,6 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; import { IViewsService } from 'vs/workbench/common/views'; -import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity'; export const ADD_CONFIGURATION_ID = 'debug.addConfiguration'; export const TOGGLE_INLINE_BREAKPOINT_ID = 'editor.debug.action.toggleInlineBreakpoint'; @@ -565,7 +564,7 @@ export function registerCommands(): void { if (list instanceof List) { const focus = list.getFocusedElements(); if (focus.length && focus[0] instanceof Breakpoint) { - return openBreakpointSource(focus[0], true, false, accessor.get(IDebugService), accessor.get(IEditorService), accessor.get(IUriIdentityService)); + return openBreakpointSource(focus[0], true, false, accessor.get(IDebugService), accessor.get(IEditorService)); } } diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts b/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts index e5c0f68206f..e6b08a505c5 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts @@ -19,7 +19,6 @@ import { IViewsService } from 'vs/workbench/common/views'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { Action } from 'vs/base/common/actions'; import { getDomNodePagePosition } from 'vs/base/browser/dom'; -import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity'; export const TOGGLE_BREAKPOINT_ID = 'editor.debug.action.toggleBreakpoint'; class ToggleBreakpointAction extends EditorAction { @@ -306,7 +305,6 @@ class GoToBreakpointAction extends EditorAction { async run(accessor: ServicesAccessor, editor: ICodeEditor): Promise { const debugService = accessor.get(IDebugService); const editorService = accessor.get(IEditorService); - const uriIdentityService = accessor.get(IUriIdentityService); if (editor.hasModel()) { const currentUri = editor.getModel().uri; const currentLine = editor.getPosition().lineNumber; @@ -333,7 +331,7 @@ class GoToBreakpointAction extends EditorAction { } if (moveBreakpoint) { - return openBreakpointSource(moveBreakpoint, false, true, debugService, editorService, uriIdentityService); + return openBreakpointSource(moveBreakpoint, false, true, debugService, editorService); } } } diff --git a/src/vs/workbench/contrib/debug/browser/debugService.ts b/src/vs/workbench/contrib/debug/browser/debugService.ts index 9e5943cf2d5..c040680bcc2 100644 --- a/src/vs/workbench/contrib/debug/browser/debugService.ts +++ b/src/vs/workbench/contrib/debug/browser/debugService.ts @@ -48,7 +48,6 @@ import { DebugTelemetry } from 'vs/workbench/contrib/debug/common/debugTelemetry import { DebugCompoundRoot } from 'vs/workbench/contrib/debug/common/debugCompoundRoot'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; -import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity'; export class DebugService implements IDebugService { declare readonly _serviceBrand: undefined; @@ -93,8 +92,7 @@ export class DebugService implements IDebugService { @IExtensionHostDebugService private readonly extensionHostDebugService: IExtensionHostDebugService, @IActivityService private readonly activityService: IActivityService, @ICommandService private readonly commandService: ICommandService, - @IQuickInputService private readonly quickInputService: IQuickInputService, - @IUriIdentityService private readonly uriIdentityService: IUriIdentityService + @IQuickInputService private readonly quickInputService: IQuickInputService ) { this.toDispose = []; @@ -792,7 +790,7 @@ export class DebugService implements IDebugService { const { stackFrame, thread, session } = getStackFrameThreadAndSessionToFocus(this.model, _stackFrame, _thread, _session); if (stackFrame) { - const editor = await stackFrame.openInEditor(this.editorService, this.uriIdentityService, true); + const editor = await stackFrame.openInEditor(this.editorService, true); if (editor) { const control = editor.getControl(); if (stackFrame && isCodeEditor(control) && control.hasModel()) { diff --git a/src/vs/workbench/contrib/debug/browser/debugSession.ts b/src/vs/workbench/contrib/debug/browser/debugSession.ts index a761e9f94d1..9cb124d17bd 100644 --- a/src/vs/workbench/contrib/debug/browser/debugSession.ts +++ b/src/vs/workbench/contrib/debug/browser/debugSession.ts @@ -37,6 +37,7 @@ import { localize } from 'vs/nls'; import { canceled } from 'vs/base/common/errors'; import { filterExceptionsFromTelemetry } from 'vs/workbench/contrib/debug/common/debugUtils'; import { DebugCompoundRoot } from 'vs/workbench/contrib/debug/common/debugCompoundRoot'; +import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity'; export class DebugSession implements IDebugSession { @@ -82,7 +83,8 @@ export class DebugSession implements IDebugSession { @IExtensionHostDebugService private readonly extensionHostDebugService: IExtensionHostDebugService, @IOpenerService private readonly openerService: IOpenerService, @INotificationService private readonly notificationService: INotificationService, - @ILifecycleService lifecycleService: ILifecycleService + @ILifecycleService lifecycleService: ILifecycleService, + @IUriIdentityService private readonly uriIdentityService: IUriIdentityService ) { this._options = options || {}; if (this.hasSeparateRepl()) { @@ -1026,12 +1028,12 @@ export class DebugSession implements IDebugSession { //---- sources getSourceForUri(uri: URI): Source | undefined { - return this.sources.get(this.getUriKey(uri)); + return this.sources.get(this.uriIdentityService.asCanonicalUri(uri).toString()); } getSource(raw?: DebugProtocol.Source): Source { - let source = new Source(raw, this.getId()); - const uriKey = this.getUriKey(source.uri); + let source = new Source(raw, this.getId(), this.uriIdentityService); + const uriKey = source.uri.toString(); const found = this.sources.get(uriKey); if (found) { source = found; @@ -1072,11 +1074,6 @@ export class DebugSession implements IDebugSession { this.cancellationMap.clear(); } - private getUriKey(uri: URI): string { - // TODO: the following code does not make sense if uri originates from a different platform - return platform.isLinux ? uri.toString() : uri.toString().toLowerCase(); - } - // REPL getReplElements(): IReplElement[] { diff --git a/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts b/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts index f4c0157ed1e..e115fe0beb6 100644 --- a/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts +++ b/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts @@ -39,7 +39,6 @@ import { IOpenerService } from 'vs/platform/opener/common/opener'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IPathService } from 'vs/workbench/services/path/common/pathService'; -import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity'; const NEW_STYLE_COMPRESS = true; @@ -432,8 +431,7 @@ export class LoadedScriptsView extends ViewPane { @IPathService private readonly pathService: IPathService, @IOpenerService openerService: IOpenerService, @IThemeService themeService: IThemeService, - @ITelemetryService telemetryService: ITelemetryService, - @IUriIdentityService private readonly uriIdentityService: IUriIdentityService + @ITelemetryService telemetryService: ITelemetryService ) { super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService); this.loadedScriptsItemType = CONTEXT_LOADED_SCRIPTS_ITEM_TYPE.bindTo(contextKeyService); @@ -500,7 +498,7 @@ export class LoadedScriptsView extends ViewPane { const source = e.element.getSource(); if (source && source.available) { const nullRange = { startLineNumber: 0, startColumn: 0, endLineNumber: 0, endColumn: 0 }; - source.openInEditor(this.editorService, this.uriIdentityService, nullRange, e.editorOptions.preserveFocus, e.sideBySide, e.editorOptions.pinned); + source.openInEditor(this.editorService, nullRange, e.editorOptions.preserveFocus, e.sideBySide, e.editorOptions.pinned); } } })); diff --git a/src/vs/workbench/contrib/debug/browser/replViewer.ts b/src/vs/workbench/contrib/debug/browser/replViewer.ts index e98704a8a22..4fbb33ebc60 100644 --- a/src/vs/workbench/contrib/debug/browser/replViewer.ts +++ b/src/vs/workbench/contrib/debug/browser/replViewer.ts @@ -23,7 +23,6 @@ import { IReplElementSource, IDebugService, IExpression, IReplElement, IDebugCon import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { localize } from 'vs/nls'; -import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity'; const $ = dom.$; @@ -139,8 +138,7 @@ export class ReplSimpleElementsRenderer implements ITreeRenderer; toString(): string; - openInEditor(editorService: IEditorService, uriIdentityService: IUriIdentityService, preserveFocus?: boolean, sideBySide?: boolean): Promise; + openInEditor(editorService: IEditorService, preserveFocus?: boolean, sideBySide?: boolean): Promise; equals(other: IStackFrame): boolean; } diff --git a/src/vs/workbench/contrib/debug/common/debugModel.ts b/src/vs/workbench/contrib/debug/common/debugModel.ts index 134beff8ae1..df5ecd0da72 100644 --- a/src/vs/workbench/contrib/debug/common/debugModel.ts +++ b/src/vs/workbench/contrib/debug/common/debugModel.ts @@ -375,9 +375,9 @@ export class StackFrame implements IStackFrame { return sourceToString === UNKNOWN_SOURCE_LABEL ? this.name : `${this.name} (${sourceToString})`; } - async openInEditor(editorService: IEditorService, uriIdentityService: IUriIdentityService, preserveFocus?: boolean, sideBySide?: boolean, pinned?: boolean): Promise { + async openInEditor(editorService: IEditorService, preserveFocus?: boolean, sideBySide?: boolean, pinned?: boolean): Promise { if (this.source.available) { - return this.source.openInEditor(editorService, uriIdentityService, this.range, preserveFocus, sideBySide, pinned); + return this.source.openInEditor(editorService, this.range, preserveFocus, sideBySide, pinned); } return undefined; } @@ -662,7 +662,8 @@ export class Breakpoint extends BaseBreakpoint implements IBreakpoint { hitCondition: string | undefined, logMessage: string | undefined, private _adapterData: any, - private textFileService: ITextFileService, + private readonly textFileService: ITextFileService, + private readonly uriIdentityService: IUriIdentityService, id = generateUuid() ) { super(enabled, hitCondition, condition, logMessage, id); @@ -681,7 +682,7 @@ export class Breakpoint extends BaseBreakpoint implements IBreakpoint { } get uri(): uri { - return this.verified && this.data && this.data.source ? getUriFromSource(this.data.source, this.data.source.path, this.data.sessionId) : this._uri; + return this.verified && this.data && this.data.source ? getUriFromSource(this.data.source, this.data.source.path, this.data.sessionId, this.uriIdentityService) : this._uri; } get column(): number | undefined { @@ -888,7 +889,8 @@ export class DebugModel implements IDebugModel { constructor( debugStorage: DebugStorage, - @ITextFileService private readonly textFileService: ITextFileService + @ITextFileService private readonly textFileService: ITextFileService, + @IUriIdentityService private readonly uriIdentityService: IUriIdentityService ) { this.breakpoints = debugStorage.loadBreakpoints(); this.functionBreakpoints = debugStorage.loadFunctionBreakpoints(); @@ -1070,7 +1072,7 @@ export class DebugModel implements IDebugModel { } addBreakpoints(uri: uri, rawData: IBreakpointData[], fireEvent = true): IBreakpoint[] { - const newBreakpoints = rawData.map(rawBp => new Breakpoint(uri, rawBp.lineNumber, rawBp.column, rawBp.enabled === false ? false : true, rawBp.condition, rawBp.hitCondition, rawBp.logMessage, undefined, this.textFileService, rawBp.id)); + const newBreakpoints = rawData.map(rawBp => new Breakpoint(uri, rawBp.lineNumber, rawBp.column, rawBp.enabled === false ? false : true, rawBp.condition, rawBp.hitCondition, rawBp.logMessage, undefined, this.textFileService, this.uriIdentityService, rawBp.id)); this.breakpoints = this.breakpoints.concat(newBreakpoints); this.breakpointsActivated = true; this.sortAndDeDup(); diff --git a/src/vs/workbench/contrib/debug/common/debugSource.ts b/src/vs/workbench/contrib/debug/common/debugSource.ts index 5130be0d148..bf1ac904c0a 100644 --- a/src/vs/workbench/contrib/debug/common/debugSource.ts +++ b/src/vs/workbench/contrib/debug/common/debugSource.ts @@ -37,7 +37,7 @@ export class Source { available: boolean; raw: DebugProtocol.Source; - constructor(raw_: DebugProtocol.Source | undefined, sessionId: string) { + constructor(raw_: DebugProtocol.Source | undefined, sessionId: string, uriIdentityService: IUriIdentityService) { let path: string; if (raw_) { this.raw = raw_; @@ -49,7 +49,7 @@ export class Source { path = `${DEBUG_SCHEME}:${UNKNOWN_SOURCE_LABEL}`; } - this.uri = getUriFromSource(this.raw, path, sessionId); + this.uri = getUriFromSource(this.raw, path, sessionId, uriIdentityService); } get name() { @@ -72,9 +72,9 @@ export class Source { return this.uri.scheme === DEBUG_SCHEME; } - openInEditor(editorService: IEditorService, uriIdentityService: IUriIdentityService, selection: IRange, preserveFocus?: boolean, sideBySide?: boolean, pinned?: boolean): Promise { + openInEditor(editorService: IEditorService, selection: IRange, preserveFocus?: boolean, sideBySide?: boolean, pinned?: boolean): Promise { return !this.available ? Promise.resolve(undefined) : editorService.openEditor({ - resource: uriIdentityService.asCanonicalUri(this.uri), + resource: this.uri, description: this.origin, options: { preserveFocus, @@ -128,7 +128,7 @@ export class Source { } } -export function getUriFromSource(raw: DebugProtocol.Source, path: string | undefined, sessionId: string): URI { +export function getUriFromSource(raw: DebugProtocol.Source, path: string | undefined, sessionId: string, uriIdentityService: IUriIdentityService): URI { if (typeof raw.sourceReference === 'number' && raw.sourceReference > 0) { return URI.from({ scheme: DEBUG_SCHEME, @@ -138,17 +138,17 @@ export function getUriFromSource(raw: DebugProtocol.Source, path: string | undef } if (path && isUri(path)) { // path looks like a uri - return URI.parse(path); + return uriIdentityService.asCanonicalUri(URI.parse(path)); } // assume a filesystem path if (path && isAbsolute(path)) { - return URI.file(path); + return uriIdentityService.asCanonicalUri(URI.file(path)); } // path is relative: since VS Code cannot deal with this by itself // create a debug url that will result in a DAP 'source' request when the url is resolved. - return URI.from({ + return uriIdentityService.asCanonicalUri(URI.from({ scheme: DEBUG_SCHEME, path, query: `session=${sessionId}` - }); + })); } diff --git a/src/vs/workbench/contrib/debug/common/debugStorage.ts b/src/vs/workbench/contrib/debug/common/debugStorage.ts index d49f9362869..6cabc0ba9ed 100644 --- a/src/vs/workbench/contrib/debug/common/debugStorage.ts +++ b/src/vs/workbench/contrib/debug/common/debugStorage.ts @@ -8,6 +8,7 @@ import { StorageScope, IStorageService } from 'vs/platform/storage/common/storag import { ExceptionBreakpoint, Expression, Breakpoint, FunctionBreakpoint, DataBreakpoint } from 'vs/workbench/contrib/debug/common/debugModel'; import { IEvaluate, IExpression, IDebugModel } from 'vs/workbench/contrib/debug/common/debug'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; +import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity'; const DEBUG_BREAKPOINTS_KEY = 'debug.breakpoint'; const DEBUG_FUNCTION_BREAKPOINTS_KEY = 'debug.functionbreakpoint'; @@ -18,14 +19,15 @@ const DEBUG_WATCH_EXPRESSIONS_KEY = 'debug.watchexpressions'; export class DebugStorage { constructor( @IStorageService private readonly storageService: IStorageService, - @ITextFileService private readonly textFileService: ITextFileService + @ITextFileService private readonly textFileService: ITextFileService, + @IUriIdentityService private readonly uriIdentityService: IUriIdentityService ) { } loadBreakpoints(): Breakpoint[] { let result: Breakpoint[] | undefined; try { result = JSON.parse(this.storageService.get(DEBUG_BREAKPOINTS_KEY, StorageScope.WORKSPACE, '[]')).map((breakpoint: any) => { - return new Breakpoint(URI.parse(breakpoint.uri.external || breakpoint.source.uri.external), breakpoint.lineNumber, breakpoint.column, breakpoint.enabled, breakpoint.condition, breakpoint.hitCondition, breakpoint.logMessage, breakpoint.adapterData, this.textFileService); + return new Breakpoint(URI.parse(breakpoint.uri.external || breakpoint.source.uri.external), breakpoint.lineNumber, breakpoint.column, breakpoint.enabled, breakpoint.condition, breakpoint.hitCondition, breakpoint.logMessage, breakpoint.adapterData, this.textFileService, this.uriIdentityService); }); } catch (e) { } diff --git a/src/vs/workbench/contrib/debug/test/browser/baseDebugView.test.ts b/src/vs/workbench/contrib/debug/test/browser/baseDebugView.test.ts index 4696357d343..a5702dbcdd3 100644 --- a/src/vs/workbench/contrib/debug/test/browser/baseDebugView.test.ts +++ b/src/vs/workbench/contrib/debug/test/browser/baseDebugView.test.ts @@ -7,7 +7,6 @@ import * as assert from 'assert'; import { renderExpressionValue, renderVariable, renderViewTree } from 'vs/workbench/contrib/debug/browser/baseDebugView'; import * as dom from 'vs/base/browser/dom'; import { Expression, Variable, Scope, StackFrame, Thread } from 'vs/workbench/contrib/debug/common/debugModel'; -import { MockSession, createMockDebugModel } from 'vs/workbench/contrib/debug/test/common/mockDebug'; import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel'; import { LinkDetector } from 'vs/workbench/contrib/debug/browser/linkDetector'; import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock'; @@ -16,6 +15,7 @@ import { createMockSession } from 'vs/workbench/contrib/debug/test/browser/callS import { isStatusbarInDebugMode } from 'vs/workbench/contrib/debug/browser/statusbarColorProvider'; import { State } from 'vs/workbench/contrib/debug/common/debug'; import { isWindows } from 'vs/base/common/platform'; +import { MockSession, createMockDebugModel } from 'vs/workbench/contrib/debug/test/browser/mockDebug'; const $ = dom.$; suite('Debug - Base Debug View', () => { diff --git a/src/vs/workbench/contrib/debug/test/browser/breakpoints.test.ts b/src/vs/workbench/contrib/debug/test/browser/breakpoints.test.ts index 876213fc2b3..aece705d654 100644 --- a/src/vs/workbench/contrib/debug/test/browser/breakpoints.test.ts +++ b/src/vs/workbench/contrib/debug/test/browser/breakpoints.test.ts @@ -6,24 +6,18 @@ import * as assert from 'assert'; import { URI as uri } from 'vs/base/common/uri'; import { DebugModel, Breakpoint } from 'vs/workbench/contrib/debug/common/debugModel'; -import { DebugSession } from 'vs/workbench/contrib/debug/browser/debugSession'; -import { NullOpenerService } from 'vs/platform/opener/common/opener'; import { getExpandedBodySize, getBreakpointMessageAndClassName } from 'vs/workbench/contrib/debug/browser/breakpointsView'; import { dispose } from 'vs/base/common/lifecycle'; import { Range } from 'vs/editor/common/core/range'; -import { IBreakpointData, IDebugSessionOptions, IBreakpointUpdateData, State } from 'vs/workbench/contrib/debug/common/debug'; +import { IBreakpointData, IBreakpointUpdateData, State } from 'vs/workbench/contrib/debug/common/debug'; import { TextModel } from 'vs/editor/common/model/textModel'; import { LanguageIdentifier, LanguageId } from 'vs/editor/common/modes'; import { createBreakpointDecorations } from 'vs/workbench/contrib/debug/browser/breakpointEditorContribution'; import { OverviewRulerLane } from 'vs/editor/common/model'; import { MarkdownString } from 'vs/base/common/htmlContent'; import { createTextModel } from 'vs/editor/test/common/editorTestUtils'; -import { generateUuid } from 'vs/base/common/uuid'; -import { createMockDebugModel } from 'vs/workbench/contrib/debug/test/common/mockDebug'; - -function createMockSession(model: DebugModel, name = 'mockSession', options?: IDebugSessionOptions): DebugSession { - return new DebugSession(generateUuid(), { resolved: { name, type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, options, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, NullOpenerService, undefined!, undefined!); -} +import { createMockSession } from 'vs/workbench/contrib/debug/test/browser/callStack.test'; +import { createMockDebugModel } from 'vs/workbench/contrib/debug/test/browser/mockDebug'; function addBreakpointsAndCheckEvents(model: DebugModel, uri: uri, data: IBreakpointData[]): void { let eventCount = 0; diff --git a/src/vs/workbench/contrib/debug/test/browser/callStack.test.ts b/src/vs/workbench/contrib/debug/test/browser/callStack.test.ts index 596687ed5a0..39c4e83e985 100644 --- a/src/vs/workbench/contrib/debug/test/browser/callStack.test.ts +++ b/src/vs/workbench/contrib/debug/test/browser/callStack.test.ts @@ -6,7 +6,7 @@ import * as assert from 'assert'; import { DebugModel, StackFrame, Thread } from 'vs/workbench/contrib/debug/common/debugModel'; import * as sinon from 'sinon'; -import { MockRawSession, createMockDebugModel } from 'vs/workbench/contrib/debug/test/common/mockDebug'; +import { MockRawSession, createMockDebugModel, mockUriIdentityService } from 'vs/workbench/contrib/debug/test/browser/mockDebug'; import { Source } from 'vs/workbench/contrib/debug/common/debugSource'; import { DebugSession } from 'vs/workbench/contrib/debug/browser/debugSession'; import { Range } from 'vs/editor/common/core/range'; @@ -19,7 +19,7 @@ import { getStackFrameThreadAndSessionToFocus } from 'vs/workbench/contrib/debug import { generateUuid } from 'vs/base/common/uuid'; export function createMockSession(model: DebugModel, name = 'mockSession', options?: IDebugSessionOptions): DebugSession { - return new DebugSession(generateUuid(), { resolved: { name, type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, options, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, NullOpenerService, undefined!, undefined!); + return new DebugSession(generateUuid(), { resolved: { name, type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, options, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, NullOpenerService, undefined!, undefined!, mockUriIdentityService); } function createTwoStackFrames(session: DebugSession): { firstStackFrame: StackFrame, secondStackFrame: StackFrame } { @@ -35,12 +35,12 @@ function createTwoStackFrames(session: DebugSession): { firstStackFrame: StackFr name: 'internalModule.js', path: 'a/b/c/d/internalModule.js', sourceReference: 10, - }, 'aDebugSessionId'); + }, 'aDebugSessionId', mockUriIdentityService); const secondSource = new Source({ name: 'internalModule.js', path: 'z/x/c/d/internalModule.js', sourceReference: 11, - }, 'aDebugSessionId'); + }, 'aDebugSessionId', mockUriIdentityService); firstStackFrame = new StackFrame(thread, 0, firstSource, 'app.js', 'normal', { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 10 }, 0); secondStackFrame = new StackFrame(thread, 1, secondSource, 'app2.js', 'normal', { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 10 }, 1); @@ -261,11 +261,11 @@ suite('Debug - CallStack', () => { name: 'internalModule.js', path: 'a/b/c/d/internalModule.js', sourceReference: 10, - }, 'aDebugSessionId'); + }, 'aDebugSessionId', mockUriIdentityService); const stackFrame = new StackFrame(thread, 1, firstSource, 'app', 'normal', { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 10 }, 1); assert.equal(stackFrame.toString(), 'app (internalModule.js:1)'); - const secondSource = new Source(undefined, 'aDebugSessionId'); + const secondSource = new Source(undefined, 'aDebugSessionId', mockUriIdentityService); const stackFrame2 = new StackFrame(thread, 2, secondSource, 'module', 'normal', { startLineNumber: undefined!, startColumn: undefined!, endLineNumber: undefined!, endColumn: undefined! }, 2); assert.equal(stackFrame2.toString(), 'module'); }); @@ -364,7 +364,7 @@ suite('Debug - CallStack', () => { get state(): State { return State.Stopped; } - }(generateUuid(), { resolved: { name: 'stoppedSession', type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, undefined, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, NullOpenerService, undefined!, undefined!); + }(generateUuid(), { resolved: { name: 'stoppedSession', type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, undefined, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, NullOpenerService, undefined!, undefined!, mockUriIdentityService); const runningSession = createMockSession(model); model.addSession(runningSession); diff --git a/src/vs/workbench/contrib/debug/test/browser/debugHover.test.ts b/src/vs/workbench/contrib/debug/test/browser/debugHover.test.ts index 98d0ed6d8fc..2068c7026ab 100644 --- a/src/vs/workbench/contrib/debug/test/browser/debugHover.test.ts +++ b/src/vs/workbench/contrib/debug/test/browser/debugHover.test.ts @@ -9,7 +9,7 @@ import { createMockSession } from 'vs/workbench/contrib/debug/test/browser/callS import { StackFrame, Thread, Scope, Variable } from 'vs/workbench/contrib/debug/common/debugModel'; import { Source } from 'vs/workbench/contrib/debug/common/debugSource'; import type { IScope, IExpression } from 'vs/workbench/contrib/debug/common/debug'; -import { createMockDebugModel } from 'vs/workbench/contrib/debug/test/common/mockDebug'; +import { createMockDebugModel, mockUriIdentityService } from 'vs/workbench/contrib/debug/test/browser/mockDebug'; suite('Debug - Hover', () => { test('find expression in stack frame', async () => { @@ -27,7 +27,7 @@ suite('Debug - Hover', () => { name: 'internalModule.js', path: 'a/b/c/d/internalModule.js', sourceReference: 10, - }, 'aDebugSessionId'); + }, 'aDebugSessionId', mockUriIdentityService); let scope: Scope; stackFrame = new class extends StackFrame { diff --git a/src/vs/workbench/contrib/debug/test/common/debugSource.test.ts b/src/vs/workbench/contrib/debug/test/browser/debugSource.test.ts similarity index 93% rename from src/vs/workbench/contrib/debug/test/common/debugSource.test.ts rename to src/vs/workbench/contrib/debug/test/browser/debugSource.test.ts index f44747a9fcf..c6da337a6ee 100644 --- a/src/vs/workbench/contrib/debug/test/common/debugSource.test.ts +++ b/src/vs/workbench/contrib/debug/test/browser/debugSource.test.ts @@ -7,6 +7,7 @@ import * as assert from 'assert'; import { URI as uri } from 'vs/base/common/uri'; import { Source } from 'vs/workbench/contrib/debug/common/debugSource'; import { isWindows } from 'vs/base/common/platform'; +import { mockUriIdentityService } from 'vs/workbench/contrib/debug/test/browser/mockDebug'; suite('Debug - Source', () => { @@ -16,7 +17,7 @@ suite('Debug - Source', () => { path: '/xx/yy/zz', sourceReference: 0, presentationHint: 'emphasize' - }, 'aDebugSessionId'); + }, 'aDebugSessionId', mockUriIdentityService); assert.equal(source.presentationHint, 'emphasize'); assert.equal(source.name, 'zz'); @@ -30,7 +31,7 @@ suite('Debug - Source', () => { name: 'internalModule.js', sourceReference: 11, presentationHint: 'deemphasize' - }, 'aDebugSessionId'); + }, 'aDebugSessionId', mockUriIdentityService); assert.equal(source.presentationHint, 'deemphasize'); assert.equal(source.name, 'internalModule.js'); diff --git a/src/vs/workbench/contrib/debug/test/common/debugUtils.test.ts b/src/vs/workbench/contrib/debug/test/browser/debugUtils.test.ts similarity index 100% rename from src/vs/workbench/contrib/debug/test/common/debugUtils.test.ts rename to src/vs/workbench/contrib/debug/test/browser/debugUtils.test.ts diff --git a/src/vs/workbench/contrib/debug/test/common/debugViewModel.test.ts b/src/vs/workbench/contrib/debug/test/browser/debugViewModel.test.ts similarity index 92% rename from src/vs/workbench/contrib/debug/test/common/debugViewModel.test.ts rename to src/vs/workbench/contrib/debug/test/browser/debugViewModel.test.ts index 576e7bfc44c..c1cc84b21aa 100644 --- a/src/vs/workbench/contrib/debug/test/common/debugViewModel.test.ts +++ b/src/vs/workbench/contrib/debug/test/browser/debugViewModel.test.ts @@ -6,7 +6,7 @@ import * as assert from 'assert'; import { ViewModel } from 'vs/workbench/contrib/debug/common/debugViewModel'; import { StackFrame, Expression, Thread } from 'vs/workbench/contrib/debug/common/debugModel'; -import { MockSession } from 'vs/workbench/contrib/debug/test/common/mockDebug'; +import { MockSession, mockUriIdentityService } from 'vs/workbench/contrib/debug/test/browser/mockDebug'; import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService'; import { Source } from 'vs/workbench/contrib/debug/common/debugSource'; @@ -26,7 +26,7 @@ suite('Debug - View Model', () => { name: 'internalModule.js', sourceReference: 11, presentationHint: 'deemphasize' - }, 'aDebugSessionId'); + }, 'aDebugSessionId', mockUriIdentityService); const frame = new StackFrame(thread, 1, source, 'app.js', 'normal', { startColumn: 1, startLineNumber: 1, endColumn: 1, endLineNumber: 1 }, 0); model.setFocus(frame, thread, session, false); diff --git a/src/vs/workbench/contrib/debug/test/common/mockDebug.ts b/src/vs/workbench/contrib/debug/test/browser/mockDebug.ts similarity index 97% rename from src/vs/workbench/contrib/debug/test/common/mockDebug.ts rename to src/vs/workbench/contrib/debug/test/browser/mockDebug.ts index 9f4002da8b9..4a885f89277 100644 --- a/src/vs/workbench/contrib/debug/test/common/mockDebug.ts +++ b/src/vs/workbench/contrib/debug/test/browser/mockDebug.ts @@ -15,6 +15,11 @@ import { DebugStorage } from 'vs/workbench/contrib/debug/common/debugStorage'; import { ExceptionBreakpoint, Expression, DataBreakpoint, FunctionBreakpoint, Breakpoint, DebugModel } from 'vs/workbench/contrib/debug/common/debugModel'; import { DebugCompoundRoot } from 'vs/workbench/contrib/debug/common/debugCompoundRoot'; import { CancellationToken } from 'vs/base/common/cancellation'; +import { TestFileService } from 'vs/workbench/test/browser/workbenchTestServices'; +import { UriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentityService'; + +const fileService = new TestFileService(); +export const mockUriIdentityService = new UriIdentityService(fileService); export class MockDebugService implements IDebugService { @@ -564,7 +569,7 @@ export class MockDebugAdapter extends AbstractDebugAdapter { class MockDebugStorage extends DebugStorage { constructor() { - super(undefined as any, undefined as any); + super(undefined as any, undefined as any, undefined as any); } loadBreakpoints(): Breakpoint[] { @@ -596,5 +601,5 @@ class MockDebugStorage extends DebugStorage { } export function createMockDebugModel(): DebugModel { - return new DebugModel(new MockDebugStorage(), { isDirty: (e: any) => false }); + return new DebugModel(new MockDebugStorage(), { isDirty: (e: any) => false }, mockUriIdentityService); } diff --git a/src/vs/workbench/contrib/debug/test/common/rawDebugSession.test.ts b/src/vs/workbench/contrib/debug/test/browser/rawDebugSession.test.ts similarity index 98% rename from src/vs/workbench/contrib/debug/test/common/rawDebugSession.test.ts rename to src/vs/workbench/contrib/debug/test/browser/rawDebugSession.test.ts index 16c02f6cb02..791c5a90a87 100644 --- a/src/vs/workbench/contrib/debug/test/common/rawDebugSession.test.ts +++ b/src/vs/workbench/contrib/debug/test/browser/rawDebugSession.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { MockDebugAdapter } from 'vs/workbench/contrib/debug/test/common/mockDebug'; +import { MockDebugAdapter } from 'vs/workbench/contrib/debug/test/browser/mockDebug'; import { timeout } from 'vs/base/common/async'; suite('Debug - AbstractDebugAdapter', () => { diff --git a/src/vs/workbench/contrib/debug/test/browser/repl.test.ts b/src/vs/workbench/contrib/debug/test/browser/repl.test.ts index 787328d4e5d..815ec28a717 100644 --- a/src/vs/workbench/contrib/debug/test/browser/repl.test.ts +++ b/src/vs/workbench/contrib/debug/test/browser/repl.test.ts @@ -7,7 +7,7 @@ import * as assert from 'assert'; import severity from 'vs/base/common/severity'; import { DebugModel, StackFrame, Thread } from 'vs/workbench/contrib/debug/common/debugModel'; -import { MockRawSession, MockDebugAdapter, createMockDebugModel } from 'vs/workbench/contrib/debug/test/common/mockDebug'; +import { MockRawSession, MockDebugAdapter, createMockDebugModel } from 'vs/workbench/contrib/debug/test/browser/mockDebug'; import { SimpleReplElement, RawObjectReplElement, ReplEvaluationInput, ReplModel, ReplEvaluationResult, ReplGroup } from 'vs/workbench/contrib/debug/common/replModel'; import { RawDebugSession } from 'vs/workbench/contrib/debug/browser/rawDebugSession'; import { timeout } from 'vs/base/common/async'; diff --git a/src/vs/workbench/contrib/debug/test/browser/telemetry.test.ts b/src/vs/workbench/contrib/debug/test/browser/telemetry.test.ts index 276463f95b8..f3112845b88 100644 --- a/src/vs/workbench/contrib/debug/test/browser/telemetry.test.ts +++ b/src/vs/workbench/contrib/debug/test/browser/telemetry.test.ts @@ -4,15 +4,15 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { MockDebugAdapter, createMockDebugModel } from 'vs/workbench/contrib/debug/test/common/mockDebug'; +import { MockDebugAdapter, createMockDebugModel, mockUriIdentityService } from 'vs/workbench/contrib/debug/test/browser/mockDebug'; import { DebugModel } from 'vs/workbench/contrib/debug/common/debugModel'; import { DebugSession } from 'vs/workbench/contrib/debug/browser/debugSession'; -import { generateUuid } from 'vs/base/common/uuid'; -import { NullOpenerService } from 'vs/platform/opener/common/opener'; import { RawDebugSession } from 'vs/workbench/contrib/debug/browser/rawDebugSession'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { stub, SinonStub } from 'sinon'; import { timeout } from 'vs/base/common/async'; +import { generateUuid } from 'vs/base/common/uuid'; +import { NullOpenerService } from 'vs/platform/opener/common/opener'; suite('Debug - DebugSession telemetry', () => { let model: DebugModel; @@ -26,7 +26,7 @@ suite('Debug - DebugSession telemetry', () => { model = createMockDebugModel(); const telemetryService = telemetry as Partial as ITelemetryService; - session = new DebugSession(generateUuid(), undefined!, undefined!, model, undefined, undefined!, telemetryService, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, NullOpenerService, undefined!, undefined!); + session = new DebugSession(generateUuid(), undefined!, undefined!, model, undefined, undefined!, telemetryService, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, NullOpenerService, undefined!, undefined!, mockUriIdentityService); session.initializeForTest(new RawDebugSession(adapter, undefined!, undefined!, telemetryService, undefined!, undefined!, undefined!)); }); diff --git a/src/vs/workbench/contrib/debug/test/browser/watch.test.ts b/src/vs/workbench/contrib/debug/test/browser/watch.test.ts index 44d32210106..e69042ab69b 100644 --- a/src/vs/workbench/contrib/debug/test/browser/watch.test.ts +++ b/src/vs/workbench/contrib/debug/test/browser/watch.test.ts @@ -5,7 +5,7 @@ import * as assert from 'assert'; import { Expression, DebugModel } from 'vs/workbench/contrib/debug/common/debugModel'; -import { createMockDebugModel } from 'vs/workbench/contrib/debug/test/common/mockDebug'; +import { createMockDebugModel } from 'vs/workbench/contrib/debug/test/browser/mockDebug'; // Expressions diff --git a/src/vs/workbench/contrib/debug/test/electron-browser/debugANSIHandling.test.ts b/src/vs/workbench/contrib/debug/test/electron-browser/debugANSIHandling.test.ts index fbf28920af5..1766397badb 100644 --- a/src/vs/workbench/contrib/debug/test/electron-browser/debugANSIHandling.test.ts +++ b/src/vs/workbench/contrib/debug/test/electron-browser/debugANSIHandling.test.ts @@ -15,8 +15,8 @@ import { TestThemeService, TestColorTheme } from 'vs/platform/theme/test/common/ import { ansiColorMap } from 'vs/workbench/contrib/terminal/common/terminalColorRegistry'; import { DebugModel } from 'vs/workbench/contrib/debug/common/debugModel'; import { DebugSession } from 'vs/workbench/contrib/debug/browser/debugSession'; -import { NullOpenerService } from 'vs/platform/opener/common/opener'; import { createMockDebugModel } from 'vs/workbench/contrib/debug/test/common/mockDebug'; +import { createMockSession } from 'vs/workbench/contrib/debug/test/browser/callStack.test'; suite('Debug - ANSI Handling', () => { @@ -30,7 +30,7 @@ suite('Debug - ANSI Handling', () => { */ setup(() => { model = createMockDebugModel(); - session = new DebugSession(generateUuid(), { resolved: { name: 'test', type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, undefined, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, NullOpenerService, undefined!, undefined!); + session = createMockSession(model); const instantiationService: TestInstantiationService = workbenchInstantiationService(); linkDetector = instantiationService.createInstance(LinkDetector); From 1593fa42b9a6630023e8a141abbeddc07085b669 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 18 Sep 2020 13:19:35 +0200 Subject: [PATCH 0118/1667] sandbox - lift extension workbench service back to browser --- .../browser/extensions.contribution.ts | 3 +- .../browser/extensions.web.contribution.ts | 11 ------- .../extensions.contribution.ts | 3 -- .../sandbox.simpleservices.ts | 33 +------------------ src/vs/workbench/workbench.web.main.ts | 3 -- 5 files changed, 3 insertions(+), 50 deletions(-) delete mode 100644 src/vs/workbench/contrib/extensions/browser/extensions.web.contribution.ts diff --git a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts index 5287eea642b..bc27a6bfd3f 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts @@ -52,9 +52,10 @@ import { CopyAction, CutAction, PasteAction } from 'vs/editor/contrib/clipboard/ import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { MultiCommand } from 'vs/editor/browser/editorExtensions'; import { Webview } from 'vs/workbench/contrib/webview/browser/webview'; +import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/browser/extensionsWorkbenchService'; // Singletons -// registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService); // TODO@sandbox TODO@ben uncomment when 'semver-umd' can be loaded +registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService); registerSingleton(IExtensionRecommendationsService, ExtensionRecommendationsService); Registry.as(OutputExtensions.OutputChannels) diff --git a/src/vs/workbench/contrib/extensions/browser/extensions.web.contribution.ts b/src/vs/workbench/contrib/extensions/browser/extensions.web.contribution.ts deleted file mode 100644 index 619906cc521..00000000000 --- a/src/vs/workbench/contrib/extensions/browser/extensions.web.contribution.ts +++ /dev/null @@ -1,11 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions'; -import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/browser/extensionsWorkbenchService'; - -// TODO@sandbox TODO@ben move back into common/extensions.contribution.ts when 'semver-umd' can be loaded -registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService); diff --git a/src/vs/workbench/contrib/extensions/electron-browser/extensions.contribution.ts b/src/vs/workbench/contrib/extensions/electron-browser/extensions.contribution.ts index 7a7c43e3749..8a3cdb7618e 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/extensions.contribution.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/extensions.contribution.ts @@ -23,11 +23,8 @@ import { ExtensionsAutoProfiler } from 'vs/workbench/contrib/extensions/electron import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { OpenExtensionsFolderAction } from 'vs/workbench/contrib/extensions/electron-sandbox/extensionsActions'; import { ExtensionsLabel } from 'vs/platform/extensionManagement/common/extensionManagement'; -import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/browser/extensionsWorkbenchService'; -import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions'; // Singletons -registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService); // TODO@sandbox TODO@ben move back into common/extensions.contribution.ts when 'semver-umd' can be loaded registerSingleton(IExtensionHostProfileService, ExtensionHostProfileService, true); const workbenchRegistry = Registry.as(WorkbenchExtensions.Workbench); diff --git a/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts b/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts index 663cc04ddc9..9586ea57317 100644 --- a/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts +++ b/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts @@ -38,7 +38,7 @@ import { isWindows, OS } from 'vs/base/common/platform'; import { IWebviewService, WebviewContentOptions, WebviewElement, WebviewExtensionDescription, WebviewIcons, WebviewOptions, WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { AbstractTextFileService } from 'vs/workbench/services/textfile/browser/textFileService'; -import { EnablementState, ExtensionRecommendationReason, IExtensionManagementServer, IExtensionManagementServerService, IExtensionRecommendation } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; +import { ExtensionRecommendationReason, IExtensionManagementServer, IExtensionManagementServerService, IExtensionRecommendation } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; import { LanguageId, TokenizationRegistry } from 'vs/editor/common/modes'; import { IGrammar, ITextMateService } from 'vs/workbench/services/textMate/common/textMateService'; import { ITunnelProvider, ITunnelService, RemoteTunnel } from 'vs/platform/remote/common/tunnel'; @@ -58,7 +58,6 @@ import { AsbtractOutputChannelModelService, IOutputChannelModelService } from 'v import { Color, RGBA } from 'vs/base/common/color'; import { joinPath } from 'vs/base/common/resources'; import { VSBuffer } from 'vs/base/common/buffer'; -import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions'; import { IIntegrityService, IntegrityTestResult } from 'vs/workbench/services/integrity/common/integrity'; import { INativeWorkbenchConfiguration, INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { NativeParsedArgs } from 'vs/platform/environment/common/argv'; @@ -486,36 +485,6 @@ registerSingleton(IExtensionService, SimpleExtensionService); //#endregion -//#region Extensions Workbench (TODO@sandbox TODO@ben remove when 'semver-umd' can be loaded) - -class SimpleExtensionsWorkbenchService implements IExtensionsWorkbenchService { - - declare readonly _serviceBrand: undefined; - - onChange = Event.None; - - local = []; - installed = []; - outdated = []; - - queryGallery(...args: any[]): any { throw new Error('Method not implemented.'); } - install(...args: any[]): any { throw new Error('Method not implemented.'); } - queryLocal(server?: IExtensionManagementServer): Promise { throw new Error('Method not implemented.'); } - canInstall(extension: any): boolean { throw new Error('Method not implemented.'); } - uninstall(extension: any): Promise { throw new Error('Method not implemented.'); } - installVersion(extension: any, version: string): Promise { throw new Error('Method not implemented.'); } - reinstall(extension: any): Promise { throw new Error('Method not implemented.'); } - setEnablement(extensions: any | any[], enablementState: EnablementState): Promise { throw new Error('Method not implemented.'); } - open(extension: any, options?: { sideByside?: boolean | undefined; preserveFocus?: boolean | undefined; pinned?: boolean | undefined; }): Promise { throw new Error('Method not implemented.'); } - checkForUpdates(): Promise { throw new Error('Method not implemented.'); } - isExtensionIgnoredToSync(extension: any): boolean { throw new Error('Method not implemented.'); } - toggleExtensionIgnoredToSync(extension: any): Promise { throw new Error('Method not implemented.'); } -} - -registerSingleton(IExtensionsWorkbenchService, SimpleExtensionsWorkbenchService); - -//#endregion - //#region Telemetry class SimpleTelemetryService implements ITelemetryService { diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts index 936e9b0b78a..7745099c27a 100644 --- a/src/vs/workbench/workbench.web.main.ts +++ b/src/vs/workbench/workbench.web.main.ts @@ -131,7 +131,4 @@ import 'vs/workbench/contrib/welcome/telemetryOptOut/browser/telemetryOptOut.con // Issues import 'vs/workbench/contrib/issue/browser/issue.web.contribution'; -// Extensions Management (// TODO@sandbox TODO@ben move back into common/extensions.contribution.ts when 'semver-umd' can be loaded) -import 'vs/workbench/contrib/extensions/browser/extensions.web.contribution'; - //#endregion From ea830ff2ac4c58769a34d8a66caa383371aa63bf Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 18 Sep 2020 13:35:35 +0200 Subject: [PATCH 0119/1667] sandbox - lift themes.test.contribution --- .eslintrc.json | 29 +++++++++++++++---- .../themes.test.contribution.ts | 0 .../test/electron-browser/fixtures/foo.js | 14 --------- src/vs/workbench/workbench.desktop.main.ts | 3 -- src/vs/workbench/workbench.sandbox.main.ts | 3 ++ 5 files changed, 27 insertions(+), 22 deletions(-) rename src/vs/workbench/contrib/themes/{test/electron-browser => browser}/themes.test.contribution.ts (100%) delete mode 100644 src/vs/workbench/contrib/themes/test/electron-browser/fixtures/foo.js diff --git a/.eslintrc.json b/.eslintrc.json index df3c5ad560c..be9033a76e7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -521,7 +521,8 @@ "vscode-textmate", "vscode-oniguruma", "iconv-lite-umd", - "semver-umd" + "semver-umd", + "jschardet" ] }, { @@ -550,7 +551,10 @@ "**/vs/workbench/api/{common,browser}/**", "**/vs/workbench/services/**/{common,browser}/**", "vscode-textmate", - "vscode-oniguruma" + "vscode-oniguruma", + "iconv-lite-umd", + "semver-umd", + "jschardet" ] }, { @@ -576,7 +580,12 @@ "**/vs/editor/**", "**/vs/workbench/{common,browser,electron-sandbox}/**", "**/vs/workbench/api/{common,browser,electron-sandbox}/**", - "**/vs/workbench/services/**/{common,browser,electron-sandbox}/**" + "**/vs/workbench/services/**/{common,browser,electron-sandbox}/**", + "vscode-textmate", + "vscode-oniguruma", + "iconv-lite-umd", + "semver-umd", + "jschardet" ] }, { @@ -692,7 +701,12 @@ "**/vs/workbench/{common,browser}/**", "**/vs/workbench/api/{common,browser}/**", "**/vs/workbench/services/**/{common,browser}/**", - "**/vs/workbench/contrib/**/{common,browser}/**" + "**/vs/workbench/contrib/**/{common,browser}/**", + "vscode-textmate", + "vscode-oniguruma", + "iconv-lite-umd", + "semver-umd", + "jschardet" ] }, { @@ -721,7 +735,12 @@ "**/vs/workbench/{common,browser,electron-sandbox}/**", "**/vs/workbench/api/{common,browser,electron-sandbox}/**", "**/vs/workbench/services/**/{common,browser,electron-sandbox}/**", - "**/vs/workbench/contrib/**/{common,browser,electron-sandbox}/**" + "**/vs/workbench/contrib/**/{common,browser,electron-sandbox}/**", + "vscode-textmate", + "vscode-oniguruma", + "iconv-lite-umd", + "semver-umd", + "jschardet" ] }, { diff --git a/src/vs/workbench/contrib/themes/test/electron-browser/themes.test.contribution.ts b/src/vs/workbench/contrib/themes/browser/themes.test.contribution.ts similarity index 100% rename from src/vs/workbench/contrib/themes/test/electron-browser/themes.test.contribution.ts rename to src/vs/workbench/contrib/themes/browser/themes.test.contribution.ts diff --git a/src/vs/workbench/contrib/themes/test/electron-browser/fixtures/foo.js b/src/vs/workbench/contrib/themes/test/electron-browser/fixtures/foo.js deleted file mode 100644 index 469a6a71cb5..00000000000 --- a/src/vs/workbench/contrib/themes/test/electron-browser/fixtures/foo.js +++ /dev/null @@ -1,14 +0,0 @@ -const webdriver = require('selenium-webdriver'); - -function mergeObjects(target) { - var sources = []; - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - sources.forEach(function (source) { - for (var key in source) { - target[key] = source[key]; - } - }); - return target; -} \ No newline at end of file diff --git a/src/vs/workbench/workbench.desktop.main.ts b/src/vs/workbench/workbench.desktop.main.ts index 4cba33ba087..0ab43c45ed8 100644 --- a/src/vs/workbench/workbench.desktop.main.ts +++ b/src/vs/workbench/workbench.desktop.main.ts @@ -109,9 +109,6 @@ import 'vs/workbench/contrib/performance/electron-browser/performance.contributi // CLI import 'vs/workbench/contrib/cli/node/cli.contribution'; -// Themes Support -import 'vs/workbench/contrib/themes/test/electron-browser/themes.test.contribution'; - // Tasks import 'vs/workbench/contrib/tasks/electron-browser/taskService'; diff --git a/src/vs/workbench/workbench.sandbox.main.ts b/src/vs/workbench/workbench.sandbox.main.ts index 1c47201d9cf..21d988533f1 100644 --- a/src/vs/workbench/workbench.sandbox.main.ts +++ b/src/vs/workbench/workbench.sandbox.main.ts @@ -86,4 +86,7 @@ import 'vs/workbench/contrib/remote/electron-sandbox/remote.contribution'; // Configuration Exporter import 'vs/workbench/contrib/configExporter/electron-sandbox/configurationExportHelper.contribution'; +// Themes Support +import 'vs/workbench/contrib/themes/browser/themes.test.contribution'; + //#endregion From 16f925040312d9d224a5a2bddc0051ed3c17e97a Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 18 Sep 2020 13:35:59 +0200 Subject: [PATCH 0120/1667] fix compile error --- .../debug/test/electron-browser/debugANSIHandling.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/debug/test/electron-browser/debugANSIHandling.test.ts b/src/vs/workbench/contrib/debug/test/electron-browser/debugANSIHandling.test.ts index 1766397badb..b56194b265d 100644 --- a/src/vs/workbench/contrib/debug/test/electron-browser/debugANSIHandling.test.ts +++ b/src/vs/workbench/contrib/debug/test/electron-browser/debugANSIHandling.test.ts @@ -15,7 +15,7 @@ import { TestThemeService, TestColorTheme } from 'vs/platform/theme/test/common/ import { ansiColorMap } from 'vs/workbench/contrib/terminal/common/terminalColorRegistry'; import { DebugModel } from 'vs/workbench/contrib/debug/common/debugModel'; import { DebugSession } from 'vs/workbench/contrib/debug/browser/debugSession'; -import { createMockDebugModel } from 'vs/workbench/contrib/debug/test/common/mockDebug'; +import { createMockDebugModel } from 'vs/workbench/contrib/debug/test/browser/mockDebug'; import { createMockSession } from 'vs/workbench/contrib/debug/test/browser/callStack.test'; suite('Debug - ANSI Handling', () => { From a5e97025557282d843f5124dc1c2652fe57df78e Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 18 Sep 2020 13:41:05 +0200 Subject: [PATCH 0121/1667] sandbox - lift textmate worker to electron-sandbox --- .../sandbox.simpleservices.ts | 22 ------------------- .../textMateService.ts | 2 +- .../textMateWorker.ts | 2 +- src/vs/workbench/workbench.desktop.main.ts | 1 - src/vs/workbench/workbench.sandbox.main.ts | 1 + 5 files changed, 3 insertions(+), 25 deletions(-) rename src/vs/workbench/services/textMate/{electron-browser => electron-sandbox}/textMateService.ts (99%) rename src/vs/workbench/services/textMate/{electron-browser => electron-sandbox}/textMateWorker.ts (99%) diff --git a/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts b/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts index 9586ea57317..ab99d719b87 100644 --- a/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts +++ b/src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts @@ -39,8 +39,6 @@ import { IWebviewService, WebviewContentOptions, WebviewElement, WebviewExtensio import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { AbstractTextFileService } from 'vs/workbench/services/textfile/browser/textFileService'; import { ExtensionRecommendationReason, IExtensionManagementServer, IExtensionManagementServerService, IExtensionRecommendation } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; -import { LanguageId, TokenizationRegistry } from 'vs/editor/common/modes'; -import { IGrammar, ITextMateService } from 'vs/workbench/services/textMate/common/textMateService'; import { ITunnelProvider, ITunnelService, RemoteTunnel } from 'vs/platform/remote/common/tunnel'; import { Disposable, IDisposable } from 'vs/base/common/lifecycle'; import { IManualSyncTask, IResourcePreview, ISyncResourceHandle, ISyncTask, IUserDataAutoSyncService, IUserDataSyncService, IUserDataSyncStore, IUserDataSyncStoreManagementService, SyncResource, SyncStatus, UserDataSyncStoreType } from 'vs/platform/userDataSync/common/userDataSync'; @@ -55,7 +53,6 @@ import { TaskSystemInfo } from 'vs/workbench/contrib/tasks/common/taskSystem'; import { IExtensionTipsService, IConfigBasedExtensionTip, IExecutableBasedExtensionTip, IWorkspaceTips } from 'vs/platform/extensionManagement/common/extensionManagement'; import { IWorkspaceTagsService, Tags } from 'vs/workbench/contrib/tags/common/workspaceTags'; import { AsbtractOutputChannelModelService, IOutputChannelModelService } from 'vs/workbench/services/output/common/outputChannelModel'; -import { Color, RGBA } from 'vs/base/common/color'; import { joinPath } from 'vs/base/common/resources'; import { VSBuffer } from 'vs/base/common/buffer'; import { IIntegrityService, IntegrityTestResult } from 'vs/workbench/services/integrity/common/integrity'; @@ -595,25 +592,6 @@ registerSingleton(IExtensionManagementServerService, SimpleExtensionManagementSe //#endregion -//#region Textmate - -TokenizationRegistry.setColorMap([null!, new Color(new RGBA(212, 212, 212, 1)), new Color(new RGBA(30, 30, 30, 1))]); - -class SimpleTextMateService implements ITextMateService { - - declare readonly _serviceBrand: undefined; - - readonly onDidEncounterLanguage: Event = Event.None; - - async createGrammar(modeId: string): Promise { return null; } - startDebugMode(printFn: (str: string) => void, onStop: () => void): void { } -} - -registerSingleton(ITextMateService, SimpleTextMateService); - -//#endregion - - //#region Tunnel class SimpleTunnelService implements ITunnelService { diff --git a/src/vs/workbench/services/textMate/electron-browser/textMateService.ts b/src/vs/workbench/services/textMate/electron-sandbox/textMateService.ts similarity index 99% rename from src/vs/workbench/services/textMate/electron-browser/textMateService.ts rename to src/vs/workbench/services/textMate/electron-sandbox/textMateService.ts index 1b01a674aa1..57f6cda6726 100644 --- a/src/vs/workbench/services/textMate/electron-browser/textMateService.ts +++ b/src/vs/workbench/services/textMate/electron-sandbox/textMateService.ts @@ -15,7 +15,7 @@ import { createWebWorker, MonacoWebWorker } from 'vs/editor/common/services/webW import { IModelService } from 'vs/editor/common/services/modelService'; import type { IRawTheme } from 'vscode-textmate'; import { IValidGrammarDefinition } from 'vs/workbench/services/textMate/common/TMScopeRegistry'; -import { TextMateWorker } from 'vs/workbench/services/textMate/electron-browser/textMateWorker'; +import { TextMateWorker } from 'vs/workbench/services/textMate/electron-sandbox/textMateWorker'; import { ITextModel } from 'vs/editor/common/model'; import { Disposable } from 'vs/base/common/lifecycle'; import { UriComponents, URI } from 'vs/base/common/uri'; diff --git a/src/vs/workbench/services/textMate/electron-browser/textMateWorker.ts b/src/vs/workbench/services/textMate/electron-sandbox/textMateWorker.ts similarity index 99% rename from src/vs/workbench/services/textMate/electron-browser/textMateWorker.ts rename to src/vs/workbench/services/textMate/electron-sandbox/textMateWorker.ts index 8a3f0ffb48a..bf62c5393a9 100644 --- a/src/vs/workbench/services/textMate/electron-browser/textMateWorker.ts +++ b/src/vs/workbench/services/textMate/electron-sandbox/textMateWorker.ts @@ -9,7 +9,7 @@ import { LanguageId } from 'vs/editor/common/modes'; import { IValidEmbeddedLanguagesMap, IValidTokenTypeMap, IValidGrammarDefinition } from 'vs/workbench/services/textMate/common/TMScopeRegistry'; import { TMGrammarFactory, ICreateGrammarResult } from 'vs/workbench/services/textMate/common/TMGrammarFactory'; import { IModelChangedEvent, MirrorTextModel } from 'vs/editor/common/model/mirrorTextModel'; -import { TextMateWorkerHost } from 'vs/workbench/services/textMate/electron-browser/textMateService'; +import { TextMateWorkerHost } from 'vs/workbench/services/textMate/electron-sandbox/textMateService'; import { TokenizationStateStore } from 'vs/editor/common/model/textModelTokens'; import type { IGrammar, StackElement, IRawTheme, IOnigLib } from 'vscode-textmate'; import { MultilineTokensBuilder, countEOL } from 'vs/editor/common/model/tokensStore'; diff --git a/src/vs/workbench/workbench.desktop.main.ts b/src/vs/workbench/workbench.desktop.main.ts index 0ab43c45ed8..50a7428a2a5 100644 --- a/src/vs/workbench/workbench.desktop.main.ts +++ b/src/vs/workbench/workbench.desktop.main.ts @@ -35,7 +35,6 @@ import 'vs/workbench/electron-browser/desktop.main'; //#region --- workbench services import 'vs/workbench/services/integrity/node/integrityService'; -import 'vs/workbench/services/textMate/electron-browser/textMateService'; import 'vs/workbench/services/search/electron-browser/searchService'; import 'vs/workbench/services/output/electron-browser/outputChannelModelService'; import 'vs/workbench/services/textfile/electron-browser/nativeTextFileService'; diff --git a/src/vs/workbench/workbench.sandbox.main.ts b/src/vs/workbench/workbench.sandbox.main.ts index 21d988533f1..5baed439d7d 100644 --- a/src/vs/workbench/workbench.sandbox.main.ts +++ b/src/vs/workbench/workbench.sandbox.main.ts @@ -21,6 +21,7 @@ import 'vs/workbench/workbench.common.main'; import 'vs/workbench/services/dialogs/electron-sandbox/fileDialogService'; import 'vs/workbench/services/workspaces/electron-sandbox/workspacesService'; +import 'vs/workbench/services/textMate/electron-sandbox/textMateService'; import 'vs/workbench/services/userDataSync/electron-sandbox/storageKeysSyncRegistryService'; import 'vs/workbench/services/menubar/electron-sandbox/menubarService'; import 'vs/workbench/services/dialogs/electron-sandbox/dialogService'; From eed5b841e52d6bf95963897124ed54dcb6712ce2 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 18 Sep 2020 13:41:57 +0200 Subject: [PATCH 0122/1667] sandbox - move userdata sync related services to electron-sandbox --- src/vs/workbench/workbench.desktop.main.ts | 5 ----- src/vs/workbench/workbench.sandbox.main.ts | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/workbench.desktop.main.ts b/src/vs/workbench/workbench.desktop.main.ts index 50a7428a2a5..acf5c492a18 100644 --- a/src/vs/workbench/workbench.desktop.main.ts +++ b/src/vs/workbench/workbench.desktop.main.ts @@ -60,14 +60,9 @@ import { ICredentialsService } from 'vs/platform/credentials/common/credentials' import { KeytarCredentialsService } from 'vs/platform/credentials/node/credentialsService'; import { ITunnelService } from 'vs/platform/remote/common/tunnel'; import { TunnelService } from 'vs/platform/remote/node/tunnelService'; -import { IUserDataInitializationService, UserDataInitializationService } from 'vs/workbench/services/userData/browser/userDataInit'; -import { IUserDataSyncResourceEnablementService } from 'vs/platform/userDataSync/common/userDataSync'; -import { UserDataSyncResourceEnablementService } from 'vs/platform/userDataSync/common/userDataSyncResourceEnablementService'; registerSingleton(ICredentialsService, KeytarCredentialsService, true); registerSingleton(ITunnelService, TunnelService); -registerSingleton(IUserDataSyncResourceEnablementService, UserDataSyncResourceEnablementService); -registerSingleton(IUserDataInitializationService, UserDataInitializationService); //#endregion diff --git a/src/vs/workbench/workbench.sandbox.main.ts b/src/vs/workbench/workbench.sandbox.main.ts index 5baed439d7d..70725dd5561 100644 --- a/src/vs/workbench/workbench.sandbox.main.ts +++ b/src/vs/workbench/workbench.sandbox.main.ts @@ -45,8 +45,13 @@ import 'vs/workbench/services/extensionManagement/electron-sandbox/extensionMana import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { ITimerService } from 'vs/workbench/services/timer/browser/timerService'; import { TimerService } from 'vs/workbench/services/timer/electron-sandbox/timerService'; +import { IUserDataInitializationService, UserDataInitializationService } from 'vs/workbench/services/userData/browser/userDataInit'; +import { IUserDataSyncResourceEnablementService } from 'vs/platform/userDataSync/common/userDataSync'; +import { UserDataSyncResourceEnablementService } from 'vs/platform/userDataSync/common/userDataSyncResourceEnablementService'; registerSingleton(ITimerService, TimerService); +registerSingleton(IUserDataSyncResourceEnablementService, UserDataSyncResourceEnablementService); +registerSingleton(IUserDataInitializationService, UserDataInitializationService); //#endregion From f48144748c23f50693e8d766e11f5d5f3f3aa21b Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 18 Sep 2020 13:53:12 +0200 Subject: [PATCH 0123/1667] Fixes #106941 --- src/vs/editor/common/config/editorOptions.ts | 4 ++-- src/vs/workbench/browser/parts/editor/editorStatus.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 19f6b1a3281..c3029be4d43 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -1030,11 +1030,11 @@ class EditorAccessibilitySupport extends BaseEditorOption { From e081ad86c870697ef89e408c027f9136d4bc7ce9 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Fri, 18 Sep 2020 15:39:39 +0200 Subject: [PATCH 0124/1667] use always default url when cannot be switched --- .../platform/userDataSync/common/userDataSyncStoreService.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/platform/userDataSync/common/userDataSyncStoreService.ts b/src/vs/platform/userDataSync/common/userDataSyncStoreService.ts index 59e8d8fb0d2..fe6f311f9cd 100644 --- a/src/vs/platform/userDataSync/common/userDataSyncStoreService.ts +++ b/src/vs/platform/userDataSync/common/userDataSyncStoreService.ts @@ -65,7 +65,8 @@ export abstract class AbstractUserDataSyncStoreManagementService extends Disposa && Object.keys(value.authenticationProviders).every(authenticationProviderId => isArray(value!.authenticationProviders![authenticationProviderId].scopes)) ) { const syncStore = value as ConfigurationSyncStore; - const type: UserDataSyncStoreType | undefined = this.storageService.get(SYNC_SERVICE_URL_TYPE, StorageScope.GLOBAL) as UserDataSyncStoreType | undefined; + const canSwitch = !!syncStore.canSwitch && !configuredStore?.url; + const type: UserDataSyncStoreType | undefined = canSwitch ? this.storageService.get(SYNC_SERVICE_URL_TYPE, StorageScope.GLOBAL) as UserDataSyncStoreType : undefined; const url = configuredStore?.url || type === 'insiders' ? syncStore.insidersUrl : type === 'stable' ? syncStore.stableUrl From cf211eeb9bca18a624a1dca210030827359f8014 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Fri, 18 Sep 2020 16:23:41 +0200 Subject: [PATCH 0125/1667] Show custom tree hovers below and offset Part of #106095 --- src/vs/workbench/contrib/views/browser/treeView.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/views/browser/treeView.ts b/src/vs/workbench/contrib/views/browser/treeView.ts index 695f7ff8883..c18c4d293f8 100644 --- a/src/vs/workbench/contrib/views/browser/treeView.ts +++ b/src/vs/workbench/contrib/views/browser/treeView.ts @@ -43,6 +43,7 @@ import { ActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems'; import { IMarkdownString } from 'vs/base/common/htmlContent'; import { isMacintosh } from 'vs/base/common/platform'; import { ColorScheme } from 'vs/platform/theme/common/theme'; +import { AnchorPosition } from 'vs/base/browser/ui/contextview/contextview'; class Root implements ITreeItem { label = { label: 'root' }; @@ -856,10 +857,10 @@ class TreeRenderer extends Disposable implements ITreeRenderer { } }; - hoverOptions = { text: tooltip, target }; + hoverOptions = { text: tooltip, target, anchorPosition: AnchorPosition.BELOW }; } if (mouseX !== undefined) { - (hoverOptions.target).x = mouseX; + (hoverOptions.target).x = mouseX + 10; } hoverService.showHover(hoverOptions); } From e85114b2a37fea98ea7b3dde5dc924e58c238ad4 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 18 Sep 2020 17:07:40 +0200 Subject: [PATCH 0126/1667] sandbox - add pedantic comments to prevent electron-browser usage --- .../electron-browser/desktop.main.ts | 59 +++++++++- .../electron-sandbox/desktop.main.ts | 58 +++++++++- src/vs/workbench/workbench.desktop.main.ts | 104 +++++++++++++++++- 3 files changed, 208 insertions(+), 13 deletions(-) diff --git a/src/vs/workbench/electron-browser/desktop.main.ts b/src/vs/workbench/electron-browser/desktop.main.ts index 8326d04ea80..f016f9afd4a 100644 --- a/src/vs/workbench/electron-browser/desktop.main.ts +++ b/src/vs/workbench/electron-browser/desktop.main.ts @@ -164,10 +164,19 @@ class DesktopMain extends Disposable { private async initServices(): Promise<{ serviceCollection: ServiceCollection, logService: ILogService, storageService: NativeStorageService }> { const serviceCollection = new ServiceCollection(); - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // NOTE: DO NOT ADD ANY OTHER SERVICE INTO THE COLLECTION HERE. - // CONTRIBUTE IT VIA WORKBENCH.DESKTOP.MAIN.TS AND registerSingleton(). - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // Main Process const mainProcessService = this._register(new MainProcessService(this.configuration.windowId)); @@ -188,6 +197,20 @@ class DesktopMain extends Disposable { const remoteAuthorityResolverService = new RemoteAuthorityResolverService(); serviceCollection.set(IRemoteAuthorityResolverService, remoteAuthorityResolverService); + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + // Sign const signService = new SignService(); serviceCollection.set(ISignService, signService); @@ -210,6 +233,20 @@ class DesktopMain extends Disposable { // User Data Provider fileService.registerProvider(Schemas.userData, new FileUserDataProvider(this.environmentService.appSettingsHome, this.environmentService.configuration.backupPath ? URI.file(this.environmentService.configuration.backupPath) : undefined, diskFileSystemProvider, this.environmentService, logService)); + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + const connection = remoteAgentService.getConnection(); if (connection) { const remoteFileSystemProvider = this._register(new RemoteFileSystemProvider(remoteAgentService)); @@ -242,6 +279,20 @@ class DesktopMain extends Disposable { }) ]); + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + return { serviceCollection, logService, storageService: services[1] }; } diff --git a/src/vs/workbench/electron-sandbox/desktop.main.ts b/src/vs/workbench/electron-sandbox/desktop.main.ts index 670fae19c84..6fe191f5a5b 100644 --- a/src/vs/workbench/electron-sandbox/desktop.main.ts +++ b/src/vs/workbench/electron-sandbox/desktop.main.ts @@ -140,10 +140,18 @@ class DesktopMain extends Disposable { private async initServices(): Promise<{ serviceCollection: ServiceCollection, logService: ILogService, storageService: SimpleStorageService }> { const serviceCollection = new ServiceCollection(); - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // NOTE: DO NOT ADD ANY OTHER SERVICE INTO THE COLLECTION HERE. - // CONTRIBUTE IT VIA WORKBENCH.DESKTOP.MAIN.TS AND registerSingleton(). - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // Main Process const mainProcessService = this._register(new MainProcessService(this.configuration.windowId)); @@ -173,6 +181,20 @@ class DesktopMain extends Disposable { const remoteAgentService = new SimpleRemoteAgentService(); serviceCollection.set(IRemoteAgentService, remoteAgentService); + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + // Native Host const nativeHostService = new NativeHostService(this.configuration.windowId, mainProcessService) as INativeHostService; serviceCollection.set(INativeHostService, nativeHostService); @@ -195,6 +217,20 @@ class DesktopMain extends Disposable { const resourceIdentityService = new SimpleResourceIdentityService(); serviceCollection.set(IResourceIdentityService, resourceIdentityService); + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + const services = await Promise.all([ this.createWorkspaceService().then(service => { @@ -216,6 +252,20 @@ class DesktopMain extends Disposable { }) ]); + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + return { serviceCollection, logService, storageService: services[1] }; } diff --git a/src/vs/workbench/workbench.desktop.main.ts b/src/vs/workbench/workbench.desktop.main.ts index acf5c492a18..5d4c5a42109 100644 --- a/src/vs/workbench/workbench.desktop.main.ts +++ b/src/vs/workbench/workbench.desktop.main.ts @@ -4,11 +4,16 @@ *--------------------------------------------------------------------------------------------*/ -// ####################################################################### -// ### ### -// ### !!! PLEASE ADD COMMON IMPORTS INTO WORKBENCH.COMMON.MAIN.TS !!! ### -// ### ### -// ####################################################################### +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //#region --- workbench common & sandbox @@ -25,6 +30,18 @@ import 'vs/workbench/electron-browser/actions/developerActions'; //#endregion +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //#region --- workbench (desktop main) import 'vs/workbench/electron-browser/desktop.main'; @@ -34,6 +51,19 @@ import 'vs/workbench/electron-browser/desktop.main'; //#region --- workbench services + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + import 'vs/workbench/services/integrity/node/integrityService'; import 'vs/workbench/services/search/electron-browser/searchService'; import 'vs/workbench/services/output/electron-browser/outputChannelModelService'; @@ -55,6 +85,19 @@ import 'vs/workbench/services/localizations/electron-browser/localizationsServic import 'vs/workbench/services/diagnostics/electron-browser/diagnosticsService'; import 'vs/workbench/services/experiment/electron-browser/experimentService'; + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { ICredentialsService } from 'vs/platform/credentials/common/credentials'; import { KeytarCredentialsService } from 'vs/platform/credentials/node/credentialsService'; @@ -67,6 +110,18 @@ registerSingleton(ITunnelService, TunnelService); //#endregion +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //#region --- workbench contributions // Tags @@ -82,6 +137,19 @@ import 'vs/workbench/contrib/debug/node/debugHelperService'; // Webview import 'vs/workbench/contrib/webview/electron-browser/webview.contribution'; + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + // Notebook import 'vs/workbench/contrib/notebook/electron-browser/notebook.contribution'; @@ -97,6 +165,19 @@ import 'vs/workbench/contrib/codeEditor/electron-browser/codeEditor.contribution // External Terminal import 'vs/workbench/contrib/externalTerminal/node/externalTerminal.contribution'; + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + // Performance import 'vs/workbench/contrib/performance/electron-browser/performance.contribution'; @@ -109,4 +190,17 @@ import 'vs/workbench/contrib/tasks/electron-browser/taskService'; // User Data Sync import 'vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution'; + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //#endregion From c4aa0108356fb01af46d3d09b7bd7213169af632 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 18 Sep 2020 17:23:50 +0200 Subject: [PATCH 0127/1667] sandbox - expose `vscode-windows-registry` from native host service --- src/vs/platform/native/common/native.ts | 3 +++ .../native/electron-main/nativeHostMainService.ts | 15 +++++++++++++++ .../tags/electron-browser/workspaceTags.ts | 12 ++++-------- .../electron-sandbox/accessibilityService.ts | 14 ++++---------- .../electron-browser/workbenchTestServices.ts | 1 + 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/vs/platform/native/common/native.ts b/src/vs/platform/native/common/native.ts index f9e86140edc..e1acb200a6e 100644 --- a/src/vs/platform/native/common/native.ts +++ b/src/vs/platform/native/common/native.ts @@ -135,4 +135,7 @@ export interface ICommonNativeHostService { // Connectivity resolveProxy(url: string): Promise; + + // Registry (windows only) + windowsGetStringRegKey(hive: 'HKEY_CURRENT_USER' | 'HKEY_LOCAL_MACHINE' | 'HKEY_CLASSES_ROOT' | 'HKEY_USERS' | 'HKEY_CURRENT_CONFIG', path: string, name: string): Promise; } diff --git a/src/vs/platform/native/electron-main/nativeHostMainService.ts b/src/vs/platform/native/electron-main/nativeHostMainService.ts index fbe0e31ada4..924f823e7f8 100644 --- a/src/vs/platform/native/electron-main/nativeHostMainService.ts +++ b/src/vs/platform/native/electron-main/nativeHostMainService.ts @@ -527,6 +527,21 @@ export class NativeHostMainService implements INativeHostMainService { //#endregion + //#region Registry (windows) + + async windowsGetStringRegKey(windowId: number | undefined, hive: 'HKEY_CURRENT_USER' | 'HKEY_LOCAL_MACHINE' | 'HKEY_CLASSES_ROOT' | 'HKEY_USERS' | 'HKEY_CURRENT_CONFIG', path: string, name: string): Promise { + if (!isWindows) { + return undefined; + } + + const Registry = await import('vscode-windows-registry'); + try { + return Registry.GetStringRegKey(hive, path, name); + } catch { + return undefined; + } + } + private windowById(windowId: number | undefined): ICodeWindow | undefined { if (typeof windowId !== 'number') { return undefined; diff --git a/src/vs/workbench/contrib/tags/electron-browser/workspaceTags.ts b/src/vs/workbench/contrib/tags/electron-browser/workspaceTags.ts index 43cc4d58f3a..1d722fdf6ec 100644 --- a/src/vs/workbench/contrib/tags/electron-browser/workspaceTags.ts +++ b/src/vs/workbench/contrib/tags/electron-browser/workspaceTags.ts @@ -17,6 +17,7 @@ import { IRequestService } from 'vs/platform/request/common/request'; import { isWindows } from 'vs/base/common/platform'; import { getRemotes, AllowedSecondLevelDomains, getDomainsOfRemotes } from 'vs/platform/extensionManagement/common/configRemotes'; import { IDiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; export function getHashedRemotesFromConfig(text: string, stripEndingDotGit: boolean = false): string[] { return getRemotes(text, stripEndingDotGit).map(r => { @@ -33,7 +34,8 @@ export class WorkspaceTags implements IWorkbenchContribution { @IRequestService private readonly requestService: IRequestService, @ITextFileService private readonly textFileService: ITextFileService, @IWorkspaceTagsService private readonly workspaceTagsService: IWorkspaceTagsService, - @IDiagnosticsService private readonly diagnosticsService: IDiagnosticsService + @IDiagnosticsService private readonly diagnosticsService: IDiagnosticsService, + @INativeHostService private readonly nativeHostService: INativeHostService ) { if (this.telemetryService.isOptedIn) { this.report(); @@ -61,13 +63,7 @@ export class WorkspaceTags implements IWorkbenchContribution { return; } - const Registry = await import('vscode-windows-registry'); - - let value; - try { - value = Registry.GetStringRegKey('HKEY_LOCAL_MACHINE', 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion', 'EditionID'); - } catch { } - + let value = await this.nativeHostService.windowsGetStringRegKey('HKEY_LOCAL_MACHINE', 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion', 'EditionID'); if (value === undefined) { value = 'Unknown'; } diff --git a/src/vs/workbench/services/accessibility/electron-sandbox/accessibilityService.ts b/src/vs/workbench/services/accessibility/electron-sandbox/accessibilityService.ts index 3bdc5475c05..2532a631061 100644 --- a/src/vs/workbench/services/accessibility/electron-sandbox/accessibilityService.ts +++ b/src/vs/workbench/services/accessibility/electron-sandbox/accessibilityService.ts @@ -15,6 +15,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IJSONEditingService } from 'vs/workbench/services/configuration/common/jsonEditing'; import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; interface AccessibilityMetrics { enabled: boolean; @@ -33,7 +34,8 @@ export class NativeAccessibilityService extends AccessibilityService implements @INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, @IContextKeyService contextKeyService: IContextKeyService, @IConfigurationService configurationService: IConfigurationService, - @ITelemetryService private readonly _telemetryService: ITelemetryService + @ITelemetryService private readonly _telemetryService: ITelemetryService, + @INativeHostService private readonly nativeHostService: INativeHostService ) { super(contextKeyService, configurationService); this.setAccessibilitySupport(environmentService.configuration.accessibilitySupport ? AccessibilitySupport.Enabled : AccessibilitySupport.Disabled); @@ -44,15 +46,7 @@ export class NativeAccessibilityService extends AccessibilityService implements return false; } - const Registry = await import('vscode-windows-registry'); - - let value: string | undefined = undefined; - try { - value = Registry.GetStringRegKey('HKEY_CURRENT_USER', 'Control Panel\\Accessibility\\Keyboard Preference', 'On'); - } catch { - return false; - } - + const value = await this.nativeHostService.windowsGetStringRegKey('HKEY_CURRENT_USER', 'Control Panel\\Accessibility\\Keyboard Preference', 'On'); return value === '1'; } diff --git a/src/vs/workbench/test/electron-browser/workbenchTestServices.ts b/src/vs/workbench/test/electron-browser/workbenchTestServices.ts index 27879201c65..397a07aa50d 100644 --- a/src/vs/workbench/test/electron-browser/workbenchTestServices.ts +++ b/src/vs/workbench/test/electron-browser/workbenchTestServices.ts @@ -230,6 +230,7 @@ export class TestNativeHostService implements INativeHostService { async readClipboardBuffer(format: string): Promise { return Uint8Array.from([]); } async hasClipboard(format: string, type?: 'selection' | 'clipboard' | undefined): Promise { return false; } async sendInputEvent(event: MouseInputEvent): Promise { } + async windowsGetStringRegKey(hive: 'HKEY_CURRENT_USER' | 'HKEY_LOCAL_MACHINE' | 'HKEY_CLASSES_ROOT' | 'HKEY_USERS' | 'HKEY_CURRENT_CONFIG', path: string, name: string): Promise { return undefined; } } export function workbenchInstantiationService(): ITestInstantiationService { From ce95d7e826341a81c2e39be7083a0691965a7824 Mon Sep 17 00:00:00 2001 From: isidor Date: Fri, 18 Sep 2020 18:12:21 +0200 Subject: [PATCH 0128/1667] tune hover behavior to allow alt to switch from debug hover to regular hover and that the mouse move does not hide the regular hover fixes #84561 --- src/vs/editor/contrib/hover/hover.ts | 3 +-- .../workbench/contrib/debug/browser/debugEditorContribution.ts | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/vs/editor/contrib/hover/hover.ts b/src/vs/editor/contrib/hover/hover.ts index 01b4416ffc5..ad75081cfcb 100644 --- a/src/vs/editor/contrib/hover/hover.ts +++ b/src/vs/editor/contrib/hover/hover.ts @@ -78,7 +78,6 @@ export class ModesHoverController implements IEditorContribution { this._didChangeConfigurationHandler = this._editor.onDidChangeConfiguration((e: ConfigurationChangedEvent) => { if (e.hasChanged(EditorOption.hover)) { - this._hideWidgets(); this._unhookEvents(); this._hookEvents(); } @@ -100,7 +99,7 @@ export class ModesHoverController implements IEditorContribution { this._toUnhook.add(this._editor.onKeyDown((e: IKeyboardEvent) => this._onKeyDown(e))); this._toUnhook.add(this._editor.onDidChangeModelDecorations(() => this._onModelDecorationsChanged())); } else { - this._toUnhook.add(this._editor.onMouseMove(hideWidgetsEventHandler)); + this._toUnhook.add(this._editor.onMouseMove((e: IEditorMouseEvent) => this._onEditorMouseMove(e))); this._toUnhook.add(this._editor.onKeyDown((e: IKeyboardEvent) => this._onKeyDown(e))); } diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts index b542a23788f..de9fb51967e 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts @@ -269,9 +269,6 @@ export class DebugEditorContribution implements IDebugEditorContribution { this.altPressed = false; this.editor.updateOptions({ hover: { enabled: false } }); listener.dispose(); - if (this.hoverRange && debugHoverWasVisible) { - this.showHover(this.hoverRange, false); - } } }); } From 50610f085d7fa5b052be075e9b33c25df41a5e8b Mon Sep 17 00:00:00 2001 From: isidor Date: Fri, 18 Sep 2020 18:44:17 +0200 Subject: [PATCH 0129/1667] callstack improvements #106957 --- src/vs/workbench/contrib/debug/browser/callStackView.ts | 6 +++--- src/vs/workbench/contrib/debug/common/debugModel.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/callStackView.ts b/src/vs/workbench/contrib/debug/browser/callStackView.ts index 98c9981b6e0..a8cab113767 100644 --- a/src/vs/workbench/contrib/debug/browser/callStackView.ts +++ b/src/vs/workbench/contrib/debug/browser/callStackView.ts @@ -156,7 +156,7 @@ export class CallStackView extends ViewPane { const thread = sessions.length === 1 && sessions[0].getAllThreads().length === 1 ? sessions[0].getAllThreads()[0] : undefined; if (thread && thread.stoppedDetails) { - this.pauseMessageLabel.textContent = thread.stoppedDetails.description || nls.localize('debugStopped', "Paused on {0}", thread.stoppedDetails.reason || ''); + this.pauseMessageLabel.textContent = thread.stateLabel; this.pauseMessageLabel.title = thread.stoppedDetails.text || ''; this.pauseMessageLabel.classList.toggle('exception', thread.stoppedDetails.reason === 'exception'); this.pauseMessage.hidden = false; @@ -547,7 +547,7 @@ class SessionsRenderer implements ICompressibleTreeRenderer Date: Fri, 18 Sep 2020 10:00:39 -0700 Subject: [PATCH 0130/1667] Move tas-client to umd version and adopt in web (#106904) * adopt tas-client-umd * adopt in web * fix whitespace * adding tas-client to webignore * upgrade tas-client-umd * move svc imort to common * remove unnecessary ignore --- .eslintrc.json | 1 + cglicenses.json | 2 +- package.json | 2 +- remote/web/package.json | 1 + remote/web/yarn.lock | 5 + .../code/browser/workbench/workbench-dev.html | 1 + src/vs/code/browser/workbench/workbench.html | 1 + .../experiment/common/experimentService.ts | 222 ++++++++++++++++- .../electron-browser/experimentService.ts | 227 ------------------ src/vs/workbench/workbench.common.main.ts | 1 + yarn.lock | 26 +- 11 files changed, 238 insertions(+), 251 deletions(-) delete mode 100644 src/vs/workbench/services/experiment/electron-browser/experimentService.ts diff --git a/.eslintrc.json b/.eslintrc.json index be9033a76e7..48a9de7c3bb 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -522,6 +522,7 @@ "vscode-oniguruma", "iconv-lite-umd", "semver-umd", + "tas-client-umd", "jschardet" ] }, diff --git a/cglicenses.json b/cglicenses.json index 0c3b576a68b..97fcf2b74f6 100644 --- a/cglicenses.json +++ b/cglicenses.json @@ -348,7 +348,7 @@ }, { // Reason: The license cannot be found by the tool due to access controls on the repository - "name": "tas-client", + "name": "tas-client-umd", "fullLicenseText": [ "MIT License", "Copyright (c) 2020 - present Microsoft Corporation", diff --git a/package.json b/package.json index 998e7866fea..d509ab5e401 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "semver-umd": "^5.5.7", "spdlog": "^0.11.1", "sudo-prompt": "9.1.1", - "tas-client": "^0.0.950", + "tas-client-umd": "^0.1.1", "v8-inspect-profiler": "^0.0.20", "vscode-nsfw": "1.2.8", "vscode-oniguruma": "1.3.1", diff --git a/remote/web/package.json b/remote/web/package.json index 4b7583d16f4..be80c6d8ad6 100644 --- a/remote/web/package.json +++ b/remote/web/package.json @@ -5,6 +5,7 @@ "iconv-lite-umd": "0.6.8", "jschardet": "2.2.1", "semver-umd": "^5.5.7", + "tas-client-umd": "0.1.1", "vscode-oniguruma": "1.3.1", "vscode-textmate": "5.2.0", "xterm": "4.10.0-beta.4", diff --git a/remote/web/yarn.lock b/remote/web/yarn.lock index 290b21742a1..9ee229a0788 100644 --- a/remote/web/yarn.lock +++ b/remote/web/yarn.lock @@ -17,6 +17,11 @@ semver-umd@^5.5.7: resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.7.tgz#966beb5e96c7da6fbf09c3da14c2872d6836c528" integrity sha512-XgjPNlD0J6aIc8xoTN6GQGwWc2Xg0kq8NzrqMVuKG/4Arl6ab1F8+Am5Y/XKKCR+FceFr2yN/Uv5ZJBhRyRqKg== +tas-client-umd@0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/tas-client-umd/-/tas-client-umd-0.1.1.tgz#a858ced3d3af5989a505f5b6bc961e4ff33ab1a4" + integrity sha512-vWp7WNBL+tMifW3k1HJb9fmmJhvbu+zIYtvQbx5w04hCl8KXuhfc59fu//Cx31WZiKcfTaIw/WPB47hzYGuh8A== + vscode-oniguruma@1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.3.1.tgz#e2383879c3485b19f533ec34efea9d7a2b14be8f" diff --git a/src/vs/code/browser/workbench/workbench-dev.html b/src/vs/code/browser/workbench/workbench-dev.html index 381d7991ec1..2c6b03fa249 100644 --- a/src/vs/code/browser/workbench/workbench-dev.html +++ b/src/vs/code/browser/workbench/workbench-dev.html @@ -42,6 +42,7 @@ 'xterm-addon-unicode11': `${window.location.origin}/static/remote/web/node_modules/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`, 'xterm-addon-webgl': `${window.location.origin}/static/remote/web/node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`, 'semver-umd': `${window.location.origin}/static/remote/web/node_modules/semver-umd/lib/semver-umd.js`, + 'tas-client-umd': `${window.location.origin}/static/remote/web/node_modules/tas-client-umd/lib/tas-client-umd.js`, 'iconv-lite-umd': `${window.location.origin}/static/remote/web/node_modules/iconv-lite-umd/lib/iconv-lite-umd.js`, 'jschardet': `${window.location.origin}/static/remote/web/node_modules/jschardet/dist/jschardet.min.js`, } diff --git a/src/vs/code/browser/workbench/workbench.html b/src/vs/code/browser/workbench/workbench.html index 06fcdd8d055..e54ca79ca50 100644 --- a/src/vs/code/browser/workbench/workbench.html +++ b/src/vs/code/browser/workbench/workbench.html @@ -43,6 +43,7 @@ 'xterm-addon-unicode11': `${window.location.origin}/static/node_modules/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`, 'xterm-addon-webgl': `${window.location.origin}/static/node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`, 'semver-umd': `${window.location.origin}/static/node_modules/semver-umd/lib/semver-umd.js`, + 'tas-client-umd': `${window.location.origin}/static/node_modules/tas-client-umd/lib/tas-client-umd.js`, 'iconv-lite-umd': `${window.location.origin}/static/node_modules/iconv-lite-umd/lib/iconv-lite-umd.js`, 'jschardet': `${window.location.origin}/static/node_modules/jschardet/dist/jschardet.min.js`, } diff --git a/src/vs/workbench/services/experiment/common/experimentService.ts b/src/vs/workbench/services/experiment/common/experimentService.ts index 758c525e263..dc84569d6dc 100644 --- a/src/vs/workbench/services/experiment/common/experimentService.ts +++ b/src/vs/workbench/services/experiment/common/experimentService.ts @@ -3,7 +3,15 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import * as platform from 'vs/base/common/platform'; +import type { IKeyValueStorage, IExperimentationTelemetry, IExperimentationFilterProvider, ExperimentationService as TASClient } from 'tas-client-umd'; +import { MementoObject, Memento } from 'vs/workbench/common/memento'; +import { IProductService } from 'vs/platform/product/common/productService'; +import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; +import { ITelemetryData } from 'vs/base/common/actions'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; export const ITASExperimentService = createDecorator('TASExperimentService'); @@ -11,3 +19,215 @@ export interface ITASExperimentService { readonly _serviceBrand: undefined; getTreatment(name: string): Promise; } + +const storageKey = 'VSCode.ABExp.FeatureData'; +const refetchInterval = 0; // no polling + +class MementoKeyValueStorage implements IKeyValueStorage { + constructor(private mementoObj: MementoObject) { } + + async getValue(key: string, defaultValue?: T | undefined): Promise { + const value = await this.mementoObj[key]; + return value || defaultValue; + } + + setValue(key: string, value: T): void { + this.mementoObj[key] = value; + } +} + +class ExperimentServiceTelemetry implements IExperimentationTelemetry { + constructor(private telemetryService: ITelemetryService) { } + + // __GDPR__COMMON__ "VSCode.ABExp.Features" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + // __GDPR__COMMON__ "abexp.assignmentcontext" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + setSharedProperty(name: string, value: string): void { + this.telemetryService.setExperimentProperty(name, value); + } + + postEvent(eventName: string, props: Map): void { + const data: ITelemetryData = {}; + for (const [key, value] of props.entries()) { + data[key] = value; + } + + /* __GDPR__ + "query-expfeature" : { + "ABExp.queriedFeature": { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + } + */ + this.telemetryService.publicLog(eventName, data); + } +} + +class ExperimentServiceFilterProvider implements IExperimentationFilterProvider { + constructor( + private version: string, + private appName: string, + private machineId: string, + private targetPopulation: TargetPopulation + ) { } + + getFilterValue(filter: string): string | null { + switch (filter) { + case Filters.ApplicationVersion: + return this.version; // productService.version + case Filters.Build: + return this.appName; // productService.nameLong + case Filters.ClientId: + return this.machineId; + case Filters.Language: + return platform.language; + case Filters.ExtensionName: + return 'vscode-core'; // always return vscode-core for exp service + case Filters.TargetPopulation: + return this.targetPopulation; + default: + return ''; + } + } + + getFilters(): Map { + let filters: Map = new Map(); + let filterValues = Object.values(Filters); + for (let value of filterValues) { + filters.set(value, this.getFilterValue(value)); + } + + return filters; + } +} + +/* +Based upon the official VSCode currently existing filters in the +ExP backend for the VSCode cluster. +https://experimentation.visualstudio.com/Analysis%20and%20Experimentation/_git/AnE.ExP.TAS.TachyonHost.Configuration?path=%2FConfigurations%2Fvscode%2Fvscode.json&version=GBmaster +"X-MSEdge-Market": "detection.market", +"X-FD-Corpnet": "detection.corpnet", +"X-VSCode–AppVersion": "appversion", +"X-VSCode-Build": "build", +"X-MSEdge-ClientId": "clientid", +"X-VSCode-ExtensionName": "extensionname", +"X-VSCode-TargetPopulation": "targetpopulation", +"X-VSCode-Language": "language" +*/ + +enum Filters { + /** + * The market in which the extension is distributed. + */ + Market = 'X-MSEdge-Market', + + /** + * The corporation network. + */ + CorpNet = 'X-FD-Corpnet', + + /** + * Version of the application which uses experimentation service. + */ + ApplicationVersion = 'X-VSCode-AppVersion', + + /** + * Insiders vs Stable. + */ + Build = 'X-VSCode-Build', + + /** + * Client Id which is used as primary unit for the experimentation. + */ + ClientId = 'X-MSEdge-ClientId', + + /** + * Extension header. + */ + ExtensionName = 'X-VSCode-ExtensionName', + + /** + * The language in use by VS Code + */ + Language = 'X-VSCode-Language', + + /** + * The target population. + * This is used to separate internal, early preview, GA, etc. + */ + TargetPopulation = 'X-VSCode-TargetPopulation', +} + +enum TargetPopulation { + Team = 'team', + Internal = 'internal', + Insiders = 'insider', + Public = 'public', +} + +export class ExperimentService implements ITASExperimentService { + _serviceBrand: undefined; + private tasClient: Promise | undefined; + private static MEMENTO_ID = 'experiment.service.memento'; + + private get experimentsEnabled(): boolean { + return this.configurationService.getValue('workbench.enableExperiments') === true; + } + + constructor( + @IProductService private productService: IProductService, + @ITelemetryService private telemetryService: ITelemetryService, + @IStorageService private storageService: IStorageService, + @IConfigurationService private configurationService: IConfigurationService, + ) { + + if (this.productService.tasConfig && this.experimentsEnabled && this.telemetryService.isOptedIn) { + this.tasClient = this.setupTASClient(); + } + } + + async getTreatment(name: string): Promise { + if (!this.tasClient) { + return undefined; + } + + if (!this.experimentsEnabled) { + return undefined; + } + + return (await this.tasClient).getTreatmentVariable('vscode', name); + } + + private async setupTASClient(): Promise { + const telemetryInfo = await this.telemetryService.getTelemetryInfo(); + const targetPopulation = telemetryInfo.msftInternal ? TargetPopulation.Internal : (this.productService.quality === 'stable' ? TargetPopulation.Public : TargetPopulation.Insiders); + const machineId = telemetryInfo.machineId; + const filterProvider = new ExperimentServiceFilterProvider( + this.productService.version, + this.productService.nameLong, + machineId, + targetPopulation + ); + + const memento = new Memento(ExperimentService.MEMENTO_ID, this.storageService); + const keyValueStorage = new MementoKeyValueStorage(memento.getMemento(StorageScope.GLOBAL)); + + const telemetry = new ExperimentServiceTelemetry(this.telemetryService); + + const tasConfig = this.productService.tasConfig!; + const tasClient = new (await import('tas-client-umd')).ExperimentationService({ + filterProviders: [filterProvider], + telemetry: telemetry, + storageKey: storageKey, + keyValueStorage: keyValueStorage, + featuresTelemetryPropertyName: tasConfig.featuresTelemetryPropertyName, + assignmentContextTelemetryPropertyName: tasConfig.assignmentContextTelemetryPropertyName, + telemetryEventName: tasConfig.telemetryEventName, + endpoint: tasConfig.endpoint, + refetchInterval: refetchInterval, + }); + + await tasClient.initializePromise; + return tasClient; + } +} + +registerSingleton(ITASExperimentService, ExperimentService, false); + diff --git a/src/vs/workbench/services/experiment/electron-browser/experimentService.ts b/src/vs/workbench/services/experiment/electron-browser/experimentService.ts deleted file mode 100644 index b9af68bd937..00000000000 --- a/src/vs/workbench/services/experiment/electron-browser/experimentService.ts +++ /dev/null @@ -1,227 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as platform from 'vs/base/common/platform'; -import type { IKeyValueStorage, IExperimentationTelemetry, IExperimentationFilterProvider, ExperimentationService as TASClient } from 'tas-client'; -import { MementoObject, Memento } from 'vs/workbench/common/memento'; -import { IProductService } from 'vs/platform/product/common/productService'; -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; -import { ITelemetryData } from 'vs/base/common/actions'; -import { ITASExperimentService } from 'vs/workbench/services/experiment/common/experimentService'; -import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; - -const storageKey = 'VSCode.ABExp.FeatureData'; -const refetchInterval = 0; // no polling - -class MementoKeyValueStorage implements IKeyValueStorage { - constructor(private mementoObj: MementoObject) { } - - async getValue(key: string, defaultValue?: T | undefined): Promise { - const value = await this.mementoObj[key]; - return value || defaultValue; - } - - setValue(key: string, value: T): void { - this.mementoObj[key] = value; - } -} - -class ExperimentServiceTelemetry implements IExperimentationTelemetry { - constructor(private telemetryService: ITelemetryService) { } - - // __GDPR__COMMON__ "VSCode.ABExp.Features" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } - // __GDPR__COMMON__ "abexp.assignmentcontext" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } - setSharedProperty(name: string, value: string): void { - this.telemetryService.setExperimentProperty(name, value); - } - - postEvent(eventName: string, props: Map): void { - const data: ITelemetryData = {}; - for (const [key, value] of props.entries()) { - data[key] = value; - } - - /* __GDPR__ - "query-expfeature" : { - "ABExp.queriedFeature": { "classification": "SystemMetaData", "purpose": "FeatureInsight" } - } - */ - this.telemetryService.publicLog(eventName, data); - } -} - -class ExperimentServiceFilterProvider implements IExperimentationFilterProvider { - constructor( - private version: string, - private appName: string, - private machineId: string, - private targetPopulation: TargetPopulation - ) { } - - getFilterValue(filter: string): string | null { - switch (filter) { - case Filters.ApplicationVersion: - return this.version; // productService.version - case Filters.Build: - return this.appName; // productService.nameLong - case Filters.ClientId: - return this.machineId; - case Filters.Language: - return platform.language; - case Filters.ExtensionName: - return 'vscode-core'; // always return vscode-core for exp service - case Filters.TargetPopulation: - return this.targetPopulation; - default: - return ''; - } - } - - getFilters(): Map { - let filters: Map = new Map(); - let filterValues = Object.values(Filters); - for (let value of filterValues) { - filters.set(value, this.getFilterValue(value)); - } - - return filters; - } -} - -/* -Based upon the official VSCode currently existing filters in the -ExP backend for the VSCode cluster. -https://experimentation.visualstudio.com/Analysis%20and%20Experimentation/_git/AnE.ExP.TAS.TachyonHost.Configuration?path=%2FConfigurations%2Fvscode%2Fvscode.json&version=GBmaster -"X-MSEdge-Market": "detection.market", -"X-FD-Corpnet": "detection.corpnet", -"X-VSCode–AppVersion": "appversion", -"X-VSCode-Build": "build", -"X-MSEdge-ClientId": "clientid", -"X-VSCode-ExtensionName": "extensionname", -"X-VSCode-TargetPopulation": "targetpopulation", -"X-VSCode-Language": "language" -*/ - -enum Filters { - /** - * The market in which the extension is distributed. - */ - Market = 'X-MSEdge-Market', - - /** - * The corporation network. - */ - CorpNet = 'X-FD-Corpnet', - - /** - * Version of the application which uses experimentation service. - */ - ApplicationVersion = 'X-VSCode-AppVersion', - - /** - * Insiders vs Stable. - */ - Build = 'X-VSCode-Build', - - /** - * Client Id which is used as primary unit for the experimentation. - */ - ClientId = 'X-MSEdge-ClientId', - - /** - * Extension header. - */ - ExtensionName = 'X-VSCode-ExtensionName', - - /** - * The language in use by VS Code - */ - Language = 'X-VSCode-Language', - - /** - * The target population. - * This is used to separate internal, early preview, GA, etc. - */ - TargetPopulation = 'X-VSCode-TargetPopulation', -} - -enum TargetPopulation { - Team = 'team', - Internal = 'internal', - Insiders = 'insider', - Public = 'public', -} - -export class ExperimentService implements ITASExperimentService { - _serviceBrand: undefined; - private tasClient: Promise | undefined; - private static MEMENTO_ID = 'experiment.service.memento'; - - private get experimentsEnabled(): boolean { - return this.configurationService.getValue('workbench.enableExperiments') === true; - } - - constructor( - @IProductService private productService: IProductService, - @ITelemetryService private telemetryService: ITelemetryService, - @IStorageService private storageService: IStorageService, - @IConfigurationService private configurationService: IConfigurationService, - ) { - - if (this.productService.tasConfig && this.experimentsEnabled && this.telemetryService.isOptedIn) { - this.tasClient = this.setupTASClient(); - } - } - - async getTreatment(name: string): Promise { - if (!this.tasClient) { - return undefined; - } - - if (!this.experimentsEnabled) { - return undefined; - } - - return (await this.tasClient).getTreatmentVariable('vscode', name); - } - - private async setupTASClient(): Promise { - const telemetryInfo = await this.telemetryService.getTelemetryInfo(); - const targetPopulation = telemetryInfo.msftInternal ? TargetPopulation.Internal : (this.productService.quality === 'stable' ? TargetPopulation.Public : TargetPopulation.Insiders); - const machineId = telemetryInfo.machineId; - const filterProvider = new ExperimentServiceFilterProvider( - this.productService.version, - this.productService.nameLong, - machineId, - targetPopulation - ); - - const memento = new Memento(ExperimentService.MEMENTO_ID, this.storageService); - const keyValueStorage = new MementoKeyValueStorage(memento.getMemento(StorageScope.GLOBAL)); - - const telemetry = new ExperimentServiceTelemetry(this.telemetryService); - - const tasConfig = this.productService.tasConfig!; - const tasClient = new (await import('tas-client')).ExperimentationService({ - filterProviders: [filterProvider], - telemetry: telemetry, - storageKey: storageKey, - keyValueStorage: keyValueStorage, - featuresTelemetryPropertyName: tasConfig.featuresTelemetryPropertyName, - assignmentContextTelemetryPropertyName: tasConfig.assignmentContextTelemetryPropertyName, - telemetryEventName: tasConfig.telemetryEventName, - endpoint: tasConfig.endpoint, - refetchInterval: refetchInterval, - }); - - await tasClient.initializePromise; - return tasClient; - } -} - -registerSingleton(ITASExperimentService, ExperimentService, false); - diff --git a/src/vs/workbench/workbench.common.main.ts b/src/vs/workbench/workbench.common.main.ts index 5285bb3ed76..d6c14031280 100644 --- a/src/vs/workbench/workbench.common.main.ts +++ b/src/vs/workbench/workbench.common.main.ts @@ -86,6 +86,7 @@ import 'vs/workbench/services/quickinput/browser/quickInputService'; import 'vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService'; import 'vs/workbench/services/authentication/browser/authenticationService'; import 'vs/workbench/services/hover/browser/hoverService'; +import 'vs/workbench/services/experiment/common/experimentService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { ExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionGalleryService'; diff --git a/yarn.lock b/yarn.lock index 95ec3d5eee7..97ae9cf2d86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1131,13 +1131,6 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== -axios@^0.19.0: - version "0.19.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27" - integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA== - dependencies: - follow-redirects "1.5.10" - azure-storage@^2.10.2: version "2.10.2" resolved "https://registry.yarnpkg.com/azure-storage/-/azure-storage-2.10.2.tgz#3bcabdbf10e72fd0990db81116e49023c4a675b6" @@ -2396,7 +2389,7 @@ debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3: dependencies: ms "2.0.0" -debug@3.1.0, debug@=3.1.0: +debug@3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== @@ -3578,13 +3571,6 @@ flush-write-stream@^1.0.0, flush-write-stream@^1.0.2: inherits "^2.0.1" readable-stream "^2.0.4" -follow-redirects@1.5.10: - version "1.5.10" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a" - integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ== - dependencies: - debug "=3.1.0" - for-in@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.5.tgz#007374e2b6d5c67420a1479bdb75a04872b738c4" @@ -8965,12 +8951,10 @@ tar@^4: safe-buffer "^5.1.2" yallist "^3.0.2" -tas-client@^0.0.950: - version "0.0.950" - resolved "https://registry.yarnpkg.com/tas-client/-/tas-client-0.0.950.tgz#0fadc684721d5bc6d6af03b09e1ff5a83a5186fc" - integrity sha512-AvCNjvfouxJyKln+TsobOBO5KmXklL9+FlxrEPlIgaixy1TxCC2v2Vs/MflCiyHlGl+BeIStP4oAVPqo5c0pIA== - dependencies: - axios "^0.19.0" +tas-client-umd@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/tas-client-umd/-/tas-client-umd-0.1.1.tgz#a858ced3d3af5989a505f5b6bc961e4ff33ab1a4" + integrity sha512-vWp7WNBL+tMifW3k1HJb9fmmJhvbu+zIYtvQbx5w04hCl8KXuhfc59fu//Cx31WZiKcfTaIw/WPB47hzYGuh8A== temp@^0.8.3: version "0.8.3" From 6932306e4dcfdc4ec2d3e4f582af01500eb95d99 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 11:06:23 -0700 Subject: [PATCH 0131/1667] Add (get) and (set) prefixes to JS/TS getters and setters in the outline Fixes #106935 --- .../src/languageFeatures/documentSymbol.ts | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/extensions/typescript-language-features/src/languageFeatures/documentSymbol.ts b/extensions/typescript-language-features/src/languageFeatures/documentSymbol.ts index d0b8b9ad901..c3c3f5d93aa 100644 --- a/extensions/typescript-language-features/src/languageFeatures/documentSymbol.ts +++ b/extensions/typescript-language-features/src/languageFeatures/documentSymbol.ts @@ -73,19 +73,7 @@ class TypeScriptDocumentSymbolProvider implements vscode.DocumentSymbolProvider const children = new Set(item.childItems || []); for (const span of item.spans) { const range = typeConverters.Range.fromTextSpan(span); - const selectionRange = item.nameSpan ? typeConverters.Range.fromTextSpan(item.nameSpan) : range; - const symbolInfo = new vscode.DocumentSymbol( - item.text, - '', - getSymbolKind(item.kind), - range, - range.contains(selectionRange) ? selectionRange : range); - - - const kindModifiers = parseKindModifier(item.kindModifiers); - if (kindModifiers.has(PConst.KindModifiers.depreacted)) { - symbolInfo.tags = [vscode.SymbolTag.Deprecated]; - } + const symbolInfo = TypeScriptDocumentSymbolProvider.convertSymbol(item, range); for (const child of children) { if (child.spans.some(span => !!range.intersection(typeConverters.Range.fromTextSpan(span)))) { @@ -103,6 +91,31 @@ class TypeScriptDocumentSymbolProvider implements vscode.DocumentSymbolProvider return shouldInclude; } + private static convertSymbol(item: Proto.NavigationTree, range: vscode.Range): vscode.DocumentSymbol { + const selectionRange = item.nameSpan ? typeConverters.Range.fromTextSpan(item.nameSpan) : range; + let label = item.text; + + switch (item.kind) { + case PConst.Kind.memberGetAccessor: label = `(get) ${label}`; break; + case PConst.Kind.memberSetAccessor: label = `(set) ${label}`; break; + } + + const symbolInfo = new vscode.DocumentSymbol( + label, + '', + getSymbolKind(item.kind), + range, + range.contains(selectionRange) ? selectionRange : range); + + + const kindModifiers = parseKindModifier(item.kindModifiers); + if (kindModifiers.has(PConst.KindModifiers.depreacted)) { + symbolInfo.tags = [vscode.SymbolTag.Deprecated]; + } + + return symbolInfo; + } + private static shouldInclueEntry(item: Proto.NavigationTree | Proto.NavigationBarItem): boolean { if (item.kind === PConst.Kind.alias) { return false; From 26b00a394e9a7725ac5cd033e91a945d96fbbaaa Mon Sep 17 00:00:00 2001 From: rebornix Date: Fri, 18 Sep 2020 11:36:24 -0700 Subject: [PATCH 0132/1667] support cell range in notebook.cell.execute command --- .../notebook/browser/contrib/coreActions.ts | 114 ++++++++++++++++-- 1 file changed, 102 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts b/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts index f156a51c5ef..455575b41af 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts @@ -20,7 +20,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis import { IQuickInputService, IQuickPickItem, QuickPickInput } from 'vs/platform/quickinput/common/quickInput'; import { BaseCellRenderTemplate, CellEditState, CellFocusMode, ICellViewModel, INotebookEditor, NOTEBOOK_CELL_INPUT_COLLAPSED, NOTEBOOK_CELL_EDITABLE, NOTEBOOK_CELL_HAS_OUTPUTS, NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_CELL_MARKDOWN_EDIT_MODE, NOTEBOOK_CELL_OUTPUT_COLLAPSED, NOTEBOOK_CELL_TYPE, NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_EDITOR_EXECUTING_NOTEBOOK, NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_RUNNABLE, NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_OUTPUT_FOCUSED, EXPAND_CELL_CONTENT_COMMAND_ID, NOTEBOOK_CELL_EDITOR_FOCUSED } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; import { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel'; -import { CellEditType, CellKind, NotebookCellMetadata, NotebookCellRunState, NOTEBOOK_EDITOR_CURSOR_BOUNDARY } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { CellEditType, CellKind, ICellRange, NotebookCellMetadata, NotebookCellRunState, NOTEBOOK_EDITOR_CURSOR_BOUNDARY } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; @@ -167,28 +167,36 @@ abstract class NotebookAction extends Action2 { } } -abstract class NotebookCellAction extends NotebookAction { +abstract class NotebookCellAction extends NotebookAction { protected isCellActionContext(context?: unknown): context is INotebookCellActionContext { return !!context && !!(context as INotebookCellActionContext).notebookEditor && !!(context as INotebookCellActionContext).cell; } + protected getCellContextFromArgs(accessor: ServicesAccessor, context?: T): INotebookCellActionContext | undefined { + return undefined; + } + async run(accessor: ServicesAccessor, context?: INotebookCellActionContext): Promise { - if (!this.isCellActionContext(context)) { - const activeEditorContext = this.getActiveEditorContext(accessor); - if (this.isCellActionContext(activeEditorContext)) { - context = activeEditorContext; - } else { - return; - } + if (this.isCellActionContext(context)) { + return this.runWithContext(accessor, context); } - this.runWithContext(accessor, context); + const contextFromArgs = this.getCellContextFromArgs(accessor, context); + + if (contextFromArgs) { + return this.runWithContext(accessor, contextFromArgs); + } + + const activeEditorContext = this.getActiveEditorContext(accessor); + if (this.isCellActionContext(activeEditorContext)) { + return this.runWithContext(accessor, activeEditorContext); + } } abstract runWithContext(accessor: ServicesAccessor, context: INotebookCellActionContext): Promise; } -registerAction2(class extends NotebookCellAction { +registerAction2(class extends NotebookCellAction { constructor() { super({ id: EXECUTE_CELL_COMMAND_ID, @@ -201,24 +209,106 @@ registerAction2(class extends NotebookCellAction { }, weight: EDITOR_WIDGET_ACTION_WEIGHT }, + description: { + description: localize('notebookActions.execute', "Execute Cell"), + args: [ + { + name: 'range', + description: 'The cell range', + schema: { + 'type': 'object', + 'required': ['start', 'end'], + 'properties': { + 'start': { + 'type': 'number' + }, + 'end': { + 'type': 'number' + } + } + } + } + ] + }, icon: { id: 'codicon/play' }, }); } + getCellContextFromArgs(accessor: ServicesAccessor, context?: ICellRange): INotebookCellActionContext | undefined { + if (!context || typeof context.start !== 'number' || typeof context.end !== 'number' || context.start >= context.end) { + return; + } + + const activeEditorContext = this.getActiveEditorContext(accessor); + + if (!activeEditorContext || !activeEditorContext.notebookEditor.viewModel || context.start >= activeEditorContext.notebookEditor.viewModel.viewCells.length) { + return; + } + + const cells = activeEditorContext.notebookEditor.viewModel.viewCells; + + // TODO@rebornix, support multiple cells + return { + notebookEditor: activeEditorContext.notebookEditor, + cell: cells[context.start] + }; + } + async runWithContext(accessor: ServicesAccessor, context: INotebookCellActionContext): Promise { return runCell(accessor, context); } }); -registerAction2(class extends NotebookCellAction { +registerAction2(class extends NotebookCellAction { constructor() { super({ id: CANCEL_CELL_COMMAND_ID, title: localize('notebookActions.cancel', "Stop Cell Execution"), icon: { id: 'codicon/primitive-square' }, + description: { + description: localize('notebookActions.execute', "Execute Cell"), + args: [ + { + name: 'range', + description: 'The cell range', + schema: { + 'type': 'object', + 'required': ['start', 'end'], + 'properties': { + 'start': { + 'type': 'number' + }, + 'end': { + 'type': 'number' + } + } + } + } + ] + }, }); } + getCellContextFromArgs(accessor: ServicesAccessor, context?: ICellRange): INotebookCellActionContext | undefined { + if (!context || typeof context.start !== 'number' || typeof context.end !== 'number' || context.start >= context.end) { + return; + } + + const activeEditorContext = this.getActiveEditorContext(accessor); + + if (!activeEditorContext || !activeEditorContext.notebookEditor.viewModel || context.start >= activeEditorContext.notebookEditor.viewModel.viewCells.length) { + return; + } + + const cells = activeEditorContext.notebookEditor.viewModel.viewCells; + + // TODO@rebornix, support multiple cells + return { + notebookEditor: activeEditorContext.notebookEditor, + cell: cells[context.start] + }; + } + async runWithContext(accessor: ServicesAccessor, context: INotebookCellActionContext): Promise { return context.notebookEditor.cancelNotebookCellExecution(context.cell); } From 6546323f61115f31303df96b804e894b8e0b059a Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Fri, 18 Sep 2020 13:25:45 -0700 Subject: [PATCH 0133/1667] remove ref to experiment service in desktop --- src/vs/workbench/workbench.desktop.main.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/vs/workbench/workbench.desktop.main.ts b/src/vs/workbench/workbench.desktop.main.ts index 5d4c5a42109..856afbd2bf1 100644 --- a/src/vs/workbench/workbench.desktop.main.ts +++ b/src/vs/workbench/workbench.desktop.main.ts @@ -83,8 +83,6 @@ import 'vs/workbench/services/userDataSync/electron-browser/userDataAutoSyncServ import 'vs/workbench/services/sharedProcess/electron-browser/sharedProcessService'; import 'vs/workbench/services/localizations/electron-browser/localizationsService'; import 'vs/workbench/services/diagnostics/electron-browser/diagnosticsService'; -import 'vs/workbench/services/experiment/electron-browser/experimentService'; - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // From f65fdf6249a8e483e972bb9689da153250775ef6 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Fri, 18 Sep 2020 14:06:39 -0700 Subject: [PATCH 0134/1667] fix build --- remote/web/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remote/web/package.json b/remote/web/package.json index be80c6d8ad6..8636177de01 100644 --- a/remote/web/package.json +++ b/remote/web/package.json @@ -5,7 +5,7 @@ "iconv-lite-umd": "0.6.8", "jschardet": "2.2.1", "semver-umd": "^5.5.7", - "tas-client-umd": "0.1.1", + "tas-client-umd": "^0.1.1", "vscode-oniguruma": "1.3.1", "vscode-textmate": "5.2.0", "xterm": "4.10.0-beta.4", From c203f794f9b6a0aafb46fcad3f9949ccdb9f3dfc Mon Sep 17 00:00:00 2001 From: rebornix Date: Fri, 18 Sep 2020 14:25:15 -0700 Subject: [PATCH 0135/1667] update lock. --- remote/web/yarn.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remote/web/yarn.lock b/remote/web/yarn.lock index 9ee229a0788..cd05cbf1994 100644 --- a/remote/web/yarn.lock +++ b/remote/web/yarn.lock @@ -17,7 +17,7 @@ semver-umd@^5.5.7: resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.7.tgz#966beb5e96c7da6fbf09c3da14c2872d6836c528" integrity sha512-XgjPNlD0J6aIc8xoTN6GQGwWc2Xg0kq8NzrqMVuKG/4Arl6ab1F8+Am5Y/XKKCR+FceFr2yN/Uv5ZJBhRyRqKg== -tas-client-umd@0.1.1: +tas-client-umd@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/tas-client-umd/-/tas-client-umd-0.1.1.tgz#a858ced3d3af5989a505f5b6bc961e4ff33ab1a4" integrity sha512-vWp7WNBL+tMifW3k1HJb9fmmJhvbu+zIYtvQbx5w04hCl8KXuhfc59fu//Cx31WZiKcfTaIw/WPB47hzYGuh8A== From 6e5fda4c75f92257b376627ea4d330b2858418ce Mon Sep 17 00:00:00 2001 From: SteVen Batten <6561887+sbatten@users.noreply.github.com> Date: Fri, 18 Sep 2020 14:40:50 -0700 Subject: [PATCH 0136/1667] switch to node libs (#107040) * switch to node libs * remove family check, its irrelevant --- src/vs/base/node/macAddress.ts | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/src/vs/base/node/macAddress.ts b/src/vs/base/node/macAddress.ts index 524b136c06b..35fec9fc86b 100644 --- a/src/vs/base/node/macAddress.ts +++ b/src/vs/base/node/macAddress.ts @@ -3,13 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { exec } from 'child_process'; -import { isWindows } from 'vs/base/common/platform'; - -const cmdline = { - windows: 'getmac.exe', - unix: '/sbin/ifconfig -a || /sbin/ip link' -}; +import { networkInterfaces } from 'os'; const invalidMacAddresses = new Set([ '00:00:00:00:00:00', @@ -39,23 +33,16 @@ export function getMac(): Promise { function doGetMac(): Promise { return new Promise((resolve, reject) => { try { - exec(isWindows ? cmdline.windows : cmdline.unix, { timeout: 10000 }, (err, stdout, stdin) => { - if (err) { - return reject(`Unable to retrieve mac address (${err.toString()})`); - } else { - const regex = /(?:[a-f\d]{2}[:\-]){5}[a-f\d]{2}/gi; - - let match; - while ((match = regex.exec(stdout)) !== null) { - const macAddressCandidate = match[0]; - if (validateMacAddress(macAddressCandidate)) { - return resolve(macAddressCandidate); - } + const ifaces = networkInterfaces(); + for (const [, infos] of Object.entries(ifaces)) { + for (const info of infos) { + if (validateMacAddress(info.mac)) { + return resolve(info.mac); } - - return reject('Unable to retrieve mac address (unexpected format)'); } - }); + } + + reject('Unable to retrieve mac address (unexpected format)'); } catch (err) { reject(err); } From ab1f288baa6a75b1de1bf12de15f114a45322398 Mon Sep 17 00:00:00 2001 From: rebornix Date: Fri, 18 Sep 2020 14:44:05 -0700 Subject: [PATCH 0137/1667] multiple selectors --- src/vs/vscode.proposed.d.ts | 10 ++++++++-- src/vs/workbench/api/browser/mainThreadNotebook.ts | 2 +- src/vs/workbench/api/common/extHost.protocol.ts | 2 +- src/vs/workbench/api/common/extHostNotebook.ts | 14 +++++++++++--- .../notebook/browser/notebookDiffEditorInput.ts | 2 +- .../notebook/browser/notebookEditorInput.ts | 2 +- .../notebook/browser/notebookServiceImpl.ts | 4 ++-- .../contrib/notebook/common/notebookProvider.ts | 8 ++++---- .../contrib/notebook/common/notebookService.ts | 2 +- 9 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 2a52eb93e63..d08e522256b 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1764,9 +1764,11 @@ declare module 'vscode' { cancelAllCellsExecution(document: NotebookDocument): void; } + export type NotebookFilenamePattern = GlobPattern | { include: GlobPattern; exclude: GlobPattern }; + export interface NotebookDocumentFilter { viewType?: string | string[]; - filenamePattern?: GlobPattern | { include: GlobPattern; exclude: GlobPattern }; + filenamePattern?: NotebookFilenamePattern; } export interface NotebookKernelProvider { @@ -1824,7 +1826,11 @@ declare module 'vscode' { /** * Not ready for production or development use yet. */ - viewOptions?: { displayName: string; filenamePattern: GlobPattern | { include: GlobPattern; exclude: GlobPattern; }; exclusive?: boolean; }; + viewOptions?: { + displayName: string; + filenamePattern: NotebookFilenamePattern[]; + exclusive?: boolean; + }; } ): Disposable; diff --git a/src/vs/workbench/api/browser/mainThreadNotebook.ts b/src/vs/workbench/api/browser/mainThreadNotebook.ts index e7f9cd2462b..754fb3affe4 100644 --- a/src/vs/workbench/api/browser/mainThreadNotebook.ts +++ b/src/vs/workbench/api/browser/mainThreadNotebook.ts @@ -448,7 +448,7 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo async $registerNotebookProvider(extension: NotebookExtensionDescription, viewType: string, supportBackup: boolean, options: { transientOutputs: boolean; transientMetadata: TransientMetadata; - viewOptions?: { displayName: string; filenamePattern: string | IRelativePattern | INotebookExclusiveDocumentFilter; exclusive: boolean; }; + viewOptions?: { displayName: string; filenamePattern: (string | IRelativePattern | INotebookExclusiveDocumentFilter)[]; exclusive: boolean; }; }): Promise { const controller: IMainNotebookController = { supportBackup, diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 7796c24e46a..586c1549ba6 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -738,7 +738,7 @@ export interface MainThreadNotebookShape extends IDisposable { $registerNotebookProvider(extension: NotebookExtensionDescription, viewType: string, supportBackup: boolean, options: { transientOutputs: boolean; transientMetadata: TransientMetadata; - viewOptions?: { displayName: string; filenamePattern: string | IRelativePattern | INotebookExclusiveDocumentFilter; exclusive: boolean; }; + viewOptions?: { displayName: string; filenamePattern: (string | IRelativePattern | INotebookExclusiveDocumentFilter)[]; exclusive: boolean; }; }): Promise; $unregisterNotebookProvider(viewType: string): Promise; $registerNotebookKernelProvider(extension: NotebookExtensionDescription, handle: number, documentFilter: INotebookDocumentFilter): Promise; diff --git a/src/vs/workbench/api/common/extHostNotebook.ts b/src/vs/workbench/api/common/extHostNotebook.ts index b9f298258e4..7191c6c1ec2 100644 --- a/src/vs/workbench/api/common/extHostNotebook.ts +++ b/src/vs/workbench/api/common/extHostNotebook.ts @@ -17,12 +17,13 @@ import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePa import * as typeConverters from 'vs/workbench/api/common/extHostTypeConverters'; import * as extHostTypes from 'vs/workbench/api/common/extHostTypes'; import { asWebviewUri, WebviewInitData } from 'vs/workbench/api/common/shared/webview'; -import { addIdToOutput, CellStatusbarAlignment, CellUri, INotebookCellStatusBarEntry, INotebookDisplayOrder, INotebookKernelInfoDto2, NotebookCellMetadata, NotebookCellsChangedEventDto, NotebookCellsChangeType, NotebookDataDto, notebookDocumentMetadataDefaults } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { addIdToOutput, CellStatusbarAlignment, CellUri, INotebookCellStatusBarEntry, INotebookDisplayOrder, INotebookExclusiveDocumentFilter, INotebookKernelInfoDto2, NotebookCellMetadata, NotebookCellsChangedEventDto, NotebookCellsChangeType, NotebookDataDto, notebookDocumentMetadataDefaults } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import * as vscode from 'vscode'; import { ResourceMap } from 'vs/base/common/map'; import { ExtHostCell, ExtHostNotebookDocument } from './extHostNotebookDocument'; import { ExtHostNotebookEditor } from './extHostNotebookEditor'; import { IdGenerator } from 'vs/base/common/idGenerator'; +import { IRelativePattern } from 'vs/base/common/glob'; class ExtHostWebviewCommWrapper extends Disposable { private readonly _onDidReceiveDocumentMessage = new Emitter(); @@ -304,7 +305,11 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN options?: { transientOutputs: boolean; transientMetadata: { [K in keyof NotebookCellMetadata]?: boolean }; - viewOptions?: { displayName: string; filenamePattern: vscode.GlobPattern | { include: vscode.GlobPattern; exclude: vscode.GlobPattern }; exclusive?: boolean; }; + viewOptions?: { + displayName: string; + filenamePattern: (vscode.GlobPattern | { include: vscode.GlobPattern; exclude: vscode.GlobPattern })[]; + exclusive?: boolean; + }; } ): vscode.Disposable { @@ -333,7 +338,10 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN const supportBackup = !!provider.backupNotebook; - const viewOptionsFilenamePattern = typeConverters.NotebookExclusiveDocumentPattern.from(options?.viewOptions?.filenamePattern); + const viewOptionsFilenamePattern = options?.viewOptions?.filenamePattern + .map(pattern => typeConverters.NotebookExclusiveDocumentPattern.from(pattern)) + .filter(pattern => pattern !== undefined) as (string | IRelativePattern | INotebookExclusiveDocumentFilter)[]; + if (!viewOptionsFilenamePattern) { console.warn(`Notebook content provider view options file name pattern is invalid ${options?.viewOptions?.filenamePattern}`); } diff --git a/src/vs/workbench/contrib/notebook/browser/notebookDiffEditorInput.ts b/src/vs/workbench/contrib/notebook/browser/notebookDiffEditorInput.ts index 1c1c65468a6..8222abea7aa 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookDiffEditorInput.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookDiffEditorInput.ts @@ -148,7 +148,7 @@ export class NotebookDiffEditorInput extends EditorInput { } if (!provider.matches(target)) { - const patterns = provider.selector.map(pattern => { + const patterns = provider.selectors.map(pattern => { if (pattern.excludeFileNamePattern) { return `${pattern.filenamePattern} (exclude: ${pattern.excludeFileNamePattern})`; } diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditorInput.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditorInput.ts index 9e11a1b57c5..89cd51bd0ef 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditorInput.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditorInput.ts @@ -118,7 +118,7 @@ export class NotebookEditorInput extends EditorInput { } if (!provider.matches(target)) { - const patterns = provider.selector.map(pattern => { + const patterns = provider.selectors.map(pattern => { if (pattern.excludeFileNamePattern) { return `${pattern.filenamePattern} (exclude: ${pattern.excludeFileNamePattern})`; } diff --git a/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts b/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts index 00db1427e49..df43a58d156 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts @@ -116,7 +116,7 @@ export class NotebookProviderInfoStore extends Disposable { this.add(new NotebookProviderInfo({ id: notebookContribution.viewType, displayName: notebookContribution.displayName, - selector: notebookContribution.selector || [], + selectors: notebookContribution.selector || [], priority: this._convertPriority(notebookContribution.priority), providerExtensionId: extension.description.identifier.value, providerDescription: extension.description.description, @@ -576,7 +576,7 @@ export class NotebookService extends Disposable implements INotebookService, ICu displayName: controller.viewOptions.displayName, id: viewType, priority: NotebookEditorPriority.default, - selector: [{ filenamePattern: controller.viewOptions.filenamePattern }], + selectors: controller.viewOptions.filenamePattern.map(pattern => ({ filenamePattern: pattern })), providerExtensionId: extensionData.id.value, providerDescription: extensionData.description, providerDisplayName: extensionData.id.value, diff --git a/src/vs/workbench/contrib/notebook/common/notebookProvider.ts b/src/vs/workbench/contrib/notebook/common/notebookProvider.ts index 7465b9e1be5..4f1587380ad 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookProvider.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookProvider.ts @@ -16,7 +16,7 @@ export interface NotebookSelector { export interface NotebookEditorDescriptor { readonly id: string; readonly displayName: string; - readonly selector: readonly NotebookSelector[]; + readonly selectors: readonly NotebookSelector[]; readonly priority: NotebookEditorPriority; readonly providerExtensionId?: string; readonly providerDescription?: string; @@ -30,7 +30,7 @@ export class NotebookProviderInfo implements NotebookEditorDescriptor { readonly id: string; readonly displayName: string; - readonly selector: readonly NotebookSelector[]; + readonly selectors: readonly NotebookSelector[]; readonly priority: NotebookEditorPriority; // it's optional as the memento might not have it readonly providerExtensionId?: string; @@ -43,7 +43,7 @@ export class NotebookProviderInfo implements NotebookEditorDescriptor { constructor(descriptor: NotebookEditorDescriptor) { this.id = descriptor.id; this.displayName = descriptor.displayName; - this.selector = descriptor.selector; + this.selectors = descriptor.selectors; this.priority = descriptor.priority; this.providerExtensionId = descriptor.providerExtensionId; this.providerDescription = descriptor.providerDescription; @@ -54,7 +54,7 @@ export class NotebookProviderInfo implements NotebookEditorDescriptor { } matches(resource: URI): boolean { - return this.selector.some(selector => NotebookProviderInfo.selectorMatches(selector, resource)); + return this.selectors.some(selector => NotebookProviderInfo.selectorMatches(selector, resource)); } static selectorMatches(selector: NotebookSelector, resource: URI): boolean { diff --git a/src/vs/workbench/contrib/notebook/common/notebookService.ts b/src/vs/workbench/contrib/notebook/common/notebookService.ts index aa00ccd018d..422fafd6c2e 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookService.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookService.ts @@ -24,7 +24,7 @@ export const INotebookService = createDecorator('notebookServi export interface IMainNotebookController { supportBackup: boolean; - viewOptions?: { displayName: string; filenamePattern: string | IRelativePattern | INotebookExclusiveDocumentFilter; exclusive: boolean; }; + viewOptions?: { displayName: string; filenamePattern: (string | IRelativePattern | INotebookExclusiveDocumentFilter)[]; exclusive: boolean; }; options: { transientOutputs: boolean; transientMetadata: TransientMetadata; }; resolveNotebookDocument(viewType: string, uri: URI, backupId?: string): Promise<{ data: NotebookDataDto, transientOptions: TransientOptions }>; reloadNotebook(mainthreadTextModel: NotebookTextModel): Promise; From fec75ce9120a055009a0dbd33ff3a36e62d925be Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 12:25:03 -0700 Subject: [PATCH 0138/1667] Remove custom editor default editor override Fixes #101541 --- .../customEditor/browser/customEditors.ts | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/vs/workbench/contrib/customEditor/browser/customEditors.ts b/src/vs/workbench/contrib/customEditor/browser/customEditors.ts index 76809c233a4..584152b8e22 100644 --- a/src/vs/workbench/contrib/customEditor/browser/customEditors.ts +++ b/src/vs/workbench/contrib/customEditor/browser/customEditors.ts @@ -29,7 +29,7 @@ import { CONTEXT_CUSTOM_EDITORS, CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, Cust import { CustomEditorModelManager } from 'vs/workbench/contrib/customEditor/common/customEditorModelManager'; import { IWebviewService, webviewHasOwnEditFunctionsContext } from 'vs/workbench/contrib/webview/browser/webview'; import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; -import { CustomEditorAssociation, CustomEditorsAssociations, customEditorsAssociationsSettingId, defaultEditorOverrideEntry } from 'vs/workbench/services/editor/common/editorOpenWith'; +import { CustomEditorAssociation, CustomEditorsAssociations, customEditorsAssociationsSettingId } from 'vs/workbench/services/editor/common/editorOpenWith'; import { ICustomEditorInfo, ICustomEditorViewTypesHandler, IEditorService, IOpenEditorOverride, IOpenEditorOverrideEntry } from 'vs/workbench/services/editor/common/editorService'; import { ContributedCustomEditors, defaultCustomEditor } from '../common/contributedCustomEditors'; import { CustomEditorInput } from './customEditorInput'; @@ -454,11 +454,6 @@ export class CustomEditorContribution extends Disposable implements IWorkbenchCo getEditorOverrides: (resource: URI, options: IEditorOptions | undefined, group: IEditorGroup | undefined): IOpenEditorOverrideEntry[] => { const currentEditor = group?.editors.find(editor => isEqual(editor.resource, resource)); - const defaultEditorOverride: IOpenEditorOverrideEntry = { - ...defaultEditorOverrideEntry, - active: this._fileEditorInputFactory.isFileEditorInput(currentEditor), - }; - const toOverride = (entry: CustomEditorInfo): IOpenEditorOverrideEntry => { return { id: entry.id, @@ -470,11 +465,6 @@ export class CustomEditorContribution extends Disposable implements IWorkbenchCo if (typeof options?.override === 'string') { // A specific override was requested. Only return it. - - if (options.override === defaultEditorOverride.id) { - return [defaultEditorOverride]; - } - const matchingEditor = this.customEditorService.getCustomEditor(options.override); return matchingEditor ? [toOverride(matchingEditor)] : []; } @@ -485,12 +475,9 @@ export class CustomEditorContribution extends Disposable implements IWorkbenchCo return []; } - return [ - defaultEditorOverride, - ...customEditors.allEditors - .filter(entry => entry.id !== defaultCustomEditor.id) - .map(toOverride) - ]; + return customEditors.allEditors + .filter(entry => entry.id !== defaultCustomEditor.id) + .map(toOverride); } })); } From 2ac15236ea0940c34a3367ea4d63de09596ffc32 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 14:49:55 -0700 Subject: [PATCH 0139/1667] Allow updating the title of a composite even if it is not active (#106892) Fixes #106083 --- src/vs/workbench/browser/parts/compositePart.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/browser/parts/compositePart.ts b/src/vs/workbench/browser/parts/compositePart.ts index c9c0963fed8..6d9d046678a 100644 --- a/src/vs/workbench/browser/parts/compositePart.ts +++ b/src/vs/workbench/browser/parts/compositePart.ts @@ -284,13 +284,14 @@ export abstract class CompositePart extends Part { protected onTitleAreaUpdate(compositeId: string): void { - // Active Composite + // Title + const compositeItem = this.instantiatedCompositeItems.get(compositeId); + if (compositeItem) { + this.updateTitle(compositeItem.composite.getId(), compositeItem.composite.getTitle()); + } + + // Actions if (this.activeComposite && this.activeComposite.getId() === compositeId) { - - // Title - this.updateTitle(this.activeComposite.getId(), this.activeComposite.getTitle()); - - // Actions const actionsBinding = this.collectCompositeActions(this.activeComposite); this.mapActionsBindingToComposite.set(this.activeComposite.getId(), actionsBinding); actionsBinding(); From d4d7666008d00fb578878d3b174a460b8068de37 Mon Sep 17 00:00:00 2001 From: Andre Weinand Date: Sat, 19 Sep 2020 00:13:10 +0200 Subject: [PATCH 0140/1667] add DAP InvalidatedEvent --- .../contrib/debug/common/debugProtocol.d.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/vs/workbench/contrib/debug/common/debugProtocol.d.ts b/src/vs/workbench/contrib/debug/common/debugProtocol.d.ts index 7d1d51444c3..0f0374d541b 100644 --- a/src/vs/workbench/contrib/debug/common/debugProtocol.d.ts +++ b/src/vs/workbench/contrib/debug/common/debugProtocol.d.ts @@ -375,6 +375,23 @@ declare module DebugProtocol { }; } + /** Event message for 'invalidated' event type. + This event signals that some state in the debug adapter has changed and requires that the client needs to re-render the data snapshot previously requested. + Debug adapters do not have to emit this event for runtime changes like stopped or thread events because in that case the client refetches the new state anyway. But the event can be used for example to refresh the UI after rendering formatting has changed in the debug adapter. + This event should only be sent if the debug adapter has received a value true for the 'supportsInvalidatedEvent' capability of the 'initialize' request. + */ + export interface InvalidatedEvent extends Event { + // event: 'invalidated'; + body: { + /** Optional set of logical areas that got invalidated. If this property is missing or empty, a single value 'all' is assumed. */ + areas?: InvalidatedAreas[]; + /** If specified, the client only needs to refetch data related to this thread. */ + threadId?: number; + /** If specified, the client only needs to refetch data related to this stack frame (and the 'threadId' is ignored). */ + stackFrameId?: number; + }; + } + /** RunInTerminal request; value of command field is 'runInTerminal'. This optional request is sent from the debug adapter to the client to run a command in a terminal. This is typically used to launch the debuggee in a terminal provided by the client. @@ -449,6 +466,8 @@ declare module DebugProtocol { supportsMemoryReferences?: boolean; /** Client supports progress reporting. */ supportsProgressReporting?: boolean; + /** Client supports the invalidated event. */ + supportsInvalidatedEvent?: boolean; } /** Response to 'initialize' request. */ @@ -2158,5 +2177,13 @@ declare module DebugProtocol { /** The end column of the range that corresponds to this instruction, if any. */ endColumn?: number; } + + /** Logical areas that can be invalidated by the 'invalidated' event. + 'all': All previously fetched data has become invalid and needs to be refetched. + 'stacks': Previously fetched stack related data has become invalid and needs to be refetched. + 'threads': Previously fetched thread related data has become invalid and needs to be refetched. + 'variables': Previously fetched variable data has become invalid and needs to be refetched. + */ + export type InvalidatedAreas = 'all' | 'stacks' | 'threads' | 'variables'; } From 6781d16f05b2e93549675ec79a4ab2917c85faaa Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Fri, 18 Sep 2020 15:14:06 -0700 Subject: [PATCH 0141/1667] productize the dialog style setting for desktop --- src/vs/workbench/electron-sandbox/desktop.contribution.ts | 7 +++++++ .../services/dialogs/electron-sandbox/dialogService.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/electron-sandbox/desktop.contribution.ts b/src/vs/workbench/electron-sandbox/desktop.contribution.ts index 7c3ff5ecb61..23b2e4d9a59 100644 --- a/src/vs/workbench/electron-sandbox/desktop.contribution.ts +++ b/src/vs/workbench/electron-sandbox/desktop.contribution.ts @@ -268,6 +268,13 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema'; 'scope': ConfigurationScope.APPLICATION, 'description': nls.localize('titleBarStyle', "Adjust the appearance of the window title bar. On Linux and Windows, this setting also affects the application and context menu appearances. Changes require a full restart to apply.") }, + 'window.dialogStyle': { + 'type': 'string', + 'enum': ['native', 'custom'], + 'default': 'native', + 'scope': ConfigurationScope.APPLICATION, + 'description': nls.localize('dialogStyle', "Adjust the appearance of dialog windows.") + }, 'window.nativeTabs': { 'type': 'boolean', 'default': false, diff --git a/src/vs/workbench/services/dialogs/electron-sandbox/dialogService.ts b/src/vs/workbench/services/dialogs/electron-sandbox/dialogService.ts index 0d6c4ed646a..d28b6b5e923 100644 --- a/src/vs/workbench/services/dialogs/electron-sandbox/dialogService.ts +++ b/src/vs/workbench/services/dialogs/electron-sandbox/dialogService.ts @@ -59,7 +59,7 @@ export class DialogService implements IDialogService { } private get useCustomDialog(): boolean { - return this.configurationService.getValue('workbench.dialogs.customEnabled') === true; + return this.configurationService.getValue('window.dialogStyle') === 'custom'; } confirm(confirmation: IConfirmation): Promise { From 536ea46187d013839c0f3dc04fee6ba945f90c1a Mon Sep 17 00:00:00 2001 From: tomerstav <7940187+tomerstav@users.noreply.github.com> Date: Fri, 18 Sep 2020 15:35:21 -0700 Subject: [PATCH 0142/1667] =?UTF-8?q?Implemented=20fix=20for=20first=20par?= =?UTF-8?q?ameter=20being=20a=20substring=20of=20the=20second=20p=E2=80=A6?= =?UTF-8?q?=20(#106432)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implemented fix for first parameter being a substring of the second parameter * Addressed PR concern * Included edge cases * Changed to regex expression * Accounted for edge case * Added regex escaping --- .../editor/contrib/parameterHints/parameterHintsWidget.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts b/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts index 9a3cf05bb24..f5a4fc0cf3d 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts +++ b/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts @@ -22,7 +22,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener'; import { editorHoverBackground, editorHoverBorder, textCodeBlockBackground, textLinkForeground, editorHoverForeground } from 'vs/platform/theme/common/colorRegistry'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { ParameterHintsModel, TriggerContext } from 'vs/editor/contrib/parameterHints/parameterHintsModel'; -import { pad } from 'vs/base/common/strings'; +import { pad, escapeRegExpCharacters } from 'vs/base/common/strings'; import { registerIcon, Codicon } from 'vs/base/common/codicons'; import { assertIsDefined } from 'vs/base/common/types'; import { ColorScheme } from 'vs/platform/theme/common/theme'; @@ -312,9 +312,11 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget { } else if (Array.isArray(param.label)) { return param.label; } else { - const idx = signature.label.lastIndexOf(param.label); + const regex = new RegExp(`\\b${escapeRegExpCharacters(param.label)}\\b`, 'g'); + regex.test(signature.label); + const idx = regex.lastIndex - param.label.length; return idx >= 0 - ? [idx, idx + param.label.length] + ? [idx, regex.lastIndex] : [0, 0]; } } From d1510288f0c3f0dd1f1301b20c3f2bc4f5d61fd1 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 15:53:58 -0700 Subject: [PATCH 0143/1667] Add timeout for `vscode.workspace.findFiles` For #87494 --- .../src/task/taskProvider.ts | 4 +++- .../src/task/tsconfigProvider.ts | 24 +++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/extensions/typescript-language-features/src/task/taskProvider.ts b/extensions/typescript-language-features/src/task/taskProvider.ts index 85d3b574ae3..f324e0ff60a 100644 --- a/extensions/typescript-language-features/src/task/taskProvider.ts +++ b/extensions/typescript-language-features/src/task/taskProvider.ts @@ -38,6 +38,8 @@ interface TypeScriptTaskDefinition extends vscode.TaskDefinition { class TscTaskProvider implements vscode.TaskProvider { private readonly projectInfoRequestTimeout = 2000; + private readonly findConfigFilesTimeout = 5000; + private autoDetect: AutoDetect = 'on'; private readonly tsconfigProvider: TsConfigProvider; private readonly disposables: vscode.Disposable[] = []; @@ -160,7 +162,7 @@ class TscTaskProvider implements vscode.TaskProvider { } private async getTsConfigsInWorkspace(): Promise { - return Array.from(await this.tsconfigProvider.getConfigsForWorkspace()); + return Array.from(await this.tsconfigProvider.getConfigsForWorkspace({ timeout: this.findConfigFilesTimeout })); } private static async getCommand(project: TSConfig): Promise { diff --git a/extensions/typescript-language-features/src/task/tsconfigProvider.ts b/extensions/typescript-language-features/src/task/tsconfigProvider.ts index d44b828e384..247b6bb321a 100644 --- a/extensions/typescript-language-features/src/task/tsconfigProvider.ts +++ b/extensions/typescript-language-features/src/task/tsconfigProvider.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; +import { wait } from '../test/testUtils'; export interface TSConfig { readonly uri: vscode.Uri; @@ -13,12 +14,13 @@ export interface TSConfig { } export class TsConfigProvider { - public async getConfigsForWorkspace(): Promise> { + public async getConfigsForWorkspace(options?: { timeout: number }): Promise> { if (!vscode.workspace.workspaceFolders) { return []; } + const configs = new Map(); - for (const config of await vscode.workspace.findFiles('**/tsconfig*.json', '**/{node_modules,.*}/**')) { + for (const config of await this.findConfigFiles(options)) { const root = vscode.workspace.getWorkspaceFolder(config); if (root) { configs.set(config.fsPath, { @@ -31,4 +33,22 @@ export class TsConfigProvider { } return configs.values(); } + + private async findConfigFiles(options?: { timeout: number }): Promise { + const timeout = options?.timeout; + const task = (token?: vscode.CancellationToken) => vscode.workspace.findFiles('**/tsconfig*.json', '**/{node_modules,.*}/**', undefined, token); + + if (typeof timeout === 'number') { + const cancel = new vscode.CancellationTokenSource(); + return Promise.race([ + task(cancel.token), + wait(timeout).then(() => { + cancel.cancel(); + return []; + }), + ]); + } else { + return task(); + } + } } From bf2448549d1d23ffdf6948446ca3d9ed3a9dd171 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 16:00:56 -0700 Subject: [PATCH 0144/1667] Make getTsConfigsInWorkspace observe the TaskProvider cancellation --- .../src/task/taskProvider.ts | 16 ++++++++++--- .../src/task/tsconfigProvider.ts | 23 ++++--------------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/extensions/typescript-language-features/src/task/taskProvider.ts b/extensions/typescript-language-features/src/task/taskProvider.ts index f324e0ff60a..babb4c8c9e2 100644 --- a/extensions/typescript-language-features/src/task/taskProvider.ts +++ b/extensions/typescript-language-features/src/task/taskProvider.ts @@ -7,6 +7,7 @@ import * as jsonc from 'jsonc-parser'; import * as path from 'path'; import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; +import { wait } from '../test/testUtils'; import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService'; import { isTsConfigFileName } from '../utils/languageDescription'; import { Lazy } from '../utils/lazy'; @@ -105,7 +106,7 @@ class TscTaskProvider implements vscode.TaskProvider { const out = new Set(); const configs = [ ...await this.getTsConfigForActiveFile(token), - ...await this.getTsConfigsInWorkspace() + ...await this.getTsConfigsInWorkspace(token) ]; for (const config of configs) { if (await exists(config.uri)) { @@ -161,8 +162,17 @@ class TscTaskProvider implements vscode.TaskProvider { return []; } - private async getTsConfigsInWorkspace(): Promise { - return Array.from(await this.tsconfigProvider.getConfigsForWorkspace({ timeout: this.findConfigFilesTimeout })); + private async getTsConfigsInWorkspace(token: vscode.CancellationToken): Promise { + const getConfigsTimeout = new vscode.CancellationTokenSource(); + token.onCancellationRequested(() => getConfigsTimeout.cancel()); + + return Promise.race([ + this.tsconfigProvider.getConfigsForWorkspace(getConfigsTimeout.token).then(x => Array.from(x)), + wait(this.findConfigFilesTimeout).then(() => { + getConfigsTimeout.cancel(); + return []; + }), + ]); } private static async getCommand(project: TSConfig): Promise { diff --git a/extensions/typescript-language-features/src/task/tsconfigProvider.ts b/extensions/typescript-language-features/src/task/tsconfigProvider.ts index 247b6bb321a..16dca92cc62 100644 --- a/extensions/typescript-language-features/src/task/tsconfigProvider.ts +++ b/extensions/typescript-language-features/src/task/tsconfigProvider.ts @@ -4,7 +4,6 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { wait } from '../test/testUtils'; export interface TSConfig { readonly uri: vscode.Uri; @@ -14,13 +13,13 @@ export interface TSConfig { } export class TsConfigProvider { - public async getConfigsForWorkspace(options?: { timeout: number }): Promise> { + public async getConfigsForWorkspace(token: vscode.CancellationToken): Promise> { if (!vscode.workspace.workspaceFolders) { return []; } const configs = new Map(); - for (const config of await this.findConfigFiles(options)) { + for (const config of await this.findConfigFiles(token)) { const root = vscode.workspace.getWorkspaceFolder(config); if (root) { configs.set(config.fsPath, { @@ -34,21 +33,7 @@ export class TsConfigProvider { return configs.values(); } - private async findConfigFiles(options?: { timeout: number }): Promise { - const timeout = options?.timeout; - const task = (token?: vscode.CancellationToken) => vscode.workspace.findFiles('**/tsconfig*.json', '**/{node_modules,.*}/**', undefined, token); - - if (typeof timeout === 'number') { - const cancel = new vscode.CancellationTokenSource(); - return Promise.race([ - task(cancel.token), - wait(timeout).then(() => { - cancel.cancel(); - return []; - }), - ]); - } else { - return task(); - } + private async findConfigFiles(token: vscode.CancellationToken): Promise { + return await vscode.workspace.findFiles('**/tsconfig*.json', '**/{node_modules,.*}/**', undefined, token); } } From 017a42552bcea08cf5376cf6b576239715f3ec89 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 16:13:55 -0700 Subject: [PATCH 0145/1667] Use Promise.all to perform config finding in parallel instead of sequentially For #87494 --- .../src/task/taskProvider.ts | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/extensions/typescript-language-features/src/task/taskProvider.ts b/extensions/typescript-language-features/src/task/taskProvider.ts index babb4c8c9e2..588722af268 100644 --- a/extensions/typescript-language-features/src/task/taskProvider.ts +++ b/extensions/typescript-language-features/src/task/taskProvider.ts @@ -9,6 +9,7 @@ import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; import { wait } from '../test/testUtils'; import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService'; +import { coalesce, flatten } from '../utils/arrays'; import { isTsConfigFileName } from '../utils/languageDescription'; import { Lazy } from '../utils/lazy'; import { isImplicitProjectConfigFile } from '../utils/tsconfig'; @@ -103,17 +104,14 @@ class TscTaskProvider implements vscode.TaskProvider { } private async getAllTsConfigs(token: vscode.CancellationToken): Promise { - const out = new Set(); - const configs = [ - ...await this.getTsConfigForActiveFile(token), - ...await this.getTsConfigsInWorkspace(token) - ]; - for (const config of configs) { - if (await exists(config.uri)) { - out.add(config); - } - } - return Array.from(out); + const configs = flatten(await Promise.all([ + this.getTsConfigForActiveFile(token), + this.getTsConfigsInWorkspace(token), + ])); + + return Promise.all( + configs.map(async config => await exists(config.uri) ? config : undefined), + ).then(coalesce); } private async getTsConfigForActiveFile(token: vscode.CancellationToken): Promise { From c3651027bac025df1d9e4c07898228f9f419e04b Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 16:23:49 -0700 Subject: [PATCH 0146/1667] Use enum --- .../src/task/taskProvider.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/extensions/typescript-language-features/src/task/taskProvider.ts b/extensions/typescript-language-features/src/task/taskProvider.ts index 588722af268..aa2fd99325f 100644 --- a/extensions/typescript-language-features/src/task/taskProvider.ts +++ b/extensions/typescript-language-features/src/task/taskProvider.ts @@ -17,7 +17,12 @@ import { TSConfig, TsConfigProvider } from './tsconfigProvider'; const localize = nls.loadMessageBundle(); -type AutoDetect = 'on' | 'off' | 'build' | 'watch'; +enum AutoDetect { + on = 'on', + off = 'off', + build = 'build', + watch = 'watch' +} const exists = async (resource: vscode.Uri): Promise => { try { @@ -42,7 +47,7 @@ class TscTaskProvider implements vscode.TaskProvider { private readonly projectInfoRequestTimeout = 2000; private readonly findConfigFilesTimeout = 5000; - private autoDetect: AutoDetect = 'on'; + private autoDetect = AutoDetect.on; private readonly tsconfigProvider: TsConfigProvider; private readonly disposables: vscode.Disposable[] = []; @@ -61,7 +66,7 @@ class TscTaskProvider implements vscode.TaskProvider { public async provideTasks(token: vscode.CancellationToken): Promise { const folders = vscode.workspace.workspaceFolders; - if ((this.autoDetect === 'off') || !folders || !folders.length) { + if ((this.autoDetect === AutoDetect.off) || !folders || !folders.length) { return []; } @@ -245,11 +250,11 @@ class TscTaskProvider implements vscode.TaskProvider { const tasks: vscode.Task[] = []; - if (this.autoDetect === 'build' || this.autoDetect === 'on') { + if (this.autoDetect === AutoDetect.build || this.autoDetect === AutoDetect.on) { tasks.push(this.getBuildTask(project.workspaceFolder, label, command, args, { type: 'typescript', tsconfig: label })); } - if (this.autoDetect === 'watch' || this.autoDetect === 'on') { + if (this.autoDetect === AutoDetect.watch || this.autoDetect === AutoDetect.on) { tasks.push(this.getWatchTask(project.workspaceFolder, label, command, args, { type: 'typescript', tsconfig: label, option: 'watch' })); } @@ -298,7 +303,7 @@ class TscTaskProvider implements vscode.TaskProvider { private onConfigurationChanged(): void { const type = vscode.workspace.getConfiguration('typescript.tsc').get('autoDetect'); - this.autoDetect = typeof type === 'undefined' ? 'on' : type; + this.autoDetect = typeof type === 'undefined' ? AutoDetect.on : type; } } From f8f2538d203c94f096910887469d757848766bdd Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 16:26:04 -0700 Subject: [PATCH 0147/1667] Move exists to own file --- .../src/task/taskProvider.ts | 10 +--------- .../typescript-language-features/src/utils/fs.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 extensions/typescript-language-features/src/utils/fs.ts diff --git a/extensions/typescript-language-features/src/task/taskProvider.ts b/extensions/typescript-language-features/src/task/taskProvider.ts index aa2fd99325f..978ed88692f 100644 --- a/extensions/typescript-language-features/src/task/taskProvider.ts +++ b/extensions/typescript-language-features/src/task/taskProvider.ts @@ -10,6 +10,7 @@ import * as nls from 'vscode-nls'; import { wait } from '../test/testUtils'; import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService'; import { coalesce, flatten } from '../utils/arrays'; +import { exists } from '../utils/fs'; import { isTsConfigFileName } from '../utils/languageDescription'; import { Lazy } from '../utils/lazy'; import { isImplicitProjectConfigFile } from '../utils/tsconfig'; @@ -24,15 +25,6 @@ enum AutoDetect { watch = 'watch' } -const exists = async (resource: vscode.Uri): Promise => { - try { - const stat = await vscode.workspace.fs.stat(resource); - // stat.type is an enum flag - return !!(stat.type & vscode.FileType.File); - } catch { - return false; - } -}; interface TypeScriptTaskDefinition extends vscode.TaskDefinition { tsconfig: string; diff --git a/extensions/typescript-language-features/src/utils/fs.ts b/extensions/typescript-language-features/src/utils/fs.ts new file mode 100644 index 00000000000..88ce3e3aa75 --- /dev/null +++ b/extensions/typescript-language-features/src/utils/fs.ts @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; + +export const exists = async (resource: vscode.Uri): Promise => { + try { + const stat = await vscode.workspace.fs.stat(resource); + // stat.type is an enum flag + return !!(stat.type & vscode.FileType.File); + } catch { + return false; + } +}; From f26d81979f7d1c7fb3504bd177260817b1767166 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 16:27:21 -0700 Subject: [PATCH 0148/1667] Extend disposable --- .../src/task/taskProvider.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/extensions/typescript-language-features/src/task/taskProvider.ts b/extensions/typescript-language-features/src/task/taskProvider.ts index 978ed88692f..75ca51278dd 100644 --- a/extensions/typescript-language-features/src/task/taskProvider.ts +++ b/extensions/typescript-language-features/src/task/taskProvider.ts @@ -10,6 +10,7 @@ import * as nls from 'vscode-nls'; import { wait } from '../test/testUtils'; import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService'; import { coalesce, flatten } from '../utils/arrays'; +import { Disposable } from '../utils/dispose'; import { exists } from '../utils/fs'; import { isTsConfigFileName } from '../utils/languageDescription'; import { Lazy } from '../utils/lazy'; @@ -34,28 +35,24 @@ interface TypeScriptTaskDefinition extends vscode.TaskDefinition { /** * Provides tasks for building `tsconfig.json` files in a project. */ -class TscTaskProvider implements vscode.TaskProvider { +class TscTaskProvider extends Disposable implements vscode.TaskProvider { private readonly projectInfoRequestTimeout = 2000; private readonly findConfigFilesTimeout = 5000; private autoDetect = AutoDetect.on; private readonly tsconfigProvider: TsConfigProvider; - private readonly disposables: vscode.Disposable[] = []; public constructor( private readonly client: Lazy ) { + super(); this.tsconfigProvider = new TsConfigProvider(); - vscode.workspace.onDidChangeConfiguration(this.onConfigurationChanged, this, this.disposables); + this._register(vscode.workspace.onDidChangeConfiguration(this.onConfigurationChanged, this)); this.onConfigurationChanged(); } - dispose() { - this.disposables.forEach(x => x.dispose()); - } - public async provideTasks(token: vscode.CancellationToken): Promise { const folders = vscode.workspace.workspaceFolders; if ((this.autoDetect === AutoDetect.off) || !folders || !folders.length) { From 84dbc21783ad21908e1921924ba5f07506f98418 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 16:36:13 -0700 Subject: [PATCH 0149/1667] Pick up TS 4.0.3 --- extensions/package.json | 2 +- extensions/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/package.json b/extensions/package.json index 97870c8d51b..b3469e53913 100644 --- a/extensions/package.json +++ b/extensions/package.json @@ -3,7 +3,7 @@ "version": "0.0.1", "description": "Dependencies shared by all extensions", "dependencies": { - "typescript": "4.0.2" + "typescript": "4.0.3" }, "scripts": { "postinstall": "node ./postinstall" diff --git a/extensions/yarn.lock b/extensions/yarn.lock index 8ed194dd356..20586e5c587 100644 --- a/extensions/yarn.lock +++ b/extensions/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -typescript@4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.2.tgz#7ea7c88777c723c681e33bf7988be5d008d05ac2" - integrity sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ== +typescript@4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.3.tgz#153bbd468ef07725c1df9c77e8b453f8d36abba5" + integrity sha512-tEu6DGxGgRJPb/mVPIZ48e69xCn2yRmCgYmDugAVwmJ6o+0u1RI18eO7E7WBTLYLaEVVOhwQmcdhQHweux/WPg== From e8572c022163b7db3e0424549bdb5ac32b7ebd4e Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Fri, 18 Sep 2020 17:20:36 -0700 Subject: [PATCH 0150/1667] remove dom deprecated refs refs #103454 --- .../browser/ui/actionbar/actionViewItems.ts | 6 ++-- .../browser/ui/contextview/contextview.ts | 8 ++--- src/vs/base/browser/ui/dialog/dialog.ts | 14 ++++---- src/vs/base/browser/ui/menu/menu.ts | 36 +++++++++---------- src/vs/base/browser/ui/menu/menubar.ts | 18 +++++----- .../browser/menuEntryActionViewItem.ts | 11 +++--- .../contextview/browser/contextMenuHandler.ts | 4 +-- .../browser/parts/compositeBarActions.ts | 6 ++-- .../workbench/browser/parts/compositePart.ts | 4 +-- .../browser/parts/titlebar/titlebarPart.ts | 4 +-- .../browser/parts/views/viewPaneContainer.ts | 4 +-- .../comments/browser/commentFormActions.ts | 3 +- 12 files changed, 58 insertions(+), 60 deletions(-) diff --git a/src/vs/base/browser/ui/actionbar/actionViewItems.ts b/src/vs/base/browser/ui/actionbar/actionViewItems.ts index cd1f27f6b9b..0968da8a678 100644 --- a/src/vs/base/browser/ui/actionbar/actionViewItems.ts +++ b/src/vs/base/browser/ui/actionbar/actionViewItems.ts @@ -14,7 +14,7 @@ import { EventType as TouchEventType, Gesture } from 'vs/base/browser/touch'; import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview'; import { DataTransfers } from 'vs/base/browser/dnd'; import { isFirefox } from 'vs/base/browser/browser'; -import { $, addClasses, addDisposableListener, append, EventHelper, EventLike, EventType, removeClasses, removeTabIndexAndUpdateFocus } from 'vs/base/browser/dom'; +import { $, addDisposableListener, append, EventHelper, EventLike, EventType, removeTabIndexAndUpdateFocus } from 'vs/base/browser/dom'; export interface IBaseActionViewItemOptions { draggable?: boolean; @@ -294,7 +294,7 @@ export class ActionViewItem extends BaseActionViewItem { updateClass(): void { if (this.cssClass && this.label) { - removeClasses(this.label, this.cssClass); + this.label.classList.remove(...this.cssClass.split(' ')); } if (this.options.icon) { @@ -303,7 +303,7 @@ export class ActionViewItem extends BaseActionViewItem { if (this.label) { this.label.classList.add('codicon'); if (this.cssClass) { - addClasses(this.label, this.cssClass); + this.label.classList.add(...this.cssClass.split(' ')); } } diff --git a/src/vs/base/browser/ui/contextview/contextview.ts b/src/vs/base/browser/ui/contextview/contextview.ts index d4aa1a0bede..82e9fddfa28 100644 --- a/src/vs/base/browser/ui/contextview/contextview.ts +++ b/src/vs/base/browser/ui/contextview/contextview.ts @@ -295,10 +295,10 @@ export class ContextView extends Disposable { const left = layout(window.innerWidth, viewSizeWidth, horizontalAnchor); - DOM.removeClasses(this.view, 'top', 'bottom', 'left', 'right'); - DOM.addClass(this.view, anchorPosition === AnchorPosition.BELOW ? 'bottom' : 'top'); - DOM.addClass(this.view, anchorAlignment === AnchorAlignment.LEFT ? 'left' : 'right'); - DOM.toggleClass(this.view, 'fixed', this.useFixedPosition); + this.view.classList.remove('top', 'bottom', 'left', 'right'); + this.view.classList.add(anchorPosition === AnchorPosition.BELOW ? 'bottom' : 'top'); + this.view.classList.add(anchorAlignment === AnchorAlignment.LEFT ? 'left' : 'right'); + this.view.classList.toggle('fixed', this.useFixedPosition); const containerPosition = DOM.getDomNodePagePosition(this.container!); this.view.style.top = `${top - (this.useFixedPosition ? DOM.getDomNodePagePosition(this.view).top : containerPosition.top)}px`; diff --git a/src/vs/base/browser/ui/dialog/dialog.ts b/src/vs/base/browser/ui/dialog/dialog.ts index 623aa9c00d0..93df3c8f22d 100644 --- a/src/vs/base/browser/ui/dialog/dialog.ts +++ b/src/vs/base/browser/ui/dialog/dialog.ts @@ -6,7 +6,7 @@ import 'vs/css!./dialog'; import * as nls from 'vs/nls'; import { Disposable } from 'vs/base/common/lifecycle'; -import { $, hide, show, EventHelper, clearNode, removeClasses, addClasses, removeNode, isAncestor, addDisposableListener, EventType } from 'vs/base/browser/dom'; +import { $, hide, show, EventHelper, clearNode, isAncestor, addDisposableListener, EventType } from 'vs/base/browser/dom'; import { domEvent } from 'vs/base/browser/event'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; @@ -234,23 +234,23 @@ export class Dialog extends Disposable { } })); - removeClasses(this.iconElement, dialogErrorIcon.classNames, dialogWarningIcon.classNames, dialogInfoIcon.classNames, Codicon.loading.classNames); + this.iconElement.classList.remove(...dialogErrorIcon.classNamesArray, ...dialogWarningIcon.classNamesArray, ...dialogInfoIcon.classNamesArray, ...Codicon.loading.classNamesArray); switch (this.options.type) { case 'error': - addClasses(this.iconElement, dialogErrorIcon.classNames); + this.iconElement.classList.add(...dialogErrorIcon.classNamesArray); break; case 'warning': - addClasses(this.iconElement, dialogWarningIcon.classNames); + this.iconElement.classList.add(...dialogWarningIcon.classNamesArray); break; case 'pending': - addClasses(this.iconElement, Codicon.loading.classNames, 'codicon-animation-spin'); + this.iconElement.classList.add(...Codicon.loading.classNamesArray, 'codicon-animation-spin'); break; case 'none': case 'info': case 'question': default: - addClasses(this.iconElement, dialogInfoIcon.classNames); + this.iconElement.classList.add(...dialogInfoIcon.classNamesArray); break; } @@ -334,7 +334,7 @@ export class Dialog extends Disposable { dispose(): void { super.dispose(); if (this.modal) { - removeNode(this.modal); + this.modal.remove(); this.modal = undefined; } diff --git a/src/vs/base/browser/ui/menu/menu.ts b/src/vs/base/browser/ui/menu/menu.ts index 608b6db98d7..92200558707 100644 --- a/src/vs/base/browser/ui/menu/menu.ts +++ b/src/vs/base/browser/ui/menu/menu.ts @@ -8,7 +8,7 @@ import * as strings from 'vs/base/common/strings'; import { IActionRunner, IAction, SubmenuAction, Separator, IActionViewItemProvider } from 'vs/base/common/actions'; import { ActionBar, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar'; import { ResolvedKeybinding, KeyCode } from 'vs/base/common/keyCodes'; -import { addClass, EventType, EventHelper, EventLike, removeTabIndexAndUpdateFocus, isAncestor, hasClass, addDisposableListener, removeClass, append, $, addClasses, removeClasses, clearNode, createStyleSheet, isInShadowDOM, getActiveElement, Dimension, IDomNodePagePosition } from 'vs/base/browser/dom'; +import { EventType, EventHelper, EventLike, removeTabIndexAndUpdateFocus, isAncestor, addDisposableListener, append, $, clearNode, createStyleSheet, isInShadowDOM, getActiveElement, Dimension, IDomNodePagePosition } from 'vs/base/browser/dom'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { RunOnceScheduler } from 'vs/base/common/async'; import { DisposableStore } from 'vs/base/common/lifecycle'; @@ -73,10 +73,10 @@ export class Menu extends ActionBar { protected styleSheet: HTMLStyleElement | undefined; constructor(container: HTMLElement, actions: ReadonlyArray, options: IMenuOptions = {}) { - addClass(container, 'monaco-menu-container'); + container.classList.add('monaco-menu-container'); container.setAttribute('role', 'presentation'); const menuElement = document.createElement('div'); - addClass(menuElement, 'monaco-menu'); + menuElement.classList.add('monaco-menu'); menuElement.setAttribute('role', 'presentation'); super(menuElement, { @@ -171,7 +171,7 @@ export class Menu extends ActionBar { target = target.parentElement; } - if (hasClass(target, 'action-item')) { + if (target.classList.contains('action-item')) { const lastFocusedItem = this.focusedItem; this.setFocusedItem(target); @@ -597,37 +597,37 @@ class BaseMenuActionViewItem extends BaseActionViewItem { updateClass(): void { if (this.cssClass && this.item) { - removeClasses(this.item, this.cssClass); + this.item.classList.remove(...this.cssClass.split(' ')); } if (this.options.icon && this.label) { this.cssClass = this.getAction().class || ''; - addClass(this.label, 'icon'); + this.label.classList.add('icon'); if (this.cssClass) { - addClasses(this.label, this.cssClass); + this.label.classList.add(...this.cssClass.split(' ')); } this.updateEnabled(); } else if (this.label) { - removeClass(this.label, 'icon'); + this.label.classList.remove('icon'); } } updateEnabled(): void { if (this.getAction().enabled) { if (this.element) { - removeClass(this.element, 'disabled'); + this.element.classList.remove('disabled'); } if (this.item) { - removeClass(this.item, 'disabled'); + this.item.classList.remove('disabled'); this.item.tabIndex = 0; } } else { if (this.element) { - addClass(this.element, 'disabled'); + this.element.classList.add('disabled'); } if (this.item) { - addClass(this.item, 'disabled'); + this.item.classList.add('disabled'); removeTabIndexAndUpdateFocus(this.item); } } @@ -639,11 +639,11 @@ class BaseMenuActionViewItem extends BaseActionViewItem { } if (this.getAction().checked) { - addClass(this.item, 'checked'); + this.item.classList.add('checked'); this.item.setAttribute('role', 'menuitemcheckbox'); this.item.setAttribute('aria-checked', 'true'); } else { - removeClass(this.item, 'checked'); + this.item.classList.remove('checked'); this.item.setAttribute('role', 'menuitem'); this.item.setAttribute('aria-checked', 'false'); } @@ -658,7 +658,7 @@ class BaseMenuActionViewItem extends BaseActionViewItem { return; } - const isSelected = this.element && hasClass(this.element, 'focused'); + const isSelected = this.element && this.element.classList.contains('focused'); const fgColor = isSelected && this.menuStyle.selectionForegroundColor ? this.menuStyle.selectionForegroundColor : this.menuStyle.foregroundColor; const bgColor = isSelected && this.menuStyle.selectionBackgroundColor ? this.menuStyle.selectionBackgroundColor : undefined; const border = isSelected && this.menuStyle.selectionBorderColor ? `thin solid ${this.menuStyle.selectionBorderColor}` : ''; @@ -726,7 +726,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem { } if (this.item) { - addClass(this.item, 'monaco-submenu-item'); + this.item.classList.add('monaco-submenu-item'); this.item.setAttribute('aria-haspopup', 'true'); this.updateAriaExpanded('false'); this.submenuIndicator = append(this.item, $('span.submenu-indicator' + menuSubmenuIcon.cssSelector)); @@ -841,7 +841,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem { if (!this.parentData.submenu) { this.updateAriaExpanded('true'); this.submenuContainer = append(this.element, $('div.monaco-submenu')); - addClasses(this.submenuContainer, 'menubar-menu-items-holder', 'context-view'); + this.submenuContainer.classList.add('menubar-menu-items-holder', 'context-view'); // Set the top value of the menu container before construction // This allows the menu constructor to calculate the proper max height @@ -919,7 +919,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem { return; } - const isSelected = this.element && hasClass(this.element, 'focused'); + const isSelected = this.element && this.element.classList.contains('focused'); const fgColor = isSelected && this.menuStyle.selectionForegroundColor ? this.menuStyle.selectionForegroundColor : this.menuStyle.foregroundColor; if (this.submenuIndicator) { diff --git a/src/vs/base/browser/ui/menu/menubar.ts b/src/vs/base/browser/ui/menu/menubar.ts index 3a0c90d47e7..cb03f5f2df7 100644 --- a/src/vs/base/browser/ui/menu/menubar.ts +++ b/src/vs/base/browser/ui/menu/menubar.ts @@ -100,7 +100,7 @@ export class MenuBar extends Disposable { this.container.setAttribute('role', 'menubar'); if (this.options.compactMode !== undefined) { - DOM.addClass(this.container, 'compact'); + this.container.classList.add('compact'); } this.menuCache = []; @@ -425,12 +425,12 @@ export class MenuBar extends Disposable { super.dispose(); this.menuCache.forEach(menuBarMenu => { - DOM.removeNode(menuBarMenu.titleElement); - DOM.removeNode(menuBarMenu.buttonElement); + menuBarMenu.titleElement.remove(); + menuBarMenu.buttonElement.remove(); }); - DOM.removeNode(this.overflowMenu.titleElement); - DOM.removeNode(this.overflowMenu.buttonElement); + this.overflowMenu.titleElement.remove(); + this.overflowMenu.buttonElement.remove(); dispose(this.overflowLayoutScheduled); this.overflowLayoutScheduled = undefined; @@ -509,7 +509,7 @@ export class MenuBar extends Disposable { } if (this.overflowMenu.buttonElement.nextElementSibling !== this.menuCache[this.numMenusShown].buttonElement) { - DOM.removeNode(this.overflowMenu.buttonElement); + this.overflowMenu.buttonElement.remove(); this.container.insertBefore(this.overflowMenu.buttonElement, this.menuCache[this.numMenusShown].buttonElement); this.overflowMenu.buttonElement.style.visibility = 'visible'; } @@ -520,7 +520,7 @@ export class MenuBar extends Disposable { this.overflowMenu.actions.push(...compactMenuActions); } } else { - DOM.removeNode(this.overflowMenu.buttonElement); + this.overflowMenu.buttonElement.remove(); this.container.appendChild(this.overflowMenu.buttonElement); this.overflowMenu.buttonElement.style.visibility = 'hidden'; } @@ -923,7 +923,7 @@ export class MenuBar extends Disposable { if (this.focusedMenu.holder) { if (this.focusedMenu.holder.parentElement) { - DOM.removeClass(this.focusedMenu.holder.parentElement, 'open'); + this.focusedMenu.holder.parentElement.classList.remove('open'); } this.focusedMenu.holder.remove(); @@ -947,7 +947,7 @@ export class MenuBar extends Disposable { const menuHolder = $('div.menubar-menu-items-holder', { 'title': '' }); - DOM.addClass(customMenu.buttonElement, 'open'); + customMenu.buttonElement.classList.add('open'); if (this.options.compactMode === Direction.Right) { menuHolder.style.top = `0px`; diff --git a/src/vs/platform/actions/browser/menuEntryActionViewItem.ts b/src/vs/platform/actions/browser/menuEntryActionViewItem.ts index a269a486852..3975c7fbd7e 100644 --- a/src/vs/platform/actions/browser/menuEntryActionViewItem.ts +++ b/src/vs/platform/actions/browser/menuEntryActionViewItem.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { addClasses, createCSSRule, removeClasses, asCSSUrl } from 'vs/base/browser/dom'; +import { createCSSRule, asCSSUrl } from 'vs/base/browser/dom'; import { domEvent } from 'vs/base/browser/event'; import { IAction, Separator } from 'vs/base/common/actions'; import { Emitter } from 'vs/base/common/event'; @@ -237,10 +237,10 @@ export class MenuEntryActionViewItem extends ActionViewItem { // theme icons const iconClass = ThemeIcon.asClassName(icon); if (this.label && iconClass) { - addClasses(this.label, iconClass); + this.label.classList.add(...iconClass.split(' ')); this._itemClassDispose.value = toDisposable(() => { if (this.label) { - removeClasses(this.label, iconClass); + this.label.classList.remove(...iconClass.split(' ')); } }); } @@ -263,11 +263,10 @@ export class MenuEntryActionViewItem extends ActionViewItem { } if (this.label) { - - addClasses(this.label, 'icon', iconClass); + this.label.classList.add('icon', ...iconClass.split(' ')); this._itemClassDispose.value = toDisposable(() => { if (this.label) { - removeClasses(this.label, 'icon', iconClass); + this.label.classList.remove('icon', ...iconClass.split(' ')); } }); } diff --git a/src/vs/platform/contextview/browser/contextMenuHandler.ts b/src/vs/platform/contextview/browser/contextMenuHandler.ts index 1804ce3328e..d307c29276b 100644 --- a/src/vs/platform/contextview/browser/contextMenuHandler.ts +++ b/src/vs/platform/contextview/browser/contextMenuHandler.ts @@ -14,7 +14,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IContextMenuDelegate } from 'vs/base/browser/contextmenu'; -import { EventType, $, removeNode, isHTMLElement } from 'vs/base/browser/dom'; +import { EventType, $, isHTMLElement } from 'vs/base/browser/dom'; import { attachMenuStyler } from 'vs/platform/theme/common/styler'; import { domEvent } from 'vs/base/browser/event'; import { StandardMouseEvent } from 'vs/base/browser/mouseEvent'; @@ -132,7 +132,7 @@ export class ContextMenuHandler { } if (this.block) { - removeNode(this.block); + this.block.remove(); this.block = null; } diff --git a/src/vs/workbench/browser/parts/compositeBarActions.ts b/src/vs/workbench/browser/parts/compositeBarActions.ts index 01a0c16c51b..be07132e53f 100644 --- a/src/vs/workbench/browser/parts/compositeBarActions.ts +++ b/src/vs/workbench/browser/parts/compositeBarActions.ts @@ -299,8 +299,8 @@ export class ActivityActionViewItem extends BaseActionViewItem { } if (clazz) { - dom.addClasses(this.badge, clazz); - this.badgeDisposable.value = toDisposable(() => dom.removeClasses(this.badge, clazz)); + this.badge.classList.add(...clazz.split(' ')); + this.badgeDisposable.value = toDisposable(() => this.badge.classList.remove(...clazz.split(' '))); } } @@ -323,7 +323,7 @@ export class ActivityActionViewItem extends BaseActionViewItem { this.label.className = 'action-label'; if (this.activity.cssClass) { - dom.addClasses(this.label, this.activity.cssClass); + this.label.classList.add(...this.activity.cssClass.split(' ')); } if (this.options.icon && !this.activity.iconUrl) { diff --git a/src/vs/workbench/browser/parts/compositePart.ts b/src/vs/workbench/browser/parts/compositePart.ts index 6d9d046678a..556c347822d 100644 --- a/src/vs/workbench/browser/parts/compositePart.ts +++ b/src/vs/workbench/browser/parts/compositePart.ts @@ -28,7 +28,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { attachProgressBarStyler } from 'vs/platform/theme/common/styler'; import { INotificationService } from 'vs/platform/notification/common/notification'; -import { Dimension, append, $, hide, show, addClasses } from 'vs/base/browser/dom'; +import { Dimension, append, $, hide, show } from 'vs/base/browser/dom'; import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview'; import { assertIsDefined, withNullAsUndefined } from 'vs/base/common/types'; @@ -213,7 +213,7 @@ export abstract class CompositePart extends Part { // Build Container off-DOM compositeContainer = $('.composite'); - addClasses(compositeContainer, this.compositeCSSClass); + compositeContainer.classList.add(...this.compositeCSSClass.split(' ')); compositeContainer.id = composite.getId(); composite.create(compositeContainer); diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts index 8310d162e06..fa7ce81e939 100644 --- a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts @@ -25,7 +25,7 @@ import { isMacintosh, isWindows, isLinux, isWeb } from 'vs/base/common/platform' import { URI } from 'vs/base/common/uri'; import { Color } from 'vs/base/common/color'; import { trim } from 'vs/base/common/strings'; -import { EventType, EventHelper, Dimension, isAncestor, append, $, addDisposableListener, runAtThisOrScheduleAtNextAnimationFrame, removeNode } from 'vs/base/browser/dom'; +import { EventType, EventHelper, Dimension, isAncestor, append, $, addDisposableListener, runAtThisOrScheduleAtNextAnimationFrame } from 'vs/base/browser/dom'; import { CustomMenubarControl } from 'vs/workbench/browser/parts/titlebar/menubarControl'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { template } from 'vs/base/common/labels'; @@ -319,7 +319,7 @@ export class TitlebarPart extends Part implements ITitleService { } if (this.menubar) { - removeNode(this.menubar); + this.menubar.remove(); this.menubar = undefined; } } diff --git a/src/vs/workbench/browser/parts/views/viewPaneContainer.ts b/src/vs/workbench/browser/parts/views/viewPaneContainer.ts index c5817766f90..6e94dbf812f 100644 --- a/src/vs/workbench/browser/parts/views/viewPaneContainer.ts +++ b/src/vs/workbench/browser/parts/views/viewPaneContainer.ts @@ -9,7 +9,7 @@ import { Event, Emitter } from 'vs/base/common/event'; import { ColorIdentifier, activeContrastBorder, foreground } from 'vs/platform/theme/common/colorRegistry'; import { attachStyler, IColorMapping, attachButtonStyler, attachLinkStyler, attachProgressBarStyler } from 'vs/platform/theme/common/styler'; import { SIDE_BAR_DRAG_AND_DROP_BACKGROUND, SIDE_BAR_SECTION_HEADER_FOREGROUND, SIDE_BAR_SECTION_HEADER_BACKGROUND, SIDE_BAR_SECTION_HEADER_BORDER, PANEL_BACKGROUND, SIDE_BAR_BACKGROUND, PANEL_SECTION_HEADER_FOREGROUND, PANEL_SECTION_HEADER_BACKGROUND, PANEL_SECTION_HEADER_BORDER, PANEL_SECTION_DRAG_AND_DROP_BACKGROUND, PANEL_SECTION_BORDER } from 'vs/workbench/common/theme'; -import { after, append, $, trackFocus, EventType, isAncestor, Dimension, addDisposableListener, createCSSRule, asCSSUrl, addClasses } from 'vs/base/browser/dom'; +import { after, append, $, trackFocus, EventType, isAncestor, Dimension, addDisposableListener, createCSSRule, asCSSUrl } from 'vs/base/browser/dom'; import { IDisposable, combinedDisposable, dispose, toDisposable, Disposable, DisposableStore } from 'vs/base/common/lifecycle'; import { IAction, Separator, IActionViewItem } from 'vs/base/common/actions'; import { ActionsOrientation, prepareActions } from 'vs/base/browser/ui/actionbar/actionbar'; @@ -361,7 +361,7 @@ export abstract class ViewPane extends Pane implements IView { } if (cssClass) { - addClasses(this.iconContainer, cssClass); + this.iconContainer.classList.add(...cssClass.split(' ')); } const calculatedTitle = this.calculateTitle(title); diff --git a/src/vs/workbench/contrib/comments/browser/commentFormActions.ts b/src/vs/workbench/contrib/comments/browser/commentFormActions.ts index 1b7a6d7ae2e..71de392b373 100644 --- a/src/vs/workbench/contrib/comments/browser/commentFormActions.ts +++ b/src/vs/workbench/contrib/comments/browser/commentFormActions.ts @@ -3,7 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as DOM from 'vs/base/browser/dom'; import { Button } from 'vs/base/browser/ui/button/button'; import { IAction } from 'vs/base/common/actions'; import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle'; @@ -25,7 +24,7 @@ export class CommentFormActions implements IDisposable { setActions(menu: IMenu) { this._toDispose.clear(); - this._buttonElements.forEach(b => DOM.removeNode(b)); + this._buttonElements.forEach(b => b.remove()); const groups = menu.getActions({ shouldForwardArgs: true }); for (const group of groups) { From bd54e5f5cc650eb2b0b67805e416dc8b99bfccbd Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 16:51:59 -0700 Subject: [PATCH 0151/1667] Simplify showQuickPick --- .../src/languageFeatures/completions.ts | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/extensions/typescript-language-features/src/languageFeatures/completions.ts b/extensions/typescript-language-features/src/languageFeatures/completions.ts index 3f994c3ac55..989e498bad3 100644 --- a/extensions/typescript-language-features/src/languageFeatures/completions.ts +++ b/extensions/typescript-language-features/src/languageFeatures/completions.ts @@ -368,29 +368,19 @@ class ApplyCompletionCodeActionCommand implements Command { return applyCodeAction(this.client, codeActions[0], nulToken); } - interface MyQuickPickItem extends vscode.QuickPickItem { - index: number; - } - - const selection = await vscode.window.showQuickPick( - codeActions.map((action, i): MyQuickPickItem => ({ + const selection = await vscode.window.showQuickPick( + codeActions.map(action => ({ label: action.description, description: '', - index: i + action, })), { placeHolder: localize('selectCodeAction', 'Select code action to apply') - } - ); + }); - if (!selection) { - return false; + if (selection) { + return applyCodeAction(this.client, selection.action, nulToken); } - - const action = codeActions[selection.index]; - if (!action) { - return false; - } - return applyCodeAction(this.client, action, nulToken); + return false; } } From b255097c33938fbcf5ffe6fecb81cb8998b61f47 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 16:58:07 -0700 Subject: [PATCH 0152/1667] null -> undefined --- .../src/languageFeatures/completions.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/typescript-language-features/src/languageFeatures/completions.ts b/extensions/typescript-language-features/src/languageFeatures/completions.ts index 989e498bad3..73f54f20c69 100644 --- a/extensions/typescript-language-features/src/languageFeatures/completions.ts +++ b/extensions/typescript-language-features/src/languageFeatures/completions.ts @@ -434,7 +434,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider< position: vscode.Position, token: vscode.CancellationToken, context: vscode.CompletionContext - ): Promise | null> { + ): Promise | undefined> { if (this.typingsStatus.isAcquiringTypings) { return Promise.reject>({ label: localize( @@ -448,14 +448,14 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider< const file = this.client.toOpenedFilePath(document); if (!file) { - return null; + return undefined; } const line = document.lineAt(position.line); const completionConfiguration = CompletionConfiguration.getConfigurationForResource(this.modeId, document.uri); if (!this.shouldTrigger(context, line, position)) { - return null; + return undefined; } const wordRange = document.getWordRangeAtPosition(position); @@ -487,7 +487,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider< if (response.type !== 'response' || !response.body) { this.logCompletionsTelemetry(duration, response); - return null; + return undefined; } isNewIdentifierLocation = response.body.isNewIdentifierLocation; isMemberCompletion = response.body.isMemberCompletion; @@ -505,7 +505,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider< } else { const response = await this.client.interruptGetErr(() => this.client.execute('completions', args, token)); if (response.type !== 'response' || !response.body) { - return null; + return undefined; } entries = response.body; From 5b4350943e5b3cc9a9b958c8f3c0f62282ee7c68 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 17:07:28 -0700 Subject: [PATCH 0153/1667] Remove custom typings for refactor trigger reason This property has been finalized --- .../src/languageFeatures/refactor.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/extensions/typescript-language-features/src/languageFeatures/refactor.ts b/extensions/typescript-language-features/src/languageFeatures/refactor.ts index edfebfcb56b..bd7a8afc505 100644 --- a/extensions/typescript-language-features/src/languageFeatures/refactor.ts +++ b/extensions/typescript-language-features/src/languageFeatures/refactor.ts @@ -25,12 +25,6 @@ namespace Experimental { export interface RefactorActionInfo extends Proto.RefactorActionInfo { readonly notApplicableReason?: string; } - - export type RefactorTriggerReason = 'implicit' | 'invoked'; - - export interface GetApplicableRefactorsRequestArgs extends Proto.FileRangeRequestArgs { - readonly triggerReason?: RefactorTriggerReason; - } } @@ -255,7 +249,7 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { } this.formattingOptionsManager.ensureConfigurationForDocument(document, token); - const args: Experimental.GetApplicableRefactorsRequestArgs = { + const args: Proto.GetApplicableRefactorsRequestArgs = { ...typeConverters.Range.toFileRangeRequestArgs(file, rangeOrSelection), triggerReason: this.toTsTriggerReason(context), }; @@ -272,7 +266,7 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { return this.pruneInvalidActions(this.appendInvalidActions(actions), context.only, /* numberOfInvalid = */ 5); } - private toTsTriggerReason(context: vscode.CodeActionContext): Experimental.RefactorTriggerReason | undefined { + private toTsTriggerReason(context: vscode.CodeActionContext): Proto.RefactorTriggerReason | undefined { if (!context.only) { return; } From 5a7d0a1ed24b344fd5a988632697bbcba0e3d0be Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 18:17:15 -0700 Subject: [PATCH 0154/1667] Adopt resolveCodeAction for JS/TS refactorings --- .../src/languageFeatures/refactor.ts | 206 +++++++++++------- .../api/common/extHostLanguageFeatures.ts | 2 +- 2 files changed, 132 insertions(+), 76 deletions(-) diff --git a/extensions/typescript-language-features/src/languageFeatures/refactor.ts b/extensions/typescript-language-features/src/languageFeatures/refactor.ts index bd7a8afc505..ab0186c8f01 100644 --- a/extensions/typescript-language-features/src/languageFeatures/refactor.ts +++ b/extensions/typescript-language-features/src/languageFeatures/refactor.ts @@ -20,34 +20,25 @@ import FormattingOptionsManager from './fileConfigurationManager'; const localize = nls.loadMessageBundle(); - namespace Experimental { export interface RefactorActionInfo extends Proto.RefactorActionInfo { readonly notApplicableReason?: string; } } +interface DidApplyRefactoringCommand_Args { + readonly codeAction: InlinedCodeAction +} -class ApplyRefactoringCommand implements Command { - public static readonly ID = '_typescript.applyRefactoring'; - public readonly id = ApplyRefactoringCommand.ID; +class DidApplyRefactoringCommand implements Command { + public static readonly ID = '_typescript.didApplyRefactoring'; + public readonly id = DidApplyRefactoringCommand.ID; constructor( - private readonly client: ITypeScriptServiceClient, private readonly telemetryReporter: TelemetryReporter ) { } - public async execute( - document: vscode.TextDocument, - refactor: string, - action: string, - range: vscode.Range - ): Promise { - const file = this.client.toOpenedFilePath(document); - if (!file) { - return false; - } - + public async execute(args: DidApplyRefactoringCommand_Args): Promise { /* __GDPR__ "refactor.execute" : { "action" : { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" }, @@ -57,50 +48,29 @@ class ApplyRefactoringCommand implements Command { } */ this.telemetryReporter.logTelemetry('refactor.execute', { - action: action, + action: args.codeAction.action, }); - const args: Proto.GetEditsForRefactorRequestArgs = { - ...typeConverters.Range.toFileRangeRequestArgs(file, range), - refactor, - action, - }; - const response = await this.client.execute('getEditsForRefactor', args, nulToken); - if (response.type !== 'response' || !response.body) { - return false; - } - - if (!response.body.edits.length) { + if (!args.codeAction.edit?.size) { vscode.window.showErrorMessage(localize('refactoringFailed', "Could not apply refactoring")); - return false; + return; } - const workspaceEdit = await this.toWorkspaceEdit(response.body); - if (!(await vscode.workspace.applyEdit(workspaceEdit))) { - return false; - } - - const renameLocation = response.body.renameLocation; + const renameLocation = args.codeAction.renameLocation; if (renameLocation) { await vscode.commands.executeCommand('editor.action.rename', [ - document.uri, + args.codeAction.document.uri, typeConverters.Position.fromLocation(renameLocation) ]); } - return true; } +} - private async toWorkspaceEdit(body: Proto.RefactorEditInfo) { - const workspaceEdit = new vscode.WorkspaceEdit(); - for (const edit of body.edits) { - const resource = this.client.toResource(edit.fileName); - if (resource.scheme === fileSchemes.file) { - workspaceEdit.createFile(resource, { ignoreIfExists: true }); - } - } - typeConverters.WorkspaceEdit.withFileCodeEdits(workspaceEdit, this.client, body.edits); - return workspaceEdit; - } +interface SelectRefactorCommand_Args { + readonly action: vscode.CodeAction; + readonly document: vscode.TextDocument; + readonly info: Proto.ApplicableRefactorInfo; + readonly rangeOrSelection: vscode.Range | vscode.Selection; } class SelectRefactorCommand implements Command { @@ -109,26 +79,34 @@ class SelectRefactorCommand implements Command { constructor( private readonly client: ITypeScriptServiceClient, - private readonly doRefactoring: ApplyRefactoringCommand + private readonly didApplyCommand: DidApplyRefactoringCommand ) { } - public async execute( - document: vscode.TextDocument, - info: Proto.ApplicableRefactorInfo, - range: vscode.Range - ): Promise { - const file = this.client.toOpenedFilePath(document); + public async execute(args: SelectRefactorCommand_Args): Promise { + const file = this.client.toOpenedFilePath(args.document); if (!file) { - return false; + return; } - const selected = await vscode.window.showQuickPick(info.actions.map((action): vscode.QuickPickItem => ({ + + const selected = await vscode.window.showQuickPick(args.info.actions.map((action): vscode.QuickPickItem => ({ label: action.name, description: action.description, }))); if (!selected) { - return false; + return; } - return this.doRefactoring.execute(document, info.name, selected.label, range); + + const tsAction = new InlinedCodeAction(this.client, args.action.title, args.action.kind, args.document, args.info.name, selected.label, args.rangeOrSelection); + await tsAction.resolve(nulToken); + + if (tsAction.edit) { + if (!(await vscode.workspace.applyEdit(tsAction.edit))) { + vscode.window.showErrorMessage(localize('refactoringFailed', "Could not apply refactoring")); + return; + } + } + + await this.didApplyCommand.execute({ codeAction: tsAction }); } } @@ -200,7 +178,80 @@ const allKnownCodeActionKinds = [ Rewrite_Property_GenerateAccessors ]; -class TypeScriptRefactorProvider implements vscode.CodeActionProvider { +class InlinedCodeAction extends vscode.CodeAction { + constructor( + public readonly client: ITypeScriptServiceClient, + title: string, + kind: vscode.CodeActionKind | undefined, + public readonly document: vscode.TextDocument, + public readonly refactor: string, + public readonly action: string, + public readonly range: vscode.Range, + ) { + super(title, kind); + } + + // Filled in during resolve + public renameLocation?: Proto.Location; + + public async resolve(token: vscode.CancellationToken): Promise { + const file = this.client.toOpenedFilePath(this.document); + if (!file) { + return; + } + + const args: Proto.GetEditsForRefactorRequestArgs = { + ...typeConverters.Range.toFileRangeRequestArgs(file, this.range), + refactor: this.refactor, + action: this.action, + }; + + const response = await this.client.execute('getEditsForRefactor', args, token); + if (response.type !== 'response' || !response.body) { + return; + } + + // Resolve + this.edit = InlinedCodeAction.getWorkspaceEditForRefactoring(this.client, response.body); + this.renameLocation = response.body.renameLocation; + + return; + } + + private static getWorkspaceEditForRefactoring( + client: ITypeScriptServiceClient, + body: Proto.RefactorEditInfo, + ): vscode.WorkspaceEdit { + const workspaceEdit = new vscode.WorkspaceEdit(); + for (const edit of body.edits) { + const resource = client.toResource(edit.fileName); + if (resource.scheme === fileSchemes.file) { + workspaceEdit.createFile(resource, { ignoreIfExists: true }); + } + } + typeConverters.WorkspaceEdit.withFileCodeEdits(workspaceEdit, client, body.edits); + return workspaceEdit; + } +} + +class SelectCodeAction extends vscode.CodeAction { + constructor( + info: Proto.ApplicableRefactorInfo, + document: vscode.TextDocument, + rangeOrSelection: vscode.Range | vscode.Selection + ) { + super(info.description, vscode.CodeActionKind.Refactor); + this.command = { + title: info.description, + command: SelectRefactorCommand.ID, + arguments: [{ action: this, document, info, rangeOrSelection }] + }; + } +} + +type TsCodeAction = InlinedCodeAction | SelectCodeAction; + +class TypeScriptRefactorProvider implements vscode.CodeActionProvider { public static readonly minVersion = API.v240; constructor( @@ -209,8 +260,8 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { commandManager: CommandManager, telemetryReporter: TelemetryReporter ) { - const doRefactoringCommand = commandManager.register(new ApplyRefactoringCommand(this.client, telemetryReporter)); - commandManager.register(new SelectRefactorCommand(this.client, doRefactoringCommand)); + const didApplyRefactoringCommand = commandManager.register(new DidApplyRefactoringCommand(telemetryReporter)); + commandManager.register(new SelectRefactorCommand(this.client, didApplyRefactoringCommand)); } public static readonly metadata: vscode.CodeActionProviderMetadata = { @@ -234,7 +285,7 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { rangeOrSelection: vscode.Range | vscode.Selection, context: vscode.CodeActionContext, token: vscode.CancellationToken - ): Promise { + ): Promise { if (!this.shouldTrigger(rangeOrSelection, context)) { return undefined; } @@ -266,6 +317,16 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { return this.pruneInvalidActions(this.appendInvalidActions(actions), context.only, /* numberOfInvalid = */ 5); } + public async resolveCodeAction( + codeAction: TsCodeAction, + token: vscode.CancellationToken, + ): Promise { + if (codeAction instanceof InlinedCodeAction) { + await codeAction.resolve(token); + } + return codeAction; + } + private toTsTriggerReason(context: vscode.CodeActionContext): Proto.RefactorTriggerReason | undefined { if (!context.only) { return; @@ -277,16 +338,11 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { body: Proto.ApplicableRefactorInfo[], document: vscode.TextDocument, rangeOrSelection: vscode.Range | vscode.Selection - ) { - const actions: vscode.CodeAction[] = []; + ): TsCodeAction[] { + const actions: TsCodeAction[] = []; for (const info of body) { if (info.inlineable === false) { - const codeAction = new vscode.CodeAction(info.description, vscode.CodeActionKind.Refactor); - codeAction.command = { - title: info.description, - command: SelectRefactorCommand.ID, - arguments: [document, info, rangeOrSelection] - }; + const codeAction = new SelectCodeAction(info, document, rangeOrSelection); actions.push(codeAction); } else { for (const action of info.actions) { @@ -303,8 +359,8 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { info: Proto.ApplicableRefactorInfo, rangeOrSelection: vscode.Range | vscode.Selection, allActions: readonly Proto.RefactorActionInfo[], - ) { - const codeAction = new vscode.CodeAction(action.description, TypeScriptRefactorProvider.getKind(action)); + ): InlinedCodeAction { + const codeAction = new InlinedCodeAction(this.client, action.description, TypeScriptRefactorProvider.getKind(action), document, info.name, action.name, rangeOrSelection); // https://github.com/microsoft/TypeScript/pull/37871 if (action.notApplicableReason) { @@ -312,8 +368,8 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { } else { codeAction.command = { title: action.description, - command: ApplyRefactoringCommand.ID, - arguments: [document, info.name, action.name, rangeOrSelection], + command: DidApplyRefactoringCommand.ID, + arguments: [{ codeAction }], }; } diff --git a/src/vs/workbench/api/common/extHostLanguageFeatures.ts b/src/vs/workbench/api/common/extHostLanguageFeatures.ts index faab8cd6491..ef49bb42954 100644 --- a/src/vs/workbench/api/common/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/common/extHostLanguageFeatures.ts @@ -465,7 +465,7 @@ class CodeActionAdapter { if (!this._provider.resolveCodeAction) { return; // this should not happen... } - const resolvedItem = await this._provider.resolveCodeAction(item, token); + const resolvedItem = (await this._provider.resolveCodeAction(item, token)) ?? item; return resolvedItem?.edit ? typeConvert.WorkspaceEdit.from(resolvedItem.edit) : undefined; From b160164e3d9e03e1c3443ec2bcb781fa2b473b83 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 18 Sep 2020 18:28:41 -0700 Subject: [PATCH 0155/1667] Pick up latest typescript nightly for building VS Code --- build/package.json | 2 +- build/yarn.lock | 8 ++++---- package.json | 2 +- yarn.lock | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build/package.json b/build/package.json index 73c7d0a7dae..c55703abc59 100644 --- a/build/package.json +++ b/build/package.json @@ -45,7 +45,7 @@ "minimist": "^1.2.3", "request": "^2.85.0", "terser": "4.3.8", - "typescript": "^4.1.0-dev.20200916", + "typescript": "^4.1.0-dev.20200918", "vsce": "1.48.0", "vscode-telemetry-extractor": "^1.6.0", "xml2js": "^0.4.17" diff --git a/build/yarn.lock b/build/yarn.lock index 236831e9561..df3a7e60123 100644 --- a/build/yarn.lock +++ b/build/yarn.lock @@ -2535,10 +2535,10 @@ typescript@^3.0.1: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g== -typescript@^4.1.0-dev.20200916: - version "4.1.0-dev.20200916" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.0-dev.20200916.tgz#b2c803a39d9335086033009903b03e7e53e39223" - integrity sha512-ly2k/AZ3AyfIyLWhBSnW3x7aDufIS9uNRagFZin36jXb6DvZEZwtyx138u8iSvtKE1AV/VNyWLLBkZYojgBM1g== +typescript@^4.1.0-dev.20200918: + version "4.1.0-dev.20200918" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.0-dev.20200918.tgz#b00beedf2da8dbba09284085114e77bf8f329686" + integrity sha512-cEcXJvz55OH3k3cmpMYoVfqdAQ2YvgeccUmccmleUnQ8VqR8T/7GI761Qky/vGZO/VhiU3Y8xJF3oLkAkNrG1g== typical@^4.0.0: version "4.0.0" diff --git a/package.json b/package.json index d509ab5e401..e9b73b70445 100644 --- a/package.json +++ b/package.json @@ -166,7 +166,7 @@ "style-loader": "^1.0.0", "ts-loader": "^4.4.2", "tsec": "googleinterns/tsec", - "typescript": "^4.1.0-dev.20200916", + "typescript": "^4.1.0-dev.20200918", "typescript-formatter": "7.1.0", "underscore": "^1.8.2", "vinyl": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 97ae9cf2d86..a75d88cb39d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9264,10 +9264,10 @@ typescript@^2.6.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4" integrity sha1-PFtv1/beCRQmkCfwPAlGdY92c6Q= -typescript@^4.1.0-dev.20200916: - version "4.1.0-dev.20200916" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.0-dev.20200916.tgz#b2c803a39d9335086033009903b03e7e53e39223" - integrity sha512-ly2k/AZ3AyfIyLWhBSnW3x7aDufIS9uNRagFZin36jXb6DvZEZwtyx138u8iSvtKE1AV/VNyWLLBkZYojgBM1g== +typescript@^4.1.0-dev.20200918: + version "4.1.0-dev.20200918" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.0-dev.20200918.tgz#b00beedf2da8dbba09284085114e77bf8f329686" + integrity sha512-cEcXJvz55OH3k3cmpMYoVfqdAQ2YvgeccUmccmleUnQ8VqR8T/7GI761Qky/vGZO/VhiU3Y8xJF3oLkAkNrG1g== uc.micro@^1.0.1, uc.micro@^1.0.3: version "1.0.3" From 64b2a7b0bd4e593e20c1fb02002910909afda4a6 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Sat, 19 Sep 2020 01:00:30 -0700 Subject: [PATCH 0156/1667] Reorder enum values in editor options With TS 4.1, the emit order of the string literal types here seems to have changed. Try reordering this --- src/vs/editor/common/config/editorOptions.ts | 6 +++--- .../unusualLineTerminators/unusualLineTerminators.ts | 2 +- src/vs/monaco.d.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index c3029be4d43..f11ae86a4a7 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -96,7 +96,7 @@ export interface IEditorOptions { * Remove unusual line terminators like LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS). * Defaults to 'prompt'. */ - unusualLineTerminators?: 'off' | 'prompt' | 'auto'; + unusualLineTerminators?: 'auto' | 'off' | 'prompt'; /** * Should the corresponding line be selected when clicking on the line number? * Defaults to true. @@ -4217,8 +4217,8 @@ export const EditorOptions = { )), unusualLineTerminators: register(new EditorStringEnumOption( EditorOption.unusualLineTerminators, 'unusualLineTerminators', - 'prompt' as 'off' | 'prompt' | 'auto', - ['off', 'prompt', 'auto'] as const, + 'prompt' as 'auto' | 'off' | 'prompt', + ['auto', 'off', 'prompt'] as const, { enumDescriptions: [ nls.localize('unusualLineTerminators.off', "Unusual line terminators are ignored."), diff --git a/src/vs/editor/contrib/unusualLineTerminators/unusualLineTerminators.ts b/src/vs/editor/contrib/unusualLineTerminators/unusualLineTerminators.ts index 2890a2852a2..2cef30f6fea 100644 --- a/src/vs/editor/contrib/unusualLineTerminators/unusualLineTerminators.ts +++ b/src/vs/editor/contrib/unusualLineTerminators/unusualLineTerminators.ts @@ -27,7 +27,7 @@ class UnusualLineTerminatorsDetector extends Disposable implements IEditorContri public static readonly ID = 'editor.contrib.unusualLineTerminatorsDetector'; - private _config: 'off' | 'prompt' | 'auto'; + private _config: 'auto' | 'off' | 'prompt'; constructor( private readonly _editor: ICodeEditor, diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 1e433773380..97005e1f82c 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -2635,7 +2635,7 @@ declare namespace monaco.editor { * Remove unusual line terminators like LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS). * Defaults to 'prompt'. */ - unusualLineTerminators?: 'off' | 'prompt' | 'auto'; + unusualLineTerminators?: 'auto' | 'off' | 'prompt'; /** * Should the corresponding line be selected when clicking on the line number? * Defaults to true. From 868ad44d0fb46564bc7684b3a6d1ac41c46a3c0b Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Sat, 19 Sep 2020 10:02:19 +0200 Subject: [PATCH 0157/1667] disable syncing extensions in web --- .../browser/userDataSyncResourceEnablementService.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/services/userDataSync/browser/userDataSyncResourceEnablementService.ts b/src/vs/workbench/services/userDataSync/browser/userDataSyncResourceEnablementService.ts index bda46ffbecc..624fa2a6c65 100644 --- a/src/vs/workbench/services/userDataSync/browser/userDataSyncResourceEnablementService.ts +++ b/src/vs/workbench/services/userDataSync/browser/userDataSyncResourceEnablementService.ts @@ -7,23 +7,22 @@ import { IUserDataSyncResourceEnablementService, SyncResource } from 'vs/platfor import { IStorageService } from 'vs/platform/storage/common/storage'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { UserDataSyncResourceEnablementService } from 'vs/platform/userDataSync/common/userDataSyncResourceEnablementService'; -import { IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; +import { isWeb } from 'vs/base/common/platform'; export class WebUserDataSyncResourceEnablementService extends UserDataSyncResourceEnablementService implements IUserDataSyncResourceEnablementService { constructor( @IStorageService storageService: IStorageService, @ITelemetryService telemetryService: ITelemetryService, - @IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService, ) { super(storageService, telemetryService); } protected getDefaultResourceEnablementValue(resource: SyncResource): boolean { - if (resource === SyncResource.Extensions) { - // In Web, disable syncing extensions by default when there is a remote server - return !this.extensionManagementServerService.remoteExtensionManagementServer; + // disable syncing extensions by default in web + if (resource === SyncResource.Extensions && isWeb) { + return false; } return super.getDefaultResourceEnablementValue(resource); } From 55ec2333f816eaa96c8d555a521866ecd258ed51 Mon Sep 17 00:00:00 2001 From: Pascal Fong Kye Date: Sat, 19 Sep 2020 17:10:57 +0200 Subject: [PATCH 0158/1667] Show filtered stats --- .../contrib/debug/browser/media/repl.css | 21 ++++++- .../workbench/contrib/debug/browser/repl.ts | 18 ++++++ .../contrib/debug/browser/replFilter.ts | 55 ++++++++++++++++++- 3 files changed, 92 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/media/repl.css b/src/vs/workbench/contrib/debug/browser/media/repl.css index 2eaa06164d0..b2a47407653 100644 --- a/src/vs/workbench/contrib/debug/browser/media/repl.css +++ b/src/vs/workbench/contrib/debug/browser/media/repl.css @@ -115,6 +115,25 @@ } .panel > .title .monaco-action-bar .action-item.repl-panel-filter-container { - min-width: 200px; + min-width: 300px; margin-right: 10px; } + +.repl-panel-filter-container .repl-panel-filter-controls { + position: absolute; + top: 0px; + bottom: 0; + right: 0px; + display: flex; + align-items: center; +} + +.repl-panel-filter-container .repl-panel-filter-controls > .repl-panel-filter-badge { + margin: 4px; + padding: 0px 8px; + border-radius: 2px; +} + +.repl-panel-filter-container .repl-panel-filter-controls > .repl-panel-filter-badge.hidden { + display: none; +} diff --git a/src/vs/workbench/contrib/debug/browser/repl.ts b/src/vs/workbench/contrib/debug/browser/repl.ts index 06620126115..fc538869ccb 100644 --- a/src/vs/workbench/contrib/debug/browser/repl.ts +++ b/src/vs/workbench/contrib/debug/browser/repl.ts @@ -251,6 +251,22 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget { })); } + private computeFilterStats(): { total: number, filtered: number } { + let filtered = 0; + let total = 0; + if (this.tree) { + total = this.tree.getNode().children.length; + for (const child of this.tree.getNode().children) { + if (child.visible) { + ++filtered; + } + } + } + return { + total, filtered + }; + } + get isReadonly(): boolean { // Do not allow to edit inactive sessions const session = this.tree.getInput(); @@ -574,6 +590,7 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget { } lastSelectedString = selection ? selection.toString() : ''; })); + this._register(this.tree.onDidChangeContentHeight(() => this.refreshReplElements(false))); // Make sure to select the session if debugging is already active this.selectSession(); this.styleElement = dom.createStyleSheet(this.container); @@ -665,6 +682,7 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget { } this.refreshScheduler.schedule(noDelay ? 0 : undefined); + this.filterState.filterStats = this.computeFilterStats(); } } diff --git a/src/vs/workbench/contrib/debug/browser/replFilter.ts b/src/vs/workbench/contrib/debug/browser/replFilter.ts index 978564cbfd9..5a1eacf43f9 100644 --- a/src/vs/workbench/contrib/debug/browser/replFilter.ts +++ b/src/vs/workbench/contrib/debug/browser/replFilter.ts @@ -19,9 +19,11 @@ import { Event, Emitter } from 'vs/base/common/event'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { KeyCode } from 'vs/base/common/keyCodes'; import { ContextScopedHistoryInputBox } from 'vs/platform/browser/contextScopedHistoryWidget'; -import { attachInputBoxStyler } from 'vs/platform/theme/common/styler'; +import { attachInputBoxStyler, attachStylerCallback } from 'vs/platform/theme/common/styler'; import { IThemeService } from 'vs/platform/theme/common/themeService'; +import { badgeBackground, badgeForeground, contrastBorder } from 'vs/platform/theme/common/colorRegistry'; import { ReplEvaluationResult, ReplEvaluationInput } from 'vs/workbench/contrib/debug/common/replModel'; +import { localize } from 'vs/nls'; type ParsedQuery = { @@ -84,12 +86,30 @@ export class ReplFilterState { return this._onDidChange.event; } + private readonly _onDidStatsChange: Emitter = new Emitter(); + get onDidStatsChange(): Event { + return this._onDidStatsChange.event; + } + private _filterText = ''; + private _stats = { total: 0, filtered: 0 }; get filterText(): string { return this._filterText; } + get filterStats(): { total: number, filtered: number } { + return this._stats; + } + + set filterStats(stats: { total: number, filtered: number }) { + const { total, filtered } = stats; + if (this._stats.total !== total || this._stats.filtered !== filtered) { + this._stats = { total, filtered }; + this._onDidStatsChange.fire(); + } + } + set filterText(filterText: string) { if (this._filterText !== filterText) { this._filterText = filterText; @@ -102,6 +122,7 @@ export class ReplFilterActionViewItem extends BaseActionViewItem { private delayedFilterUpdate: Delayer; private container!: HTMLElement; + private filterBadge: HTMLElement | null = null; private filterInputBox!: HistoryInputBox; constructor( @@ -123,6 +144,7 @@ export class ReplFilterActionViewItem extends BaseActionViewItem { this.element = DOM.append(this.container, DOM.$('')); this.element.className = this.class; this.createInput(this.element); + this.createBadge(this.element); this.updateClass(); } @@ -179,6 +201,37 @@ export class ReplFilterActionViewItem extends BaseActionViewItem { } } + private createBadge(container: HTMLElement): void { + const controlsContainer = DOM.append(container, DOM.$('.repl-panel-filter-controls')); + const filterBadge = this.filterBadge = DOM.append(controlsContainer, DOM.$('.repl-panel-filter-badge')); + this._register(attachStylerCallback(this.themeService, { badgeBackground, badgeForeground, contrastBorder }, colors => { + const background = colors.badgeBackground ? colors.badgeBackground.toString() : ''; + const foreground = colors.badgeForeground ? colors.badgeForeground.toString() : ''; + const border = colors.contrastBorder ? colors.contrastBorder.toString() : ''; + + filterBadge.style.backgroundColor = background; + + filterBadge.style.borderWidth = border ? '1px' : ''; + filterBadge.style.borderStyle = border ? 'solid' : ''; + filterBadge.style.borderColor = border; + filterBadge.style.color = foreground; + })); + this.updateBadge(); + this._register(this.filters.onDidStatsChange(() => this.updateBadge())); + } + + private updateBadge(): void { + if (this.filterBadge) { + const { total, filtered } = this.filters.filterStats; + const filterBadgeHidden = total === filtered || filtered === 0; + + this.filterBadge.classList.toggle('hidden', filterBadgeHidden); + this.filterBadge.textContent = localize('showing filtered repl lines', "Showing {0} of {1}", filtered, total); + + this.filterInputBox.inputElement.style.paddingRight = filterBadgeHidden ? '4px' : '150px'; + } + } + protected get class(): string { return 'panel-action-tree-filter'; } From d6606217c8aff0fcbb2462c8c41f1227bdb2f9c6 Mon Sep 17 00:00:00 2001 From: Pascal Fong Kye Date: Sat, 19 Sep 2020 17:52:38 +0200 Subject: [PATCH 0159/1667] Dynamic layout Use fixed size when pane grows instead of flex to avoid flickering --- .../contrib/debug/browser/media/repl.css | 4 +++ .../workbench/contrib/debug/browser/repl.ts | 1 + .../contrib/debug/browser/replFilter.ts | 31 ++++++++++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/debug/browser/media/repl.css b/src/vs/workbench/contrib/debug/browser/media/repl.css index b2a47407653..23307c5b58a 100644 --- a/src/vs/workbench/contrib/debug/browser/media/repl.css +++ b/src/vs/workbench/contrib/debug/browser/media/repl.css @@ -119,6 +119,10 @@ margin-right: 10px; } +.panel > .title .monaco-action-bar .action-item.repl-panel-filter-container.grow { + width: 400px; +} + .repl-panel-filter-container .repl-panel-filter-controls { position: absolute; top: 0px; diff --git a/src/vs/workbench/contrib/debug/browser/repl.ts b/src/vs/workbench/contrib/debug/browser/repl.ts index fc538869ccb..36ade4de754 100644 --- a/src/vs/workbench/contrib/debug/browser/repl.ts +++ b/src/vs/workbench/contrib/debug/browser/repl.ts @@ -447,6 +447,7 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget { protected layoutBody(height: number, width: number): void { super.layoutBody(height, width); this.dimension = new dom.Dimension(width, height); + this.filterState.layout = this.dimension; const replInputHeight = Math.min(this.replInput.getContentHeight(), height); if (this.tree) { const lastElementVisible = this.tree.scrollTop + this.tree.renderHeight >= this.tree.scrollHeight; diff --git a/src/vs/workbench/contrib/debug/browser/replFilter.ts b/src/vs/workbench/contrib/debug/browser/replFilter.ts index 5a1eacf43f9..08415cbd320 100644 --- a/src/vs/workbench/contrib/debug/browser/replFilter.ts +++ b/src/vs/workbench/contrib/debug/browser/replFilter.ts @@ -91,8 +91,14 @@ export class ReplFilterState { return this._onDidStatsChange.event; } + private readonly _onDidLayoutChange: Emitter = new Emitter(); + get onDidLayoutChange(): Event { + return this._onDidLayoutChange.event; + } + private _filterText = ''; private _stats = { total: 0, filtered: 0 }; + private _layout = new DOM.Dimension(0, 0); get filterText(): string { return this._filterText; @@ -116,6 +122,17 @@ export class ReplFilterState { this._onDidChange.fire(); } } + + get layout(): DOM.Dimension { + return this._layout; + } + + set layout(layout: DOM.Dimension) { + if (this._layout.width !== layout.width || this._layout.height !== layout.height) { + this._layout = layout; + this._onDidLayoutChange.fire(); + } + } } export class ReplFilterActionViewItem extends BaseActionViewItem { @@ -168,6 +185,7 @@ export class ReplFilterActionViewItem extends BaseActionViewItem { this._register(this.filters.onDidChange(() => { this.filterInputBox.value = this.filters.filterText; })); + this._register(this.filters.onDidLayoutChange(() => { this.updateClass(); })); this._register(DOM.addStandardDisposableListener(this.filterInputBox.inputElement, DOM.EventType.KEY_DOWN, (e: any) => this.onInputKeyDown(e))); this._register(DOM.addStandardDisposableListener(container, DOM.EventType.KEY_DOWN, this.handleKeyboardEvent)); this._register(DOM.addStandardDisposableListener(container, DOM.EventType.KEY_UP, this.handleKeyboardEvent)); @@ -232,7 +250,18 @@ export class ReplFilterActionViewItem extends BaseActionViewItem { } } + protected updateClass(): void { + if (this.element && this.container) { + this.element.className = this.class; + this.container.classList.toggle('grow', this.element.classList.contains('grow')); + } + } + protected get class(): string { - return 'panel-action-tree-filter'; + if (this.filters.layout.width > 600) { + return 'panel-action-tree-filter grow'; + } else { + return 'panel-action-tree-filter'; + } } } From 640385a87577cf11981d0c9383d5318034a1252a Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Sun, 20 Sep 2020 15:25:19 +0200 Subject: [PATCH 0160/1667] Fix #107109 --- .../browser/actions/layoutActions.ts | 19 +---- .../parts/activitybar/activitybarPart.ts | 6 +- src/vs/workbench/common/views.ts | 3 + .../views/browser/viewDescriptorService.ts | 72 ++++++++++++++++++- .../views/common/viewContainerModel.ts | 4 +- 5 files changed, 82 insertions(+), 22 deletions(-) diff --git a/src/vs/workbench/browser/actions/layoutActions.ts b/src/vs/workbench/browser/actions/layoutActions.ts index 44e73f5ccb8..986c463dc57 100644 --- a/src/vs/workbench/browser/actions/layoutActions.ts +++ b/src/vs/workbench/browser/actions/layoutActions.ts @@ -475,24 +475,7 @@ export class ResetViewLocationsAction extends Action { } async run(): Promise { - this.viewDescriptorService.viewContainers.forEach(viewContainer => { - const viewContainerModel = this.viewDescriptorService.getViewContainerModel(viewContainer); - - viewContainerModel.allViewDescriptors.forEach(viewDescriptor => { - const defaultContainer = this.viewDescriptorService.getDefaultContainerById(viewDescriptor.id); - const currentContainer = this.viewDescriptorService.getViewContainerByViewId(viewDescriptor.id); - - if (defaultContainer && currentContainer !== defaultContainer) { - this.viewDescriptorService.moveViewsToContainer([viewDescriptor], defaultContainer); - } - }); - - const defaultContainerLocation = this.viewDescriptorService.getDefaultViewContainerLocation(viewContainer); - const currentContainerLocation = this.viewDescriptorService.getViewContainerLocation(viewContainer); - if (defaultContainerLocation !== null && currentContainerLocation !== defaultContainerLocation) { - this.viewDescriptorService.moveViewContainerToLocation(viewContainer, defaultContainerLocation); - } - }); + this.viewDescriptorService.reset(); } } diff --git a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts index 688c92ae6ed..dd8cdc687cf 100644 --- a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts +++ b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts @@ -762,7 +762,11 @@ export class ActivitybarPart extends Part implements IActivityBarService { const viewContainers = this.getViewContainers(); for (const { id } of this.cachedViewContainers) { if (viewContainers.every(viewContainer => viewContainer.id !== id)) { - this.hideComposite(id); + if (this.viewDescriptorService.isViewContainerRemovedPermanently(id)) { + this.removeComposite(id); + } else { + this.hideComposite(id); + } } } } diff --git a/src/vs/workbench/common/views.ts b/src/vs/workbench/common/views.ts index 09ba0837b60..f4b3e26f92f 100644 --- a/src/vs/workbench/common/views.ts +++ b/src/vs/workbench/common/views.ts @@ -519,6 +519,7 @@ export interface IViewDescriptorService { getDefaultViewContainer(location: ViewContainerLocation): ViewContainer | undefined; getViewContainerById(id: string): ViewContainer | null; + isViewContainerRemovedPermanently(id: string): boolean; getDefaultViewContainerLocation(viewContainer: ViewContainer): ViewContainerLocation | null; getViewContainerLocation(viewContainer: ViewContainer): ViewContainerLocation | null; getViewContainersByLocation(location: ViewContainerLocation): ViewContainer[]; @@ -538,6 +539,8 @@ export interface IViewDescriptorService { readonly onDidChangeLocation: Event<{ views: IViewDescriptor[], from: ViewContainerLocation, to: ViewContainerLocation }>; moveViewToLocation(view: IViewDescriptor, location: ViewContainerLocation): void; + + reset(): void; } // Custom views diff --git a/src/vs/workbench/services/views/browser/viewDescriptorService.ts b/src/vs/workbench/services/views/browser/viewDescriptorService.ts index f8c3d2107c2..7e0ef661f13 100644 --- a/src/vs/workbench/services/views/browser/viewDescriptorService.ts +++ b/src/vs/workbench/services/views/browser/viewDescriptorService.ts @@ -17,7 +17,7 @@ import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { generateUuid } from 'vs/base/common/uuid'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { ViewContainerModel } from 'vs/workbench/services/views/common/viewContainerModel'; +import { getViewsStateStorageId, ViewContainerModel } from 'vs/workbench/services/views/common/viewContainerModel'; import { registerAction2, Action2, MenuId } from 'vs/platform/actions/common/actions'; import { localize } from 'vs/nls'; @@ -25,6 +25,8 @@ interface ICachedViewContainerInfo { containerId: string; } +function getViewContainerStorageId(viewContainerId: string): string { return `${viewContainerId}.state`; } + export class ViewDescriptorService extends Disposable implements IViewDescriptorService { declare readonly _serviceBrand: undefined; @@ -203,6 +205,11 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor private onDidRegisterExtensions(): void { // If an extension is uninstalled, this method will handle resetting views to default locations this.fallbackOrphanedViews(); + + // Clean up empty generated view containers + for (const viewContainerId of [...this.cachedViewContainerInfo.keys()]) { + this.cleanUpViewContainer(viewContainerId); + } } private onDidRegisterViews(views: { views: IViewDescriptor[], viewContainer: ViewContainer }[]): void { @@ -333,9 +340,42 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor if (from && to && from !== to) { this.moveViews(views, from, to); + this.cleanUpViewContainer(from.id); } } + reset(): void { + this.viewContainers.forEach(viewContainer => { + const viewContainerModel = this.getViewContainerModel(viewContainer); + + viewContainerModel.allViewDescriptors.forEach(viewDescriptor => { + const defaultContainer = this.getDefaultContainerById(viewDescriptor.id); + const currentContainer = this.getViewContainerByViewId(viewDescriptor.id); + + if (currentContainer && defaultContainer && currentContainer !== defaultContainer) { + this.moveViews([viewDescriptor], currentContainer, defaultContainer); + } + }); + + const defaultContainerLocation = this.getDefaultViewContainerLocation(viewContainer); + const currentContainerLocation = this.getViewContainerLocation(viewContainer); + if (defaultContainerLocation !== null && currentContainerLocation !== defaultContainerLocation) { + this.moveViewContainerToLocation(viewContainer, defaultContainerLocation); + } + + this.cleanUpViewContainer(viewContainer.id); + }); + + this.cachedViewContainerInfo.clear(); + this.saveViewContainerLocationsToCache(); + this.cachedViewInfo.clear(); + this.saveViewPositionsToCache(); + } + + isViewContainerRemovedPermanently(viewContainerId: string): boolean { + return this.isGeneratedContainerId(viewContainerId) && !this.cachedViewContainerInfo.has(viewContainerId); + } + private moveViews(views: IViewDescriptor[], from: ViewContainer, to: ViewContainer, skipCacheUpdate?: boolean): void { this.removeViews(from, views); this.addViews(to, views, true); @@ -391,6 +431,34 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor } } + private cleanUpViewContainer(viewContainerId: string): void { + // Skip if container is not generated + if (!this.isGeneratedContainerId(viewContainerId)) { + return; + } + + // Skip if container has views registered + const viewContainer = this.getViewContainerById(viewContainerId); + if (viewContainer && this.getViewContainerModel(viewContainer)?.allViewDescriptors.length) { + return; + } + + // Skip if container has views in the cache + if ([...this.cachedViewInfo.values()].some(({ containerId }) => containerId === viewContainerId)) { + return; + } + + // Deregister the container + if (viewContainer) { + this.viewContainersRegistry.deregisterViewContainer(viewContainer); + } + + // Clean up caches of container + this.cachedViewContainerInfo.delete(viewContainerId); + this.cachedViewContainerLocationsValue = JSON.stringify([...this.cachedViewContainerInfo]); + this.storageService.remove(getViewsStateStorageId(viewContainer?.storageId || getViewContainerStorageId(viewContainerId)), StorageScope.GLOBAL); + } + private registerGeneratedViewContainer(location: ViewContainerLocation, existingId?: string): ViewContainer { const id = existingId || this.generateContainerId(location); @@ -399,7 +467,7 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [id, { mergeViewWithContainerWhenSingleView: true, donotShowContainerTitleWhenMergedWithContainer: true }]), name: 'Custom Views', // we don't want to see this, so no need to localize icon: location === ViewContainerLocation.Sidebar ? 'codicon-window' : undefined, - storageId: `${id}.state`, + storageId: getViewContainerStorageId(id), hideIfEmpty: true }, location); diff --git a/src/vs/workbench/services/views/common/viewContainerModel.ts b/src/vs/workbench/services/views/common/viewContainerModel.ts index a360b073c53..26b27257273 100644 --- a/src/vs/workbench/services/views/common/viewContainerModel.ts +++ b/src/vs/workbench/services/views/common/viewContainerModel.ts @@ -16,6 +16,8 @@ import { move } from 'vs/base/common/arrays'; import { isUndefined, isUndefinedOrNull } from 'vs/base/common/types'; import { isEqual } from 'vs/base/common/resources'; +export function getViewsStateStorageId(viewContainerStorageId: string): string { return `${viewContainerStorageId}.hidden`; } + class CounterSet implements IReadableSet { private map = new Map(); @@ -86,7 +88,7 @@ class ViewDescriptorsState extends Disposable { ) { super(); - this.globalViewsStateStorageId = `${viewContainerStorageId}.hidden`; + this.globalViewsStateStorageId = getViewsStateStorageId(viewContainerStorageId); this.workspaceViewsStateStorageId = viewContainerStorageId; storageKeysSyncRegistryService.registerStorageKey({ key: this.globalViewsStateStorageId, version: 1 }); this._register(this.storageService.onDidChangeStorage(e => this.onDidStorageChange(e))); From ed3df6e1ea22603fe348c83b1ce4b4179c2d8fb3 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Sun, 20 Sep 2020 19:05:37 -0700 Subject: [PATCH 0161/1667] Update distro --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e9b73b70445..afb7e5deef6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.50.0", - "distro": "2d37a6f06b11ba2a64023c81eb7f32e271bca756", + "distro": "e1ab83d5a229ad32d7b0af96380fdf36ec203b2f", "author": { "name": "Microsoft Corporation" }, From 8c1015f5e1a7a686d19ec8a5f56a495332f16062 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 21 Sep 2020 09:24:58 +0200 Subject: [PATCH 0162/1667] workaround for https://github.com/microsoft/vscode/issues/107143 --- src/vs/workbench/contrib/notebook/common/notebookProvider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/notebook/common/notebookProvider.ts b/src/vs/workbench/contrib/notebook/common/notebookProvider.ts index 4f1587380ad..2a6a2beb211 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookProvider.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookProvider.ts @@ -54,7 +54,7 @@ export class NotebookProviderInfo implements NotebookEditorDescriptor { } matches(resource: URI): boolean { - return this.selectors.some(selector => NotebookProviderInfo.selectorMatches(selector, resource)); + return this.selectors?.some(selector => NotebookProviderInfo.selectorMatches(selector, resource)); } static selectorMatches(selector: NotebookSelector, resource: URI): boolean { From 341bc9c8f01a724aadfa7b841ed6ac67aaeb7995 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 21 Sep 2020 09:38:52 +0200 Subject: [PATCH 0163/1667] editors - add and use preferredTitleHeight for groups --- .../workbench/browser/parts/editor/editor.ts | 18 +++++----- .../browser/parts/editor/editorDropTarget.ts | 7 ++-- .../browser/parts/editor/editorGroupView.ts | 19 ++++++----- .../parts/editor/noTabsTitleControl.ts | 12 ++++--- .../browser/parts/editor/tabsTitleControl.ts | 33 +++++++++++-------- .../test/browser/workbenchTestServices.ts | 1 + 6 files changed, 53 insertions(+), 37 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/editor.ts b/src/vs/workbench/browser/parts/editor/editor.ts index 8d335bb6298..a76f48a8dff 100644 --- a/src/vs/workbench/browser/parts/editor/editor.ts +++ b/src/vs/workbench/browser/parts/editor/editor.ts @@ -16,8 +16,6 @@ import { getIEditor } from 'vs/editor/browser/editorBrowser'; import { IEditorOptions } from 'vs/platform/editor/common/editor'; import { IEditorService, IResourceEditorInputType } from 'vs/workbench/services/editor/common/editorService'; -export const EDITOR_TITLE_HEIGHT = 35; - export interface IEditorPartCreationOptions { restorePreviousState: boolean; } @@ -111,12 +109,6 @@ export interface IEditorGroupsAccessor { } export interface IEditorGroupView extends IDisposable, ISerializableView, IEditorGroup { - readonly group: EditorGroup; - readonly whenRestored: Promise; - readonly disposed: boolean; - - readonly isEmpty: boolean; - readonly isMinimized: boolean; readonly onDidFocus: Event; readonly onWillDispose: Event; @@ -125,6 +117,16 @@ export interface IEditorGroupView extends IDisposable, ISerializableView, IEdito readonly onWillCloseEditor: Event; readonly onDidCloseEditor: Event; + readonly group: EditorGroup; + readonly whenRestored: Promise; + + readonly preferredTitleHeight: number; + + readonly isEmpty: boolean; + readonly isMinimized: boolean; + + readonly disposed: boolean; + setActive(isActive: boolean): void; notifyIndexChanged(newIndex: number): void; diff --git a/src/vs/workbench/browser/parts/editor/editorDropTarget.ts b/src/vs/workbench/browser/parts/editor/editorDropTarget.ts index 066fb21db21..3b82e1a65e7 100644 --- a/src/vs/workbench/browser/parts/editor/editorDropTarget.ts +++ b/src/vs/workbench/browser/parts/editor/editorDropTarget.ts @@ -6,7 +6,7 @@ import 'vs/css!./media/editordroptarget'; import { LocalSelectionTransfer, DraggedEditorIdentifier, ResourcesDropHandler, DraggedEditorGroupIdentifier, DragAndDropObserver, containsDragType } from 'vs/workbench/browser/dnd'; import { addDisposableListener, EventType, EventHelper, isAncestor } from 'vs/base/browser/dom'; -import { IEditorGroupsAccessor, EDITOR_TITLE_HEIGHT, IEditorGroupView, getActiveTextEditorOptions } from 'vs/workbench/browser/parts/editor/editor'; +import { IEditorGroupsAccessor, IEditorGroupView, getActiveTextEditorOptions } from 'vs/workbench/browser/parts/editor/editor'; import { EDITOR_DRAG_AND_DROP_BACKGROUND } from 'vs/workbench/common/theme'; import { IThemeService, Themable } from 'vs/platform/theme/common/themeService'; import { activeContrastBorder } from 'vs/platform/theme/common/colorRegistry'; @@ -500,10 +500,13 @@ class DropOverlay extends Themable { } private getOverlayOffsetHeight(): number { + + // With tabs and opened editors: use the area below tabs as drop target if (!this.groupView.isEmpty && this.accessor.partOptions.showTabs) { - return EDITOR_TITLE_HEIGHT; // show overlay below title if group shows tabs + return this.groupView.preferredTitleHeight; } + // Without tabs or empty group: use entire editor area as drop target return 0; } diff --git a/src/vs/workbench/browser/parts/editor/editorGroupView.ts b/src/vs/workbench/browser/parts/editor/editorGroupView.ts index 5ac0ef7a945..f3daaaeaf17 100644 --- a/src/vs/workbench/browser/parts/editor/editorGroupView.ts +++ b/src/vs/workbench/browser/parts/editor/editorGroupView.ts @@ -717,6 +717,10 @@ export class EditorGroupView extends Themable implements IEditorGroupView { return this._group.count === 0; } + get preferredTitleHeight(): number { + return this.titleAreaControl.getPreferredHeight(); + } + get isMinimized(): boolean { if (!this.dimension) { return false; @@ -1694,17 +1698,14 @@ export class EditorGroupView extends Themable implements IEditorGroupView { layout(width: number, height: number): void { this.dimension = new Dimension(width, height); - // Ensure editor container gets height as CSS depending - // on the preferred height of the title control - this.editorContainer.style.height = `calc(100% - ${this.titleAreaControl.getPreferredHeight()}px)`; + // Ensure editor container gets height as CSS depending on the preferred height of the title control + const titleHeight = this.preferredTitleHeight; + const editorHeight = Math.max(0, height - titleHeight); + this.editorContainer.style.height = `${editorHeight}px`; // Forward to controls - this.layoutTitleAreaControl(width); - this.editorControl.layout(new Dimension(this.dimension.width, Math.max(0, this.dimension.height - this.titleAreaControl.getPreferredHeight()))); - } - - private layoutTitleAreaControl(width: number): void { - this.titleAreaControl.layout(new Dimension(width, this.titleAreaControl.getPreferredHeight())); + this.titleAreaControl.layout(new Dimension(width, titleHeight)); + this.editorControl.layout(new Dimension(width, editorHeight)); } relayout(): void { diff --git a/src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts b/src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts index 1ccbc86d42f..f3dc4c75322 100644 --- a/src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts +++ b/src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts @@ -10,7 +10,6 @@ import { ResourceLabel, IResourceLabel } from 'vs/workbench/browser/labels'; import { TAB_ACTIVE_FOREGROUND, TAB_UNFOCUSED_ACTIVE_FOREGROUND } from 'vs/workbench/common/theme'; import { EventType as TouchEventType, GestureEvent, Gesture } from 'vs/base/browser/touch'; import { addDisposableListener, EventType, EventHelper, Dimension } from 'vs/base/browser/dom'; -import { EDITOR_TITLE_HEIGHT } from 'vs/workbench/browser/parts/editor/editor'; import { IAction } from 'vs/base/common/actions'; import { CLOSE_EDITOR_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands'; import { Color } from 'vs/base/common/color'; @@ -22,6 +21,9 @@ interface IRenderedEditorLabel { } export class NoTabsTitleControl extends TitleControl { + + private static readonly HEIGHT = 35; + private titleContainer: HTMLElement | undefined; private editorLabel: IResourceLabel | undefined; private activeLabel: IRenderedEditorLabel = Object.create(null); @@ -113,10 +115,6 @@ export class NoTabsTitleControl extends TitleControl { setTimeout(() => this.quickInputService.quickAccess.show(), 50); } - getPreferredHeight(): number { - return EDITOR_TITLE_HEIGHT; - } - openEditor(editor: IEditorInput): void { const activeEditorChanged = this.ifActiveEditorChanged(() => this.redraw()); if (!activeEditorChanged) { @@ -317,6 +315,10 @@ export class NoTabsTitleControl extends TitleControl { return { primaryEditorActions: editorActions.primary.filter(action => action.id === CLOSE_EDITOR_COMMAND_ID), secondaryEditorActions: [] }; } + getPreferredHeight(): number { + return NoTabsTitleControl.HEIGHT; + } + layout(dimension: Dimension): void { if (this.breadcrumbsControl) { this.breadcrumbsControl.layout(undefined); diff --git a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts index 9223a04e0dd..334e25223a3 100644 --- a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts +++ b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts @@ -34,7 +34,7 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten import { MergeGroupMode, IMergeGroupOptions, GroupsArrangement, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { addDisposableListener, EventType, EventHelper, Dimension, scheduleAtNextAnimationFrame, findParentWithClass, clearNode } from 'vs/base/browser/dom'; import { localize } from 'vs/nls'; -import { IEditorGroupsAccessor, IEditorGroupView, EditorServiceImpl, EDITOR_TITLE_HEIGHT } from 'vs/workbench/browser/parts/editor/editor'; +import { IEditorGroupsAccessor, IEditorGroupView, EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor'; import { CloseOneEditorAction, UnpinEditorAction } from 'vs/workbench/browser/parts/editor/editorActions'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { BreadcrumbsControl } from 'vs/workbench/browser/parts/editor/breadcrumbsControl'; @@ -64,12 +64,14 @@ export class TabsTitleControl extends TitleControl { large: 10 }; - private static readonly TAB_SIZES = { + private static readonly TAB_WIDTH = { compact: 38, shrink: 80, fit: 120 }; + private static readonly TAB_HEIGHT = 35; + private titleContainer: HTMLElement | undefined; private tabsAndActionsContainer: HTMLElement | undefined; private tabsContainer: HTMLElement | undefined; @@ -509,6 +511,11 @@ export class TabsTitleControl extends TitleControl { this.computeTabLabels(); } + // Update tabs scrollbar sizing + if (oldOptions.titleScrollbarSizing !== newOptions.titleScrollbarSizing) { + this.updateTabsScrollbarSizing(); + } + // Redraw tabs when other options change if ( oldOptions.labelFormat !== newOptions.labelFormat || @@ -521,11 +528,6 @@ export class TabsTitleControl extends TitleControl { ) { this.redraw(); } - - // Udate tabs scrollbar sizing - if (oldOptions.titleScrollbarSizing !== newOptions.titleScrollbarSizing) { - this.updateTabsScrollbarSizing(); - } } updateStyles(): void { @@ -1065,10 +1067,10 @@ export class TabsTitleControl extends TitleControl { let stickyTabWidth = 0; switch (options.pinnedTabSizing) { case 'compact': - stickyTabWidth = TabsTitleControl.TAB_SIZES.compact; + stickyTabWidth = TabsTitleControl.TAB_WIDTH.compact; break; case 'shrink': - stickyTabWidth = TabsTitleControl.TAB_SIZES.shrink; + stickyTabWidth = TabsTitleControl.TAB_WIDTH.shrink; break; } @@ -1221,7 +1223,12 @@ export class TabsTitleControl extends TitleControl { } getPreferredHeight(): number { - return EDITOR_TITLE_HEIGHT + (this.breadcrumbsControl && !this.breadcrumbsControl.isHidden() ? BreadcrumbsControl.HEIGHT : 0); + let height = TabsTitleControl.TAB_HEIGHT; + if (this.breadcrumbsControl && !this.breadcrumbsControl.isHidden()) { + height += BreadcrumbsControl.HEIGHT; + } + + return height; } layout(dimension: Dimension | undefined): void { @@ -1299,10 +1306,10 @@ export class TabsTitleControl extends TitleControl { let stickyTabWidth = 0; switch (this.accessor.partOptions.pinnedTabSizing) { case 'compact': - stickyTabWidth = TabsTitleControl.TAB_SIZES.compact; + stickyTabWidth = TabsTitleControl.TAB_WIDTH.compact; break; case 'shrink': - stickyTabWidth = TabsTitleControl.TAB_SIZES.shrink; + stickyTabWidth = TabsTitleControl.TAB_WIDTH.shrink; break; } @@ -1314,7 +1321,7 @@ export class TabsTitleControl extends TitleControl { // Special case: we have sticky tabs but the available space for showing tabs // is little enough that we need to disable sticky tabs sticky positioning // so that tabs can be scrolled at naturally. - if (this.group.stickyCount > 0 && availableTabsContainerWidth < TabsTitleControl.TAB_SIZES.fit) { + if (this.group.stickyCount > 0 && availableTabsContainerWidth < TabsTitleControl.TAB_WIDTH.fit) { tabsContainer.classList.add('disable-sticky-tabs'); availableTabsContainerWidth = visibleTabsContainerWidth; diff --git a/src/vs/workbench/test/browser/workbenchTestServices.ts b/src/vs/workbench/test/browser/workbenchTestServices.ts index 77e578e55dc..b8f5e9d574f 100644 --- a/src/vs/workbench/test/browser/workbenchTestServices.ts +++ b/src/vs/workbench/test/browser/workbenchTestServices.ts @@ -602,6 +602,7 @@ export class TestEditorGroupView implements IEditorGroupView { maximumWidth!: number; minimumHeight!: number; maximumHeight!: number; + preferredTitleHeight!: number; isEmpty = true; isMinimized = false; From cc82ac4e721f6d79cd59594293ad181fa076f148 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 21 Sep 2020 09:26:34 +0200 Subject: [PATCH 0164/1667] remove removeNode, https://github.com/microsoft/vscode/issues/103454#issuecomment-695136569 --- src/vs/base/browser/dom.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts index d92f9ac5f1f..87c0ac44b68 100644 --- a/src/vs/base/browser/dom.ts +++ b/src/vs/base/browser/dom.ts @@ -22,15 +22,6 @@ export function clearNode(node: HTMLElement): void { } } -/** - * @deprecated use `node.remove()` instead - */ -export function removeNode(node: HTMLElement): void { - if (node.parentNode) { - node.parentNode.removeChild(node); - } -} - export function isInDOM(node: Node | null): boolean { while (node) { if (node === document.body) { From 9c91e2822a12a265b25dd2d1a21e9224269343da Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 21 Sep 2020 10:05:46 +0200 Subject: [PATCH 0165/1667] remove deprecated activation event, fixes https://github.com/microsoft/vscode/issues/105496 --- .../workbench/contrib/notebook/browser/notebookServiceImpl.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts b/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts index df43a58d156..7c0ff6d588b 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts @@ -560,9 +560,6 @@ export class NotebookService extends Disposable implements INotebookService, ICu await this._extensionService.activateByEvent(`*`); // this awaits full activation of all matching extensions await this._extensionService.activateByEvent(`onNotebook:${viewType}`); - - // TODO@jrieken deprecated, remove this - await this._extensionService.activateByEvent(`onNotebookEditor:${viewType}`); } return this._notebookProviders.has(viewType); } From 54ac1f495179866acbbdbcb9d83e2885b5246874 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 21 Sep 2020 10:23:10 +0200 Subject: [PATCH 0166/1667] Explorer empty on startup (fix #107143) --- .../services/editor/browser/editorService.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/services/editor/browser/editorService.ts b/src/vs/workbench/services/editor/browser/editorService.ts index 9473ea6b91a..4e90faf08c3 100644 --- a/src/vs/workbench/services/editor/browser/editorService.ts +++ b/src/vs/workbench/services/editor/browser/editorService.ts @@ -39,6 +39,7 @@ import { Extensions as ConfigurationExtensions, IConfigurationRegistry } from 'v import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService'; import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity'; import { IModelService } from 'vs/editor/common/services/modelService'; +import { ILogService } from 'vs/platform/log/common/log'; type CachedEditorInput = ResourceEditorInput | IFileEditorInput | UntitledTextEditorInput; type OpenInEditorGroup = IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE; @@ -77,7 +78,8 @@ export class EditorService extends Disposable implements EditorServiceImpl { @IConfigurationService private readonly configurationService: IConfigurationService, @IWorkspaceContextService private readonly contextService: IWorkspaceContextService, @IWorkingCopyService private readonly workingCopyService: IWorkingCopyService, - @IUriIdentityService private readonly uriIdentityService: IUriIdentityService + @IUriIdentityService private readonly uriIdentityService: IUriIdentityService, + @ILogService private readonly logService: ILogService ) { super(); @@ -500,8 +502,13 @@ export class EditorService extends Disposable implements EditorServiceImpl { getEditorOverrides(resource: URI, options: IEditorOptions | undefined, group: IEditorGroup | undefined): [IOpenEditorOverrideHandler, IOpenEditorOverrideEntry][] { const overrides = []; for (const handler of this.openEditorHandlers) { - const handlers = handler.getEditorOverrides ? handler.getEditorOverrides(resource, options, group).map(val => [handler, val] as [IOpenEditorOverrideHandler, IOpenEditorOverrideEntry]) : []; - overrides.push(...handlers); + if (typeof handler.getEditorOverrides === 'function') { + try { + overrides.push(...handler.getEditorOverrides(resource, options, group).map(val => [handler, val] as [IOpenEditorOverrideHandler, IOpenEditorOverrideEntry])); + } catch (error) { + this.logService.error(`Unexpected error getting editor overides: ${error}`); + } + } } return overrides; From 59ddfaff0c12fd17457269d5d9122922fa9e1c4d Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Mon, 21 Sep 2020 02:02:05 -0700 Subject: [PATCH 0167/1667] Fix custom tree view to allow getting all root children (#107077) --- src/vs/workbench/contrib/views/browser/treeView.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/views/browser/treeView.ts b/src/vs/workbench/contrib/views/browser/treeView.ts index c18c4d293f8..93751bcebad 100644 --- a/src/vs/workbench/contrib/views/browser/treeView.ts +++ b/src/vs/workbench/contrib/views/browser/treeView.ts @@ -164,6 +164,7 @@ export class TreeView extends Disposable implements ITreeView { } if (dataProvider) { + const self = this; this._dataProvider = new class implements ITreeViewDataProvider { private _isEmpty: boolean = true; private _onDidChangeEmpty: Emitter = new Emitter(); @@ -173,11 +174,12 @@ export class TreeView extends Disposable implements ITreeView { return this._isEmpty; } - async getChildren(node: ITreeItem): Promise { + async getChildren(node?: ITreeItem): Promise { let children: ITreeItem[]; if (node && node.children) { children = node.children; } else { + node = node ?? self.root; children = await (node instanceof Root ? dataProvider.getChildren() : dataProvider.getChildren(node)); node.children = children; } From 708bc7d7b22503e0643464a3fe1ed3e3404b72ef Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Mon, 21 Sep 2020 11:09:36 +0200 Subject: [PATCH 0168/1667] Remove keyboard support from remote explorer help Part of #107011 --- src/vs/workbench/contrib/remote/browser/remote.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts index 073860141f3..1ac97179862 100644 --- a/src/vs/workbench/contrib/remote/browser/remote.ts +++ b/src/vs/workbench/contrib/remote/browser/remote.ts @@ -429,7 +429,6 @@ class HelpPanel extends ViewPane { [new HelpTreeRenderer()], new HelpDataSource(), { - keyboardSupport: true, accessibilityProvider: { getAriaLabel: (item: HelpItemBase) => { return item.label; From 7a89ee8cfcc892c91685e616db7376b150558902 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 21 Sep 2020 15:29:12 +0200 Subject: [PATCH 0169/1667] fix typo --- src/vs/workbench/services/editor/browser/editorService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/services/editor/browser/editorService.ts b/src/vs/workbench/services/editor/browser/editorService.ts index 4e90faf08c3..39ff228070e 100644 --- a/src/vs/workbench/services/editor/browser/editorService.ts +++ b/src/vs/workbench/services/editor/browser/editorService.ts @@ -506,7 +506,7 @@ export class EditorService extends Disposable implements EditorServiceImpl { try { overrides.push(...handler.getEditorOverrides(resource, options, group).map(val => [handler, val] as [IOpenEditorOverrideHandler, IOpenEditorOverrideEntry])); } catch (error) { - this.logService.error(`Unexpected error getting editor overides: ${error}`); + this.logService.error(`Unexpected error getting editor overrides: ${error}`); } } } From 6514e941992afcb24a8664acba23a52ba02aff8e Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 8 Sep 2020 17:21:58 +0200 Subject: [PATCH 0170/1667] Fixes microsoft/monaco-editor#1968: Let the editor know that the suggest widget is hidden --- src/vs/editor/contrib/suggest/suggestWidget.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vs/editor/contrib/suggest/suggestWidget.ts b/src/vs/editor/contrib/suggest/suggestWidget.ts index 107bee50e37..1dea7c8e9f5 100644 --- a/src/vs/editor/contrib/suggest/suggestWidget.ts +++ b/src/vs/editor/contrib/suggest/suggestWidget.ts @@ -1137,6 +1137,8 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate