diff --git a/extensions/typescript-basics/test/colorize-results/tsconfig_json.json b/extensions/typescript-basics/test/colorize-results/tsconfig_json.json index e9dc59f3db4..0fbf1b4c28c 100644 --- a/extensions/typescript-basics/test/colorize-results/tsconfig_json.json +++ b/extensions/typescript-basics/test/colorize-results/tsconfig_json.json @@ -1,7 +1,7 @@ [ { "c": "{", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc punctuation.definition.dictionary.begin.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc punctuation.definition.dictionary.begin.jsonc", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -12,7 +12,7 @@ }, { "c": "\t", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -23,40 +23,40 @@ }, { "c": "\"", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc string.json.jsonc support.type.property-name.json.jsonc punctuation.support.type.property-name.begin.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc string.jsonc support.type.property-name.jsonc punctuation.support.type.property-name.begin.jsonc", "r": { "dark_plus": "support.type.property-name: #9CDCFE", - "light_plus": "support.type.property-name.json: #0451A5", + "light_plus": "support.type.property-name.jsonc: #0451A5", "dark_vs": "support.type.property-name: #9CDCFE", - "light_vs": "support.type.property-name.json: #0451A5", + "light_vs": "support.type.property-name.jsonc: #0451A5", "hc_black": "support.type.property-name: #D4D4D4" } }, { "c": "compilerOptions", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc string.json.jsonc support.type.property-name.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc string.jsonc support.type.property-name.jsonc", "r": { "dark_plus": "support.type.property-name: #9CDCFE", - "light_plus": "support.type.property-name.json: #0451A5", + "light_plus": "support.type.property-name.jsonc: #0451A5", "dark_vs": "support.type.property-name: #9CDCFE", - "light_vs": "support.type.property-name.json: #0451A5", + "light_vs": "support.type.property-name.jsonc: #0451A5", "hc_black": "support.type.property-name: #D4D4D4" } }, { "c": "\"", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc string.json.jsonc support.type.property-name.json.jsonc punctuation.support.type.property-name.end.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc string.jsonc support.type.property-name.jsonc punctuation.support.type.property-name.end.jsonc", "r": { "dark_plus": "support.type.property-name: #9CDCFE", - "light_plus": "support.type.property-name.json: #0451A5", + "light_plus": "support.type.property-name.jsonc: #0451A5", "dark_vs": "support.type.property-name: #9CDCFE", - "light_vs": "support.type.property-name.json: #0451A5", + "light_vs": "support.type.property-name.jsonc: #0451A5", "hc_black": "support.type.property-name: #D4D4D4" } }, { "c": ":", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc punctuation.separator.dictionary.key-value.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc punctuation.separator.dictionary.key-value.jsonc", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -67,7 +67,7 @@ }, { "c": " ", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -78,7 +78,7 @@ }, { "c": "{", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc meta.structure.dictionary.json.jsonc punctuation.definition.dictionary.begin.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc punctuation.definition.dictionary.begin.jsonc", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -89,7 +89,7 @@ }, { "c": "\t\t", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc meta.structure.dictionary.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -100,40 +100,40 @@ }, { "c": "\"", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc meta.structure.dictionary.json.jsonc string.json.jsonc support.type.property-name.json.jsonc punctuation.support.type.property-name.begin.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc string.jsonc support.type.property-name.jsonc punctuation.support.type.property-name.begin.jsonc", "r": { "dark_plus": "support.type.property-name: #9CDCFE", - "light_plus": "support.type.property-name.json: #0451A5", + "light_plus": "support.type.property-name.jsonc: #0451A5", "dark_vs": "support.type.property-name: #9CDCFE", - "light_vs": "support.type.property-name.json: #0451A5", + "light_vs": "support.type.property-name.jsonc: #0451A5", "hc_black": "support.type.property-name: #D4D4D4" } }, { "c": "target", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc meta.structure.dictionary.json.jsonc string.json.jsonc support.type.property-name.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc string.jsonc support.type.property-name.jsonc", "r": { "dark_plus": "support.type.property-name: #9CDCFE", - "light_plus": "support.type.property-name.json: #0451A5", + "light_plus": "support.type.property-name.jsonc: #0451A5", "dark_vs": "support.type.property-name: #9CDCFE", - "light_vs": "support.type.property-name.json: #0451A5", + "light_vs": "support.type.property-name.jsonc: #0451A5", "hc_black": "support.type.property-name: #D4D4D4" } }, { "c": "\"", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc meta.structure.dictionary.json.jsonc string.json.jsonc support.type.property-name.json.jsonc punctuation.support.type.property-name.end.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc string.jsonc support.type.property-name.jsonc punctuation.support.type.property-name.end.jsonc", "r": { "dark_plus": "support.type.property-name: #9CDCFE", - "light_plus": "support.type.property-name.json: #0451A5", + "light_plus": "support.type.property-name.jsonc: #0451A5", "dark_vs": "support.type.property-name: #9CDCFE", - "light_vs": "support.type.property-name.json: #0451A5", + "light_vs": "support.type.property-name.jsonc: #0451A5", "hc_black": "support.type.property-name: #D4D4D4" } }, { "c": ":", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc punctuation.separator.dictionary.key-value.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc punctuation.separator.dictionary.key-value.jsonc", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -144,7 +144,7 @@ }, { "c": " ", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -155,7 +155,7 @@ }, { "c": "\"", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc string.quoted.double.json.jsonc punctuation.definition.string.begin.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc string.quoted.double.jsonc punctuation.definition.string.begin.jsonc", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -166,7 +166,7 @@ }, { "c": "es6", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc string.quoted.double.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc string.quoted.double.jsonc", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -177,7 +177,7 @@ }, { "c": "\"", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc string.quoted.double.json.jsonc punctuation.definition.string.end.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc string.quoted.double.jsonc punctuation.definition.string.end.jsonc", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -188,7 +188,7 @@ }, { "c": "\t", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -199,7 +199,7 @@ }, { "c": "}", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc meta.structure.dictionary.value.json.jsonc meta.structure.dictionary.json.jsonc punctuation.definition.dictionary.end.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc punctuation.definition.dictionary.end.jsonc", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -210,7 +210,7 @@ }, { "c": "}", - "t": "source.json.jsonc meta.structure.dictionary.json.jsonc punctuation.definition.dictionary.end.json.jsonc", + "t": "source.jsonc meta.structure.dictionary.jsonc punctuation.definition.dictionary.end.jsonc", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", diff --git a/extensions/typescript-language-features/src/features/updatePathsOnRename.ts b/extensions/typescript-language-features/src/features/updatePathsOnRename.ts index e1c8ff89069..ac25ee879a5 100644 --- a/extensions/typescript-language-features/src/features/updatePathsOnRename.ts +++ b/extensions/typescript-language-features/src/features/updatePathsOnRename.ts @@ -226,11 +226,15 @@ export class UpdateImportsOnFileRenameHandler { const edits: Proto.FileCodeEdits[] = []; for (const edit of response.body) { // Workaround for https://github.com/Microsoft/vscode/issues/52675 + if ((edit as Proto.FileCodeEdits).fileName.match(/[\/\\]node_modules[\/\\]/gi)) { + continue; + } for (const change of (edit as Proto.FileCodeEdits).textChanges) { if (change.newText.match(/\/node_modules\//gi)) { continue; } } + edits.push(await this.fixEdit(edit, isDirectoryRename, oldFile, newFile)); } return typeConverters.WorkspaceEdit.fromFileCodeEdits(this.client, edits); 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 87734062b8a..50ef55b4f55 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts @@ -646,7 +646,7 @@ suite('window namespace tests', () => { }); const renderer = window.createTerminalRenderer('foo'); const reg2 = renderer.onDidChangeMaximumDimensions(dimensions => { - assert.ok(dimensions.cols > 0); + assert.ok(dimensions.columns > 0); assert.ok(dimensions.rows > 0); reg2.dispose(); const reg3 = window.onDidCloseTerminal(() => { diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 71329e06fea..b8746621f99 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -5539,6 +5539,50 @@ declare module 'vscode' { readonly webviewPanel: WebviewPanel; } + /** + * Restore webview panels that have been persisted when vscode shuts down. + * + * There are two types of webview persistence: + * + * - Persistence within a session. + * - Persistence across sessions (across restarts of VS Code). + * + * A `WebviewPanelSerializer` is only required for the second case: persisting a webview across sessions. + * + * Persistence within a session allows a webview to save its state when it becomes hidden + * and restore its content from this state when it becomes visible again. It is powered entirely + * by the webview content itself. To save off a persisted state, call `acquireVsCodeApi().setState()` with + * any json serializable object. To restore the state again, call `getState()` + * + * ```js + * // Within the webview + * const vscode = acquireVsCodeApi(); + * + * // Get existing state + * const oldState = vscode.getState() || { value: 0 }; + * + * // Update state + * setState({ value: oldState.value + 1 }) + * ``` + * + * A `WebviewPanelSerializer` extends this persistence across restarts of VS Code. When the editor is shutdown, VS Code will save off the state from `setState` of all webviews that have a serializer. When the + * webview first becomes visible after the restart, this state is passed to `deserializeWebviewPanel`. + * The extension can then restore the old `WebviewPanel` from this state. + */ + interface WebviewPanelSerializer { + /** + * Restore a webview panel from its seriailzed `state`. + * + * Called when a serialized webview first becomes visible. + * + * @param webviewPanel Webview panel to restore. The serializer should take ownership of this panel. + * @param state Persisted state. + * + * @return Thanble indicating that the webview has been fully restored. + */ + deserializeWebviewPanel(webviewPanel: WebviewPanel, state: any): Thenable; + } + /** * Namespace describing the environment the editor runs in. */ @@ -6145,6 +6189,19 @@ declare module 'vscode' { * @returns a [TreeView](#TreeView). */ export function createTreeView(viewId: string, options: { treeDataProvider: TreeDataProvider }): TreeView; + + /** + * Registers a webview panel serializer. + * + * Extensions that support reviving should have an `"onWebviewPanel:viewType"` activation method and + * make sure that [registerWebviewPanelSerializer](#registerWebviewPanelSerializer) is called during activation. + * + * Only a single serializer may be registered at a time for a given `viewType`. + * + * @param viewType Type of the webview panel that can be serialized. + * @param serializer Webview serializer. + */ + export function registerWebviewPanelSerializer(viewType: string, serializer: WebviewPanelSerializer): Disposable; } /** diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 968306e710f..737e1b91bdf 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -351,7 +351,7 @@ declare module 'vscode' { /** * The number of columns in the terminal. */ - cols: number; + columns: number; /** * The number of rows in the terminal. @@ -857,69 +857,6 @@ declare module 'vscode' { } //#endregion - //#region Matt: WebView Serializer - - /** - * Restore webview panels that have been persisted when vscode shuts down. - * - * There are two types of webview persistence: - * - * - Persistence within a session. - * - Persistence across sessions (across restarts of VS Code). - * - * A `WebviewPanelSerializer` is only required for the second case: persisting a webview across sessions. - * - * Persistence within a session allows a webview to save its state when it becomes hidden - * and restore its content from this state when it becomes visible again. It is powered entirely - * by the webview content itself. To save off a persisted state, call `acquireVsCodeApi().setState()` with - * any json serializable object. To restore the state again, call `getState()` - * - * ```js - * // Within the webview - * const vscode = acquireVsCodeApi(); - * - * // Get existing state - * const oldState = vscode.getState() || { value: 0 }; - * - * // Update state - * setState({ value: oldState.value + 1 }) - * ``` - * - * A `WebviewPanelSerializer` extends this persistence across restarts of VS Code. When the editor is shutdown, VS Code will save off the state from `setState` of all webviews that have a serializer. When the - * webview first becomes visible after the restart, this state is passed to `deserializeWebviewPanel`. - * The extension can then restore the old `WebviewPanel` from this state. - */ - interface WebviewPanelSerializer { - /** - * Restore a webview panel from its seriailzed `state`. - * - * Called when a serialized webview first becomes visible. - * - * @param webviewPanel Webview panel to restore. The serializer should take ownership of this panel. - * @param state Persisted state. - * - * @return Thanble indicating that the webview has been fully restored. - */ - deserializeWebviewPanel(webviewPanel: WebviewPanel, state: any): Thenable; - } - - namespace window { - /** - * Registers a webview panel serializer. - * - * Extensions that support reviving should have an `"onWebviewPanel:viewType"` activation method and - * make sure that [registerWebviewPanelSerializer](#registerWebviewPanelSerializer) is called during activation. - * - * Only a single serializer may be registered at a time for a given `viewType`. - * - * @param viewType Type of the webview panel that can be serialized. - * @param serializer Webview serializer. - */ - export function registerWebviewPanelSerializer(viewType: string, serializer: WebviewPanelSerializer): Disposable; - } - - //#endregion - //#region Matt: Deinition range /** diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index 609db622a2b..15853b9ba76 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -442,6 +442,9 @@ export function createApiFactory( createTreeView(viewId: string, options: { treeDataProvider: vscode.TreeDataProvider }): vscode.TreeView { return extHostTreeViews.createTreeView(viewId, options); }, + registerWebviewPanelSerializer: (viewType: string, serializer: vscode.WebviewPanelSerializer) => { + return extHostWebviews.registerWebviewPanelSerializer(viewType, serializer); + }, // proposed API sampleFunction: proposedApiFunction(extension, () => { return extHostMessageService.showMessage(extension, Severity.Info, 'Hello Proposed Api!', {}, []); @@ -449,9 +452,6 @@ export function createApiFactory( registerDecorationProvider: proposedApiFunction(extension, (provider: vscode.DecorationProvider) => { return extHostDecorations.registerDecorationProvider(provider, extension.id); }), - registerWebviewPanelSerializer: proposedApiFunction(extension, (viewType: string, serializer: vscode.WebviewPanelSerializer) => { - return extHostWebviews.registerWebviewPanelSerializer(viewType, serializer); - }), registerProtocolHandler: proposedApiFunction(extension, (handler: vscode.ProtocolHandler) => { return extHostUrls.registerProtocolHandler(extension.id, handler); }), diff --git a/src/vs/workbench/api/node/extHostTerminalService.ts b/src/vs/workbench/api/node/extHostTerminalService.ts index 47d2ac74ad4..4c16f048f99 100644 --- a/src/vs/workbench/api/node/extHostTerminalService.ts +++ b/src/vs/workbench/api/node/extHostTerminalService.ts @@ -179,7 +179,7 @@ export class ExtHostTerminalRenderer extends BaseExtHostTerminal implements vsco } return { rows: this._maximumDimensions.rows, - cols: this._maximumDimensions.cols + columns: this._maximumDimensions.columns }; } @@ -212,8 +212,8 @@ export class ExtHostTerminalRenderer extends BaseExtHostTerminal implements vsco this._onInput.fire(data); } - public _setMaximumDimensions(cols: number, rows: number): void { - this._maximumDimensions = { cols, rows }; + public _setMaximumDimensions(columns: number, rows: number): void { + this._maximumDimensions = { columns, rows }; this._onDidChangeMaximumDimensions.fire(this.maximumDimensions); } } diff --git a/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts b/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts index 8726d796de5..3e0bb79f096 100644 --- a/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts @@ -716,12 +716,14 @@ export class SettingsEditor2 extends BaseEditor { const [result] = results; if (!this.searchResultModel) { this.searchResultModel = this.instantiationService.createInstance(SearchResultModel, this.viewState); + this.searchResultModel.setResult(type, result); this.tocTreeModel.currentSearchModel = this.searchResultModel; this.toggleSearchMode(); this.settingsTree.setInput(this.searchResultModel); + } else { + this.searchResultModel.setResult(type, result); } - this.searchResultModel.setResult(type, result); this.tocTreeModel.update(); resolve(this.refreshTreeAndMaintainFocus()); }); diff --git a/src/vs/workbench/parts/preferences/browser/settingsTree.ts b/src/vs/workbench/parts/preferences/browser/settingsTree.ts index 6d82e55449d..eb577526abc 100644 --- a/src/vs/workbench/parts/preferences/browser/settingsTree.ts +++ b/src/vs/workbench/parts/preferences/browser/settingsTree.ts @@ -901,6 +901,11 @@ export class SearchResultModel { setResult(type: SearchResultIdx, result: ISearchResult): void { this.cachedUniqueSearchResults = null; this.rawSearchResults = this.rawSearchResults || []; + if (!result) { + delete this.rawSearchResults[type]; + return; + } + this.rawSearchResults[type] = result; // Recompute children