From 701f6763dafe893cb15c5dc0aaf23ed2fa9acf77 Mon Sep 17 00:00:00 2001 From: hantatsang Date: Tue, 8 Jun 2021 19:44:16 +1000 Subject: [PATCH 01/39] Update DocumentFilter docstring --- src/vs/vscode.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 77b7c5465dc..a275c2eee26 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -1989,7 +1989,7 @@ declare module 'vscode' { * { language: 'typescript', scheme: 'file' } * * @example A language filter that applies to all package.json paths - * { language: 'json', scheme: 'untitled', pattern: '**​/package.json' } + * { language: 'json', scheme: 'file', pattern: '**​/package.json' } */ export interface DocumentFilter { From 2daeb4d1ae82ec3de9aa3d35bd7a8e8d32c69717 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Tue, 8 Jun 2021 10:25:44 -0700 Subject: [PATCH 02/39] Document startupEditor: readme being not resource-scopable. Closes #124689 --- .../contrib/welcome/page/browser/welcomePage.contribution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/welcome/page/browser/welcomePage.contribution.ts b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.contribution.ts index ca012b9fd54..fbc9dc5d205 100644 --- a/src/vs/workbench/contrib/welcome/page/browser/welcomePage.contribution.ts +++ b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.contribution.ts @@ -25,7 +25,7 @@ Registry.as(ConfigurationExtensions.Configuration) 'enumDescriptions': [ localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.none' }, "Start without an editor."), localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.welcomePage' }, "Open the legacy Welcome page."), - localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.readme' }, "Open the README when opening a folder that contains one, fallback to 'welcomePage' otherwise."), + localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.readme' }, "Open the README when opening a folder that contains one, fallback to 'welcomePage' otherwise. Note: This is only observed as a global ccnfiguration, it will be ignored if set in a workspace or folder configuration."), localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.newUntitledFile' }, "Open a new untitled file (only applies when opening an empty window)."), localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.welcomePageInEmptyWorkbench' }, "Open the legacy Welcome page when opening an empty workbench."), localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.gettingStarted' }, "Open the new Welcome Page with content to aid in getting started with VS Code and extensions."), From a359d5502c557dc3596b2cfde394b4b887795a46 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Tue, 8 Jun 2021 10:29:47 -0700 Subject: [PATCH 03/39] fixes #125722 --- .../contrib/workspace/browser/workspaceTrustEditor.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts b/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts index 230f468978c..a69e1fa4c02 100644 --- a/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts +++ b/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts @@ -823,13 +823,13 @@ export class WorkspaceTrustEditor extends EditorPane { [ localize('untrustedTasks', "Tasks are disabled"), localize('untrustedDebugging', "Debugging is disabled"), - localize('untrustedExtensions', "[{0} extensions](command:{1}) are disabled or have limited functionality", numExtensions, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID) + localize('untrustedExtensions', "[{0} extensions]({1}) are disabled or have limited functionality", numExtensions, `command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`) ] : [ localize('untrustedTasks', "Tasks are disabled"), localize('untrustedDebugging', "Debugging is disabled"), - numSettings ? localize('untrustedSettings', "[{0} workspace settings](command:{1}) are not applied", numSettings, 'settings.filterUntrusted') : localize('no untrustedSettings', "Workspace settings requiring trust are not applied"), - localize('untrustedExtensions', "[{0} extensions](command:{1}) are disabled or have limited functionality", numExtensions, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID) + numSettings ? localize('untrustedSettings', "[{0} workspace settings]({1}) are not applied", numSettings, 'settings.filterUntrusted') : localize('no untrustedSettings', "Workspace settings requiring trust are not applied"), + localize('untrustedExtensions', "[{0} extensions]({1}) are disabled or have limited functionality", numExtensions, `command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`) ]; this.renderLimitationsListElement(untrustedContainer, untrustedContainerItems, xListIcon.classNamesArray); From f1e458a1d791e1b646d06644ae4852af16cd949d Mon Sep 17 00:00:00 2001 From: netcon Date: Wed, 9 Jun 2021 01:40:29 +0800 Subject: [PATCH 04/39] fix: web typescript extension can not found definitions (#125279) --- .../typescript-language-features/src/typescriptServiceClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/typescript-language-features/src/typescriptServiceClient.ts b/extensions/typescript-language-features/src/typescriptServiceClient.ts index 4990b4ce1c7..279d0e2d4d8 100644 --- a/extensions/typescript-language-features/src/typescriptServiceClient.ts +++ b/extensions/typescript-language-features/src/typescriptServiceClient.ts @@ -703,7 +703,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType if (isWeb()) { // On web, treat absolute paths as pointing to standard lib files if (filepath.startsWith('/')) { - return vscode.Uri.joinPath(this.context.extensionUri, 'node_modules', 'typescript', 'lib', filepath.slice(1)); + return vscode.Uri.joinPath(this.context.extensionUri, 'dist', 'browser', 'typescript', filepath.slice(1)); } } From a1e83e707b1301cd081a9649b944a256ea1a03ec Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Tue, 8 Jun 2021 10:43:28 -0700 Subject: [PATCH 05/39] revert to reapply safely --- .../contrib/workspace/browser/workspaceTrustEditor.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts b/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts index a69e1fa4c02..230f468978c 100644 --- a/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts +++ b/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts @@ -823,13 +823,13 @@ export class WorkspaceTrustEditor extends EditorPane { [ localize('untrustedTasks', "Tasks are disabled"), localize('untrustedDebugging', "Debugging is disabled"), - localize('untrustedExtensions', "[{0} extensions]({1}) are disabled or have limited functionality", numExtensions, `command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`) + localize('untrustedExtensions', "[{0} extensions](command:{1}) are disabled or have limited functionality", numExtensions, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID) ] : [ localize('untrustedTasks', "Tasks are disabled"), localize('untrustedDebugging', "Debugging is disabled"), - numSettings ? localize('untrustedSettings', "[{0} workspace settings]({1}) are not applied", numSettings, 'settings.filterUntrusted') : localize('no untrustedSettings', "Workspace settings requiring trust are not applied"), - localize('untrustedExtensions', "[{0} extensions]({1}) are disabled or have limited functionality", numExtensions, `command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`) + numSettings ? localize('untrustedSettings', "[{0} workspace settings](command:{1}) are not applied", numSettings, 'settings.filterUntrusted') : localize('no untrustedSettings', "Workspace settings requiring trust are not applied"), + localize('untrustedExtensions', "[{0} extensions](command:{1}) are disabled or have limited functionality", numExtensions, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID) ]; this.renderLimitationsListElement(untrustedContainer, untrustedContainerItems, xListIcon.classNamesArray); From ce87fa49842775c95705f80f766ef0677ce7576e Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Tue, 8 Jun 2021 10:45:37 -0700 Subject: [PATCH 06/39] fixes #125722 --- .../contrib/workspace/browser/workspaceTrustEditor.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts b/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts index 230f468978c..4f95167c1f1 100644 --- a/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts +++ b/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts @@ -823,13 +823,13 @@ export class WorkspaceTrustEditor extends EditorPane { [ localize('untrustedTasks', "Tasks are disabled"), localize('untrustedDebugging', "Debugging is disabled"), - localize('untrustedExtensions', "[{0} extensions](command:{1}) are disabled or have limited functionality", numExtensions, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID) + localize('untrustedExtensions', "[{0} extensions]({1}) are disabled or have limited functionality", numExtensions, `command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`) ] : [ localize('untrustedTasks', "Tasks are disabled"), localize('untrustedDebugging', "Debugging is disabled"), - numSettings ? localize('untrustedSettings', "[{0} workspace settings](command:{1}) are not applied", numSettings, 'settings.filterUntrusted') : localize('no untrustedSettings', "Workspace settings requiring trust are not applied"), - localize('untrustedExtensions', "[{0} extensions](command:{1}) are disabled or have limited functionality", numExtensions, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID) + numSettings ? localize('untrustedSettings', "[{0} workspace settings]({1}) are not applied", numSettings, 'command:settings.filterUntrusted') : localize('no untrustedSettings', "Workspace settings requiring trust are not applied"), + localize('untrustedExtensions', "[{0} extensions]({1}) are disabled or have limited functionality", numExtensions, `command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`) ]; this.renderLimitationsListElement(untrustedContainer, untrustedContainerItems, xListIcon.classNamesArray); From 97b5db8dbabce767e5720396957046c2ffac0126 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 8 Jun 2021 11:35:27 -0700 Subject: [PATCH 07/39] 'vs code' -> 'the editor' in d.ts Fixes #124361 Also adds a lint rule for this --- .eslintrc.json | 1 + .../eslint/vscode-dts-vscode-in-comments.js | 45 ++++++ .../eslint/vscode-dts-vscode-in-comments.ts | 53 +++++++ src/vs/vscode.d.ts | 134 +++++++++--------- src/vs/vscode.proposed.d.ts | 46 +++--- 5 files changed, 189 insertions(+), 90 deletions(-) create mode 100644 build/lib/eslint/vscode-dts-vscode-in-comments.js create mode 100644 build/lib/eslint/vscode-dts-vscode-in-comments.ts diff --git a/.eslintrc.json b/.eslintrc.json index 63fb6b80ac5..df8c35d28ed 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -989,6 +989,7 @@ "vscode-dts-cancellation": "warn", "vscode-dts-use-thenable": "warn", "vscode-dts-region-comments": "warn", + "vscode-dts-vscode-in-comments": "warn", "vscode-dts-provider-naming": [ "warn", { diff --git a/build/lib/eslint/vscode-dts-vscode-in-comments.js b/build/lib/eslint/vscode-dts-vscode-in-comments.js new file mode 100644 index 00000000000..8f9a13fb01f --- /dev/null +++ b/build/lib/eslint/vscode-dts-vscode-in-comments.js @@ -0,0 +1,45 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +module.exports = new class ApiVsCodeInComments { + constructor() { + this.meta = { + messages: { + comment: `Don't use the term 'vs code' in comments` + } + }; + } + create(context) { + const sourceCode = context.getSourceCode(); + return { + ['Program']: (_node) => { + for (const comment of sourceCode.getAllComments()) { + if (comment.type !== 'Block') { + continue; + } + if (!comment.range) { + continue; + } + const startIndex = comment.range[0] + '/*'.length; + const re = /vs code/ig; + let match; + while ((match = re.exec(comment.value))) { + // Allow using 'VS Code' in quotes + if (comment.value[match.index - 1] === `'` && comment.value[match.index + match[0].length] === `'`) { + continue; + } + // Types for eslint seem incorrect + const start = sourceCode.getLocFromIndex(startIndex + match.index); + const end = sourceCode.getLocFromIndex(startIndex + match.index + match[0].length); + context.report({ + messageId: 'comment', + loc: { start, end } + }); + } + } + } + }; + } +}; diff --git a/build/lib/eslint/vscode-dts-vscode-in-comments.ts b/build/lib/eslint/vscode-dts-vscode-in-comments.ts new file mode 100644 index 00000000000..8ced8eb25fd --- /dev/null +++ b/build/lib/eslint/vscode-dts-vscode-in-comments.ts @@ -0,0 +1,53 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import type * as estree from 'estree'; + +export = new class ApiVsCodeInComments implements eslint.Rule.RuleModule { + + readonly meta: eslint.Rule.RuleMetaData = { + messages: { + comment: `Don't use the term 'vs code' in comments` + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + const sourceCode = context.getSourceCode(); + + return { + ['Program']: (_node: any) => { + + for (const comment of sourceCode.getAllComments()) { + if (comment.type !== 'Block') { + continue; + } + if (!comment.range) { + continue; + } + + const startIndex = comment.range[0] + '/*'.length; + const re = /vs code/ig; + let match: RegExpExecArray | null; + while ((match = re.exec(comment.value))) { + // Allow using 'VS Code' in quotes + if (comment.value[match.index - 1] === `'` && comment.value[match.index + match[0].length] === `'`) { + continue; + } + + // Types for eslint seem incorrect + const start = sourceCode.getLocFromIndex(startIndex + match.index) as any as estree.Position; + const end = sourceCode.getLocFromIndex(startIndex + match.index + match[0].length) as any as estree.Position; + context.report({ + messageId: 'comment', + loc: { start, end } + }); + } + } + } + }; + } +}; diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 77b7c5465dc..83e85319554 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -2815,9 +2815,9 @@ declare module 'vscode' { } /** - * The inline values provider interface defines the contract between extensions and the VS Code debugger inline values feature. + * The inline values provider interface defines the contract between extensions and the editor's debugger inline values feature. * In this contract the provider returns inline value information for a given document range - * and VS Code shows this information in the editor at the end of lines. + * and the editor shows this information in the editor at the end of lines. */ export interface InlineValuesProvider { @@ -2829,7 +2829,7 @@ declare module 'vscode' { /** * Provide "inline value" information for a given document and range. - * VS Code calls this method whenever debugging stops in the given document. + * The editor calls this method whenever debugging stops in the given document. * The returned inline values information is rendered in the editor at the end of lines. * * @param document The document for which the inline values information is needed. @@ -3646,7 +3646,7 @@ declare module 'vscode' { * ``` * * @see {@link SemanticTokensBuilder} for a helper to encode tokens as integers. - * *NOTE*: When doing edits, it is possible that multiple edits occur until VS Code decides to invoke the semantic tokens provider. + * *NOTE*: When doing edits, it is possible that multiple edits occur until the editor decides to invoke the semantic tokens provider. * *NOTE*: If the provider cannot temporarily compute semantic tokens, it can indicate this by throwing an error with the message 'Busy'. */ provideDocumentSemanticTokens(document: TextDocument, token: CancellationToken): ProviderResult; @@ -5556,7 +5556,7 @@ declare module 'vscode' { /** * Role of the widget which defines how a screen reader interacts with it. * The role should be set in special cases when for example a tree-like element behaves like a checkbox. - * If role is not specified VS Code will pick the appropriate role automatically. + * If role is not specified the editor will pick the appropriate role automatically. * More about aria roles can be found here https://w3c.github.io/aria/#widget_roles */ role?: string; @@ -5648,7 +5648,7 @@ declare module 'vscode' { * The command must be {@link commands.getCommands known}. * * Note that if this is a {@link Command `Command`} object, only the {@link Command.command `command`} and {@link Command.arguments `arguments`} - * are used by VS Code. + * are used by the editor. */ command: string | Command | undefined; @@ -5959,13 +5959,13 @@ declare module 'vscode' { export enum ExtensionMode { /** * The extension is installed normally (for example, from the marketplace - * or VSIX) in VS Code. + * or VSIX) in the editor. */ Production = 1, /** * The extension is running from an `--extensionDevelopmentPath` provided - * when launching VS Code. + * when launching the editor. */ Development = 2, @@ -6549,7 +6549,7 @@ declare module 'vscode' { constructor(commandLine: string, options?: ShellExecutionOptions); /** - * Creates a shell execution with a command and arguments. For the real execution VS Code will + * Creates a shell execution with a command and arguments. For the real execution the editor will * construct a command line from the command and the arguments. This is subject to interpretation * especially when it comes to quoting. If full control over the command line is needed please * use the constructor that creates a `ShellExecution` with the full command line. @@ -6865,7 +6865,7 @@ declare module 'vscode' { export function fetchTasks(filter?: TaskFilter): Thenable; /** - * Executes a task that is managed by VS Code. The returned + * Executes a task that is managed by the editor. The returned * task execution can be used to terminate the task. * * @throws When running a ShellExecution or a ProcessExecution @@ -7281,7 +7281,7 @@ declare module 'vscode' { * @param scheme The scheme of the filesystem, for example `file` or `git`. * * @return `true` if the file system supports writing, `false` if it does not - * support writing (i.e. it is readonly), and `undefined` if VS Code does not + * support writing (i.e. it is readonly), and `undefined` if the editor does not * know about the filesystem. */ isWritableFileSystem(scheme: string): boolean | undefined; @@ -7362,7 +7362,7 @@ declare module 'vscode' { * Webviews are sandboxed from normal extension process, so all communication with the webview must use * message passing. To send a message from the extension to the webview, use {@link Webview.postMessage `postMessage`}. * To send message from the webview back to an extension, use the `acquireVsCodeApi` function inside the webview - * to get a handle to VS Code's api and then call `.postMessage()`: + * to get a handle to the editor's api and then call `.postMessage()`: * * ```html *