From 20e6388e17198a63b4d91665da8d26f4fb94b570 Mon Sep 17 00:00:00 2001 From: Gunay Mert Karadogan Date: Wed, 13 Feb 2019 20:07:55 +0000 Subject: [PATCH 01/90] Add workspace name variable for snippets #68261 --- .../editor/contrib/snippet/snippetSession.ts | 7 +++- .../contrib/snippet/snippetVariables.ts | 29 ++++++++++++++ .../snippet/test/snippetVariables.test.ts | 38 ++++++++++++++++++- 3 files changed, 70 insertions(+), 4 deletions(-) diff --git a/src/vs/editor/contrib/snippet/snippetSession.ts b/src/vs/editor/contrib/snippet/snippetSession.ts index bf6c4909ac7..53cb0ed3c15 100644 --- a/src/vs/editor/contrib/snippet/snippetSession.ts +++ b/src/vs/editor/contrib/snippet/snippetSession.ts @@ -15,9 +15,10 @@ import { Selection } from 'vs/editor/common/core/selection'; import { IIdentifiedSingleEditOperation, ITextModel, TrackedRangeStickiness } from 'vs/editor/common/model'; import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; +import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { optional } from 'vs/platform/instantiation/common/instantiation'; import { Choice, Placeholder, SnippetParser, Text, TextmateSnippet } from './snippetParser'; -import { ClipboardBasedVariableResolver, CompositeSnippetVariableResolver, ModelBasedVariableResolver, SelectionBasedVariableResolver, TimeBasedVariableResolver, CommentBasedVariableResolver } from './snippetVariables'; +import { ClipboardBasedVariableResolver, CompositeSnippetVariableResolver, ModelBasedVariableResolver, SelectionBasedVariableResolver, TimeBasedVariableResolver, CommentBasedVariableResolver, WorkspaceBasedVariableResolver } from './snippetVariables'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import * as colors from 'vs/platform/theme/common/colorRegistry'; @@ -354,6 +355,7 @@ export class SnippetSession { const modelBasedVariableResolver = new ModelBasedVariableResolver(model); const clipboardService = editor.invokeWithinContext(accessor => accessor.get(IClipboardService, optional)); + const workspaceService = editor.invokeWithinContext(accessor => accessor.get(IWorkspaceContextService, optional)); let delta = 0; @@ -409,7 +411,8 @@ export class SnippetSession { new ClipboardBasedVariableResolver(clipboardService, idx, indexedSelections.length), new SelectionBasedVariableResolver(model, selection), new CommentBasedVariableResolver(model), - new TimeBasedVariableResolver + new TimeBasedVariableResolver, + new WorkspaceBasedVariableResolver(workspaceService), ])); const offset = model.getOffsetAt(start) + delta; diff --git a/src/vs/editor/contrib/snippet/snippetVariables.ts b/src/vs/editor/contrib/snippet/snippetVariables.ts index dd7591c79ab..d7307c5a043 100644 --- a/src/vs/editor/contrib/snippet/snippetVariables.ts +++ b/src/vs/editor/contrib/snippet/snippetVariables.ts @@ -11,6 +11,8 @@ import { VariableResolver, Variable, Text } from 'vs/editor/contrib/snippet/snip import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry'; import { getLeadingWhitespace, commonPrefixLength, isFalsyOrWhitespace, pad } from 'vs/base/common/strings'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; +import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; +import { isSingleFolderWorkspaceIdentifier, toWorkspaceIdentifier, WORKSPACE_EXTENSION } from 'vs/platform/workspaces/common/workspaces'; export const KnownSnippetVariableNames = Object.freeze({ 'CURRENT_YEAR': true, @@ -38,6 +40,7 @@ export const KnownSnippetVariableNames = Object.freeze({ 'BLOCK_COMMENT_START': true, 'BLOCK_COMMENT_END': true, 'LINE_COMMENT': true, + 'WORKSPACE_NAME': true, }); export class CompositeSnippetVariableResolver implements VariableResolver { @@ -244,3 +247,29 @@ export class TimeBasedVariableResolver implements VariableResolver { return undefined; } } + +export class WorkspaceBasedVariableResolver implements VariableResolver { + constructor( + private readonly _workspaceService: IWorkspaceContextService, + ) { + // + } + + resolve(variable: Variable): string | undefined { + if (variable.name !== 'WORKSPACE_NAME' || !this._workspaceService) { + return undefined; + } + + const workspaceIdentifier = toWorkspaceIdentifier(this._workspaceService.getWorkspace()); + if (!workspaceIdentifier) { + return undefined; + } + + if (isSingleFolderWorkspaceIdentifier(workspaceIdentifier)) { + return basename(workspaceIdentifier.path); + } + + const filename = basename(workspaceIdentifier.configPath.path); + return filename.substr(0, filename.length - WORKSPACE_EXTENSION.length - 1); + } +} \ No newline at end of file diff --git a/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts b/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts index 4931b38dac7..57853e2b59f 100644 --- a/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts +++ b/src/vs/editor/contrib/snippet/test/snippetVariables.test.ts @@ -6,10 +6,11 @@ import * as assert from 'assert'; import { isWindows } from 'vs/base/common/platform'; import { URI } from 'vs/base/common/uri'; import { Selection } from 'vs/editor/common/core/selection'; -import { SelectionBasedVariableResolver, CompositeSnippetVariableResolver, ModelBasedVariableResolver, ClipboardBasedVariableResolver, TimeBasedVariableResolver } from 'vs/editor/contrib/snippet/snippetVariables'; +import { SelectionBasedVariableResolver, CompositeSnippetVariableResolver, ModelBasedVariableResolver, ClipboardBasedVariableResolver, TimeBasedVariableResolver, WorkspaceBasedVariableResolver } from 'vs/editor/contrib/snippet/snippetVariables'; import { SnippetParser, Variable, VariableResolver } from 'vs/editor/contrib/snippet/snippetParser'; import { TextModel } from 'vs/editor/common/model/textModel'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; +import { Workspace, toWorkspaceFolders, IWorkspace, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; suite('Snippet Variables Resolver', function () { @@ -301,4 +302,37 @@ suite('Snippet Variables Resolver', function () { snippet.resolveVariables({ resolve() { return '11'; } }); assert.equal(snippet.toString(), 'It is not line 10'); }); -}); + + test('Add workspace name variable for snippets #68261', function () { + + let workspace: IWorkspace; + let resolver: VariableResolver; + const workspaceService = new class implements IWorkspaceContextService { + _serviceBrand: any; + _throw = () => { throw new Error(); }; + onDidChangeWorkbenchState = this._throw; + onDidChangeWorkspaceName = this._throw; + onDidChangeWorkspaceFolders = this._throw; + getCompleteWorkspace = this._throw; + getWorkspace(): IWorkspace { return workspace; } + getWorkbenchState = this._throw; + getWorkspaceFolder = this._throw; + isCurrentWorkspace = this._throw; + isInsideWorkspace = this._throw; + }; + + resolver = new WorkspaceBasedVariableResolver(workspaceService); + + // empty workspace + workspace = new Workspace(''); + assertVariableResolve(resolver, 'WORKSPACE_NAME', undefined); + + // single folder workspace without config + workspace = new Workspace('', toWorkspaceFolders([{ path: '/folderName' }])); + assertVariableResolve(resolver, 'WORKSPACE_NAME', 'folderName'); + + // workspace with config + workspace = new Workspace('', toWorkspaceFolders([{ path: 'folderName' }]), URI.file('testWorkspace.code-workspace')); + assertVariableResolve(resolver, 'WORKSPACE_NAME', 'testWorkspace'); + }); +}); \ No newline at end of file From 460645a1f5d084a9cd3f42a98cc43beb63f18cc0 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Wed, 27 Feb 2019 11:16:39 -0800 Subject: [PATCH 02/90] fix russian mnemonics fixes #69515 fixes #62449 --- src/vs/base/browser/ui/menu/menu.ts | 18 +++++++++--------- src/vs/base/browser/ui/menu/menubar.ts | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/vs/base/browser/ui/menu/menu.ts b/src/vs/base/browser/ui/menu/menu.ts index c2b6a7ea36d..47da5e42776 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 nls from 'vs/nls'; import * as strings from 'vs/base/common/strings'; import { IActionRunner, IAction, Action } from 'vs/base/common/actions'; import { ActionBar, IActionItemProvider, ActionsOrientation, Separator, ActionItem, IActionItemOptions, BaseActionItem } from 'vs/base/browser/ui/actionbar/actionbar'; -import { ResolvedKeybinding, KeyCode, KeyCodeUtils } from 'vs/base/common/keyCodes'; +import { ResolvedKeybinding, KeyCode } from 'vs/base/common/keyCodes'; import { addClass, EventType, EventHelper, EventLike, removeTabIndexAndUpdateFocus, isAncestor, hasClass, addDisposableListener, removeClass, append, $, addClasses, removeClasses } from 'vs/base/browser/dom'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { RunOnceScheduler } from 'vs/base/common/async'; @@ -20,8 +20,8 @@ import { Event, Emitter } from 'vs/base/common/event'; import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview'; import { isLinux } from 'vs/base/common/platform'; -export const MENU_MNEMONIC_REGEX: RegExp = /\(&(\w)\)|(?>; + private mnemonics: Map>; private menuDisposables: IDisposable[]; private scrollableElement: DomScrollableElement; private menuElement: HTMLElement; @@ -93,7 +93,7 @@ export class Menu extends ActionBar { if (options.enableMnemonics) { this.menuDisposables.push(addDisposableListener(menuElement, EventType.KEY_DOWN, (e) => { - const key = KeyCodeUtils.fromString(e.key); + const key = e.key.toLocaleLowerCase(); if (this.mnemonics.has(key)) { EventHelper.stop(e, true); const actions = this.mnemonics.get(key)!; @@ -175,7 +175,7 @@ export class Menu extends ActionBar { parent: this }; - this.mnemonics = new Map>(); + this.mnemonics = new Map>(); this.push(actions, { icon: true, label: true, isMenu: true }); @@ -349,7 +349,7 @@ class MenuActionItem extends BaseActionItem { private label: HTMLElement; private check: HTMLElement; - private mnemonic: KeyCode; + private mnemonic: string; private cssClass: string; protected menuStyle: IMenuStyles; @@ -368,7 +368,7 @@ class MenuActionItem extends BaseActionItem { if (label) { let matches = MENU_MNEMONIC_REGEX.exec(label); if (matches) { - this.mnemonic = KeyCodeUtils.fromString((!!matches[1] ? matches[1] : matches[2]).toLocaleLowerCase()); + this.mnemonic = (!!matches[1] ? matches[1] : matches[2]).toLocaleLowerCase(); } } } @@ -522,7 +522,7 @@ class MenuActionItem extends BaseActionItem { } } - getMnemonic(): KeyCode { + getMnemonic(): string { return this.mnemonic; } diff --git a/src/vs/base/browser/ui/menu/menubar.ts b/src/vs/base/browser/ui/menu/menubar.ts index 02e64243b56..4506ec9f488 100644 --- a/src/vs/base/browser/ui/menu/menubar.ts +++ b/src/vs/base/browser/ui/menu/menubar.ts @@ -14,7 +14,7 @@ import { cleanMnemonic, IMenuOptions, Menu, MENU_ESCAPED_MNEMONIC_REGEX, MENU_MN import { ActionRunner, IAction, IActionRunner } from 'vs/base/common/actions'; import { RunOnceScheduler } from 'vs/base/common/async'; import { Event, Emitter } from 'vs/base/common/event'; -import { KeyCode, KeyCodeUtils, ResolvedKeybinding } from 'vs/base/common/keyCodes'; +import { KeyCode, ResolvedKeybinding } from 'vs/base/common/keyCodes'; import { Disposable, dispose, IDisposable } from 'vs/base/common/lifecycle'; const $ = DOM.$; @@ -70,7 +70,7 @@ export class MenuBar extends Disposable { private openedViaKeyboard: boolean; private awaitingAltRelease: boolean; private ignoreNextMouseUp: boolean; - private mnemonics: Map; + private mnemonics: Map; private updatePending: boolean; private _focusState: MenubarState; @@ -89,7 +89,7 @@ export class MenuBar extends Disposable { this.container.attributes['role'] = 'menubar'; this.menuCache = []; - this.mnemonics = new Map(); + this.mnemonics = new Map(); this._focusState = MenubarState.VISIBLE; @@ -110,7 +110,7 @@ export class MenuBar extends Disposable { this._register(DOM.addDisposableListener(this.container, DOM.EventType.KEY_DOWN, (e) => { let event = new StandardKeyboardEvent(e as KeyboardEvent); let eventHandled = true; - const key = !!e.key ? KeyCodeUtils.fromString(e.key) : KeyCode.Unknown; + const key = !!e.key ? e.key.toLocaleLowerCase() : ''; if (event.equals(KeyCode.LeftArrow)) { this.focusPrevious(); @@ -162,7 +162,7 @@ export class MenuBar extends Disposable { return; } - const key = KeyCodeUtils.fromString(e.key); + const key = e.key.toLocaleLowerCase(); if (!this.mnemonics.has(key)) { return; } @@ -505,7 +505,7 @@ export class MenuBar extends Disposable { } private registerMnemonic(menuIndex: number, mnemonic: string): void { - this.mnemonics.set(KeyCodeUtils.fromString(mnemonic), menuIndex); + this.mnemonics.set(mnemonic.toLocaleLowerCase(), menuIndex); } private hideMenubar(): void { From 8c6d7bcbd0cbda7e1d09860d268cca8ae3ad0bc7 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 27 Feb 2019 11:21:56 -0800 Subject: [PATCH 03/90] Bundle TS 3.3.3 instead of TS 3.3.3333 People were being confused by the version number... --- 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 94c17380115..88394d29642 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": "3.3.3333" + "typescript": "3.3.3" }, "scripts": { "postinstall": "node ./postinstall" diff --git a/extensions/yarn.lock b/extensions/yarn.lock index 568fe29f5bf..abf61b0ecfa 100644 --- a/extensions/yarn.lock +++ b/extensions/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -typescript@3.3.3333: - version "3.3.3333" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3333.tgz#171b2c5af66c59e9431199117a3bcadc66fdcfd6" - integrity sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw== +typescript@3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3.tgz#f1657fc7daa27e1a8930758ace9ae8da31403221" + integrity sha512-Y21Xqe54TBVp+VDSNbuDYdGw0BpoR/Q6wo/+35M8PAU0vipahnyduJWirxxdxjsAkS7hue53x2zp8gz7F05u0A== From 69249882e8717cf111e04330390107282e337559 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Wed, 27 Feb 2019 11:45:57 -0800 Subject: [PATCH 04/90] fixes #69323 --- src/vs/workbench/browser/layout.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index 09e3e1b2b10..819bb315340 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -423,7 +423,7 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr } this.statusbarHeight = isStatusbarHidden ? 0 : this.partLayoutInfo.statusbar.height; - this.titlebarHeight = isTitlebarHidden ? 0 : this.partLayoutInfo.titlebar.height / (!menubarVisibility || menubarVisibility === 'hidden' ? getZoomFactor() : 1); // adjust for zoom prevention + this.titlebarHeight = isTitlebarHidden ? 0 : this.partLayoutInfo.titlebar.height / (isMacintosh || !menubarVisibility || menubarVisibility === 'hidden' ? getZoomFactor() : 1); // adjust for zoom prevention this.sidebarHeight = this.workbenchSize.height - this.statusbarHeight - this.titlebarHeight; let sidebarSize = new Dimension(this.sidebarWidth, this.sidebarHeight); From d51a1ce48270a1e51cf2c8943c62d71197bf0bb0 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 27 Feb 2019 13:52:04 -0800 Subject: [PATCH 05/90] Remove star from ligthbulb widget --- src/vs/editor/contrib/codeAction/codeActionWidget.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/editor/contrib/codeAction/codeActionWidget.ts b/src/vs/editor/contrib/codeAction/codeActionWidget.ts index 3522fc39320..c1968825103 100644 --- a/src/vs/editor/contrib/codeAction/codeActionWidget.ts +++ b/src/vs/editor/contrib/codeAction/codeActionWidget.ts @@ -51,7 +51,7 @@ export class CodeActionContextMenu { private codeActionToAction(action: CodeAction): Action { const id = action.command ? action.command.id : action.title; - const title = action.isPreferred ? `${action.title} ★` : action.title; + const title = action.title; return new Action(id, title, undefined, true, () => this._onApplyCodeAction(action) .finally(() => this._onDidExecuteCodeAction.fire(undefined))); From bbcea2f3f9ae6b92a924d8934579c3973b57d8b0 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Wed, 27 Feb 2019 15:13:34 -0800 Subject: [PATCH 06/90] adding some basic menubar tests --- .../base/test/browser/ui/menu/menubar.test.ts | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 src/vs/base/test/browser/ui/menu/menubar.test.ts diff --git a/src/vs/base/test/browser/ui/menu/menubar.test.ts b/src/vs/base/test/browser/ui/menu/menubar.test.ts new file mode 100644 index 00000000000..7e41a8a46a6 --- /dev/null +++ b/src/vs/base/test/browser/ui/menu/menubar.test.ts @@ -0,0 +1,81 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as assert from 'assert'; +import { $ } from 'vs/base/browser/dom'; +import { MenuBar } from 'vs/base/browser/ui/menu/menubar'; + +function getButtonElementByAriaLabel(menubarElement: HTMLElement, ariaLabel: string): HTMLElement | null { + let i; + for (i = 0; i < menubarElement.childElementCount; i++) { + + if (menubarElement.children[i].getAttribute('aria-label') === ariaLabel) { + return menubarElement.children[i] as HTMLElement; + } + } + + return null; +} + +function getTitleDivFromButtonDiv(menuButtonElement: HTMLElement): HTMLElement | null { + let i; + for (i = 0; i < menuButtonElement.childElementCount; i++) { + if (menuButtonElement.children[i].classList.contains('menubar-menu-title')) { + return menuButtonElement.children[i] as HTMLElement; + } + } + + return null; +} + +function getMnemonicFromTitleDiv(menuTitleDiv: HTMLElement): string | null { + let i; + for (i = 0; i < menuTitleDiv.childElementCount; i++) { + if (menuTitleDiv.children[i].tagName.toLocaleLowerCase() === 'mnemonic') { + return menuTitleDiv.children[i].textContent; + } + } + + return null; +} + +function validateMenuBarItem(menubar: MenuBar, menubarContainer: HTMLElement, label: string, readableLabel: string, mnemonic: string) { + menubar.push([ + { + actions: [], + label: label + } + ]); + + const buttonElement = getButtonElementByAriaLabel(menubarContainer, readableLabel); + assert(buttonElement !== null, `Button element not found for ${readableLabel} button.`); + + const titleDiv = getTitleDivFromButtonDiv(buttonElement); + assert(titleDiv !== null, `Title div not found for ${readableLabel} button.`); + + const mnem = getMnemonicFromTitleDiv(titleDiv); + assert.equal(mnem, mnemonic, 'Mnemonic not correct'); +} + +suite('Menubar', () => { + const container = $('.container'); + + const menubar = new MenuBar(container, { + enableMnemonics: true, + visibility: 'visible' + }); + + test('English File menu renders mnemonics', function () { + validateMenuBarItem(menubar, container, '&File', 'File', 'F'); + }); + + test('Russian File menu renders mnemonics', function () { + validateMenuBarItem(menubar, container, '&Файл', 'Файл', 'Ф'); + }); + + test('Chinese File menu renders mnemonics', function () { + validateMenuBarItem(menubar, container, '文件(&F)', '文件', 'F'); + }); +}); \ No newline at end of file From 17d8121dd6098f01d5fd2acef297d8d3ed72bc73 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Wed, 27 Feb 2019 16:23:11 -0800 Subject: [PATCH 07/90] node2@1.32.1 - #69118 --- build/builtInExtensions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/builtInExtensions.json b/build/builtInExtensions.json index 37d63713475..e0794621304 100644 --- a/build/builtInExtensions.json +++ b/build/builtInExtensions.json @@ -16,7 +16,7 @@ }, { "name": "ms-vscode.node-debug2", - "version": "1.32.0", + "version": "1.32.1", "repo": "https://github.com/Microsoft/vscode-node-debug2", "metadata": { "id": "36d19e17-7569-4841-a001-947eb18602b2", From 0a4a3b98282175a82a819b70d2bbe46475e1ebd0 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Wed, 27 Feb 2019 17:17:17 -0800 Subject: [PATCH 08/90] strict null checks --- src/vs/base/test/browser/ui/menu/menubar.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/base/test/browser/ui/menu/menubar.test.ts b/src/vs/base/test/browser/ui/menu/menubar.test.ts index 7e41a8a46a6..8bbeddcfc58 100644 --- a/src/vs/base/test/browser/ui/menu/menubar.test.ts +++ b/src/vs/base/test/browser/ui/menu/menubar.test.ts @@ -52,10 +52,10 @@ function validateMenuBarItem(menubar: MenuBar, menubarContainer: HTMLElement, la const buttonElement = getButtonElementByAriaLabel(menubarContainer, readableLabel); assert(buttonElement !== null, `Button element not found for ${readableLabel} button.`); - const titleDiv = getTitleDivFromButtonDiv(buttonElement); + const titleDiv = getTitleDivFromButtonDiv(buttonElement!); assert(titleDiv !== null, `Title div not found for ${readableLabel} button.`); - const mnem = getMnemonicFromTitleDiv(titleDiv); + const mnem = getMnemonicFromTitleDiv(titleDiv!); assert.equal(mnem, mnemonic, 'Mnemonic not correct'); } From 09d4f006b20f4d74b3a76a53ccddec46bd9baef9 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 28 Feb 2019 13:04:18 -0800 Subject: [PATCH 09/90] Revert "Cleaning up reviver handling for webviews" This reverts commit 714192fdc30bfdb02259f41a3459e335c2b38e5a. Fixes #69612 --- .../api/electron-browser/mainThreadWebview.ts | 109 +++++++++--------- .../electron-browser/webviewEditorService.ts | 32 +++-- 2 files changed, 73 insertions(+), 68 deletions(-) diff --git a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts index e8b248cb19c..2e056e31d90 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts @@ -2,33 +2,35 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { onUnexpectedError } from 'vs/base/common/errors'; import { dispose, IDisposable } from 'vs/base/common/lifecycle'; import * as map from 'vs/base/common/map'; import { URI, UriComponents } from 'vs/base/common/uri'; -import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { localize } from 'vs/nls'; -import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; import { IOpenerService } from 'vs/platform/opener/common/opener'; -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { ExtHostContext, ExtHostWebviewsShape, IExtHostContext, MainContext, MainThreadWebviewsShape, WebviewInsetHandle, WebviewPanelHandle, WebviewPanelShowOptions } from 'vs/workbench/api/node/extHost.protocol'; +import { ExtHostContext, ExtHostWebviewsShape, IExtHostContext, MainContext, MainThreadWebviewsShape, WebviewPanelHandle, WebviewPanelShowOptions, WebviewInsetHandle } from 'vs/workbench/api/node/extHost.protocol'; import { editorGroupToViewColumn, EditorViewColumn, viewColumnToEditorGroup } from 'vs/workbench/api/shared/editor'; -import { CodeInsetController } from 'vs/workbench/contrib/codeinset/electron-browser/codeInset.contribution'; import { WebviewEditor } from 'vs/workbench/contrib/webview/electron-browser/webviewEditor'; import { WebviewEditorInput } from 'vs/workbench/contrib/webview/electron-browser/webviewEditorInput'; -import { ICreateWebViewShowOptions, IWebviewEditorService, WebviewInputOptions } from 'vs/workbench/contrib/webview/electron-browser/webviewEditorService'; -import { WebviewElement } from 'vs/workbench/contrib/webview/electron-browser/webviewElement'; -import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; +import { ICreateWebViewShowOptions, IWebviewEditorService, WebviewInputOptions, WebviewReviver } from 'vs/workbench/contrib/webview/electron-browser/webviewEditorService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; -import { IPartService, Parts } from 'vs/workbench/services/part/common/partService'; +import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import * as vscode from 'vscode'; import { extHostNamedCustomer } from './extHostCustomers'; +import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import { onUnexpectedError } from 'vs/base/common/errors'; +import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { WebviewElement } from 'vs/workbench/contrib/webview/electron-browser/webviewElement'; +import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; +import { CodeInsetController } from 'vs/workbench/contrib/codeinset/electron-browser/codeInset.contribution'; +import { IPartService, Parts } from 'vs/workbench/services/part/common/partService'; @extHostNamedCustomer(MainContext.MainThreadWebviews) -export class MainThreadWebviews implements MainThreadWebviewsShape { +export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviver { + + private static readonly viewType = 'mainThreadWebview'; private static readonly standardSupportedLinkSchemes = ['http', 'https', 'mailto']; @@ -39,7 +41,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape { private readonly _proxy: ExtHostWebviewsShape; private readonly _webviews = new Map(); private readonly _webviewsElements = new Map(); - private readonly _revivers = new Map(); + private readonly _revivers = new Set(); private _activeWebview: WebviewPanelHandle | undefined = undefined; @@ -60,6 +62,8 @@ export class MainThreadWebviews implements MainThreadWebviewsShape { _editorService.onDidActiveEditorChange(this.onActiveEditorChanged, this, this._toDispose); _editorService.onDidVisibleEditorsChange(this.onVisibleEditorsChanged, this, this._toDispose); + this._toDispose.push(_webviewService.registerReviver(MainThreadWebviews.viewType, this)); + lifecycleService.onBeforeShutdown(e => { e.veto(this._onBeforeShutdown()); }, this, this._toDispose); @@ -84,7 +88,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape { mainThreadShowOptions.group = viewColumnToEditorGroup(this._editorGroupService, showOptions.viewColumn); } - const webview = this._webviewService.createWebview(this.getInternalWebviewId(viewType), title, mainThreadShowOptions, reviveWebviewOptions(options), URI.revive(extensionLocation), this.createWebviewEventDelegate(handle)); + const webview = this._webviewService.createWebview(MainThreadWebviews.viewType, title, mainThreadShowOptions, reviveWebviewOptions(options), URI.revive(extensionLocation), this.createWebviewEventDelegate(handle)); webview.state = { viewType: viewType, state: undefined @@ -205,57 +209,50 @@ export class MainThreadWebviews implements MainThreadWebviewsShape { } public $registerSerializer(viewType: string): void { - if (this._revivers.has(viewType)) { - throw new Error(`Reviver for ${viewType} already registered`); - } - this._revivers.set(viewType, this._webviewService.registerReviver(this.getInternalWebviewId(viewType), { - canRevive: (webview) => { - return !webview.isDisposed() && webview.state; - }, - reviveWebview: (webview): Promise => { - const viewType = webview.state.viewType; - return Promise.resolve(this._extensionService.activateByEvent(`onWebviewPanel:${viewType}`).then(() => { - const handle = 'revival-' + MainThreadWebviews.revivalPool++; - this._webviews.set(handle, webview); - webview._events = this.createWebviewEventDelegate(handle); - let state = undefined; - if (webview.state.state) { - try { - state = JSON.parse(webview.state.state); - } catch { - // noop - } - } - - return this._proxy.$deserializeWebviewPanel(handle, webview.state.viewType, webview.getTitle(), state, editorGroupToViewColumn(this._editorGroupService, webview.group), webview.options) - .then(undefined, error => { - onUnexpectedError(error); - - webview.html = MainThreadWebviews.getDeserializationFailedContents(viewType); - }); - })); - } - })); + this._revivers.add(viewType); } public $unregisterSerializer(viewType: string): void { - const reviver = this._revivers.get(viewType); - if (!reviver) { - throw new Error(`No reviver for ${viewType} registered`); - } - - reviver.dispose(); this._revivers.delete(viewType); } - private getInternalWebviewId(viewType: string): string { - return `mainThreadWebview-${viewType}`; + public reviveWebview(webview: WebviewEditorInput): Promise { + const viewType = webview.state.viewType; + return Promise.resolve(this._extensionService.activateByEvent(`onWebviewPanel:${viewType}`).then(() => { + const handle = 'revival-' + MainThreadWebviews.revivalPool++; + this._webviews.set(handle, webview); + webview._events = this.createWebviewEventDelegate(handle); + + let state = undefined; + if (webview.state.state) { + try { + state = JSON.parse(webview.state.state); + } catch { + // noop + } + } + + return this._proxy.$deserializeWebviewPanel(handle, webview.state.viewType, webview.getTitle(), state, editorGroupToViewColumn(this._editorGroupService, webview.group), webview.options) + .then(undefined, error => { + onUnexpectedError(error); + + webview.html = MainThreadWebviews.getDeserializationFailedContents(viewType); + }); + })); + } + + public canRevive(webview: WebviewEditorInput): boolean { + if (webview.isDisposed() || !webview.state) { + return false; + } + + return this._revivers.has(webview.state.viewType) || !!webview.reviver; } private _onBeforeShutdown(): boolean { - this._webviews.forEach((webview) => { - if (!webview.isDisposed() && webview.state && this._revivers.has(webview.state.viewType)) { - webview.state.state = webview.webviewState; + this._webviews.forEach((view) => { + if (this.canRevive(view)) { + view.state.state = view.webviewState; } }); return false; // Don't veto shutdown diff --git a/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts b/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts index abbda87a79e..c1d9d940bed 100644 --- a/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts +++ b/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts @@ -90,7 +90,7 @@ export function areWebviewInputOptionsEqual(a: WebviewInputOptions, b: WebviewIn export class WebviewEditorService implements IWebviewEditorService { _serviceBrand: any; - private readonly _revivers = new Map(); + private readonly _revivers = new Map(); private _awaitingRevival: { input: WebviewEditorInput, resolve: (x: any) => void }[] = []; constructor( @@ -159,14 +159,17 @@ export class WebviewEditorService implements IWebviewEditorService { viewType: string, reviver: WebviewReviver ): IDisposable { - if (this._revivers.has(viewType)) { - throw new Error(`Reviver for ${viewType} already registered`); + const currentRevivers = this._revivers.get(viewType); + if (currentRevivers) { + currentRevivers.push(reviver); + } else { + this._revivers.set(viewType, [reviver]); } - this._revivers.set(viewType, reviver); + // Resolve any pending views - const toRevive = this._awaitingRevival.filter(x => reviver.canRevive(x.input)); - this._awaitingRevival = this._awaitingRevival.filter(x => !reviver.canRevive(x.input)); + const toRevive = this._awaitingRevival.filter(x => x.input.viewType === viewType); + this._awaitingRevival = this._awaitingRevival.filter(x => x.input.viewType !== viewType); for (const input of toRevive) { reviver.reviveWebview(input.input).then(() => input.resolve(undefined)); @@ -181,19 +184,24 @@ export class WebviewEditorService implements IWebviewEditorService { webview: WebviewEditorInput ): boolean { const viewType = webview.viewType; - const reviver = this._revivers.get(viewType); - return !!reviver && reviver.canRevive(webview); + const revivers = this._revivers.get(viewType); + return !!revivers && revivers.some(reviver => reviver.canRevive(webview)); } private async tryRevive( webview: WebviewEditorInput ): Promise { - const reviver = this._revivers.get(webview.viewType); - if (!reviver || !reviver.canRevive(webview)) { + const revivers = this._revivers.get(webview.viewType); + if (!revivers) { return false; } - await reviver.reviveWebview(webview); - return true; + for (const reviver of revivers) { + if (reviver.canRevive(webview)) { + await reviver.reviveWebview(webview); + return true; + } + } + return false; } } From 52306b406d9231a0667c758e536bd177e5570180 Mon Sep 17 00:00:00 2001 From: Rachel Macfarlane Date: Thu, 28 Feb 2019 18:16:29 -0800 Subject: [PATCH 10/90] Fix memory leak in commentThreadWidget --- .../electron-browser/commentThreadWidget.ts | 62 ++++++++++--------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/src/vs/workbench/contrib/comments/electron-browser/commentThreadWidget.ts b/src/vs/workbench/contrib/comments/electron-browser/commentThreadWidget.ts index 5c3bad5a5b0..79fb58de164 100644 --- a/src/vs/workbench/contrib/comments/electron-browser/commentThreadWidget.ts +++ b/src/vs/workbench/contrib/comments/electron-browser/commentThreadWidget.ts @@ -11,7 +11,7 @@ import { Action } from 'vs/base/common/actions'; import * as arrays from 'vs/base/common/arrays'; import { Color } from 'vs/base/common/color'; import { Emitter, Event } from 'vs/base/common/event'; -import { IDisposable } from 'vs/base/common/lifecycle'; +import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import * as platform from 'vs/base/common/platform'; import * as strings from 'vs/base/common/strings'; import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser'; @@ -69,7 +69,7 @@ export class ReviewZoneWidget extends ZoneWidget { private _owner: string; private _pendingComment: string; private _draftMode: modes.DraftMode; - private _localToDispose: IDisposable[]; + private _submitActionsDisposables: IDisposable[]; private _globalToDispose: IDisposable[]; private _markdownRenderer: MarkdownRenderer; private _styleElement: HTMLStyleElement; @@ -117,7 +117,7 @@ export class ReviewZoneWidget extends ZoneWidget { this._draftMode = draftMode; this._isCollapsed = commentThread.collapsibleState !== modes.CommentThreadCollapsibleState.Expanded; this._globalToDispose = []; - this._localToDispose = []; + this._disposables = []; this._formActions = null; this.create(); @@ -296,12 +296,14 @@ export class ReviewZoneWidget extends ZoneWidget { } updateDraftMode(draftMode: modes.DraftMode) { - this._draftMode = draftMode; + if (this._draftMode !== draftMode) { + this._draftMode = draftMode; - if (this._formActions) { - let model = this._commentEditor.getModel(); - dom.clearNode(this._formActions); - this.createCommentWidgetActions(this._formActions, model); + if (this._formActions) { + let model = this._commentEditor.getModel(); + dom.clearNode(this._formActions); + this.createCommentWidgetActions(this._formActions, model); + } } } @@ -316,8 +318,8 @@ export class ReviewZoneWidget extends ZoneWidget { display(lineNumber: number) { this._commentGlyph = new CommentGlyphWidget(this.editor, lineNumber); - this._localToDispose.push(this.editor.onMouseDown(e => this.onEditorMouseDown(e))); - this._localToDispose.push(this.editor.onMouseUp(e => this.onEditorMouseUp(e))); + this._disposables.push(this.editor.onMouseDown(e => this.onEditorMouseDown(e))); + this._disposables.push(this.editor.onMouseUp(e => this.onEditorMouseUp(e))); let headHeight = Math.ceil(this.editor.getConfiguration().lineHeight * 1.2); this._headElement.style.height = `${headHeight}px`; this._headElement.style.lineHeight = this._headElement.style.height; @@ -343,12 +345,12 @@ export class ReviewZoneWidget extends ZoneWidget { }); const resource = URI.parse(`${COMMENT_SCHEME}:commentinput-${modeId}.md?${params}`); const model = this.modelService.createModel(this._pendingComment || '', this.modeService.createByFilepathOrFirstLine(resource.path), resource, false); - this._localToDispose.push(model); + this._disposables.push(model); this._commentEditor.setModel(model); - this._localToDispose.push(this._commentEditor); - this._localToDispose.push(this._commentEditor.getModel().onDidChangeContent(() => this.setCommentEditorDecorations())); + this._disposables.push(this._commentEditor); + this._disposables.push(this._commentEditor.getModel().onDidChangeContent(() => this.setCommentEditorDecorations())); if ((this._commentThread as modes.CommentThread2).commentThreadHandle !== undefined) { - this._localToDispose.push(this._commentEditor.onDidFocusEditorWidget(() => { + this._disposables.push(this._commentEditor.onDidFocusEditorWidget(() => { let commentThread = this._commentThread as modes.CommentThread2; commentThread.input = { uri: this._commentEditor.getModel().uri, @@ -357,7 +359,7 @@ export class ReviewZoneWidget extends ZoneWidget { this.commentService.setActiveCommentThread(this._commentThread); })); - this._localToDispose.push(this._commentEditor.getModel().onDidChangeContent(() => { + this._disposables.push(this._commentEditor.getModel().onDidChangeContent(() => { let modelContent = this._commentEditor.getValue(); let thread = (this._commentThread as modes.CommentThread2); if (thread.input.uri === this._commentEditor.getModel().uri && thread.input.value !== modelContent) { @@ -367,7 +369,7 @@ export class ReviewZoneWidget extends ZoneWidget { } })); - this._localToDispose.push((this._commentThread as modes.CommentThread2).onDidChangeInput(input => { + this._disposables.push((this._commentThread as modes.CommentThread2).onDidChangeInput(input => { let thread = (this._commentThread as modes.CommentThread2); if (thread.input.uri !== this._commentEditor.getModel().uri) { @@ -389,7 +391,7 @@ export class ReviewZoneWidget extends ZoneWidget { } })); - this._localToDispose.push((this._commentThread as modes.CommentThread2).onDidChangeComments(_ => { + this._disposables.push((this._commentThread as modes.CommentThread2).onDidChangeComments(_ => { this.update(this._commentThread); })); } @@ -406,7 +408,7 @@ export class ReviewZoneWidget extends ZoneWidget { } } - this._localToDispose.push(this._commentEditor.onKeyDown((ev: IKeyboardEvent) => { + this._disposables.push(this._commentEditor.onKeyDown((ev: IKeyboardEvent) => { const hasExistingComments = this._commentThread.comments.length > 0; if (this._commentEditor.getModel().getValueLength() === 0 && ev.keyCode === KeyCode.Escape) { @@ -432,7 +434,7 @@ export class ReviewZoneWidget extends ZoneWidget { if ((this._commentThread as modes.CommentThread2).commentThreadHandle !== undefined) { this.createCommentWidgetActions2(this._formActions, model); - this._localToDispose.push((this._commentThread as modes.CommentThread2).onDidChangeAcceptInputCommands(_ => { + this._disposables.push((this._commentThread as modes.CommentThread2).onDidChangeAcceptInputCommands(_ => { dom.clearNode(this._formActions); this.createCommentWidgetActions2(this._formActions, model); })); @@ -471,12 +473,14 @@ export class ReviewZoneWidget extends ZoneWidget { } private createCommentWidgetActions(container: HTMLElement, model: ITextModel) { + dispose(this._submitActionsDisposables); + const button = new Button(container); - this._localToDispose.push(attachButtonStyler(button, this.themeService)); + this._submitActionsDisposables.push(attachButtonStyler(button, this.themeService)); button.label = 'Add comment'; button.enabled = model.getValueLength() > 0; - this._localToDispose.push(this._commentEditor.onDidChangeModelContent(_ => { + this._submitActionsDisposables.push(this._commentEditor.onDidChangeModelContent(_ => { if (this._commentEditor.getValue()) { button.enabled = true; } else { @@ -498,7 +502,7 @@ export class ReviewZoneWidget extends ZoneWidget { const deleteDraftLabel = this.commentService.getDeleteDraftLabel(this._owner); if (deleteDraftLabel) { const deletedraftButton = new Button(container); - this._disposables.push(attachButtonStyler(deletedraftButton, this.themeService)); + this._submitActionsDisposables.push(attachButtonStyler(deletedraftButton, this.themeService)); deletedraftButton.label = deleteDraftLabel; deletedraftButton.enabled = true; @@ -514,7 +518,7 @@ export class ReviewZoneWidget extends ZoneWidget { const submitDraftLabel = this.commentService.getFinishDraftLabel(this._owner); if (submitDraftLabel) { const submitdraftButton = new Button(container); - this._disposables.push(attachButtonStyler(submitdraftButton, this.themeService)); + this._submitActionsDisposables.push(attachButtonStyler(submitdraftButton, this.themeService)); submitdraftButton.label = this.commentService.getFinishDraftLabel(this._owner); submitdraftButton.enabled = true; @@ -540,7 +544,7 @@ export class ReviewZoneWidget extends ZoneWidget { draftButton.label = this.commentService.getStartDraftLabel(this._owner); draftButton.enabled = model.getValueLength() > 0; - this._localToDispose.push(this._commentEditor.onDidChangeModelContent(_ => { + this._submitActionsDisposables.push(this._commentEditor.onDidChangeModelContent(_ => { if (this._commentEditor.getValue()) { draftButton.enabled = true; } else { @@ -571,12 +575,12 @@ export class ReviewZoneWidget extends ZoneWidget { commentThread.acceptInputCommands.reverse().forEach(command => { const button = new Button(container); - this._localToDispose.push(attachButtonStyler(button, this.themeService)); + this._disposables.push(attachButtonStyler(button, this.themeService)); button.label = command.title; let commandId = command.id; let args = command.arguments || []; - this._localToDispose.push(button.onDidClick(async () => { + this._disposables.push(button.onDidClick(async () => { commentThread.input = { uri: this._commentEditor.getModel().uri, value: this._commentEditor.getValue() @@ -707,8 +711,8 @@ export class ReviewZoneWidget extends ZoneWidget { } this._reviewThreadReplyButton.textContent = nls.localize('reply', "Reply..."); // bind click/escape actions for reviewThreadReplyButton and textArea - this._localToDispose.push(dom.addDisposableListener(this._reviewThreadReplyButton, 'click', _ => this.expandReplyArea())); - this._localToDispose.push(dom.addDisposableListener(this._reviewThreadReplyButton, 'focus', _ => this.expandReplyArea())); + this._disposables.push(dom.addDisposableListener(this._reviewThreadReplyButton, 'click', _ => this.expandReplyArea())); + this._disposables.push(dom.addDisposableListener(this._reviewThreadReplyButton, 'focus', _ => this.expandReplyArea())); this._commentEditor.onDidBlurEditorWidget(() => { if (this._commentEditor.getModel().getValueLength() === 0 && dom.hasClass(this._commentForm, 'expand')) { @@ -920,7 +924,7 @@ export class ReviewZoneWidget extends ZoneWidget { } this._globalToDispose.forEach(global => global.dispose()); - this._localToDispose.forEach(local => local.dispose()); + this._submitActionsDisposables.forEach(local => local.dispose()); this._onDidClose.fire(undefined); } } \ No newline at end of file From 240eace66d4af5652c2a2c13f315c9705ed2108f Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 1 Mar 2019 13:45:43 +0100 Subject: [PATCH 11/90] fix #69557 --- .../workbench/browser/parts/editor/breadcrumbsPicker.ts | 2 +- src/vs/workbench/contrib/outline/browser/outlinePanel.ts | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts index decc4f57d70..6f1c4e469c8 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts @@ -150,7 +150,7 @@ export abstract class BreadcrumbsPicker { this._arrow.style.marginLeft = `${this._layoutInfo.arrowOffset}px`; this._treeContainer.style.height = `${treeHeight}px`; this._treeContainer.style.width = `${this._layoutInfo.width}px`; - this._tree.layout(); + this._tree.layout(treeHeight, this._layoutInfo.width); } diff --git a/src/vs/workbench/contrib/outline/browser/outlinePanel.ts b/src/vs/workbench/contrib/outline/browser/outlinePanel.ts index 99d9907e974..0df0b100107 100644 --- a/src/vs/workbench/contrib/outline/browser/outlinePanel.ts +++ b/src/vs/workbench/contrib/outline/browser/outlinePanel.ts @@ -239,7 +239,6 @@ export class OutlinePanel extends ViewletPanel { private _editorDisposables = new Array(); private _outlineViewState = new OutlineViewState(); private _requestOracle?: RequestOracle; - private _cachedHeight: number; private _domNode: HTMLElement; private _message: HTMLDivElement; private _inputContainer: HTMLDivElement; @@ -379,10 +378,8 @@ export class OutlinePanel extends ViewletPanel { })); } - protected layoutBody(height: number): void { - if (height !== this._cachedHeight) { - this._tree.layout(height); - } + protected layoutBody(height: number, width: number): void { + this._tree.layout(height, width); } getActions(): IAction[] { @@ -525,7 +522,7 @@ export class OutlinePanel extends ViewletPanel { await this._tree.setInput(newModel, state); } - this.layoutBody(this._cachedHeight); + this._tree.layout(); // transfer focus from domNode to the tree if (this._domNode === document.activeElement) { From 78484cc6cee62012f7a19d700ecb90d10126e4f8 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 1 Mar 2019 13:51:45 +0100 Subject: [PATCH 12/90] fix #69578 --- src/vs/editor/contrib/documentSymbols/outlineTree.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/contrib/documentSymbols/outlineTree.ts b/src/vs/editor/contrib/documentSymbols/outlineTree.ts index a15286a4a94..a6fe4786c24 100644 --- a/src/vs/editor/contrib/documentSymbols/outlineTree.ts +++ b/src/vs/editor/contrib/documentSymbols/outlineTree.ts @@ -16,7 +16,7 @@ import { SymbolKind, symbolKindToCssClass } from 'vs/editor/common/modes'; import { OutlineElement, OutlineGroup, OutlineModel, TreeElement } from 'vs/editor/contrib/documentSymbols/outlineModel'; import { localize } from 'vs/nls'; import { IKeybindingService, IKeyboardEvent } from 'vs/platform/keybinding/common/keybinding'; -import { IconLabel } from 'vs/base/browser/ui/iconLabel/iconLabel'; +import { IconLabel, IIconLabelValueOptions } from 'vs/base/browser/ui/iconLabel/iconLabel'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { OutlineConfigKeys } from 'vs/editor/contrib/documentSymbols/outline'; import { MarkerSeverity } from 'vs/platform/markers/common/markers'; @@ -120,8 +120,9 @@ export class OutlineElementRenderer implements ITreeRenderer, index: number, template: OutlineElementTemplate): void { const { element } = node; - const options = { + const options: IIconLabelValueOptions = { matches: createMatches(node.filterData), + labelEscapeNewLines: true, extraClasses: [], title: localize('title.template', "{0} ({1})", element.symbol.name, OutlineElementRenderer._symbolKindNames[element.symbol.kind]) }; From 28d66834bdc0c75628ca0eb2c97a65c434808ad8 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 1 Mar 2019 13:53:16 +0100 Subject: [PATCH 13/90] strict null mess --- src/vs/editor/contrib/documentSymbols/outlineTree.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/contrib/documentSymbols/outlineTree.ts b/src/vs/editor/contrib/documentSymbols/outlineTree.ts index a6fe4786c24..926d6a3da2f 100644 --- a/src/vs/editor/contrib/documentSymbols/outlineTree.ts +++ b/src/vs/editor/contrib/documentSymbols/outlineTree.ts @@ -16,7 +16,7 @@ import { SymbolKind, symbolKindToCssClass } from 'vs/editor/common/modes'; import { OutlineElement, OutlineGroup, OutlineModel, TreeElement } from 'vs/editor/contrib/documentSymbols/outlineModel'; import { localize } from 'vs/nls'; import { IKeybindingService, IKeyboardEvent } from 'vs/platform/keybinding/common/keybinding'; -import { IconLabel, IIconLabelValueOptions } from 'vs/base/browser/ui/iconLabel/iconLabel'; +import { IconLabel } from 'vs/base/browser/ui/iconLabel/iconLabel'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { OutlineConfigKeys } from 'vs/editor/contrib/documentSymbols/outline'; import { MarkerSeverity } from 'vs/platform/markers/common/markers'; @@ -120,7 +120,7 @@ export class OutlineElementRenderer implements ITreeRenderer, index: number, template: OutlineElementTemplate): void { const { element } = node; - const options: IIconLabelValueOptions = { + const options = { matches: createMatches(node.filterData), labelEscapeNewLines: true, extraClasses: [], From c3913b81adacb36ae9c636b29fb2391a3f436789 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 1 Mar 2019 14:03:59 +0100 Subject: [PATCH 14/90] Revert "make sure outline requests are cancelled when changing providers, #69147" This reverts commit bfe5b4c92c18b0be8e492b836bbbb45ca0571d4e. This fixes #69657 --- .../contrib/documentSymbols/outlineModel.ts | 12 +++------ .../documentSymbols/test/outlineModel.test.ts | 26 +------------------ 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/src/vs/editor/contrib/documentSymbols/outlineModel.ts b/src/vs/editor/contrib/documentSymbols/outlineModel.ts index 0c231026ede..179b23f3a11 100644 --- a/src/vs/editor/contrib/documentSymbols/outlineModel.ts +++ b/src/vs/editor/contrib/documentSymbols/outlineModel.ts @@ -264,11 +264,7 @@ export class OutlineModel extends TreeElement { }); } - private static _create(textModel: ITextModel, token: CancellationToken): Promise { - - let chainedToken = new CancellationTokenSource(); - let listener = DocumentSymbolProviderRegistry.onDidChange(() => chainedToken.cancel()); - token.onCancellationRequested(() => chainedToken.cancel()); + static _create(textModel: ITextModel, token: CancellationToken): Promise { let result = new OutlineModel(textModel); let promises = DocumentSymbolProviderRegistry.ordered(textModel).map((provider, index) => { @@ -276,7 +272,7 @@ export class OutlineModel extends TreeElement { let id = TreeElement.findId(`provider_${index}`, result); let group = new OutlineGroup(id, result, provider, index); - return Promise.resolve(provider.provideDocumentSymbols(result.textModel, chainedToken.token)).then(result => { + return Promise.resolve(provider.provideDocumentSymbols(result.textModel, token)).then(result => { for (const info of result || []) { OutlineModel._makeOutlineElement(info, group); } @@ -293,9 +289,7 @@ export class OutlineModel extends TreeElement { }); }); - return Promise.all(promises) - .then(() => result._compact()) - .finally(() => listener.dispose()); + return Promise.all(promises).then(() => result._compact()); } private static _makeOutlineElement(info: DocumentSymbol, container: OutlineGroup | OutlineElement): void { diff --git a/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts b/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts index 229c065da87..b15a1451072 100644 --- a/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts +++ b/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts @@ -46,7 +46,7 @@ suite('OutlineModel', function () { let isCancelled = false; let reg = DocumentSymbolProviderRegistry.register({ pattern: '**/path.foo' }, { - provideDocumentSymbols(_d, token) { + provideDocumentSymbols(d, token) { return new Promise(resolve => { token.onCancellationRequested(_ => { isCancelled = true; @@ -183,28 +183,4 @@ suite('OutlineModel', function () { assert.equal(model.children['g2']!.children['c2'].children['c2.2'].marker!.count, 1); }); - test('"Cannot read property \'adapter\' of undefined" #69147', async function () { - - let model = TextModel.createFromString('foo', undefined, undefined, URI.file('/fome/path.foo')); - let reg1 = DocumentSymbolProviderRegistry.register({ pattern: '**/path.foo' }, { - provideDocumentSymbols(_model, token) { - assert.equal(token.isCancellationRequested, true); - return []; - } - }); - let reg2 = DocumentSymbolProviderRegistry.register({ pattern: '**/path.foo' }, { - provideDocumentSymbols(_model, token) { - assert.equal(token.isCancellationRequested, false); - reg1.dispose(); - assert.equal(token.isCancellationRequested, true); - return []; - } - }); - - await OutlineModel.create(model, CancellationToken.None); - - reg1.dispose(); - reg2.dispose(); - }); - }); From 804373ac4d5c84e96c8086cee5b9be132df88837 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Fri, 1 Mar 2019 18:00:01 +0100 Subject: [PATCH 15/90] fixes #69613 --- .../contrib/referenceSearch/referencesWidget.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vs/editor/contrib/referenceSearch/referencesWidget.ts b/src/vs/editor/contrib/referenceSearch/referencesWidget.ts index 78037a31b7e..c637c11f7e0 100644 --- a/src/vs/editor/contrib/referenceSearch/referencesWidget.ts +++ b/src/vs/editor/contrib/referenceSearch/referencesWidget.ts @@ -412,16 +412,16 @@ export class ReferenceWidget extends PeekViewWidget { onEvent(e.elements[0], 'show'); } }); - this._tree.onMouseDblClick(e => { - const aside = e.browserEvent.ctrlKey || e.browserEvent.metaKey || e.browserEvent.altKey; - const goto = e.browserEvent.detail === 2; + this._tree.onDidOpen(e => { + const aside = (e.browserEvent instanceof MouseEvent) && (e.browserEvent.ctrlKey || e.browserEvent.metaKey || e.browserEvent.altKey); + const goto = !e.browserEvent || ((e.browserEvent instanceof MouseEvent) && e.browserEvent.detail === 2); if (aside) { - onEvent(e.element, 'side'); + onEvent(e.elements[0], 'side'); } else if (goto) { - onEvent(e.element, 'goto'); + onEvent(e.elements[0], 'goto'); } else { - onEvent(e.element, 'show'); + onEvent(e.elements[0], 'show'); } }); From d6c200ea57fc3104af1c237dfd16ff0d83c3ad2a Mon Sep 17 00:00:00 2001 From: Rachel Macfarlane Date: Fri, 1 Mar 2019 10:47:58 -0800 Subject: [PATCH 16/90] Initialize disposables array in commentThreadWidget --- .../contrib/comments/electron-browser/commentThreadWidget.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/comments/electron-browser/commentThreadWidget.ts b/src/vs/workbench/contrib/comments/electron-browser/commentThreadWidget.ts index 79fb58de164..973dd5a3292 100644 --- a/src/vs/workbench/contrib/comments/electron-browser/commentThreadWidget.ts +++ b/src/vs/workbench/contrib/comments/electron-browser/commentThreadWidget.ts @@ -117,7 +117,7 @@ export class ReviewZoneWidget extends ZoneWidget { this._draftMode = draftMode; this._isCollapsed = commentThread.collapsibleState !== modes.CommentThreadCollapsibleState.Expanded; this._globalToDispose = []; - this._disposables = []; + this._submitActionsDisposables = []; this._formActions = null; this.create(); From 485b2c924a9c66faa20c6bd10c799e5e9409f8a5 Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Fri, 1 Mar 2019 12:47:37 -0800 Subject: [PATCH 17/90] Notice for Node v10.x requirement for smoketest --- test/smoke/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/smoke/README.md b/test/smoke/README.md index c61944fee9e..4154212a0f5 100644 --- a/test/smoke/README.md +++ b/test/smoke/README.md @@ -1,5 +1,7 @@ # VS Code Smoke Test +Make sure you are on **Node v10.x**. + ### Run ```bash From 55d720646c20baf94b4ff2b20b7b79bbfb3ef8a6 Mon Sep 17 00:00:00 2001 From: Andre Weinand Date: Fri, 1 Mar 2019 22:28:42 +0100 Subject: [PATCH 18/90] support integrated terminal in serverReady feature --- .../debug-server-ready/src/extension.ts | 186 ++++++++++++------ .../debug-server-ready/src/typings/ref.d.ts | 1 + 2 files changed, 127 insertions(+), 60 deletions(-) diff --git a/extensions/debug-server-ready/src/extension.ts b/extensions/debug-server-ready/src/extension.ts index 1aecc7ec852..413c4c3529f 100644 --- a/extensions/debug-server-ready/src/extension.ts +++ b/extensions/debug-server-ready/src/extension.ts @@ -7,7 +7,6 @@ import * as vscode from 'vscode'; //import * as nls from 'vscode-nls'; import * as util from 'util'; -const trackers = new Set(); const PATTERN = 'listening on.* (https?://\\S+|[0-9]+)'; // matches "listening on port 3000" or "Now listening on: https://localhost:5001" const URI_FORMAT = 'http://localhost:%s'; @@ -20,13 +19,123 @@ interface ServerReadyAction { webRoot?: string; } +class ServerReadyDetector extends vscode.Disposable { + static detectors = new Map(); + + private hasFired = false; + private regexp: RegExp; + private disposables: vscode.Disposable[] = []; + + static start(session: vscode.DebugSession): ServerReadyDetector | undefined { + if (session.configuration.serverReadyAction) { + let detector = ServerReadyDetector.detectors.get(session); + if (!detector) { + detector = new ServerReadyDetector(session); + ServerReadyDetector.detectors.set(session, detector); + } + return detector; + } + return undefined; + } + + static stop(session: vscode.DebugSession): void { + let detector = ServerReadyDetector.detectors.get(session); + if (detector) { + ServerReadyDetector.detectors.delete(session); + detector.dispose(); + } + } + + private constructor(private session: vscode.DebugSession) { + super(() => this.internalDispose()); + + this.regexp = new RegExp(session.configuration.serverReadyAction.pattern || PATTERN); + } + + private internalDispose() { + this.disposables.forEach(d => d.dispose()); + this.disposables = []; + } + + trackTerminals() { + // TODO: listen only on the Terminal associated with the debug session + vscode.window.terminals.forEach(terminal => { + this.disposables.push(terminal.onDidWriteData(s => { + this.detectPattern(s); + })); + }); + } + + detectPattern(s: string): void { + + if (!this.hasFired) { + const result = this.regexp.exec(s); + if (result && result.length === 2) { + this.openExternalWithString(this.session, result[1]); + this.hasFired = true; + this.internalDispose(); + } + } + } + + private openExternalWithString(session: vscode.DebugSession, portOrUriString: string) { + + if (portOrUriString) { + if (/^[0-9]+$/.test(portOrUriString)) { + const args: ServerReadyAction = session.configuration.serverReadyAction; + portOrUriString = util.format(args.uriFormat || URI_FORMAT, portOrUriString); + } + this.openExternalWithUri(session, portOrUriString); + } + } + + private openExternalWithUri(session: vscode.DebugSession, uri: string) { + + const args: ServerReadyAction = session.configuration.serverReadyAction; + switch (args.action || 'openExternally') { + case 'openExternally': + vscode.env.openExternal(vscode.Uri.parse(uri)); + break; + case 'debugWithChrome': + vscode.debug.startDebugging(session.workspaceFolder, { + type: 'chrome', + name: 'Chrome Debug', + request: 'launch', + url: uri, + webRoot: args.webRoot || WEB_ROOT + }); + break; + default: + // not supported + break; + } + } +} + export function activate(context: vscode.ExtensionContext) { + context.subscriptions.push(vscode.debug.onDidChangeActiveDebugSession(session => { + if (session && session.configuration.serverReadyAction) { + const detector = ServerReadyDetector.start(session); + if (detector) { + detector.trackTerminals(); + } + } + })); + + context.subscriptions.push(vscode.debug.onDidTerminateDebugSession(session => { + ServerReadyDetector.stop(session); + })); + + const trackers = new Set(); + context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('*', { resolveDebugConfiguration(_folder: vscode.WorkspaceFolder | undefined, debugConfiguration: vscode.DebugConfiguration) { - const args: ServerReadyAction = debugConfiguration.serverReadyAction; - if (debugConfiguration.type && args) { - startTrackerForType(context, debugConfiguration.type); + if (debugConfiguration.type && debugConfiguration.serverReadyAction) { + if (!trackers.has(debugConfiguration.type)) { + trackers.add(debugConfiguration.type); + startTrackerForType(context, debugConfiguration.type); + } } return debugConfiguration; } @@ -35,63 +144,20 @@ export function activate(context: vscode.ExtensionContext) { function startTrackerForType(context: vscode.ExtensionContext, type: string) { - if (!trackers.has(type)) { - trackers.add(type); - - // scan debug console output for a PORT message - context.subscriptions.push(vscode.debug.registerDebugAdapterTrackerFactory(type, { - createDebugAdapterTracker(session: vscode.DebugSession) { - const args: ServerReadyAction = session.configuration.serverReadyAction; - if (args) { - const regexp = new RegExp(args.pattern || PATTERN); - let hasFired = false; - return { - onDidSendMessage: m => { - if (!hasFired && m.type === 'event' && m.event === 'output' && m.body.output) { - const result = regexp.exec(m.body.output); - if (result && result.length === 2) { - openExternalWithString(session, result[1]); - hasFired = true; - } - } + // scan debug console output for a PORT message + context.subscriptions.push(vscode.debug.registerDebugAdapterTrackerFactory(type, { + createDebugAdapterTracker(session: vscode.DebugSession) { + const detector = ServerReadyDetector.start(session); + if (detector) { + return { + onDidSendMessage: m => { + if (m.type === 'event' && m.event === 'output' && m.body.output) { + detector.detectPattern(m.body.output); } - }; - } - return undefined; + } + }; } - })); - } -} - -function openExternalWithString(session: vscode.DebugSession, portOrUriString: string) { - - if (portOrUriString) { - if (/^[0-9]+$/.test(portOrUriString)) { - const args: ServerReadyAction = session.configuration.serverReadyAction; - portOrUriString = util.format(args.uriFormat || URI_FORMAT, portOrUriString); + return undefined; } - openExternalWithUri(session, portOrUriString); - } -} - -function openExternalWithUri(session: vscode.DebugSession, uri: string) { - - const args: ServerReadyAction = session.configuration.serverReadyAction; - switch (args.action || 'openExternally') { - case 'openExternally': - vscode.env.openExternal(vscode.Uri.parse(uri)); - break; - case 'debugWithChrome': - vscode.debug.startDebugging(session.workspaceFolder, { - type: 'chrome', - name: 'Chrome Debug', - request: 'launch', - url: uri, - webRoot: args.webRoot || WEB_ROOT - }); - break; - default: - // not supported - break; - } + })); } diff --git a/extensions/debug-server-ready/src/typings/ref.d.ts b/extensions/debug-server-ready/src/typings/ref.d.ts index bc057c55878..954bab971e3 100644 --- a/extensions/debug-server-ready/src/typings/ref.d.ts +++ b/extensions/debug-server-ready/src/typings/ref.d.ts @@ -4,4 +4,5 @@ *--------------------------------------------------------------------------------------------*/ /// +/// /// From c4b1ae364800aa95383b5a7c63b326d0870b369f Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Fri, 1 Mar 2019 15:55:09 -0800 Subject: [PATCH 19/90] 1.32 -> 1.33 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d392e69ab0c..606c1365c3b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "code-oss-dev", - "version": "1.32.0", + "version": "1.33.0", "distro": "d7aadf23b016949c24a43083a0b3deecb8aa81fa", "author": { "name": "Microsoft Corporation" From 29acd11312415a5d9967f3e33015ddfc6d2ceb08 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 26 Feb 2019 16:13:26 -0800 Subject: [PATCH 20/90] Fix bad newline --- .../typescript-language-features/src/utils/typeConverters.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/typescript-language-features/src/utils/typeConverters.ts b/extensions/typescript-language-features/src/utils/typeConverters.ts index 36a20544fee..131287ea58f 100644 --- a/extensions/typescript-language-features/src/utils/typeConverters.ts +++ b/extensions/typescript-language-features/src/utils/typeConverters.ts @@ -63,8 +63,8 @@ export namespace WorkspaceEdit { edits: Iterable ): vscode.WorkspaceEdit { return withFileCodeEdits(new vscode.WorkspaceEdit(), client, edits); - } + export function withFileCodeEdits( workspaceEdit: vscode.WorkspaceEdit, client: ITypeScriptServiceClient, From 1cb65ce8e5f8d11987289b37ed8a544e370ecfce Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 26 Feb 2019 16:15:10 -0800 Subject: [PATCH 21/90] Extract and lift constant --- .../typescript-language-features/src/utils/typeConverters.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/typescript-language-features/src/utils/typeConverters.ts b/extensions/typescript-language-features/src/utils/typeConverters.ts index 131287ea58f..279853cff21 100644 --- a/extensions/typescript-language-features/src/utils/typeConverters.ts +++ b/extensions/typescript-language-features/src/utils/typeConverters.ts @@ -71,8 +71,9 @@ export namespace WorkspaceEdit { edits: Iterable ): vscode.WorkspaceEdit { for (const edit of edits) { + const resource = client.toResource(edit.fileName); for (const textChange of edit.textChanges) { - workspaceEdit.replace(client.toResource(edit.fileName), + workspaceEdit.replace(resource, Range.fromTextSpan(textChange), textChange.newText); } From 491dd0feb8cbb2c43b2ebea3f8ebbac2c4a047f6 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 26 Feb 2019 16:53:02 -0800 Subject: [PATCH 22/90] Add logging to see if TS buffers are in an invalid state An example would be trying to change a file that is not opened --- .../src/features/bufferSyncSupport.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/extensions/typescript-language-features/src/features/bufferSyncSupport.ts b/extensions/typescript-language-features/src/features/bufferSyncSupport.ts index 32c0b020e6b..422fee00f03 100644 --- a/extensions/typescript-language-features/src/features/bufferSyncSupport.ts +++ b/extensions/typescript-language-features/src/features/bufferSyncSupport.ts @@ -13,11 +13,17 @@ import * as languageModeIds from '../utils/languageModeIds'; import { ResourceMap } from '../utils/resourceMap'; import * as typeConverters from '../utils/typeConverters'; -enum BufferKind { +const enum BufferKind { TypeScript = 1, JavaScript = 2, } +const enum BufferState { + Initial = 1, + Open = 2, + Closed = 2, +} + function mode2ScriptKind(mode: string): 'TS' | 'TSX' | 'JS' | 'JSX' | undefined { switch (mode) { case languageModeIds.typescript: return 'TS'; @@ -30,6 +36,8 @@ function mode2ScriptKind(mode: string): 'TS' | 'TSX' | 'JS' | 'JSX' | undefined class SyncedBuffer { + private state = BufferState.Initial; + constructor( private readonly document: vscode.TextDocument, public readonly filepath: string, @@ -63,6 +71,7 @@ class SyncedBuffer { } this.client.executeWithoutWaitingForResponse('open', args); + this.state = BufferState.Open; } public get resource(): vscode.Uri { @@ -91,9 +100,14 @@ class SyncedBuffer { file: this.filepath }; this.client.executeWithoutWaitingForResponse('close', args); + this.state = BufferState.Closed; } public onContentChanged(events: vscode.TextDocumentContentChangeEvent[]): void { + if (this.state !== BufferState.Open) { + console.error(`Unexpected buffer state: ${this.state}`); + } + for (const { range, text } of events) { const args: Proto.ChangeRequestArgs = { insertString: text, From 9061cad570f03d4fa0b698fb9f8bac1241f25d05 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 26 Feb 2019 17:14:14 -0800 Subject: [PATCH 23/90] Removing preview.html command Fixes #62630 --- .../src/singlefolder-tests/commands.test.ts | 17 -- src/vs/workbench/api/node/apiCommands.ts | 13 - src/vs/workbench/api/node/extHost.api.impl.ts | 19 +- .../workbench/api/node/extHostApiCommands.ts | 16 +- .../contrib/html/common/htmlInput.ts | 32 --- .../electron-browser/html.contribution.ts | 81 ------ .../html/electron-browser/htmlPreviewPart.ts | 256 ------------------ src/vs/workbench/workbench.main.ts | 3 - 8 files changed, 2 insertions(+), 435 deletions(-) delete mode 100644 src/vs/workbench/contrib/html/common/htmlInput.ts delete mode 100644 src/vs/workbench/contrib/html/electron-browser/html.contribution.ts delete mode 100644 src/vs/workbench/contrib/html/electron-browser/htmlPreviewPart.ts diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/commands.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/commands.test.ts index c007e2168f0..c26666ed671 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/commands.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/commands.test.ts @@ -74,23 +74,6 @@ suite('commands namespace tests', () => { }); - test('api-command: vscode.previewHtml', async function () { - - let registration = workspace.registerTextDocumentContentProvider('speciale', { - provideTextDocumentContent(uri) { - return `content of URI ${uri.toString()}`; - } - }); - - let virtualDocumentUri = Uri.parse('speciale://authority/path'); - let title = 'A title'; - - const success = await commands.executeCommand('vscode.previewHtml', virtualDocumentUri, ViewColumn.Three, title); - assert.ok(success); - registration.dispose(); - - }); - test('api-command: vscode.diff', function () { let registration = workspace.registerTextDocumentContentProvider('sc', { diff --git a/src/vs/workbench/api/node/apiCommands.ts b/src/vs/workbench/api/node/apiCommands.ts index 01d1c77337c..f2cc8adc5a6 100644 --- a/src/vs/workbench/api/node/apiCommands.ts +++ b/src/vs/workbench/api/node/apiCommands.ts @@ -36,19 +36,6 @@ function adjustHandler(handler: (executor: ICommandsExecutor, ...args: any[]) => }; } -export class PreviewHTMLAPICommand { - public static ID = 'vscode.previewHtml'; - public static execute(executor: ICommandsExecutor, uri: URI, position?: vscode.ViewColumn, label?: string, options?: any): Promise { - return executor.executeCommand('_workbench.previewHtml', - uri, - typeof position === 'number' && typeConverters.ViewColumn.from(position), - label, - options - ); - } -} -CommandsRegistry.registerCommand(PreviewHTMLAPICommand.ID, adjustHandler(PreviewHTMLAPICommand.execute)); - export class OpenFolderAPICommand { public static ID = 'vscode.openFolder'; public static execute(executor: ICommandsExecutor, uri?: URI, forceNewWindow?: boolean): Promise { diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index 565c8835155..d14dab1dd99 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -175,23 +175,6 @@ export function createApiFactory( }; })(); - // Warn when trying to use the vscode.previewHtml command as it does not work properly in all scenarios and - // has security concerns. - const checkCommand = (() => { - let done = false; - const informOnce = () => { - if (!done) { - done = true; - window.showWarningMessage(localize('previewHtml.deprecated', "Extension '{0}' uses the 'vscode.previewHtml' command which is deprecated and will be removed soon. Please file an issue against this extension to update to use VS Code's webview API.", extension.identifier.value)); - } - }; - return (commandId: string) => { - if (commandId === 'vscode.previewHtml') { - informOnce(); - } - return commandId; - }; - })(); // namespace: commands const commands: typeof vscode.commands = { @@ -232,7 +215,7 @@ export function createApiFactory( }); }), executeCommand(id: string, ...args: any[]): Thenable { - return extHostCommands.executeCommand(checkCommand(id), ...args); + return extHostCommands.executeCommand(id, ...args); }, getCommands(filterInternal: boolean = false): Thenable { return extHostCommands.getCommands(filterInternal); diff --git a/src/vs/workbench/api/node/extHostApiCommands.ts b/src/vs/workbench/api/node/extHostApiCommands.ts index 3e6559eb625..8a54f2e10d4 100644 --- a/src/vs/workbench/api/node/extHostApiCommands.ts +++ b/src/vs/workbench/api/node/extHostApiCommands.ts @@ -15,7 +15,7 @@ import * as search from 'vs/workbench/contrib/search/common/search'; import { ICommandHandlerDescription } from 'vs/platform/commands/common/commands'; import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands'; import { CustomCodeAction } from 'vs/workbench/api/node/extHostLanguageFeatures'; -import { ICommandsExecutor, PreviewHTMLAPICommand, OpenFolderAPICommand, DiffAPICommand, OpenAPICommand, RemoveFromRecentlyOpenedAPICommand, SetEditorLayoutAPICommand } from './apiCommands'; +import { ICommandsExecutor, OpenFolderAPICommand, DiffAPICommand, OpenAPICommand, RemoveFromRecentlyOpenedAPICommand, SetEditorLayoutAPICommand } from './apiCommands'; import { EditorGroupLayout } from 'vs/workbench/services/editor/common/editorGroupsService'; import { isFalsyOrEmpty } from 'vs/base/common/arrays'; @@ -219,20 +219,6 @@ export class ExtHostApiCommands { }; }; - this._register(PreviewHTMLAPICommand.ID, adjustHandler(PreviewHTMLAPICommand.execute), { - description: ` - Render the HTML of the resource in an editor view. - - See [working with the HTML preview](https://code.visualstudio.com/docs/extensionAPI/vscode-api-commands#working-with-the-html-preview) for more information about the HTML preview's integration with the editor and for best practices for extension authors. - `, - args: [ - { name: 'uri', description: 'Uri of the resource to preview.', constraint: (value: any) => value instanceof URI || typeof value === 'string' }, - { name: 'column', description: '(optional) Column in which to preview.', constraint: (value: any) => typeof value === 'undefined' || (typeof value === 'number' && typeof types.ViewColumn[value] === 'string') }, - { name: 'label', description: '(optional) An human readable string that is used as title for the preview.', constraint: (v: any) => typeof v === 'string' || typeof v === 'undefined' }, - { name: 'options', description: '(optional) Options for controlling webview environment.', constraint: (v: any) => typeof v === 'object' || typeof v === 'undefined' } - ] - }); - this._register(OpenFolderAPICommand.ID, adjustHandler(OpenFolderAPICommand.execute), { description: 'Open a folder or workspace in the current window or new window depending on the newWindow argument. Note that opening in the same window will shutdown the current extension host process and start a new one on the given folder/workspace unless the newWindow parameter is set to true.', args: [ diff --git a/src/vs/workbench/contrib/html/common/htmlInput.ts b/src/vs/workbench/contrib/html/common/htmlInput.ts deleted file mode 100644 index e70b08d999a..00000000000 --- a/src/vs/workbench/contrib/html/common/htmlInput.ts +++ /dev/null @@ -1,32 +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 { URI } from 'vs/base/common/uri'; -import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput'; -import { ITextModelService } from 'vs/editor/common/services/resolverService'; -import { IHashService } from 'vs/workbench/services/hash/common/hashService'; - -export interface HtmlInputOptions { - readonly allowScripts?: boolean; - readonly allowSvgs?: boolean; - readonly svgWhiteList?: string[]; -} - -export function areHtmlInputOptionsEqual(left: HtmlInputOptions, right: HtmlInputOptions) { - return left.allowScripts === right.allowScripts && left.allowSvgs === right.allowSvgs; -} - -export class HtmlInput extends ResourceEditorInput { - constructor( - name: string, - description: string, - resource: URI, - public readonly options: HtmlInputOptions, - @ITextModelService textModelResolverService: ITextModelService, - @IHashService hashService: IHashService - ) { - super(name, description, resource, textModelResolverService, hashService); - } -} diff --git a/src/vs/workbench/contrib/html/electron-browser/html.contribution.ts b/src/vs/workbench/contrib/html/electron-browser/html.contribution.ts deleted file mode 100644 index 693109a0624..00000000000 --- a/src/vs/workbench/contrib/html/electron-browser/html.contribution.ts +++ /dev/null @@ -1,81 +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 { URI } from 'vs/base/common/uri'; -import { localize } from 'vs/nls'; -import { CommandsRegistry } from 'vs/platform/commands/common/commands'; -import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; -import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { EditorViewColumn, viewColumnToEditorGroup } from 'vs/workbench/api/shared/editor'; -import { HtmlInput, HtmlInputOptions } from '../common/htmlInput'; -import { HtmlPreviewPart } from './htmlPreviewPart'; -import { Registry } from 'vs/platform/registry/common/platform'; -import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; -import { IEditorGroupsService, IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService'; -import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions'; -import { IEditorRegistry, EditorDescriptor, Extensions as EditorExtensions } from 'vs/workbench/browser/editor'; -import { registerWebViewCommands } from 'vs/workbench/contrib/webview/electron-browser/webview.contribution'; - -// --- Register Editor - -(Registry.as(EditorExtensions.Editors)).registerEditor(new EditorDescriptor( - HtmlPreviewPart, - HtmlPreviewPart.ID, - localize('html.editor.label', "Html Preview")), - [new SyncDescriptor(HtmlInput)]); - -// --- Register Commands - -CommandsRegistry.registerCommand('_workbench.previewHtml', function ( - accessor: ServicesAccessor, - resource: URI | string, - position?: EditorViewColumn, - label?: string -) { - const uri = resource instanceof URI ? resource : URI.parse(resource); - label = label || uri.fsPath; - - let input: HtmlInput | undefined; - - const editorGroupService = accessor.get(IEditorGroupsService); - - let targetGroup: IEditorGroup = editorGroupService.getGroup(viewColumnToEditorGroup(editorGroupService, position)); - if (!targetGroup) { - targetGroup = editorGroupService.activeGroup; - } - - // Find already opened HTML input if any - if (targetGroup) { - const editors = targetGroup.editors; - for (const editor of editors) { - const editorResource = editor.getResource(); - if (editor instanceof HtmlInput && editorResource && editorResource.toString() === resource.toString()) { - input = editor; - break; - } - } - } - - const extensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService); - - const inputOptions: HtmlInputOptions = { - allowScripts: true, - allowSvgs: true, - svgWhiteList: extensionsWorkbenchService.allowedBadgeProviders - }; - - // Otherwise, create new input and open it - if (!input) { - input = accessor.get(IInstantiationService).createInstance(HtmlInput, label, '', uri, inputOptions); - } else { - input.setName(label); // make sure to use passed in label - } - - return accessor.get(IEditorService) - .openEditor(input, { pinned: true }, viewColumnToEditorGroup(editorGroupService, position)) - .then(editor => true); -}); - -registerWebViewCommands(HtmlPreviewPart.ID); \ No newline at end of file diff --git a/src/vs/workbench/contrib/html/electron-browser/htmlPreviewPart.ts b/src/vs/workbench/contrib/html/electron-browser/htmlPreviewPart.ts deleted file mode 100644 index 8f86431edbb..00000000000 --- a/src/vs/workbench/contrib/html/electron-browser/htmlPreviewPart.ts +++ /dev/null @@ -1,256 +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 { localize } from 'vs/nls'; -import { Disposable, IDisposable, dispose, IReference } from 'vs/base/common/lifecycle'; -import { EditorOptions, EditorInput, IEditorMemento } from 'vs/workbench/common/editor'; -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { BaseTextEditorModel } from 'vs/workbench/common/editor/textEditorModel'; -import { HtmlInput, HtmlInputOptions, areHtmlInputOptionsEqual } from 'vs/workbench/contrib/html/common/htmlInput'; -import { IThemeService } from 'vs/platform/theme/common/themeService'; -import { IOpenerService } from 'vs/platform/opener/common/opener'; -import { ITextModelService, ITextEditorModel } from 'vs/editor/common/services/resolverService'; -import { Parts, IPartService } from 'vs/workbench/services/part/common/partService'; -import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { IStorageService } from 'vs/platform/storage/common/storage'; -import { Dimension } from 'vs/base/browser/dom'; -import { BaseWebviewEditor } from 'vs/workbench/contrib/webview/electron-browser/baseWebviewEditor'; -import { WebviewElement, WebviewContentOptions } from 'vs/workbench/contrib/webview/electron-browser/webviewElement'; -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { IEditorGroupsService, IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService'; -import { CancellationToken } from 'vs/base/common/cancellation'; -import { Event, Emitter } from 'vs/base/common/event'; - -export interface HtmlPreviewEditorViewState { - scrollYPercentage: number; -} - -/** - * An implementation of editor for showing HTML content in an IFrame by leveraging the HTML input. - */ -export class HtmlPreviewPart extends BaseWebviewEditor { - - static readonly ID: string = 'workbench.editor.htmlPreviewPart'; - static class: string = 'htmlPreviewPart'; - - private _webviewDisposables: IDisposable[]; - - private _modelRef?: IReference; - public get model() { return this._modelRef ? this._modelRef.object.textEditorModel : undefined; } - private _modelChangeSubscription = Disposable.None; - private _themeChangeSubscription = Disposable.None; - - private _content: HTMLElement; - private _scrollYPercentage: number = 0; - - private editorMemento: IEditorMemento; - - private readonly _onDidFocusWebview = this._register(new Emitter()); - public get onDidFocus(): Event { return this._onDidFocusWebview.event; } - - constructor( - @ITelemetryService telemetryService: ITelemetryService, - @IThemeService themeService: IThemeService, - @IContextKeyService contextKeyService: IContextKeyService, - @IOpenerService private readonly _openerService: IOpenerService, - @IPartService private readonly _partService: IPartService, - @IStorageService readonly _storageService: IStorageService, - @ITextModelService private readonly _textModelResolverService: ITextModelService, - @IInstantiationService private readonly _instantiationService: IInstantiationService, - @IEditorGroupsService readonly editorGroupService: IEditorGroupsService - ) { - super(HtmlPreviewPart.ID, telemetryService, themeService, contextKeyService, _storageService); - - this.editorMemento = this.getEditorMemento(editorGroupService, this.viewStateStorageKey); - } - - dispose(): void { - // remove from dom - this._webviewDisposables = dispose(this._webviewDisposables); - - // unhook listeners - this._themeChangeSubscription.dispose(); - this._modelChangeSubscription.dispose(); - - // dispose model ref - dispose(this._modelRef); - super.dispose(); - } - - protected createEditor(parent: HTMLElement): void { - this._content = document.createElement('div'); - this._content.style.position = 'absolute'; - this._content.classList.add(HtmlPreviewPart.class); - parent.appendChild(this._content); - } - - private get webview(): WebviewElement { - if (!this._webview) { - let webviewOptions: WebviewContentOptions = {}; - if (this.input && this.input instanceof HtmlInput) { - webviewOptions = this.input.options; - } - - this._webview = this._instantiationService.createInstance(WebviewElement, - this._partService.getContainer(Parts.EDITOR_PART), - { - useSameOriginForRoot: true - }, - webviewOptions); - this._webview.mountTo(this._content); - - if (this.input && this.input instanceof HtmlInput) { - const state = this.loadHTMLPreviewViewState(this.input); - this._scrollYPercentage = state ? state.scrollYPercentage : 0; - this.webview.initialScrollProgress = this._scrollYPercentage; - - const resourceUri = this.input.getResource(); - this.webview.baseUrl = resourceUri.toString(true); - } - this._webviewDisposables = [ - this._webview, - this._webview.onDidClickLink(uri => this._openerService.open(uri)), - this._webview.onDidScroll(data => { - this._scrollYPercentage = data.scrollYPercentage; - }), - ]; - - this._register(this._webview.onDidFocus(() => this._onDidFocusWebview.fire())); - } - return this._webview; - } - - protected setEditorVisible(visible: boolean, group: IEditorGroup): void { - this._doSetVisible(visible); - super.setEditorVisible(visible, group); - } - - private _doSetVisible(visible: boolean): void { - if (!visible) { - this._themeChangeSubscription.dispose(); - this._modelChangeSubscription.dispose(); - this._webviewDisposables = dispose(this._webviewDisposables); - this._webview = undefined; - } else { - this._themeChangeSubscription = this.themeService.onThemeChange(this.onThemeChange.bind(this)); - - if (this._hasValidModel()) { - this._modelChangeSubscription = this.model!.onDidChangeContent(() => this.webview.contents = this.model!.getLinesContent().join('\n')); - this.webview.contents = this.model!.getLinesContent().join('\n'); - } - } - } - - private _hasValidModel(): boolean { - return !!(this._modelRef && this.model && !this.model.isDisposed()); - } - - public layout(dimension: Dimension): void { - const { width, height } = dimension; - this._content.style.width = `${width}px`; - this._content.style.height = `${height}px`; - - super.layout(dimension); - } - - public clearInput(): void { - if (this.input instanceof HtmlInput) { - this.saveHTMLPreviewViewState(this.input, { - scrollYPercentage: this._scrollYPercentage - }); - } - dispose(this._modelRef); - this._modelRef = undefined; - super.clearInput(); - } - - protected saveState(): void { - if (this.input instanceof HtmlInput) { - this.saveHTMLPreviewViewState(this.input, { - scrollYPercentage: this._scrollYPercentage - }); - } - - super.saveState(); - } - - public sendMessage(data: any): void { - this.webview.sendMessage(data); - } - - public setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Promise { - - if (this.input && this.input.matches(input) && this._hasValidModel() && this.input instanceof HtmlInput && input instanceof HtmlInput && areHtmlInputOptionsEqual(this.input.options, input.options)) { - return Promise.resolve(undefined); - } - - let oldOptions: HtmlInputOptions | undefined = undefined; - - if (this.input instanceof HtmlInput) { - oldOptions = this.input.options; - this.saveHTMLPreviewViewState(this.input, { - scrollYPercentage: this._scrollYPercentage - }); - } - - if (this._modelRef) { - this._modelRef.dispose(); - } - this._modelChangeSubscription.dispose(); - - if (!(input instanceof HtmlInput)) { - return Promise.reject(new Error('Invalid input')); - } - - return super.setInput(input, options, token).then(() => { - const resourceUri = input.getResource(); - return this._textModelResolverService.createModelReference(resourceUri).then(ref => { - if (token.isCancellationRequested) { - return undefined; - } - - const model = ref.object; - if (model instanceof BaseTextEditorModel) { - this._modelRef = ref; - } - - if (!this.model) { - return Promise.reject(new Error(localize('html.voidInput', "Invalid editor input."))); - } - - if (oldOptions && !areHtmlInputOptionsEqual(oldOptions, input.options)) { - this._doSetVisible(false); - } - - this._modelChangeSubscription = this.model.onDidChangeContent(() => { - if (this.model) { - this._scrollYPercentage = 0; - this.webview.contents = this.model.getLinesContent().join('\n'); - } - }); - const state = this.loadHTMLPreviewViewState(input); - this._scrollYPercentage = state ? state.scrollYPercentage : 0; - this.webview.baseUrl = resourceUri.toString(true); - this.webview.options = input.options; - this.webview.contents = this.model.getLinesContent().join('\n'); - this.webview.initialScrollProgress = this._scrollYPercentage; - return undefined; - }); - }); - } - - - private get viewStateStorageKey(): string { - return this.getId() + '.editorViewState'; - } - - private saveHTMLPreviewViewState(input: HtmlInput, editorViewState: HtmlPreviewEditorViewState): void { - this.editorMemento.saveEditorState(this.group!, input, editorViewState); - } - - private loadHTMLPreviewViewState(input: HtmlInput): HtmlPreviewEditorViewState | undefined { - return this.editorMemento.loadEditorState(this.group!, input); - } -} diff --git a/src/vs/workbench/workbench.main.ts b/src/vs/workbench/workbench.main.ts index 368fffe6423..cf08e9d08ee 100644 --- a/src/vs/workbench/workbench.main.ts +++ b/src/vs/workbench/workbench.main.ts @@ -98,9 +98,6 @@ import 'vs/workbench/contrib/markers/browser/markers.contribution'; // Comments import 'vs/workbench/contrib/comments/electron-browser/comments.contribution'; -// HTML Preview -import 'vs/workbench/contrib/html/electron-browser/html.contribution'; - // URL Support import 'vs/workbench/contrib/url/common/url.contribution'; From 09905893e616072578f8cb542d9fd50cca0986e0 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 26 Feb 2019 17:22:09 -0800 Subject: [PATCH 24/90] Removing the baseWebviewEditor class This base class is no longer needed now that the html preview has been removed --- .../electron-browser/baseWebviewEditor.ts | 98 --------------- .../electron-browser/webview.contribution.ts | 3 +- .../electron-browser/webviewCommands.ts | 10 +- .../webview/electron-browser/webviewEditor.ts | 119 +++++++++++++----- 4 files changed, 96 insertions(+), 134 deletions(-) delete mode 100644 src/vs/workbench/contrib/webview/electron-browser/baseWebviewEditor.ts diff --git a/src/vs/workbench/contrib/webview/electron-browser/baseWebviewEditor.ts b/src/vs/workbench/contrib/webview/electron-browser/baseWebviewEditor.ts deleted file mode 100644 index 0851ec06807..00000000000 --- a/src/vs/workbench/contrib/webview/electron-browser/baseWebviewEditor.ts +++ /dev/null @@ -1,98 +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 { Dimension } from 'vs/base/browser/dom'; -import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { IThemeService } from 'vs/platform/theme/common/themeService'; -import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; -import { WebviewElement } from './webviewElement'; -import { IStorageService } from 'vs/platform/storage/common/storage'; - -/** A context key that is set when the find widget in a webview is visible. */ -export const KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE = new RawContextKey('webviewFindWidgetVisible', false); - - -/** - * This class is only intended to be subclassed and not instantiated. - */ -export abstract class BaseWebviewEditor extends BaseEditor { - - protected _webview: WebviewElement | undefined; - protected findWidgetVisible: IContextKey; - - constructor( - id: string, - telemetryService: ITelemetryService, - themeService: IThemeService, - contextKeyService: IContextKeyService, - storageService: IStorageService - ) { - super(id, telemetryService, themeService, storageService); - if (contextKeyService) { - this.findWidgetVisible = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE.bindTo(contextKeyService); - } - } - - public showFind() { - if (this._webview) { - this._webview.showFind(); - this.findWidgetVisible.set(true); - } - } - - public hideFind() { - this.findWidgetVisible.reset(); - if (this._webview) { - this._webview.hideFind(); - } - } - - public get isWebviewEditor() { - return true; - } - - public reload() { - this.withWebviewElement(webview => webview.reload()); - } - - public layout(dimension: Dimension): void { - this.withWebviewElement(webview => webview.layout()); - } - - public focus(): void { - this.withWebviewElement(webview => webview.focus()); - } - - public selectAll(): void { - this.withWebviewElement(webview => webview.selectAll()); - } - - public copy(): void { - this.withWebviewElement(webview => webview.copy()); - } - - public paste(): void { - this.withWebviewElement(webview => webview.paste()); - } - - public cut(): void { - this.withWebviewElement(webview => webview.cut()); - } - - public undo(): void { - this.withWebviewElement(webview => webview.undo()); - } - - public redo(): void { - this.withWebviewElement(webview => webview.redo()); - } - - private withWebviewElement(f: (element: WebviewElement) => void): void { - if (this._webview) { - f(this._webview); - } - } -} diff --git a/src/vs/workbench/contrib/webview/electron-browser/webview.contribution.ts b/src/vs/workbench/contrib/webview/electron-browser/webview.contribution.ts index 8e2b9e03bc0..484ff86a0c3 100644 --- a/src/vs/workbench/contrib/webview/electron-browser/webview.contribution.ts +++ b/src/vs/workbench/contrib/webview/electron-browser/webview.contribution.ts @@ -15,9 +15,8 @@ import { EditorDescriptor, Extensions as EditorExtensions, IEditorRegistry } fro import { Extensions as ActionExtensions, IWorkbenchActionRegistry } from 'vs/workbench/common/actions'; import { Extensions as EditorInputExtensions, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor'; import { WebviewEditorInputFactory } from 'vs/workbench/contrib/webview/electron-browser/webviewEditorInputFactory'; -import { KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE } from './baseWebviewEditor'; import { HideWebViewEditorFindCommand, OpenWebviewDeveloperToolsAction, ReloadWebviewAction, ShowWebViewEditorFindWidgetCommand, SelectAllWebviewEditorCommand, CopyWebviewEditorCommand, PasteWebviewEditorCommand, CutWebviewEditorCommand, UndoWebviewEditorCommand, RedoWebviewEditorCommand } from './webviewCommands'; -import { WebviewEditor } from './webviewEditor'; +import { WebviewEditor, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE } from './webviewEditor'; import { WebviewEditorInput } from './webviewEditorInput'; import { IWebviewEditorService, WebviewEditorService } from './webviewEditorService'; import { InputFocusedContextKey } from 'vs/platform/contextkey/common/contextkeys'; diff --git a/src/vs/workbench/contrib/webview/electron-browser/webviewCommands.ts b/src/vs/workbench/contrib/webview/electron-browser/webviewCommands.ts index b91a3fa1224..ff62950a517 100644 --- a/src/vs/workbench/contrib/webview/electron-browser/webviewCommands.ts +++ b/src/vs/workbench/contrib/webview/electron-browser/webviewCommands.ts @@ -8,7 +8,7 @@ import { Command } from 'vs/editor/browser/editorExtensions'; import * as nls from 'vs/nls'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { BaseWebviewEditor } from './baseWebviewEditor'; +import { WebviewEditor } from 'vs/workbench/contrib/webview/electron-browser/webviewEditor'; export class ShowWebViewEditorFindWidgetCommand extends Command { public static readonly ID = 'editor.action.webvieweditor.showFind'; @@ -143,13 +143,13 @@ export class ReloadWebviewAction extends Action { private getVisibleWebviews() { return this.editorService.visibleControls - .filter(control => control && (control as BaseWebviewEditor).isWebviewEditor) - .map(control => control as BaseWebviewEditor); + .filter(control => control && (control as WebviewEditor).isWebviewEditor) + .map(control => control as WebviewEditor); } } -function getActiveWebviewEditor(accessor: ServicesAccessor): BaseWebviewEditor | null { +function getActiveWebviewEditor(accessor: ServicesAccessor): WebviewEditor | null { const editorService = accessor.get(IEditorService); - const activeControl = editorService.activeControl as BaseWebviewEditor; + const activeControl = editorService.activeControl as WebviewEditor; return activeControl.isWebviewEditor ? activeControl : null; } \ No newline at end of file diff --git a/src/vs/workbench/contrib/webview/electron-browser/webviewEditor.ts b/src/vs/workbench/contrib/webview/electron-browser/webviewEditor.ts index b004ebbd6ea..344124376ef 100644 --- a/src/vs/workbench/contrib/webview/electron-browser/webviewEditor.ts +++ b/src/vs/workbench/contrib/webview/electron-browser/webviewEditor.ts @@ -6,24 +6,31 @@ import * as DOM from 'vs/base/browser/dom'; import { CancellationToken } from 'vs/base/common/cancellation'; import { Emitter, Event } from 'vs/base/common/event'; -import { IDisposable, dispose } from 'vs/base/common/lifecycle'; +import { dispose, IDisposable } from 'vs/base/common/lifecycle'; import { URI } from 'vs/base/common/uri'; -import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { IStorageService } from 'vs/platform/storage/common/storage'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IThemeService } from 'vs/platform/theme/common/themeService'; +import { IWindowService } from 'vs/platform/windows/common/windows'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; +import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; import { EditorOptions } from 'vs/workbench/common/editor'; import { WebviewEditorInput } from 'vs/workbench/contrib/webview/electron-browser/webviewEditorInput'; -import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService'; +import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IPartService, Parts } from 'vs/workbench/services/part/common/partService'; -import { BaseWebviewEditor, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE } from './baseWebviewEditor'; import { WebviewElement } from './webviewElement'; -import { IWindowService } from 'vs/platform/windows/common/windows'; -import { IStorageService } from 'vs/platform/storage/common/storage'; -export class WebviewEditor extends BaseWebviewEditor { +/** A context key that is set when the find widget in a webview is visible. */ +export const KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE = new RawContextKey('webviewFindWidgetVisible', false); + + +export class WebviewEditor extends BaseEditor { + + protected _webview: WebviewElement | undefined; + protected findWidgetVisible: IContextKey; public static readonly ID = 'WebviewEditor'; @@ -50,7 +57,10 @@ export class WebviewEditor extends BaseWebviewEditor { @IWindowService private readonly _windowService: IWindowService, @IStorageService storageService: IStorageService ) { - super(WebviewEditor.ID, telemetryService, themeService, _contextKeyService, storageService); + super(WebviewEditor.ID, telemetryService, themeService, storageService); + if (_contextKeyService) { + this.findWidgetVisible = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE.bindTo(_contextKeyService); + } } protected createEditor(parent: HTMLElement): void { @@ -73,27 +83,6 @@ export class WebviewEditor extends BaseWebviewEditor { } } - public layout(dimension: DOM.Dimension): void { - if (this._webview) { - this.doUpdateContainer(); - } - super.layout(dimension); - } - - public focus() { - super.focus(); - if (this._onFocusWindowHandler) { - return; - } - - // Make sure we restore focus when switching back to a VS Code window - this._onFocusWindowHandler = this._windowService.onDidChangeFocus(focused => { - if (focused && this._editorService.activeControl === this) { - this.focus(); - } - }); - } - public dispose(): void { this.pendingMessages = []; @@ -122,6 +111,78 @@ export class WebviewEditor extends BaseWebviewEditor { this.pendingMessages.push(data); } } + public showFind() { + if (this._webview) { + this._webview.showFind(); + this.findWidgetVisible.set(true); + } + } + + public hideFind() { + this.findWidgetVisible.reset(); + if (this._webview) { + this._webview.hideFind(); + } + } + + public get isWebviewEditor() { + return true; + } + + public reload() { + this.withWebviewElement(webview => webview.reload()); + } + + public layout(_dimension: DOM.Dimension): void { + this.withWebviewElement(webview => { + this.doUpdateContainer(); + webview.layout(); + }); + } + + public focus(): void { + super.focus(); + if (!this._onFocusWindowHandler) { + + // Make sure we restore focus when switching back to a VS Code window + this._onFocusWindowHandler = this._windowService.onDidChangeFocus(focused => { + if (focused && this._editorService.activeControl === this) { + this.focus(); + } + }); + } + this.withWebviewElement(webview => webview.focus()); + } + + public selectAll(): void { + this.withWebviewElement(webview => webview.selectAll()); + } + + public copy(): void { + this.withWebviewElement(webview => webview.copy()); + } + + public paste(): void { + this.withWebviewElement(webview => webview.paste()); + } + + public cut(): void { + this.withWebviewElement(webview => webview.cut()); + } + + public undo(): void { + this.withWebviewElement(webview => webview.undo()); + } + + public redo(): void { + this.withWebviewElement(webview => webview.redo()); + } + + private withWebviewElement(f: (element: WebviewElement) => void): void { + if (this._webview) { + f(this._webview); + } + } protected setEditorVisible(visible: boolean, group: IEditorGroup): void { if (this.input && this.input instanceof WebviewEditorInput) { From c7bf51034b8791bd5ad47f10906aace5c08e8976 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 27 Feb 2019 11:47:56 -0800 Subject: [PATCH 25/90] Take uri as argument instead of string version of uri --- .../node/extHostDocumentContentProviders.ts | 4 ++-- src/vs/workbench/api/node/extHostDocuments.ts | 18 +++++++----------- .../api/node/extHostDocumentsAndEditors.ts | 4 ++-- .../api/node/extHostTypeConverters.ts | 2 +- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/vs/workbench/api/node/extHostDocumentContentProviders.ts b/src/vs/workbench/api/node/extHostDocumentContentProviders.ts index 89c7332e1b1..3ffd9a81fda 100644 --- a/src/vs/workbench/api/node/extHostDocumentContentProviders.ts +++ b/src/vs/workbench/api/node/extHostDocumentContentProviders.ts @@ -52,13 +52,13 @@ export class ExtHostDocumentContentProvider implements ExtHostDocumentContentPro this._logService.warn(`Provider for scheme '${scheme}' is firing event for schema '${uri.scheme}' which will be IGNORED`); return; } - if (this._documentsAndEditors.getDocument(uri.toString())) { + if (this._documentsAndEditors.getDocument(uri)) { this.$provideTextDocumentContent(handle, uri).then(value => { if (!value) { return; } - const document = this._documentsAndEditors.getDocument(uri.toString()); + const document = this._documentsAndEditors.getDocument(uri); if (!document) { // disposed in the meantime return; diff --git a/src/vs/workbench/api/node/extHostDocuments.ts b/src/vs/workbench/api/node/extHostDocuments.ts index dfc39581f84..a053696d1cf 100644 --- a/src/vs/workbench/api/node/extHostDocuments.ts +++ b/src/vs/workbench/api/node/extHostDocuments.ts @@ -60,7 +60,7 @@ export class ExtHostDocuments implements ExtHostDocumentsShape { if (!resource) { return undefined; } - const data = this._documentsAndEditors.getDocument(resource.toString()); + const data = this._documentsAndEditors.getDocument(resource); if (data) { return data; } @@ -77,7 +77,7 @@ export class ExtHostDocuments implements ExtHostDocumentsShape { public ensureDocumentData(uri: URI): Promise { - let cached = this._documentsAndEditors.getDocument(uri.toString()); + let cached = this._documentsAndEditors.getDocument(uri); if (cached) { return Promise.resolve(cached); } @@ -86,7 +86,7 @@ export class ExtHostDocuments implements ExtHostDocumentsShape { if (!promise) { promise = this._proxy.$tryOpenDocument(uri).then(() => { this._documentLoader.delete(uri.toString()); - return this._documentsAndEditors.getDocument(uri.toString()); + return this._documentsAndEditors.getDocument(uri); }, err => { this._documentLoader.delete(uri.toString()); return Promise.reject(err); @@ -103,8 +103,7 @@ export class ExtHostDocuments implements ExtHostDocumentsShape { public $acceptModelModeChanged(uriComponents: UriComponents, oldModeId: string, newModeId: string): void { const uri = URI.revive(uriComponents); - const strURL = uri.toString(); - let data = this._documentsAndEditors.getDocument(strURL); + let data = this._documentsAndEditors.getDocument(uri); // Treat a mode change as a remove + add @@ -115,16 +114,14 @@ export class ExtHostDocuments implements ExtHostDocumentsShape { public $acceptModelSaved(uriComponents: UriComponents): void { const uri = URI.revive(uriComponents); - const strURL = uri.toString(); - let data = this._documentsAndEditors.getDocument(strURL); + let data = this._documentsAndEditors.getDocument(uri); this.$acceptDirtyStateChanged(uriComponents, false); this._onDidSaveDocument.fire(data.document); } public $acceptDirtyStateChanged(uriComponents: UriComponents, isDirty: boolean): void { const uri = URI.revive(uriComponents); - const strURL = uri.toString(); - let data = this._documentsAndEditors.getDocument(strURL); + let data = this._documentsAndEditors.getDocument(uri); data._acceptIsDirty(isDirty); this._onDidChangeDocument.fire({ document: data.document, @@ -134,8 +131,7 @@ export class ExtHostDocuments implements ExtHostDocumentsShape { public $acceptModelChanged(uriComponents: UriComponents, events: IModelChangedEvent, isDirty: boolean): void { const uri = URI.revive(uriComponents); - const strURL = uri.toString(); - let data = this._documentsAndEditors.getDocument(strURL); + let data = this._documentsAndEditors.getDocument(uri); data._acceptIsDirty(isDirty); data.onEvents(events); this._onDidChangeDocument.fire({ diff --git a/src/vs/workbench/api/node/extHostDocumentsAndEditors.ts b/src/vs/workbench/api/node/extHostDocumentsAndEditors.ts index 4048e3a936b..0455b24ecbf 100644 --- a/src/vs/workbench/api/node/extHostDocumentsAndEditors.ts +++ b/src/vs/workbench/api/node/extHostDocumentsAndEditors.ts @@ -131,8 +131,8 @@ export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsSha } } - getDocument(strUrl: string): ExtHostDocumentData { - return this._documents.get(strUrl); + getDocument(uri: URI): ExtHostDocumentData { + return this._documents.get(uri.toString()); } allDocuments(): ExtHostDocumentData[] { diff --git a/src/vs/workbench/api/node/extHostTypeConverters.ts b/src/vs/workbench/api/node/extHostTypeConverters.ts index a445750d59d..54006bf3829 100644 --- a/src/vs/workbench/api/node/extHostTypeConverters.ts +++ b/src/vs/workbench/api/node/extHostTypeConverters.ts @@ -457,7 +457,7 @@ export namespace WorkspaceEdit { const [uri, uriOrEdits] = entry; if (Array.isArray(uriOrEdits)) { // text edits - const doc = documents && uri ? documents.getDocument(uri.toString()) : undefined; + const doc = documents && uri ? documents.getDocument(uri) : undefined; result.edits.push({ resource: uri, modelVersionId: doc && doc.version, edits: uriOrEdits.map(TextEdit.from) }); } else { // resource edits From 4516dd8ce62e2f3f45546d9287ebc5c5518fbbfd Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 27 Feb 2019 16:50:51 -0800 Subject: [PATCH 26/90] Make sure we properly set _visible This value was previously always false --- src/vs/editor/contrib/codeAction/codeActionWidget.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vs/editor/contrib/codeAction/codeActionWidget.ts b/src/vs/editor/contrib/codeAction/codeActionWidget.ts index c1968825103..9e543cb08ac 100644 --- a/src/vs/editor/contrib/codeAction/codeActionWidget.ts +++ b/src/vs/editor/contrib/codeAction/codeActionWidget.ts @@ -32,6 +32,7 @@ export class CodeActionContextMenu { // cancel when editor went off-dom return Promise.reject(canceled()); } + this._visible = true; const actions = codeActions.map(action => this.codeActionToAction(action)); this._contextMenuService.showContextMenu({ getAnchor: () => { From f62d1f25f3ef410dd2ba0ecc1f83d4c4c3b8c88a Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 27 Feb 2019 18:28:24 -0800 Subject: [PATCH 27/90] Only show the markdown refresh preview command when preview is active or you are in a markdown file --- extensions/markdown-language-features/package.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/extensions/markdown-language-features/package.json b/extensions/markdown-language-features/package.json index 9dd958c29c9..10431185034 100644 --- a/extensions/markdown-language-features/package.json +++ b/extensions/markdown-language-features/package.json @@ -153,6 +153,14 @@ { "command": "markdown.preview.toggleLock", "when": "markdownPreviewFocus" + }, + { + "command": "markdown.preview.refresh", + "when": "editorLangId == markdown" + }, + { + "command": "markdown.preview.refresh", + "when": "markdownPreviewFocus" } ] }, @@ -315,4 +323,4 @@ "webpack": "^4.1.0", "webpack-cli": "^2.0.10" } -} +} \ No newline at end of file From e30008eb4a12761abb7b164ac285b16e8b802273 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 28 Feb 2019 15:54:37 -0800 Subject: [PATCH 28/90] Leave determining which webviews a reviver supports entirely up to that reviver Don't key off of `viewType` first, let the reviver decide --- .../api/electron-browser/mainThreadWebview.ts | 4 +-- .../electron-browser/webviewEditorService.ts | 36 +++++++------------ 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts index 2e056e31d90..2f4502f7a3c 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts @@ -62,7 +62,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv _editorService.onDidActiveEditorChange(this.onActiveEditorChanged, this, this._toDispose); _editorService.onDidVisibleEditorsChange(this.onVisibleEditorsChanged, this, this._toDispose); - this._toDispose.push(_webviewService.registerReviver(MainThreadWebviews.viewType, this)); + this._toDispose.push(_webviewService.registerReviver(this)); lifecycleService.onBeforeShutdown(e => { e.veto(this._onBeforeShutdown()); @@ -242,7 +242,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv } public canRevive(webview: WebviewEditorInput): boolean { - if (webview.isDisposed() || !webview.state) { + if (webview.isDisposed() || !webview.state || webview.viewType !== MainThreadWebviews.viewType) { return false; } diff --git a/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts b/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts index c1d9d940bed..8c71b32bf72 100644 --- a/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts +++ b/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts @@ -49,7 +49,6 @@ export interface IWebviewEditorService { ): void; registerReviver( - viewType: string, reviver: WebviewReviver ): IDisposable; @@ -90,7 +89,7 @@ export function areWebviewInputOptionsEqual(a: WebviewInputOptions, b: WebviewIn export class WebviewEditorService implements IWebviewEditorService { _serviceBrand: any; - private readonly _revivers = new Map(); + private readonly _revivers = new Set(); private _awaitingRevival: { input: WebviewEditorInput, resolve: (x: any) => void }[] = []; constructor( @@ -135,7 +134,7 @@ export class WebviewEditorService implements IWebviewEditorService { ): WebviewEditorInput { const webviewInput = this._instantiationService.createInstance(WebviewEditorInput, viewType, id, title, options, state, {}, extensionLocation, { canRevive: (_webview) => { - return true; + return _webview === webviewInput; }, reviveWebview: (webview: WebviewEditorInput): Promise => { return this.tryRevive(webview).then(didRevive => { @@ -156,47 +155,38 @@ export class WebviewEditorService implements IWebviewEditorService { } registerReviver( - viewType: string, reviver: WebviewReviver ): IDisposable { - const currentRevivers = this._revivers.get(viewType); - if (currentRevivers) { - currentRevivers.push(reviver); - } else { - this._revivers.set(viewType, [reviver]); - } - + this._revivers.add(reviver); // Resolve any pending views - const toRevive = this._awaitingRevival.filter(x => x.input.viewType === viewType); - this._awaitingRevival = this._awaitingRevival.filter(x => x.input.viewType !== viewType); + const toRevive = this._awaitingRevival.filter(x => reviver.canRevive(x.input)); + this._awaitingRevival = this._awaitingRevival.filter(x => !reviver.canRevive(x.input)); for (const input of toRevive) { reviver.reviveWebview(input.input).then(() => input.resolve(undefined)); } return toDisposable(() => { - this._revivers.delete(viewType); + this._revivers.delete(reviver); }); } canRevive( webview: WebviewEditorInput ): boolean { - const viewType = webview.viewType; - const revivers = this._revivers.get(viewType); - return !!revivers && revivers.some(reviver => reviver.canRevive(webview)); + for (const reviver of this._revivers) { + if (reviver.canRevive(webview)) { + return true; + } + } + return false; } private async tryRevive( webview: WebviewEditorInput ): Promise { - const revivers = this._revivers.get(webview.viewType); - if (!revivers) { - return false; - } - - for (const reviver of revivers) { + for (const reviver of this._revivers) { if (reviver.canRevive(webview)) { await reviver.reviveWebview(webview); return true; From 98c084ff4a74a4162319f505c259f578114c2000 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 28 Feb 2019 16:01:27 -0800 Subject: [PATCH 29/90] Don't re-use reviver interface where it not needed --- .../electron-browser/webviewEditorInput.ts | 6 ++--- .../electron-browser/webviewEditorService.ts | 27 ++++++++----------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/vs/workbench/contrib/webview/electron-browser/webviewEditorInput.ts b/src/vs/workbench/contrib/webview/electron-browser/webviewEditorInput.ts index 5e9c6243e94..caa44a7d943 100644 --- a/src/vs/workbench/contrib/webview/electron-browser/webviewEditorInput.ts +++ b/src/vs/workbench/contrib/webview/electron-browser/webviewEditorInput.ts @@ -10,7 +10,7 @@ import { IEditorModel } from 'vs/platform/editor/common/editor'; import { EditorInput, EditorModel, GroupIdentifier, IEditorInput } from 'vs/workbench/common/editor'; import { IPartService, Parts } from 'vs/workbench/services/part/common/partService'; import * as vscode from 'vscode'; -import { WebviewEvents, WebviewInputOptions, WebviewReviver } from './webviewEditorService'; +import { WebviewEvents, WebviewInputOptions } from './webviewEditorService'; import { WebviewElement } from './webviewElement'; export class WebviewEditorInput extends EditorInput { @@ -77,7 +77,7 @@ export class WebviewEditorInput extends EditorInput { state: any, events: WebviewEvents, extensionLocation: URI | undefined, - public readonly reviver: WebviewReviver | undefined, + public readonly reviver: (input: WebviewEditorInput) => Promise | undefined, @IPartService private readonly _partService: IPartService, ) { super(); @@ -215,7 +215,7 @@ export class WebviewEditorInput extends EditorInput { public resolve(): Promise { if (this.reviver && !this._revived) { this._revived = true; - return this.reviver.reviveWebview(this).then(() => new EditorModel()); + return this.reviver(this).then(() => new EditorModel()); } return Promise.resolve(new EditorModel()); } diff --git a/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts b/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts index 8c71b32bf72..5e68af23090 100644 --- a/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts +++ b/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts @@ -132,23 +132,18 @@ export class WebviewEditorService implements IWebviewEditorService { options: WebviewInputOptions, extensionLocation: URI ): WebviewEditorInput { - const webviewInput = this._instantiationService.createInstance(WebviewEditorInput, viewType, id, title, options, state, {}, extensionLocation, { - canRevive: (_webview) => { - return _webview === webviewInput; - }, - reviveWebview: (webview: WebviewEditorInput): Promise => { - return this.tryRevive(webview).then(didRevive => { - if (didRevive) { - return Promise.resolve(undefined); - } + const webviewInput = this._instantiationService.createInstance(WebviewEditorInput, viewType, id, title, options, state, {}, extensionLocation, (webview: WebviewEditorInput): Promise => { + return this.tryRevive(webview).then(didRevive => { + if (didRevive) { + return Promise.resolve(undefined); + } - // A reviver may not be registered yet. Put into queue and resolve promise when we can revive - let resolve: (value: void) => void; - const promise = new Promise(r => { resolve = r; }); - this._awaitingRevival.push({ input: webview, resolve: resolve! }); - return promise; - }); - } + // A reviver may not be registered yet. Put into queue and resolve promise when we can revive + let resolve: (value: void) => void; + const promise = new Promise(r => { resolve = r; }); + this._awaitingRevival.push({ input: webview, resolve: resolve! }); + return promise; + }); }); webviewInput.iconPath = iconPath; return webviewInput; From 904e426052a5ac50390ad79cd8a98f442c6c7418 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 28 Feb 2019 17:19:33 -0800 Subject: [PATCH 30/90] Introduce RevivedWebviewEditorInput --- .../api/electron-browser/mainThreadWebview.ts | 4 +-- .../electron-browser/webviewEditorInput.ts | 34 +++++++++++++++---- .../webviewEditorInputFactory.ts | 4 +-- .../electron-browser/webviewEditorService.ts | 23 ++++++------- 4 files changed, 42 insertions(+), 23 deletions(-) diff --git a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts index 2f4502f7a3c..1ccd47f9ff3 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts @@ -11,7 +11,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener'; import { ExtHostContext, ExtHostWebviewsShape, IExtHostContext, MainContext, MainThreadWebviewsShape, WebviewPanelHandle, WebviewPanelShowOptions, WebviewInsetHandle } from 'vs/workbench/api/node/extHost.protocol'; import { editorGroupToViewColumn, EditorViewColumn, viewColumnToEditorGroup } from 'vs/workbench/api/shared/editor'; import { WebviewEditor } from 'vs/workbench/contrib/webview/electron-browser/webviewEditor'; -import { WebviewEditorInput } from 'vs/workbench/contrib/webview/electron-browser/webviewEditorInput'; +import { WebviewEditorInput, RevivedWebviewEditorInput } from 'vs/workbench/contrib/webview/electron-browser/webviewEditorInput'; import { ICreateWebViewShowOptions, IWebviewEditorService, WebviewInputOptions, WebviewReviver } from 'vs/workbench/contrib/webview/electron-browser/webviewEditorService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; @@ -246,7 +246,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv return false; } - return this._revivers.has(webview.state.viewType) || !!webview.reviver; + return this._revivers.has(webview.state.viewType) || !!(webview as RevivedWebviewEditorInput).reviver; } private _onBeforeShutdown(): boolean { diff --git a/src/vs/workbench/contrib/webview/electron-browser/webviewEditorInput.ts b/src/vs/workbench/contrib/webview/electron-browser/webviewEditorInput.ts index caa44a7d943..3173942bff3 100644 --- a/src/vs/workbench/contrib/webview/electron-browser/webviewEditorInput.ts +++ b/src/vs/workbench/contrib/webview/electron-browser/webviewEditorInput.ts @@ -64,8 +64,6 @@ export class WebviewEditorInput extends EditorInput { private _scrollYPercentage: number = 0; private _state: any; - private _revived: boolean = false; - public readonly extensionLocation: URI | undefined; private readonly _id: number; @@ -77,7 +75,6 @@ export class WebviewEditorInput extends EditorInput { state: any, events: WebviewEvents, extensionLocation: URI | undefined, - public readonly reviver: (input: WebviewEditorInput) => Promise | undefined, @IPartService private readonly _partService: IPartService, ) { super(); @@ -213,10 +210,6 @@ export class WebviewEditorInput extends EditorInput { } public resolve(): Promise { - if (this.reviver && !this._revived) { - this._revived = true; - return this.reviver(this).then(() => new EditorModel()); - } return Promise.resolve(new EditorModel()); } @@ -310,3 +303,30 @@ export class WebviewEditorInput extends EditorInput { this._group = group; } } + + +export class RevivedWebviewEditorInput extends WebviewEditorInput { + private _revived: boolean = false; + + constructor( + viewType: string, + id: number | undefined, + name: string, + options: WebviewInputOptions, + state: any, + events: WebviewEvents, + extensionLocation: URI | undefined, + public readonly reviver: (input: WebviewEditorInput) => Promise, + @IPartService partService: IPartService, + ) { + super(viewType, id, name, options, state, events, extensionLocation, partService); + } + + public async resolve(): Promise { + if (!this._revived) { + this._revived = true; + await this.reviver(this); + } + return super.resolve(); + } +} \ No newline at end of file diff --git a/src/vs/workbench/contrib/webview/electron-browser/webviewEditorInputFactory.ts b/src/vs/workbench/contrib/webview/electron-browser/webviewEditorInputFactory.ts index e46bac47814..26247da337e 100644 --- a/src/vs/workbench/contrib/webview/electron-browser/webviewEditorInputFactory.ts +++ b/src/vs/workbench/contrib/webview/electron-browser/webviewEditorInputFactory.ts @@ -5,7 +5,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IEditorInputFactory } from 'vs/workbench/common/editor'; -import { WebviewEditorInput } from './webviewEditorInput'; +import { WebviewEditorInput, RevivedWebviewEditorInput } from './webviewEditorInput'; import { IWebviewEditorService, WebviewInputOptions } from './webviewEditorService'; import { URI, UriComponents } from 'vs/base/common/uri'; @@ -41,7 +41,7 @@ export class WebviewEditorInputFactory implements IEditorInputFactory { } // Only attempt revival if we may have a reviver - if (!this._webviewService.canRevive(input) && !input.reviver) { + if (!this._webviewService.canRevive(input) && !(input instanceof RevivedWebviewEditorInput)) { return null; } diff --git a/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts b/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts index 5e68af23090..234d1a1bcad 100644 --- a/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts +++ b/src/vs/workbench/contrib/webview/electron-browser/webviewEditorService.ts @@ -9,7 +9,7 @@ import { IInstantiationService, createDecorator } from 'vs/platform/instantiatio import { IEditorService, ACTIVE_GROUP_TYPE, SIDE_GROUP_TYPE } from 'vs/workbench/services/editor/common/editorService'; import { IEditorGroupsService, IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService'; import * as vscode from 'vscode'; -import { WebviewEditorInput } from './webviewEditorInput'; +import { WebviewEditorInput, RevivedWebviewEditorInput } from './webviewEditorInput'; import { GroupIdentifier } from 'vs/workbench/common/editor'; import { equals } from 'vs/base/common/arrays'; @@ -132,18 +132,17 @@ export class WebviewEditorService implements IWebviewEditorService { options: WebviewInputOptions, extensionLocation: URI ): WebviewEditorInput { - const webviewInput = this._instantiationService.createInstance(WebviewEditorInput, viewType, id, title, options, state, {}, extensionLocation, (webview: WebviewEditorInput): Promise => { - return this.tryRevive(webview).then(didRevive => { - if (didRevive) { - return Promise.resolve(undefined); - } + const webviewInput = this._instantiationService.createInstance(RevivedWebviewEditorInput, viewType, id, title, options, state, {}, extensionLocation, async (webview: WebviewEditorInput): Promise => { + const didRevive = await this.tryRevive(webview); + if (didRevive) { + return Promise.resolve(undefined); + } - // A reviver may not be registered yet. Put into queue and resolve promise when we can revive - let resolve: (value: void) => void; - const promise = new Promise(r => { resolve = r; }); - this._awaitingRevival.push({ input: webview, resolve: resolve! }); - return promise; - }); + // A reviver may not be registered yet. Put into queue and resolve promise when we can revive + let resolve: () => void; + const promise = new Promise(r => { resolve = r; }); + this._awaitingRevival.push({ input: webview, resolve: resolve! }); + return promise; }); webviewInput.iconPath = iconPath; return webviewInput; From 82c3b30e39b05e433224c4c408da62432f007b43 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 28 Feb 2019 17:33:29 -0800 Subject: [PATCH 31/90] Don't hold on to themeService member --- .../contrib/webview/electron-browser/webviewElement.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts b/src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts index 5a287448892..70b14883b23 100644 --- a/src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts +++ b/src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts @@ -235,7 +235,7 @@ export class WebviewElement extends Disposable { private readonly _options: WebviewOptions, private _contentOptions: WebviewContentOptions, @IInstantiationService instantiationService: IInstantiationService, - @IThemeService private readonly _themeService: IThemeService, + @IThemeService themeService: IThemeService, @IEnvironmentService environmentService: IEnvironmentService, @IFileService fileService: IFileService ) { @@ -347,8 +347,8 @@ export class WebviewElement extends Disposable { this._webviewFindWidget = this._register(instantiationService.createInstance(WebviewFindWidget, this)); } - this.style(this._themeService.getTheme()); - this._register(this._themeService.onThemeChange(this.style, this)); + this.style(themeService.getTheme()); + themeService.onThemeChange(this.style, this, this._toDispose); } public mountTo(parent: HTMLElement) { From 5dfc7f62cf17f30f887d68a5d9a240bb3549881a Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Thu, 28 Feb 2019 11:27:48 +0100 Subject: [PATCH 32/90] Add support for async worker creation --- src/vs/base/worker/defaultWorkerFactory.ts | 37 +++++++++++++++------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/vs/base/worker/defaultWorkerFactory.ts b/src/vs/base/worker/defaultWorkerFactory.ts index 30ad9bf632f..b252db4be2e 100644 --- a/src/vs/base/worker/defaultWorkerFactory.ts +++ b/src/vs/base/worker/defaultWorkerFactory.ts @@ -6,7 +6,7 @@ import { globals } from 'vs/base/common/platform'; import { IWorker, IWorkerCallback, IWorkerFactory, logOnceWebWorkerWarning } from 'vs/base/common/worker/simpleWorker'; -function getWorker(workerId: string, label: string): Worker { +function getWorker(workerId: string, label: string): Worker | Promise { // Option for hosts to overwrite the worker script (used in the standalone editor) if (globals.MonacoEnvironment) { if (typeof globals.MonacoEnvironment.getWorker === 'function') { @@ -24,6 +24,13 @@ function getWorker(workerId: string, label: string): Worker { throw new Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker`); } +function isPromiseLike(obj: any): obj is PromiseLike { + if (typeof obj.then === 'function') { + return true; + } + return false; +} + /** * A worker that uses HTML5 web workers so that is has * its own global scope and its own thread. @@ -31,18 +38,26 @@ function getWorker(workerId: string, label: string): Worker { class WebWorker implements IWorker { private id: number; - private worker: Worker | null; + private worker: Promise | null; constructor(moduleId: string, id: number, label: string, onMessageCallback: IWorkerCallback, onErrorCallback: (err: any) => void) { this.id = id; - this.worker = getWorker('workerMain.js', label); - this.postMessage(moduleId); - this.worker.onmessage = function (ev: any) { - onMessageCallback(ev.data); - }; - if (typeof this.worker.addEventListener === 'function') { - this.worker.addEventListener('error', onErrorCallback); + const workerOrPromise = getWorker('workerMain.js', label); + if (isPromiseLike(workerOrPromise)) { + this.worker = workerOrPromise; + } else { + this.worker = Promise.resolve(workerOrPromise); } + this.postMessage(moduleId); + this.worker.then((w) => { + w.onmessage = function (ev: any) { + onMessageCallback(ev.data); + }; + (w).onmessageerror = onErrorCallback; + if (typeof w.addEventListener === 'function') { + w.addEventListener('error', onErrorCallback); + } + }); } public getId(): number { @@ -51,13 +66,13 @@ class WebWorker implements IWorker { public postMessage(msg: string): void { if (this.worker) { - this.worker.postMessage(msg); + this.worker.then(w => w.postMessage(msg)); } } public dispose(): void { if (this.worker) { - this.worker.terminate(); + this.worker.then(w => w.terminate()); } this.worker = null; } From c1ec8af28fa465151e24e28866569fb7a5351c02 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 1 Mar 2019 13:32:28 +0100 Subject: [PATCH 33/90] Add workaround for regular expression leading to Syntax Error (#69655) --- src/vs/base/browser/ui/menu/menu.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/vs/base/browser/ui/menu/menu.ts b/src/vs/base/browser/ui/menu/menu.ts index 47da5e42776..26d89db30a2 100644 --- a/src/vs/base/browser/ui/menu/menu.ts +++ b/src/vs/base/browser/ui/menu/menu.ts @@ -20,8 +20,22 @@ import { Event, Emitter } from 'vs/base/common/event'; import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview'; import { isLinux } from 'vs/base/common/platform'; -export const MENU_MNEMONIC_REGEX: RegExp = /\(&([^\s&])\)|(? Date: Fri, 1 Mar 2019 13:33:32 +0100 Subject: [PATCH 34/90] Add built-in support for cross-origin web worker loading --- src/vs/base/worker/defaultWorkerFactory.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/vs/base/worker/defaultWorkerFactory.ts b/src/vs/base/worker/defaultWorkerFactory.ts index b252db4be2e..eccaa81f139 100644 --- a/src/vs/base/worker/defaultWorkerFactory.ts +++ b/src/vs/base/worker/defaultWorkerFactory.ts @@ -18,7 +18,22 @@ function getWorker(workerId: string, label: string): Worker | Promise { } // ESM-comment-begin if (typeof require === 'function') { - return new Worker(require.toUrl('./' + workerId) + '#' + label); + // check if the JS lives on a different origin + + const workerMain = require.toUrl('./' + workerId); + if (/^(http:)|(https:)|(file:)/.test(workerMain)) { + const currentUrl = String(window.location); + const currentOrigin = currentUrl.substr(0, currentUrl.length - window.location.hash.length - window.location.search.length - window.location.pathname.length); + if (workerMain.substring(0, currentOrigin.length) !== currentOrigin) { + // this is the cross-origin case + // i.e. the webpage is running at a different origin than where the scripts are loaded from + const workerBaseUrl = workerMain.substr(0, workerMain.length - 'vs/base/worker/workerMain.js'.length); + const js = `/*${label}*/self.MonacoEnvironment={baseUrl: '${workerBaseUrl}'};importScripts('${workerMain}');/*${label}*/`; + const url = `data:text/javascript;charset=utf-8,${encodeURIComponent(js)}`; + return new Worker(url); + } + } + return new Worker(workerMain + '#' + label); } // ESM-comment-end throw new Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker`); From 07a671b2d0aee8ac761538f5c74a0fb05433babf Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 1 Mar 2019 13:34:14 +0100 Subject: [PATCH 35/90] Avoid console log error messages in the standalone editor --- src/vs/editor/contrib/folding/folding.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vs/editor/contrib/folding/folding.ts b/src/vs/editor/contrib/folding/folding.ts index d85f6bfbc75..e8393a98ce2 100644 --- a/src/vs/editor/contrib/folding/folding.ts +++ b/src/vs/editor/contrib/folding/folding.ts @@ -279,6 +279,9 @@ export class FoldingController implements IEditorContribution { } return foldingModel; }); + }).then(undefined, (err) => { + onUnexpectedError(err); + return null; }); } } From f18704818733145b21a139dc47d005718b1ee83c Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 1 Mar 2019 20:05:24 +0100 Subject: [PATCH 36/90] Fixes Microsoft/monaco-editor#1319: Listen to selectionchange listener only when focused --- .../browser/controller/textAreaInput.ts | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/vs/editor/browser/controller/textAreaInput.ts b/src/vs/editor/browser/controller/textAreaInput.ts index 7ccf0e99d29..bc986faeb6f 100644 --- a/src/vs/editor/browser/controller/textAreaInput.ts +++ b/src/vs/editor/browser/controller/textAreaInput.ts @@ -10,7 +10,7 @@ import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { RunOnceScheduler } from 'vs/base/common/async'; import { Emitter, Event } from 'vs/base/common/event'; import { KeyCode } from 'vs/base/common/keyCodes'; -import { Disposable } from 'vs/base/common/lifecycle'; +import { Disposable, IDisposable } from 'vs/base/common/lifecycle'; import * as platform from 'vs/base/common/platform'; import * as strings from 'vs/base/common/strings'; import { ITextAreaWrapper, ITypeData, TextAreaState } from 'vs/editor/browser/controller/textAreaState'; @@ -105,6 +105,7 @@ export class TextAreaInput extends Disposable { private readonly _asyncTriggerCut: RunOnceScheduler; private _textAreaState: TextAreaState; + private _selectionChangeListener: IDisposable | null; private _hasFocus: boolean; private _isDoingComposition: boolean; @@ -330,8 +331,9 @@ export class TextAreaInput extends Disposable { this._lastTextAreaEvent = TextAreaInputEventType.blur; this._setHasFocus(false); })); + } - + private _installSelectionChangeListener(): IDisposable { // See https://github.com/Microsoft/vscode/issues/27216 // When using a Braille display, it is possible for users to reposition the // system caret. This is reflected in Chrome as a `selectionchange` event. @@ -351,7 +353,7 @@ export class TextAreaInput extends Disposable { // `selectionchange` events often come multiple times for a single logical change // so throttle multiple `selectionchange` events that burst in a short period of time. let previousSelectionChangeEventTime = 0; - this._register(dom.addDisposableListener(document, 'selectionchange', (e) => { + return dom.addDisposableListener(document, 'selectionchange', (e) => { if (!this._hasFocus) { return; } @@ -411,11 +413,15 @@ export class TextAreaInput extends Disposable { ); this._onSelectionChangeRequest.fire(newSelection); - })); + }); } public dispose(): void { super.dispose(); + if (this._selectionChangeListener) { + this._selectionChangeListener.dispose(); + this._selectionChangeListener = null; + } } public focusTextArea(): void { @@ -435,6 +441,14 @@ export class TextAreaInput extends Disposable { } this._hasFocus = newHasFocus; + if (this._selectionChangeListener) { + this._selectionChangeListener.dispose(); + this._selectionChangeListener = null; + } + if (this._hasFocus) { + this._selectionChangeListener = this._installSelectionChangeListener(); + } + if (this._hasFocus) { if (browser.isEdge) { // Edge has a bug where setting the selection range while the focus event From 5698d79117a1d2db448503bd265c1aa679f59eb5 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 1 Mar 2019 20:46:33 +0100 Subject: [PATCH 37/90] Fixes Microsoft/monaco-editor#1335 --- src/vs/editor/common/modes/supports/tokenization.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/editor/common/modes/supports/tokenization.ts b/src/vs/editor/common/modes/supports/tokenization.ts index e58c791f60b..d245a41fb89 100644 --- a/src/vs/editor/common/modes/supports/tokenization.ts +++ b/src/vs/editor/common/modes/supports/tokenization.ts @@ -240,7 +240,7 @@ export class TokenTheme { } } -const STANDARD_TOKEN_TYPE_REGEXP = /\b(comment|string|regex)\b/; +const STANDARD_TOKEN_TYPE_REGEXP = /\b(comment|string|regex|regexp)\b/; export function toStandardTokenType(tokenType: string): StandardTokenType { let m = tokenType.match(STANDARD_TOKEN_TYPE_REGEXP); if (!m) { @@ -253,6 +253,8 @@ export function toStandardTokenType(tokenType: string): StandardTokenType { return StandardTokenType.String; case 'regex': return StandardTokenType.RegEx; + case 'regexp': + return StandardTokenType.RegEx; } throw new Error('Unexpected match for standard token type!'); } From f2536728d3ef013c7e4512d8901d9487930e1038 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 1 Mar 2019 23:15:02 +0100 Subject: [PATCH 38/90] Add monaco.editor.remeasureFonts (Microsoft/monaco-editor#392) --- src/vs/editor/browser/config/configuration.ts | 9 +++++++++ src/vs/editor/standalone/browser/standaloneEditor.ts | 9 +++++++++ src/vs/monaco.d.ts | 5 +++++ 3 files changed, 23 insertions(+) diff --git a/src/vs/editor/browser/config/configuration.ts b/src/vs/editor/browser/config/configuration.ts index f4a579bc8ce..32e87b2a794 100644 --- a/src/vs/editor/browser/config/configuration.ts +++ b/src/vs/editor/browser/config/configuration.ts @@ -54,6 +54,10 @@ class CSSBasedConfigurationCache { } } +export function clearAllFontInfos(): void { + CSSBasedConfiguration.INSTANCE.clearCache(); +} + export function readFontInfo(bareFontInfo: BareFontInfo): FontInfo { return CSSBasedConfiguration.INSTANCE.readConfiguration(bareFontInfo); } @@ -122,6 +126,11 @@ class CSSBasedConfiguration extends Disposable { super.dispose(); } + public clearCache(): void { + this._cache = new CSSBasedConfigurationCache(); + this._onDidChange.fire(); + } + private _writeToCache(item: BareFontInfo, value: FontInfo): void { this._cache.put(item, value); diff --git a/src/vs/editor/standalone/browser/standaloneEditor.ts b/src/vs/editor/standalone/browser/standaloneEditor.ts index bd5660f51e4..09d4b4bce46 100644 --- a/src/vs/editor/standalone/browser/standaloneEditor.ts +++ b/src/vs/editor/standalone/browser/standaloneEditor.ts @@ -37,6 +37,7 @@ import { IMarker, IMarkerData } from 'vs/platform/markers/common/markers'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; +import { clearAllFontInfos } from 'vs/editor/browser/config/configuration'; type Omit = Pick>; @@ -311,6 +312,13 @@ export function setTheme(themeName: string): void { StaticServices.standaloneThemeService.get().setTheme(themeName); } +/** + * Clears all cached font measurements and triggers re-measurement. + */ +export function remeasureFonts(): void { + clearAllFontInfos(); +} + /** * @internal */ @@ -340,6 +348,7 @@ export function createMonacoEditorAPI(): typeof monaco.editor { tokenize: tokenize, defineTheme: defineTheme, setTheme: setTheme, + remeasureFonts: remeasureFonts, // enums ScrollbarVisibility: standaloneEnums.ScrollbarVisibility, diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 8084ebff346..cf24813d108 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -923,6 +923,11 @@ declare namespace monaco.editor { */ export function setTheme(themeName: string): void; + /** + * Clears all cached font measurements and triggers re-measurement. + */ + export function remeasureFonts(): void; + export type BuiltinTheme = 'vs' | 'vs-dark' | 'hc-black'; export interface IStandaloneThemeData { From e4300018d215cdc8dd0ba7b29f4c1be8f377889b Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Sat, 2 Mar 2019 00:42:49 +0100 Subject: [PATCH 39/90] Allow to register a tokenizer promise and honor tokenizer promises when dealing with embedded modes in colorizing API --- src/vs/editor/standalone/browser/colorizer.ts | 23 +++++++++-- .../standalone/browser/standaloneLanguages.ts | 38 ++++++++++++------ .../standalone/common/monarch/monarchLexer.ts | 39 ++++++++++++++++++- src/vs/monaco.d.ts | 4 +- 4 files changed, 86 insertions(+), 18 deletions(-) diff --git a/src/vs/editor/standalone/browser/colorizer.ts b/src/vs/editor/standalone/browser/colorizer.ts index e085b2e80ed..7ae4fb0498c 100644 --- a/src/vs/editor/standalone/browser/colorizer.ts +++ b/src/vs/editor/standalone/browser/colorizer.ts @@ -13,6 +13,7 @@ import { IModeService } from 'vs/editor/common/services/modeService'; import { RenderLineInput, renderViewLine2 as renderViewLine } from 'vs/editor/common/viewLayout/viewLineRenderer'; import { ViewLineRenderingData } from 'vs/editor/common/viewModel/viewModel'; import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService'; +import { MonarchTokenizer } from 'vs/editor/standalone/common/monarch/monarchLexer'; export interface IColorizerOptions { tabSize?: number; @@ -82,9 +83,10 @@ export class Colorizer { } const tokenizationSupport = TokenizationRegistry.get(language!); if (tokenizationSupport) { - return resolve(_colorize(lines, tabSize, tokenizationSupport)); + _colorize(lines, tabSize, tokenizationSupport).then(resolve, reject); + return; } - return resolve(_fakeColorize(lines, tabSize)); + resolve(_fakeColorize(lines, tabSize)); }; // wait 500ms for mode to load, then give up @@ -130,8 +132,21 @@ export class Colorizer { } } -function _colorize(lines: string[], tabSize: number, tokenizationSupport: ITokenizationSupport): string { - return _actualColorize(lines, tabSize, tokenizationSupport); +function _colorize(lines: string[], tabSize: number, tokenizationSupport: ITokenizationSupport): Promise { + return new Promise((c, e) => { + const execute = () => { + const result = _actualColorize(lines, tabSize, tokenizationSupport); + if (tokenizationSupport instanceof MonarchTokenizer) { + const status = tokenizationSupport.getLoadStatus(); + if (status.loaded === false) { + status.promise.then(execute, e); + return; + } + } + c(result); + }; + execute(); + }); } function _fakeColorize(lines: string[], tabSize: number): string { diff --git a/src/vs/editor/standalone/browser/standaloneLanguages.ts b/src/vs/editor/standalone/browser/standaloneLanguages.ts index 238ae5df16e..8a1f4a9c183 100644 --- a/src/vs/editor/standalone/browser/standaloneLanguages.ts +++ b/src/vs/editor/standalone/browser/standaloneLanguages.ts @@ -292,31 +292,47 @@ export interface EncodedTokensProvider { function isEncodedTokensProvider(provider: TokensProvider | EncodedTokensProvider): provider is EncodedTokensProvider { return provider['tokenizeEncoded']; } + +function isThenable(obj: any): obj is Thenable { + if (typeof obj.then === 'function') { + return true; + } + return false; +} + /** * Set the tokens provider for a language (manual implementation). */ -export function setTokensProvider(languageId: string, provider: TokensProvider | EncodedTokensProvider): IDisposable { +export function setTokensProvider(languageId: string, provider: TokensProvider | EncodedTokensProvider | Thenable): IDisposable { let languageIdentifier = StaticServices.modeService.get().getLanguageIdentifier(languageId); if (!languageIdentifier) { throw new Error(`Cannot set tokens provider for unknown language ${languageId}`); } - let adapter: modes.ITokenizationSupport; - if (isEncodedTokensProvider(provider)) { - adapter = new EncodedTokenizationSupport2Adapter(provider); - } else { - adapter = new TokenizationSupport2Adapter(StaticServices.standaloneThemeService.get(), languageIdentifier, provider); + const create = (provider: TokensProvider | EncodedTokensProvider) => { + if (isEncodedTokensProvider(provider)) { + return new EncodedTokenizationSupport2Adapter(provider); + } else { + return new TokenizationSupport2Adapter(StaticServices.standaloneThemeService.get(), languageIdentifier!, provider); + } + }; + if (isThenable(provider)) { + return modes.TokenizationRegistry.registerPromise(languageId, provider.then(provider => create(provider))); } - return modes.TokenizationRegistry.register(languageId, adapter); + return modes.TokenizationRegistry.register(languageId, create(provider)); } /** * Set the tokens provider for a language (monarch implementation). */ -export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage): IDisposable { - let lexer = compile(languageId, languageDef); - let adapter = createTokenizationSupport(StaticServices.modeService.get(), StaticServices.standaloneThemeService.get(), languageId, lexer); - return modes.TokenizationRegistry.register(languageId, adapter); +export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage | Thenable): IDisposable { + const create = (languageDef: IMonarchLanguage) => { + return createTokenizationSupport(StaticServices.modeService.get(), StaticServices.standaloneThemeService.get(), languageId, compile(languageId, languageDef)); + }; + if (isThenable(languageDef)) { + return modes.TokenizationRegistry.registerPromise(languageId, languageDef.then(languageDef => create(languageDef))); + } + return modes.TokenizationRegistry.register(languageId, create(languageDef)); } /** diff --git a/src/vs/editor/standalone/common/monarch/monarchLexer.ts b/src/vs/editor/standalone/common/monarch/monarchLexer.ts index 0deb0ed169a..6d8b55352ab 100644 --- a/src/vs/editor/standalone/common/monarch/monarchLexer.ts +++ b/src/vs/editor/standalone/common/monarch/monarchLexer.ts @@ -374,13 +374,16 @@ class MonarchModernTokensCollector implements IMonarchTokensCollector { } } -class MonarchTokenizer implements modes.ITokenizationSupport { +export type ILoadStatus = { loaded: true; } | { loaded: false; promise: Promise; }; + +export class MonarchTokenizer implements modes.ITokenizationSupport { private readonly _modeService: IModeService; private readonly _standaloneThemeService: IStandaloneThemeService; private readonly _modeId: string; private readonly _lexer: monarchCommon.ILexer; private _embeddedModes: { [modeId: string]: boolean; }; + public embeddedLoaded: Promise; private _tokenizationRegistryListener: IDisposable; constructor(modeService: IModeService, standaloneThemeService: IStandaloneThemeService, modeId: string, lexer: monarchCommon.ILexer) { @@ -389,6 +392,7 @@ class MonarchTokenizer implements modes.ITokenizationSupport { this._modeId = modeId; this._lexer = lexer; this._embeddedModes = Object.create(null); + this.embeddedLoaded = Promise.resolve(undefined); // Set up listening for embedded modes let emitting = false; @@ -416,6 +420,39 @@ class MonarchTokenizer implements modes.ITokenizationSupport { this._tokenizationRegistryListener.dispose(); } + public getLoadStatus(): ILoadStatus { + let promises: Thenable[] = []; + for (let nestedModeId in this._embeddedModes) { + const tokenizationSupport = modes.TokenizationRegistry.get(nestedModeId); + if (tokenizationSupport) { + // The nested mode is already loaded + if (tokenizationSupport instanceof MonarchTokenizer) { + const nestedModeStatus = tokenizationSupport.getLoadStatus(); + if (nestedModeStatus.loaded === false) { + promises.push(nestedModeStatus.promise); + } + } + continue; + } + + const tokenizationSupportPromise = modes.TokenizationRegistry.getPromise(nestedModeId); + if (tokenizationSupportPromise) { + // The nested mode is in the process of being loaded + promises.push(tokenizationSupportPromise); + } + } + + if (promises.length === 0) { + return { + loaded: true + }; + } + return { + loaded: false, + promise: Promise.all(promises).then(_ => undefined) + }; + } + public getInitialState(): modes.IState { let rootState = MonarchStackElementFactory.create(null, this._lexer.start!); return MonarchLineStateFactory.create(rootState, null); diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index cf24813d108..3f279a4527c 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -4284,12 +4284,12 @@ declare namespace monaco.languages { /** * Set the tokens provider for a language (manual implementation). */ - export function setTokensProvider(languageId: string, provider: TokensProvider | EncodedTokensProvider): IDisposable; + export function setTokensProvider(languageId: string, provider: TokensProvider | EncodedTokensProvider | Thenable): IDisposable; /** * Set the tokens provider for a language (monarch implementation). */ - export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage): IDisposable; + export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage | Thenable): IDisposable; /** * Register a reference provider (used by e.g. reference search). From 7ff5246e1bd5f33abb46a2055c75c10a8a73cdff Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Sat, 2 Mar 2019 00:54:08 +0100 Subject: [PATCH 40/90] More honoring of tokenization support promises in colorize API --- src/vs/editor/standalone/browser/colorizer.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/vs/editor/standalone/browser/colorizer.ts b/src/vs/editor/standalone/browser/colorizer.ts index 7ae4fb0498c..db4ceaff579 100644 --- a/src/vs/editor/standalone/browser/colorizer.ts +++ b/src/vs/editor/standalone/browser/colorizer.ts @@ -65,7 +65,17 @@ export class Colorizer { let tokenizationSupport = TokenizationRegistry.get(language); if (tokenizationSupport) { - return Promise.resolve(_colorize(lines, tabSize, tokenizationSupport)); + return _colorize(lines, tabSize, tokenizationSupport); + } + + let tokenizationSupportPromise = TokenizationRegistry.getPromise(language); + if (tokenizationSupportPromise) { + // A tokenizer will be registered soon + return new Promise((resolve, reject) => { + tokenizationSupportPromise.then(tokenizationSupport => { + _colorize(lines, tabSize, tokenizationSupport).then(resolve, reject); + }, reject); + }); } return new Promise((resolve, reject) => { From 95e1e94fca81704ff6ebeab49132e1bcd621859c Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Sat, 2 Mar 2019 01:45:15 +0100 Subject: [PATCH 41/90] Fix strict null check --- src/vs/editor/standalone/browser/colorizer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/editor/standalone/browser/colorizer.ts b/src/vs/editor/standalone/browser/colorizer.ts index db4ceaff579..7c9a64ff411 100644 --- a/src/vs/editor/standalone/browser/colorizer.ts +++ b/src/vs/editor/standalone/browser/colorizer.ts @@ -72,7 +72,7 @@ export class Colorizer { if (tokenizationSupportPromise) { // A tokenizer will be registered soon return new Promise((resolve, reject) => { - tokenizationSupportPromise.then(tokenizationSupport => { + tokenizationSupportPromise!.then(tokenizationSupport => { _colorize(lines, tabSize, tokenizationSupport).then(resolve, reject); }, reject); }); From 6aa3a66966affc4f755ac4acf033b8c1caaad5d6 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Sat, 2 Mar 2019 01:53:49 +0100 Subject: [PATCH 42/90] Make vs/base/common/path compatible with ESM --- src/vs/base/common/path.ts | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/vs/base/common/path.ts b/src/vs/base/common/path.ts index 53bd495fd8d..982934e20d1 100644 --- a/src/vs/base/common/path.ts +++ b/src/vs/base/common/path.ts @@ -205,12 +205,7 @@ interface IPath { posix: IPath | null; } -interface IExportedPath extends IPath { - win32: IPath; - posix: IPath; -} - -const win32: IPath = { +export const win32: IPath = { // path.resolve([from ...], to) resolve(...pathSegments: string[]): string { let resolvedDevice = ''; @@ -1199,7 +1194,7 @@ const win32: IPath = { posix: null }; -const posix: IPath = { +export const posix: IPath = { // path.resolve([from ...], to) resolve(...pathSegments: string[]): string { let resolvedPath = ''; @@ -1685,5 +1680,16 @@ const posix: IPath = { posix.win32 = win32.win32 = win32; posix.posix = win32.posix = posix; -const impl = (safeProcess.platform === 'win32' ? win32 : posix) as IExportedPath; -export = impl; +export const normalize = (safeProcess.platform === 'win32' ? win32.normalize : posix.normalize); +export const isAbsolute = (safeProcess.platform === 'win32' ? win32.isAbsolute : posix.isAbsolute); +export const join = (safeProcess.platform === 'win32' ? win32.join : posix.join); +export const resolve = (safeProcess.platform === 'win32' ? win32.resolve : posix.resolve); +export const relative = (safeProcess.platform === 'win32' ? win32.relative : posix.relative); +export const dirname = (safeProcess.platform === 'win32' ? win32.dirname : posix.dirname); +export const basename = (safeProcess.platform === 'win32' ? win32.basename : posix.basename); +export const extname = (safeProcess.platform === 'win32' ? win32.extname : posix.extname); +export const format = (safeProcess.platform === 'win32' ? win32.format : posix.format); +export const parse = (safeProcess.platform === 'win32' ? win32.parse : posix.parse); +export const toNamespacedPath = (safeProcess.platform === 'win32' ? win32.toNamespacedPath : posix.toNamespacedPath); +export const sep = (safeProcess.platform === 'win32' ? win32.sep : posix.sep); +export const delimiter = (safeProcess.platform === 'win32' ? win32.delimiter : posix.delimiter); From afded16b6fd860266463e8fba797a38a5d5a5d89 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Sat, 2 Mar 2019 02:08:54 +0100 Subject: [PATCH 43/90] Fix Microsoft/monaco-editor#1297 --- build/monaco/monaco.usage.recipe | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/monaco/monaco.usage.recipe b/build/monaco/monaco.usage.recipe index fad1e8ee724..13290a7abb5 100644 --- a/build/monaco/monaco.usage.recipe +++ b/build/monaco/monaco.usage.recipe @@ -13,6 +13,7 @@ import { QuickOpenWidget } from './vs/base/parts/quickopen/browser/quickOpenWidg import { WorkbenchAsyncDataTree } from './vs/platform/list/browser/listService'; import { SyncDescriptor0, SyncDescriptor1, SyncDescriptor2, SyncDescriptor3, SyncDescriptor4, SyncDescriptor5, SyncDescriptor6, SyncDescriptor7, SyncDescriptor8 } from './vs/platform/instantiation/common/descriptors'; import { DiffNavigator } from './vs/editor/browser/widget/diffNavigator'; +import { DocumentRangeFormattingEditProvider } from './vs/editor/common/modes'; import * as editorAPI from './vs/editor/editor.api'; (function () { @@ -32,6 +33,7 @@ import * as editorAPI from './vs/editor/editor.api'; a = (>b).getProxyObject; // IWorkerClient a = create1; a = create2; + a = (b).extensionId; // injection madness a = (>b).ctor; From 57f34ad851fd07c0bd4d83da8bb587d806d42ce7 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Sat, 2 Mar 2019 02:25:49 +0100 Subject: [PATCH 44/90] monaco-editor-core@0.16.0 --- build/gulpfile.editor.js | 8 ++++++ build/monaco/ThirdPartyNotices.txt | 25 ++++++++++++++++++ build/monaco/package.json | 2 +- build/monaco/version.txt | 0 src/vs/base/common/path.ts | 42 ++++++++++++++++-------------- 5 files changed, 56 insertions(+), 21 deletions(-) create mode 100644 build/monaco/version.txt diff --git a/build/gulpfile.editor.js b/build/gulpfile.editor.js index 05c7d4fb8b5..7bbf246a8dc 100644 --- a/build/gulpfile.editor.js +++ b/build/gulpfile.editor.js @@ -234,6 +234,14 @@ const finalEditorResourcesTask = task.define('final-editor-resources', () => { })) .pipe(gulp.dest('out-monaco-editor-core')), + // 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}`); + this.emit('data', data); + })) + .pipe(gulp.dest('out-monaco-editor-core')), + // README.md gulp.src('build/monaco/README-npm.md') .pipe(es.through(function (data) { diff --git a/build/monaco/ThirdPartyNotices.txt b/build/monaco/ThirdPartyNotices.txt index a459893cc97..1de70ddaab6 100644 --- a/build/monaco/ThirdPartyNotices.txt +++ b/build/monaco/ThirdPartyNotices.txt @@ -7,6 +7,31 @@ herein, whether by implication, estoppel or otherwise. +%% nodejs path library (https://github.com/nodejs/node/tree/43dd49c9782848c25e5b03448c8a0f923f13c158) +========================================= +Copyright Joyent, Inc. and other Node contributors. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +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 nodejs path library NOTICES AND INFORMATION + %% promise-polyfill version 8.1.0 (https://github.com/taylorhakes/promise-polyfill) ========================================= diff --git a/build/monaco/package.json b/build/monaco/package.json index efd919085b2..1962694ce6d 100644 --- a/build/monaco/package.json +++ b/build/monaco/package.json @@ -1,7 +1,7 @@ { "name": "monaco-editor-core", "private": true, - "version": "0.14.3", + "version": "0.16.0", "description": "A browser based code editor", "author": "Microsoft Corporation", "license": "MIT", diff --git a/build/monaco/version.txt b/build/monaco/version.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/vs/base/common/path.ts b/src/vs/base/common/path.ts index 982934e20d1..a93084c42b7 100644 --- a/src/vs/base/common/path.ts +++ b/src/vs/base/common/path.ts @@ -6,26 +6,28 @@ // NOTE: VSCode's copy of nodejs path library to be usable in common (non-node) namespace // Copied from: https://github.com/nodejs/node/tree/43dd49c9782848c25e5b03448c8a0f923f13c158 -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// 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. +/** + * Copyright Joyent, Inc. and other Node contributors. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * 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. + */ import { isWindows } from 'vs/base/common/platform'; From 87a826c6e8e8891020a9e02fa796b3590c10d751 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Sat, 2 Mar 2019 02:29:27 +0100 Subject: [PATCH 45/90] Fix path tests --- src/vs/base/test/common/path.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/base/test/common/path.test.ts b/src/vs/base/test/common/path.test.ts index f16f61a9bea..e135fd3a177 100644 --- a/src/vs/base/test/common/path.test.ts +++ b/src/vs/base/test/common/path.test.ts @@ -753,11 +753,11 @@ suite('Paths (Node Implementation)', () => { // posix assert.strictEqual(path.posix.delimiter, ':'); - if (isWindows) { - assert.strictEqual(path, path.win32); - } else { - assert.strictEqual(path, path.posix); - } + // if (isWindows) { + // assert.strictEqual(path, path.win32); + // } else { + // assert.strictEqual(path, path.posix); + // } }); // test('perf', () => { From 3f68d38c9bf1ff4f2c69befc5b107af3fb087a4f Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 1 Mar 2019 19:52:09 -0800 Subject: [PATCH 46/90] Fix strict null error in webview --- src/vs/workbench/api/node/extHostWebview.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/api/node/extHostWebview.ts b/src/vs/workbench/api/node/extHostWebview.ts index df6b86f3e92..d5e5d2264db 100644 --- a/src/vs/workbench/api/node/extHostWebview.ts +++ b/src/vs/workbench/api/node/extHostWebview.ts @@ -85,7 +85,7 @@ export class ExtHostWebviewPanel implements vscode.WebviewPanel { private readonly _options: vscode.WebviewPanelOptions; private readonly _webview: ExtHostWebview; private _isDisposed: boolean = false; - private _viewColumn: vscode.ViewColumn; + private _viewColumn: vscode.ViewColumn | undefined; private _visible: boolean = true; private _active: boolean = true; @@ -101,7 +101,7 @@ export class ExtHostWebviewPanel implements vscode.WebviewPanel { proxy: MainThreadWebviewsShape, viewType: string, title: string, - viewColumn: vscode.ViewColumn, + viewColumn: vscode.ViewColumn | undefined, editorOptions: vscode.WebviewPanelOptions, webview: ExtHostWebview ) { @@ -173,7 +173,7 @@ export class ExtHostWebviewPanel implements vscode.WebviewPanel { get viewColumn(): vscode.ViewColumn | undefined { this.assertNotDisposed(); - if (this._viewColumn < 0) { + if (typeof this._viewColumn === 'number' && this._viewColumn < 0) { // We are using a symbolic view column // Return undefined instead to indicate that the real view column is currently unknown but will be resolved. return undefined; From a733b477504dbaf81b26296cdd2d3d40d72ffcca Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 1 Mar 2019 19:53:22 -0800 Subject: [PATCH 47/90] Strict null work in breadcrumbs --- .../browser/parts/editor/breadcrumbsControl.ts | 10 +++++----- .../browser/parts/editor/breadcrumbsPicker.ts | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts index 8eaf0a8810b..1b9aad2e2fb 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts @@ -221,7 +221,7 @@ export class BreadcrumbsControl { input = input.master; } - if (!input || !input.getResource() || (input.getResource().scheme !== Schemas.untitled && !this._fileService.canHandleResource(input.getResource()))) { + if (!input || !input.getResource() || (input.getResource()!.scheme !== Schemas.untitled && !this._fileService.canHandleResource(input.getResource()!))) { // cleanup and return when there is no input or when // we cannot handle this input this._ckBreadcrumbsPossible.set(false); @@ -238,7 +238,7 @@ export class BreadcrumbsControl { this._ckBreadcrumbsPossible.set(true); let editor = this._getActiveCodeEditor(); - let model = new EditorBreadcrumbsModel(input.getResource(), editor, this._workspaceService, this._configurationService); + let model = new EditorBreadcrumbsModel(input.getResource()!, editor, this._workspaceService, this._configurationService); dom.toggleClass(this.domNode, 'relative-path', model.isRelative()); let updateBreadcrumbs = () => { @@ -435,7 +435,7 @@ export class BreadcrumbsControl { this._ckBreadcrumbsActive.set(value); } - private _revealInEditor(event: IBreadcrumbsItemEvent, element: any, group: SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE, pinned: boolean = false): void { + private _revealInEditor(event: IBreadcrumbsItemEvent, element: any, group: SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE | undefined, pinned: boolean = false): void { if (element instanceof FileElement) { if (element.kind === FileKind.FILE) { // open file in any editor @@ -450,14 +450,14 @@ export class BreadcrumbsControl { } else if (element instanceof OutlineElement) { // open symbol in code editor - let model = OutlineModel.get(element); + const model = OutlineModel.get(element); this._codeEditorService.openCodeEditor({ resource: model.textModel.uri, options: { selection: Range.collapseToStart(element.symbol.selectionRange), revealInCenterIfOutsideViewport: true } - }, this._getActiveCodeEditor(), group === SIDE_GROUP); + }, this._getActiveCodeEditor() || null, group === SIDE_GROUP); } } diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts index 6f1c4e469c8..b0d991ac9eb 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts @@ -87,11 +87,11 @@ export abstract class BreadcrumbsPicker { this._arrow = document.createElement('div'); this._arrow.className = 'arrow'; - this._arrow.style.borderColor = `transparent transparent ${color.toString()}`; + this._arrow.style.borderColor = `transparent transparent ${color ? color.toString() : ''}`; this._domNode.appendChild(this._arrow); this._treeContainer = document.createElement('div'); - this._treeContainer.style.background = color.toString(); + this._treeContainer.style.background = color ? color.toString() : ''; this._treeContainer.style.paddingTop = '2px'; this._treeContainer.style.boxShadow = `0px 5px 8px ${this._themeService.getTheme().getColor(widgetShadow)}`; this._domNode.appendChild(this._treeContainer); @@ -219,10 +219,10 @@ class FileDataSource implements IAsyncDataSource { - for (let child of stat.children) { + for (const child of stat.children || []) { this._parents.set(stat, child); } - return stat.children; + return stat.children || []; }); } } From 326660dddd15333def33eacf11561368cb370a24 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 1 Mar 2019 20:00:18 -0800 Subject: [PATCH 48/90] Strict null work --- src/vs/workbench/browser/dnd.ts | 2 +- .../workbench/browser/parts/editor/editor.ts | 2 +- src/vs/workbench/common/editor.ts | 2 +- .../files/browser/editors/binaryFileEditor.ts | 2 +- .../browser/editors/fileEditorTracker.ts | 23 ++++++++++--------- .../files/browser/editors/textFileEditor.ts | 6 ++--- .../contrib/files/browser/saveErrorHandler.ts | 6 +++++ .../contrib/files/browser/views/emptyView.ts | 17 ++++++++++---- .../files/browser/views/explorerView.ts | 4 ++-- .../files/common/editors/fileEditorInput.ts | 2 +- .../electron-browser/remoteFileDialog.ts | 4 +++- .../services/editor/browser/editorService.ts | 2 +- 12 files changed, 44 insertions(+), 28 deletions(-) diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts index 5897ab9e710..a494e038b78 100644 --- a/src/vs/workbench/browser/dnd.ts +++ b/src/vs/workbench/browser/dnd.ts @@ -162,7 +162,7 @@ export class ResourcesDropHandler { ) { } - handleDrop(event: DragEvent, resolveTargetGroup: () => IEditorGroup, afterDrop: (targetGroup: IEditorGroup) => void, targetIndex?: number): void { + handleDrop(event: DragEvent, resolveTargetGroup: () => IEditorGroup | undefined, afterDrop: (targetGroup: IEditorGroup) => void, targetIndex?: number): void { const untitledOrFileResources = extractResources(event).filter(r => this.fileService.canHandleResource(r.resource) || r.resource.scheme === Schemas.untitled); if (!untitledOrFileResources.length) { return; diff --git a/src/vs/workbench/browser/parts/editor/editor.ts b/src/vs/workbench/browser/parts/editor/editor.ts index 5da1159887f..0fac3e2d9e6 100644 --- a/src/vs/workbench/browser/parts/editor/editor.ts +++ b/src/vs/workbench/browser/parts/editor/editor.ts @@ -77,7 +77,7 @@ export interface IEditorOpeningEvent extends IEditorIdentifier { * to return a promise that resolves to NULL to prevent the opening * alltogether. */ - prevent(callback: () => Promise): void; + prevent(callback: () => undefined | Promise): void; } export interface IEditorGroupsAccessor { diff --git a/src/vs/workbench/common/editor.ts b/src/vs/workbench/common/editor.ts index 027f4d17d21..bd9740edb23 100644 --- a/src/vs/workbench/common/editor.ts +++ b/src/vs/workbench/common/editor.ts @@ -678,7 +678,7 @@ export class EditorOptions implements IEditorOptions { /** * Helper to create EditorOptions inline. */ - static create(settings: IEditorOptions): EditorOptions | null { + static create(settings: IEditorOptions): EditorOptions { const options = new EditorOptions(); options.preserveFocus = settings.preserveFocus; diff --git a/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts b/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts index a928e36712a..56e4ac1979b 100644 --- a/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts +++ b/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts @@ -64,7 +64,7 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor { }); } - getTitle(): string { + getTitle(): string | null { return this.input ? this.input.getName() : nls.localize('binaryFileEditor', "Binary File Viewer"); } } diff --git a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts index 5b62bd8c09b..c281e9d0bfb 100644 --- a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts +++ b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts @@ -13,7 +13,7 @@ import { FileOperationEvent, FileOperation, IFileService, FileChangeType, FileCh import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput'; import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; import { Disposable } from 'vs/base/common/lifecycle'; -import { distinct } from 'vs/base/common/arrays'; +import { distinct, coalesce } from 'vs/base/common/arrays'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { isLinux } from 'vs/base/common/platform'; @@ -92,12 +92,12 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut // are visible in any editor. since this is a fast operation in the case nothing has changed, // we tolerate the additional work. distinct( - this.editorService.visibleEditors + coalesce(this.editorService.visibleEditors .map(editorInput => { const resource = toResource(editorInput, { supportSideBySide: true }); return resource ? this.textFileService.models.get(resource) : undefined; - }) - .filter(model => model && !model.isDirty()), + })) + .filter(model => !model.isDirty()), m => m.getResource().toString() ).forEach(model => this.queueModelLoad(model)); } @@ -276,7 +276,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut if (editorResource && resource.toString() === editorResource.toString()) { const control = editor.getControl(); if (isCodeEditor(control)) { - return control.saveViewState(); + return control.saveViewState() || undefined; } } } @@ -320,18 +320,19 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut private handleUpdatesToVisibleBinaryEditors(e: FileChangesEvent): void { const editors = this.editorService.visibleControls; editors.forEach(editor => { - const resource = toResource(editor.input, { supportSideBySide: true }); + const resource = editor.input ? toResource(editor.input, { supportSideBySide: true }) : undefined; // Support side-by-side binary editors too let isBinaryEditor = false; if (editor instanceof SideBySideEditor) { - isBinaryEditor = editor.getMasterEditor().getId() === BINARY_FILE_EDITOR_ID; + const masterEditor = editor.getMasterEditor(); + isBinaryEditor = !!masterEditor && masterEditor.getId() === BINARY_FILE_EDITOR_ID; } else { isBinaryEditor = editor.getId() === BINARY_FILE_EDITOR_ID; } // Binary editor that should reload from event - if (resource && isBinaryEditor && (e.contains(resource, FileChangeType.UPDATED) || e.contains(resource, FileChangeType.ADDED))) { + if (resource && editor.input && isBinaryEditor && (e.contains(resource, FileChangeType.UPDATED) || e.contains(resource, FileChangeType.ADDED))) { this.editorService.openEditor(editor.input, { forceReload: true, preserveFocus: true }, editor.group); } }); @@ -339,10 +340,10 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut private handleOutOfWorkspaceWatchers(): void { const visibleOutOfWorkspacePaths = new ResourceMap(); - this.editorService.visibleEditors.map(editorInput => { + coalesce(this.editorService.visibleEditors.map(editorInput => { return toResource(editorInput, { supportSideBySide: true }); - }).filter(resource => { - return !!resource && this.fileService.canHandleResource(resource) && !this.contextService.isInsideWorkspace(resource); + })).filter(resource => { + return this.fileService.canHandleResource(resource) && !this.contextService.isInsideWorkspace(resource); }).forEach(resource => { visibleOutOfWorkspacePaths.set(resource, resource); }); diff --git a/src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts b/src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts index 8d1c0fbc798..5e1a9623ea0 100644 --- a/src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts +++ b/src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts @@ -185,7 +185,7 @@ export class TextFileEditor extends BaseTextEditor { if ((error).fileOperationResult === FileOperationResult.FILE_NOT_FOUND && isValidBasename(basename(input.getResource()))) { return Promise.reject(createErrorWithActions(toErrorMessage(error), { actions: [ - new Action('workbench.files.action.createMissingFile', nls.localize('createFile', "Create File"), null, true, () => { + new Action('workbench.files.action.createMissingFile', nls.localize('createFile', "Create File"), undefined, true, () => { return this.fileService.updateContent(input.getResource(), '').then(() => this.editorService.openEditor({ resource: input.getResource(), options: { @@ -202,14 +202,14 @@ export class TextFileEditor extends BaseTextEditor { return Promise.reject(createErrorWithActions(toErrorMessage(error), { actions: [ - new Action('workbench.window.action.relaunchWithIncreasedMemoryLimit', nls.localize('relaunchWithIncreasedMemoryLimit', "Restart with {0} MB", memoryLimit), null, true, () => { + new Action('workbench.window.action.relaunchWithIncreasedMemoryLimit', nls.localize('relaunchWithIncreasedMemoryLimit', "Restart with {0} MB", memoryLimit), undefined, true, () => { return this.windowsService.relaunch({ addArgs: [ `--max-memory=${memoryLimit}` ] }); }), - new Action('workbench.window.action.configureMemoryLimit', nls.localize('configureMemoryLimit', 'Configure Memory Limit'), null, true, () => { + new Action('workbench.window.action.configureMemoryLimit', nls.localize('configureMemoryLimit', 'Configure Memory Limit'), undefined, true, () => { return this.preferencesService.openGlobalSettings(undefined, { query: 'files.maxMemoryForLargeFilesMB' }); }) ] diff --git a/src/vs/workbench/contrib/files/browser/saveErrorHandler.ts b/src/vs/workbench/contrib/files/browser/saveErrorHandler.ts index 76ea4afea5f..c3861633546 100644 --- a/src/vs/workbench/contrib/files/browser/saveErrorHandler.ts +++ b/src/vs/workbench/contrib/files/browser/saveErrorHandler.ts @@ -314,6 +314,9 @@ export const acceptLocalChangesCommand = (accessor: ServicesAccessor, resource: const modelService = accessor.get(IModelService); const control = editorService.activeControl; + if (!control) { + return; + } const editor = control.input; const group = control.group; @@ -350,6 +353,9 @@ export const revertLocalChangesCommand = (accessor: ServicesAccessor, resource: const resolverService = accessor.get(ITextModelService); const control = editorService.activeControl; + if (!control) { + return; + } const editor = control.input; const group = control.group; diff --git a/src/vs/workbench/contrib/files/browser/views/emptyView.ts b/src/vs/workbench/contrib/files/browser/views/emptyView.ts index 40315768e67..89e2def4556 100644 --- a/src/vs/workbench/contrib/files/browser/views/emptyView.ts +++ b/src/vs/workbench/contrib/files/browser/views/emptyView.ts @@ -70,6 +70,9 @@ export class EmptyView extends ViewletPanel { attachButtonStyler(this.button, this.themeService); this.disposables.push(this.button.onDidClick(() => { + if (!this.actionRunner) { + return; + } const actionClass = this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE ? AddRootFolderAction : env.isMacintosh ? OpenFileFolderAction : OpenFolderAction; const action = this.instantiationService.createInstance(actionClass, actionClass.ID, actionClass.LABEL); this.actionRunner.run(action).then(() => { @@ -82,21 +85,25 @@ export class EmptyView extends ViewletPanel { this.disposables.push(new DragAndDropObserver(container, { onDrop: e => { - container.style.backgroundColor = this.themeService.getTheme().getColor(SIDE_BAR_BACKGROUND).toString(); + const color = this.themeService.getTheme().getColor(SIDE_BAR_BACKGROUND); + container.style.backgroundColor = color ? color.toString() : ''; const dropHandler = this.instantiationService.createInstance(ResourcesDropHandler, { allowWorkspaceOpen: true }); dropHandler.handleDrop(e, () => undefined, targetGroup => undefined); }, onDragEnter: (e) => { - container.style.backgroundColor = this.themeService.getTheme().getColor(listDropBackground).toString(); + const color = this.themeService.getTheme().getColor(listDropBackground); + container.style.backgroundColor = color ? color.toString() : ''; }, onDragEnd: () => { - container.style.backgroundColor = this.themeService.getTheme().getColor(SIDE_BAR_BACKGROUND).toString(); + const color = this.themeService.getTheme().getColor(SIDE_BAR_BACKGROUND); + container.style.backgroundColor = color ? color.toString() : ''; }, onDragLeave: () => { - container.style.backgroundColor = this.themeService.getTheme().getColor(SIDE_BAR_BACKGROUND).toString(); + const color = this.themeService.getTheme().getColor(SIDE_BAR_BACKGROUND); + container.style.backgroundColor = color ? color.toString() : ''; }, onDragOver: e => { - e.dataTransfer.dropEffect = 'copy'; + e.dataTransfer!.dropEffect = 'copy'; } })); diff --git a/src/vs/workbench/contrib/files/browser/views/explorerView.ts b/src/vs/workbench/contrib/files/browser/views/explorerView.ts index 2f4cf5df114..eafa721b5bd 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerView.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerView.ts @@ -61,7 +61,7 @@ export class ExplorerView extends ViewletPanel { // Refresh is needed on the initial explorer open private shouldRefresh = true; - private setTreeInputPromise = Promise.resolve(undefined); + private setTreeInputPromise = Promise.resolve(); private dragHandler: DelayedDragHandler; private decorationProvider: ExplorerDecorationsProvider; private autoReveal = false; @@ -487,7 +487,7 @@ export class ExplorerView extends ViewletPanel { return promise; } - private getActiveFile(): URI { + private getActiveFile(): URI | undefined { const input = this.editorService.activeEditor; // ignore diff editor inputs (helps to get out of diffing when returning to explorer) diff --git a/src/vs/workbench/contrib/files/common/editors/fileEditorInput.ts b/src/vs/workbench/contrib/files/common/editors/fileEditorInput.ts index 3b7916fe08f..ba125a48dba 100644 --- a/src/vs/workbench/contrib/files/common/editors/fileEditorInput.ts +++ b/src/vs/workbench/contrib/files/common/editors/fileEditorInput.ts @@ -28,7 +28,7 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput { private preferredEncoding: string; private forceOpenAsBinary: boolean; private forceOpenAsText: boolean; - private textModelReference: Promise>; + private textModelReference: Promise> | null; private name: string; /** diff --git a/src/vs/workbench/services/dialogs/electron-browser/remoteFileDialog.ts b/src/vs/workbench/services/dialogs/electron-browser/remoteFileDialog.ts index c8264fa5a65..82aefb51aff 100644 --- a/src/vs/workbench/services/dialogs/electron-browser/remoteFileDialog.ts +++ b/src/vs/workbench/services/dialogs/electron-browser/remoteFileDialog.ts @@ -150,7 +150,9 @@ export class RemoteFileDialog { } this.filePickBox.onDidTriggerButton(button => { if (button === this.fallbackPickerButton) { - options.availableFileSystems.shift(); + if (options.availableFileSystems) { + options.availableFileSystems.shift(); + } isResolved = true; if (this.requiresTrailing) { this.fileDialogService.showSaveDialog(options).then(result => { diff --git a/src/vs/workbench/services/editor/browser/editorService.ts b/src/vs/workbench/services/editor/browser/editorService.ts index 228dfe7afb4..b9665358c3b 100644 --- a/src/vs/workbench/services/editor/browser/editorService.ts +++ b/src/vs/workbench/services/editor/browser/editorService.ts @@ -54,7 +54,7 @@ export class EditorService extends Disposable implements EditorServiceImpl { private fileInputFactory: IFileInputFactory; private openEditorHandlers: IOpenEditorOverrideHandler[] = []; - private lastActiveEditor: IEditorInput; + private lastActiveEditor: IEditorInput | null; private lastActiveGroupId: GroupIdentifier; constructor( From 74e525d78fc9eb9fff3adcdcc07a85be7661e1e4 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 1 Mar 2019 20:22:40 -0800 Subject: [PATCH 49/90] Strict null work on api tests --- .../api/extHostApiCommands.test.ts | 22 +++++++++---------- .../api/extHostTextEditor.test.ts | 2 +- .../api/extHostTreeViews.test.ts | 4 ++-- .../api/mainThreadConfiguration.test.ts | 16 +++++++------- .../api/mainThreadEditors.test.ts | 6 ++--- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts index 49c0a50275a..f7c066436d5 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts @@ -87,15 +87,15 @@ suite('ExtHostLanguageFeatureCommands', function () { instantiationService.stub(IModelService, { _serviceBrand: IModelService, getModel(): any { return model; }, - createModel(): any { throw new Error(); }, - updateModel(): any { throw new Error(); }, - setMode(): any { throw new Error(); }, - destroyModel(): any { throw new Error(); }, - getModels(): any { throw new Error(); }, - onModelAdded: undefined, - onModelModeChanged: undefined, - onModelRemoved: undefined, - getCreationOptions(): any { throw new Error(); } + createModel() { throw new Error(); }, + updateModel() { throw new Error(); }, + setMode() { throw new Error(); }, + destroyModel() { throw new Error(); }, + getModels() { throw new Error(); }, + onModelAdded: undefined!, + onModelModeChanged: undefined!, + onModelRemoved: undefined!, + getCreationOptions() { throw new Error(); } }); inst = instantiationService; } @@ -190,8 +190,8 @@ suite('ExtHostLanguageFeatureCommands', function () { test('executeWorkspaceSymbolProvider should accept empty string, #39522', async function () { disposables.push(extHost.registerWorkspaceSymbolProvider(nullExtensionDescription, { - provideWorkspaceSymbols(query) { - return [new types.SymbolInformation('hello', types.SymbolKind.Array, new types.Range(0, 0, 0, 0), URI.parse('foo:bar'))]; + provideWorkspaceSymbols(query): vscode.SymbolInformation[] { + return [new types.SymbolInformation('hello', types.SymbolKind.Array, new types.Range(0, 0, 0, 0), URI.parse('foo:bar')) as vscode.SymbolInformation]; } })); diff --git a/src/vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts b/src/vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts index b7cdcfcf6e9..a9bcfbeca01 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts @@ -292,7 +292,7 @@ suite('ExtHostTextEditorOptions', () => { }); test('ignores invalid indentSize 1', () => { - opts.indentSize = null; + opts.indentSize = null!; assertState(opts, { tabSize: 4, indentSize: 4, diff --git a/src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts b/src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts index f371dd2f5d9..7e626d3985b 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts @@ -625,7 +625,7 @@ suite('ExtHostTreeView', function () { getTreeItem: (element: { key: string }): TreeItem => { return getTreeItem(element.key); }, - getParent: ({ key }: { key: string }): { key: string } => { + getParent: ({ key }: { key: string }): { key: string } | undefined => { const parentKey = key.substring(0, key.length - 1); return parentKey ? new Key(parentKey) : undefined; }, @@ -672,7 +672,7 @@ suite('ExtHostTreeView', function () { return parent; } - function getChildren(key: string): string[] { + function getChildren(key: string | undefined): string[] { if (!key) { return Object.keys(tree); } diff --git a/src/vs/workbench/test/electron-browser/api/mainThreadConfiguration.test.ts b/src/vs/workbench/test/electron-browser/api/mainThreadConfiguration.test.ts index 4be29bb9ecd..01d75b06fd5 100644 --- a/src/vs/workbench/test/electron-browser/api/mainThreadConfiguration.test.ts +++ b/src/vs/workbench/test/electron-browser/api/mainThreadConfiguration.test.ts @@ -63,7 +63,7 @@ suite('MainThreadConfiguration', function () { instantiationService.stub(IWorkspaceContextService, { getWorkbenchState: () => WorkbenchState.WORKSPACE }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); - testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', null); + testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', undefined); assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); @@ -81,7 +81,7 @@ suite('MainThreadConfiguration', function () { instantiationService.stub(IWorkspaceContextService, { getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); - testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', null); + testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', undefined); assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); @@ -90,7 +90,7 @@ suite('MainThreadConfiguration', function () { instantiationService.stub(IWorkspaceContextService, { getWorkbenchState: () => WorkbenchState.WORKSPACE }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); - testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', null); + testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', undefined); assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); @@ -117,7 +117,7 @@ suite('MainThreadConfiguration', function () { instantiationService.stub(IWorkspaceContextService, { getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); - testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', null); + testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', undefined); assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); @@ -162,7 +162,7 @@ suite('MainThreadConfiguration', function () { instantiationService.stub(IWorkspaceContextService, { getWorkbenchState: () => WorkbenchState.WORKSPACE }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); - testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', null); + testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', undefined); assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); @@ -180,7 +180,7 @@ suite('MainThreadConfiguration', function () { instantiationService.stub(IWorkspaceContextService, { getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); - testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', null); + testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', undefined); assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); @@ -189,7 +189,7 @@ suite('MainThreadConfiguration', function () { instantiationService.stub(IWorkspaceContextService, { getWorkbenchState: () => WorkbenchState.WORKSPACE }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); - testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', null); + testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', undefined); assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); @@ -216,7 +216,7 @@ suite('MainThreadConfiguration', function () { instantiationService.stub(IWorkspaceContextService, { getWorkbenchState: () => WorkbenchState.FOLDER }); const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy)); - testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', null); + testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', undefined); assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]); }); diff --git a/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts b/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts index 049ba68c009..fb0d2c8e3aa 100644 --- a/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts +++ b/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts @@ -100,10 +100,10 @@ suite('MainThreadEditors', () => { textFileService, workbenchEditorService, codeEditorService, - null, + null!, fileService, - null, - null, + null!, + null!, editorGroupService, bulkEditService, new class extends mock() implements IPanelService { From c5e999376f6f30ebe94bfdc838dccd2a9e7424b4 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 1 Mar 2019 20:24:34 -0800 Subject: [PATCH 50/90] Fix strict null error in performance --- .../contrib/performance/electron-browser/startupProfiler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts b/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts index b6c1119841a..dfd9214684a 100644 --- a/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts +++ b/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts @@ -87,7 +87,7 @@ export class StartupProfiler implements IWorkbenchContribution { message: localize('prof.thanks', "Thanks for helping us."), detail: localize('prof.detail.restart', "A final restart is required to continue to use '{0}'. Again, thank you for your contribution.", this._environmentService.appNameLong), primaryButton: localize('prof.restart', "Restart"), - secondaryButton: null + secondaryButton: undefined }).then(() => { // now we are ready to restart this._windowsService.relaunch({ removeArgs }); From 0e6253f84a6f825478d9fd6dc8c457e706202c9d Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sat, 2 Mar 2019 08:25:20 +0100 Subject: [PATCH 51/90] fix #69328 --- src/vs/base/node/storage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/base/node/storage.ts b/src/vs/base/node/storage.ts index 546396f1959..5197db44743 100644 --- a/src/vs/base/node/storage.ts +++ b/src/vs/base/node/storage.ts @@ -352,7 +352,7 @@ export class SQLiteStorageDatabase implements IStorageDatabase { rows.forEach(row => items.set(row.key, row.value)); if (this.logger.isTracing) { - this.logger.trace(`[storage ${this.name}] getItems(): ${mapToString(items)}`); + this.logger.trace(`[storage ${this.name}] getItems(): ${items.size} rows`); } return items; From b0bd70e6d8fd203781389629b326f262642e05cb Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sat, 2 Mar 2019 08:28:44 +0100 Subject: [PATCH 52/90] debt - Buffer requires /node/ layer --- src/tsconfig.strictNullChecks.json | 2 +- .../services/extensions/electron-browser/extensionHost.ts | 2 +- .../workbench/services/extensions/node/extensionHostProcess.ts | 2 +- .../extensions/{common => node}/extensionHostProtocol.ts | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename src/vs/workbench/services/extensions/{common => node}/extensionHostProtocol.ts (100%) diff --git a/src/tsconfig.strictNullChecks.json b/src/tsconfig.strictNullChecks.json index 315d356b476..05f40f7f586 100644 --- a/src/tsconfig.strictNullChecks.json +++ b/src/tsconfig.strictNullChecks.json @@ -340,7 +340,6 @@ "./vs/workbench/services/editor/common/editorGroupsService.ts", "./vs/workbench/services/editor/common/editorService.ts", "./vs/workbench/services/extensionManagement/node/multiExtensionManagement.ts", - "./vs/workbench/services/extensions/common/extensionHostProtocol.ts", "./vs/workbench/services/extensions/common/extensions.ts", "./vs/workbench/services/extensions/common/extensionsRegistry.ts", "./vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts", @@ -350,6 +349,7 @@ "./vs/workbench/services/extensions/node/extensionDescriptionRegistry.ts", "./vs/workbench/services/extensions/node/extensionManagementServerService.ts", "./vs/workbench/services/extensions/node/extensionPoints.ts", + "./vs/workbench/services/extensions/node/extensionHostProtocol.ts", "./vs/workbench/services/extensions/node/lazyPromise.ts", "./vs/workbench/services/extensions/node/proxyIdentifier.ts", "./vs/workbench/services/extensions/node/rpcProtocol.ts", diff --git a/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts b/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts index f889ee4c832..43324615a90 100644 --- a/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts +++ b/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts @@ -33,7 +33,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IWindowService, IWindowsService } from 'vs/platform/windows/common/windows'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IInitData } from 'vs/workbench/api/node/extHost.protocol'; -import { MessageType, createMessageOfType, isMessageOfType } from 'vs/workbench/services/extensions/common/extensionHostProtocol'; +import { MessageType, createMessageOfType, isMessageOfType } from 'vs/workbench/services/extensions/node/extensionHostProtocol'; import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions'; export interface IExtensionHostStarter { diff --git a/src/vs/workbench/services/extensions/node/extensionHostProcess.ts b/src/vs/workbench/services/extensions/node/extensionHostProcess.ts index 484cef96b1c..dab5ec2b636 100644 --- a/src/vs/workbench/services/extensions/node/extensionHostProcess.ts +++ b/src/vs/workbench/services/extensions/node/extensionHostProcess.ts @@ -11,7 +11,7 @@ import { IMessagePassingProtocol } from 'vs/base/parts/ipc/node/ipc'; import { Protocol } from 'vs/base/parts/ipc/node/ipc.net'; import product from 'vs/platform/product/node/product'; import { IInitData } from 'vs/workbench/api/node/extHost.protocol'; -import { MessageType, createMessageOfType, isMessageOfType } from 'vs/workbench/services/extensions/common/extensionHostProtocol'; +import { MessageType, createMessageOfType, isMessageOfType } from 'vs/workbench/services/extensions/node/extensionHostProtocol'; import { exit, ExtensionHostMain } from 'vs/workbench/services/extensions/node/extensionHostMain'; // With Electron 2.x and node.js 8.x the "natives" module diff --git a/src/vs/workbench/services/extensions/common/extensionHostProtocol.ts b/src/vs/workbench/services/extensions/node/extensionHostProtocol.ts similarity index 100% rename from src/vs/workbench/services/extensions/common/extensionHostProtocol.ts rename to src/vs/workbench/services/extensions/node/extensionHostProtocol.ts From ba066625bfb83037f547bb31b67b762be5a948f8 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sat, 2 Mar 2019 08:36:15 +0100 Subject: [PATCH 53/90] :lipstick: --- src/vs/base/common/extpath.ts | 6 +++--- src/vs/base/node/extfs.ts | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/vs/base/common/extpath.ts b/src/vs/base/common/extpath.ts index eaf31396842..ab554f756bf 100644 --- a/src/vs/base/common/extpath.ts +++ b/src/vs/base/common/extpath.ts @@ -6,7 +6,7 @@ import { isWindows } from 'vs/base/common/platform'; import { startsWithIgnoreCase, equalsIgnoreCase } from 'vs/base/common/strings'; import { CharCode } from 'vs/base/common/charCode'; -import { sep } from 'vs/base/common/path'; +import { sep, posix } from 'vs/base/common/path'; function isPathSeparator(code: number) { return code === CharCode.Slash || code === CharCode.Backslash; @@ -18,7 +18,7 @@ function isPathSeparator(code: number) { * Using it on a Linux or MaxOS path might change it. */ export function toSlashes(osPath: string) { - return osPath.replace(/[\\/]/g, '/'); + return osPath.replace(/[\\/]/g, posix.sep); } /** @@ -26,7 +26,7 @@ export function toSlashes(osPath: string) { * `getRoot('files:///files/path') === files:///`, * or `getRoot('\\server\shares\path') === \\server\shares\` */ -export function getRoot(path: string, sep: string = '/'): string { +export function getRoot(path: string, sep: string = posix.sep): string { if (!path) { return ''; diff --git a/src/vs/base/node/extfs.ts b/src/vs/base/node/extfs.ts index 866ba70ddc9..a42ed5d8f95 100644 --- a/src/vs/base/node/extfs.ts +++ b/src/vs/base/node/extfs.ts @@ -219,7 +219,7 @@ export function del(path: string, tmpFolder: string, callback: (error: Error | n } function rmRecursive(path: string, callback: (error: Error | null) => void): void { - if (path === '\\' || path === '/') { + if (path === paths.win32.sep || path === paths.posix.sep) { return callback(new Error('Will not delete root!')); } @@ -277,6 +277,10 @@ function rmRecursive(path: string, callback: (error: Error | null) => void): voi } export function delSync(path: string): void { + if (path === paths.win32.sep || path === paths.posix.sep) { + throw new Error('Will not delete root!'); + } + try { const stat = fs.lstatSync(path); if (stat.isDirectory() && !stat.isSymbolicLink()) { From e4b70bca4a0a40836c7aae2b98ebaca824c488de Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sat, 2 Mar 2019 09:13:33 +0100 Subject: [PATCH 54/90] fix #69334 --- .../editor/common/services/getIconClasses.ts | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/src/vs/editor/common/services/getIconClasses.ts b/src/vs/editor/common/services/getIconClasses.ts index d8f7d5bf122..ca49de2528f 100644 --- a/src/vs/editor/common/services/getIconClasses.ts +++ b/src/vs/editor/common/services/getIconClasses.ts @@ -12,9 +12,11 @@ import { IModelService } from 'vs/editor/common/services/modelService'; import { FileKind } from 'vs/platform/files/common/files'; export function getIconClasses(modelService: IModelService, modeService: IModeService, resource: uri | undefined, fileKind?: FileKind): string[] { + // we always set these base classes even if we do not have a path const classes = fileKind === FileKind.ROOT_FOLDER ? ['rootfolder-icon'] : fileKind === FileKind.FOLDER ? ['folder-icon'] : ['file-icon']; if (resource) { + // Get the path and name of the resource. For data-URIs, we need to parse specially let name: string | undefined; let path: string | undefined; @@ -22,17 +24,19 @@ export function getIconClasses(modelService: IModelService, modeService: IModeSe const metadata = DataUri.parseMetaData(resource); name = metadata.get(DataUri.META_DATA_LABEL); path = name; - } - else { + } else { name = cssEscape(basenameOrAuthority(resource).toLowerCase()); path = resource.path.toLowerCase(); } + // Folders if (fileKind === FileKind.FOLDER) { classes.push(`${name}-name-folder-icon`); } + // Files else { + // Name & Extension(s) if (name) { classes.push(`${name}-name-file-icon`); @@ -42,8 +46,9 @@ export function getIconClasses(modelService: IModelService, modeService: IModeSe } classes.push(`ext-file-icon`); // extra segment to increase file-ext score } + // Configured Language - let configuredLangId: string | null = getConfiguredLangId(modelService, resource); + let configuredLangId: string | null = getConfiguredLangId(modelService, modeService, resource); configuredLangId = configuredLangId || (path ? modeService.getModeIdByFilepathOrFirstLine(path) : null); if (configuredLangId) { classes.push(`${cssEscape(configuredLangId)}-lang-file-icon`); @@ -53,16 +58,32 @@ export function getIconClasses(modelService: IModelService, modeService: IModeSe return classes; } -export function getConfiguredLangId(modelService: IModelService, resource: uri): string | null { +export function getConfiguredLangId(modelService: IModelService, modeService: IModeService, resource: uri): string | null { let configuredLangId: string | null = null; if (resource) { - const model = modelService.getModel(resource); - if (model) { - const modeId = model.getLanguageIdentifier().language; - if (modeId && modeId !== PLAINTEXT_MODE_ID) { - configuredLangId = modeId; // only take if the mode is specific (aka no just plain text) + let modeId: string | null = null; + + // Data URI: check for encoded metadata + if (resource.scheme === Schemas.data) { + const metadata = DataUri.parseMetaData(resource); + const mime = metadata.get(DataUri.META_DATA_MIME); + + if (mime) { + modeId = modeService.getModeId(mime); } } + + // Any other URI: check for model if existing + else { + const model = modelService.getModel(resource); + if (model) { + modeId = model.getLanguageIdentifier().language; + } + } + + if (modeId && modeId !== PLAINTEXT_MODE_ID) { + configuredLangId = modeId; // only take if the mode is specific (aka no just plain text) + } } return configuredLangId; From 4585f69a82082487d317c8854d8aa4d2eee25591 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sat, 23 Feb 2019 15:56:03 +0100 Subject: [PATCH 55/90] fix compile error --- src/vs/workbench/browser/labels.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/browser/labels.ts b/src/vs/workbench/browser/labels.ts index 97f0a3e9d6a..f24e0dee22e 100644 --- a/src/vs/workbench/browser/labels.ts +++ b/src/vs/workbench/browser/labels.ts @@ -386,7 +386,7 @@ class ResourceLabelWidget extends IconLabel { } if (this.label) { - const configuredLangId = this.label.resource ? getConfiguredLangId(this.modelService, this.label.resource) : null; + const configuredLangId = this.label.resource ? getConfiguredLangId(this.modelService, this.modeService, this.label.resource) : null; if (this.lastKnownConfiguredLangId !== configuredLangId) { clearIconCache = true; this.lastKnownConfiguredLangId = configuredLangId || undefined; From 900d58bfe522e812acedf8720076590d853787b3 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sat, 23 Feb 2019 15:56:03 +0100 Subject: [PATCH 56/90] debt - declare more services via registerSingleton() --- src/vs/base/common/path.ts | 47 ++++------- src/vs/base/common/process.ts | 27 +++++++ .../workbench/api/node/extHostDebugService.ts | 2 +- .../codeEditor/browser/selectionClipboard.ts | 1 + .../codeInset.contribution.ts | 2 +- .../workbench/electron-browser/workbench.ts | 80 ------------------- .../electron-browser/broadcastService.ts | 12 ++- .../browser/configurationResolverService.ts | 13 +-- .../common/variableResolver.ts | 3 +- .../configurationResolverService.test.ts | 32 +++++--- .../decorations/browser/decorationsService.ts | 7 +- .../dialogs/electron-browser/dialogService.ts | 2 +- .../editor/browser/codeEditorService.ts | 6 +- .../inactiveExtensionUrlHandler.ts | 3 + .../preferences/browser/preferencesService.ts | 6 +- .../progress/browser/progressService2.ts | 3 + .../services/search/node/searchService.ts | 3 + .../workspace/node/workspaceEditingService.ts | 3 + src/vs/workbench/workbench.main.ts | 33 ++++++++ 19 files changed, 148 insertions(+), 137 deletions(-) create mode 100644 src/vs/base/common/process.ts diff --git a/src/vs/base/common/path.ts b/src/vs/base/common/path.ts index a93084c42b7..844cdd246a9 100644 --- a/src/vs/base/common/path.ts +++ b/src/vs/base/common/path.ts @@ -29,7 +29,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { isWindows } from 'vs/base/common/platform'; +import * as process from 'vs/base/common/process'; const CHAR_UPPERCASE_A = 65;/* A */ const CHAR_LOWERCASE_A = 97; /* a */ @@ -41,19 +41,6 @@ const CHAR_BACKWARD_SLASH = 92; /* \ */ const CHAR_COLON = 58; /* : */ const CHAR_QUESTION_MARK = 63; /* ? */ -interface IProcess { - cwd(): string; - platform: string; - env: object; -} - -declare let process: IProcess; -const safeProcess: IProcess = (typeof process === 'undefined') ? { - cwd() { return '/'; }, - env: {}, - get platform() { return isWindows ? 'win32' : 'posix'; } -} : process; - class ErrorInvalidArgType extends Error { code: 'ERR_INVALID_ARG_TYPE'; constructor(name: string, expected: string, actual: string) { @@ -219,14 +206,14 @@ export const win32: IPath = { if (i >= 0) { path = pathSegments[i]; } else if (!resolvedDevice) { - path = safeProcess.cwd(); + path = process.cwd(); } else { // Windows has the concept of drive-specific current working // directories. If we've resolved a drive letter but not yet an // absolute path, get cwd for that drive, or the process cwd if // the drive cwd is not available. We're sure the device is not // a UNC path at this points, because UNC paths are always absolute. - path = safeProcess.env['=' + resolvedDevice] || safeProcess.cwd(); + path = process.env['=' + resolvedDevice] || process.cwd(); // Verify that a cwd was found and that it actually points // to our drive. If not, default to the drive's root. @@ -1208,7 +1195,7 @@ export const posix: IPath = { path = pathSegments[i]; } else { - path = safeProcess.cwd(); + path = process.cwd(); } validateString(path, 'path'); @@ -1682,16 +1669,16 @@ export const posix: IPath = { posix.win32 = win32.win32 = win32; posix.posix = win32.posix = posix; -export const normalize = (safeProcess.platform === 'win32' ? win32.normalize : posix.normalize); -export const isAbsolute = (safeProcess.platform === 'win32' ? win32.isAbsolute : posix.isAbsolute); -export const join = (safeProcess.platform === 'win32' ? win32.join : posix.join); -export const resolve = (safeProcess.platform === 'win32' ? win32.resolve : posix.resolve); -export const relative = (safeProcess.platform === 'win32' ? win32.relative : posix.relative); -export const dirname = (safeProcess.platform === 'win32' ? win32.dirname : posix.dirname); -export const basename = (safeProcess.platform === 'win32' ? win32.basename : posix.basename); -export const extname = (safeProcess.platform === 'win32' ? win32.extname : posix.extname); -export const format = (safeProcess.platform === 'win32' ? win32.format : posix.format); -export const parse = (safeProcess.platform === 'win32' ? win32.parse : posix.parse); -export const toNamespacedPath = (safeProcess.platform === 'win32' ? win32.toNamespacedPath : posix.toNamespacedPath); -export const sep = (safeProcess.platform === 'win32' ? win32.sep : posix.sep); -export const delimiter = (safeProcess.platform === 'win32' ? win32.delimiter : posix.delimiter); +export const normalize = (process.platform === 'win32' ? win32.normalize : posix.normalize); +export const isAbsolute = (process.platform === 'win32' ? win32.isAbsolute : posix.isAbsolute); +export const join = (process.platform === 'win32' ? win32.join : posix.join); +export const resolve = (process.platform === 'win32' ? win32.resolve : posix.resolve); +export const relative = (process.platform === 'win32' ? win32.relative : posix.relative); +export const dirname = (process.platform === 'win32' ? win32.dirname : posix.dirname); +export const basename = (process.platform === 'win32' ? win32.basename : posix.basename); +export const extname = (process.platform === 'win32' ? win32.extname : posix.extname); +export const format = (process.platform === 'win32' ? win32.format : posix.format); +export const parse = (process.platform === 'win32' ? win32.parse : posix.parse); +export const toNamespacedPath = (process.platform === 'win32' ? win32.toNamespacedPath : posix.toNamespacedPath); +export const sep = (process.platform === 'win32' ? win32.sep : posix.sep); +export const delimiter = (process.platform === 'win32' ? win32.delimiter : posix.delimiter); diff --git a/src/vs/base/common/process.ts b/src/vs/base/common/process.ts new file mode 100644 index 00000000000..386ad29df56 --- /dev/null +++ b/src/vs/base/common/process.ts @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { isWindows, isMacintosh, setImmediate } from 'vs/base/common/platform'; + +interface IProcess { + platform: string; + env: object; + + cwd(): string; + nextTick(callback: (...args: any[]) => void): number; +} + +declare let 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): number { return setImmediate(callback); } +} : process; + +export const cwd = safeProcess.cwd; +export const env = safeProcess.env; +export const platform = safeProcess.platform; +export const nextTick = safeProcess.nextTick; diff --git a/src/vs/workbench/api/node/extHostDebugService.ts b/src/vs/workbench/api/node/extHostDebugService.ts index 32d93fbbf95..c593cb4bf65 100644 --- a/src/vs/workbench/api/node/extHostDebugService.ts +++ b/src/vs/workbench/api/node/extHostDebugService.ts @@ -909,7 +909,7 @@ export class ExtHostVariableResolverService extends AbstractVariableResolverServ } return undefined; } - }); + }, process.env); } } diff --git a/src/vs/workbench/contrib/codeEditor/browser/selectionClipboard.ts b/src/vs/workbench/contrib/codeEditor/browser/selectionClipboard.ts index a1f46f8ff1d..4c3a8ba75ff 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/selectionClipboard.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/selectionClipboard.ts @@ -5,6 +5,7 @@ import { RunOnceScheduler } from 'vs/base/common/async'; import { Disposable } from 'vs/base/common/lifecycle'; +import * as process from 'vs/base/common/process'; import * as platform from 'vs/base/common/platform'; import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser'; import { registerEditorContribution } from 'vs/editor/browser/editorExtensions'; diff --git a/src/vs/workbench/contrib/codeinset/electron-browser/codeInset.contribution.ts b/src/vs/workbench/contrib/codeinset/electron-browser/codeInset.contribution.ts index bce7c3f7d4f..a0369eaff5e 100644 --- a/src/vs/workbench/contrib/codeinset/electron-browser/codeInset.contribution.ts +++ b/src/vs/workbench/contrib/codeinset/electron-browser/codeInset.contribution.ts @@ -309,7 +309,7 @@ export class CodeInsetController implements editorCommon.IEditorContribution { const widgetPromises = widgetRequests.map(request => { if (request.resolved) { - return Promise.resolve(void 0); + return Promise.resolve(undefined); } let a = new Promise(resolve => { this._pendingWebviews.set(request.symbol.id, element => { diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index 7445d7b6645..c1e45f78c1c 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -44,33 +44,23 @@ import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/c import { IActivityService } from 'vs/workbench/services/activity/common/activity'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IFileService } from 'vs/platform/files/common/files'; -import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { ITitleService } from 'vs/workbench/services/title/common/titleService'; import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen'; -import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { IHistoryService } from 'vs/workbench/services/history/common/history'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { TextFileService } from 'vs/workbench/services/textfile/common/textFileService'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; -import { IProgressService2 } from 'vs/platform/progress/common/progress'; -import { ProgressService2 } from 'vs/workbench/services/progress/browser/progressService2'; import { TextModelResolverService } from 'vs/workbench/services/textmodelResolver/common/textModelResolverService'; import { ITextModelService } from 'vs/editor/common/services/resolverService'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { LifecyclePhase, StartupKind, ILifecycleService, WillShutdownEvent } from 'vs/platform/lifecycle/common/lifecycle'; import { IWindowService, IWindowConfiguration, IPath, MenuBarVisibility, getTitleBarStyle, IWindowsService } from 'vs/platform/windows/common/windows'; import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar'; -import { IMenuService } from 'vs/platform/actions/common/actions'; -import { MenuService } from 'vs/platform/actions/common/menuService'; import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; -import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing'; -import { FileDecorationsService } from 'vs/workbench/services/decorations/browser/decorationsService'; -import { IDecorationsService } from 'vs/workbench/services/decorations/browser/decorations'; import { ActivityService } from 'vs/workbench/services/activity/browser/activityService'; -import { IListService, ListService } from 'vs/platform/list/browser/listService'; import { IViewsService } from 'vs/workbench/common/views'; import { ViewsService } from 'vs/workbench/browser/parts/views/views'; import { INotificationService } from 'vs/platform/notification/common/notification'; @@ -102,34 +92,21 @@ import { LabelService } from 'vs/workbench/services/label/common/labelService'; import { ITelemetryServiceConfig, TelemetryService } from 'vs/platform/telemetry/common/telemetryService'; import { combinedAppender, LogAppender, NullTelemetryService, configurationTelemetry } from 'vs/platform/telemetry/common/telemetryUtils'; import ErrorTelemetry from 'vs/platform/telemetry/browser/errorTelemetry'; -import { IDownloadService } from 'vs/platform/download/common/download'; import { IExtensionGalleryService, IExtensionManagementServerService, IExtensionManagementService, IExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionManagement'; import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver'; import { ExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionEnablementService'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { CommandService } from 'vs/workbench/services/commands/common/commandService'; -import { IMarkerService } from 'vs/platform/markers/common/markers'; -import { MarkerService } from 'vs/platform/markers/common/markerService'; import { IModeService } from 'vs/editor/common/services/modeService'; import { WorkbenchModeServiceImpl } from 'vs/workbench/services/mode/common/workbenchModeService'; import { ITextResourceConfigurationService, ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration'; import { TextResourceConfigurationService } from 'vs/editor/common/services/resourceConfigurationImpl'; import { IModelService } from 'vs/editor/common/services/modelService'; import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl'; -import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDecorationService'; -import { MarkerDecorationsService } from 'vs/editor/common/services/markerDecorationsServiceImpl'; -import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService'; -import { EditorWorkerServiceImpl } from 'vs/editor/common/services/editorWorkerServiceImpl'; import { IUntitledEditorService, UntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService'; -import { ISearchService } from 'vs/workbench/services/search/common/search'; -import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; -import { CodeEditorService } from 'vs/workbench/services/editor/browser/codeEditorService'; -import { IOpenerService } from 'vs/platform/opener/common/opener'; -import { OpenerService } from 'vs/editor/browser/services/openerService'; import { ILocalizationsService } from 'vs/platform/localizations/common/localizations'; import { HistoryService } from 'vs/workbench/services/history/browser/history'; -import { ConfigurationResolverService } from 'vs/workbench/services/configurationResolver/browser/configurationResolverService'; import { WorkbenchThemeService } from 'vs/workbench/services/themes/browser/workbenchThemeService'; import { IProductService } from 'vs/platform/product/common/product'; import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; @@ -139,14 +116,12 @@ import { WorkbenchContextKeysHandler } from 'vs/workbench/browser/contextkeys'; import { BackupFileService, InMemoryBackupFileService } from 'vs/workbench/services/backup/node/backupFileService'; import { WorkspaceService } from 'vs/workbench/services/configuration/node/configurationService'; import { JSONEditingService } from 'vs/workbench/services/configuration/node/jsonEditingService'; -import { WorkspaceEditingService } from 'vs/workbench/services/workspace/node/workspaceEditingService'; import { getDelayedChannel } from 'vs/base/parts/ipc/node/ipc'; import { connect as connectNet } from 'vs/base/parts/ipc/node/ipc.net'; import { DialogChannel } from 'vs/platform/dialogs/node/dialogIpc'; import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc'; import { resolveWorkbenchCommonProperties } from 'vs/platform/telemetry/node/workbenchCommonProperties'; import { IRequestService } from 'vs/platform/request/node/request'; -import { DownloadService } from 'vs/platform/download/node/downloadService'; import { ExtensionGalleryService } from 'vs/platform/extensionManagement/node/extensionGalleryService'; import { IRemoteAgentService } from 'vs/workbench/services/remote/node/remoteAgentService'; import { DownloadServiceChannel } from 'vs/platform/download/node/downloadIpc'; @@ -154,7 +129,6 @@ import { LogLevelSetterChannel } from 'vs/platform/log/node/logIpc'; import { ExtensionManagementChannelClient } from 'vs/platform/extensionManagement/node/extensionManagementIpc'; import { ExtensionManagementServerService } from 'vs/workbench/services/extensions/node/extensionManagementServerService'; import { MultiExtensionManagementService } from 'vs/workbench/services/extensionManagement/node/multiExtensionManagement'; -import { SearchService } from 'vs/workbench/services/search/node/searchService'; import { LocalizationsChannelClient } from 'vs/platform/localizations/node/localizationsIpc'; import { AccessibilityService } from 'vs/platform/accessibility/node/accessibilityService'; import { ProductService } from 'vs/platform/product/node/productService'; @@ -164,11 +138,8 @@ import { RemoteFileService } from 'vs/workbench/services/files/node/remoteFileSe // import@electron-browser import { ContextMenuService as NativeContextMenuService } from 'vs/workbench/services/contextmenu/electron-browser/contextmenuService'; import { WorkbenchKeybindingService } from 'vs/workbench/services/keybinding/electron-browser/keybindingService'; -import { ClipboardService } from 'vs/platform/clipboard/electron-browser/clipboardService'; import { LifecycleService } from 'vs/platform/lifecycle/electron-browser/lifecycleService'; -import { IExtensionUrlHandler, ExtensionUrlHandler } from 'vs/workbench/services/extensions/electron-browser/inactiveExtensionUrlHandler'; import { DialogService, FileDialogService } from 'vs/workbench/services/dialogs/electron-browser/dialogService'; -import { IBroadcastService, BroadcastService } from 'vs/workbench/services/broadcast/electron-browser/broadcastService'; import { WindowService } from 'vs/platform/windows/electron-browser/windowService'; import { RemoteAuthorityResolverService } from 'vs/platform/remote/electron-browser/remoteAuthorityResolverService'; import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl'; @@ -466,12 +437,6 @@ export class Workbench extends Disposable implements IPartService { // Labels serviceCollection.set(ILabelService, new SyncDescriptor(LabelService, undefined, true)); - // Clipboard - serviceCollection.set(IClipboardService, new SyncDescriptor(ClipboardService, undefined, true)); - - // Broadcast - serviceCollection.set(IBroadcastService, new SyncDescriptor(BroadcastService, [this.configuration.windowId], true)); - // Notifications this.notificationService = new NotificationService(); serviceCollection.set(INotificationService, this.notificationService); @@ -527,9 +492,6 @@ export class Workbench extends Disposable implements IPartService { // Request Service serviceCollection.set(IRequestService, new SyncDescriptor(RequestService, undefined, true)); - // Download Service - serviceCollection.set(IDownloadService, new SyncDescriptor(DownloadService, undefined, true)); - // Extension Gallery serviceCollection.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService, undefined, true)); @@ -567,9 +529,6 @@ export class Workbench extends Disposable implements IPartService { // Commands serviceCollection.set(ICommandService, new SyncDescriptor(CommandService, undefined, true)); - // Markers - serviceCollection.set(IMarkerService, new SyncDescriptor(MarkerService, undefined, true)); - // Editor Mode serviceCollection.set(IModeService, new SyncDescriptor(WorkbenchModeServiceImpl)); @@ -582,38 +541,17 @@ export class Workbench extends Disposable implements IPartService { // Editor Models serviceCollection.set(IModelService, new SyncDescriptor(ModelServiceImpl, undefined, true)); - // Marker Decorations - serviceCollection.set(IMarkerDecorationsService, new SyncDescriptor(MarkerDecorationsService)); - - // Editor Worker - serviceCollection.set(IEditorWorkerService, new SyncDescriptor(EditorWorkerServiceImpl)); - // Untitled Editors serviceCollection.set(IUntitledEditorService, new SyncDescriptor(UntitledEditorService, undefined, true)); - // Search - serviceCollection.set(ISearchService, new SyncDescriptor(SearchService)); - - // Code Editor - serviceCollection.set(ICodeEditorService, new SyncDescriptor(CodeEditorService, undefined, true)); - - // Opener - serviceCollection.set(IOpenerService, new SyncDescriptor(OpenerService, undefined, true)); - // Localization const localizationsChannel = getDelayedChannel(sharedProcess.then(c => c.getChannel('localizations'))); serviceCollection.set(ILocalizationsService, new SyncDescriptor(LocalizationsChannelClient, [localizationsChannel])); - // Hash - // serviceCollection.set(IHashService, new SyncDescriptor(HashService, undefined, true)); - // Status bar this.statusbarPart = this.instantiationService.createInstance(StatusbarPart, Identifiers.STATUSBAR_PART); serviceCollection.set(IStatusbarService, this.statusbarPart); - // Progress 2 - serviceCollection.set(IProgressService2, new SyncDescriptor(ProgressService2)); - // Context Keys this.contextKeyService = this.instantiationService.createInstance(ContextKeyService); serviceCollection.set(IContextKeyService, this.contextKeyService); @@ -622,9 +560,6 @@ export class Workbench extends Disposable implements IPartService { this.keybindingService = this.instantiationService.createInstance(WorkbenchKeybindingService, window); serviceCollection.set(IKeybindingService, this.keybindingService); - // List - serviceCollection.set(IListService, this.instantiationService.createInstance(ListService)); - // Context view service this.contextViewService = this.instantiationService.createInstance(ContextViewService, this.workbench); serviceCollection.set(IContextViewService, this.contextViewService); @@ -636,9 +571,6 @@ export class Workbench extends Disposable implements IPartService { serviceCollection.set(IContextMenuService, new SyncDescriptor(NativeContextMenuService)); } - // Menus/Actions - serviceCollection.set(IMenuService, new SyncDescriptor(MenuService, undefined, true)); - // Sidebar part this.sidebarPart = this.instantiationService.createInstance(SidebarPart, Identifiers.SIDEBAR_PART); @@ -693,24 +625,12 @@ export class Workbench extends Disposable implements IPartService { // Text File Service serviceCollection.set(ITextFileService, new SyncDescriptor(TextFileService)); - // File Decorations - serviceCollection.set(IDecorationsService, new SyncDescriptor(FileDecorationsService)); - - // Inactive extension URL handler - serviceCollection.set(IExtensionUrlHandler, new SyncDescriptor(ExtensionUrlHandler)); - // Text Model Resolver Service serviceCollection.set(ITextModelService, new SyncDescriptor(TextModelResolverService, undefined, true)); // JSON Editing serviceCollection.set(IJSONEditingService, new SyncDescriptor(JSONEditingService, undefined, true)); - // Workspace Editing - serviceCollection.set(IWorkspaceEditingService, new SyncDescriptor(WorkspaceEditingService, undefined, true)); - - // Configuration Resolver - serviceCollection.set(IConfigurationResolverService, new SyncDescriptor(ConfigurationResolverService, [process.env], true)); - // Quick open service (quick open controller) this.quickOpen = this.instantiationService.createInstance(QuickOpenController); serviceCollection.set(IQuickOpenService, this.quickOpen); diff --git a/src/vs/workbench/services/broadcast/electron-browser/broadcastService.ts b/src/vs/workbench/services/broadcast/electron-browser/broadcastService.ts index a22264520c3..8c1b3c9f6aa 100644 --- a/src/vs/workbench/services/broadcast/electron-browser/broadcastService.ts +++ b/src/vs/workbench/services/broadcast/electron-browser/broadcastService.ts @@ -8,6 +8,8 @@ import { Event, Emitter } from 'vs/base/common/event'; import { ipcRenderer as ipc } from 'electron'; import { ILogService } from 'vs/platform/log/common/log'; import { Disposable } from 'vs/base/common/lifecycle'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; +import { IWindowService } from 'vs/platform/windows/common/windows'; export const IBroadcastService = createDecorator('broadcastService'); @@ -30,12 +32,16 @@ export class BroadcastService extends Disposable implements IBroadcastService { private readonly _onBroadcast: Emitter = this._register(new Emitter()); get onBroadcast(): Event { return this._onBroadcast.event; } + private windowId: number; + constructor( - private windowId: number, + @IWindowService readonly windowService: IWindowService, @ILogService private readonly logService: ILogService ) { super(); + this.windowId = windowService.getCurrentWindowId(); + this.registerListeners(); } @@ -55,4 +61,6 @@ export class BroadcastService extends Disposable implements IBroadcastService { payload: b.payload }); } -} \ No newline at end of file +} + +registerSingleton(IBroadcastService, BroadcastService, true); \ No newline at end of file diff --git a/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts b/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts index 24b3264415f..71aa1fd6d00 100644 --- a/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts +++ b/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts @@ -6,7 +6,6 @@ import { URI as uri } from 'vs/base/common/uri'; import * as nls from 'vs/nls'; import * as path from 'vs/base/common/path'; -import * as platform from 'vs/base/common/platform'; import * as Types from 'vs/base/common/types'; import { Schemas } from 'vs/base/common/network'; import { toResource } from 'vs/workbench/common/editor'; @@ -20,14 +19,16 @@ import { AbstractVariableResolverService } from 'vs/workbench/services/configura import { isCodeEditor } from 'vs/editor/browser/editorBrowser'; import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput'; import { IQuickInputService, IInputOptions, IQuickPickItem, IPickOptions } from 'vs/platform/quickinput/common/quickInput'; -import { ConfiguredInput } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; +import { ConfiguredInput, IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; +import { IWindowService } from 'vs/platform/windows/common/windows'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class ConfigurationResolverService extends AbstractVariableResolverService { static INPUT_OR_COMMAND_VARIABLES_PATTERN = /\${((input|command):(.*?))}/g; constructor( - envVariables: platform.IProcessEnvironment, + @IWindowService windowService: IWindowService, @IEditorService editorService: IEditorService, @IEnvironmentService environmentService: IEnvironmentService, @IConfigurationService private readonly configurationService: IConfigurationService, @@ -79,7 +80,7 @@ export class ConfigurationResolverService extends AbstractVariableResolverServic } return undefined; } - }, envVariables); + }, windowService.getConfiguration().userEnv); } public resolveWithInteractionReplace(folder: IWorkspaceFolder, config: any, section?: string, variables?: IStringDictionary): Promise { @@ -287,4 +288,6 @@ export class ConfigurationResolverService extends AbstractVariableResolverServic } return Promise.reject(new Error(nls.localize('inputVariable.undefinedVariable', "Undefined input variable '{0}' encountered. Remove or define '{0}' to continue.", variable))); } -} \ No newline at end of file +} + +registerSingleton(IConfigurationResolverService, ConfigurationResolverService, true); \ No newline at end of file diff --git a/src/vs/workbench/services/configurationResolver/common/variableResolver.ts b/src/vs/workbench/services/configurationResolver/common/variableResolver.ts index 88d1c2de2f0..82e83a3c2cd 100644 --- a/src/vs/workbench/services/configurationResolver/common/variableResolver.ts +++ b/src/vs/workbench/services/configurationResolver/common/variableResolver.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as paths from 'vs/base/common/path'; +import * as process from 'vs/base/common/process'; import * as types from 'vs/base/common/types'; import * as objects from 'vs/base/common/objects'; import { IStringDictionary } from 'vs/base/common/collections'; @@ -32,7 +33,7 @@ export class AbstractVariableResolverService implements IConfigurationResolverSe constructor( private _context: IVariableResolveContext, - private _envVariables: IProcessEnvironment = process.env + private _envVariables: IProcessEnvironment ) { if (isWindows) { this._envVariables = Object.create(null); 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 af81556238a..4fc62f2dfbc 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 @@ -11,16 +11,18 @@ import { ICommandService } from 'vs/platform/commands/common/commands'; import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; import { ConfigurationResolverService } from 'vs/workbench/services/configurationResolver/browser/configurationResolverService'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; -import { TestEnvironmentService, TestEditorService, TestContextService } from 'vs/workbench/test/workbenchTestServices'; +import { TestEnvironmentService, TestEditorService, TestContextService, TestWindowService } from 'vs/workbench/test/workbenchTestServices'; import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; import { Disposable } from 'vs/base/common/lifecycle'; import { IQuickInputService, IQuickPickItem, QuickPickInput, IPickOptions, Omit, IInputOptions, IQuickInputButton, IQuickPick, IInputBox, IQuickNavigateConfiguration } from 'vs/platform/quickinput/common/quickInput'; import { CancellationToken } from 'vs/base/common/cancellation'; import * as Types from 'vs/base/common/types'; +import { IWindowService, IWindowConfiguration } from 'vs/platform/windows/common/windows'; suite('Configuration Resolver Service', () => { let configurationResolverService: IConfigurationResolverService | null; let envVariables: { [key: string]: string } = { key1: 'Value for key1', key2: 'Value for key2' }; + let windowService: IWindowService; let mockCommandService: MockCommandService; let editorService: TestEditorService; let workspace: IWorkspaceFolder; @@ -30,13 +32,14 @@ suite('Configuration Resolver Service', () => { mockCommandService = new MockCommandService(); editorService = new TestEditorService(); quickInputService = new MockQuickInputService(); + windowService = new MockWindowService(envVariables); workspace = { uri: uri.parse('file:///VSCode/workspaceLocation'), name: 'hey', index: 0, toResource: () => null }; - configurationResolverService = new ConfigurationResolverService(envVariables, editorService, TestEnvironmentService, new MockInputsConfigurationService(), mockCommandService, new TestContextService(), quickInputService); + configurationResolverService = new ConfigurationResolverService(windowService, editorService, TestEnvironmentService, new MockInputsConfigurationService(), mockCommandService, new TestContextService(), quickInputService); }); teardown(() => { @@ -120,7 +123,7 @@ suite('Configuration Resolver Service', () => { } }); - let service = new ConfigurationResolverService(envVariables, new TestEditorService(), TestEnvironmentService, configurationService, mockCommandService, new TestContextService(), quickInputService); + let service = new ConfigurationResolverService(windowService, new TestEditorService(), TestEnvironmentService, configurationService, mockCommandService, new TestContextService(), quickInputService); assert.strictEqual(service.resolve(workspace, 'abc ${config:editor.fontFamily} xyz'), 'abc foo xyz'); }); @@ -137,7 +140,7 @@ suite('Configuration Resolver Service', () => { } }); - let service = new ConfigurationResolverService(envVariables, new TestEditorService(), TestEnvironmentService, configurationService, mockCommandService, new TestContextService(), quickInputService); + let service = new ConfigurationResolverService(windowService, new TestEditorService(), TestEnvironmentService, configurationService, mockCommandService, new TestContextService(), quickInputService); assert.strictEqual(service.resolve(workspace, 'abc ${config:editor.fontFamily} ${config:terminal.integrated.fontFamily} xyz'), 'abc foo bar xyz'); }); @@ -154,7 +157,7 @@ suite('Configuration Resolver Service', () => { } }); - let service = new ConfigurationResolverService(envVariables, new TestEditorService(), TestEnvironmentService, configurationService, mockCommandService, new TestContextService(), quickInputService); + let service = new ConfigurationResolverService(windowService, new TestEditorService(), TestEnvironmentService, configurationService, mockCommandService, new TestContextService(), quickInputService); if (platform.isWindows) { assert.strictEqual(service.resolve(workspace, 'abc ${config:editor.fontFamily} ${workspaceFolder} ${env:key1} xyz'), 'abc foo \\VSCode\\workspaceLocation Value for key1 xyz'); } else { @@ -175,7 +178,7 @@ suite('Configuration Resolver Service', () => { } }); - let service = new ConfigurationResolverService(envVariables, new TestEditorService(), TestEnvironmentService, configurationService, mockCommandService, new TestContextService(), quickInputService); + let service = new ConfigurationResolverService(windowService, new TestEditorService(), TestEnvironmentService, configurationService, mockCommandService, new TestContextService(), quickInputService); if (platform.isWindows) { assert.strictEqual(service.resolve(workspace, '${config:editor.fontFamily} ${config:terminal.integrated.fontFamily} ${workspaceFolder} - ${workspaceFolder} ${env:key1} - ${env:key2}'), 'foo bar \\VSCode\\workspaceLocation - \\VSCode\\workspaceLocation Value for key1 - Value for key2'); } else { @@ -209,7 +212,7 @@ suite('Configuration Resolver Service', () => { } }); - let service = new ConfigurationResolverService(envVariables, new TestEditorService(), TestEnvironmentService, configurationService, mockCommandService, new TestContextService(), quickInputService); + let service = new ConfigurationResolverService(windowService, new TestEditorService(), TestEnvironmentService, configurationService, mockCommandService, new TestContextService(), quickInputService); assert.strictEqual(service.resolve(workspace, 'abc ${config:editor.fontFamily} ${config:editor.lineNumbers} ${config:editor.insertSpaces} xyz'), 'abc foo 123 false xyz'); }); @@ -219,7 +222,7 @@ suite('Configuration Resolver Service', () => { editor: {} }); - let service = new ConfigurationResolverService(envVariables, new TestEditorService(), TestEnvironmentService, configurationService, mockCommandService, new TestContextService(), quickInputService); + let service = new ConfigurationResolverService(windowService, new TestEditorService(), TestEnvironmentService, configurationService, mockCommandService, new TestContextService(), quickInputService); assert.strictEqual(service.resolve(workspace, 'abc ${unknownVariable} xyz'), 'abc ${unknownVariable} xyz'); assert.strictEqual(service.resolve(workspace, 'abc ${env:unknownVariable} xyz'), 'abc xyz'); }); @@ -232,7 +235,7 @@ suite('Configuration Resolver Service', () => { } }); - let service = new ConfigurationResolverService(envVariables, new TestEditorService(), TestEnvironmentService, configurationService, mockCommandService, new TestContextService(), quickInputService); + let service = new ConfigurationResolverService(windowService, new TestEditorService(), TestEnvironmentService, configurationService, mockCommandService, new TestContextService(), quickInputService); assert.throws(() => service.resolve(workspace, 'abc ${env} xyz')); assert.throws(() => service.resolve(workspace, 'abc ${env:} xyz')); @@ -611,3 +614,14 @@ class MockInputsConfigurationService extends TestConfigurationService { return configuration; } } + +class MockWindowService extends TestWindowService { + + constructor(private env: platform.IProcessEnvironment) { + super(); + } + + getConfiguration(): IWindowConfiguration { + return { userEnv: this.env } as IWindowConfiguration; + } +} diff --git a/src/vs/workbench/services/decorations/browser/decorationsService.ts b/src/vs/workbench/services/decorations/browser/decorationsService.ts index e0ef2f3814f..5b3859f5fd8 100644 --- a/src/vs/workbench/services/decorations/browser/decorationsService.ts +++ b/src/vs/workbench/services/decorations/browser/decorationsService.ts @@ -18,6 +18,7 @@ import { isFalsyOrWhitespace } from 'vs/base/common/strings'; import { localize } from 'vs/nls'; import { isPromiseCanceledError } from 'vs/base/common/errors'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; class DecorationRule { @@ -353,8 +354,7 @@ export class FileDecorationsService implements IDecorationsService { ); constructor( - @IThemeService themeService: IThemeService, - cleanUpCount: number = 17 + @IThemeService themeService: IThemeService ) { this._decorationStyles = new DecorationStyles(themeService); @@ -362,7 +362,7 @@ export class FileDecorationsService implements IDecorationsService { // css styles that we don't need anymore let count = 0; let reg = this.onDidChangeDecorations(() => { - if (++count % cleanUpCount === 0) { + if (++count % 17 === 0) { this._decorationStyles.cleanUp(this._data.iterator()); } }); @@ -442,3 +442,4 @@ function getColor(theme: ITheme, color: string | undefined) { return 'inherit'; } +registerSingleton(IDecorationsService, FileDecorationsService); \ No newline at end of file diff --git a/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts b/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts index 4d16b57ee49..cec0ec1ff07 100644 --- a/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts +++ b/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts @@ -362,7 +362,7 @@ export class FileDialogService implements IFileDialogService { if (urisToOpen) { return this.windowService.openWindow(urisToOpen, { forceNewWindow, forceOpenWorkspaceAsFile }); } - return void 0; + return undefined; }); } diff --git a/src/vs/workbench/services/editor/browser/codeEditorService.ts b/src/vs/workbench/services/editor/browser/codeEditorService.ts index 0c98821626b..fe5bb0a5372 100644 --- a/src/vs/workbench/services/editor/browser/codeEditorService.ts +++ b/src/vs/workbench/services/editor/browser/codeEditorService.ts @@ -10,6 +10,8 @@ import { IResourceInput } from 'vs/platform/editor/common/editor'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { TextEditorOptions } from 'vs/workbench/common/editor'; import { ACTIVE_GROUP, IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; +import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class CodeEditorService extends CodeEditorServiceImpl { @@ -72,4 +74,6 @@ export class CodeEditorService extends CodeEditorServiceImpl { return null; }); } -} \ No newline at end of file +} + +registerSingleton(ICodeEditorService, CodeEditorService, true); \ No newline at end of file diff --git a/src/vs/workbench/services/extensions/electron-browser/inactiveExtensionUrlHandler.ts b/src/vs/workbench/services/extensions/electron-browser/inactiveExtensionUrlHandler.ts index 80700c6aa9a..2713af6dad8 100644 --- a/src/vs/workbench/services/extensions/electron-browser/inactiveExtensionUrlHandler.ts +++ b/src/vs/workbench/services/extensions/electron-browser/inactiveExtensionUrlHandler.ts @@ -17,6 +17,7 @@ import { IURLHandler, IURLService } from 'vs/platform/url/common/url'; import { IWindowService } from 'vs/platform/windows/common/windows'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; const FIVE_MINUTES = 5 * 60 * 1000; const THIRTY_SECONDS = 30 * 1000; @@ -271,3 +272,5 @@ export class ExtensionUrlHandler implements IExtensionUrlHandler, IURLHandler { this.uriBuffer.clear(); } } + +registerSingleton(IExtensionUrlHandler, ExtensionUrlHandler); \ No newline at end of file diff --git a/src/vs/workbench/services/preferences/browser/preferencesService.ts b/src/vs/workbench/services/preferences/browser/preferencesService.ts index ee6c999089f..9646b53859d 100644 --- a/src/vs/workbench/services/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/services/preferences/browser/preferencesService.ts @@ -45,7 +45,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic private lastOpenedSettingsInput: PreferencesEditorInput | null = null; - private readonly _onDispose = new Emitter(); + private readonly _onDispose = this._register(new Emitter()); private _defaultUserSettingsUriCounter = 0; private _defaultUserSettingsContentModel: DefaultSettings; @@ -74,14 +74,14 @@ export class PreferencesService extends Disposable implements IPreferencesServic super(); // The default keybindings.json updates based on keyboard layouts, so here we make sure // if a model has been given out we update it accordingly. - keybindingService.onDidUpdateKeybindings(() => { + this._register(keybindingService.onDidUpdateKeybindings(() => { const model = modelService.getModel(this.defaultKeybindingsResource); if (!model) { // model has not been given out => nothing to do return; } modelService.updateModel(model, defaultKeybindingsContents(keybindingService)); - }); + })); } readonly defaultKeybindingsResource = URI.from({ scheme: network.Schemas.vscode, authority: 'defaultsettings', path: '/keybindings.json' }); diff --git a/src/vs/workbench/services/progress/browser/progressService2.ts b/src/vs/workbench/services/progress/browser/progressService2.ts index da77ec66b8d..f61446ca4b9 100644 --- a/src/vs/workbench/services/progress/browser/progressService2.ts +++ b/src/vs/workbench/services/progress/browser/progressService2.ts @@ -15,6 +15,7 @@ import { ProgressBadge, IActivityService } from 'vs/workbench/services/activity/ import { INotificationService, Severity, INotificationHandle, INotificationActions } from 'vs/platform/notification/common/notification'; import { Action } from 'vs/base/common/actions'; import { Event } from 'vs/base/common/event'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class ProgressService2 implements IProgressService2 { @@ -267,3 +268,5 @@ export class ProgressService2 implements IProgressService2 { return promise; } } + +registerSingleton(IProgressService2, ProgressService2, true); \ No newline at end of file diff --git a/src/vs/workbench/services/search/node/searchService.ts b/src/vs/workbench/services/search/node/searchService.ts index 3eaafa4f31e..a61f1d7a986 100644 --- a/src/vs/workbench/services/search/node/searchService.ts +++ b/src/vs/workbench/services/search/node/searchService.ts @@ -29,6 +29,7 @@ import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/un import { IRawSearchService, ISerializedFileMatch, ISerializedSearchComplete, ISerializedSearchProgressItem, isSerializedSearchComplete, isSerializedSearchSuccess } from './search'; import { SearchChannelClient } from './searchIpc'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class SearchService extends Disposable implements ISearchService { _serviceBrand: any; @@ -586,3 +587,5 @@ export class DiskSearch implements ISearchResultProvider { return this.raw.clearCache(cacheKey); } } + +registerSingleton(ISearchService, SearchService, true); \ No newline at end of file diff --git a/src/vs/workbench/services/workspace/node/workspaceEditingService.ts b/src/vs/workbench/services/workspace/node/workspaceEditingService.ts index c91fa335414..a1884b928a5 100644 --- a/src/vs/workbench/services/workspace/node/workspaceEditingService.ts +++ b/src/vs/workbench/services/workspace/node/workspaceEditingService.ts @@ -26,6 +26,7 @@ import { isEqual, basename } from 'vs/base/common/resources'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; import { IFileService } from 'vs/platform/files/common/files'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class WorkspaceEditingService implements IWorkspaceEditingService { @@ -329,3 +330,5 @@ export class WorkspaceEditingService implements IWorkspaceEditingService { return this.jsonEditingService.write(toWorkspace.configPath, { key: 'settings', value: targetWorkspaceConfiguration }, true); } } + +registerSingleton(IWorkspaceEditingService, WorkspaceEditingService, true); \ No newline at end of file diff --git a/src/vs/workbench/workbench.main.ts b/src/vs/workbench/workbench.main.ts index cf08e9d08ee..cbf781391bd 100644 --- a/src/vs/workbench/workbench.main.ts +++ b/src/vs/workbench/workbench.main.ts @@ -38,12 +38,45 @@ import 'vs/workbench/api/browser/viewsExtensionPoint'; //#region --- workbench services +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; +import { IMenuService } from 'vs/platform/actions/common/actions'; +import { MenuService } from 'vs/platform/actions/common/menuService'; +import { IListService, ListService } from 'vs/platform/list/browser/listService'; +import { OpenerService } from 'vs/editor/browser/services/openerService'; +import { IOpenerService } from 'vs/platform/opener/common/opener'; +import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService'; +import { EditorWorkerServiceImpl } from 'vs/editor/common/services/editorWorkerServiceImpl'; +import { MarkerDecorationsService } from 'vs/editor/common/services/markerDecorationsServiceImpl'; +import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDecorationService'; +import { IMarkerService } from 'vs/platform/markers/common/markers'; +import { MarkerService } from 'vs/platform/markers/common/markerService'; +import { IDownloadService } from 'vs/platform/download/common/download'; +import { DownloadService } from 'vs/platform/download/node/downloadService'; import 'vs/workbench/services/bulkEdit/browser/bulkEditService'; import 'vs/workbench/services/integrity/node/integrityService'; import 'vs/workbench/services/keybinding/common/keybindingEditing'; import 'vs/workbench/services/hash/node/hashService'; import 'vs/workbench/services/textMate/electron-browser/textMateService'; +import 'vs/workbench/services/configurationResolver/browser/configurationResolverService'; +import 'vs/workbench/services/workspace/node/workspaceEditingService'; +import 'vs/workbench/services/extensions/electron-browser/inactiveExtensionUrlHandler'; +import 'vs/workbench/services/decorations/browser/decorationsService'; +import 'vs/workbench/services/search/node/searchService'; +import 'vs/workbench/services/progress/browser/progressService2'; +import 'vs/workbench/services/editor/browser/codeEditorService'; +import 'vs/workbench/services/broadcast/electron-browser/broadcastService'; +import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; +import { ClipboardService } from 'vs/platform/clipboard/electron-browser/clipboardService'; + +registerSingleton(IMenuService, MenuService, true); +registerSingleton(IListService, ListService, true); +registerSingleton(IOpenerService, OpenerService, true); +registerSingleton(IEditorWorkerService, EditorWorkerServiceImpl); +registerSingleton(IMarkerDecorationsService, MarkerDecorationsService); +registerSingleton(IMarkerService, MarkerService, true); +registerSingleton(IDownloadService, DownloadService, true); +registerSingleton(IClipboardService, ClipboardService, true); //#endregion From 9c1b8851eb7521aecff46d02f4bac15513ef15f3 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sat, 2 Mar 2019 09:50:12 +0100 Subject: [PATCH 57/90] :lipstick: imports --- src/vs/workbench/workbench.main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/workbench.main.ts b/src/vs/workbench/workbench.main.ts index cbf781391bd..178d700f976 100644 --- a/src/vs/workbench/workbench.main.ts +++ b/src/vs/workbench/workbench.main.ts @@ -52,6 +52,8 @@ import { IMarkerService } from 'vs/platform/markers/common/markers'; import { MarkerService } from 'vs/platform/markers/common/markerService'; import { IDownloadService } from 'vs/platform/download/common/download'; import { DownloadService } from 'vs/platform/download/node/downloadService'; +import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; +import { ClipboardService } from 'vs/platform/clipboard/electron-browser/clipboardService'; import 'vs/workbench/services/bulkEdit/browser/bulkEditService'; import 'vs/workbench/services/integrity/node/integrityService'; @@ -66,8 +68,6 @@ import 'vs/workbench/services/search/node/searchService'; import 'vs/workbench/services/progress/browser/progressService2'; import 'vs/workbench/services/editor/browser/codeEditorService'; import 'vs/workbench/services/broadcast/electron-browser/broadcastService'; -import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; -import { ClipboardService } from 'vs/platform/clipboard/electron-browser/clipboardService'; registerSingleton(IMenuService, MenuService, true); registerSingleton(IListService, ListService, true); From 51891b88b917b10af22070c5b6d54491d05fd09e Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sun, 24 Feb 2019 16:56:32 +0100 Subject: [PATCH 58/90] nodeless - set good default zoom factor --- src/vs/base/browser/browser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/base/browser/browser.ts b/src/vs/base/browser/browser.ts index c09210608f3..16414ef34d3 100644 --- a/src/vs/base/browser/browser.ts +++ b/src/vs/base/browser/browser.ts @@ -34,7 +34,7 @@ class WindowManager { } // --- Zoom Factor - private _zoomFactor: number = 0; + private _zoomFactor: number = 1; public getZoomFactor(): number { return this._zoomFactor; From c9ebd2e15a1c3997ed353507c28957ab6dff2b6a Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 26 Feb 2019 15:26:34 +0100 Subject: [PATCH 59/90] nodeless - move window.title setting to workbench.contribution --- .../workbench/browser/workbench.contribution.ts | 16 ++++++++++++++++ .../electron-browser/main.contribution.ts | 6 ------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/browser/workbench.contribution.ts b/src/vs/workbench/browser/workbench.contribution.ts index 1eb763e0023..e1f55c10fb7 100644 --- a/src/vs/workbench/browser/workbench.contribution.ts +++ b/src/vs/workbench/browser/workbench.contribution.ts @@ -243,6 +243,22 @@ import { isMacintosh } from 'vs/base/common/platform'; } }); + // Window + registry.registerConfiguration({ + 'id': 'window', + 'order': 8, + 'title': nls.localize('windowConfigurationTitle', "Window"), + 'type': 'object', + 'properties': { + 'window.title': { + 'type': 'string', + 'default': isMacintosh ? '${activeEditorShort}${separator}${rootName}' : '${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}', + 'markdownDescription': nls.localize({ comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'], key: 'title' }, + "Controls the window title based on the active editor. Variables are substituted based on the context:\n- `\${activeEditorShort}`: the file name (e.g. myFile.txt).\n- `\${activeEditorMedium}`: the path of the file relative to the workspace folder (e.g. myFolder/myFileFolder/myFile.txt).\n- `\${activeEditorLong}`: the full path of the file (e.g. /Users/Development/myFolder/myFileFolder/myFile.txt).\n- `\${activeFolderShort}`: the name of the folder the file is contained in (e.g. myFileFolder).\n- `\${activeFolderMedium}`: the path of the folder the file is contained in, relative to the workspace folder (e.g. myFolder/myFileFolder).\n- `\${activeFolderLong}`: the full path of the folder the file is contained in (e.g. /Users/Development/myFolder/myFileFolder).\n- `\${folderName}`: name of the workspace folder the file is contained in (e.g. myFolder).\n- `\${folderPath}`: file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder).\n- `\${rootName}`: name of the workspace (e.g. myFolder or myWorkspace).\n- `\${rootPath}`: file path of the workspace (e.g. /Users/Development/myWorkspace).\n- `\${appName}`: e.g. VS Code.\n- `\${dirty}`: a dirty indicator if the active editor is dirty.\n- `\${separator}`: a conditional separator (\" - \") that only shows when surrounded by variables with values or static text.") + } + } + }); + // Zen Mode registry.registerConfiguration({ 'id': 'zenMode', diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index 0d9d443dc16..cd5983d7aa7 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -590,12 +590,6 @@ import { LogStorageAction } from 'vs/platform/storage/node/storageService'; 'default': 0, 'description': nls.localize('zoomLevel', "Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.") }, - 'window.title': { - 'type': 'string', - 'default': isMacintosh ? '${activeEditorShort}${separator}${rootName}' : '${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}', - 'markdownDescription': nls.localize({ comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'], key: 'title' }, - "Controls the window title based on the active editor. Variables are substituted based on the context:\n- `\${activeEditorShort}`: the file name (e.g. myFile.txt).\n- `\${activeEditorMedium}`: the path of the file relative to the workspace folder (e.g. myFolder/myFileFolder/myFile.txt).\n- `\${activeEditorLong}`: the full path of the file (e.g. /Users/Development/myFolder/myFileFolder/myFile.txt).\n- `\${activeFolderShort}`: the name of the folder the file is contained in (e.g. myFileFolder).\n- `\${activeFolderMedium}`: the path of the folder the file is contained in, relative to the workspace folder (e.g. myFolder/myFileFolder).\n- `\${activeFolderLong}`: the full path of the folder the file is contained in (e.g. /Users/Development/myFolder/myFileFolder).\n- `\${folderName}`: name of the workspace folder the file is contained in (e.g. myFolder).\n- `\${folderPath}`: file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder).\n- `\${rootName}`: name of the workspace (e.g. myFolder or myWorkspace).\n- `\${rootPath}`: file path of the workspace (e.g. /Users/Development/myWorkspace).\n- `\${appName}`: e.g. VS Code.\n- `\${dirty}`: a dirty indicator if the active editor is dirty.\n- `\${separator}`: a conditional separator (\" - \") that only shows when surrounded by variables with values or static text.") - }, 'window.newWindowDimensions': { 'type': 'string', 'enum': ['default', 'inherit', 'maximized', 'fullscreen'], From 739a9dd5ce02c0d1950973eafec45b1905e6b405 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 26 Feb 2019 15:54:55 +0100 Subject: [PATCH 60/90] debt - dragover needs preventDefault() --- src/vs/base/browser/dnd.ts | 4 +++- src/vs/base/browser/ui/list/listView.ts | 2 ++ src/vs/base/browser/ui/tree/abstractTree.ts | 2 ++ src/vs/base/parts/tree/browser/treeView.ts | 2 ++ src/vs/workbench/browser/dnd.ts | 2 ++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/vs/base/browser/dnd.ts b/src/vs/base/browser/dnd.ts index d7e6571b6f9..6ba70bd072a 100644 --- a/src/vs/base/browser/dnd.ts +++ b/src/vs/base/browser/dnd.ts @@ -16,7 +16,9 @@ export class DelayedDragHandler extends Disposable { constructor(container: HTMLElement, callback: () => void) { super(); - this._register(addDisposableListener(container, 'dragover', () => { + this._register(addDisposableListener(container, 'dragover', e => { + e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome) + if (!this.timeout) { this.timeout = setTimeout(() => { callback(); diff --git a/src/vs/base/browser/ui/list/listView.ts b/src/vs/base/browser/ui/list/listView.ts index 3bf44fc334b..ac85245b2fe 100644 --- a/src/vs/base/browser/ui/list/listView.ts +++ b/src/vs/base/browser/ui/list/listView.ts @@ -786,6 +786,8 @@ export class ListView implements ISpliceable, IDisposable { } private onDragOver(event: IListDragEvent): boolean { + event.browserEvent.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome) + this.onDragLeaveTimeout.dispose(); if (StaticDND.CurrentDragAndDropData && StaticDND.CurrentDragAndDropData.getData() === 'vscode-ui') { diff --git a/src/vs/base/browser/ui/tree/abstractTree.ts b/src/vs/base/browser/ui/tree/abstractTree.ts index 22839784b16..52f31490996 100644 --- a/src/vs/base/browser/ui/tree/abstractTree.ts +++ b/src/vs/base/browser/ui/tree/abstractTree.ts @@ -603,6 +603,8 @@ class TypeFilterController implements IDisposable { }; const onDragOver = (event: DragEvent) => { + event.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome) + const x = event.screenX - left; if (event.dataTransfer) { event.dataTransfer.dropEffect = 'none'; diff --git a/src/vs/base/parts/tree/browser/treeView.ts b/src/vs/base/parts/tree/browser/treeView.ts index 5e7e31b7d3e..39ed5525f7f 100644 --- a/src/vs/base/parts/tree/browser/treeView.ts +++ b/src/vs/base/parts/tree/browser/treeView.ts @@ -1422,6 +1422,8 @@ export class TreeView extends HeightMap { } private onDragOver(e: DragEvent): boolean { + e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome) + let event = new Mouse.DragMouseEvent(e); let viewItem = this.getItemAround(event.target); diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts index a494e038b78..9b036521f2e 100644 --- a/src/vs/workbench/browser/dnd.ts +++ b/src/vs/workbench/browser/dnd.ts @@ -447,6 +447,8 @@ export class DragAndDropObserver extends Disposable { })); this._register(addDisposableListener(this.element, EventType.DRAG_OVER, (e: DragEvent) => { + e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome) + if (this.callbacks.onDragOver) { this.callbacks.onDragOver(e); } From 1e17319bfde04aefb34fd1b0648868dca208fa2c Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sat, 2 Mar 2019 11:00:09 +0100 Subject: [PATCH 61/90] fix #69588 --- src/vs/code/electron-main/main.ts | 6 ++--- src/vs/code/node/cli.ts | 25 +++++++++--------- src/vs/code/node/wait.ts | 26 ------------------- src/vs/code/test/node/argv.test.ts | 11 +++++++- src/vs/platform/environment/node/argv.ts | 14 ++++++++++ .../platform/environment/node/argvHelper.ts | 24 +++++++++++++++-- 6 files changed, 61 insertions(+), 45 deletions(-) delete mode 100644 src/vs/code/node/wait.ts diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index ac399cc99a2..49668099824 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -8,7 +8,8 @@ import { app, dialog } from 'electron'; import { assign } from 'vs/base/common/objects'; import * as platform from 'vs/base/common/platform'; import product from 'vs/platform/product/node/product'; -import { parseMainProcessArgv } from 'vs/platform/environment/node/argvHelper'; +import { parseMainProcessArgv, createWaitMarkerFile } from 'vs/platform/environment/node/argvHelper'; +import { addArg } from 'vs/platform/environment/node/argv'; import { mkdirp } from 'vs/base/node/pfs'; import { validatePaths } from 'vs/code/node/paths'; import { LifecycleService, ILifecycleService } from 'vs/platform/lifecycle/electron-main/lifecycleMain'; @@ -36,7 +37,6 @@ import { IDiagnosticsService, DiagnosticsService } from 'vs/platform/diagnostics import { BufferLogService } from 'vs/platform/log/common/bufferLog'; import { uploadLogs } from 'vs/code/electron-main/logUploader'; import { setUnexpectedErrorHandler } from 'vs/base/common/errors'; -import { createWaitMarkerFile } from 'vs/code/node/wait'; class ExpectedError extends Error { readonly isExpected = true; @@ -359,7 +359,7 @@ function main(): void { if (args.wait && !args.waitMarkerFilePath) { createWaitMarkerFile(args.verbose).then(waitMarkerFilePath => { if (waitMarkerFilePath) { - process.argv.push('--waitMarkerFilePath', waitMarkerFilePath); + addArg(process.argv, '--waitMarkerFilePath', waitMarkerFilePath); args.waitMarkerFilePath = waitMarkerFilePath; } diff --git a/src/vs/code/node/cli.ts b/src/vs/code/node/cli.ts index 12409054728..6f558debea5 100644 --- a/src/vs/code/node/cli.ts +++ b/src/vs/code/node/cli.ts @@ -5,7 +5,8 @@ import { spawn, ChildProcess } from 'child_process'; import { assign } from 'vs/base/common/objects'; -import { buildHelpMessage, buildVersionMessage } from 'vs/platform/environment/node/argv'; +import { buildHelpMessage, buildVersionMessage, addArg } from 'vs/platform/environment/node/argv'; +import { parseCLIProcessArgv, createWaitMarkerFile } from 'vs/platform/environment/node/argvHelper'; import { ParsedArgs } from 'vs/platform/environment/common/environment'; import product from 'vs/platform/product/node/product'; import pkg from 'vs/platform/product/node/package'; @@ -19,8 +20,6 @@ import * as iconv from 'iconv-lite'; import { writeFileAndFlushSync } from 'vs/base/node/extfs'; import { isWindows } from 'vs/base/common/platform'; import { ProfilingSession, Target } from 'v8-inspect-profiler'; -import { createWaitMarkerFile } from 'vs/code/node/wait'; -import { parseCLIProcessArgv } from 'vs/platform/environment/node/argvHelper'; function shouldSpawnCliProcess(argv: ParsedArgs): boolean { return !!argv['install-source'] @@ -180,11 +179,11 @@ export async function main(argv: string[]): Promise { }); // Make sure to open tmp file - argv.push(stdinFilePath); + addArg(argv, stdinFilePath); // Enable --wait to get all data and ignore adding this to history - argv.push('--wait'); - argv.push('--skip-add-to-recently-opened'); + addArg(argv, '--wait'); + addArg(argv, '--skip-add-to-recently-opened'); args.wait = true; } @@ -232,7 +231,7 @@ export async function main(argv: string[]): Promise { if (args.wait) { waitMarkerFilePath = await createWaitMarkerFile(verbose); if (waitMarkerFilePath) { - argv.push('--waitMarkerFilePath', waitMarkerFilePath); + addArg(argv, '--waitMarkerFilePath', waitMarkerFilePath); } } @@ -252,11 +251,11 @@ export async function main(argv: string[]): Promise { const filenamePrefix = paths.join(os.homedir(), 'prof-' + Math.random().toString(16).slice(-4)); - argv.push(`--inspect-brk=${portMain}`); - argv.push(`--remote-debugging-port=${portRenderer}`); - argv.push(`--inspect-brk-extensions=${portExthost}`); - argv.push(`--prof-startup-prefix`, filenamePrefix); - argv.push(`--no-cached-data`); + addArg(argv, `--inspect-brk=${portMain}`); + addArg(argv, `--remote-debugging-port=${portRenderer}`); + addArg(argv, `--inspect-brk-extensions=${portExthost}`); + addArg(argv, `--prof-startup-prefix`, filenamePrefix); + addArg(argv, `--no-cached-data`); fs.writeFileSync(filenamePrefix, argv.slice(-6).join('|')); @@ -341,7 +340,7 @@ export async function main(argv: string[]): Promise { if (args['js-flags']) { const match = /max_old_space_size=(\d+)/g.exec(args['js-flags']); if (match && !args['max-memory']) { - argv.push(`--max-memory=${match[1]}`); + addArg(argv, `--max-memory=${match[1]}`); } } diff --git a/src/vs/code/node/wait.ts b/src/vs/code/node/wait.ts deleted file mode 100644 index 9f9b9aaa41d..00000000000 --- a/src/vs/code/node/wait.ts +++ /dev/null @@ -1,26 +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 { join } from 'vs/base/common/path'; -import { tmpdir } from 'os'; -import { writeFile } from 'vs/base/node/pfs'; - -export function createWaitMarkerFile(verbose?: boolean): Promise { - const randomWaitMarkerPath = join(tmpdir(), Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10)); - - return writeFile(randomWaitMarkerPath, '').then(() => { - if (verbose) { - console.log(`Marker file for --wait created: ${randomWaitMarkerPath}`); - } - - return randomWaitMarkerPath; - }, error => { - if (verbose) { - console.error(`Failed to create marker file for --wait: ${error}`); - } - - return Promise.resolve(undefined); - }); -} diff --git a/src/vs/code/test/node/argv.test.ts b/src/vs/code/test/node/argv.test.ts index 2988c631ee7..6ce5684fab0 100644 --- a/src/vs/code/test/node/argv.test.ts +++ b/src/vs/code/test/node/argv.test.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { formatOptions, Option } from 'vs/platform/environment/node/argv'; +import { formatOptions, Option, addArg } from 'vs/platform/environment/node/argv'; suite('formatOptions', () => { @@ -54,4 +54,13 @@ suite('formatOptions', () => { ' bar bar bar bar bar bar bar bar bar ' ]); }); + + test('addArg', () => { + assert.deepEqual(addArg([], 'foo'), ['foo']); + assert.deepEqual(addArg([], 'foo', 'bar'), ['foo', 'bar']); + assert.deepEqual(addArg(['foo'], 'bar'), ['foo', 'bar']); + assert.deepEqual(addArg(['--wait'], 'bar'), ['--wait', 'bar']); + assert.deepEqual(addArg(['--wait', '--', '--foo'], 'bar'), ['--wait', 'bar', '--', '--foo']); + assert.deepEqual(addArg(['--', '--foo'], 'bar'), ['bar', '--', '--foo']); + }); }); diff --git a/src/vs/platform/environment/node/argv.ts b/src/vs/platform/environment/node/argv.ts index 7a304566aef..25b3fae01f6 100644 --- a/src/vs/platform/environment/node/argv.ts +++ b/src/vs/platform/environment/node/argv.ts @@ -239,3 +239,17 @@ export function hasArgs(arg: string | string[] | undefined): boolean { } return false; } + +export function addArg(argv: string[], ...args: string[]): string[] { + const endOfArgsMarkerIndex = argv.indexOf('--'); + if (endOfArgsMarkerIndex === -1) { + argv.push(...args); + } else { + // if the we have an argument "--" (end of argument marker) + // we cannot add arguments at the end. rather, we add + // arguments before the "--" marker. + argv.splice(endOfArgsMarkerIndex, 0, ...args); + } + + return argv; +} \ No newline at end of file diff --git a/src/vs/platform/environment/node/argvHelper.ts b/src/vs/platform/environment/node/argvHelper.ts index b31e7659e97..7e0819f77ab 100644 --- a/src/vs/platform/environment/node/argvHelper.ts +++ b/src/vs/platform/environment/node/argvHelper.ts @@ -4,12 +4,14 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; +import { tmpdir } from 'os'; import { firstIndex } from 'vs/base/common/arrays'; import { localize } from 'vs/nls'; import { ParsedArgs } from '../common/environment'; import { MIN_MAX_MEMORY_SIZE_MB } from 'vs/platform/files/common/files'; import { parseArgs } from 'vs/platform/environment/node/argv'; - +import { join } from 'vs/base/common/path'; +import { writeFile } from 'vs/base/node/pfs'; function validate(args: ParsedArgs): ParsedArgs { if (args.goto) { @@ -57,4 +59,22 @@ export function parseCLIProcessArgv(processArgv: string[]): ParsedArgs { } return validate(parseArgs(args)); -} \ No newline at end of file +} + +export function createWaitMarkerFile(verbose?: boolean): Promise { + const randomWaitMarkerPath = join(tmpdir(), Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10)); + + return writeFile(randomWaitMarkerPath, '').then(() => { + if (verbose) { + console.log(`Marker file for --wait created: ${randomWaitMarkerPath}`); + } + + return randomWaitMarkerPath; + }, error => { + if (verbose) { + console.error(`Failed to create marker file for --wait: ${error}`); + } + + return Promise.resolve(undefined); + }); +} From e96ab81392ec49effa0369f4f086be8c128e5e2f Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Sat, 2 Mar 2019 20:57:46 +0100 Subject: [PATCH 62/90] extensionTestsLocationURI.fsPath normalizes path (for #69569) --- src/vs/workbench/api/node/extHostExtensionService.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/api/node/extHostExtensionService.ts b/src/vs/workbench/api/node/extHostExtensionService.ts index cada07e1ff7..58ba2e568ef 100644 --- a/src/vs/workbench/api/node/extHostExtensionService.ts +++ b/src/vs/workbench/api/node/extHostExtensionService.ts @@ -5,6 +5,7 @@ import * as nls from 'vs/nls'; import * as path from 'vs/base/common/path'; +import { originalFSPath } from 'vs/base/common/resources'; import { Barrier } from 'vs/base/common/async'; import { IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle'; import { TernarySearchTree } from 'vs/base/common/map'; @@ -614,7 +615,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape { return Promise.resolve(undefined); } - const extensionTestsPath = extensionTestsLocationURI.fsPath; + const extensionTestsPath = originalFSPath(extensionTestsLocationURI); // Require the test runner via node require from the provided path let testRunner: ITestRunner | undefined; From eb17fc81bb96f137909d30b44f76c89c4d9a3fee Mon Sep 17 00:00:00 2001 From: MOZGIII Date: Sun, 3 Mar 2019 07:38:40 +0300 Subject: [PATCH 63/90] Fixes useExec promise not returning if there's no work to do --- src/vs/base/node/processes.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/base/node/processes.ts b/src/vs/base/node/processes.ts index 0dab519e6a4..e16c0722a57 100644 --- a/src/vs/base/node/processes.ts +++ b/src/vs/base/node/processes.ts @@ -321,14 +321,14 @@ export abstract class AbstractProcess { private useExec(): Promise { return new Promise((c, e) => { if (!this.shell || !Platform.isWindows) { - c(false); + return c(false); } let cmdShell = cp.spawn(getWindowsShell(), ['/s', '/c']); cmdShell.on('error', (error: Error) => { - c(true); + return c(true); }); cmdShell.on('exit', (data: any) => { - c(false); + return c(false); }); }); } @@ -470,4 +470,4 @@ export namespace win32 { } return path.join(cwd, command); } -} \ No newline at end of file +} From def23176f224e6399fc789a06b8ae1efa9b3c2dd Mon Sep 17 00:00:00 2001 From: Filipe Correia Date: Sun, 3 Mar 2019 10:57:42 +0000 Subject: [PATCH 64/90] Update vscode.d.ts --- 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 b2ac03e4fcd..9305f29a4c3 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -3701,7 +3701,7 @@ declare module 'vscode' { } /** - * A line based folding range. To be valid, start and end line must a zero or larger and smaller than the number of lines in the document. + * A line based folding range. To be valid, start and end line must be bigger than zero and smaller than the number of lines in the document. * Invalid ranges will be ignored. */ export class FoldingRange { From 2702c1421cf2a87bc31c6ba5211d66d3b09ce757 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 4 Mar 2019 08:40:35 +0100 Subject: [PATCH 65/90] debt - work on untangling layout things out of workbench --- src/vs/base/browser/ui/splitview/panelview.ts | 5 +- src/vs/workbench/browser/composite.ts | 16 +- .../parts/activitybar/activitybarPart.ts | 24 +- .../workbench/browser/parts/compositePart.ts | 7 +- .../browser/parts/panel/panelActions.ts | 2 +- .../browser/parts/panel/panelPart.ts | 75 +- .../browser/parts/sidebar/sidebarPart.ts | 54 +- .../browser/parts/titlebar/titlebarPart.ts | 14 +- src/vs/workbench/common/panel.ts | 4 + src/vs/workbench/common/viewlet.ts | 5 + .../contrib/debug/browser/debugCommands.ts | 2 +- .../debug/browser/debugEditorActions.ts | 2 +- .../markers/browser/markers.contribution.ts | 10 +- .../workbench/electron-browser/workbench.ts | 960 +++++++++--------- .../activity/browser/activityService.ts | 1 - 15 files changed, 598 insertions(+), 583 deletions(-) diff --git a/src/vs/base/browser/ui/splitview/panelview.ts b/src/vs/base/browser/ui/splitview/panelview.ts index fb9897920a5..e83b324542d 100644 --- a/src/vs/base/browser/ui/splitview/panelview.ts +++ b/src/vs/base/browser/ui/splitview/panelview.ts @@ -172,8 +172,9 @@ export abstract class Panel implements IView { this.renderHeader(this.header); const focusTracker = trackFocus(this.header); - focusTracker.onDidFocus(() => addClass(this.header, 'focused')); - focusTracker.onDidBlur(() => removeClass(this.header, 'focused')); + this.disposables.push(focusTracker); + focusTracker.onDidFocus(() => addClass(this.header, 'focused'), null, this.disposables); + focusTracker.onDidBlur(() => removeClass(this.header, 'focused'), null, this.disposables); this.updateHeader(); diff --git a/src/vs/workbench/browser/composite.ts b/src/vs/workbench/browser/composite.ts index 894aa1d77b9..4fc60b1cc1d 100644 --- a/src/vs/workbench/browser/composite.ts +++ b/src/vs/workbench/browser/composite.ts @@ -38,7 +38,7 @@ export abstract class Composite extends Component implements IComposite { private _onDidFocus: Emitter; get onDidFocus(): Event { if (!this._onDidFocus) { - this._registerFocusTrackEvents(); + this.registerFocusTrackEvents(); } return this._onDidFocus.event; @@ -47,13 +47,13 @@ export abstract class Composite extends Component implements IComposite { private _onDidBlur: Emitter; get onDidBlur(): Event { if (!this._onDidBlur) { - this._registerFocusTrackEvents(); + this.registerFocusTrackEvents(); } return this._onDidBlur.event; } - private _registerFocusTrackEvents(): void { + private registerFocusTrackEvents(): void { this._onDidFocus = this._register(new Emitter()); this._onDidBlur = this._register(new Emitter()); @@ -217,11 +217,11 @@ export abstract class CompositeDescriptor { constructor( private readonly ctor: IConstructorSignature0, - public readonly id: string, - public readonly name: string, - public readonly cssClass?: string, - public readonly order?: number, - public readonly keybindingId?: string, + readonly id: string, + readonly name: string, + readonly cssClass?: string, + readonly order?: number, + readonly keybindingId?: string, ) { } instantiate(instantiationService: IInstantiationService): T { diff --git a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts index b8b8e289b18..f54dadfb511 100644 --- a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts +++ b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts @@ -110,6 +110,7 @@ export class ActivitybarPart extends Part implements ISerializableView { private registerListeners(): void { + // Viewlet registration this._register(this.viewletService.onDidViewletRegister(viewlet => this.onDidRegisterViewlets([viewlet]))); this._register(this.viewletService.onDidViewletDeregister(({ id }) => this.removeComposite(id, true))); @@ -119,6 +120,7 @@ export class ActivitybarPart extends Part implements ISerializableView { // Deactivate viewlet action on close this._register(this.viewletService.onDidViewletClose(viewlet => this.compositeBar.deactivateComposite(viewlet.getId()))); + // Extension registration let disposables: IDisposable[] = []; this._register(this.extensionService.onDidRegisterExtensions(() => { disposables = dispose(disposables); @@ -126,11 +128,13 @@ export class ActivitybarPart extends Part implements ISerializableView { this.compositeBar.onDidChange(() => this.saveCachedViewlets(), this, disposables); this.storageService.onDidChangeStorage(e => this.onDidStorageChange(e), this, disposables); })); + this._register(toDisposable(() => dispose(disposables))); } private onDidRegisterExtensions(): void { this.removeNotExistingComposites(); + for (const viewlet of this.viewletService.getViewlets()) { this.enableCompositeActions(viewlet); const viewContainer = this.getViewContainer(viewlet.id); @@ -142,6 +146,7 @@ export class ActivitybarPart extends Part implements ISerializableView { } } } + this.saveCachedViewlets(); } @@ -154,6 +159,7 @@ export class ActivitybarPart extends Part implements ISerializableView { } private onDidViewletOpen(viewlet: IViewlet): void { + // Update the composite bar by adding this.compositeBar.addComposite(this.viewletService.getViewlet(viewlet.getId())); this.compositeBar.activateComposite(viewlet.getId()); @@ -162,8 +168,7 @@ export class ActivitybarPart extends Part implements ISerializableView { if (viewContainer) { const viewDescriptors = this.viewsService.getViewDescriptors(viewContainer); if (viewDescriptors && viewDescriptors.activeViewDescriptors.length === 0) { - // Update the composite bar by hiding - this.removeComposite(viewletDescriptor.id, true); + this.removeComposite(viewletDescriptor.id, true); // Update the composite bar by hiding } } } @@ -325,6 +330,7 @@ export class ActivitybarPart extends Part implements ISerializableView { } else { this.compositeBar.removeComposite(compositeId); } + const compositeActions = this.compositeActions[compositeId]; if (compositeActions) { compositeActions.activityAction.dispose(); @@ -338,6 +344,7 @@ export class ActivitybarPart extends Part implements ISerializableView { if (activityAction instanceof PlaceHolderViewletActivityAction) { activityAction.setActivity(viewlet); } + if (pinnedAction instanceof PlaceHolderToggleCompositePinnedAction) { pinnedAction.setActivity(viewlet); } @@ -345,6 +352,7 @@ export class ActivitybarPart extends Part implements ISerializableView { getPinnedViewletIds(): string[] { const pinnedCompositeIds = this.compositeBar.getPinnedComposites().map(v => v.id); + return this.viewletService.getViewlets() .filter(v => this.compositeBar.isPinned(v.id)) .sort((v1, v2) => pinnedCompositeIds.indexOf(v1.id) - pinnedCompositeIds.indexOf(v2.id)) @@ -369,8 +377,7 @@ export class ActivitybarPart extends Part implements ISerializableView { let availableHeight = this.dimension.height; if (this.globalActionBar) { - // adjust height for global actions showing - availableHeight -= (this.globalActionBar.items.length * ActivitybarPart.ACTION_HEIGHT); + availableHeight -= (this.globalActionBar.items.length * ActivitybarPart.ACTION_HEIGHT); // adjust height for global actions showing } this.compositeBar.layout(new Dimension(dim1 instanceof Dimension ? dim1.width : dim1, availableHeight)); @@ -414,8 +421,9 @@ export class ActivitybarPart extends Part implements ISerializableView { private saveCachedViewlets(): void { const state: ICachedViewlet[] = []; - const compositeItems = this.compositeBar.getCompositeBarItems(); const allViewlets = this.viewletService.getViewlets(); + + const compositeItems = this.compositeBar.getCompositeBarItems(); for (const compositeItem of compositeItems) { const viewContainer = this.getViewContainer(compositeItem.id); const viewlet = allViewlets.filter(({ id }) => id === compositeItem.id)[0]; @@ -432,6 +440,7 @@ export class ActivitybarPart extends Part implements ISerializableView { state.push({ id: compositeItem.id, iconUrl: viewlet.iconUrl, views, pinned: compositeItem && compositeItem.pinned, order: compositeItem ? compositeItem.order : undefined, visible: compositeItem && compositeItem.visible }); } } + this.cachedViewletsValue = JSON.stringify(state); } @@ -442,6 +451,7 @@ export class ActivitybarPart extends Part implements ISerializableView { serialized.visible = isUndefinedOrNull(serialized.visible) ? true : serialized.visible; return serialized; }); + for (const old of this.loadOldCachedViewlets()) { const cachedViewlet = cachedViewlets.filter(cached => cached.id === old.id)[0]; if (cachedViewlet) { @@ -449,6 +459,7 @@ export class ActivitybarPart extends Part implements ISerializableView { cachedViewlet.views = old.views; } } + return cachedViewlets; } @@ -456,6 +467,7 @@ export class ActivitybarPart extends Part implements ISerializableView { const previousState = this.storageService.get('workbench.activity.placeholderViewlets', StorageScope.GLOBAL, '[]'); const result = (JSON.parse(previousState)); this.storageService.remove('workbench.activity.placeholderViewlets', StorageScope.GLOBAL); + return result; } @@ -464,6 +476,7 @@ export class ActivitybarPart extends Part implements ISerializableView { if (!this._cachedViewletsValue) { this._cachedViewletsValue = this.getStoredCachedViewletsValue(); } + return this._cachedViewletsValue; } @@ -487,6 +500,7 @@ export class ActivitybarPart extends Part implements ISerializableView { if (viewletId === SCM_VIEWLET_ID) { return null; } + const viewContainerRegistry = Registry.as(ViewContainerExtensions.ViewContainersRegistry); return viewContainerRegistry.get(viewletId); } diff --git a/src/vs/workbench/browser/parts/compositePart.ts b/src/vs/workbench/browser/parts/compositePart.ts index 30f54594cf3..a9a2883e398 100644 --- a/src/vs/workbench/browser/parts/compositePart.ts +++ b/src/vs/workbench/browser/parts/compositePart.ts @@ -98,6 +98,7 @@ export abstract class CompositePart extends Part { } protected openComposite(id: string, focus?: boolean): Composite | undefined { + // Check if composite already visible and just focus in that case if (this.activeComposite && this.activeComposite.getId() === id) { if (focus) { @@ -449,6 +450,7 @@ export abstract class CompositePart extends Part { getProgressIndicator(id: string): IProgressService | null { const compositeItem = this.instantiatedCompositeItems.get(id); + return compositeItem ? compositeItem.progressService : null; } @@ -467,6 +469,7 @@ export abstract class CompositePart extends Part { layout(dimension: Dimension): Dimension[]; layout(width: number, height: number): void; layout(dim1: Dimension | number, dim2?: number): Dimension[] | void { + // Pass to super const sizes = super.layout(dim1 instanceof Dimension ? dim1 : new Dimension(dim1, dim2!)); @@ -483,8 +486,7 @@ export abstract class CompositePart extends Part { protected removeComposite(compositeId: string): boolean { if (this.activeComposite && this.activeComposite.getId() === compositeId) { - // do not remove active compoiste - return false; + return false; // do not remove active composite } delete this.mapCompositeToCompositeContainer[compositeId]; @@ -495,6 +497,7 @@ export abstract class CompositePart extends Part { dispose(compositeItem.disposable); this.instantiatedCompositeItems.delete(compositeId); } + return true; } diff --git a/src/vs/workbench/browser/parts/panel/panelActions.ts b/src/vs/workbench/browser/parts/panel/panelActions.ts index adb1d3b18d5..e5f639f4449 100644 --- a/src/vs/workbench/browser/parts/panel/panelActions.ts +++ b/src/vs/workbench/browser/parts/panel/panelActions.ts @@ -249,7 +249,7 @@ export class NextPanelViewAction extends SwitchPanelViewAction { super(id, name, panelService); } - public run(): Promise { + run(): Promise { return super.run(1); } } diff --git a/src/vs/workbench/browser/parts/panel/panelPart.ts b/src/vs/workbench/browser/parts/panel/panelPart.ts index d6bd16824cc..87c274bf9ea 100644 --- a/src/vs/workbench/browser/parts/panel/panelPart.ts +++ b/src/vs/workbench/browser/parts/panel/panelPart.ts @@ -8,7 +8,7 @@ import { IAction } from 'vs/base/common/actions'; import { Event, Emitter } from 'vs/base/common/event'; import { Registry } from 'vs/platform/registry/common/platform'; import { ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar'; -import { IPanel } from 'vs/workbench/common/panel'; +import { IPanel, ActivePanelContext, PanelFocusContext } from 'vs/workbench/common/panel'; import { CompositePart, ICompositeTitleLabel } from 'vs/workbench/browser/parts/compositePart'; import { Panel, PanelRegistry, Extensions as PanelExtensions, PanelDescriptor } from 'vs/workbench/browser/panel'; import { IPanelService, IPanelIdentifier } from 'vs/workbench/services/panel/common/panelService'; @@ -29,15 +29,12 @@ import { INotificationService } from 'vs/platform/notification/common/notificati import { Dimension, trackFocus } from 'vs/base/browser/dom'; import { localize } from 'vs/nls'; import { IDisposable } from 'vs/base/common/lifecycle'; -import { RawContextKey, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { isUndefinedOrNull } from 'vs/base/common/types'; import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { ISerializableView } from 'vs/base/browser/ui/grid/grid'; import { LayoutPriority } from 'vs/base/browser/ui/grid/gridview'; -export const ActivePanelContext = new RawContextKey('activePanel', ''); -export const PanelFocusContext = new RawContextKey('panelFocus', false); - interface ICachedPanel { id: string; pinned: boolean; @@ -66,11 +63,16 @@ export class PanelPart extends CompositePart implements IPanelService, IS private _onDidChange = this._register(new Emitter<{ width: number; height: number; }>()); get onDidChange(): Event<{ width: number, height: number }> { return this._onDidChange.event; } + get onDidPanelOpen(): Event<{ panel: IPanel, focus: boolean }> { return Event.map(this.onDidCompositeOpen.event, compositeOpen => ({ panel: compositeOpen.composite, focus: compositeOpen.focus })); } + get onDidPanelClose(): Event { return this.onDidCompositeClose.event; } + private activePanelContextKey: IContextKey; private panelFocusContextKey: IContextKey; - private blockOpeningPanel: boolean; + private compositeBar: CompositeBar; private compositeActions: { [compositeId: string]: { activityAction: PanelActivityAction, pinnedAction: ToggleCompositePinnedAction } } = Object.create(null); + + private blockOpeningPanel: boolean; private dimension: Dimension; constructor( @@ -142,25 +144,13 @@ export class PanelPart extends CompositePart implements IPanelService, IS this.registerListeners(); } - create(parent: HTMLElement): void { - this.element = parent; - - super.create(parent); - - const focusTracker = trackFocus(parent); - - focusTracker.onDidFocus(() => { - this.panelFocusContextKey.set(true); - }); - focusTracker.onDidBlur(() => { - this.panelFocusContextKey.set(false); - }); - } - private registerListeners(): void { - this._register(this.onDidPanelOpen(({ panel }) => this._onDidPanelOpen(panel))); - this._register(this.onDidPanelClose(this._onDidPanelClose, this)); + // Panel open/close + this._register(this.onDidPanelOpen(({ panel }) => this.onPanelOpen(panel))); + this._register(this.onDidPanelClose(this.onPanelClose, this)); + + // Panel register/deregister this._register(this.registry.onDidRegister(panelDescriptor => this.compositeBar.addComposite(panelDescriptor))); this._register(this.registry.onDidDeregister(panelDescriptor => { this.compositeBar.hideComposite(panelDescriptor.id); @@ -176,17 +166,18 @@ export class PanelPart extends CompositePart implements IPanelService, IS // Deactivate panel action on close this._register(this.onDidPanelClose(panel => this.compositeBar.deactivateComposite(panel.getId()))); + // State this.lifecycleService.when(LifecyclePhase.Eventually).then(() => { this._register(this.compositeBar.onDidChange(() => this.saveCachedPanels())); this._register(this.storageService.onDidChangeStorage(e => this.onDidStorageChange(e))); }); } - private _onDidPanelOpen(panel: IPanel): void { + private onPanelOpen(panel: IPanel): void { this.activePanelContextKey.set(panel.getId()); } - private _onDidPanelClose(panel: IPanel): void { + private onPanelClose(panel: IPanel): void { const id = panel.getId(); if (this.activePanelContextKey.get() === id) { @@ -194,12 +185,14 @@ export class PanelPart extends CompositePart implements IPanelService, IS } } - get onDidPanelOpen(): Event<{ panel: IPanel, focus: boolean }> { - return Event.map(this.onDidCompositeOpen.event, compositeOpen => ({ panel: compositeOpen.composite, focus: compositeOpen.focus })); - } + create(parent: HTMLElement): void { + this.element = parent; - get onDidPanelClose(): Event { - return this.onDidCompositeClose.event; + super.create(parent); + + const focusTracker = this._register(trackFocus(parent)); + this._register(focusTracker.onDidFocus(() => this.panelFocusContextKey.set(true))); + this._register(focusTracker.onDidBlur(() => this.panelFocusContextKey.set(false))); } updateStyles(): void { @@ -241,6 +234,10 @@ export class PanelPart extends CompositePart implements IPanelService, IS return this.getPanels().filter(p => p.id === panelId).pop(); } + hasPanel(panelId: string): boolean { + return !!this.getPanels().filter(p => p.id === panelId).length; + } + getPanels(): PanelDescriptor[] { return Registry.as(PanelExtensions.Panels).getPanels() .sort((v1, v2) => typeof v1.order === 'number' && typeof v2.order === 'number' ? v1.order - v2.order : NaN); @@ -303,8 +300,7 @@ export class PanelPart extends CompositePart implements IPanelService, IS const { width, height } = dim1 instanceof Dimension ? dim1 : { width: dim1, height: dim2 }; if (this.partService.getPanelPosition() === Position.RIGHT) { - // Take into account the 1px border when layouting - this.dimension = new Dimension(width - 1, height!); + this.dimension = new Dimension(width - 1, height!); // Take into account the 1px border when layouting } else { this.dimension = new Dimension(width, height!); } @@ -321,9 +317,9 @@ export class PanelPart extends CompositePart implements IPanelService, IS if (this.dimension) { let availableWidth = this.dimension.width - 40; // take padding into account if (this.toolBar) { - // adjust height for global actions showing - availableWidth = Math.max(PanelPart.MIN_COMPOSITE_BAR_WIDTH, availableWidth - this.getToolbarWidth()); + availableWidth = Math.max(PanelPart.MIN_COMPOSITE_BAR_WIDTH, availableWidth - this.getToolbarWidth()); // adjust height for global actions showing } + this.compositeBar.layout(new Dimension(availableWidth, this.dimension.height)); } } @@ -337,6 +333,7 @@ export class PanelPart extends CompositePart implements IPanelService, IS }; this.compositeActions[compositeId] = compositeActions; } + return compositeActions; } @@ -348,8 +345,10 @@ export class PanelPart extends CompositePart implements IPanelService, IS compositeActions.pinnedAction.dispose(); delete this.compositeActions[compositeId]; } + return true; } + return false; } @@ -358,6 +357,7 @@ export class PanelPart extends CompositePart implements IPanelService, IS if (!activePanel) { return 0; } + return this.toolBar.getItemsWidth(); } @@ -396,22 +396,26 @@ export class PanelPart extends CompositePart implements IPanelService, IS private saveCachedPanels(): void { const state: ICachedPanel[] = []; + const compositeItems = this.compositeBar.getCompositeBarItems(); for (const compositeItem of compositeItems) { state.push({ id: compositeItem.id, pinned: compositeItem.pinned, order: compositeItem.order, visible: compositeItem.visible }); } + this.cachedPanelsValue = JSON.stringify(state); } private getCachedPanels(): ICachedPanel[] { - const storedStates = >JSON.parse(this.cachedPanelsValue); const registeredPanels = this.getPanels(); + + const storedStates = >JSON.parse(this.cachedPanelsValue); const cachedPanels = storedStates.map(c => { const serialized: ICachedPanel = typeof c === 'string' /* migration from pinned states to composites states */ ? { id: c, pinned: true, order: undefined, visible: true } : c; const registered = registeredPanels.some(p => p.id === serialized.id); serialized.visible = registered ? isUndefinedOrNull(serialized.visible) ? true : serialized.visible : false; return serialized; }); + return cachedPanels; } @@ -420,6 +424,7 @@ export class PanelPart extends CompositePart implements IPanelService, IS if (!this._cachedPanelsValue) { this._cachedPanelsValue = this.getStoredCachedPanelsValue(); } + return this._cachedPanelsValue; } diff --git a/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts b/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts index 653dde866ac..d1d90205df5 100644 --- a/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts +++ b/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts @@ -13,7 +13,7 @@ import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/wor import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IPartService, Parts, Position as SideBarPosition } from 'vs/workbench/services/part/common/partService'; -import { IViewlet } from 'vs/workbench/common/viewlet'; +import { IViewlet, SidebarFocusContext, ActiveViewletContext } from 'vs/workbench/common/viewlet'; import { IStorageService } from 'vs/platform/storage/common/storage'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; @@ -27,16 +27,12 @@ import { SIDE_BAR_TITLE_FOREGROUND, SIDE_BAR_BACKGROUND, SIDE_BAR_FOREGROUND, SI import { INotificationService } from 'vs/platform/notification/common/notification'; import { EventType, addDisposableListener, trackFocus, Dimension } from 'vs/base/browser/dom'; import { StandardMouseEvent } from 'vs/base/browser/mouseEvent'; -import { RawContextKey, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { ISerializableView } from 'vs/base/browser/ui/grid/grid'; import { LayoutPriority } from 'vs/base/browser/ui/grid/gridview'; -export const SidebarVisibleContext = new RawContextKey('sidebarVisible', false); -export const SidebarFocusContext = new RawContextKey('sideBarFocus', false); -export const ActiveViewletContext = new RawContextKey('activeViewlet', ''); - export class SidebarPart extends CompositePart implements ISerializableView, IViewletService { _serviceBrand: any; @@ -54,11 +50,18 @@ export class SidebarPart extends CompositePart implements ISerializable private _onDidChange = this._register(new Emitter<{ width: number; height: number; }>()); get onDidChange(): Event<{ width: number, height: number }> { return this._onDidChange.event; } + get onDidViewletRegister(): Event { return >this.viewletRegistry.onDidRegister; } + + private _onDidViewletDeregister = this._register(new Emitter()); + get onDidViewletDeregister(): Event { return this._onDidViewletDeregister.event; } + + get onDidViewletOpen(): Event { return Event.map(this.onDidCompositeOpen.event, compositeEvent => compositeEvent.composite); } + get onDidViewletClose(): Event { return this.onDidCompositeClose.event as Event; } + private viewletRegistry: ViewletRegistry; private sideBarFocusContextKey: IContextKey; private activeViewletContextKey: IContextKey; private blockOpeningViewlet: boolean; - private _onDidViewletDeregister = this._register(new Emitter()); constructor( id: string, @@ -92,52 +95,47 @@ export class SidebarPart extends CompositePart implements ISerializable { hasTitle: true, borderWidth: () => (this.getColor(SIDE_BAR_BORDER) || this.getColor(contrastBorder)) ? 1 : 0 } ); - this.sideBarFocusContextKey = SidebarFocusContext.bindTo(contextKeyService); this.viewletRegistry = Registry.as(ViewletExtensions.Viewlets); + this.sideBarFocusContextKey = SidebarFocusContext.bindTo(contextKeyService); this.activeViewletContextKey = ActiveViewletContext.bindTo(contextKeyService); + this.registerListeners(); + } + + private registerListeners(): void { + + // Viewlet open this._register(this.onDidViewletOpen(viewlet => { this.activeViewletContextKey.set(viewlet.getId()); })); + + // Viewlet close this._register(this.onDidViewletClose(viewlet => { if (this.activeViewletContextKey.get() === viewlet.getId()) { this.activeViewletContextKey.reset(); } })); + + // Viewlet deregister this._register(this.registry.onDidDeregister(async (viewletDescriptor: ViewletDescriptor) => { if (this.getActiveViewlet().getId() === viewletDescriptor.id) { await this.openViewlet(this.getDefaultViewletId()); } + this.removeComposite(viewletDescriptor.id); this._onDidViewletDeregister.fire(viewletDescriptor); })); } - get onDidViewletRegister(): Event { return >this.viewletRegistry.onDidRegister; } - get onDidViewletDeregister(): Event { return this._onDidViewletDeregister.event; } - - get onDidViewletOpen(): Event { - return Event.map(this.onDidCompositeOpen.event, compositeEvent => compositeEvent.composite); - } - - get onDidViewletClose(): Event { - return this.onDidCompositeClose.event as Event; - } - create(parent: HTMLElement): void { this.element = parent; super.create(parent); - const focusTracker = trackFocus(parent); - - focusTracker.onDidFocus(() => { - this.sideBarFocusContextKey.set(true); - }); - focusTracker.onDidBlur(() => { - this.sideBarFocusContextKey.set(false); - }); + const focusTracker = this._register(trackFocus(parent)); + this._register(focusTracker.onDidFocus(() => this.sideBarFocusContextKey.set(true))); + this._register(focusTracker.onDidBlur(() => this.sideBarFocusContextKey.set(false))); } createTitleArea(parent: HTMLElement): HTMLElement { @@ -205,11 +203,13 @@ export class SidebarPart extends CompositePart implements ISerializable if (this.getViewlet(id)) { return Promise.resolve(this.doOpenViewlet(id, focus)); } + return this.extensionService.whenInstalledExtensionsRegistered() .then(() => { if (this.getViewlet(id)) { return this.doOpenViewlet(id, focus); } + return null; }); } diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts index 3ab509fad99..768cbe3ef10 100644 --- a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts @@ -52,9 +52,12 @@ export class TitlebarPart extends Part implements ITitleService, ISerializableVi get minimumHeight(): number { return isMacintosh ? 22 / getZoomFactor() : (30 / (this.configurationService.getValue('window.menuBarVisibility') === 'hidden' ? getZoomFactor() : 1)); } get maximumHeight(): number { return isMacintosh ? 22 / getZoomFactor() : (30 / (this.configurationService.getValue('window.menuBarVisibility') === 'hidden' ? getZoomFactor() : 1)); } - private _onDidChange = this._register(new Emitter<{ width: number; height: number; }>()); + private _onDidChange = this._register(new Emitter<{ width: number, height: number }>()); get onDidChange(): Event<{ width: number, height: number }> { return this._onDidChange.event; } + private _onMenubarVisibilityChange = this._register(new Emitter()); + get onMenubarVisibilityChange(): Event { return this._onMenubarVisibilityChange.event; } + _serviceBrand: any; private title: HTMLElement; @@ -141,6 +144,8 @@ export class TitlebarPart extends Part implements ITitleService, ISerializableVi } this.adjustTitleMarginToCenter(); + + this._onMenubarVisibilityChange.fire(visible); } } @@ -154,10 +159,6 @@ export class TitlebarPart extends Part implements ITitleService, ISerializableVi } } - onMenubarVisibilityChange(): Event { - return this.menubarPart.onVisibilityChange; - } - private onActiveEditorChange(): void { // Dispose old listeners @@ -494,8 +495,7 @@ export class TitlebarPart extends Part implements ITitleService, ISerializableVi const setting = this.configurationService.getValue('window.doubleClickIconToClose'); if (setting) { this.appIcon.style['-webkit-app-region'] = 'no-drag'; - } - else { + } else { this.appIcon.style['-webkit-app-region'] = 'drag'; } } diff --git a/src/vs/workbench/common/panel.ts b/src/vs/workbench/common/panel.ts index 57c365b0a62..628846c404a 100644 --- a/src/vs/workbench/common/panel.ts +++ b/src/vs/workbench/common/panel.ts @@ -4,5 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import { IComposite } from 'vs/workbench/common/composite'; +import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; + +export const ActivePanelContext = new RawContextKey('activePanel', ''); +export const PanelFocusContext = new RawContextKey('panelFocus', false); export interface IPanel extends IComposite { } diff --git a/src/vs/workbench/common/viewlet.ts b/src/vs/workbench/common/viewlet.ts index aa90d23fb94..b213967decd 100644 --- a/src/vs/workbench/common/viewlet.ts +++ b/src/vs/workbench/common/viewlet.ts @@ -4,6 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import { IComposite } from 'vs/workbench/common/composite'; +import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; + +export const SidebarVisibleContext = new RawContextKey('sidebarVisible', false); +export const SidebarFocusContext = new RawContextKey('sideBarFocus', false); +export const ActiveViewletContext = new RawContextKey('activeViewlet', ''); export interface IViewlet extends IComposite { diff --git a/src/vs/workbench/contrib/debug/browser/debugCommands.ts b/src/vs/workbench/contrib/debug/browser/debugCommands.ts index b231d8a4853..ffb98ba210f 100644 --- a/src/vs/workbench/contrib/debug/browser/debugCommands.ts +++ b/src/vs/workbench/contrib/debug/browser/debugCommands.ts @@ -22,7 +22,7 @@ import { openBreakpointSource } from 'vs/workbench/contrib/debug/browser/breakpo import { INotificationService } from 'vs/platform/notification/common/notification'; import { InputFocusedContext } from 'vs/platform/contextkey/common/contextkeys'; import { ServicesAccessor } from 'vs/editor/browser/editorExtensions'; -import { PanelFocusContext } from 'vs/workbench/browser/parts/panel/panelPart'; +import { PanelFocusContext } from 'vs/workbench/common/panel'; import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { onUnexpectedError } from 'vs/base/common/errors'; diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts b/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts index e4bef65fcc3..7b460194b62 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts @@ -16,7 +16,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { openBreakpointSource } from 'vs/workbench/contrib/debug/browser/breakpointsView'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; -import { PanelFocusContext } from 'vs/workbench/browser/parts/panel/panelPart'; +import { PanelFocusContext } from 'vs/workbench/common/panel'; import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; export const TOGGLE_BREAKPOINT_ID = 'editor.debug.action.toggleBreakpoint'; diff --git a/src/vs/workbench/contrib/markers/browser/markers.contribution.ts b/src/vs/workbench/contrib/markers/browser/markers.contribution.ts index 7d759e601b8..2176ac7a9ef 100644 --- a/src/vs/workbench/contrib/markers/browser/markers.contribution.ts +++ b/src/vs/workbench/contrib/markers/browser/markers.contribution.ts @@ -3,8 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import 'vs/workbench/contrib/markers/browser/markersFileDecorations'; import { CommandsRegistry, ICommandHandler } from 'vs/platform/commands/common/commands'; -import { ContextKeyExpr, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; +import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; @@ -23,9 +24,8 @@ import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } fr import { IMarkersWorkbenchService, MarkersWorkbenchService, ActivityUpdater } from 'vs/workbench/contrib/markers/browser/markers'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; - -import './markersFileDecorations'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; +import { ActivePanelContext } from 'vs/workbench/common/panel'; registerSingleton(IMarkersWorkbenchService, MarkersWorkbenchService, false); @@ -182,7 +182,7 @@ registerAction({ category: localize('problems', "Problems"), menu: { menuId: MenuId.CommandPalette, - when: new RawContextKey('activePanel', Constants.MARKERS_PANEL_ID) + when: ActivePanelContext.isEqualTo(Constants.MARKERS_PANEL_ID) } }); registerAction({ @@ -198,7 +198,7 @@ registerAction({ category: localize('problems', "Problems"), menu: { menuId: MenuId.CommandPalette, - when: new RawContextKey('activePanel', Constants.MARKERS_PANEL_ID) + when: ActivePanelContext.isEqualTo(Constants.MARKERS_PANEL_ID) } }); diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index c1e45f78c1c..a6bc3e655bf 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -21,7 +21,7 @@ import { IResourceInput } from 'vs/platform/editor/common/editor'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { IEditorInputFactoryRegistry, Extensions as EditorExtensions, IUntitledResourceInput, IResourceDiffInput, InEditorZenModeContext } from 'vs/workbench/common/editor'; import { ActivitybarPart } from 'vs/workbench/browser/parts/activitybar/activitybarPart'; -import { SidebarPart, SidebarVisibleContext } from 'vs/workbench/browser/parts/sidebar/sidebarPart'; +import { SidebarPart } from 'vs/workbench/browser/parts/sidebar/sidebarPart'; import { PanelPart } from 'vs/workbench/browser/parts/panel/panelPart'; import { StatusbarPart } from 'vs/workbench/browser/parts/statusbar/statusbarPart'; import { TitlebarPart } from 'vs/workbench/browser/parts/titlebar/titlebarPart'; @@ -111,6 +111,7 @@ import { WorkbenchThemeService } from 'vs/workbench/services/themes/browser/work import { IProductService } from 'vs/platform/product/common/product'; import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; import { WorkbenchContextKeysHandler } from 'vs/workbench/browser/contextkeys'; +import { SidebarVisibleContext } from 'vs/workbench/common/viewlet'; // import@node import { BackupFileService, InMemoryBackupFileService } from 'vs/workbench/services/backup/node/backupFileService'; @@ -146,65 +147,42 @@ import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browse import { ExtensionService } from 'vs/workbench/services/extensions/electron-browser/extensionService'; import { RequestService } from 'vs/platform/request/electron-browser/requestService'; -interface IZenModeSettings { - fullScreen: boolean; - centerLayout: boolean; - hideTabs: boolean; - hideActivityBar: boolean; - hideStatusBar: boolean; - hideLineNumbers: boolean; - restore: boolean; +enum Identifiers { + TITLEBAR_PART = 'workbench.parts.titlebar', + ACTIVITYBAR_PART = 'workbench.parts.activitybar', + SIDEBAR_PART = 'workbench.parts.sidebar', + PANEL_PART = 'workbench.parts.panel', + EDITOR_PART = 'workbench.parts.editor', + STATUSBAR_PART = 'workbench.parts.statusbar' } -interface IWorkbenchStartedInfo { - customKeybindingsCount: number; - pinnedViewlets: string[]; - restoredViewlet: string; - restoredEditorsCount: number; +enum Settings { + MENUBAR_VISIBLE = 'window.menuBarVisibility', + ACTIVITYBAR_VISIBLE = 'workbench.activityBar.visible', + STATUSBAR_VISIBLE = 'workbench.statusBar.visible', + + SIDEBAR_POSITION = 'workbench.sideBar.location', + PANEL_POSITION = 'workbench.panel.defaultLocation', + + FONT_ALIASING = 'workbench.fontAliasing', + ZEN_MODE_RESTORE = 'zenMode.restore' } + type FontAliasingOption = 'default' | 'antialiased' | 'none' | 'auto'; - const fontAliasingValues: FontAliasingOption[] = ['antialiased', 'none', 'auto']; -const Identifiers = { - WORKBENCH_CONTAINER: 'workbench.main.container', - TITLEBAR_PART: 'workbench.parts.titlebar', - ACTIVITYBAR_PART: 'workbench.parts.activitybar', - SIDEBAR_PART: 'workbench.parts.sidebar', - PANEL_PART: 'workbench.parts.panel', - EDITOR_PART: 'workbench.parts.editor', - STATUSBAR_PART: 'workbench.parts.statusbar' -}; +enum State { + SIDEBAR_HIDDEN = 'workbench.sidebar.hidden', -interface IZenMode { - active: boolean; - transitionedToFullScreen: boolean; - transitionedToCenteredEditorLayout: boolean; - transitionDisposeables: IDisposable[]; - wasSideBarVisible: boolean; - wasPanelVisible: boolean; -} + PANEL_HIDDEN = 'workbench.panel.hidden', + PANEL_POSITION = 'workbench.panel.location', -interface IWorkbenchUIState { - lastPanelHeight?: number; - lastPanelWidth?: number; - lastSidebarDimension?: number; + ZEN_MODE_ENABLED = 'workbench.zenmode.active', + CENTERED_LAYOUT_ENABLED = 'workbench.centerededitorlayout.active', } export class Workbench extends Disposable implements IPartService { - private static readonly sidebarHiddenStorageKey = 'workbench.sidebar.hidden'; - private static readonly menubarVisibilityConfigurationKey = 'window.menuBarVisibility'; - private static readonly panelHiddenStorageKey = 'workbench.panel.hidden'; - private static readonly zenModeActiveStorageKey = 'workbench.zenmode.active'; - private static readonly centeredEditorLayoutActiveStorageKey = 'workbench.centerededitorlayout.active'; - private static readonly panelPositionStorageKey = 'workbench.panel.location'; - private static readonly defaultPanelPositionStorageKey = 'workbench.panel.defaultLocation'; - private static readonly sidebarPositionConfigurationKey = 'workbench.sideBar.location'; - private static readonly statusbarVisibleConfigurationKey = 'workbench.statusBar.visible'; - private static readonly activityBarVisibleConfigurationKey = 'workbench.activityBar.visible'; - private static readonly fontAliasingConfigurationKey = 'workbench.fontAliasing'; - _serviceBrand: any; private readonly _onShutdown = this._register(new Emitter()); @@ -214,12 +192,12 @@ export class Workbench extends Disposable implements IPartService { get onWillShutdown(): Event { return this._onWillShutdown.event; } private previousErrorValue: string; - private previousErrorTime: number = 0; + private previousErrorTime = 0; private workbench: HTMLElement; - private workbenchStarted: boolean; - private workbenchRestored: boolean; - private workbenchShutdown: boolean; + + private restored: boolean; + private disposed: boolean; private editorService: EditorService; private editorGroupService: IEditorGroupsService; @@ -232,10 +210,6 @@ export class Workbench extends Disposable implements IPartService { private telemetryService: ITelemetryService; private windowService: IWindowService; private lifecycleService: LifecycleService; - private fileService: IFileService; - private quickInput: QuickInputService; - - private workbenchGrid: Grid | WorkbenchLayout; private titlebarPart: TitlebarPart; private activitybarPart: ActivitybarPart; @@ -244,36 +218,13 @@ export class Workbench extends Disposable implements IPartService { private editorPart: EditorPart; private statusbarPart: StatusbarPart; - private titlebarPartView: View; - private activitybarPartView: View; - private sidebarPartView: View; - private panelPartView: View; - private editorPartView: View; - private statusbarPartView: View; - private quickOpen: QuickOpenController; + private quickInput: QuickInputService; + private notificationsCenter: NotificationsCenter; private notificationsToasts: NotificationsToasts; - private editorHidden: boolean; - private sideBarHidden: boolean; - private statusBarHidden: boolean; - private activityBarHidden: boolean; - private menubarToggled: boolean; - private sideBarPosition: Position; - private panelPosition: Position; - private panelHidden: boolean; - private menubarVisibility: MenuBarVisibility; - private zenMode: IZenMode; private fontAliasing: FontAliasingOption; - private hasInitialFilesToOpen: boolean; - private shouldCenterLayout = false; - private uiState: IWorkbenchUIState = { - lastPanelHeight: 350, - lastPanelWidth: 350, - lastSidebarDimension: 300, - }; - private inZenModeContext: IContextKey; private sideBarVisibleContext: IContextKey; @@ -291,11 +242,6 @@ export class Workbench extends Disposable implements IPartService { ) { super(); - this.hasInitialFilesToOpen = !!( - (configuration.filesToCreate && configuration.filesToCreate.length > 0) || - (configuration.filesToOpen && configuration.filesToOpen.length > 0) || - (configuration.filesToDiff && configuration.filesToDiff.length > 0)); - this.registerErrorHandler(); } @@ -358,7 +304,6 @@ export class Workbench extends Disposable implements IPartService { } private doStartup(): Promise { - this.workbenchStarted = true; // Logging this.logService.trace('workbench configuration', JSON.stringify(this.configuration)); @@ -381,9 +326,6 @@ export class Workbench extends Disposable implements IPartService { // Warm up font cache information before building up too many dom elements restoreFontInfo(this.storageService); readFontInfo(BareFontInfo.createFromRawSettings(this.configurationService.getValue('editor'), getZoomLevel())); - this._register(this.storageService.onWillSaveState(() => { - saveFontInfo(this.storageService); // Keep font info for next startup around - })); // Create Workbench Container this.createWorkbench(); @@ -400,7 +342,7 @@ export class Workbench extends Disposable implements IPartService { this.registerListeners(); // Settings - this.initSettings(); + this.initState(); // Create Workbench and Parts this.renderWorkbench(); @@ -421,7 +363,6 @@ export class Workbench extends Disposable implements IPartService { private createWorkbench(): void { this.workbench = document.createElement('div'); - this.workbench.id = Identifiers.WORKBENCH_CONTAINER; const platformClass = isWindows ? 'windows' : isLinux ? 'linux' : 'mac'; @@ -565,7 +506,7 @@ export class Workbench extends Disposable implements IPartService { serviceCollection.set(IContextViewService, this.contextViewService); // Use themable context menus when custom titlebar is enabled to match custom menubar - if (!isMacintosh && this.useCustomTitleBarStyle()) { + if (!isMacintosh && getTitleBarStyle(this.configurationService, this.environmentService) === 'custom') { serviceCollection.set(IContextMenuService, new SyncDescriptor(HTMLContextMenuService, [null])); } else { serviceCollection.set(IContextMenuService, new SyncDescriptor(NativeContextMenuService)); @@ -589,13 +530,13 @@ export class Workbench extends Disposable implements IPartService { serviceCollection.set(IActivityService, new SyncDescriptor(ActivityService, [this.activitybarPart, this.panelPart], true)); // File Service - this.fileService = this.instantiationService.createInstance(RemoteFileService); - serviceCollection.set(IFileService, this.fileService); - this.configurationService.acquireFileService(this.fileService); - this.themeService.acquireFileService(this.fileService); + const fileService = this.instantiationService.createInstance(RemoteFileService); + serviceCollection.set(IFileService, fileService); + this.configurationService.acquireFileService(fileService); + this.themeService.acquireFileService(fileService); // Editor and Group services - this.editorPart = this.instantiationService.createInstance(EditorPart, Identifiers.EDITOR_PART, !this.hasInitialFilesToOpen); + this.editorPart = this.instantiationService.createInstance(EditorPart, Identifiers.EDITOR_PART, !this.hasInitialFilesToOpen()); this.editorGroupService = this.editorPart; serviceCollection.set(IEditorGroupsService, this.editorPart); this.editorService = this.instantiationService.createInstance(EditorService); @@ -657,6 +598,13 @@ export class Workbench extends Disposable implements IPartService { this.configurationService.acquireInstantiationService(this.instantiationService); } + private hasInitialFilesToOpen(): boolean { + return !!( + (this.configuration.filesToCreate && this.configuration.filesToCreate.length > 0) || + (this.configuration.filesToOpen && this.configuration.filesToOpen.length > 0) || + (this.configuration.filesToDiff && this.configuration.filesToDiff.length > 0)); + } + //#region event handling private registerListeners(): void { @@ -665,21 +613,38 @@ export class Workbench extends Disposable implements IPartService { this._register(this.storageService.onWillSaveState(e => this.saveState(e))); // Restore editor if hidden and it changes - this._register(this.editorService.onDidVisibleEditorsChange(() => this.restoreHiddenEditor())); - this._register(this.editorPart.onDidActivateGroup(() => this.restoreHiddenEditor())); + this._register(this.editorService.onDidVisibleEditorsChange(() => this.setEditorHidden(false))); + this._register(this.editorPart.onDidActivateGroup(() => this.setEditorHidden(false))); // Configuration changes + this._register(this.configurationService.onDidChangeConfiguration(() => this.setFontAliasing())); this._register(this.configurationService.onDidChangeConfiguration(() => this.onDidUpdateConfiguration())); // Fullscreen changes this._register(onDidChangeFullscreen(() => this.onFullscreenChanged())); // Group changes - this._register(this.editorGroupService.onDidAddGroup(() => this.centerEditorLayout(this.shouldCenterLayout))); - this._register(this.editorGroupService.onDidRemoveGroup(() => this.centerEditorLayout(this.shouldCenterLayout))); + this._register(this.editorGroupService.onDidAddGroup(() => this.centerEditorLayout(this.state.editor.centered))); + this._register(this.editorGroupService.onDidRemoveGroup(() => this.centerEditorLayout(this.state.editor.centered))); // Prevent workbench from scrolling #55456 this._register(addDisposableListener(this.workbench, EventType.SCROLL, () => this.workbench.scrollTop = 0)); + + // Menubar visibility changes + if ((isWindows || isLinux) && getTitleBarStyle(this.configurationService, this.environmentService) === 'custom') { + this._register(this.titlebarPart.onMenubarVisibilityChange(visible => this.onMenubarToggled(visible))); + } + } + + private onMenubarToggled(visible: boolean) { + if (visible !== this.state.menuBar.toggled) { + this.state.menuBar.toggled = visible; + + if (isFullscreen() && (this.state.menuBar.visibility === 'toggle' || this.state.menuBar.visibility === 'default')) { + this._onTitleBarVisibilityChange.fire(); + this.layout(); + } + } } private onFullscreenChanged(): void { @@ -690,65 +655,18 @@ export class Workbench extends Disposable implements IPartService { } else { removeClass(this.workbench, 'fullscreen'); - if (this.zenMode.transitionedToFullScreen && this.zenMode.active) { + if (this.state.zenMode.transitionedToFullScreen && this.state.zenMode.active) { this.toggleZenMode(); } } // Changing fullscreen state of the window has an impact on custom title bar visibility, so we need to update - if (this.useCustomTitleBarStyle()) { + if (getTitleBarStyle(this.configurationService, this.environmentService) === 'custom') { this._onTitleBarVisibilityChange.fire(); this.layout(); // handle title bar when fullscreen changes } } - private onMenubarToggled(visible: boolean) { - if (visible !== this.menubarToggled) { - this.menubarToggled = visible; - - if (isFullscreen() && (this.menubarVisibility === 'toggle' || this.menubarVisibility === 'default')) { - this._onTitleBarVisibilityChange.fire(); - this.layout(); - } - } - } - - private restoreHiddenEditor(): void { - if (this.editorHidden) { - this.setEditorHidden(false); - } - } - - private onDidUpdateConfiguration(skipLayout?: boolean): void { - const newSidebarPositionValue = this.configurationService.getValue(Workbench.sidebarPositionConfigurationKey); - const newSidebarPosition = (newSidebarPositionValue === 'right') ? Position.RIGHT : Position.LEFT; - if (newSidebarPosition !== this.getSideBarPosition()) { - this.setSideBarPosition(newSidebarPosition); - } - - this.setPanelPositionFromStorageOrConfig(); - - const fontAliasing = this.configurationService.getValue(Workbench.fontAliasingConfigurationKey); - if (fontAliasing !== this.fontAliasing) { - this.setFontAliasing(fontAliasing); - } - - if (!this.zenMode.active) { - const newStatusbarHiddenValue = !this.configurationService.getValue(Workbench.statusbarVisibleConfigurationKey); - if (newStatusbarHiddenValue !== this.statusBarHidden) { - this.setStatusBarHidden(newStatusbarHiddenValue, skipLayout); - } - - const newActivityBarHiddenValue = !this.configurationService.getValue(Workbench.activityBarVisibleConfigurationKey); - if (newActivityBarHiddenValue !== this.activityBarHidden) { - this.setActivityBarHidden(newActivityBarHiddenValue, skipLayout); - } - } - - const newMenubarVisibility = this.configurationService.getValue(Workbench.menubarVisibilityConfigurationKey); - this.setMenubarVisibility(newMenubarVisibility, !!skipLayout); - } - //#endregion private restoreParts(): Promise { @@ -777,7 +695,7 @@ export class Workbench extends Disposable implements IPartService { // Restore Sidebar let viewletIdToRestore: string | undefined; - if (!this.sideBarHidden) { + if (!this.state.sideBar.hidden) { this.sideBarVisibleContext.set(true); if (this.shouldRestoreLastOpenedViewlet()) { @@ -797,28 +715,26 @@ export class Workbench extends Disposable implements IPartService { // Restore Panel const panelRegistry = Registry.as(PanelExtensions.Panels); const panelId = this.storageService.get(PanelPart.activePanelSettingsKey, StorageScope.WORKSPACE, panelRegistry.getDefaultPanelId()); - if (!this.panelHidden && !!panelId) { + if (!this.state.panel.hidden && !!panelId) { mark('willRestorePanel'); - const isPanelToRestoreEnabled = !!this.panelPart.getPanels().filter(p => p.id === panelId).length; - const panelIdToRestore = isPanelToRestoreEnabled ? panelId : panelRegistry.getDefaultPanelId(); + const panelIdToRestore = this.panelPart.hasPanel(panelId) ? panelId : panelRegistry.getDefaultPanelId(); this.panelPart.openPanel(panelIdToRestore, false); mark('didRestorePanel'); } // Restore Zen Mode if active and supported for restore on startup - const zenConfig = this.configurationService.getValue('zenMode'); - const wasZenActive = this.storageService.getBoolean(Workbench.zenModeActiveStorageKey, StorageScope.WORKSPACE, false); - if (wasZenActive && zenConfig.restore) { + const wasZenActive = this.storageService.getBoolean(State.ZEN_MODE_ENABLED, StorageScope.WORKSPACE, false); + if (wasZenActive && this.configurationService.getValue(Settings.ZEN_MODE_RESTORE)) { this.toggleZenMode(true, true); } // Restore Forced Editor Center Mode - if (this.storageService.getBoolean(Workbench.centeredEditorLayoutActiveStorageKey, StorageScope.WORKSPACE, false)) { + if (this.storageService.getBoolean(State.CENTERED_LAYOUT_ENABLED, StorageScope.WORKSPACE, false)) { this.centerEditorLayout(true); } const onRestored = (error?: Error): void => { - this.workbenchRestored = true; + this.restored = true; // Set lifecycle phase to `Restored` this.lifecycleService.phase = LifecyclePhase.Restored; @@ -835,18 +751,13 @@ export class Workbench extends Disposable implements IPartService { onUnexpectedError(error); } - this.logStartupTelemetry({ - customKeybindingsCount: this.keybindingService.customKeybindingsCount(), - pinnedViewlets: this.activitybarPart.getPinnedViewletIds(), - restoredViewlet: viewletIdToRestore, - restoredEditorsCount: this.editorService.visibleEditors.length - }); + this.logStartupTelemetry(viewletIdToRestore); }; return Promise.all(restorePromises).then(() => onRestored(), error => onRestored(error)); } - private logStartupTelemetry(info: IWorkbenchStartedInfo): void { + private logStartupTelemetry(restoredViewlet: string): void { const { filesToOpen, filesToCreate, filesToDiff } = this.configuration; /* __GDPR__ @@ -877,12 +788,12 @@ export class Workbench extends Disposable implements IPartService { 'workbench.filesToOpen': filesToOpen && filesToOpen.length || 0, 'workbench.filesToCreate': filesToCreate && filesToCreate.length || 0, 'workbench.filesToDiff': filesToDiff && filesToDiff.length || 0, - customKeybindingsCount: info.customKeybindingsCount, + customKeybindingsCount: this.keybindingService.customKeybindingsCount(), theme: this.themeService.getColorTheme().id, language, - pinnedViewlets: info.pinnedViewlets, - restoredViewlet: info.restoredViewlet, - restoredEditors: info.restoredEditorsCount, + pinnedViewlets: this.activitybarPart.getPinnedViewletIds(), + restoredViewlet: restoredViewlet, + restoredEditors: this.editorService.visibleEditors.length, startupKind: this.lifecycleService.startupKind }); @@ -902,7 +813,7 @@ export class Workbench extends Disposable implements IPartService { private resolveEditorsToOpen(): Promise | IResourceEditor[] { // Files to open, diff or create - if (this.hasInitialFilesToOpen) { + if (this.hasInitialFilesToOpen()) { // Files to diff is exclusive const filesToDiff = this.toInputs(this.configuration.filesToDiff, false); @@ -980,165 +891,23 @@ export class Workbench extends Disposable implements IPartService { return startupEditor.value === 'newUntitledFile'; } - private initSettings(): void { - - // Editor visiblity - this.editorHidden = false; - - // Sidebar visibility - this.sideBarHidden = this.storageService.getBoolean(Workbench.sidebarHiddenStorageKey, StorageScope.WORKSPACE, this.contextService.getWorkbenchState() === WorkbenchState.EMPTY); - - // Panel part visibility - const panelRegistry = Registry.as(PanelExtensions.Panels); - this.panelHidden = this.storageService.getBoolean(Workbench.panelHiddenStorageKey, StorageScope.WORKSPACE, true); - if (!panelRegistry.getDefaultPanelId()) { - this.panelHidden = true; // we hide panel part if there is no default panel - } - - // Sidebar position - const sideBarPosition = this.configurationService.getValue(Workbench.sidebarPositionConfigurationKey); - this.sideBarPosition = (sideBarPosition === 'right') ? Position.RIGHT : Position.LEFT; - - // Panel position - this.setPanelPositionFromStorageOrConfig(); - - // Menubar visibility - const menuBarVisibility = this.configurationService.getValue(Workbench.menubarVisibilityConfigurationKey); - this.setMenubarVisibility(menuBarVisibility, true); - - // Statusbar visibility - const statusBarVisible = this.configurationService.getValue(Workbench.statusbarVisibleConfigurationKey); - this.statusBarHidden = !statusBarVisible; - - // Activity bar visibility - const activityBarVisible = this.configurationService.getValue(Workbench.activityBarVisibleConfigurationKey); - this.activityBarHidden = !activityBarVisible; - - // Font aliasing - this.fontAliasing = this.configurationService.getValue(Workbench.fontAliasingConfigurationKey); - - // Zen mode - this.zenMode = { - active: false, - transitionedToFullScreen: false, - transitionedToCenteredEditorLayout: false, - wasSideBarVisible: false, - wasPanelVisible: false, - transitionDisposeables: [] - }; - } - - private setPanelPositionFromStorageOrConfig() { - const defaultPanelPosition = this.configurationService.getValue(Workbench.defaultPanelPositionStorageKey); - const panelPosition = this.storageService.get(Workbench.panelPositionStorageKey, StorageScope.WORKSPACE, defaultPanelPosition); - - this.panelPosition = (panelPosition === 'right') ? Position.RIGHT : Position.BOTTOM; - } - - private useCustomTitleBarStyle(): boolean { - return getTitleBarStyle(this.configurationService, this.environmentService) === 'custom'; - } - - private saveLastPanelDimension(): void { - if (!(this.workbenchGrid instanceof Grid)) { - return; - } - - if (this.panelPosition === Position.BOTTOM) { - this.uiState.lastPanelHeight = this.workbenchGrid.getViewSize(this.panelPartView); - } else { - this.uiState.lastPanelWidth = this.workbenchGrid.getViewSize(this.panelPartView); - } - } - - private getLastPanelDimension(position: Position): number | undefined { - return position === Position.BOTTOM ? this.uiState.lastPanelHeight : this.uiState.lastPanelWidth; - } - - private setStatusBarHidden(hidden: boolean, skipLayout?: boolean): void { - this.statusBarHidden = hidden; - - // Adjust CSS - if (hidden) { - addClass(this.workbench, 'nostatusbar'); - } else { - removeClass(this.workbench, 'nostatusbar'); - } - - // Layout - if (!skipLayout) { - if (this.workbenchGrid instanceof Grid) { - this.layout(); - } else { - this.workbenchGrid.layout(); - } - } - } - - private setFontAliasing(aliasing: FontAliasingOption) { - this.fontAliasing = aliasing; - - // Remove all - removeClasses(this.workbench, ...fontAliasingValues.map(value => `monaco-font-aliasing-${value}`)); - - // Add specific - if (fontAliasingValues.some(option => option === aliasing)) { - addClass(this.workbench, `monaco-font-aliasing-${aliasing}`); - } - } - - private createWorkbenchLayout(): void { - if (this.configurationService.getValue('workbench.useExperimentalGridLayout')) { - - // Create view wrappers for all parts - this.titlebarPartView = new View(this.titlebarPart); - this.sidebarPartView = new View(this.sidebarPart); - this.activitybarPartView = new View(this.activitybarPart); - this.editorPartView = new View(this.editorPart); - this.panelPartView = new View(this.panelPart); - this.statusbarPartView = new View(this.statusbarPart); - - this.workbenchGrid = new Grid(this.editorPartView, { proportionalLayout: false }); - - this.workbench.prepend(this.workbenchGrid.element); - } else { - this.workbenchGrid = this.instantiationService.createInstance( - WorkbenchLayout, - this.container, - this.workbench, - { - titlebar: this.titlebarPart, - activitybar: this.activitybarPart, - editor: this.editorPart, - sidebar: this.sidebarPart, - panel: this.panelPart, - statusbar: this.statusbarPart, - }, - this.quickOpen, - this.quickInput, - this.notificationsCenter, - this.notificationsToasts - ); - } - } - private renderWorkbench(): void { // Apply sidebar state as CSS class - if (this.sideBarHidden) { + if (this.state.sideBar.hidden) { addClass(this.workbench, 'nosidebar'); } - if (this.panelHidden) { + if (this.state.panel.hidden) { addClass(this.workbench, 'nopanel'); } - if (this.statusBarHidden) { + if (this.state.statusBar.hidden) { addClass(this.workbench, 'nostatusbar'); } // Apply font aliasing - this.setFontAliasing(this.fontAliasing); + this.setFontAliasing(); // Apply fullscreen state if (isFullscreen()) { @@ -1156,55 +925,66 @@ export class Workbench extends Disposable implements IPartService { // Notification Handlers this.createNotificationsHandlers(); - - // Menubar visibility changes - if ((isWindows || isLinux) && this.useCustomTitleBarStyle()) { - this.titlebarPart.onMenubarVisibilityChange()(e => this.onMenubarToggled(e)); - } - // Add Workbench to DOM this.container.appendChild(this.workbench); } + private setFontAliasing() { + const aliasing = this.configurationService.getValue(Settings.FONT_ALIASING); + if (this.fontAliasing === aliasing) { + return; + } + + this.fontAliasing = aliasing; + + // Remove all + removeClasses(this.workbench, ...fontAliasingValues.map(value => `monaco-font-aliasing-${value}`)); + + // Add specific + if (fontAliasingValues.some(option => option === aliasing)) { + addClass(this.workbench, `monaco-font-aliasing-${aliasing}`); + } + } + private createTitlebarPart(): void { - const titlebarContainer = this.createPart(Identifiers.TITLEBAR_PART, ['part', 'titlebar'], 'contentinfo'); + const titlebarContainer = this.createPart(Identifiers.TITLEBAR_PART, 'contentinfo', 'titlebar'); this.titlebarPart.create(titlebarContainer); } private createActivityBarPart(): void { - const activitybarPartContainer = this.createPart(Identifiers.ACTIVITYBAR_PART, ['part', 'activitybar', this.sideBarPosition === Position.LEFT ? 'left' : 'right'], 'navigation'); + const activitybarPartContainer = this.createPart(Identifiers.ACTIVITYBAR_PART, 'navigation', 'activitybar', this.state.sideBar.position === Position.LEFT ? 'left' : 'right'); this.activitybarPart.create(activitybarPartContainer); } private createSidebarPart(): void { - const sidebarPartContainer = this.createPart(Identifiers.SIDEBAR_PART, ['part', 'sidebar', this.sideBarPosition === Position.LEFT ? 'left' : 'right'], 'complementary'); + const sidebarPartContainer = this.createPart(Identifiers.SIDEBAR_PART, 'complementary', 'sidebar', this.state.sideBar.position === Position.LEFT ? 'left' : 'right'); this.sidebarPart.create(sidebarPartContainer); } private createPanelPart(): void { - const panelPartContainer = this.createPart(Identifiers.PANEL_PART, ['part', 'panel', this.panelPosition === Position.BOTTOM ? 'bottom' : 'right'], 'complementary'); + const panelPartContainer = this.createPart(Identifiers.PANEL_PART, 'complementary', 'panel', this.state.panel.position === Position.BOTTOM ? 'bottom' : 'right'); this.panelPart.create(panelPartContainer); } private createEditorPart(): void { - const editorContainer = this.createPart(Identifiers.EDITOR_PART, ['part', 'editor'], 'main'); + const editorContainer = this.createPart(Identifiers.EDITOR_PART, 'main', 'editor'); this.editorPart.create(editorContainer); } private createStatusbarPart(): void { - const statusbarContainer = this.createPart(Identifiers.STATUSBAR_PART, ['part', 'statusbar'], 'contentinfo'); + const statusbarContainer = this.createPart(Identifiers.STATUSBAR_PART, 'contentinfo', 'statusbar'); this.statusbarPart.create(statusbarContainer); } - private createPart(id: string, classes: string[], role: string): HTMLElement { + private createPart(id: string, role: string, ...classes: string[]): HTMLElement { const part = document.createElement('div'); - classes.forEach(clazz => addClass(part, clazz)); + addClasses(part, 'part', ...classes); part.id = id; part.setAttribute('role', role); @@ -1246,25 +1026,28 @@ export class Workbench extends Disposable implements IPartService { } private saveState(e: IWillSaveStateEvent): void { - if (this.zenMode.active) { - this.storageService.store(Workbench.zenModeActiveStorageKey, true, StorageScope.WORKSPACE); + + // Zen Mode + if (this.state.zenMode.active) { + this.storageService.store(State.ZEN_MODE_ENABLED, true, StorageScope.WORKSPACE); } else { - this.storageService.remove(Workbench.zenModeActiveStorageKey, StorageScope.WORKSPACE); + this.storageService.remove(State.ZEN_MODE_ENABLED, StorageScope.WORKSPACE); } - if (e.reason === WillSaveStateReason.SHUTDOWN && this.zenMode.active) { - const zenConfig = this.configurationService.getValue('zenMode'); - if (!zenConfig.restore) { - // We will not restore zen mode, need to clear all zen mode state changes - this.toggleZenMode(true); + if (e.reason === WillSaveStateReason.SHUTDOWN && this.state.zenMode.active) { + if (!this.configurationService.getValue(Settings.ZEN_MODE_RESTORE)) { + this.toggleZenMode(true); // We will not restore zen mode, need to clear all zen mode state changes } } + + // Font info + saveFontInfo(this.storageService); } dispose(): void { super.dispose(); - this.workbenchShutdown = true; + this.disposed = true; } //#region IPartService @@ -1274,8 +1057,130 @@ export class Workbench extends Disposable implements IPartService { get onEditorLayout(): Event { return this.editorPart.onDidLayout; } + private workbenchGrid: Grid | WorkbenchLayout; + + private titleBarPartView: View; + private activityBarPartView: View; + private sideBarPartView: View; + private panelPartView: View; + private editorPartView: View; + private statusBarPartView: View; + + private state = { + menuBar: { + visibility: undefined as MenuBarVisibility, + toggled: false + }, + + activityBar: { + hidden: false + }, + + sideBar: { + hidden: false, + position: undefined as Position, + width: 300 + }, + + editor: { + hidden: false, + centered: false + }, + + panel: { + hidden: false, + position: undefined as Position, + height: 350, + width: 350 + }, + + statusBar: { + hidden: false + }, + + zenMode: { + active: false, + transitionedToFullScreen: false, + transitionedToCenteredEditorLayout: false, + wasSideBarVisible: false, + wasPanelVisible: false, + transitionDisposeables: [] as IDisposable[] + } + }; + + private onDidUpdateConfiguration(skipLayout?: boolean): void { + + // Sidebar Position + const newSidebarPositionValue = this.configurationService.getValue(Settings.SIDEBAR_POSITION); + const newSidebarPosition = (newSidebarPositionValue === 'right') ? Position.RIGHT : Position.LEFT; + if (newSidebarPosition !== this.getSideBarPosition()) { + this.setSideBarPosition(newSidebarPosition); + } + + // Panel Position + this.setPanelPositionFromStorageOrConfig(); + + if (!this.state.zenMode.active) { + + // Statusbar Visibility + const newStatusbarHiddenValue = !this.configurationService.getValue(Settings.STATUSBAR_VISIBLE); + if (newStatusbarHiddenValue !== this.state.statusBar.hidden) { + this.setStatusBarHidden(newStatusbarHiddenValue, skipLayout); + } + + // Activitybar Visibility + const newActivityBarHiddenValue = !this.configurationService.getValue(Settings.ACTIVITYBAR_VISIBLE); + if (newActivityBarHiddenValue !== this.state.activityBar.hidden) { + this.setActivityBarHidden(newActivityBarHiddenValue, skipLayout); + } + } + + // Menubar Visibility + const newMenubarVisibility = this.configurationService.getValue(Settings.MENUBAR_VISIBLE); + this.setMenubarVisibility(newMenubarVisibility, !!skipLayout); + } + + private initState(): void { + + // Sidebar visibility + this.state.sideBar.hidden = this.storageService.getBoolean(State.SIDEBAR_HIDDEN, StorageScope.WORKSPACE, this.contextService.getWorkbenchState() === WorkbenchState.EMPTY); + + // Panel part visibility + const panelRegistry = Registry.as(PanelExtensions.Panels); + this.state.panel.hidden = this.storageService.getBoolean(State.PANEL_HIDDEN, StorageScope.WORKSPACE, true); + if (!panelRegistry.getDefaultPanelId()) { + this.state.panel.hidden = true; // we hide panel part if there is no default panel + } + + // Sidebar Position + const sideBarPosition = this.configurationService.getValue(Settings.SIDEBAR_POSITION); + this.state.sideBar.position = (sideBarPosition === 'right') ? Position.RIGHT : Position.LEFT; + + // Panel Position + this.setPanelPositionFromStorageOrConfig(); + + // Menubar visibility + const menuBarVisibility = this.configurationService.getValue(Settings.MENUBAR_VISIBLE); + this.setMenubarVisibility(menuBarVisibility, true); + + // Statusbar visibility + const statusBarVisible = this.configurationService.getValue(Settings.STATUSBAR_VISIBLE); + this.state.statusBar.hidden = !statusBarVisible; + + // Activity bar visibility + const activityBarVisible = this.configurationService.getValue(Settings.ACTIVITYBAR_VISIBLE); + this.state.activityBar.hidden = !activityBarVisible; + } + + private setPanelPositionFromStorageOrConfig() { + const defaultPanelPosition = this.configurationService.getValue(Settings.PANEL_POSITION); + const panelPosition = this.storageService.get(State.PANEL_POSITION, StorageScope.WORKSPACE, defaultPanelPosition); + + this.state.panel.position = (panelPosition === 'right') ? Position.RIGHT : Position.BOTTOM; + } + isRestored(): boolean { - return !!(this.workbenchRestored && this.workbenchStarted); + return this.restored; } hasFocus(part: Parts): boolean { @@ -1285,6 +1190,7 @@ export class Workbench extends Disposable implements IPartService { } const container = this.getContainer(part); + return isAncestor(activeElement, container); } @@ -1310,29 +1216,29 @@ export class Workbench extends Disposable implements IPartService { isVisible(part: Parts): boolean { switch (part) { case Parts.TITLEBAR_PART: - if (!this.useCustomTitleBarStyle()) { + if (getTitleBarStyle(this.configurationService, this.environmentService) === 'native') { return false; } else if (!isFullscreen()) { return true; } else if (isMacintosh) { return false; - } else if (this.menubarVisibility === 'visible') { + } else if (this.state.menuBar.visibility === 'visible') { return true; - } else if (this.menubarVisibility === 'toggle' || this.menubarVisibility === 'default') { - return this.menubarToggled; + } else if (this.state.menuBar.visibility === 'toggle' || this.state.menuBar.visibility === 'default') { + return this.state.menuBar.toggled; } return false; case Parts.SIDEBAR_PART: - return !this.sideBarHidden; + return !this.state.sideBar.hidden; case Parts.PANEL_PART: - return !this.panelHidden; + return !this.state.panel.hidden; case Parts.STATUSBAR_PART: - return !this.statusBarHidden; + return !this.state.statusBar.hidden; case Parts.ACTIVITYBAR_PART: - return !this.activityBarHidden; + return !this.state.activityBar.hidden; case Parts.EDITOR_PART: - return this.workbenchGrid instanceof Grid ? !this.editorHidden : true; + return this.workbenchGrid instanceof Grid ? !this.state.editor.hidden : true; } return true; // any other part cannot be hidden @@ -1346,7 +1252,7 @@ export class Workbench extends Disposable implements IPartService { } else { offset = this.workbenchGrid.partLayoutInfo.titlebar.height; - if (isMacintosh || this.menubarVisibility === 'hidden') { + if (isMacintosh || this.state.menuBar.visibility === 'hidden') { offset /= getZoomFactor(); } } @@ -1360,8 +1266,8 @@ export class Workbench extends Disposable implements IPartService { } toggleZenMode(skipLayout?: boolean, restoring = false): void { - this.zenMode.active = !this.zenMode.active; - this.zenMode.transitionDisposeables = dispose(this.zenMode.transitionDisposeables); + this.state.zenMode.active = !this.state.zenMode.active; + this.state.zenMode.transitionDisposeables = dispose(this.state.zenMode.transitionDisposeables); // Check if zen mode transitioned to full screen and if now we are out of zen mode // -> we need to go out of full screen (same goes for the centered editor layout) @@ -1376,14 +1282,21 @@ export class Workbench extends Disposable implements IPartService { }; // Zen Mode Active - if (this.zenMode.active) { - const config = this.configurationService.getValue('zenMode'); + if (this.state.zenMode.active) { + const config: { + fullScreen: boolean; + centerLayout: boolean; + hideTabs: boolean; + hideActivityBar: boolean; + hideStatusBar: boolean; + hideLineNumbers: boolean; + } = this.configurationService.getValue('zenMode'); toggleFullScreen = !isFullscreen() && config.fullScreen; - this.zenMode.transitionedToFullScreen = restoring ? config.fullScreen : toggleFullScreen; - this.zenMode.transitionedToCenteredEditorLayout = !this.isEditorLayoutCentered() && config.centerLayout; - this.zenMode.wasSideBarVisible = this.isVisible(Parts.SIDEBAR_PART); - this.zenMode.wasPanelVisible = this.isVisible(Parts.PANEL_PART); + this.state.zenMode.transitionedToFullScreen = restoring ? config.fullScreen : toggleFullScreen; + this.state.zenMode.transitionedToCenteredEditorLayout = !this.isEditorLayoutCentered() && config.centerLayout; + this.state.zenMode.wasSideBarVisible = this.isVisible(Parts.SIDEBAR_PART); + this.state.zenMode.wasPanelVisible = this.isVisible(Parts.PANEL_PART); this.setPanelHidden(true, true); this.setSideBarHidden(true, true); @@ -1398,11 +1311,11 @@ export class Workbench extends Disposable implements IPartService { if (config.hideLineNumbers) { setLineNumbers('off'); - this.zenMode.transitionDisposeables.push(this.editorService.onDidVisibleEditorsChange(() => setLineNumbers('off'))); + this.state.zenMode.transitionDisposeables.push(this.editorService.onDidVisibleEditorsChange(() => setLineNumbers('off'))); } if (config.hideTabs && this.editorPart.partOptions.showTabs) { - this.zenMode.transitionDisposeables.push(this.editorPart.enforcePartOptions({ showTabs: false })); + this.state.zenMode.transitionDisposeables.push(this.editorPart.enforcePartOptions({ showTabs: false })); } if (config.centerLayout) { @@ -1412,15 +1325,15 @@ export class Workbench extends Disposable implements IPartService { // Zen Mode Inactive else { - if (this.zenMode.wasPanelVisible) { + if (this.state.zenMode.wasPanelVisible) { this.setPanelHidden(false, true); } - if (this.zenMode.wasSideBarVisible) { + if (this.state.zenMode.wasSideBarVisible) { this.setSideBarHidden(false, true); } - if (this.zenMode.transitionedToCenteredEditorLayout) { + if (this.state.zenMode.transitionedToCenteredEditorLayout) { this.centerEditorLayout(false, true); } setLineNumbers(this.configurationService.getValue('editor.lineNumbers')); @@ -1430,10 +1343,10 @@ export class Workbench extends Disposable implements IPartService { this.editorGroupService.activeGroup.focus(); - toggleFullScreen = this.zenMode.transitionedToFullScreen && isFullscreen(); + toggleFullScreen = this.state.zenMode.transitionedToFullScreen && isFullscreen(); } - this.inZenModeContext.set(this.zenMode.active); + this.inZenModeContext.set(this.state.zenMode.active); if (!skipLayout) { this.layout(); @@ -1444,98 +1357,65 @@ export class Workbench extends Disposable implements IPartService { } } - private updateGrid(): void { - if (!(this.workbenchGrid instanceof Grid)) { - return; + private setStatusBarHidden(hidden: boolean, skipLayout?: boolean): void { + this.state.statusBar.hidden = hidden; + + // Adjust CSS + if (hidden) { + addClass(this.workbench, 'nostatusbar'); + } else { + removeClass(this.workbench, 'nostatusbar'); } - let panelInGrid = this.workbenchGrid.hasView(this.panelPartView); - let sidebarInGrid = this.workbenchGrid.hasView(this.sidebarPartView); - let activityBarInGrid = this.workbenchGrid.hasView(this.activitybarPartView); - let statusBarInGrid = this.workbenchGrid.hasView(this.statusbarPartView); - let titlebarInGrid = this.workbenchGrid.hasView(this.titlebarPartView); - - // Add parts to grid - if (!statusBarInGrid) { - this.workbenchGrid.addView(this.statusbarPartView, Sizing.Split, this.editorPartView, Direction.Down); - statusBarInGrid = true; + // Layout + if (!skipLayout) { + if (this.workbenchGrid instanceof Grid) { + this.layout(); + } else { + this.workbenchGrid.layout(); + } } + } - if (!titlebarInGrid && this.useCustomTitleBarStyle()) { - this.workbenchGrid.addView(this.titlebarPartView, Sizing.Split, this.editorPartView, Direction.Up); - titlebarInGrid = true; - } + private createWorkbenchLayout(): void { + if (this.configurationService.getValue('workbench.useExperimentalGridLayout')) { - if (!activityBarInGrid) { - this.workbenchGrid.addView(this.activitybarPartView, Sizing.Split, panelInGrid && this.sideBarPosition === this.panelPosition ? this.panelPartView : this.editorPartView, this.sideBarPosition === Position.RIGHT ? Direction.Right : Direction.Left); - activityBarInGrid = true; - } + // Create view wrappers for all parts + this.titleBarPartView = new View(this.titlebarPart); + this.sideBarPartView = new View(this.sidebarPart); + this.activityBarPartView = new View(this.activitybarPart); + this.editorPartView = new View(this.editorPart); + this.panelPartView = new View(this.panelPart); + this.statusBarPartView = new View(this.statusbarPart); - if (!sidebarInGrid) { - this.workbenchGrid.addView(this.sidebarPartView, this.uiState.lastSidebarDimension !== undefined ? this.uiState.lastSidebarDimension : Sizing.Split, this.activitybarPartView, this.sideBarPosition === Position.LEFT ? Direction.Right : Direction.Left); - sidebarInGrid = true; - } + this.workbenchGrid = new Grid(this.editorPartView, { proportionalLayout: false }); - if (!panelInGrid) { - this.workbenchGrid.addView(this.panelPartView, this.getLastPanelDimension(this.panelPosition) !== undefined ? this.getLastPanelDimension(this.panelPosition) : Sizing.Split, this.editorPartView, this.panelPosition === Position.BOTTOM ? Direction.Down : Direction.Right); - panelInGrid = true; - } - - // Hide parts - if (this.panelHidden) { - this.panelPartView.hide(); - } - - if (this.statusBarHidden) { - this.statusbarPartView.hide(); - } - - if (!this.isVisible(Parts.TITLEBAR_PART)) { - this.titlebarPartView.hide(); - } - - if (this.activityBarHidden) { - this.activitybarPartView.hide(); - } - - if (this.sideBarHidden) { - this.sidebarPartView.hide(); - } - - if (this.editorHidden) { - this.editorPartView.hide(); - } - - // Show visible parts - if (!this.editorHidden) { - this.editorPartView.show(); - } - - if (!this.statusBarHidden) { - this.statusbarPartView.show(); - } - - if (this.isVisible(Parts.TITLEBAR_PART)) { - this.titlebarPartView.show(); - } - - if (!this.activityBarHidden) { - this.activitybarPartView.show(); - } - - if (!this.sideBarHidden) { - this.sidebarPartView.show(); - } - - if (!this.panelHidden) { - this.panelPartView.show(); + this.workbench.prepend(this.workbenchGrid.element); + } else { + this.workbenchGrid = this.instantiationService.createInstance( + WorkbenchLayout, + this.container, + this.workbench, + { + titlebar: this.titlebarPart, + activitybar: this.activitybarPart, + editor: this.editorPart, + sidebar: this.sidebarPart, + panel: this.panelPart, + statusbar: this.statusbarPart, + }, + this.quickOpen, + this.quickInput, + this.notificationsCenter, + this.notificationsToasts + ); } } layout(options?: ILayoutOptions): void { this.contextViewService.layout(); - if (this.workbenchStarted && !this.workbenchShutdown) { + if (!this.disposed) { if (this.workbenchGrid instanceof Grid) { const dimensions = getClientArea(this.container); position(this.workbench, 0, 0, 0, 0, 'relative'); @@ -1550,21 +1430,110 @@ export class Workbench extends Disposable implements IPartService { this.notificationsCenter.layout(dimensions); this.notificationsToasts.layout(dimensions); - // Update grid view membership - this.updateGrid(); + // Layout Grid + this.layoutGrid(); } else { this.workbenchGrid.layout(options); } } } + private layoutGrid(): void { + if (!(this.workbenchGrid instanceof Grid)) { + return; + } + + let panelInGrid = this.workbenchGrid.hasView(this.panelPartView); + let sidebarInGrid = this.workbenchGrid.hasView(this.sideBarPartView); + let activityBarInGrid = this.workbenchGrid.hasView(this.activityBarPartView); + let statusBarInGrid = this.workbenchGrid.hasView(this.statusBarPartView); + let titlebarInGrid = this.workbenchGrid.hasView(this.titleBarPartView); + + // Add parts to grid + if (!statusBarInGrid) { + this.workbenchGrid.addView(this.statusBarPartView, Sizing.Split, this.editorPartView, Direction.Down); + statusBarInGrid = true; + } + + if (!titlebarInGrid && getTitleBarStyle(this.configurationService, this.environmentService) === 'custom') { + this.workbenchGrid.addView(this.titleBarPartView, Sizing.Split, this.editorPartView, Direction.Up); + titlebarInGrid = true; + } + + if (!activityBarInGrid) { + this.workbenchGrid.addView(this.activityBarPartView, Sizing.Split, panelInGrid && this.state.sideBar.position === this.state.panel.position ? this.panelPartView : this.editorPartView, this.state.sideBar.position === Position.RIGHT ? Direction.Right : Direction.Left); + activityBarInGrid = true; + } + + if (!sidebarInGrid) { + this.workbenchGrid.addView(this.sideBarPartView, this.state.sideBar.width !== undefined ? this.state.sideBar.width : Sizing.Split, this.activityBarPartView, this.state.sideBar.position === Position.LEFT ? Direction.Right : Direction.Left); + sidebarInGrid = true; + } + + if (!panelInGrid) { + this.workbenchGrid.addView(this.panelPartView, this.getPanelDimension(this.state.panel.position) !== undefined ? this.getPanelDimension(this.state.panel.position) : Sizing.Split, this.editorPartView, this.state.panel.position === Position.BOTTOM ? Direction.Down : Direction.Right); + panelInGrid = true; + } + + // Hide parts + if (this.state.panel.hidden) { + this.panelPartView.hide(); + } + + if (this.state.statusBar.hidden) { + this.statusBarPartView.hide(); + } + + if (!this.isVisible(Parts.TITLEBAR_PART)) { + this.titleBarPartView.hide(); + } + + if (this.state.activityBar.hidden) { + this.activityBarPartView.hide(); + } + + if (this.state.sideBar.hidden) { + this.sideBarPartView.hide(); + } + + if (this.state.editor.hidden) { + this.editorPartView.hide(); + } + + // Show visible parts + if (!this.state.editor.hidden) { + this.editorPartView.show(); + } + + if (!this.state.statusBar.hidden) { + this.statusBarPartView.show(); + } + + if (this.isVisible(Parts.TITLEBAR_PART)) { + this.titleBarPartView.show(); + } + + if (!this.state.activityBar.hidden) { + this.activityBarPartView.show(); + } + + if (!this.state.sideBar.hidden) { + this.sideBarPartView.show(); + } + + if (!this.state.panel.hidden) { + this.panelPartView.show(); + } + } + isEditorLayoutCentered(): boolean { - return this.shouldCenterLayout; + return this.state.editor.centered; } centerEditorLayout(active: boolean, skipLayout?: boolean): void { - this.storageService.store(Workbench.centeredEditorLayoutActiveStorageKey, active, StorageScope.WORKSPACE); - this.shouldCenterLayout = active; + this.storageService.store(State.CENTERED_LAYOUT_ENABLED, active, StorageScope.WORKSPACE); + this.state.editor.centered = active; + let smartActive = active; if (this.editorPart.groups.length > 1 && this.configurationService.getValue('workbench.editor.centeredLayoutAutoResize')) { smartActive = false; // Respect the auto resize setting - do not go into centered layout if there is more than 1 group. @@ -1584,7 +1553,7 @@ export class Workbench extends Disposable implements IPartService { let view: View; switch (part) { case Parts.SIDEBAR_PART: - view = this.sidebarPartView; + view = this.sideBarPartView; case Parts.PANEL_PART: view = this.panelPartView; case Parts.EDITOR_PART: @@ -1601,7 +1570,7 @@ export class Workbench extends Disposable implements IPartService { } setActivityBarHidden(hidden: boolean, skipLayout?: boolean): void { - this.activityBarHidden = hidden; + this.state.activityBar.hidden = hidden; // Layout if (!skipLayout) { @@ -1614,14 +1583,14 @@ export class Workbench extends Disposable implements IPartService { } setEditorHidden(hidden: boolean, skipLayout?: boolean): void { - if (!(this.workbenchGrid instanceof Grid)) { + if (!(this.workbenchGrid instanceof Grid) || hidden === this.state.editor.hidden) { return; } - this.editorHidden = hidden; + this.state.editor.hidden = hidden; // The editor and the panel cannot be hidden at the same time - if (this.editorHidden && this.panelHidden) { + if (this.state.editor.hidden && this.state.panel.hidden) { this.setPanelHidden(false, true); } @@ -1631,7 +1600,7 @@ export class Workbench extends Disposable implements IPartService { } setSideBarHidden(hidden: boolean, skipLayout?: boolean): void { - this.sideBarHidden = hidden; + this.state.sideBar.hidden = hidden; this.sideBarVisibleContext.set(!hidden); // Adjust CSS @@ -1644,9 +1613,9 @@ export class Workbench extends Disposable implements IPartService { // If sidebar becomes hidden, also hide the current active Viewlet if any if (hidden && this.sidebarPart.getActiveViewlet()) { this.sidebarPart.hideActiveViewlet(); - const activePanel = this.panelPart.getActivePanel(); // Pass Focus to Editor or Panel if Sidebar is now hidden + const activePanel = this.panelPart.getActivePanel(); if (this.hasFocus(Parts.PANEL_PART) && activePanel) { activePanel.focus(); } else { @@ -1668,9 +1637,9 @@ export class Workbench extends Disposable implements IPartService { // Remember in settings const defaultHidden = this.contextService.getWorkbenchState() === WorkbenchState.EMPTY; if (hidden !== defaultHidden) { - this.storageService.store(Workbench.sidebarHiddenStorageKey, hidden ? 'true' : 'false', StorageScope.WORKSPACE); + this.storageService.store(State.SIDEBAR_HIDDEN, hidden ? 'true' : 'false', StorageScope.WORKSPACE); } else { - this.storageService.remove(Workbench.sidebarHiddenStorageKey, StorageScope.WORKSPACE); + this.storageService.remove(State.SIDEBAR_HIDDEN, StorageScope.WORKSPACE); } // Layout @@ -1684,7 +1653,7 @@ export class Workbench extends Disposable implements IPartService { } setPanelHidden(hidden: boolean, skipLayout?: boolean): void { - this.panelHidden = hidden; + this.state.panel.hidden = hidden; // Adjust CSS if (hidden) { @@ -1710,13 +1679,13 @@ export class Workbench extends Disposable implements IPartService { // Remember in settings if (!hidden) { - this.storageService.store(Workbench.panelHiddenStorageKey, 'false', StorageScope.WORKSPACE); + this.storageService.store(State.PANEL_HIDDEN, 'false', StorageScope.WORKSPACE); } else { - this.storageService.remove(Workbench.panelHiddenStorageKey, StorageScope.WORKSPACE); + this.storageService.remove(State.PANEL_HIDDEN, StorageScope.WORKSPACE); } - // The editor and panel cannot be hiddne at the same time - if (hidden && this.editorHidden) { + // The editor and panel cannot be hidden at the same time + if (hidden && this.state.editor.hidden) { this.setEditorHidden(false, true); } @@ -1751,19 +1720,19 @@ export class Workbench extends Disposable implements IPartService { } getSideBarPosition(): Position { - return this.sideBarPosition; + return this.state.sideBar.position; } - setSideBarPosition(position: Position): void { - const wasHidden = this.sideBarHidden; + private setSideBarPosition(position: Position): void { + const wasHidden = this.state.sideBar.hidden; - if (this.sideBarHidden) { + if (this.state.sideBar.hidden) { this.setSideBarHidden(false, true /* Skip Layout */); } const newPositionValue = (position === Position.LEFT) ? 'left' : 'right'; - const oldPositionValue = (this.sideBarPosition === Position.LEFT) ? 'left' : 'right'; - this.sideBarPosition = position; + const oldPositionValue = (this.state.sideBar.position === Position.LEFT) ? 'left' : 'right'; + this.state.sideBar.position = position; // Adjust CSS removeClass(this.activitybarPart.getContainer(), oldPositionValue); @@ -1777,15 +1746,14 @@ export class Workbench extends Disposable implements IPartService { // Layout if (this.workbenchGrid instanceof Grid) { - if (!wasHidden) { - this.uiState.lastSidebarDimension = this.workbenchGrid.getViewSize(this.sidebarPartView); + this.state.sideBar.width = this.workbenchGrid.getViewSize(this.sideBarPartView); } - this.workbenchGrid.removeView(this.sidebarPartView); - this.workbenchGrid.removeView(this.activitybarPartView); + this.workbenchGrid.removeView(this.sideBarPartView); + this.workbenchGrid.removeView(this.activityBarPartView); - if (!this.panelHidden && this.panelPosition === Position.BOTTOM) { + if (!this.state.panel.hidden && this.state.panel.position === Position.BOTTOM) { this.workbenchGrid.removeView(this.panelPartView); } @@ -1796,8 +1764,8 @@ export class Workbench extends Disposable implements IPartService { } setMenubarVisibility(visibility: MenuBarVisibility, skipLayout: boolean): void { - if (this.menubarVisibility !== visibility) { - this.menubarVisibility = visibility; + if (this.state.menuBar.visibility !== visibility) { + this.state.menuBar.visibility = visibility; // Layout if (!skipLayout) { @@ -1812,26 +1780,26 @@ export class Workbench extends Disposable implements IPartService { } getMenubarVisibility(): MenuBarVisibility { - return this.menubarVisibility; + return this.state.menuBar.visibility; } getPanelPosition(): Position { - return this.panelPosition; + return this.state.panel.position; } setPanelPosition(position: Position): void { - const wasHidden = this.panelHidden; + const wasHidden = this.state.panel.hidden; - if (this.panelHidden) { + if (this.state.panel.hidden) { this.setPanelHidden(false, true /* Skip Layout */); } else { - this.saveLastPanelDimension(); + this.savePanelDimension(); } const newPositionValue = (position === Position.BOTTOM) ? 'bottom' : 'right'; - const oldPositionValue = (this.panelPosition === Position.BOTTOM) ? 'bottom' : 'right'; - this.panelPosition = position; - this.storageService.store(Workbench.panelPositionStorageKey, PositionToString(this.panelPosition).toLowerCase(), StorageScope.WORKSPACE); + const oldPositionValue = (this.state.panel.position === Position.BOTTOM) ? 'bottom' : 'right'; + this.state.panel.position = position; + this.storageService.store(State.PANEL_POSITION, PositionToString(this.state.panel.position).toLowerCase(), StorageScope.WORKSPACE); // Adjust CSS removeClass(this.panelPart.getContainer(), oldPositionValue); @@ -1843,7 +1811,7 @@ export class Workbench extends Disposable implements IPartService { // Layout if (this.workbenchGrid instanceof Grid) { if (!wasHidden) { - this.saveLastPanelDimension(); + this.savePanelDimension(); } this.workbenchGrid.removeView(this.panelPartView); @@ -1853,5 +1821,21 @@ export class Workbench extends Disposable implements IPartService { } } + private getPanelDimension(position: Position): number | undefined { + return position === Position.BOTTOM ? this.state.panel.height : this.state.panel.width; + } + + private savePanelDimension(): void { + if (!(this.workbenchGrid instanceof Grid)) { + return; + } + + if (this.state.panel.position === Position.BOTTOM) { + this.state.panel.height = this.workbenchGrid.getViewSize(this.panelPartView); + } else { + this.state.panel.width = this.workbenchGrid.getViewSize(this.panelPartView); + } + } + //#endregion -} +} \ No newline at end of file diff --git a/src/vs/workbench/services/activity/browser/activityService.ts b/src/vs/workbench/services/activity/browser/activityService.ts index a5230bd32ae..e75331d2e3c 100644 --- a/src/vs/workbench/services/activity/browser/activityService.ts +++ b/src/vs/workbench/services/activity/browser/activityService.ts @@ -30,5 +30,4 @@ export class ActivityService implements IActivityService { getPinnedViewletIds(): string[] { return this.activitybarPart.getPinnedViewletIds(); } - } From cdbe7bff05ef8232726c4c2da00046dc2314f561 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 4 Mar 2019 08:42:51 +0100 Subject: [PATCH 66/90] resolve #69734 on master --- src/vs/workbench/browser/media/style.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/browser/media/style.css b/src/vs/workbench/browser/media/style.css index 0bd743e7af5..488552dc37c 100644 --- a/src/vs/workbench/browser/media/style.css +++ b/src/vs/workbench/browser/media/style.css @@ -91,16 +91,16 @@ body { cursor: pointer; } -.monaco-workbench .monaco-font-aliasing-antialiased { +.monaco-workbench.monaco-font-aliasing-antialiased { -webkit-font-smoothing: antialiased; } -.monaco-workbench .monaco-font-aliasing-none { +.monaco-workbench.monaco-font-aliasing-none { -webkit-font-smoothing: none; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - .monaco-workbench .monaco-font-aliasing-auto { + .monaco-workbench.monaco-font-aliasing-auto { -webkit-font-smoothing: antialiased; } } From f6703e50429d4885132381eea457ad560945bd60 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 4 Mar 2019 09:18:00 +0100 Subject: [PATCH 67/90] debt - group context keys in one place --- src/vs/workbench/browser/contextkeys.ts | 33 +++++++++++++++++-- .../workbench/electron-browser/workbench.ts | 24 +++++--------- .../services/part/common/partService.ts | 5 +++ 3 files changed, 44 insertions(+), 18 deletions(-) diff --git a/src/vs/workbench/browser/contextkeys.ts b/src/vs/workbench/browser/contextkeys.ts index 098badbdae0..79e2037b343 100644 --- a/src/vs/workbench/browser/contextkeys.ts +++ b/src/vs/workbench/browser/contextkeys.ts @@ -8,7 +8,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { InputFocusedContext } from 'vs/platform/contextkey/common/contextkeys'; import { IWindowConfiguration, IWindowService } from 'vs/platform/windows/common/windows'; -import { ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, TEXT_DIFF_EDITOR_ID, SplitEditorsVertically } from 'vs/workbench/common/editor'; +import { ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, TEXT_DIFF_EDITOR_ID, SplitEditorsVertically, InEditorZenModeContext } from 'vs/workbench/common/editor'; import { IsMacContext, IsLinuxContext, IsWindowsContext, HasMacNativeTabsContext, IsDevelopmentContext, SupportsWorkspacesContext, SupportsOpenFileFolderContext, WorkbenchStateContext, WorkspaceFolderCountContext } from 'vs/workbench/common/contextkeys'; import { trackFocus, addDisposableListener, EventType } from 'vs/base/browser/dom'; import { preferredSideBySideGroupDirection, GroupDirection, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; @@ -17,18 +17,28 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment' import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { EditorGroupsServiceImpl } from 'vs/workbench/browser/parts/editor/editor'; +import { SidebarVisibleContext } from 'vs/workbench/common/viewlet'; +import { IPartService, Parts } from 'vs/workbench/services/part/common/partService'; +import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; export class WorkbenchContextKeysHandler extends Disposable { private inputFocusedContext: IContextKey; + private activeEditorContext: IContextKey; private editorsVisibleContext: IContextKey; private textCompareEditorVisibleContext: IContextKey; private textCompareEditorActiveContext: IContextKey; private activeEditorGroupEmpty: IContextKey; private multipleEditorGroupsContext: IContextKey; + private splitEditorsVerticallyContext: IContextKey; + private workbenchStateContext: IContextKey; private workspaceFolderCountContext: IContextKey; - private splitEditorsVerticallyContext: IContextKey; + + + private inZenModeContext: IContextKey; + + private sideBarVisibleContext: IContextKey; constructor( @IContextKeyService private contextKeyService: IContextKeyService, @@ -37,7 +47,9 @@ export class WorkbenchContextKeysHandler extends Disposable { @IEnvironmentService private environmentService: IEnvironmentService, @IWindowService private windowService: IWindowService, @IEditorService private editorService: IEditorService, - @IEditorGroupsService private editorGroupService: EditorGroupsServiceImpl + @IEditorGroupsService private editorGroupService: EditorGroupsServiceImpl, + @IPartService private partService: IPartService, + @IViewletService private viewletService: IViewletService ) { super(); @@ -63,6 +75,11 @@ export class WorkbenchContextKeysHandler extends Disposable { this.updateSplitEditorsVerticallyContext(); } })); + + this._register(this.partService.onZenModeChange(enabled => this.inZenModeContext.set(enabled))); + + this._register(this.viewletService.onDidViewletClose(() => this.updateSideBarContextKeys())); + this._register(this.viewletService.onDidViewletOpen(() => this.updateSideBarContextKeys())); } private initContextKeys(): void { @@ -105,6 +122,12 @@ export class WorkbenchContextKeysHandler extends Disposable { // Editor Layout this.splitEditorsVerticallyContext = SplitEditorsVertically.bindTo(this.contextKeyService); this.updateSplitEditorsVerticallyContext(); + + // Zen Mode + this.inZenModeContext = InEditorZenModeContext.bindTo(this.contextKeyService); + + // Sidebar + this.sideBarVisibleContext = SidebarVisibleContext.bindTo(this.contextKeyService); } private updateEditorContextKeys(): void { @@ -178,4 +201,8 @@ export class WorkbenchContextKeysHandler extends Disposable { case WorkbenchState.WORKSPACE: return 'workspace'; } } + + private updateSideBarContextKeys(): void { + this.sideBarVisibleContext.set(this.partService.isVisible(Parts.SIDEBAR_PART)); + } } \ No newline at end of file diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index a6bc3e655bf..50ec10caaf9 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -19,7 +19,7 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { isWindows, isLinux, isMacintosh, language } from 'vs/base/common/platform'; import { IResourceInput } from 'vs/platform/editor/common/editor'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; -import { IEditorInputFactoryRegistry, Extensions as EditorExtensions, IUntitledResourceInput, IResourceDiffInput, InEditorZenModeContext } from 'vs/workbench/common/editor'; +import { IEditorInputFactoryRegistry, Extensions as EditorExtensions, IUntitledResourceInput, IResourceDiffInput } from 'vs/workbench/common/editor'; import { ActivitybarPart } from 'vs/workbench/browser/parts/activitybar/activitybarPart'; import { SidebarPart } from 'vs/workbench/browser/parts/sidebar/sidebarPart'; import { PanelPart } from 'vs/workbench/browser/parts/panel/panelPart'; @@ -40,7 +40,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur import { IJSONEditingService } from 'vs/workbench/services/configuration/common/jsonEditing'; import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; +import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IActivityService } from 'vs/workbench/services/activity/common/activity'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IFileService } from 'vs/platform/files/common/files'; @@ -111,7 +111,6 @@ import { WorkbenchThemeService } from 'vs/workbench/services/themes/browser/work import { IProductService } from 'vs/platform/product/common/product'; import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; import { WorkbenchContextKeysHandler } from 'vs/workbench/browser/contextkeys'; -import { SidebarVisibleContext } from 'vs/workbench/common/viewlet'; // import@node import { BackupFileService, InMemoryBackupFileService } from 'vs/workbench/services/backup/node/backupFileService'; @@ -202,7 +201,6 @@ export class Workbench extends Disposable implements IPartService { private editorService: EditorService; private editorGroupService: IEditorGroupsService; private contextViewService: ContextViewService; - private contextKeyService: IContextKeyService; private keybindingService: IKeybindingService; private backupFileService: IBackupFileService; private notificationService: NotificationService; @@ -225,8 +223,6 @@ export class Workbench extends Disposable implements IPartService { private notificationsToasts: NotificationsToasts; private fontAliasing: FontAliasingOption; - private inZenModeContext: IContextKey; - private sideBarVisibleContext: IContextKey; constructor( private container: HTMLElement, @@ -335,8 +331,6 @@ export class Workbench extends Disposable implements IPartService { // Context Keys this._register(this.instantiationService.createInstance(WorkbenchContextKeysHandler)); - this.inZenModeContext = InEditorZenModeContext.bindTo(this.contextKeyService); - this.sideBarVisibleContext = SidebarVisibleContext.bindTo(this.contextKeyService); // Register Listeners this.registerListeners(); @@ -494,8 +488,7 @@ export class Workbench extends Disposable implements IPartService { serviceCollection.set(IStatusbarService, this.statusbarPart); // Context Keys - this.contextKeyService = this.instantiationService.createInstance(ContextKeyService); - serviceCollection.set(IContextKeyService, this.contextKeyService); + serviceCollection.set(IContextKeyService, new SyncDescriptor(ContextKeyService)); // Keybindings this.keybindingService = this.instantiationService.createInstance(WorkbenchKeybindingService, window); @@ -696,8 +689,6 @@ export class Workbench extends Disposable implements IPartService { // Restore Sidebar let viewletIdToRestore: string | undefined; if (!this.state.sideBar.hidden) { - this.sideBarVisibleContext.set(true); - if (this.shouldRestoreLastOpenedViewlet()) { viewletIdToRestore = this.storageService.get(SidebarPart.activeViewletSettingsKey, StorageScope.WORKSPACE); } @@ -1055,6 +1046,9 @@ export class Workbench extends Disposable implements IPartService { private readonly _onTitleBarVisibilityChange: Emitter = this._register(new Emitter()); get onTitleBarVisibilityChange(): Event { return this._onTitleBarVisibilityChange.event; } + private readonly _onZenMode: Emitter = this._register(new Emitter()); + get onZenModeChange(): Event { return this._onZenMode.event; } + get onEditorLayout(): Event { return this.editorPart.onDidLayout; } private workbenchGrid: Grid | WorkbenchLayout; @@ -1346,8 +1340,6 @@ export class Workbench extends Disposable implements IPartService { toggleFullScreen = this.state.zenMode.transitionedToFullScreen && isFullscreen(); } - this.inZenModeContext.set(this.state.zenMode.active); - if (!skipLayout) { this.layout(); } @@ -1355,6 +1347,9 @@ export class Workbench extends Disposable implements IPartService { if (toggleFullScreen) { this.windowService.toggleFullScreen(); } + + // Event + this._onZenMode.fire(this.state.zenMode.active); } private setStatusBarHidden(hidden: boolean, skipLayout?: boolean): void { @@ -1601,7 +1596,6 @@ export class Workbench extends Disposable implements IPartService { setSideBarHidden(hidden: boolean, skipLayout?: boolean): void { this.state.sideBar.hidden = hidden; - this.sideBarVisibleContext.set(!hidden); // Adjust CSS if (hidden) { diff --git a/src/vs/workbench/services/part/common/partService.ts b/src/vs/workbench/services/part/common/partService.ts index c779417568b..07c381500f6 100644 --- a/src/vs/workbench/services/part/common/partService.ts +++ b/src/vs/workbench/services/part/common/partService.ts @@ -49,6 +49,11 @@ export interface IPartService { */ onTitleBarVisibilityChange: Event; + /** + * Emits when the zen mode is enabled or disabled. + */ + onZenModeChange: Event; + /** * Emits when the editor part's layout changes. */ From c10ea17d96516e53a542b3982f556a1bca1c99cb Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Mon, 4 Mar 2019 09:31:27 +0100 Subject: [PATCH 68/90] Syntax highlighting and check for .ipy files. Fixes #69694 --- extensions/python/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/python/package.json b/extensions/python/package.json index c81942af764..53ca25bd88f 100644 --- a/extensions/python/package.json +++ b/extensions/python/package.json @@ -10,7 +10,7 @@ "contributes": { "languages": [{ "id": "python", - "extensions": [ ".py", ".rpy", ".pyw", ".cpy", ".gyp", ".gypi", ".snakefile", ".smk", ".pyi"], + "extensions": [ ".py", ".rpy", ".pyw", ".cpy", ".gyp", ".gypi", ".snakefile", ".smk", ".pyi", ".ipy"], "aliases": [ "Python", "py" ], "firstLine": "^#!\\s*/.*\\bpython[0-9.-]*\\b", "configuration": "./language-configuration.json" From 6311e9ba1c21150a9d65a8371e0d9f50f08d4409 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 4 Mar 2019 09:42:33 +0100 Subject: [PATCH 69/90] fix compile --- src/vs/workbench/test/workbenchTestServices.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vs/workbench/test/workbenchTestServices.ts b/src/vs/workbench/test/workbenchTestServices.ts index d605a994a11..a3ff5279c3c 100644 --- a/src/vs/workbench/test/workbenchTestServices.ts +++ b/src/vs/workbench/test/workbenchTestServices.ts @@ -444,6 +444,8 @@ export class TestPartService implements IPartService { public _serviceBrand: any; + onZenModeChange: Event = Event.None; + private _onTitleBarVisibilityChange = new Emitter(); private _onMenubarVisibilityChange = new Emitter(); private _onEditorLayout = new Emitter(); From 595ac89613b2626e53025746b4a95bc5e9f4513f Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 4 Mar 2019 10:35:08 +0100 Subject: [PATCH 70/90] debt - move more things into workbench state object --- src/vs/workbench/browser/panel.ts | 7 + .../browser/parts/panel/panelPart.ts | 4 - .../workbench/electron-browser/workbench.ts | 336 ++++++++++-------- 3 files changed, 185 insertions(+), 162 deletions(-) diff --git a/src/vs/workbench/browser/panel.ts b/src/vs/workbench/browser/panel.ts index eee8dbfc218..d33465167e2 100644 --- a/src/vs/workbench/browser/panel.ts +++ b/src/vs/workbench/browser/panel.ts @@ -61,6 +61,13 @@ export class PanelRegistry extends CompositeRegistry { getDefaultPanelId(): string { return this.defaultPanelId; } + + /** + * Find out if a panel exists with the provided ID. + */ + hasPanel(id: string): boolean { + return this.getPanels().some(panel => panel.id === id); + } } /** diff --git a/src/vs/workbench/browser/parts/panel/panelPart.ts b/src/vs/workbench/browser/parts/panel/panelPart.ts index 87c274bf9ea..04dbc490a5c 100644 --- a/src/vs/workbench/browser/parts/panel/panelPart.ts +++ b/src/vs/workbench/browser/parts/panel/panelPart.ts @@ -234,10 +234,6 @@ export class PanelPart extends CompositePart implements IPanelService, IS return this.getPanels().filter(p => p.id === panelId).pop(); } - hasPanel(panelId: string): boolean { - return !!this.getPanels().filter(p => p.id === panelId).length; - } - getPanels(): PanelDescriptor[] { return Registry.as(PanelExtensions.Panels).getPanels() .sort((v1, v2) => typeof v1.order === 'number' && typeof v2.order === 'number' ? v1.order - v2.order : NaN); diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index 50ec10caaf9..77d601e49b3 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -28,6 +28,7 @@ import { TitlebarPart } from 'vs/workbench/browser/parts/titlebar/titlebarPart'; import { EditorPart } from 'vs/workbench/browser/parts/editor/editorPart'; import { IActionBarRegistry, Extensions as ActionBarExtensions } from 'vs/workbench/browser/actions'; import { PanelRegistry, Extensions as PanelExtensions } from 'vs/workbench/browser/panel'; +import { ViewletRegistry, Extensions as ViewletExtensions } from 'vs/workbench/browser/viewlet'; import { QuickOpenController } from 'vs/workbench/browser/parts/quickopen/quickOpenController'; import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; import { QuickInputService } from 'vs/workbench/browser/parts/quickinput/quickInput'; @@ -677,78 +678,63 @@ export class Workbench extends Disposable implements IPartService { return Promise.resolve(undefined); } - const editorsToOpen = this.resolveEditorsToOpen(); - - if (Array.isArray(editorsToOpen)) { - return openEditors(editorsToOpen, this.editorService); + if (Array.isArray(this.state.editor.editorsToOpen)) { + return openEditors(this.state.editor.editorsToOpen, this.editorService); } - return editorsToOpen.then(editors => openEditors(editors, this.editorService)); + return this.state.editor.editorsToOpen.then(editors => openEditors(editors, this.editorService)); }).then(() => mark('didRestoreEditors'))); // Restore Sidebar - let viewletIdToRestore: string | undefined; - if (!this.state.sideBar.hidden) { - if (this.shouldRestoreLastOpenedViewlet()) { - viewletIdToRestore = this.storageService.get(SidebarPart.activeViewletSettingsKey, StorageScope.WORKSPACE); - } - - if (!viewletIdToRestore) { - viewletIdToRestore = this.sidebarPart.getDefaultViewletId(); - } - + if (this.state.sideBar.viewletToRestore) { mark('willRestoreViewlet'); - restorePromises.push(this.sidebarPart.openViewlet(viewletIdToRestore) + restorePromises.push(this.sidebarPart.openViewlet(this.state.sideBar.viewletToRestore) .then(viewlet => viewlet || this.sidebarPart.openViewlet(this.sidebarPart.getDefaultViewletId())) .then(() => mark('didRestoreViewlet'))); } // Restore Panel - const panelRegistry = Registry.as(PanelExtensions.Panels); - const panelId = this.storageService.get(PanelPart.activePanelSettingsKey, StorageScope.WORKSPACE, panelRegistry.getDefaultPanelId()); - if (!this.state.panel.hidden && !!panelId) { + if (this.state.panel.panelToRestore) { mark('willRestorePanel'); - const panelIdToRestore = this.panelPart.hasPanel(panelId) ? panelId : panelRegistry.getDefaultPanelId(); - this.panelPart.openPanel(panelIdToRestore, false); + this.panelPart.openPanel(this.state.panel.panelToRestore, false); mark('didRestorePanel'); } - // Restore Zen Mode if active and supported for restore on startup - const wasZenActive = this.storageService.getBoolean(State.ZEN_MODE_ENABLED, StorageScope.WORKSPACE, false); - if (wasZenActive && this.configurationService.getValue(Settings.ZEN_MODE_RESTORE)) { + // Restore Zen Mode + if (this.state.zenMode.restore) { this.toggleZenMode(true, true); } - // Restore Forced Editor Center Mode - if (this.storageService.getBoolean(State.CENTERED_LAYOUT_ENABLED, StorageScope.WORKSPACE, false)) { + // Restore Editor Center Mode + if (this.state.editor.restoreCentered) { this.centerEditorLayout(true); } - const onRestored = (error?: Error): void => { - this.restored = true; - - // Set lifecycle phase to `Restored` - this.lifecycleService.phase = LifecyclePhase.Restored; - - // Set lifecycle phase to `Eventually` after a short delay and when - // idle (min 2.5sec, max 5sec) - setTimeout(() => { - this._register(runWhenIdle(() => { - this.lifecycleService.phase = LifecyclePhase.Eventually; - }, 2500)); - }, 2500); - - if (error) { - onUnexpectedError(error); - } - - this.logStartupTelemetry(viewletIdToRestore); - }; - - return Promise.all(restorePromises).then(() => onRestored(), error => onRestored(error)); + return Promise.all(restorePromises).then(() => this.whenRestored(), error => this.whenRestored(error)); } - private logStartupTelemetry(restoredViewlet: string): void { + private whenRestored(error?: Error): void { + this.restored = true; + + // Set lifecycle phase to `Restored` + this.lifecycleService.phase = LifecyclePhase.Restored; + + // Set lifecycle phase to `Eventually` after a short delay and when + // idle (min 2.5sec, max 5sec) + setTimeout(() => { + this._register(runWhenIdle(() => { + this.lifecycleService.phase = LifecyclePhase.Eventually; + }, 2500)); + }, 2500); + + if (error) { + onUnexpectedError(error); + } + + this.logStartupTelemetry(); + } + + private logStartupTelemetry(): void { const { filesToOpen, filesToCreate, filesToDiff } = this.configuration; /* __GDPR__ @@ -783,7 +769,7 @@ export class Workbench extends Disposable implements IPartService { theme: this.themeService.getColorTheme().id, language, pinnedViewlets: this.activitybarPart.getPinnedViewletIds(), - restoredViewlet: restoredViewlet, + restoredViewlet: this.state.sideBar.viewletToRestore, restoredEditors: this.editorService.visibleEditors.length, startupKind: this.lifecycleService.startupKind }); @@ -792,96 +778,6 @@ export class Workbench extends Disposable implements IPartService { mark('didStartWorkbench'); } - private shouldRestoreLastOpenedViewlet(): boolean { - if (!this.environmentService.isBuilt) { - return true; // always restore sidebar when we are in development mode - } - - // always restore sidebar when the window was reloaded - return this.lifecycleService.startupKind === StartupKind.ReloadedWindow; - } - - private resolveEditorsToOpen(): Promise | IResourceEditor[] { - - // Files to open, diff or create - if (this.hasInitialFilesToOpen()) { - - // Files to diff is exclusive - const filesToDiff = this.toInputs(this.configuration.filesToDiff, false); - if (filesToDiff && filesToDiff.length === 2) { - return [{ - leftResource: filesToDiff[0].resource, - rightResource: filesToDiff[1].resource, - options: { pinned: true }, - forceFile: true - }]; - } - - const filesToCreate = this.toInputs(this.configuration.filesToCreate, true); - const filesToOpen = this.toInputs(this.configuration.filesToOpen, false); - - // Otherwise: Open/Create files - return [...filesToOpen, ...filesToCreate]; - } - - // Empty workbench - else if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY && this.openUntitledFile()) { - const isEmpty = this.editorGroupService.count === 1 && this.editorGroupService.activeGroup.count === 0; - if (!isEmpty) { - return []; // do not open any empty untitled file if we restored editors from previous session - } - - return this.backupFileService.hasBackups().then(hasBackups => { - if (hasBackups) { - return []; // do not open any empty untitled file if we have backups to restore - } - - return [{}]; - }); - } - - return []; - } - - private toInputs(paths: IPath[], isNew: boolean): Array { - if (!paths || !paths.length) { - return []; - } - - return paths.map(p => { - const resource = p.fileUri; - let input: IResourceInput | IUntitledResourceInput; - if (isNew) { - input = { filePath: resource.fsPath, options: { pinned: true } } as IUntitledResourceInput; - } else { - input = { resource, options: { pinned: true }, forceFile: true } as IResourceInput; - } - - if (!isNew && p.lineNumber) { - input.options.selection = { - startLineNumber: p.lineNumber, - startColumn: p.columnNumber - }; - } - - return input; - }); - } - - private openUntitledFile() { - const startupEditor = this.configurationService.inspect('workbench.startupEditor'); - - // Fallback to previous workbench.welcome.enabled setting in case startupEditor is not defined - if (!startupEditor.user && !startupEditor.workspace) { - const welcomeEnabledValue = this.configurationService.getValue('workbench.welcome.enabled'); - if (typeof welcomeEnabledValue === 'boolean') { - return !welcomeEnabledValue; - } - } - - return startupEditor.value === 'newUntitledFile'; - } - private renderWorkbench(): void { // Apply sidebar state as CSS class @@ -1073,19 +969,23 @@ export class Workbench extends Disposable implements IPartService { sideBar: { hidden: false, position: undefined as Position, - width: 300 + width: 300, + viewletToRestore: undefined as string }, editor: { hidden: false, - centered: false + centered: false, + restoreCentered: false, + editorsToOpen: undefined as Promise | IResourceEditor[] }, panel: { hidden: false, position: undefined as Position, height: 350, - width: 350 + width: 350, + panelToRestore: undefined as string }, statusBar: { @@ -1094,6 +994,7 @@ export class Workbench extends Disposable implements IPartService { zenMode: { active: false, + restore: false, transitionedToFullScreen: false, transitionedToCenteredEditorLayout: false, wasSideBarVisible: false, @@ -1136,34 +1037,153 @@ export class Workbench extends Disposable implements IPartService { private initState(): void { + // Menubar visibility + this.state.menuBar.visibility = this.configurationService.getValue(Settings.MENUBAR_VISIBLE); + + // Activity bar visibility + this.state.activityBar.hidden = !this.configurationService.getValue(Settings.ACTIVITYBAR_VISIBLE); + // Sidebar visibility this.state.sideBar.hidden = this.storageService.getBoolean(State.SIDEBAR_HIDDEN, StorageScope.WORKSPACE, this.contextService.getWorkbenchState() === WorkbenchState.EMPTY); - // Panel part visibility - const panelRegistry = Registry.as(PanelExtensions.Panels); - this.state.panel.hidden = this.storageService.getBoolean(State.PANEL_HIDDEN, StorageScope.WORKSPACE, true); - if (!panelRegistry.getDefaultPanelId()) { - this.state.panel.hidden = true; // we hide panel part if there is no default panel + // Sidebar position + this.state.sideBar.position = (this.configurationService.getValue(Settings.SIDEBAR_POSITION) === 'right') ? Position.RIGHT : Position.LEFT; + + // Sidebar viewlet + if (!this.state.sideBar.hidden) { + const viewletRegistry = Registry.as(ViewletExtensions.Viewlets); + + // Only restore last viewlet if window was reloaded or we are in development mode + let viewletToRestore: string; + if (!this.environmentService.isBuilt || this.lifecycleService.startupKind === StartupKind.ReloadedWindow) { + viewletToRestore = this.storageService.get(SidebarPart.activeViewletSettingsKey, StorageScope.WORKSPACE, viewletRegistry.getDefaultViewletId()); + } else { + viewletToRestore = viewletRegistry.getDefaultViewletId(); + } + + if (viewletToRestore) { + this.state.sideBar.viewletToRestore = viewletToRestore; + } else { + this.state.sideBar.hidden = true; // we hide sidebar if there is no viewlet to restore + } } - // Sidebar Position - const sideBarPosition = this.configurationService.getValue(Settings.SIDEBAR_POSITION); - this.state.sideBar.position = (sideBarPosition === 'right') ? Position.RIGHT : Position.LEFT; + // Editor centered layout + this.state.editor.restoreCentered = this.storageService.getBoolean(State.CENTERED_LAYOUT_ENABLED, StorageScope.WORKSPACE, false); - // Panel Position + // Editors to open + this.state.editor.editorsToOpen = this.resolveEditorsToOpen(); + + // Panel visibility + this.state.panel.hidden = this.storageService.getBoolean(State.PANEL_HIDDEN, StorageScope.WORKSPACE, true); + + // Panel position this.setPanelPositionFromStorageOrConfig(); - // Menubar visibility - const menuBarVisibility = this.configurationService.getValue(Settings.MENUBAR_VISIBLE); - this.setMenubarVisibility(menuBarVisibility, true); + // Panel to restore + if (!this.state.panel.hidden) { + const panelRegistry = Registry.as(PanelExtensions.Panels); + + let panelToRestore = this.storageService.get(PanelPart.activePanelSettingsKey, StorageScope.WORKSPACE, panelRegistry.getDefaultPanelId()); + if (!panelRegistry.hasPanel(panelToRestore)) { + panelToRestore = panelRegistry.getDefaultPanelId(); // fallback to default if panel is unknown + } + + if (panelToRestore) { + this.state.panel.panelToRestore = panelToRestore; + } else { + this.state.panel.hidden = true; // we hide panel if there is no panel to restore + } + } // Statusbar visibility const statusBarVisible = this.configurationService.getValue(Settings.STATUSBAR_VISIBLE); this.state.statusBar.hidden = !statusBarVisible; - // Activity bar visibility - const activityBarVisible = this.configurationService.getValue(Settings.ACTIVITYBAR_VISIBLE); - this.state.activityBar.hidden = !activityBarVisible; + // Zen mode enablement + const wasZenActive = this.storageService.getBoolean(State.ZEN_MODE_ENABLED, StorageScope.WORKSPACE, false); + this.state.zenMode.restore = wasZenActive && this.configurationService.getValue(Settings.ZEN_MODE_RESTORE); + } + + private resolveEditorsToOpen(): Promise | IResourceEditor[] { + + // Files to open, diff or create + if (this.hasInitialFilesToOpen()) { + + // Files to diff is exclusive + const filesToDiff = this.toInputs(this.configuration.filesToDiff, false); + if (filesToDiff && filesToDiff.length === 2) { + return [{ + leftResource: filesToDiff[0].resource, + rightResource: filesToDiff[1].resource, + options: { pinned: true }, + forceFile: true + }]; + } + + const filesToCreate = this.toInputs(this.configuration.filesToCreate, true); + const filesToOpen = this.toInputs(this.configuration.filesToOpen, false); + + // Otherwise: Open/Create files + return [...filesToOpen, ...filesToCreate]; + } + + // Empty workbench + else if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY && this.openUntitledFile()) { + const isEmpty = this.editorGroupService.count === 1 && this.editorGroupService.activeGroup.count === 0; + if (!isEmpty) { + return []; // do not open any empty untitled file if we restored editors from previous session + } + + return this.backupFileService.hasBackups().then(hasBackups => { + if (hasBackups) { + return []; // do not open any empty untitled file if we have backups to restore + } + + return [{}]; + }); + } + + return []; + } + + private toInputs(paths: IPath[], isNew: boolean): Array { + if (!paths || !paths.length) { + return []; + } + + return paths.map(p => { + const resource = p.fileUri; + let input: IResourceInput | IUntitledResourceInput; + if (isNew) { + input = { filePath: resource.fsPath, options: { pinned: true } } as IUntitledResourceInput; + } else { + input = { resource, options: { pinned: true }, forceFile: true } as IResourceInput; + } + + if (!isNew && p.lineNumber) { + input.options.selection = { + startLineNumber: p.lineNumber, + startColumn: p.columnNumber + }; + } + + return input; + }); + } + + private openUntitledFile(): boolean { + const startupEditor = this.configurationService.inspect('workbench.startupEditor'); + + // Fallback to previous workbench.welcome.enabled setting in case startupEditor is not defined + if (!startupEditor.user && !startupEditor.workspace) { + const welcomeEnabledValue = this.configurationService.getValue('workbench.welcome.enabled'); + if (typeof welcomeEnabledValue === 'boolean') { + return !welcomeEnabledValue; + } + } + + return startupEditor.value === 'newUntitledFile'; } private setPanelPositionFromStorageOrConfig() { From bf8c66a079d36f5c17ceadf5a068a015df24d4be Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 4 Mar 2019 10:39:43 +0100 Subject: [PATCH 71/90] fix #69753 --- src/vs/workbench/api/node/extHostFileSystem.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/api/node/extHostFileSystem.ts b/src/vs/workbench/api/node/extHostFileSystem.ts index 2d6c3792d51..20f4f98a453 100644 --- a/src/vs/workbench/api/node/extHostFileSystem.ts +++ b/src/vs/workbench/api/node/extHostFileSystem.ts @@ -276,7 +276,7 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape { this._watches.set(session, subscription); } - $unwatch(session: number): void { + $unwatch(_handle: number, session: number): void { let subscription = this._watches.get(session); if (subscription) { subscription.dispose(); From d88970796edaf01e284ba50fb2777837f4c026a9 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 4 Mar 2019 10:39:59 +0100 Subject: [PATCH 72/90] storage - getInteger() => getNumber() --- src/vs/base/node/storage.ts | 10 +++++----- src/vs/base/test/node/storage/storage.test.ts | 6 +++--- .../contrib/find/test/findController.test.ts | 4 ++-- .../contrib/multicursor/test/multicursor.test.ts | 2 +- .../electron-browser/lifecycleService.ts | 2 +- src/vs/platform/storage/common/storage.ts | 8 ++++---- .../platform/storage/node/storageMainService.ts | 12 ++++++------ src/vs/platform/storage/node/storageService.ts | 8 ++++---- .../storage/test/node/storageService.test.ts | 16 ++++++++-------- src/vs/workbench/browser/layout.ts | 8 ++++---- .../browser/parts/views/viewsViewlet.ts | 2 +- .../contrib/debug/browser/debugToolbar.ts | 2 +- .../contrib/quickopen/browser/commandsHandler.ts | 2 +- .../languageSurveys.contribution.ts | 8 ++++---- .../surveys/electron-browser/nps.contribution.ts | 2 +- .../contrib/update/electron-browser/update.ts | 2 +- .../node/textResourcePropertiesService.ts | 2 +- 17 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/vs/base/node/storage.ts b/src/vs/base/node/storage.ts index 5197db44743..455b278aac7 100644 --- a/src/vs/base/node/storage.ts +++ b/src/vs/base/node/storage.ts @@ -61,8 +61,8 @@ export interface IStorage extends IDisposable { getBoolean(key: string, fallbackValue: boolean): boolean; getBoolean(key: string, fallbackValue?: boolean): boolean | undefined; - getInteger(key: string, fallbackValue: number): number; - getInteger(key: string, fallbackValue?: number): number | undefined; + getNumber(key: string, fallbackValue: number): number; + getNumber(key: string, fallbackValue?: number): number | undefined; set(key: string, value: string | boolean | number): Promise; delete(key: string): Promise; @@ -195,9 +195,9 @@ export class Storage extends Disposable implements IStorage { return value === 'true'; } - getInteger(key: string, fallbackValue: number): number; - getInteger(key: string, fallbackValue?: number): number | undefined; - getInteger(key: string, fallbackValue?: number): number | undefined { + getNumber(key: string, fallbackValue: number): number; + getNumber(key: string, fallbackValue?: number): number | undefined; + getNumber(key: string, fallbackValue?: number): number | undefined { const value = this.get(key); if (isUndefinedOrNull(value)) { diff --git a/src/vs/base/test/node/storage/storage.test.ts b/src/vs/base/test/node/storage/storage.test.ts index 67c918e9e77..bbd9e00d992 100644 --- a/src/vs/base/test/node/storage/storage.test.ts +++ b/src/vs/base/test/node/storage/storage.test.ts @@ -31,7 +31,7 @@ suite('Storage Library', () => { // Empty fallbacks equal(storage.get('foo', 'bar'), 'bar'); - equal(storage.getInteger('foo', 55), 55); + equal(storage.getNumber('foo', 55), 55); equal(storage.getBoolean('foo', true), true); let changes = new Set(); @@ -45,7 +45,7 @@ suite('Storage Library', () => { const set3Promise = storage.set('barBoolean', true); equal(storage.get('bar'), 'foo'); - equal(storage.getInteger('barNumber'), 55); + equal(storage.getNumber('barNumber'), 55); equal(storage.getBoolean('barBoolean'), true); equal(changes.size, 3); @@ -71,7 +71,7 @@ suite('Storage Library', () => { const delete3Promise = storage.delete('barBoolean'); ok(!storage.get('bar')); - ok(!storage.getInteger('barNumber')); + ok(!storage.getNumber('barNumber')); ok(!storage.getBoolean('barBoolean')); equal(changes.size, 3); diff --git a/src/vs/editor/contrib/find/test/findController.test.ts b/src/vs/editor/contrib/find/test/findController.test.ts index 41b06546a59..2e8e1c92f5d 100644 --- a/src/vs/editor/contrib/find/test/findController.test.ts +++ b/src/vs/editor/contrib/find/test/findController.test.ts @@ -65,7 +65,7 @@ suite('FindController', () => { onWillSaveState: Event.None, get: (key: string) => queryState[key], getBoolean: (key: string) => !!queryState[key], - getInteger: (key: string) => undefined, + getNumber: (key: string) => undefined, store: (key: string, value: any) => { queryState[key] = value; return Promise.resolve(); }, remove: (key) => undefined } as any); @@ -440,7 +440,7 @@ suite('FindController query options persistence', () => { onWillSaveState: Event.None, get: (key: string) => queryState[key], getBoolean: (key: string) => !!queryState[key], - getInteger: (key: string) => undefined, + getNumber: (key: string) => undefined, store: (key: string, value: any) => { queryState[key] = value; return Promise.resolve(); }, remove: (key) => undefined } as any); diff --git a/src/vs/editor/contrib/multicursor/test/multicursor.test.ts b/src/vs/editor/contrib/multicursor/test/multicursor.test.ts index c26d0b0fd58..f2715cbe06a 100644 --- a/src/vs/editor/contrib/multicursor/test/multicursor.test.ts +++ b/src/vs/editor/contrib/multicursor/test/multicursor.test.ts @@ -65,7 +65,7 @@ suite('Multicursor selection', () => { onWillSaveState: Event.None, get: (key: string) => queryState[key], getBoolean: (key: string) => !!queryState[key], - getInteger: (key: string) => undefined!, + getNumber: (key: string) => undefined!, store: (key: string, value: any) => { queryState[key] = value; return Promise.resolve(); }, remove: (key) => undefined } as IStorageService); diff --git a/src/vs/platform/lifecycle/electron-browser/lifecycleService.ts b/src/vs/platform/lifecycle/electron-browser/lifecycleService.ts index d073ecdeb60..7e74fc62cde 100644 --- a/src/vs/platform/lifecycle/electron-browser/lifecycleService.ts +++ b/src/vs/platform/lifecycle/electron-browser/lifecycleService.ts @@ -57,7 +57,7 @@ export class LifecycleService extends Disposable implements ILifecycleService { } private resolveStartupKind(): StartupKind { - const lastShutdownReason = this.storageService.getInteger(LifecycleService.LAST_SHUTDOWN_REASON_KEY, StorageScope.WORKSPACE); + const lastShutdownReason = this.storageService.getNumber(LifecycleService.LAST_SHUTDOWN_REASON_KEY, StorageScope.WORKSPACE); this.storageService.remove(LifecycleService.LAST_SHUTDOWN_REASON_KEY, StorageScope.WORKSPACE); let startupKind: StartupKind; diff --git a/src/vs/platform/storage/common/storage.ts b/src/vs/platform/storage/common/storage.ts index 13089daf59f..1861da449bd 100644 --- a/src/vs/platform/storage/common/storage.ts +++ b/src/vs/platform/storage/common/storage.ts @@ -67,8 +67,8 @@ export interface IStorageService { * The scope argument allows to define the scope of the storage * operation to either the current workspace only or all workspaces. */ - getInteger(key: string, scope: StorageScope, fallbackValue: number): number; - getInteger(key: string, scope: StorageScope, fallbackValue?: number): number | undefined; + getNumber(key: string, scope: StorageScope, fallbackValue: number): number; + getNumber(key: string, scope: StorageScope, fallbackValue?: number): number | undefined; /** * Store a value under the given key to storage. The value will be converted to a string. @@ -142,8 +142,8 @@ export class InMemoryStorageService extends Disposable implements IStorageServic return value === 'true'; } - getInteger(key: string, scope: StorageScope, fallbackValue: number): number; - getInteger(key: string, scope: StorageScope, fallbackValue?: number): number | undefined { + getNumber(key: string, scope: StorageScope, fallbackValue: number): number; + getNumber(key: string, scope: StorageScope, fallbackValue?: number): number | undefined { const value = this.getCache(scope).get(key); if (isUndefinedOrNull(value)) { diff --git a/src/vs/platform/storage/node/storageMainService.ts b/src/vs/platform/storage/node/storageMainService.ts index fdd88608429..eacff97fbc1 100644 --- a/src/vs/platform/storage/node/storageMainService.ts +++ b/src/vs/platform/storage/node/storageMainService.ts @@ -52,8 +52,8 @@ export interface IStorageMainService { * the provided defaultValue if the element is null or undefined. The element * will be converted to a number using parseInt with a base of 10. */ - getInteger(key: string, fallbackValue: number): number; - getInteger(key: string, fallbackValue?: number): number | undefined; + getNumber(key: string, fallbackValue: number): number; + getNumber(key: string, fallbackValue?: number): number | undefined; /** * Store a string value under the given key to storage. The value will @@ -362,10 +362,10 @@ export class StorageMainService extends Disposable implements IStorageMainServic return this.storage.getBoolean(key, fallbackValue); } - getInteger(key: string, fallbackValue: number): number; - getInteger(key: string, fallbackValue?: number): number | undefined; - getInteger(key: string, fallbackValue?: number): number | undefined { - return this.storage.getInteger(key, fallbackValue); + getNumber(key: string, fallbackValue: number): number; + getNumber(key: string, fallbackValue?: number): number | undefined; + getNumber(key: string, fallbackValue?: number): number | undefined { + return this.storage.getNumber(key, fallbackValue); } store(key: string, value: any): Promise { diff --git a/src/vs/platform/storage/node/storageService.ts b/src/vs/platform/storage/node/storageService.ts index 7e05b32576d..06870260f32 100644 --- a/src/vs/platform/storage/node/storageService.ts +++ b/src/vs/platform/storage/node/storageService.ts @@ -170,10 +170,10 @@ export class StorageService extends Disposable implements IStorageService { return this.getStorage(scope).getBoolean(key, fallbackValue); } - getInteger(key: string, scope: StorageScope, fallbackValue: number): number; - getInteger(key: string, scope: StorageScope): number | undefined; - getInteger(key: string, scope: StorageScope, fallbackValue?: number): number | undefined { - return this.getStorage(scope).getInteger(key, fallbackValue); + getNumber(key: string, scope: StorageScope, fallbackValue: number): number; + getNumber(key: string, scope: StorageScope): number | undefined; + getNumber(key: string, scope: StorageScope, fallbackValue?: number): number | undefined { + return this.getStorage(scope).getNumber(key, fallbackValue); } store(key: string, value: string | boolean | number, scope: StorageScope): void { diff --git a/src/vs/platform/storage/test/node/storageService.test.ts b/src/vs/platform/storage/test/node/storageService.test.ts index 634967a79a7..91478086ce4 100644 --- a/src/vs/platform/storage/test/node/storageService.test.ts +++ b/src/vs/platform/storage/test/node/storageService.test.ts @@ -48,8 +48,8 @@ suite('StorageService', () => { strictEqual(storage.get('Monaco.IDE.Core.Storage.Test.get', scope, 'foobar'), 'foobar'); strictEqual(storage.get('Monaco.IDE.Core.Storage.Test.get', scope, ''), ''); - strictEqual(storage.getInteger('Monaco.IDE.Core.Storage.Test.getInteger', scope, 5), 5); - strictEqual(storage.getInteger('Monaco.IDE.Core.Storage.Test.getInteger', scope, 0), 0); + strictEqual(storage.getNumber('Monaco.IDE.Core.Storage.Test.getNumber', scope, 5), 5); + strictEqual(storage.getNumber('Monaco.IDE.Core.Storage.Test.getNumber', scope, 0), 0); strictEqual(storage.getBoolean('Monaco.IDE.Core.Storage.Test.getBoolean', scope, true), true); strictEqual(storage.getBoolean('Monaco.IDE.Core.Storage.Test.getBoolean', scope, false), false); @@ -59,11 +59,11 @@ suite('StorageService', () => { storage.store('Monaco.IDE.Core.Storage.Test.get', '', scope); strictEqual(storage.get('Monaco.IDE.Core.Storage.Test.get', scope, (undefined)!), ''); - storage.store('Monaco.IDE.Core.Storage.Test.getInteger', 5, scope); - strictEqual(storage.getInteger('Monaco.IDE.Core.Storage.Test.getInteger', scope, (undefined)!), 5); + storage.store('Monaco.IDE.Core.Storage.Test.getNumber', 5, scope); + strictEqual(storage.getNumber('Monaco.IDE.Core.Storage.Test.getNumber', scope, (undefined)!), 5); - storage.store('Monaco.IDE.Core.Storage.Test.getInteger', 0, scope); - strictEqual(storage.getInteger('Monaco.IDE.Core.Storage.Test.getInteger', scope, (undefined)!), 0); + storage.store('Monaco.IDE.Core.Storage.Test.getNumber', 0, scope); + strictEqual(storage.getNumber('Monaco.IDE.Core.Storage.Test.getNumber', scope, (undefined)!), 0); storage.store('Monaco.IDE.Core.Storage.Test.getBoolean', true, scope); strictEqual(storage.getBoolean('Monaco.IDE.Core.Storage.Test.getBoolean', scope, (undefined)!), true); @@ -72,7 +72,7 @@ suite('StorageService', () => { strictEqual(storage.getBoolean('Monaco.IDE.Core.Storage.Test.getBoolean', scope, (undefined)!), false); strictEqual(storage.get('Monaco.IDE.Core.Storage.Test.getDefault', scope, 'getDefault'), 'getDefault'); - strictEqual(storage.getInteger('Monaco.IDE.Core.Storage.Test.getIntegerDefault', scope, 5), 5); + strictEqual(storage.getNumber('Monaco.IDE.Core.Storage.Test.getNumberDefault', scope, 5), 5); strictEqual(storage.getBoolean('Monaco.IDE.Core.Storage.Test.getBooleanDefault', scope, true), true); } @@ -111,7 +111,7 @@ suite('StorageService', () => { await storage.migrate({ id: String(Date.now() + 100) }); equal(storage.get('bar', StorageScope.WORKSPACE), 'foo'); - equal(storage.getInteger('barNumber', StorageScope.WORKSPACE), 55); + equal(storage.getNumber('barNumber', StorageScope.WORKSPACE), 55); equal(storage.getBoolean('barBoolean', StorageScope.GLOBAL), true); await storage.close(); diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index 819bb315340..e9711a46e71 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -103,13 +103,13 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr } private restorePreviousState(): void { - this._sidebarWidth = Math.max(this.partLayoutInfo.sidebar.minWidth, this.storageService.getInteger(WorkbenchLayout.sashXOneWidthSettingsKey, StorageScope.GLOBAL, DEFAULT_SIDEBAR_PART_WIDTH)); + this._sidebarWidth = Math.max(this.partLayoutInfo.sidebar.minWidth, this.storageService.getNumber(WorkbenchLayout.sashXOneWidthSettingsKey, StorageScope.GLOBAL, DEFAULT_SIDEBAR_PART_WIDTH)); - this._panelWidth = Math.max(this.partLayoutInfo.panel.minWidth, this.storageService.getInteger(WorkbenchLayout.sashXTwoWidthSettingsKey, StorageScope.GLOBAL, DEFAULT_PANEL_PART_SIZE)); - this._panelHeight = Math.max(this.partLayoutInfo.panel.minHeight, this.storageService.getInteger(WorkbenchLayout.sashYHeightSettingsKey, StorageScope.GLOBAL, DEFAULT_PANEL_PART_SIZE)); + this._panelWidth = Math.max(this.partLayoutInfo.panel.minWidth, this.storageService.getNumber(WorkbenchLayout.sashXTwoWidthSettingsKey, StorageScope.GLOBAL, DEFAULT_PANEL_PART_SIZE)); + this._panelHeight = Math.max(this.partLayoutInfo.panel.minHeight, this.storageService.getNumber(WorkbenchLayout.sashYHeightSettingsKey, StorageScope.GLOBAL, DEFAULT_PANEL_PART_SIZE)); this.panelMaximized = false; - this.panelSizeBeforeMaximized = this.storageService.getInteger(WorkbenchLayout.panelSizeBeforeMaximizedKey, StorageScope.GLOBAL, 0); + this.panelSizeBeforeMaximized = this.storageService.getNumber(WorkbenchLayout.panelSizeBeforeMaximizedKey, StorageScope.GLOBAL, 0); } private registerListeners(): void { diff --git a/src/vs/workbench/browser/parts/views/viewsViewlet.ts b/src/vs/workbench/browser/parts/views/viewsViewlet.ts index 4a63b4a810b..55b19d00586 100644 --- a/src/vs/workbench/browser/parts/views/viewsViewlet.ts +++ b/src/vs/workbench/browser/parts/views/viewsViewlet.ts @@ -67,7 +67,7 @@ export abstract class ViewContainerViewlet extends PanelViewlet implements IView this.viewletState = this.getMemento(StorageScope.WORKSPACE); this.visibleViewsStorageId = `${id}.numberOfVisibleViews`; - this.visibleViewsCountFromCache = this.storageService.getInteger(this.visibleViewsStorageId, StorageScope.WORKSPACE, 1); + this.visibleViewsCountFromCache = this.storageService.getNumber(this.visibleViewsStorageId, StorageScope.WORKSPACE, 1); this._register(toDisposable(() => this.viewDisposables = dispose(this.viewDisposables))); } diff --git a/src/vs/workbench/contrib/debug/browser/debugToolbar.ts b/src/vs/workbench/contrib/debug/browser/debugToolbar.ts index cd9233d3714..f28f1268117 100644 --- a/src/vs/workbench/contrib/debug/browser/debugToolbar.ts +++ b/src/vs/workbench/contrib/debug/browser/debugToolbar.ts @@ -228,7 +228,7 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution { this.$el.style.left = `${x}px`; if (y === undefined) { - y = this.storageService.getInteger(DEBUG_TOOLBAR_Y_KEY, StorageScope.GLOBAL, 0); + y = this.storageService.getNumber(DEBUG_TOOLBAR_Y_KEY, StorageScope.GLOBAL, 0); } const titleAreaHeight = 35; if ((y < titleAreaHeight / 2) || (y > titleAreaHeight + titleAreaHeight / 2)) { diff --git a/src/vs/workbench/contrib/quickopen/browser/commandsHandler.ts b/src/vs/workbench/contrib/quickopen/browser/commandsHandler.ts index 13019490a5b..0ebc16e91c7 100644 --- a/src/vs/workbench/contrib/quickopen/browser/commandsHandler.ts +++ b/src/vs/workbench/contrib/quickopen/browser/commandsHandler.ts @@ -111,7 +111,7 @@ class CommandsHistory extends Disposable { entries.forEach(entry => commandHistory.set(entry.key, entry.value)); } - commandCounter = this.storageService.getInteger(CommandsHistory.PREF_KEY_COUNTER, StorageScope.GLOBAL, commandCounter); + commandCounter = this.storageService.getNumber(CommandsHistory.PREF_KEY_COUNTER, StorageScope.GLOBAL, commandCounter); } push(commandId: string): void { diff --git a/src/vs/workbench/contrib/surveys/electron-browser/languageSurveys.contribution.ts b/src/vs/workbench/contrib/surveys/electron-browser/languageSurveys.contribution.ts index 318047f643b..447a3565881 100644 --- a/src/vs/workbench/contrib/surveys/electron-browser/languageSurveys.contribution.ts +++ b/src/vs/workbench/contrib/surveys/electron-browser/languageSurveys.contribution.ts @@ -40,13 +40,13 @@ class LanguageSurvey { const date = new Date().toDateString(); - if (storageService.getInteger(EDITED_LANGUAGE_COUNT_KEY, StorageScope.GLOBAL, 0) < data.editCount) { + if (storageService.getNumber(EDITED_LANGUAGE_COUNT_KEY, StorageScope.GLOBAL, 0) < data.editCount) { textFileService.models.onModelsSaved(e => { e.forEach(event => { if (event.kind === StateChange.SAVED) { const model = modelService.getModel(event.resource); if (model && model.getModeId() === data.languageId && date !== storageService.get(EDITED_LANGUAGE_DATE_KEY, StorageScope.GLOBAL)) { - const editedCount = storageService.getInteger(EDITED_LANGUAGE_COUNT_KEY, StorageScope.GLOBAL, 0) + 1; + const editedCount = storageService.getNumber(EDITED_LANGUAGE_COUNT_KEY, StorageScope.GLOBAL, 0) + 1; storageService.store(EDITED_LANGUAGE_COUNT_KEY, editedCount, StorageScope.GLOBAL); storageService.store(EDITED_LANGUAGE_DATE_KEY, date, StorageScope.GLOBAL); } @@ -60,7 +60,7 @@ class LanguageSurvey { return; } - const sessionCount = storageService.getInteger(SESSION_COUNT_KEY, StorageScope.GLOBAL, 0) + 1; + const sessionCount = storageService.getNumber(SESSION_COUNT_KEY, StorageScope.GLOBAL, 0) + 1; storageService.store(LAST_SESSION_DATE_KEY, date, StorageScope.GLOBAL); storageService.store(SESSION_COUNT_KEY, sessionCount, StorageScope.GLOBAL); @@ -68,7 +68,7 @@ class LanguageSurvey { return; } - if (storageService.getInteger(EDITED_LANGUAGE_COUNT_KEY, StorageScope.GLOBAL, 0) < data.editCount) { + if (storageService.getNumber(EDITED_LANGUAGE_COUNT_KEY, StorageScope.GLOBAL, 0) < data.editCount) { return; } diff --git a/src/vs/workbench/contrib/surveys/electron-browser/nps.contribution.ts b/src/vs/workbench/contrib/surveys/electron-browser/nps.contribution.ts index 7253741210e..c11fd38db20 100644 --- a/src/vs/workbench/contrib/surveys/electron-browser/nps.contribution.ts +++ b/src/vs/workbench/contrib/surveys/electron-browser/nps.contribution.ts @@ -39,7 +39,7 @@ class NPSContribution implements IWorkbenchContribution { return; } - const sessionCount = (storageService.getInteger(SESSION_COUNT_KEY, StorageScope.GLOBAL, 0) || 0) + 1; + const sessionCount = (storageService.getNumber(SESSION_COUNT_KEY, StorageScope.GLOBAL, 0) || 0) + 1; storageService.store(LAST_SESSION_DATE_KEY, date, StorageScope.GLOBAL); storageService.store(SESSION_COUNT_KEY, sessionCount, StorageScope.GLOBAL); diff --git a/src/vs/workbench/contrib/update/electron-browser/update.ts b/src/vs/workbench/contrib/update/electron-browser/update.ts index 02eae23b8f0..8faae3e5068 100644 --- a/src/vs/workbench/contrib/update/electron-browser/update.ts +++ b/src/vs/workbench/contrib/update/electron-browser/update.ts @@ -512,7 +512,7 @@ export class UpdateContribution implements IGlobalActivity { this.storageService.store('update/updateNotificationTime', currentMillis, StorageScope.GLOBAL); } - const updateNotificationMillis = this.storageService.getInteger('update/updateNotificationTime', StorageScope.GLOBAL, currentMillis); + const updateNotificationMillis = this.storageService.getNumber('update/updateNotificationTime', StorageScope.GLOBAL, currentMillis); const diffDays = (currentMillis - updateNotificationMillis) / (1000 * 60 * 60 * 24); return diffDays > 5; diff --git a/src/vs/workbench/services/textfile/node/textResourcePropertiesService.ts b/src/vs/workbench/services/textfile/node/textResourcePropertiesService.ts index 86503bc02d5..2d54b0c9e43 100644 --- a/src/vs/workbench/services/textfile/node/textResourcePropertiesService.ts +++ b/src/vs/workbench/services/textfile/node/textResourcePropertiesService.ts @@ -45,7 +45,7 @@ export class TextResourcePropertiesService implements ITextResourcePropertiesSer if (remoteAuthority) { if (resource.scheme !== Schemas.file) { const osCacheKey = `resource.authority.os.${remoteAuthority}`; - os = this.remoteEnvironment ? this.remoteEnvironment.os : /* Get it from cache */ this.storageService.getInteger(osCacheKey, StorageScope.WORKSPACE, OS); + os = this.remoteEnvironment ? this.remoteEnvironment.os : /* Get it from cache */ this.storageService.getNumber(osCacheKey, StorageScope.WORKSPACE, OS); this.storageService.store(osCacheKey, os, StorageScope.WORKSPACE); } } From 5f54123a0c82044bcb90e7591db4fa292892885b Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 4 Mar 2019 10:48:42 +0100 Subject: [PATCH 73/90] make IPreferenceService use sync descriptor, #69226 --- src/vs/workbench/electron-browser/workbench.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index 77d601e49b3..49cae59eb3f 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -575,7 +575,7 @@ export class Workbench extends Disposable implements IPartService { serviceCollection.set(IQuickInputService, this.quickInput); // PreferencesService - serviceCollection.set(IPreferencesService, this.instantiationService.createInstance(PreferencesService)); + serviceCollection.set(IPreferencesService, new SyncDescriptor(PreferencesService)); // Contributed services const contributedServices = getServices(); @@ -1852,4 +1852,4 @@ export class Workbench extends Disposable implements IPartService { } //#endregion -} \ No newline at end of file +} From 2469f39a58d457f6f206a4f5c0e7be28446f9af2 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 4 Mar 2019 10:49:25 +0100 Subject: [PATCH 74/90] :lipstick: --- .../workbench/electron-browser/workbench.ts | 228 +++++++++--------- 1 file changed, 112 insertions(+), 116 deletions(-) diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index 49cae59eb3f..849aec0a71d 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -353,7 +353,7 @@ export class Workbench extends Disposable implements IPartService { this.lifecycleService.when(LifecyclePhase.Restored).then(() => clearTimeout(timeoutHandle)); // Restore Parts - return this.restoreParts(); + return this.restoreParts().then(() => this.whenStarted(), error => this.whenStarted(error)); } private createWorkbench(): void { @@ -663,121 +663,6 @@ export class Workbench extends Disposable implements IPartService { //#endregion - private restoreParts(): Promise { - const restorePromises: Promise[] = []; - - // Restore Editorpart - mark('willRestoreEditors'); - restorePromises.push(this.editorPart.whenRestored.then(() => { - - function openEditors(editors: IResourceEditor[], editorService: IEditorService) { - if (editors.length) { - return editorService.openEditors(editors); - } - - return Promise.resolve(undefined); - } - - if (Array.isArray(this.state.editor.editorsToOpen)) { - return openEditors(this.state.editor.editorsToOpen, this.editorService); - } - - return this.state.editor.editorsToOpen.then(editors => openEditors(editors, this.editorService)); - }).then(() => mark('didRestoreEditors'))); - - // Restore Sidebar - if (this.state.sideBar.viewletToRestore) { - mark('willRestoreViewlet'); - restorePromises.push(this.sidebarPart.openViewlet(this.state.sideBar.viewletToRestore) - .then(viewlet => viewlet || this.sidebarPart.openViewlet(this.sidebarPart.getDefaultViewletId())) - .then(() => mark('didRestoreViewlet'))); - } - - // Restore Panel - if (this.state.panel.panelToRestore) { - mark('willRestorePanel'); - this.panelPart.openPanel(this.state.panel.panelToRestore, false); - mark('didRestorePanel'); - } - - // Restore Zen Mode - if (this.state.zenMode.restore) { - this.toggleZenMode(true, true); - } - - // Restore Editor Center Mode - if (this.state.editor.restoreCentered) { - this.centerEditorLayout(true); - } - - return Promise.all(restorePromises).then(() => this.whenRestored(), error => this.whenRestored(error)); - } - - private whenRestored(error?: Error): void { - this.restored = true; - - // Set lifecycle phase to `Restored` - this.lifecycleService.phase = LifecyclePhase.Restored; - - // Set lifecycle phase to `Eventually` after a short delay and when - // idle (min 2.5sec, max 5sec) - setTimeout(() => { - this._register(runWhenIdle(() => { - this.lifecycleService.phase = LifecyclePhase.Eventually; - }, 2500)); - }, 2500); - - if (error) { - onUnexpectedError(error); - } - - this.logStartupTelemetry(); - } - - private logStartupTelemetry(): void { - const { filesToOpen, filesToCreate, filesToDiff } = this.configuration; - - /* __GDPR__ - "workspaceLoad" : { - "userAgent" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "windowSize.innerHeight": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, - "windowSize.innerWidth": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, - "windowSize.outerHeight": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, - "windowSize.outerWidth": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, - "emptyWorkbench": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, - "workbench.filesToOpen": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, - "workbench.filesToCreate": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, - "workbench.filesToDiff": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, - "customKeybindingsCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, - "theme": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "language": { "classification": "SystemMetaData", "purpose": "BusinessInsight" }, - "pinnedViewlets": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "restoredViewlet": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "restoredEditors": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, - "pinnedViewlets": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "startupKind": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true } - } - */ - this.telemetryService.publicLog('workspaceLoad', { - userAgent: navigator.userAgent, - windowSize: { innerHeight: window.innerHeight, innerWidth: window.innerWidth, outerHeight: window.outerHeight, outerWidth: window.outerWidth }, - emptyWorkbench: this.contextService.getWorkbenchState() === WorkbenchState.EMPTY, - 'workbench.filesToOpen': filesToOpen && filesToOpen.length || 0, - 'workbench.filesToCreate': filesToCreate && filesToCreate.length || 0, - 'workbench.filesToDiff': filesToDiff && filesToDiff.length || 0, - customKeybindingsCount: this.keybindingService.customKeybindingsCount(), - theme: this.themeService.getColorTheme().id, - language, - pinnedViewlets: this.activitybarPart.getPinnedViewletIds(), - restoredViewlet: this.state.sideBar.viewletToRestore, - restoredEditors: this.editorService.visibleEditors.length, - startupKind: this.lifecycleService.startupKind - }); - - // Telemetry: startup metrics - mark('didStartWorkbench'); - } - private renderWorkbench(): void { // Apply sidebar state as CSS class @@ -912,6 +797,117 @@ export class Workbench extends Disposable implements IPartService { registerNotificationCommands(this.notificationsCenter, this.notificationsToasts); } + private restoreParts(): Promise { + const restorePromises: Promise[] = []; + + // Restore editors + mark('willRestoreEditors'); + restorePromises.push(this.editorPart.whenRestored.then(() => { + + function openEditors(editors: IResourceEditor[], editorService: IEditorService) { + if (editors.length) { + return editorService.openEditors(editors); + } + + return Promise.resolve(undefined); + } + + if (Array.isArray(this.state.editor.editorsToOpen)) { + return openEditors(this.state.editor.editorsToOpen, this.editorService); + } + + return this.state.editor.editorsToOpen.then(editors => openEditors(editors, this.editorService)); + }).then(() => mark('didRestoreEditors'))); + + // Restore Sidebar + if (this.state.sideBar.viewletToRestore) { + mark('willRestoreViewlet'); + restorePromises.push(this.sidebarPart.openViewlet(this.state.sideBar.viewletToRestore) + .then(viewlet => viewlet || this.sidebarPart.openViewlet(this.sidebarPart.getDefaultViewletId())) + .then(() => mark('didRestoreViewlet'))); + } + + // Restore Panel + if (this.state.panel.panelToRestore) { + mark('willRestorePanel'); + this.panelPart.openPanel(this.state.panel.panelToRestore, false); + mark('didRestorePanel'); + } + + // Restore Zen Mode + if (this.state.zenMode.restore) { + this.toggleZenMode(true, true); + } + + // Restore Editor Center Mode + if (this.state.editor.restoreCentered) { + this.centerEditorLayout(true); + } + + return Promise.all(restorePromises); + } + + private whenStarted(error?: Error): void { + this.restored = true; + + // Set lifecycle phase to `Restored` + this.lifecycleService.phase = LifecyclePhase.Restored; + + // Set lifecycle phase to `Eventually` after a short delay and when + // idle (min 2.5sec, max 5sec) + setTimeout(() => { + this._register(runWhenIdle(() => { + this.lifecycleService.phase = LifecyclePhase.Eventually; + }, 2500)); + }, 2500); + + if (error) { + onUnexpectedError(error); + } + + const { filesToOpen, filesToCreate, filesToDiff } = this.configuration; + + /* __GDPR__ + "workspaceLoad" : { + "userAgent" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, + "windowSize.innerHeight": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, + "windowSize.innerWidth": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, + "windowSize.outerHeight": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, + "windowSize.outerWidth": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, + "emptyWorkbench": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, + "workbench.filesToOpen": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, + "workbench.filesToCreate": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, + "workbench.filesToDiff": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, + "customKeybindingsCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, + "theme": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, + "language": { "classification": "SystemMetaData", "purpose": "BusinessInsight" }, + "pinnedViewlets": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, + "restoredViewlet": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, + "restoredEditors": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, + "pinnedViewlets": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, + "startupKind": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true } + } + */ + this.telemetryService.publicLog('workspaceLoad', { + userAgent: navigator.userAgent, + windowSize: { innerHeight: window.innerHeight, innerWidth: window.innerWidth, outerHeight: window.outerHeight, outerWidth: window.outerWidth }, + emptyWorkbench: this.contextService.getWorkbenchState() === WorkbenchState.EMPTY, + 'workbench.filesToOpen': filesToOpen && filesToOpen.length || 0, + 'workbench.filesToCreate': filesToCreate && filesToCreate.length || 0, + 'workbench.filesToDiff': filesToDiff && filesToDiff.length || 0, + customKeybindingsCount: this.keybindingService.customKeybindingsCount(), + theme: this.themeService.getColorTheme().id, + language, + pinnedViewlets: this.activitybarPart.getPinnedViewletIds(), + restoredViewlet: this.state.sideBar.viewletToRestore, + restoredEditors: this.editorService.visibleEditors.length, + startupKind: this.lifecycleService.startupKind + }); + + // Telemetry: startup metrics + mark('didStartWorkbench'); + } + private saveState(e: IWillSaveStateEvent): void { // Zen Mode From baf256a71b26cf7811aa0e27a797e47ab1c05124 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 4 Mar 2019 11:00:49 +0100 Subject: [PATCH 75/90] debt - move editor layout event out of workbench --- src/vs/workbench/browser/parts/panel/panelActions.ts | 9 ++++++--- .../splash/electron-browser/partsSplash.contribution.ts | 4 +++- .../contrib/watermark/electron-browser/watermark.ts | 6 ++++-- src/vs/workbench/electron-browser/workbench.ts | 4 +--- .../services/editor/common/editorGroupsService.ts | 6 ++++++ src/vs/workbench/services/part/common/partService.ts | 5 ----- src/vs/workbench/test/workbenchTestServices.ts | 6 +----- 7 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/vs/workbench/browser/parts/panel/panelActions.ts b/src/vs/workbench/browser/parts/panel/panelActions.ts index e5f639f4449..0ec0fe83d72 100644 --- a/src/vs/workbench/browser/parts/panel/panelActions.ts +++ b/src/vs/workbench/browser/parts/panel/panelActions.ts @@ -15,6 +15,7 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { IPartService, Parts, Position } from 'vs/workbench/services/part/common/partService'; import { ActivityAction } from 'vs/workbench/browser/parts/compositeBarActions'; import { IActivity } from 'vs/workbench/common/activity'; +import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; export class ClosePanelAction extends Action { @@ -100,6 +101,7 @@ export class TogglePanelPositionAction extends Action { id: string, label: string, @IPartService private readonly partService: IPartService, + @IEditorGroupsService editorGroupsService: IEditorGroupsService ) { super(id, label, partService.getPanelPosition() === Position.RIGHT ? 'move-panel-to-bottom' : 'move-panel-to-right'); @@ -111,7 +113,7 @@ export class TogglePanelPositionAction extends Action { this.label = positionRight ? TogglePanelPositionAction.MOVE_TO_BOTTOM_LABEL : TogglePanelPositionAction.MOVE_TO_RIGHT_LABEL; }; - this.toDispose.push(partService.onEditorLayout(() => setClassAndLabel())); + this.toDispose.push(editorGroupsService.onDidLayout(() => setClassAndLabel())); setClassAndLabel(); } @@ -143,13 +145,14 @@ export class ToggleMaximizedPanelAction extends Action { constructor( id: string, label: string, - @IPartService private readonly partService: IPartService + @IPartService private readonly partService: IPartService, + @IEditorGroupsService editorGroupsService: IEditorGroupsService ) { super(id, label, partService.isPanelMaximized() ? 'minimize-panel-action' : 'maximize-panel-action'); this.toDispose = []; - this.toDispose.push(partService.onEditorLayout(() => { + this.toDispose.push(editorGroupsService.onDidLayout(() => { const maximized = this.partService.isPanelMaximized(); this.class = maximized ? 'minimize-panel-action' : 'maximize-panel-action'; this.label = maximized ? ToggleMaximizedPanelAction.RESTORE_LABEL : ToggleMaximizedPanelAction.MAXIMIZE_LABEL; 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 b03134e1686..b8f8fbbf0a5 100644 --- a/src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts +++ b/src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts @@ -21,6 +21,7 @@ import { IPartService, Parts, Position } from 'vs/workbench/services/part/common import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IFileService } from 'vs/platform/files/common/files'; import { URI } from 'vs/base/common/uri'; +import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; class PartsSplash { @@ -38,11 +39,12 @@ class PartsSplash { @IEnvironmentService private readonly _envService: IEnvironmentService, @IBroadcastService private readonly _broadcastService: IBroadcastService, @ILifecycleService lifecycleService: ILifecycleService, + @IEditorGroupsService editorGroupsService: IEditorGroupsService ) { lifecycleService.when(LifecyclePhase.Restored).then(_ => this._removePartsSplash()); Event.debounce(Event.any( onDidChangeFullscreen, - _partService.onEditorLayout + editorGroupsService.onDidLayout ), () => { }, 800)(this._savePartsSplash, this, this._disposables); } diff --git a/src/vs/workbench/contrib/watermark/electron-browser/watermark.ts b/src/vs/workbench/contrib/watermark/electron-browser/watermark.ts index 150f230c22c..6e7a0f9f557 100644 --- a/src/vs/workbench/contrib/watermark/electron-browser/watermark.ts +++ b/src/vs/workbench/contrib/watermark/electron-browser/watermark.ts @@ -26,6 +26,7 @@ import { QUICKOPEN_ACTION_ID } from 'vs/workbench/browser/parts/quickopen/quicko import { TERMINAL_COMMAND_ID } from 'vs/workbench/contrib/terminal/common/terminalCommands'; import * as dom from 'vs/base/browser/dom'; import { KeybindingLabel } from 'vs/base/browser/ui/keybindingLabel/keybindingLabel'; +import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; const $ = dom.$; @@ -112,7 +113,8 @@ export class WatermarkContribution implements IWorkbenchContribution { @IPartService private readonly partService: IPartService, @IKeybindingService private readonly keybindingService: IKeybindingService, @IWorkspaceContextService private readonly contextService: IWorkspaceContextService, - @IConfigurationService private readonly configurationService: IConfigurationService + @IConfigurationService private readonly configurationService: IConfigurationService, + @IEditorGroupsService private readonly editorGroupsService: IEditorGroupsService ) { this.workbenchState = contextService.getWorkbenchState(); @@ -171,7 +173,7 @@ export class WatermarkContribution implements IWorkbenchContribution { update(); dom.prepend(container.firstElementChild as HTMLElement, this.watermark); this.toDispose.push(this.keybindingService.onDidUpdateKeybindings(update)); - this.toDispose.push(this.partService.onEditorLayout(({ height }: IDimension) => { + this.toDispose.push(this.editorGroupsService.onDidLayout(({ height }: IDimension) => { container.classList[height <= 478 ? 'add' : 'remove']('max-height-478px'); })); } diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index 849aec0a71d..7aaab4a467a 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -33,7 +33,7 @@ import { QuickOpenController } from 'vs/workbench/browser/parts/quickopen/quickO import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; import { QuickInputService } from 'vs/workbench/browser/parts/quickinput/quickInput'; import { getServices } from 'vs/platform/instantiation/common/extensions'; -import { Position, Parts, IPartService, IDimension, PositionToString, ILayoutOptions } from 'vs/workbench/services/part/common/partService'; +import { Position, Parts, IPartService, PositionToString, ILayoutOptions } from 'vs/workbench/services/part/common/partService'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IStorageService, StorageScope, IWillSaveStateEvent, WillSaveStateReason } from 'vs/platform/storage/common/storage'; import { ContextMenuService as HTMLContextMenuService } from 'vs/platform/contextview/browser/contextMenuService'; @@ -941,8 +941,6 @@ export class Workbench extends Disposable implements IPartService { private readonly _onZenMode: Emitter = this._register(new Emitter()); get onZenModeChange(): Event { return this._onZenMode.event; } - get onEditorLayout(): Event { return this.editorPart.onDidLayout; } - private workbenchGrid: Grid | WorkbenchLayout; private titleBarPartView: View; diff --git a/src/vs/workbench/services/editor/common/editorGroupsService.ts b/src/vs/workbench/services/editor/common/editorGroupsService.ts index 882c487b795..948c1ec185c 100644 --- a/src/vs/workbench/services/editor/common/editorGroupsService.ts +++ b/src/vs/workbench/services/editor/common/editorGroupsService.ts @@ -9,6 +9,7 @@ import { IEditorInput, IEditor, GroupIdentifier, IEditorInputWithOptions, CloseD import { IEditorOptions, ITextEditorOptions } from 'vs/platform/editor/common/editor'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IActiveEditor } from 'vs/workbench/services/editor/common/editorService'; +import { IDimension } from 'vs/editor/common/editorCommon'; export const IEditorGroupsService = createDecorator('editorGroupsService'); @@ -164,6 +165,11 @@ export interface IEditorGroupsService { */ readonly onDidMoveGroup: Event; + /** + * An event for when the group container is layed out. + */ + readonly onDidLayout: Event; + /** * An active group is the default location for new editors to open. */ diff --git a/src/vs/workbench/services/part/common/partService.ts b/src/vs/workbench/services/part/common/partService.ts index 07c381500f6..269ce816af3 100644 --- a/src/vs/workbench/services/part/common/partService.ts +++ b/src/vs/workbench/services/part/common/partService.ts @@ -54,11 +54,6 @@ export interface IPartService { */ onZenModeChange: Event; - /** - * Emits when the editor part's layout changes. - */ - onEditorLayout: Event; - /** * Asks the part service if all parts have been fully restored. For editor part * this means that the contents of editors have loaded. diff --git a/src/vs/workbench/test/workbenchTestServices.ts b/src/vs/workbench/test/workbenchTestServices.ts index a3ff5279c3c..6f31697329d 100644 --- a/src/vs/workbench/test/workbenchTestServices.ts +++ b/src/vs/workbench/test/workbenchTestServices.ts @@ -448,7 +448,6 @@ export class TestPartService implements IPartService { private _onTitleBarVisibilityChange = new Emitter(); private _onMenubarVisibilityChange = new Emitter(); - private _onEditorLayout = new Emitter(); public get onTitleBarVisibilityChange(): Event { return this._onTitleBarVisibilityChange.event; @@ -458,10 +457,6 @@ export class TestPartService implements IPartService { return this._onMenubarVisibilityChange.event; } - public get onEditorLayout(): Event { - return this._onEditorLayout.event; - } - public isRestored(): boolean { return true; } @@ -556,6 +551,7 @@ export class TestEditorGroupsService implements EditorGroupsServiceImpl { onDidAddGroup: Event = Event.None; onDidRemoveGroup: Event = Event.None; onDidMoveGroup: Event = Event.None; + onDidLayout: Event = Event.None; orientation: any; whenRestored: Promise = Promise.resolve(undefined); From 5893ace5c199d7fa3d8ae94b6aae1e4d3ae0da98 Mon Sep 17 00:00:00 2001 From: isidor Date: Mon, 4 Mar 2019 11:14:58 +0100 Subject: [PATCH 76/90] fixes #69755 --- .../files/browser/views/explorerView.ts | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/vs/workbench/contrib/files/browser/views/explorerView.ts b/src/vs/workbench/contrib/files/browser/views/explorerView.ts index eafa721b5bd..98fcd9cdb45 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerView.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerView.ts @@ -61,7 +61,6 @@ export class ExplorerView extends ViewletPanel { // Refresh is needed on the initial explorer open private shouldRefresh = true; - private setTreeInputPromise = Promise.resolve(); private dragHandler: DelayedDragHandler; private decorationProvider: ExplorerDecorationsProvider; private autoReveal = false; @@ -166,7 +165,7 @@ export class ExplorerView extends ViewletPanel { this.refresh(); })); - this.disposables.push(this.explorerService.onDidChangeRoots(() => this.setTreeInputPromise = this.setTreeInput())); + this.disposables.push(this.explorerService.onDidChangeRoots(() => this.setTreeInput())); this.disposables.push(this.explorerService.onDidChangeItem(e => this.refresh(e))); this.disposables.push(this.explorerService.onDidChangeEditable(async e => { const isEditing = !!this.explorerService.getEditableData(e); @@ -206,8 +205,7 @@ export class ExplorerView extends ViewletPanel { // If a refresh was requested and we are now visible, run it if (this.shouldRefresh) { this.shouldRefresh = false; - this.setTreeInputPromise = this.setTreeInput(); - await this.setTreeInputPromise; + await this.setTreeInput(); } // Find resource to focus from active editor input if set this.selectActiveFile(false, true); @@ -231,22 +229,21 @@ export class ExplorerView extends ViewletPanel { } focus(): void { - this.setTreeInputPromise.then(() => { - this.tree.domFocus(); - const focused = this.tree.getFocus(); - if (focused.length === 1) { - if (this.autoReveal) { - this.tree.reveal(focused[0], 0.5); - } + this.tree.domFocus(); - const activeFile = this.getActiveFile(); - if (!activeFile && !focused[0].isDirectory) { - // Open the focused element in the editor if there is currently no file opened #67708 - this.editorService.openEditor({ resource: focused[0].resource, options: { preserveFocus: true, revealIfVisible: true } }) - .then(undefined, onUnexpectedError); - } + const focused = this.tree.getFocus(); + if (focused.length === 1) { + if (this.autoReveal) { + this.tree.reveal(focused[0], 0.5); } - }); + + const activeFile = this.getActiveFile(); + if (!activeFile && !focused[0].isDirectory) { + // Open the focused element in the editor if there is currently no file opened #67708 + this.editorService.openEditor({ resource: focused[0].resource, options: { preserveFocus: true, revealIfVisible: true } }) + .then(undefined, onUnexpectedError); + } + } } private selectActiveFile(deselect?: boolean, reveal = this.autoReveal): void { From a1481e3e2e51f833ce5001500f4b4559c5777cb7 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Mon, 4 Mar 2019 11:15:47 +0100 Subject: [PATCH 77/90] Switch cpp and c grammar to jeff-hykin/cpp-textmate-grammar --- extensions/cpp/build/update-grammars.js | 4 +- extensions/cpp/cgmanifest.json | 10 +- extensions/cpp/syntaxes/c.tmLanguage.json | 306 +- extensions/cpp/syntaxes/cpp.tmLanguage.json | 2510 ++++++++++++++++- .../test/colorize-results/test-23630_cpp.json | 22 +- .../test/colorize-results/test-23850_cpp.json | 20 +- .../cpp/test/colorize-results/test_c.json | 418 +-- .../cpp/test/colorize-results/test_cc.json | 884 +++--- .../cpp/test/colorize-results/test_cpp.json | 774 ++--- .../test/colorize-results/test_m.json | 396 +-- 10 files changed, 4055 insertions(+), 1289 deletions(-) diff --git a/extensions/cpp/build/update-grammars.js b/extensions/cpp/build/update-grammars.js index f02f51ca2cc..406b326156c 100644 --- a/extensions/cpp/build/update-grammars.js +++ b/extensions/cpp/build/update-grammars.js @@ -6,8 +6,8 @@ var updateGrammar = require('../../../build/npm/update-grammar'); -updateGrammar.update('atom/language-c', 'grammars/c.cson', './syntaxes/c.tmLanguage.json'); -updateGrammar.update('atom/language-c', 'grammars/c%2B%2B.cson', './syntaxes/cpp.tmLanguage.json'); +updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/c.tmLanguage.json', './syntaxes/c.tmLanguage.json'); +updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/cpp.tmLanguage.json', './syntaxes/cpp.tmLanguage.json'); // `source.c.platform` which is still included by other grammars updateGrammar.update('textmate/c.tmbundle', 'Syntaxes/Platform.tmLanguage', './syntaxes/platform.tmLanguage.json'); diff --git a/extensions/cpp/cgmanifest.json b/extensions/cpp/cgmanifest.json index e6666933f61..08cd245eac1 100644 --- a/extensions/cpp/cgmanifest.json +++ b/extensions/cpp/cgmanifest.json @@ -4,14 +4,14 @@ "component": { "type": "git", "git": { - "name": "atom/language-c", - "repositoryUrl": "https://github.com/atom/language-c", - "commitHash": "9c0c5f202741a5647025db8d5df5fefba47b036c" + "name": "jeff-hykin/cpp-textmate-grammar", + "repositoryUrl": "https://github.com/jeff-hykin/cpp-textmate-grammar", + "commitHash": "d57808aa3db2242f1f2be1aec19649a852aaa52e" } }, "license": "MIT", - "version": "0.58.1", - "description": "The files syntaxes/c.json and syntaxes/c++.json were derived from the Atom package https://atom.io/packages/language-c which was originally converted from the C TextMate bundle https://github.com/textmate/c.tmbundle." + "version": "1.4.5", + "description": "The files syntaxes/c.json and syntaxes/c++.json were derived from https://github.com/atom/language-c which was originally converted from the C TextMate bundle https://github.com/textmate/c.tmbundle." }, { "component": { diff --git a/extensions/cpp/syntaxes/c.tmLanguage.json b/extensions/cpp/syntaxes/c.tmLanguage.json index bcd5470a64c..efb692081eb 100644 --- a/extensions/cpp/syntaxes/c.tmLanguage.json +++ b/extensions/cpp/syntaxes/c.tmLanguage.json @@ -1,10 +1,10 @@ { "information_for_contributors": [ - "This file has been converted from https://github.com/atom/language-c/blob/master/grammars/c.cson", + "This file has been converted from https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master//syntaxes/c.tmLanguage.json", "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/atom/language-c/commit/9c0c5f202741a5647025db8d5df5fefba47b036c", + "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/9de911d74546b9ae74c57e404515935a0405e696", "name": "C", "scopeName": "source.c", "patterns": [ @@ -50,6 +50,9 @@ { "include": "#operators" }, + { + "include": "#operator_overload" + }, { "include": "#numbers" }, @@ -57,7 +60,7 @@ "include": "#strings" }, { - "begin": "(?x)\n^\\s* ((\\#)\\s*define) \\s+ # define\n((?[a-zA-Z_$][\\w$]*)) # macro name\n(?:\n (\\()\n (\n \\s* \\g \\s* # first argument\n ((,) \\s* \\g \\s*)* # additional arguments\n (?:\\.\\.\\.)? # varargs ellipsis?\n )\n (\\))\n)?", + "begin": "(?x)\n^\\s* ((\\#)\\s*define) \\s+\t# define\n((?[a-zA-Z_$][\\w$]*))\t # macro name\n(?:\n (\\()\n\t(\n\t \\s* \\g \\s*\t\t # first argument\n\t ((,) \\s* \\g \\s*)* # additional arguments\n\t (?:\\.\\.\\.)?\t\t\t# varargs ellipsis?\n\t)\n (\\))\n)?", "beginCaptures": { "1": { "name": "keyword.control.directive.define.c" @@ -90,8 +93,8 @@ ] }, { - "begin": "^\\s*((#)\\s*(error|warning))\\b", - "captures": { + "begin": "^\\s*((#)\\s*(error|warning))\\b\\s*", + "beginCaptures": { "1": { "name": "keyword.control.directive.diagnostic.$3.c" }, @@ -99,17 +102,61 @@ "name": "punctuation.definition.directive.c" } }, - "end": "(?=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", - "end": "(?<=\\))(?!\\w)", + "begin": "(?!(?:not|compl|sizeof|new|delete|not_eq|bitand|xor|bitor|and|or|throw|and_eq|xor_eq|or_eq|alignof|alignas|typeid|noexcept|static_cast|dynamic_cast|const_cast|reinterpret_cast|while|for|do|if|else|goto|switch|try|catch|return|break|case|continue|default|auto|void|char|short|int|signed|unsigned|long|float|double|bool|wchar_t|u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t|pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t|const|static|volatile|register|restrict|constexpr|extern|inline|mutable|friend|NULL|true|false|TRUE|FALSE|nullptr|class|struct|union|enum|explicit|virtual|mutable|constexpr|consteval|private|protected|public|if|elif|else|endif|ifdef|ifndef|define|undef|include|line|error|warning|pragma|_Pragma|defined|__has_include|__has_cpp_attribute|this|template|namespace|using|operator|typedef|decltype|typename|asm|__asm__|atomic_cancel|atomic_commit|atomic_noexcept|concept|co_await|co_return|co_yield|export|import|module|reflexpr|requires|synchronized|thread_local|audit|axiom|transaction_safe|transaction_safe_dynamic)\\s*\\()(?=[a-zA-Z_][a-zA-Z0-9_]*\\s*\\()", + "end": "(?<=\\))", "name": "meta.function.c", "patterns": [ { @@ -282,15 +329,31 @@ "include": "#line_continuation_character" }, { - "match": "(\\[)|(\\])", - "captures": { + "name": "meta.bracket.square.access.c", + "begin": "([a-zA-Z_][a-zA-Z_0-9]*|(?<=[\\]\\)]))?(\\[)(?!\\])", + "beginCaptures": { "1": { - "name": "punctuation.definition.begin.bracket.square.c" + "name": "variable.object.c" }, "2": { + "name": "punctuation.definition.begin.bracket.square.c" + } + }, + "end": "\\]", + "endCaptures": { + "0": { "name": "punctuation.definition.end.bracket.square.c" } - } + }, + "patterns": [ + { + "include": "#function-call-innards" + } + ] + }, + { + "name": "storage.modifier.array.bracket.square.c", + "match": "\\[\\s*\\]" }, { "match": ";", @@ -302,8 +365,56 @@ } ], "repository": { - "access": { + "probably_a_parameter": { + "match": "(?:([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?==)|(?<=(?:[a-zA-Z0-9_]\\s|[&*>\\]\\)]))\\s*([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=(?:\\[\\]\\s*)?(?:,|\\))))", "captures": { + "1": { + "name": "variable.parameter.probably.defaulted.c" + }, + "2": { + "name": "variable.parameter.probably.c" + } + } + }, + "operator_overload": { + "begin": "((?:[a-zA-Z_][a-zA-Z0-9_]*\\s*(?:<(?:[\\s<>,\\w])*>\\s*)?::)*)(operator)((?:\\s*(?:\\+\\+|\\-\\-|\\(\\)|\\[\\]|\\->|\\+\\+|\\-\\-|\\+|\\-|!|~|\\*|&|\\->\\*|\\*|\\/|%|\\+|\\-|<<|>>|<=>|<|<=|>|>=|==|!=|&|\\^|\\||&&|\\|\\||=|\\+=|\\-=|\\*=|\\/=|%=|<<=|>>=|&=|\\^=|\\|=|,)|\\s+(?:(?:new|new\\[\\]|delete|delete\\[\\])|[a-zA-Z_][a-zA-Z0-9_]*)))\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.scope.c" + }, + "2": { + "name": "entity.name.operator.overload.c" + }, + "3": { + "name": "entity.name.operator.overloadee.c" + }, + "4": { + "name": "punctuation.section.parameters.begin.bracket.round.c" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parameters.end.bracket.round.c" + } + }, + "name": "meta.function.definition.parameters.operator-overload.c", + "patterns": [ + { + "include": "#probably_a_parameter" + }, + { + "include": "#function-innards" + } + ] + }, + "access-method": { + "name": "meta.function-call.member.c", + "begin": "([a-zA-Z_][a-zA-Z_0-9]*|(?<=[\\]\\)]))\\s*(?:(\\.)|(->))((?:(?:[a-zA-Z_][a-zA-Z_0-9]*)\\s*(?:(?:\\.)|(?:->)))*)\\s*([a-zA-Z_][a-zA-Z_0-9]*)(\\()", + "beginCaptures": { + "1": { + "name": "variable.object.c" + }, "2": { "name": "punctuation.separator.dot-access.c" }, @@ -311,10 +422,81 @@ "name": "punctuation.separator.pointer-access.c" }, "4": { - "name": "variable.other.member.c" + "patterns": [ + { + "match": "\\.", + "name": "punctuation.separator.dot-access.c" + }, + { + "match": "->", + "name": "punctuation.separator.pointer-access.c" + }, + { + "match": "[a-zA-Z_][a-zA-Z_0-9]*", + "name": "variable.object.c" + }, + { + "name": "everything.else", + "match": ".+" + } + ] + }, + "5": { + "name": "entity.name.function.member.c" + }, + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.function.member.c" } }, - "match": "((\\.)|(->))\\s*(([a-zA-Z_][a-zA-Z_0-9]*)\\b(?!\\s*\\())?" + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.function.member.c" + } + }, + "patterns": [ + { + "include": "#function-call-innards" + } + ] + }, + "access-member": { + "name": "variable.object.access.c", + "match": "(?:([a-zA-Z_][a-zA-Z0-9_]*)|(?<=\\]|\\)))\\s*(?:((?:\\.|\\.\\*))|((?:->|->\\*)))\\s*((?:[a-zA-Z_][a-zA-Z0-9_]*\\s*(?:\\.|->)\\s*)*)\\b(?!(?:auto|void|char|short|int|signed|unsigned|long|float|double|bool|wchar_t|u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t|pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t))([a-zA-Z_][a-zA-Z0-9_]*)\\b(?!\\()", + "captures": { + "1": { + "name": "variable.object.c" + }, + "2": { + "name": "punctuation.separator.dot-access.c" + }, + "3": { + "name": "punctuation.separator.pointer-access.c" + }, + "4": { + "patterns": [ + { + "match": "\\.", + "name": "punctuation.separator.dot-access.c" + }, + { + "match": "->", + "name": "punctuation.separator.pointer-access.c" + }, + { + "match": "[a-zA-Z_][a-zA-Z0-9_]*", + "name": "variable.object.c" + }, + { + "match": ".+", + "name": "everything.else" + } + ] + }, + "5": { + "name": "variable.other.member.c" + } + } }, "block": { "patterns": [ @@ -352,25 +534,36 @@ "include": "#preprocessor-rule-conditional-block" }, { - "include": "#access" + "include": "#access-method" }, { - "include": "#libc" + "include": "#access-member" }, { "include": "#c_function_call" }, { - "captures": { + "name": "meta.initialization.c", + "begin": "(?x)\n(?:\n (?:\n\t(?=\\s)(?=+!]+ | \\(\\) | \\[\\]))\n)\n\\s*(\\() # opening bracket", + "beginCaptures": { "1": { "name": "variable.other.c" }, "2": { - "name": "punctuation.definition.parameters.c" + "name": "punctuation.section.parens.begin.bracket.round.initialization.c" } }, - "match": "(?x)\n(?:\n (?:\n (?=\\s)(?=+!]+ | \\(\\) | \\[\\]))\n)\n\\s*(\\() # opening bracket", - "name": "meta.initialization.c" + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.initialization.c" + } + }, + "patterns": [ + { + "include": "#function-call-innards" + } + ] }, { "begin": "{", @@ -400,7 +593,7 @@ ] }, "c_function_call": { - "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate)\\s*\\()\n(?=\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*\\( # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", + "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(?=\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*\\( # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", "end": "(?<=\\))(?!\\w)", "name": "meta.function-call.c", "patterns": [ @@ -488,17 +681,6 @@ } ] }, - "libc": { - "captures": { - "1": { - "name": "punctuation.whitespace.support.function.leading.c" - }, - "2": { - "name": "support.function.C99.c" - } - }, - "match": "(?x) (\\s*) \\b\n(_Exit|(?:nearbyint|nextafter|nexttoward|netoward|nan)[fl]?|a(?:cos|sin)h?[fl]?|abort|abs|asctime|assert\n|atan(?:[h2]?[fl]?)?|atexit|ato[ifl]|atoll|bsearch|btowc|cabs[fl]?|cacos|cacos[fl]|cacosh[fl]?\n|calloc|carg[fl]?|casinh?[fl]?|catanh?[fl]?|cbrt[fl]?|ccosh?[fl]?|ceil[fl]?|cexp[fl]?|cimag[fl]?\n|clearerr|clock|clog[fl]?|conj[fl]?|copysign[fl]?|cosh?[fl]?|cpow[fl]?|cproj[fl]?|creal[fl]?\n|csinh?[fl]?|csqrt[fl]?|ctanh?[fl]?|ctime|difftime|div|erfc?[fl]?|exit|fabs[fl]?\n|exp(?:2[fl]?|[fl]|m1[fl]?)?|fclose|fdim[fl]?|fe[gs]et(?:env|exceptflag|round)|feclearexcept\n|feholdexcept|feof|feraiseexcept|ferror|fetestexcept|feupdateenv|fflush|fgetpos|fgetw?[sc]\n|floor[fl]?|fmax?[fl]?|fmin[fl]?|fmod[fl]?|fopen|fpclassify|fprintf|fputw?[sc]|fread|free|freopen\n|frexp[fl]?|fscanf|fseek|fsetpos|ftell|fwide|fwprintf|fwrite|fwscanf|genv|get[sc]|getchar|gmtime\n|gwc|gwchar|hypot[fl]?|ilogb[fl]?|imaxabs|imaxdiv|isalnum|isalpha|isblank|iscntrl|isdigit|isfinite\n|isgraph|isgreater|isgreaterequal|isinf|isless(?:equal|greater)?|isw?lower|isnan|isnormal|isw?print\n|isw?punct|isw?space|isunordered|isw?upper|iswalnum|iswalpha|iswblank|iswcntrl|iswctype|iswdigit|iswgraph\n|isw?xdigit|labs|ldexp[fl]?|ldiv|lgamma[fl]?|llabs|lldiv|llrint[fl]?|llround[fl]?|localeconv|localtime\n|log[2b]?[fl]?|log1[p0][fl]?|longjmp|lrint[fl]?|lround[fl]?|malloc|mbr?len|mbr?towc|mbsinit|mbsrtowcs\n|mbstowcs|memchr|memcmp|memcpy|memmove|memset|mktime|modf[fl]?|perror|pow[fl]?|printf|puts|putw?c(?:har)?\n|qsort|raise|rand|remainder[fl]?|realloc|remove|remquo[fl]?|rename|rewind|rint[fl]?|round[fl]?|scalbl?n[fl]?\n|scanf|setbuf|setjmp|setlocale|setvbuf|signal|signbit|sinh?[fl]?|snprintf|sprintf|sqrt[fl]?|srand|sscanf\n|strcat|strchr|strcmp|strcoll|strcpy|strcspn|strerror|strftime|strlen|strncat|strncmp|strncpy|strpbrk\n|strrchr|strspn|strstr|strto[kdf]|strtoimax|strtol[dl]?|strtoull?|strtoumax|strxfrm|swprintf|swscanf\n|system|tan|tan[fl]|tanh[fl]?|tgamma[fl]?|time|tmpfile|tmpnam|tolower|toupper|trunc[fl]?|ungetw?c|va_arg\n|va_copy|va_end|va_start|vfw?printf|vfw?scanf|vprintf|vscanf|vsnprintf|vsprintf|vsscanf|vswprintf|vswscanf\n|vwprintf|vwscanf|wcrtomb|wcscat|wcschr|wcscmp|wcscoll|wcscpy|wcscspn|wcsftime|wcslen|wcsncat|wcsncmp|wcsncpy\n|wcspbrk|wcsrchr|wcsrtombs|wcsspn|wcsstr|wcsto[dkf]|wcstoimax|wcstol[dl]?|wcstombs|wcstoull?|wcstoumax|wcsxfrm\n|wctom?b|wmem(?:set|chr|cpy|cmp|move)|wprintf|wscanf)\\b" - }, "line_continuation_character": { "patterns": [ { @@ -520,6 +702,7 @@ ] }, "parens": { + "name": "punctuation.section.parens", "begin": "\\(", "beginCaptures": { "0": { @@ -539,6 +722,7 @@ ] }, "parens-block": { + "name": "punctuation.section.parens.block", "begin": "\\(", "beginCaptures": { "0": { @@ -554,6 +738,10 @@ "patterns": [ { "include": "#block_innards" + }, + { + "match": "(?=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", + "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas|asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void)\\s*\\()\n(?=\n (?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*\\( # actual name\n |\n (?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", "end": "(?<=\\))(?!\\w)|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", "beginCaptures": { "1": { "name": "entity.name.function.c" @@ -1846,7 +2045,8 @@ "include": "#vararg_ellipses" }, { - "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "name": "meta.function.definition.parameters", + "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", "beginCaptures": { "1": { "name": "entity.name.function.c" @@ -1862,6 +2062,9 @@ } }, "patterns": [ + { + "include": "#probably_a_parameter" + }, { "include": "#function-innards" } @@ -1900,13 +2103,16 @@ "include": "#storage_types" }, { - "include": "#access" + "include": "#access-method" + }, + { + "include": "#access-member" }, { "include": "#operators" }, { - "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", "beginCaptures": { "1": { "name": "entity.name.function.c" diff --git a/extensions/cpp/syntaxes/cpp.tmLanguage.json b/extensions/cpp/syntaxes/cpp.tmLanguage.json index f29bc255ba8..c3c6d813d97 100644 --- a/extensions/cpp/syntaxes/cpp.tmLanguage.json +++ b/extensions/cpp/syntaxes/cpp.tmLanguage.json @@ -1,46 +1,83 @@ { "information_for_contributors": [ - "This file has been converted from https://github.com/atom/language-c/blob/master/grammars/c%2B%2B.cson", + "This file has been converted from https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master//syntaxes/cpp.tmLanguage.json", "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/atom/language-c/commit/3a269f88b12e512fb9495dc006a1dabf325d3d7f", + "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/d57808aa3db2242f1f2be1aec19649a852aaa52e", "name": "C++", "scopeName": "source.cpp", "patterns": [ { "include": "#special_block" }, + { + "match": "(?-mix:##[a-zA-Z_]\\w*(?!\\w))", + "name": "variable.other.macro.argument.cpp" + }, { "include": "#strings" }, { - "match": "\\b(friend|explicit|virtual|override|final|noexcept)\\b", - "name": "storage.modifier.cpp" + "match": "(?[a-zA-Z_$][\\w$]*))\t # macro name\n(?:\n (\\()\n\t(\n\t \\s* \\g \\s*\t\t # first argument\n\t ((,) \\s* \\g \\s*)* # additional arguments\n\t (?:\\.\\.\\.)?\t\t\t# varargs ellipsis?\n\t)\n (\\))\n)?", + "beginCaptures": { + "1": { + "name": "keyword.control.directive.define.cpp" + }, + "2": { + "name": "punctuation.definition.directive.cpp" + }, + "3": { + "name": "entity.name.function.preprocessor.cpp" + }, + "5": { + "name": "punctuation.definition.parameters.begin.cpp" + }, + "6": { + "name": "variable.parameter.preprocessor.cpp" + }, + "8": { + "name": "punctuation.separator.parameters.cpp" + }, + "9": { + "name": "punctuation.definition.parameters.end.cpp" + } + }, + "end": "(?=(?://|/\\*))|(?", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cpp" + } + }, + "name": "string.quoted.other.lt-gt.include.cpp" + } + ] + }, + { + "include": "#pragma-mark" + }, + { + "begin": "^\\s*((#)\\s*line)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.directive.line.cpp" + }, + "2": { + "name": "punctuation.definition.directive.cpp" + } + }, + "end": "(?=(?://|/\\*))|(?,\\w])*>\\s*", + "captures": { + "0": { + "patterns": [ + { + "include": "#storage_types-c" + }, + { + "include": "#constants" + }, + { + "include": "#scope_resolution" + }, + { + "match": "(?,\\w])*>\\s*)?::)*)\\s*([a-zA-Z_]\\w*)\\s*(?:(<(?:[\\s<>,\\w])*>\\s*))?(::)", + "captures": { + "1": { + "name": "entity.scope.cpp", + "patterns": [ + { + "include": "#scope_resolution" + } + ] + }, + "2": { + "name": "entity.scope.name.cpp" + }, + "3": { + "patterns": [ + { + "include": "#template-call-innards" + } + ] + }, + "4": { + "name": "punctuation.separator.namespace.access.cpp" + } + } + }, + "template_definition": { + "begin": "(?-mix:(?", + "endCaptures": { + "0": { + "name": "punctuation.section.angle-brackets.end.template.definition.cpp" + } + }, + "name": "template.definition.cpp", + "patterns": [ + { + "include": "#scope_resolution" + }, + { + "include": "#template_definition_argument" + }, + { + "include": "#template-call-innards" + } + ] + }, + "template_definition_argument": { + "match": "\\s*(?:(?:(?:([a-zA-Z_]\\w*)|((?:[a-zA-Z_]\\w*\\s+)+)([a-zA-Z_]\\w*))|([a-zA-Z_]\\w*)\\s*(\\.\\.\\.)\\s*([a-zA-Z_]\\w*))|((?:[a-zA-Z_][a-zA-Z_0-9]*\\s+)*)([a-zA-Z_][a-zA-Z_0-9]*)\\s*(=)\\s*(\\w+))\\s*(?:(,)|(?=>))", + "captures": { + "1": { + "name": "storage.type.template.argument.$1.cpp" + }, + "2": { + "name": "storage.type.template.argument.$2.cpp" + }, + "3": { + "name": "entity.name.type.template.cpp" + }, + "4": { + "name": "storage.type.template.cpp" + }, + "5": { + "name": "keyword.operator.ellipsis.template.definition.cpp" + }, + "6": { + "name": "entity.name.type.template.cpp" + }, + "7": { + "name": "storage.type.template.cpp" + }, + "8": { + "name": "entity.name.type.template.cpp" + }, + "9": { + "name": "keyword.operator.assignment.cpp" + }, + "10": { + "name": "keyword.operator.assignment.cpp" + }, + "11": { + "name": "storage.type.template.argument.$10.cpp" + }, + "12": { + "name": "constant.language.cpp" + }, + "13": { + "name": "punctuation.separator.comma.template.argument.cpp" + } + } + }, "angle_brackets": { "begin": "<", "end": ">", @@ -134,13 +638,13 @@ "begin": "\\{", "beginCaptures": { "0": { - "name": "punctuation.section.block.begin.bracket.curly.c" + "name": "punctuation.section.block.begin.bracket.curly.cpp" } }, "end": "\\}", "endCaptures": { "0": { - "name": "punctuation.section.block.end.bracket.curly.c" + "name": "punctuation.section.block.end.bracket.curly.cpp" } }, "name": "meta.block.cpp", @@ -148,14 +652,14 @@ { "captures": { "1": { - "name": "support.function.any-method.c" + "name": "support.function.any-method.cpp" }, "2": { - "name": "punctuation.definition.parameters.c" + "name": "punctuation.definition.parameters.cpp" } }, - "match": "(?x)\n(\n (?!while|for|do|if|else|switch|catch|enumerate|return|r?iterate)\n (?:\\b[A-Za-z_][A-Za-z0-9_]*+\\b|::)*+ # actual name\n)\n\\s*(\\() # opening bracket", - "name": "meta.function-call.c" + "match": "(?x)\n(\n (?!while|for|do|if|else|switch|catch|return)\n (?:\\b[A-Za-z_][A-Za-z0-9_]*+\\b|::)*+ # actual name\n)\n\\s*(\\() # opening bracket", + "name": "meta.function-call.cpp" }, { "include": "$base" @@ -165,25 +669,28 @@ "constructor": { "patterns": [ { - "begin": "(?x)\n(?:^\\s*) # beginning of line\n((?!while|for|do|if|else|switch|catch|enumerate|r?iterate)[A-Za-z_][A-Za-z0-9_:]*) # actual name\n\\s*(\\() # opening bracket", + "begin": "(?x)\n(?:^\\s*) # beginning of line\n((?!while|for|do|if|else|switch|catch)[A-Za-z_][A-Za-z0-9_:]*) # actual name\n\\s*(\\() # opening bracket", "beginCaptures": { "1": { - "name": "entity.name.function.cpp" + "name": "entity.name.function.constructor.cpp" }, "2": { - "name": "punctuation.definition.parameters.begin.c" + "name": "punctuation.definition.parameters.begin.constructor.cpp" } }, "end": "\\)", "endCaptures": { "0": { - "name": "punctuation.definition.parameters.end.c" + "name": "punctuation.definition.parameters.end.constructor.cpp" } }, "name": "meta.function.constructor.cpp", "patterns": [ { - "include": "$base" + "include": "#probably_a_parameter" + }, + { + "include": "#function-innards-c" } ] }, @@ -191,7 +698,7 @@ "begin": "(?x)\n(:)\n(\n (?=\n \\s*[A-Za-z_][A-Za-z0-9_:]* # actual name\n \\s* (\\() # opening bracket\n )\n)", "beginCaptures": { "1": { - "name": "punctuation.definition.parameters.c" + "name": "punctuation.definition.initializer-list.parameters.cpp" } }, "end": "(?=\\{)", @@ -207,34 +714,51 @@ "special_block": { "patterns": [ { - "begin": "\\b(using)\\b\\s*(namespace)\\b\\s*((?:[_A-Za-z][_A-Za-z0-9]*\\b(::)?)*)", + "comment": "https://en.cppreference.com/w/cpp/language/namespace", + "begin": "\\b(using)\\s+(namespace)\\s+(?:((?:[a-zA-Z_]\\w*\\s*(?:<(?:[\\s<>,\\w])*>\\s*)?::)*)\\s*)?((?,\\w])*>\\s*)?::)*[a-zA-Z_]\\w*)|(?={))", "beginCaptures": { "1": { - "name": "storage.type.cpp" + "name": "keyword.other.namespace.definition.cpp" }, "2": { - "name": "entity.name.type.cpp" - } - }, - "captures": { - "1": { - "name": "keyword.control.namespace.$2" + "patterns": [ + { + "match": "(?-mix:(?|\\[|\\]|=))", @@ -271,25 +795,28 @@ ] }, { - "begin": "\\b(class|struct)\\b\\s*([_A-Za-z][_A-Za-z0-9]*\\b)?+(\\s*:\\s*(public|protected|private)\\s*([_A-Za-z][_A-Za-z0-9]*\\b)((\\s*,\\s*(public|protected|private)\\s*[_A-Za-z][_A-Za-z0-9]*\\b)*))?", + "begin": "\\b(?:(class)|(struct))\\b\\s*([_A-Za-z][_A-Za-z0-9]*\\b)?+(\\s*:\\s*(public|protected|private)\\s*([_A-Za-z][_A-Za-z0-9]*\\b)((\\s*,\\s*(public|protected|private)\\s*[_A-Za-z][_A-Za-z0-9]*\\b)*))?", "beginCaptures": { "1": { - "name": "storage.type.cpp" + "name": "storage.type.class.cpp" }, "2": { + "name": "storage.type.struct.cpp" + }, + "3": { "name": "entity.name.type.cpp" }, - "4": { - "name": "storage.type.modifier.cpp" - }, "5": { - "name": "entity.name.type.inherited.cpp" + "name": "storage.type.modifier.access.cpp" }, "6": { + "name": "entity.name.type.inherited.cpp" + }, + "7": { "patterns": [ { "match": "(public|protected|private)", - "name": "storage.type.modifier.cpp" + "name": "storage.type.modifier.access.cpp" }, { "match": "[_A-Za-z][_A-Za-z0-9]*", @@ -298,7 +825,12 @@ ] } }, - "end": "(?<=\\})|(?=(;|\\(|\\)|>|\\[|\\]|=))", + "end": "(?<=\\})|(;)|(?=(\\(|\\)|>|\\[|\\]|=))", + "endCaptures": { + "1": { + "name": "punctuation.terminator.statement.cpp" + } + }, "name": "meta.class-struct-block.cpp", "patterns": [ { @@ -351,13 +883,13 @@ "begin": "\\{", "beginCaptures": { "0": { - "name": "punctuation.section.block.begin.bracket.curly.c" + "name": "punctuation.section.block.begin.bracket.curly.cpp" } }, "end": "\\}|(?=\\s*#\\s*endif\\b)", "endCaptures": { "0": { - "name": "punctuation.section.block.end.bracket.curly.c" + "name": "punctuation.section.block.end.bracket.curly.cpp" } }, "patterns": [ @@ -413,7 +945,7 @@ "name": "constant.character.escape.cpp" }, { - "include": "source.c#string_placeholder" + "include": "#string_placeholder-c" } ] }, @@ -442,6 +974,1858 @@ "name": "string.quoted.double.raw.cpp" } ] + }, + "probably_a_parameter": { + "match": "(?:([a-zA-Z_]\\w*)\\s*(?==)|(?<=(?:\\w\\s|[&*>\\]\\)]))\\s*([a-zA-Z_]\\w*)\\s*(?=(?:\\[\\]\\s*)?(?:,|\\))))", + "captures": { + "1": { + "name": "variable.parameter.probably.defaulted.cpp" + }, + "2": { + "name": "variable.parameter.probably.cpp" + } + } + }, + "operator_overload": { + "begin": "((?:[a-zA-Z_]\\w*\\s*(?:<(?:[\\s<>,\\w])*>\\s*)?::)*)\\s*(operator)((?:\\s*(?:\\+\\+|\\-\\-|\\(\\)|\\[\\]|\\->|\\+\\+|\\-\\-|\\+|\\-|!|~|\\*|&|\\->\\*|\\*|\\/|%|\\+|\\-|<<|>>|<=>|<|<=|>|>=|==|!=|&|\\^|\\||&&|\\|\\||=|\\+=|\\-=|\\*=|\\/=|%=|<<=|>>=|&=|\\^=|\\|=|,)|\\s+(?:(?:new|new\\[\\]|delete|delete\\[\\])|(?:[a-zA-Z_]\\w*\\s*(?:<(?:[\\s<>,\\w])*>\\s*)?::)*[a-zA-Z_]\\w*\\s*(?:&)?)))\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.scope.cpp" + }, + "2": { + "name": "entity.name.operator.overload.cpp" + }, + "3": { + "name": "entity.name.operator.overloadee.cpp" + }, + "4": { + "name": "punctuation.section.parameters.begin.bracket.round.cpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parameters.end.bracket.round.cpp" + } + }, + "name": "meta.function.definition.parameters.operator-overload.cpp", + "patterns": [ + { + "include": "#probably_a_parameter" + }, + { + "include": "#function-innards-c" + } + ] + }, + "access-method": { + "name": "meta.function-call.member.cpp", + "begin": "([a-zA-Z_][a-zA-Z_0-9]*|(?<=[\\]\\)]))\\s*(?:(\\.)|(->))((?:(?:[a-zA-Z_][a-zA-Z_0-9]*)\\s*(?:(?:\\.)|(?:->)))*)\\s*([a-zA-Z_][a-zA-Z_0-9]*)(\\()", + "beginCaptures": { + "1": { + "name": "variable.object.cpp" + }, + "2": { + "name": "punctuation.separator.dot-access.cpp" + }, + "3": { + "name": "punctuation.separator.pointer-access.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\.", + "name": "punctuation.separator.dot-access.cpp" + }, + { + "match": "->", + "name": "punctuation.separator.pointer-access.cpp" + }, + { + "match": "[a-zA-Z_][a-zA-Z_0-9]*", + "name": "variable.object.cpp" + }, + { + "name": "everything.else.cpp", + "match": ".+" + } + ] + }, + "5": { + "name": "entity.name.function.member.cpp" + }, + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.function.member.cpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.function.member.cpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards-c" + } + ] + }, + "access-member": { + "name": "variable.object.access.cpp", + "match": "(?:([a-zA-Z_]\\w*)|(?<=\\]|\\)))\\s*(?:((?:\\.|\\.\\*))|((?:->|->\\*)))\\s*((?:[a-zA-Z_]\\w*\\s*(?:\\.|->)\\s*)*)\\b(?!(?:auto|void|char|short|int|signed|unsigned|long|float|double|bool|wchar_t|u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t|pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t))([a-zA-Z_]\\w*)\\b(?!\\()", + "captures": { + "1": { + "name": "variable.object.cpp" + }, + "2": { + "name": "punctuation.separator.dot-access.cpp" + }, + "3": { + "name": "punctuation.separator.pointer-access.cpp" + }, + "4": { + "patterns": [ + { + "match": "\\.", + "name": "punctuation.separator.dot-access.cpp" + }, + { + "match": "->", + "name": "punctuation.separator.pointer-access.cpp" + }, + { + "match": "[a-zA-Z_]\\w*", + "name": "variable.object.cpp" + }, + { + "match": ".+", + "name": "everything.else.cpp" + } + ] + }, + "5": { + "name": "variable.other.member.cpp" + } + } + }, + "block-c": { + "patterns": [ + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.cpp" + } + }, + "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)", + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.cpp" + } + }, + "name": "meta.block.cpp", + "patterns": [ + { + "include": "#block_innards-c" + } + ] + } + ] + }, + "block_innards-c": { + "patterns": [ + { + "include": "#preprocessor-rule-enabled-block" + }, + { + "include": "#preprocessor-rule-disabled-block" + }, + { + "include": "#preprocessor-rule-conditional-block" + }, + { + "include": "#access-method" + }, + { + "include": "#access-member" + }, + { + "include": "#c_function_call" + }, + { + "name": "meta.initialization.cpp", + "begin": "(?x)\n(?:\n (?:\n\t(?=\\s)(?=+!]+ | \\(\\) | \\[\\]))\n)\n\\s*(\\() # opening bracket", + "beginCaptures": { + "1": { + "name": "variable.other.cpp" + }, + "2": { + "name": "punctuation.section.parens.begin.bracket.round.initialization.cpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.initialization.cpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards-c" + } + ] + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.cpp" + } + }, + "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)", + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.cpp" + } + }, + "patterns": [ + { + "include": "#block_innards-c" + } + ] + }, + { + "include": "#parens-block-c" + }, + { + "include": "$base" + } + ] + }, + "c_function_call": { + "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|return|typeid|alignof|alignas|sizeof|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(?=\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*(?:<(?:[\\s<>,\\w])*>\\s*)?\\( # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", + "end": "(?<=\\))(?!\\w)", + "name": "meta.function-call.cpp", + "patterns": [ + { + "include": "#function-call-innards-c" + } + ] + }, + "comments-c": { + "patterns": [ + { + "captures": { + "1": { + "name": "meta.toc-list.banner.block.cpp" + } + }, + "match": "^/\\* =(\\s*.*?)\\s*= \\*/$\\n?", + "name": "comment.block.cpp" + }, + { + "begin": "/\\*", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.begin.cpp" + } + }, + "end": "\\*/", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.end.cpp" + } + }, + "name": "comment.block.cpp" + }, + { + "match": "\\*/.*\\n", + "name": "invalid.illegal.stray-comment-end.cpp" + }, + { + "captures": { + "1": { + "name": "meta.toc-list.banner.line.cpp" + } + }, + "match": "^// =(\\s*.*?)\\s*=\\s*$\\n?", + "name": "comment.line.banner.cpp" + }, + { + "begin": "(^[ \\t]+)?(?=//)", + "beginCaptures": { + "1": { + "name": "punctuation.whitespace.comment.leading.cpp" + } + }, + "end": "(?!\\G)", + "patterns": [ + { + "begin": "//", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.cpp" + } + }, + "end": "(?=\\n)", + "name": "comment.line.double-slash.cpp", + "patterns": [ + { + "include": "#line_continuation_character" + } + ] + } + ] + } + ] + }, + "disabled": { + "begin": "^\\s*#\\s*if(n?def)?\\b.*$", + "end": "^\\s*#\\s*endif\\b", + "patterns": [ + { + "include": "#disabled" + }, + { + "include": "#pragma-mark" + } + ] + }, + "line_continuation_character": { + "patterns": [ + { + "match": "(\\\\)\\n", + "captures": { + "1": { + "name": "constant.character.escape.line-continuation.cpp" + } + } + } + ] + }, + "numbers-c": { + "patterns": [ + { + "match": "\\b((?:0(?:x|X)[0-9a-fA-F](?:[0-9a-fA-F']*[0-9a-fA-F'])?|0(?:b|B)[01](?:[01']*[01'])?)(?:\\.[\\d+a-fA-F']+p[\\d']+)?|(([0-9](?:[0-9']*[0-9'])*(?:\\.[0-9](?:[0-9']*[0-9'])*)?)|(\\.[0-9](?:[0-9']*[0-9'])*))((e|E)(\\+|-)?[0-9](?:[0-9']*[0-9'])*)?)(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\w*", + "name": "constant.numeric.cpp", + "captures": { + "0": { + "patterns": [ + { + "match": "(?-mix:(?>=|\\|=", + "name": "keyword.operator.assignment.compound.bitwise.cpp" + }, + { + "match": "<<|>>", + "name": "keyword.operator.bitwise.shift.cpp" + }, + { + "match": "!=|<=|>=|==|<|>", + "name": "keyword.operator.comparison.cpp" + }, + { + "match": "&&|!|\\|\\|", + "name": "keyword.operator.logical.cpp" + }, + { + "match": "&|\\||\\^|~", + "name": "keyword.operator.cpp" + }, + { + "match": "=", + "name": "keyword.operator.assignment.cpp" + }, + { + "match": "%|\\*|/|-|\\+", + "name": "keyword.operator.cpp" + }, + { + "begin": "\\?", + "beginCaptures": { + "0": { + "name": "keyword.operator.ternary.cpp" + } + }, + "end": ":", + "applyEndPatternLast": true, + "endCaptures": { + "0": { + "name": "keyword.operator.ternary.cpp" + } + }, + "patterns": [ + { + "include": "#access-method" + }, + { + "include": "#access-member" + }, + { + "include": "#c_function_call" + }, + { + "include": "$base" + } + ] + } + ] + }, + "strings-c": { + "patterns": [ + { + "begin": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cpp" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cpp" + } + }, + "name": "string.quoted.double.cpp", + "patterns": [ + { + "include": "#string_escaped_char-c" + }, + { + "include": "#string_placeholder-c" + }, + { + "include": "#line_continuation_character" + } + ] + }, + { + "begin": "(?-mix:(?=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", + "end": "(?<=\\))(?!\\w)|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.name.function.cpp" + }, + "2": { + "name": "punctuation.section.arguments.begin.bracket.round.cpp" + } + }, + "end": "(\\))|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.name.function.cpp" + }, + "2": { + "name": "punctuation.section.parameters.begin.bracket.round.cpp" + } + }, + "end": "\\)|:", + "endCaptures": { + "0": { + "name": "punctuation.section.parameters.end.bracket.round.cpp" + } + }, + "patterns": [ + { + "include": "#probably_a_parameter" + }, + { + "include": "#function-innards-c" + } + ] + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.cpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.cpp" + } + }, + "patterns": [ + { + "include": "#function-innards-c" + } + ] + }, + { + "include": "$base" + } + ] + }, + "function-call-innards-c": { + "patterns": [ + { + "include": "#comments-c" + }, + { + "include": "#storage_types-c" + }, + { + "include": "#access-method" + }, + { + "include": "#access-member" + }, + { + "include": "#operators" + }, + { + "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|return|typeid|alignof|alignas|sizeof|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:new)\\s*((?:<(?:[\\s<>,\\w])*>\\s*)?) # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.operator.memory.new.cpp" + }, + "2": { + "patterns": [ + { + "include": "#template-call-innards" + } + ] + }, + "3": { + "name": "punctuation.section.arguments.begin.bracket.round.cpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.cpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards-c" + } + ] + }, + { + "begin": "(?,\\w])*>\\s*)?::)*)\\s*([a-zA-Z_]\\w*)\\s*(?:(<(?:[\\s<>,\\w])*>\\s*))?(\\()", + "beginCaptures": { + "1": { + "patterns": [ + { + "include": "#scope_resolution" + } + ] + }, + "2": { + "name": "entity.name.function.call.cpp" + }, + "3": { + "patterns": [ + { + "include": "#template-call-innards" + } + ] + }, + "4": { + "name": "punctuation.section.arguments.begin.bracket.round.cpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.cpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards-c" + } + ] + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.cpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.cpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards-c" + } + ] + }, + { + "include": "#block_innards-c" + } + ] } } } \ No newline at end of file diff --git a/extensions/cpp/test/colorize-results/test-23630_cpp.json b/extensions/cpp/test/colorize-results/test-23630_cpp.json index f22786a105f..a58961ae945 100644 --- a/extensions/cpp/test/colorize-results/test-23630_cpp.json +++ b/extensions/cpp/test/colorize-results/test-23630_cpp.json @@ -1,7 +1,7 @@ [ { "c": "#", - "t": "source.cpp meta.preprocessor.c keyword.control.directive.conditional.c punctuation.definition.directive.c", + "t": "source.cpp meta.preprocessor.cpp keyword.control.directive.conditional.cpp punctuation.definition.directive.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -12,7 +12,7 @@ }, { "c": "ifndef", - "t": "source.cpp meta.preprocessor.c keyword.control.directive.conditional.c", + "t": "source.cpp meta.preprocessor.cpp keyword.control.directive.conditional.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -23,7 +23,7 @@ }, { "c": " ", - "t": "source.cpp meta.preprocessor.c", + "t": "source.cpp meta.preprocessor.cpp", "r": { "dark_plus": "meta.preprocessor: #569CD6", "light_plus": "meta.preprocessor: #0000FF", @@ -34,7 +34,7 @@ }, { "c": "_UCRT", - "t": "source.cpp meta.preprocessor.c entity.name.function.preprocessor.c", + "t": "source.cpp meta.preprocessor.cpp entity.name.function.preprocessor.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -45,7 +45,7 @@ }, { "c": " ", - "t": "source.cpp meta.preprocessor.macro.c", + "t": "source.cpp meta.preprocessor.macro.cpp", "r": { "dark_plus": "meta.preprocessor: #569CD6", "light_plus": "meta.preprocessor: #0000FF", @@ -56,7 +56,7 @@ }, { "c": "#", - "t": "source.cpp meta.preprocessor.macro.c keyword.control.directive.define.c punctuation.definition.directive.c", + "t": "source.cpp meta.preprocessor.macro.cpp keyword.control.directive.define.cpp punctuation.definition.directive.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -67,7 +67,7 @@ }, { "c": "define", - "t": "source.cpp meta.preprocessor.macro.c keyword.control.directive.define.c", + "t": "source.cpp meta.preprocessor.macro.cpp keyword.control.directive.define.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -78,7 +78,7 @@ }, { "c": " ", - "t": "source.cpp meta.preprocessor.macro.c", + "t": "source.cpp meta.preprocessor.macro.cpp", "r": { "dark_plus": "meta.preprocessor: #569CD6", "light_plus": "meta.preprocessor: #0000FF", @@ -89,7 +89,7 @@ }, { "c": "_UCRT", - "t": "source.cpp meta.preprocessor.macro.c entity.name.function.preprocessor.c", + "t": "source.cpp meta.preprocessor.macro.cpp entity.name.function.preprocessor.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -100,7 +100,7 @@ }, { "c": "#", - "t": "source.cpp meta.preprocessor.c keyword.control.directive.conditional.c punctuation.definition.directive.c", + "t": "source.cpp meta.preprocessor.cpp keyword.control.directive.conditional.cpp punctuation.definition.directive.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -111,7 +111,7 @@ }, { "c": "endif", - "t": "source.cpp meta.preprocessor.c keyword.control.directive.conditional.c", + "t": "source.cpp meta.preprocessor.cpp keyword.control.directive.conditional.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", diff --git a/extensions/cpp/test/colorize-results/test-23850_cpp.json b/extensions/cpp/test/colorize-results/test-23850_cpp.json index bbb5237498f..924bbc78243 100644 --- a/extensions/cpp/test/colorize-results/test-23850_cpp.json +++ b/extensions/cpp/test/colorize-results/test-23850_cpp.json @@ -1,7 +1,7 @@ [ { "c": "#", - "t": "source.cpp meta.preprocessor.c keyword.control.directive.conditional.c punctuation.definition.directive.c", + "t": "source.cpp meta.preprocessor.cpp keyword.control.directive.conditional.cpp punctuation.definition.directive.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -12,7 +12,7 @@ }, { "c": "ifndef", - "t": "source.cpp meta.preprocessor.c keyword.control.directive.conditional.c", + "t": "source.cpp meta.preprocessor.cpp keyword.control.directive.conditional.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -23,7 +23,7 @@ }, { "c": " ", - "t": "source.cpp meta.preprocessor.c", + "t": "source.cpp meta.preprocessor.cpp", "r": { "dark_plus": "meta.preprocessor: #569CD6", "light_plus": "meta.preprocessor: #0000FF", @@ -34,7 +34,7 @@ }, { "c": "_UCRT", - "t": "source.cpp meta.preprocessor.c entity.name.function.preprocessor.c", + "t": "source.cpp meta.preprocessor.cpp entity.name.function.preprocessor.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -45,7 +45,7 @@ }, { "c": "#", - "t": "source.cpp meta.preprocessor.macro.c keyword.control.directive.define.c punctuation.definition.directive.c", + "t": "source.cpp meta.preprocessor.macro.cpp keyword.control.directive.define.cpp punctuation.definition.directive.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -56,7 +56,7 @@ }, { "c": "define", - "t": "source.cpp meta.preprocessor.macro.c keyword.control.directive.define.c", + "t": "source.cpp meta.preprocessor.macro.cpp keyword.control.directive.define.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -67,7 +67,7 @@ }, { "c": " ", - "t": "source.cpp meta.preprocessor.macro.c", + "t": "source.cpp meta.preprocessor.macro.cpp", "r": { "dark_plus": "meta.preprocessor: #569CD6", "light_plus": "meta.preprocessor: #0000FF", @@ -78,7 +78,7 @@ }, { "c": "_UCRT", - "t": "source.cpp meta.preprocessor.macro.c entity.name.function.preprocessor.c", + "t": "source.cpp meta.preprocessor.macro.cpp entity.name.function.preprocessor.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -89,7 +89,7 @@ }, { "c": "#", - "t": "source.cpp meta.preprocessor.c keyword.control.directive.conditional.c punctuation.definition.directive.c", + "t": "source.cpp meta.preprocessor.cpp keyword.control.directive.conditional.cpp punctuation.definition.directive.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -100,7 +100,7 @@ }, { "c": "endif", - "t": "source.cpp meta.preprocessor.c keyword.control.directive.conditional.c", + "t": "source.cpp meta.preprocessor.cpp keyword.control.directive.conditional.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", diff --git a/extensions/cpp/test/colorize-results/test_c.json b/extensions/cpp/test/colorize-results/test_c.json index 0725010d8c2..79a3c093e65 100644 --- a/extensions/cpp/test/colorize-results/test_c.json +++ b/extensions/cpp/test/colorize-results/test_c.json @@ -243,7 +243,7 @@ }, { "c": "int", - "t": "source.c storage.type.c", + "t": "source.c storage.type.built-in.primitive.c", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -265,7 +265,7 @@ }, { "c": "main", - "t": "source.c meta.function.c entity.name.function.c", + "t": "source.c meta.function.c meta.function.definition.parameters entity.name.function.c", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -276,7 +276,7 @@ }, { "c": "(", - "t": "source.c meta.function.c punctuation.section.parameters.begin.bracket.round.c", + "t": "source.c meta.function.c meta.function.definition.parameters punctuation.section.parameters.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -287,7 +287,7 @@ }, { "c": ")", - "t": "source.c meta.function.c punctuation.section.parameters.end.bracket.round.c", + "t": "source.c meta.function.c meta.function.definition.parameters punctuation.section.parameters.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -320,7 +320,7 @@ }, { "c": "float", - "t": "source.c meta.block.c storage.type.c", + "t": "source.c meta.block.c storage.type.built-in.primitive.c", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -507,7 +507,7 @@ }, { "c": " ", - "t": "source.c meta.block.c punctuation.whitespace.support.function.leading.c", + "t": "source.c meta.block.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -518,18 +518,18 @@ }, { "c": "printf", - "t": "source.c meta.block.c support.function.C99.c", + "t": "source.c meta.block.c meta.function-call.c entity.name.function.c", "r": { - "dark_plus": "support.function: #DCDCAA", - "light_plus": "support.function: #795E26", + "dark_plus": "entity.name.function: #DCDCAA", + "light_plus": "entity.name.function: #795E26", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "support.function: #DCDCAA" + "hc_black": "entity.name.function: #DCDCAA" } }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.section.arguments.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -540,7 +540,7 @@ }, { "c": "\"", - "t": "source.c meta.block.c string.quoted.double.c punctuation.definition.string.begin.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c punctuation.definition.string.begin.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -551,7 +551,7 @@ }, { "c": "Enter coefficients a, b and c: ", - "t": "source.c meta.block.c string.quoted.double.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -562,7 +562,7 @@ }, { "c": "\"", - "t": "source.c meta.block.c string.quoted.double.c punctuation.definition.string.end.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c punctuation.definition.string.end.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -573,7 +573,7 @@ }, { "c": ")", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.section.arguments.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -595,7 +595,7 @@ }, { "c": " ", - "t": "source.c meta.block.c punctuation.whitespace.support.function.leading.c", + "t": "source.c meta.block.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -606,18 +606,18 @@ }, { "c": "scanf", - "t": "source.c meta.block.c support.function.C99.c", + "t": "source.c meta.block.c meta.function-call.c entity.name.function.c", "r": { - "dark_plus": "support.function: #DCDCAA", - "light_plus": "support.function: #795E26", + "dark_plus": "entity.name.function: #DCDCAA", + "light_plus": "entity.name.function: #795E26", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "support.function: #DCDCAA" + "hc_black": "entity.name.function: #DCDCAA" } }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.section.arguments.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -628,7 +628,7 @@ }, { "c": "\"", - "t": "source.c meta.block.c string.quoted.double.c punctuation.definition.string.begin.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c punctuation.definition.string.begin.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -639,7 +639,7 @@ }, { "c": "%f%f%f", - "t": "source.c meta.block.c string.quoted.double.c constant.other.placeholder.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c constant.other.placeholder.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -650,7 +650,7 @@ }, { "c": "\"", - "t": "source.c meta.block.c string.quoted.double.c punctuation.definition.string.end.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c punctuation.definition.string.end.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -661,7 +661,7 @@ }, { "c": ",", - "t": "source.c meta.block.c punctuation.separator.delimiter.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -672,7 +672,7 @@ }, { "c": "&", - "t": "source.c meta.block.c keyword.operator.c", + "t": "source.c meta.block.c meta.function-call.c keyword.operator.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -683,7 +683,7 @@ }, { "c": "a", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c meta.function-call.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -694,7 +694,7 @@ }, { "c": ",", - "t": "source.c meta.block.c punctuation.separator.delimiter.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -705,7 +705,7 @@ }, { "c": "&", - "t": "source.c meta.block.c keyword.operator.c", + "t": "source.c meta.block.c meta.function-call.c keyword.operator.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -716,7 +716,7 @@ }, { "c": "b", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c meta.function-call.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -727,7 +727,7 @@ }, { "c": ",", - "t": "source.c meta.block.c punctuation.separator.delimiter.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -738,7 +738,7 @@ }, { "c": "&", - "t": "source.c meta.block.c keyword.operator.c", + "t": "source.c meta.block.c meta.function-call.c keyword.operator.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -749,7 +749,7 @@ }, { "c": "c", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c meta.function-call.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -760,7 +760,7 @@ }, { "c": ")", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.section.arguments.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -947,7 +947,7 @@ }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -958,7 +958,7 @@ }, { "c": "determinant", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c punctuation.section.parens.block", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -969,7 +969,7 @@ }, { "c": ">", - "t": "source.c meta.block.c keyword.operator.comparison.c", + "t": "source.c meta.block.c punctuation.section.parens.block keyword.operator.comparison.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -980,7 +980,7 @@ }, { "c": "0", - "t": "source.c meta.block.c constant.numeric.c", + "t": "source.c meta.block.c punctuation.section.parens.block constant.numeric.c", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -991,7 +991,7 @@ }, { "c": ")", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1057,7 +1057,7 @@ }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1068,7 +1068,7 @@ }, { "c": "-", - "t": "source.c meta.block.c keyword.operator.c", + "t": "source.c meta.block.c punctuation.section.parens.block keyword.operator.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -1079,7 +1079,7 @@ }, { "c": "b", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c punctuation.section.parens.block", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1090,7 +1090,7 @@ }, { "c": "+", - "t": "source.c meta.block.c keyword.operator.c", + "t": "source.c meta.block.c punctuation.section.parens.block keyword.operator.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -1101,18 +1101,18 @@ }, { "c": "sqrt", - "t": "source.c meta.block.c support.function.C99.c", + "t": "source.c meta.block.c punctuation.section.parens.block meta.function-call.c entity.name.function.c", "r": { - "dark_plus": "support.function: #DCDCAA", - "light_plus": "support.function: #795E26", + "dark_plus": "entity.name.function: #DCDCAA", + "light_plus": "entity.name.function: #795E26", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "support.function: #DCDCAA" + "hc_black": "entity.name.function: #DCDCAA" } }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block meta.function-call.c punctuation.section.arguments.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1123,7 +1123,7 @@ }, { "c": "determinant", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c punctuation.section.parens.block meta.function-call.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1133,8 +1133,19 @@ } }, { - "c": "))", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "c": ")", + "t": "source.c meta.block.c punctuation.section.parens.block meta.function-call.c punctuation.section.arguments.end.bracket.round.c", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": ")", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1156,7 +1167,7 @@ }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1167,7 +1178,7 @@ }, { "c": "2", - "t": "source.c meta.block.c constant.numeric.c", + "t": "source.c meta.block.c punctuation.section.parens.block constant.numeric.c", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -1178,7 +1189,7 @@ }, { "c": "*", - "t": "source.c meta.block.c keyword.operator.c", + "t": "source.c meta.block.c punctuation.section.parens.block keyword.operator.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -1189,7 +1200,7 @@ }, { "c": "a", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c punctuation.section.parens.block", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1200,7 +1211,7 @@ }, { "c": ")", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1255,7 +1266,7 @@ }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1266,7 +1277,7 @@ }, { "c": "-", - "t": "source.c meta.block.c keyword.operator.c", + "t": "source.c meta.block.c punctuation.section.parens.block keyword.operator.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -1277,7 +1288,7 @@ }, { "c": "b", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c punctuation.section.parens.block", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1288,7 +1299,7 @@ }, { "c": "-", - "t": "source.c meta.block.c keyword.operator.c", + "t": "source.c meta.block.c punctuation.section.parens.block keyword.operator.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -1299,18 +1310,18 @@ }, { "c": "sqrt", - "t": "source.c meta.block.c support.function.C99.c", + "t": "source.c meta.block.c punctuation.section.parens.block meta.function-call.c entity.name.function.c", "r": { - "dark_plus": "support.function: #DCDCAA", - "light_plus": "support.function: #795E26", + "dark_plus": "entity.name.function: #DCDCAA", + "light_plus": "entity.name.function: #795E26", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "support.function: #DCDCAA" + "hc_black": "entity.name.function: #DCDCAA" } }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block meta.function-call.c punctuation.section.arguments.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1321,7 +1332,7 @@ }, { "c": "determinant", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c punctuation.section.parens.block meta.function-call.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1331,8 +1342,19 @@ } }, { - "c": "))", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "c": ")", + "t": "source.c meta.block.c punctuation.section.parens.block meta.function-call.c punctuation.section.arguments.end.bracket.round.c", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": ")", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1354,7 +1376,7 @@ }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1365,7 +1387,7 @@ }, { "c": "2", - "t": "source.c meta.block.c constant.numeric.c", + "t": "source.c meta.block.c punctuation.section.parens.block constant.numeric.c", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -1376,7 +1398,7 @@ }, { "c": "*", - "t": "source.c meta.block.c keyword.operator.c", + "t": "source.c meta.block.c punctuation.section.parens.block keyword.operator.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -1387,7 +1409,7 @@ }, { "c": "a", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c punctuation.section.parens.block", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1398,7 +1420,7 @@ }, { "c": ")", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1420,7 +1442,7 @@ }, { "c": " ", - "t": "source.c meta.block.c punctuation.whitespace.support.function.leading.c", + "t": "source.c meta.block.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1431,18 +1453,18 @@ }, { "c": "printf", - "t": "source.c meta.block.c support.function.C99.c", + "t": "source.c meta.block.c meta.function-call.c entity.name.function.c", "r": { - "dark_plus": "support.function: #DCDCAA", - "light_plus": "support.function: #795E26", + "dark_plus": "entity.name.function: #DCDCAA", + "light_plus": "entity.name.function: #795E26", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "support.function: #DCDCAA" + "hc_black": "entity.name.function: #DCDCAA" } }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.section.arguments.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1453,7 +1475,7 @@ }, { "c": "\"", - "t": "source.c meta.block.c string.quoted.double.c punctuation.definition.string.begin.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c punctuation.definition.string.begin.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1464,7 +1486,7 @@ }, { "c": "Roots are: ", - "t": "source.c meta.block.c string.quoted.double.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1475,7 +1497,7 @@ }, { "c": "%.2f", - "t": "source.c meta.block.c string.quoted.double.c constant.other.placeholder.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c constant.other.placeholder.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1486,7 +1508,7 @@ }, { "c": " and ", - "t": "source.c meta.block.c string.quoted.double.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1497,7 +1519,7 @@ }, { "c": "%.2f", - "t": "source.c meta.block.c string.quoted.double.c constant.other.placeholder.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c constant.other.placeholder.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1508,7 +1530,7 @@ }, { "c": "\"", - "t": "source.c meta.block.c string.quoted.double.c punctuation.definition.string.end.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c punctuation.definition.string.end.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1519,7 +1541,7 @@ }, { "c": ",", - "t": "source.c meta.block.c punctuation.separator.delimiter.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1530,7 +1552,7 @@ }, { "c": "r1 ", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c meta.function-call.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1541,7 +1563,7 @@ }, { "c": ",", - "t": "source.c meta.block.c punctuation.separator.delimiter.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1552,7 +1574,7 @@ }, { "c": " r2", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c meta.function-call.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1563,7 +1585,7 @@ }, { "c": ")", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.section.arguments.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1662,7 +1684,7 @@ }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1673,7 +1695,7 @@ }, { "c": "determinant", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c punctuation.section.parens.block", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1684,7 +1706,7 @@ }, { "c": "==", - "t": "source.c meta.block.c keyword.operator.comparison.c", + "t": "source.c meta.block.c punctuation.section.parens.block keyword.operator.comparison.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -1695,7 +1717,7 @@ }, { "c": "0", - "t": "source.c meta.block.c constant.numeric.c", + "t": "source.c meta.block.c punctuation.section.parens.block constant.numeric.c", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -1706,7 +1728,7 @@ }, { "c": ")", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1827,7 +1849,7 @@ }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1838,7 +1860,7 @@ }, { "c": "2", - "t": "source.c meta.block.c constant.numeric.c", + "t": "source.c meta.block.c punctuation.section.parens.block constant.numeric.c", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -1849,7 +1871,7 @@ }, { "c": "*", - "t": "source.c meta.block.c keyword.operator.c", + "t": "source.c meta.block.c punctuation.section.parens.block keyword.operator.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -1860,7 +1882,7 @@ }, { "c": "a", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c punctuation.section.parens.block", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1871,7 +1893,7 @@ }, { "c": ")", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1893,7 +1915,7 @@ }, { "c": " ", - "t": "source.c meta.block.c punctuation.whitespace.support.function.leading.c", + "t": "source.c meta.block.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1904,18 +1926,18 @@ }, { "c": "printf", - "t": "source.c meta.block.c support.function.C99.c", + "t": "source.c meta.block.c meta.function-call.c entity.name.function.c", "r": { - "dark_plus": "support.function: #DCDCAA", - "light_plus": "support.function: #795E26", + "dark_plus": "entity.name.function: #DCDCAA", + "light_plus": "entity.name.function: #795E26", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "support.function: #DCDCAA" + "hc_black": "entity.name.function: #DCDCAA" } }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.section.arguments.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1926,7 +1948,7 @@ }, { "c": "\"", - "t": "source.c meta.block.c string.quoted.double.c punctuation.definition.string.begin.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c punctuation.definition.string.begin.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1937,7 +1959,7 @@ }, { "c": "Roots are: ", - "t": "source.c meta.block.c string.quoted.double.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1948,7 +1970,7 @@ }, { "c": "%.2f", - "t": "source.c meta.block.c string.quoted.double.c constant.other.placeholder.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c constant.other.placeholder.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1959,7 +1981,7 @@ }, { "c": " and ", - "t": "source.c meta.block.c string.quoted.double.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1970,7 +1992,7 @@ }, { "c": "%.2f", - "t": "source.c meta.block.c string.quoted.double.c constant.other.placeholder.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c constant.other.placeholder.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1981,7 +2003,7 @@ }, { "c": "\"", - "t": "source.c meta.block.c string.quoted.double.c punctuation.definition.string.end.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c punctuation.definition.string.end.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1992,7 +2014,7 @@ }, { "c": ",", - "t": "source.c meta.block.c punctuation.separator.delimiter.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2003,7 +2025,7 @@ }, { "c": " r1", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c meta.function-call.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2014,7 +2036,7 @@ }, { "c": ",", - "t": "source.c meta.block.c punctuation.separator.delimiter.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2025,7 +2047,7 @@ }, { "c": " r2", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c meta.function-call.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2036,7 +2058,7 @@ }, { "c": ")", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.section.arguments.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2190,7 +2212,7 @@ }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2201,7 +2223,7 @@ }, { "c": "2", - "t": "source.c meta.block.c constant.numeric.c", + "t": "source.c meta.block.c punctuation.section.parens.block constant.numeric.c", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -2212,7 +2234,7 @@ }, { "c": "*", - "t": "source.c meta.block.c keyword.operator.c", + "t": "source.c meta.block.c punctuation.section.parens.block keyword.operator.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -2223,7 +2245,7 @@ }, { "c": "a", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c punctuation.section.parens.block", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2234,7 +2256,7 @@ }, { "c": ")", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2278,50 +2300,6 @@ }, { "c": " ", - "t": "source.c meta.block.c punctuation.whitespace.support.function.leading.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "sqrt", - "t": "source.c meta.block.c support.function.C99.c", - "r": { - "dark_plus": "support.function: #DCDCAA", - "light_plus": "support.function: #795E26", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "support.function: #DCDCAA" - } - }, - { - "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "-", - "t": "source.c meta.block.c keyword.operator.c", - "r": { - "dark_plus": "keyword.operator: #D4D4D4", - "light_plus": "keyword.operator: #000000", - "dark_vs": "keyword.operator: #D4D4D4", - "light_vs": "keyword.operator: #000000", - "hc_black": "keyword.operator: #D4D4D4" - } - }, - { - "c": "determinant", "t": "source.c meta.block.c", "r": { "dark_plus": "default: #D4D4D4", @@ -2331,9 +2309,53 @@ "hc_black": "default: #FFFFFF" } }, + { + "c": "sqrt", + "t": "source.c meta.block.c meta.function-call.c entity.name.function.c", + "r": { + "dark_plus": "entity.name.function: #DCDCAA", + "light_plus": "entity.name.function: #795E26", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "entity.name.function: #DCDCAA" + } + }, + { + "c": "(", + "t": "source.c meta.block.c meta.function-call.c punctuation.section.arguments.begin.bracket.round.c", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "-", + "t": "source.c meta.block.c meta.function-call.c keyword.operator.c", + "r": { + "dark_plus": "keyword.operator: #D4D4D4", + "light_plus": "keyword.operator: #000000", + "dark_vs": "keyword.operator: #D4D4D4", + "light_vs": "keyword.operator: #000000", + "hc_black": "keyword.operator: #D4D4D4" + } + }, + { + "c": "determinant", + "t": "source.c meta.block.c meta.function-call.c", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, { "c": ")", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.section.arguments.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2355,7 +2377,7 @@ }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2366,7 +2388,7 @@ }, { "c": "2", - "t": "source.c meta.block.c constant.numeric.c", + "t": "source.c meta.block.c punctuation.section.parens.block constant.numeric.c", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -2377,7 +2399,7 @@ }, { "c": "*", - "t": "source.c meta.block.c keyword.operator.c", + "t": "source.c meta.block.c punctuation.section.parens.block keyword.operator.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -2388,7 +2410,7 @@ }, { "c": "a", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c punctuation.section.parens.block", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2399,7 +2421,7 @@ }, { "c": ")", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.c meta.block.c punctuation.section.parens.block punctuation.section.parens.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2421,7 +2443,7 @@ }, { "c": " ", - "t": "source.c meta.block.c punctuation.whitespace.support.function.leading.c", + "t": "source.c meta.block.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2432,18 +2454,18 @@ }, { "c": "printf", - "t": "source.c meta.block.c support.function.C99.c", + "t": "source.c meta.block.c meta.function-call.c entity.name.function.c", "r": { - "dark_plus": "support.function: #DCDCAA", - "light_plus": "support.function: #795E26", + "dark_plus": "entity.name.function: #DCDCAA", + "light_plus": "entity.name.function: #795E26", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "support.function: #DCDCAA" + "hc_black": "entity.name.function: #DCDCAA" } }, { "c": "(", - "t": "source.c meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.section.arguments.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2454,7 +2476,7 @@ }, { "c": "\"", - "t": "source.c meta.block.c string.quoted.double.c punctuation.definition.string.begin.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c punctuation.definition.string.begin.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -2465,7 +2487,7 @@ }, { "c": "Roots are: ", - "t": "source.c meta.block.c string.quoted.double.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -2476,7 +2498,7 @@ }, { "c": "%.2f", - "t": "source.c meta.block.c string.quoted.double.c constant.other.placeholder.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c constant.other.placeholder.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -2487,7 +2509,7 @@ }, { "c": "+", - "t": "source.c meta.block.c string.quoted.double.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -2498,7 +2520,7 @@ }, { "c": "%.2f", - "t": "source.c meta.block.c string.quoted.double.c constant.other.placeholder.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c constant.other.placeholder.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -2509,7 +2531,7 @@ }, { "c": "i and ", - "t": "source.c meta.block.c string.quoted.double.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -2520,7 +2542,7 @@ }, { "c": "%.2f", - "t": "source.c meta.block.c string.quoted.double.c constant.other.placeholder.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c constant.other.placeholder.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -2531,7 +2553,7 @@ }, { "c": "-", - "t": "source.c meta.block.c string.quoted.double.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -2542,7 +2564,7 @@ }, { "c": "%.2f", - "t": "source.c meta.block.c string.quoted.double.c constant.other.placeholder.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c constant.other.placeholder.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -2553,7 +2575,7 @@ }, { "c": "i", - "t": "source.c meta.block.c string.quoted.double.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -2564,7 +2586,7 @@ }, { "c": "\"", - "t": "source.c meta.block.c string.quoted.double.c punctuation.definition.string.end.c", + "t": "source.c meta.block.c meta.function-call.c string.quoted.double.c punctuation.definition.string.end.c", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -2575,7 +2597,7 @@ }, { "c": ",", - "t": "source.c meta.block.c punctuation.separator.delimiter.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2586,7 +2608,7 @@ }, { "c": " real", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c meta.function-call.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2597,7 +2619,7 @@ }, { "c": ",", - "t": "source.c meta.block.c punctuation.separator.delimiter.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2608,7 +2630,7 @@ }, { "c": " imag", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c meta.function-call.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2619,7 +2641,7 @@ }, { "c": ",", - "t": "source.c meta.block.c punctuation.separator.delimiter.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2630,7 +2652,7 @@ }, { "c": " real", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c meta.function-call.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2641,7 +2663,7 @@ }, { "c": ",", - "t": "source.c meta.block.c punctuation.separator.delimiter.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2652,7 +2674,7 @@ }, { "c": " imag", - "t": "source.c meta.block.c", + "t": "source.c meta.block.c meta.function-call.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2663,7 +2685,7 @@ }, { "c": ")", - "t": "source.c meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.c meta.block.c meta.function-call.c punctuation.section.arguments.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", diff --git a/extensions/cpp/test/colorize-results/test_cc.json b/extensions/cpp/test/colorize-results/test_cc.json index f3f72320fb5..96e8792159f 100644 --- a/extensions/cpp/test/colorize-results/test_cc.json +++ b/extensions/cpp/test/colorize-results/test_cc.json @@ -1,7 +1,7 @@ [ { "c": "#", - "t": "source.cpp meta.preprocessor.c keyword.control.directive.conditional.c punctuation.definition.directive.c", + "t": "source.cpp meta.preprocessor.cpp keyword.control.directive.conditional.cpp punctuation.definition.directive.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -12,7 +12,7 @@ }, { "c": "if", - "t": "source.cpp meta.preprocessor.c keyword.control.directive.conditional.c", + "t": "source.cpp meta.preprocessor.cpp keyword.control.directive.conditional.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -23,7 +23,7 @@ }, { "c": " ", - "t": "source.cpp meta.preprocessor.c", + "t": "source.cpp meta.preprocessor.cpp", "r": { "dark_plus": "meta.preprocessor: #569CD6", "light_plus": "meta.preprocessor: #0000FF", @@ -34,7 +34,7 @@ }, { "c": "B4G_DEBUG_CHECK", - "t": "source.cpp meta.preprocessor.c entity.name.function.preprocessor.c", + "t": "source.cpp meta.preprocessor.cpp entity.name.function.preprocessor.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -56,7 +56,7 @@ }, { "c": "fprintf", - "t": "source.cpp meta.function.c entity.name.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp entity.name.function.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -67,7 +67,7 @@ }, { "c": "(", - "t": "source.cpp meta.function.c punctuation.section.parameters.begin.bracket.round.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -78,7 +78,7 @@ }, { "c": "stderr", - "t": "source.cpp meta.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -89,7 +89,7 @@ }, { "c": ",", - "t": "source.cpp meta.function.c punctuation.separator.delimiter.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.separator.delimiter.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -100,7 +100,7 @@ }, { "c": "\"", - "t": "source.cpp meta.function.c string.quoted.double.cpp punctuation.definition.string.begin.cpp", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp string.quoted.double.cpp punctuation.definition.string.begin.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -111,7 +111,7 @@ }, { "c": "num_candidate_ret=", - "t": "source.cpp meta.function.c string.quoted.double.cpp", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp string.quoted.double.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -122,7 +122,7 @@ }, { "c": "%d", - "t": "source.cpp meta.function.c string.quoted.double.cpp constant.other.placeholder.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp string.quoted.double.cpp constant.other.placeholder.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -133,7 +133,7 @@ }, { "c": ":", - "t": "source.cpp meta.function.c string.quoted.double.cpp", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp string.quoted.double.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -144,7 +144,7 @@ }, { "c": "\"", - "t": "source.cpp meta.function.c string.quoted.double.cpp punctuation.definition.string.end.cpp", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp string.quoted.double.cpp punctuation.definition.string.end.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -155,7 +155,7 @@ }, { "c": ",", - "t": "source.cpp meta.function.c punctuation.separator.delimiter.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.separator.delimiter.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -166,7 +166,7 @@ }, { "c": " num_candidate", - "t": "source.cpp meta.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -177,7 +177,7 @@ }, { "c": ")", - "t": "source.cpp meta.function.c punctuation.section.parameters.end.bracket.round.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -188,7 +188,7 @@ }, { "c": ";", - "t": "source.cpp punctuation.terminator.statement.c", + "t": "source.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -210,7 +210,7 @@ }, { "c": "for", - "t": "source.cpp keyword.control.c", + "t": "source.cpp keyword.control.for.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -221,7 +221,7 @@ }, { "c": "(", - "t": "source.cpp punctuation.section.parens.begin.bracket.round.c", + "t": "source.cpp punctuation.section.parens-c\b.cpp punctuation.section.parens.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -232,7 +232,7 @@ }, { "c": "int", - "t": "source.cpp storage.type.c", + "t": "source.cpp punctuation.section.parens-c\b.cpp storage.type.language.primitive.cpp", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -243,7 +243,7 @@ }, { "c": " i", - "t": "source.cpp", + "t": "source.cpp punctuation.section.parens-c\b.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -254,7 +254,7 @@ }, { "c": "=", - "t": "source.cpp keyword.operator.assignment.c", + "t": "source.cpp punctuation.section.parens-c\b.cpp keyword.operator.assignment.cpp", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -265,7 +265,7 @@ }, { "c": "0", - "t": "source.cpp constant.numeric.c", + "t": "source.cpp punctuation.section.parens-c\b.cpp constant.numeric.cpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -276,7 +276,7 @@ }, { "c": ";", - "t": "source.cpp punctuation.terminator.statement.c", + "t": "source.cpp punctuation.section.parens-c\b.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -287,7 +287,7 @@ }, { "c": "i", - "t": "source.cpp", + "t": "source.cpp punctuation.section.parens-c\b.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -298,7 +298,7 @@ }, { "c": "<", - "t": "source.cpp keyword.operator.comparison.c", + "t": "source.cpp punctuation.section.parens-c\b.cpp keyword.operator.comparison.cpp", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -309,7 +309,7 @@ }, { "c": "num_candidate", - "t": "source.cpp", + "t": "source.cpp punctuation.section.parens-c\b.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -320,7 +320,7 @@ }, { "c": ";", - "t": "source.cpp punctuation.terminator.statement.c", + "t": "source.cpp punctuation.section.parens-c\b.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -331,7 +331,7 @@ }, { "c": "++", - "t": "source.cpp keyword.operator.increment.c", + "t": "source.cpp punctuation.section.parens-c\b.cpp keyword.operator.increment.cpp", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -342,7 +342,7 @@ }, { "c": "i", - "t": "source.cpp", + "t": "source.cpp punctuation.section.parens-c\b.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -353,7 +353,7 @@ }, { "c": ")", - "t": "source.cpp punctuation.section.parens.end.bracket.round.c", + "t": "source.cpp punctuation.section.parens-c\b.cpp punctuation.section.parens.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -375,7 +375,7 @@ }, { "c": "fprintf", - "t": "source.cpp meta.function.c entity.name.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp entity.name.function.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -386,7 +386,7 @@ }, { "c": "(", - "t": "source.cpp meta.function.c punctuation.section.parameters.begin.bracket.round.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -397,7 +397,7 @@ }, { "c": "stderr", - "t": "source.cpp meta.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -408,7 +408,7 @@ }, { "c": ",", - "t": "source.cpp meta.function.c punctuation.separator.delimiter.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.separator.delimiter.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -419,7 +419,7 @@ }, { "c": "\"", - "t": "source.cpp meta.function.c string.quoted.double.cpp punctuation.definition.string.begin.cpp", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp string.quoted.double.cpp punctuation.definition.string.begin.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -430,7 +430,7 @@ }, { "c": "%d", - "t": "source.cpp meta.function.c string.quoted.double.cpp constant.other.placeholder.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp string.quoted.double.cpp constant.other.placeholder.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -441,7 +441,7 @@ }, { "c": ",", - "t": "source.cpp meta.function.c string.quoted.double.cpp", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp string.quoted.double.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -452,7 +452,7 @@ }, { "c": "\"", - "t": "source.cpp meta.function.c string.quoted.double.cpp punctuation.definition.string.end.cpp", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp string.quoted.double.cpp punctuation.definition.string.end.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -463,7 +463,7 @@ }, { "c": ",", - "t": "source.cpp meta.function.c punctuation.separator.delimiter.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.separator.delimiter.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -474,18 +474,18 @@ }, { "c": "user_candidate", - "t": "source.cpp meta.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp meta.bracket.square.access.cpp variable.object.cpp", "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" + "hc_black": "variable: #9CDCFE" } }, { "c": "[", - "t": "source.cpp meta.function.c punctuation.definition.begin.bracket.square.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp meta.bracket.square.access.cpp punctuation.definition.begin.bracket.square.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -496,7 +496,7 @@ }, { "c": "i", - "t": "source.cpp meta.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp meta.bracket.square.access.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -507,7 +507,7 @@ }, { "c": "]", - "t": "source.cpp meta.function.c punctuation.definition.end.bracket.square.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp meta.bracket.square.access.cpp punctuation.definition.end.bracket.square.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -518,7 +518,7 @@ }, { "c": ")", - "t": "source.cpp meta.function.c punctuation.section.parameters.end.bracket.round.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -529,7 +529,7 @@ }, { "c": ";", - "t": "source.cpp punctuation.terminator.statement.c", + "t": "source.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -551,7 +551,7 @@ }, { "c": "fprintf", - "t": "source.cpp meta.function.c entity.name.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp entity.name.function.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -562,7 +562,7 @@ }, { "c": "(", - "t": "source.cpp meta.function.c punctuation.section.parameters.begin.bracket.round.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -573,7 +573,7 @@ }, { "c": "stderr", - "t": "source.cpp meta.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -584,7 +584,7 @@ }, { "c": ",", - "t": "source.cpp meta.function.c punctuation.separator.delimiter.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.separator.delimiter.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -595,7 +595,7 @@ }, { "c": "\"", - "t": "source.cpp meta.function.c string.quoted.double.cpp punctuation.definition.string.begin.cpp", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp string.quoted.double.cpp punctuation.definition.string.begin.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -606,7 +606,7 @@ }, { "c": ";", - "t": "source.cpp meta.function.c string.quoted.double.cpp", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp string.quoted.double.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -617,7 +617,7 @@ }, { "c": "\"", - "t": "source.cpp meta.function.c string.quoted.double.cpp punctuation.definition.string.end.cpp", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp string.quoted.double.cpp punctuation.definition.string.end.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -628,7 +628,7 @@ }, { "c": ")", - "t": "source.cpp meta.function.c punctuation.section.parameters.end.bracket.round.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -639,7 +639,7 @@ }, { "c": ";", - "t": "source.cpp punctuation.terminator.statement.c", + "t": "source.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -650,7 +650,7 @@ }, { "c": "#", - "t": "source.cpp meta.preprocessor.c keyword.control.directive.conditional.c punctuation.definition.directive.c", + "t": "source.cpp meta.preprocessor.cpp keyword.control.directive.conditional.cpp punctuation.definition.directive.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -661,7 +661,7 @@ }, { "c": "endif", - "t": "source.cpp meta.preprocessor.c keyword.control.directive.conditional.c", + "t": "source.cpp meta.preprocessor.cpp keyword.control.directive.conditional.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -683,7 +683,7 @@ }, { "c": "void", - "t": "source.cpp storage.type.c", + "t": "source.cpp storage.type.language.primitive.cpp", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -705,7 +705,7 @@ }, { "c": "main", - "t": "source.cpp meta.function.c entity.name.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp entity.name.function.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -716,7 +716,7 @@ }, { "c": "(", - "t": "source.cpp meta.function.c punctuation.section.parameters.begin.bracket.round.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -726,8 +726,8 @@ } }, { - "c": "O obj", - "t": "source.cpp meta.function.c", + "c": "O ", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -736,9 +736,20 @@ "hc_black": "default: #FFFFFF" } }, + { + "c": "obj", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp variable.parameter.probably.cpp", + "r": { + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "variable: #9CDCFE" + } + }, { "c": ")", - "t": "source.cpp meta.function.c punctuation.section.parameters.end.bracket.round.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -760,7 +771,7 @@ }, { "c": "{", - "t": "source.cpp meta.block.c punctuation.section.block.begin.bracket.curly.c", + "t": "source.cpp meta.block.cpp punctuation.section.block.begin.bracket.curly.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -771,7 +782,7 @@ }, { "c": " ", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -782,7 +793,7 @@ }, { "c": "LOG_INFO", - "t": "source.cpp meta.block.c meta.function-call.c entity.name.function.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp entity.name.function.call.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -793,7 +804,7 @@ }, { "c": "(", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.section.arguments.begin.bracket.round.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.section.arguments.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -804,7 +815,7 @@ }, { "c": "\"", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp punctuation.definition.string.begin.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp punctuation.definition.string.begin.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -815,7 +826,7 @@ }, { "c": "not hilighted as string", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -826,7 +837,7 @@ }, { "c": "\"", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp punctuation.definition.string.end.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp punctuation.definition.string.end.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -837,7 +848,7 @@ }, { "c": ")", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.section.arguments.end.bracket.round.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.section.arguments.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -848,7 +859,7 @@ }, { "c": ";", - "t": "source.cpp meta.block.c punctuation.terminator.statement.c", + "t": "source.cpp meta.block.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -859,7 +870,7 @@ }, { "c": " ", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -870,7 +881,7 @@ }, { "c": "LOG_INFO", - "t": "source.cpp meta.block.c meta.function-call.c entity.name.function.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp entity.name.function.call.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -881,7 +892,7 @@ }, { "c": "(", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.section.arguments.begin.bracket.round.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.section.arguments.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -892,7 +903,7 @@ }, { "c": "obj ", - "t": "source.cpp meta.block.c meta.function-call.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -903,7 +914,7 @@ }, { "c": "<<", - "t": "source.cpp meta.block.c meta.function-call.c keyword.operator.bitwise.shift.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp keyword.operator.bitwise.shift.cpp", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -914,7 +925,7 @@ }, { "c": " ", - "t": "source.cpp meta.block.c meta.function-call.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -925,7 +936,7 @@ }, { "c": "\"", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp punctuation.definition.string.begin.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp punctuation.definition.string.begin.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -936,7 +947,7 @@ }, { "c": ", even worse; ", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -947,7 +958,7 @@ }, { "c": "\"", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp punctuation.definition.string.end.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp punctuation.definition.string.end.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -958,7 +969,7 @@ }, { "c": " ", - "t": "source.cpp meta.block.c meta.function-call.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -969,7 +980,7 @@ }, { "c": "<<", - "t": "source.cpp meta.block.c meta.function-call.c keyword.operator.bitwise.shift.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp keyword.operator.bitwise.shift.cpp", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -979,8 +990,8 @@ } }, { - "c": " obj", - "t": "source.cpp meta.block.c meta.function-call.c", + "c": " ", + "t": "source.cpp meta.block.cpp meta.function-call.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -989,20 +1000,31 @@ "hc_black": "default: #FFFFFF" } }, + { + "c": "obj", + "t": "source.cpp meta.block.cpp meta.function-call.cpp variable.object.access.cpp variable.object.cpp", + "r": { + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "variable: #9CDCFE" + } + }, { "c": ".", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.separator.dot-access.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp variable.object.access.cpp punctuation.separator.dot-access.cpp", "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" + "hc_black": "variable: #9CDCFE" } }, { "c": "x", - "t": "source.cpp meta.block.c meta.function-call.c variable.other.member.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp variable.object.access.cpp variable.other.member.cpp", "r": { "dark_plus": "variable: #9CDCFE", "light_plus": "variable: #001080", @@ -1013,7 +1035,7 @@ }, { "c": " ", - "t": "source.cpp meta.block.c meta.function-call.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1024,7 +1046,7 @@ }, { "c": "<<", - "t": "source.cpp meta.block.c meta.function-call.c keyword.operator.bitwise.shift.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp keyword.operator.bitwise.shift.cpp", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -1035,7 +1057,7 @@ }, { "c": " ", - "t": "source.cpp meta.block.c meta.function-call.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1046,7 +1068,7 @@ }, { "c": "\"", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp punctuation.definition.string.begin.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp punctuation.definition.string.begin.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1057,7 +1079,7 @@ }, { "c": " check this out.", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1068,7 +1090,7 @@ }, { "c": "\"", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp punctuation.definition.string.end.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp punctuation.definition.string.end.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1079,7 +1101,7 @@ }, { "c": ")", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.section.arguments.end.bracket.round.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.section.arguments.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1090,7 +1112,7 @@ }, { "c": ";", - "t": "source.cpp meta.block.c punctuation.terminator.statement.c", + "t": "source.cpp meta.block.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1101,7 +1123,7 @@ }, { "c": " ", - "t": "source.cpp meta.block.c punctuation.whitespace.comment.leading.cpp", + "t": "source.cpp meta.block.cpp punctuation.whitespace.comment.leading.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1112,7 +1134,7 @@ }, { "c": "//", - "t": "source.cpp meta.block.c comment.line.double-slash.cpp punctuation.definition.comment.cpp", + "t": "source.cpp meta.block.cpp comment.line.double-slash.cpp punctuation.definition.comment.cpp", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", @@ -1123,7 +1145,7 @@ }, { "c": " everything from this point on is interpeted as a string literal...", - "t": "source.cpp meta.block.c comment.line.double-slash.cpp", + "t": "source.cpp meta.block.cpp comment.line.double-slash.cpp", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", @@ -1134,7 +1156,7 @@ }, { "c": " O x", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1145,7 +1167,7 @@ }, { "c": ";", - "t": "source.cpp meta.block.c punctuation.terminator.statement.c", + "t": "source.cpp meta.block.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1155,8 +1177,19 @@ } }, { - "c": " std", - "t": "source.cpp meta.block.c", + "c": " ", + "t": "source.cpp meta.block.cpp punctuation.separator.namespace.access.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "std", + "t": "source.cpp meta.block.cpp punctuation.separator.namespace.access.cpp entity.scope.name.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1167,7 +1200,7 @@ }, { "c": "::", - "t": "source.cpp meta.block.c punctuation.separator.namespace.access.cpp", + "t": "source.cpp meta.block.cpp punctuation.separator.namespace.access.cpp punctuation.separator.namespace.access.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1178,7 +1211,7 @@ }, { "c": "unique_ptr", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1189,7 +1222,7 @@ }, { "c": "<", - "t": "source.cpp meta.block.c keyword.operator.comparison.c", + "t": "source.cpp meta.block.cpp keyword.operator.comparison.cpp", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -1200,7 +1233,7 @@ }, { "c": "O", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1211,7 +1244,7 @@ }, { "c": ">", - "t": "source.cpp meta.block.c keyword.operator.comparison.c", + "t": "source.cpp meta.block.cpp keyword.operator.comparison.cpp", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -1222,7 +1255,7 @@ }, { "c": " ", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1233,7 +1266,7 @@ }, { "c": "o", - "t": "source.cpp meta.block.c meta.function-call.c entity.name.function.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp entity.name.function.call.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -1244,7 +1277,7 @@ }, { "c": "(", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.section.arguments.begin.bracket.round.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.section.arguments.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1255,18 +1288,18 @@ }, { "c": "new", - "t": "source.cpp meta.block.c meta.function-call.c keyword.control.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp keyword.operator.new.cpp", "r": { - "dark_plus": "keyword.control: #C586C0", - "light_plus": "keyword.control: #AF00DB", - "dark_vs": "keyword.control: #569CD6", - "light_vs": "keyword.control: #0000FF", - "hc_black": "keyword.control: #C586C0" + "dark_plus": "keyword.operator.new: #569CD6", + "light_plus": "keyword.operator.new: #0000FF", + "dark_vs": "keyword.operator.new: #569CD6", + "light_vs": "keyword.operator.new: #0000FF", + "hc_black": "keyword.operator.new: #569CD6" } }, { "c": " O", - "t": "source.cpp meta.block.c meta.function-call.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1277,7 +1310,7 @@ }, { "c": ")", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.section.arguments.end.bracket.round.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.section.arguments.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1288,7 +1321,7 @@ }, { "c": ";", - "t": "source.cpp meta.block.c punctuation.terminator.statement.c", + "t": "source.cpp meta.block.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1299,7 +1332,7 @@ }, { "c": " ", - "t": "source.cpp meta.block.c punctuation.whitespace.comment.leading.cpp", + "t": "source.cpp meta.block.cpp punctuation.whitespace.comment.leading.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1310,7 +1343,7 @@ }, { "c": "//", - "t": "source.cpp meta.block.c comment.line.double-slash.cpp punctuation.definition.comment.cpp", + "t": "source.cpp meta.block.cpp comment.line.double-slash.cpp punctuation.definition.comment.cpp", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", @@ -1321,7 +1354,7 @@ }, { "c": " sadness.", - "t": "source.cpp meta.block.c comment.line.double-slash.cpp", + "t": "source.cpp meta.block.cpp comment.line.double-slash.cpp", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", @@ -1332,7 +1365,7 @@ }, { "c": " ", - "t": "source.cpp meta.block.c punctuation.whitespace.support.function.leading.c", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1343,18 +1376,18 @@ }, { "c": "sprintf", - "t": "source.cpp meta.block.c support.function.C99.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp entity.name.function.call.cpp", "r": { - "dark_plus": "support.function: #DCDCAA", - "light_plus": "support.function: #795E26", + "dark_plus": "entity.name.function: #DCDCAA", + "light_plus": "entity.name.function: #795E26", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "support.function: #DCDCAA" + "hc_black": "entity.name.function: #DCDCAA" } }, { "c": "(", - "t": "source.cpp meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.section.arguments.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1365,7 +1398,7 @@ }, { "c": "options", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1376,7 +1409,7 @@ }, { "c": ",", - "t": "source.cpp meta.block.c punctuation.separator.delimiter.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.separator.delimiter.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1387,7 +1420,7 @@ }, { "c": " ", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1398,7 +1431,7 @@ }, { "c": "\"", - "t": "source.cpp meta.block.c string.quoted.double.cpp punctuation.definition.string.begin.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp punctuation.definition.string.begin.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1409,7 +1442,7 @@ }, { "c": "STYLE=Keramik;TITLE=", - "t": "source.cpp meta.block.c string.quoted.double.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1420,7 +1453,7 @@ }, { "c": "%s", - "t": "source.cpp meta.block.c string.quoted.double.cpp constant.other.placeholder.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp constant.other.placeholder.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1431,7 +1464,7 @@ }, { "c": ";THEME=", - "t": "source.cpp meta.block.c string.quoted.double.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1442,7 +1475,7 @@ }, { "c": "%s", - "t": "source.cpp meta.block.c string.quoted.double.cpp constant.other.placeholder.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp constant.other.placeholder.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1453,7 +1486,7 @@ }, { "c": "\"", - "t": "source.cpp meta.block.c string.quoted.double.cpp punctuation.definition.string.end.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp punctuation.definition.string.end.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1464,7 +1497,7 @@ }, { "c": ",", - "t": "source.cpp meta.block.c punctuation.separator.delimiter.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.separator.delimiter.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1474,19 +1507,8 @@ } }, { - "c": " ", - "t": "source.cpp meta.block.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "...", - "t": "source.cpp meta.block.c punctuation.separator.dot-access.c", + "c": " ...", + "t": "source.cpp meta.block.cpp meta.function-call.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1497,7 +1519,7 @@ }, { "c": ")", - "t": "source.cpp meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.section.arguments.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1508,7 +1530,7 @@ }, { "c": ";", - "t": "source.cpp meta.block.c punctuation.terminator.statement.c", + "t": "source.cpp meta.block.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1519,7 +1541,7 @@ }, { "c": "}", - "t": "source.cpp meta.block.c punctuation.section.block.end.bracket.curly.c", + "t": "source.cpp meta.block.cpp punctuation.section.block.end.bracket.curly.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1530,7 +1552,7 @@ }, { "c": "int", - "t": "source.cpp storage.type.c", + "t": "source.cpp storage.type.language.primitive.cpp", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -1552,7 +1574,7 @@ }, { "c": "main2", - "t": "source.cpp meta.function.c entity.name.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp entity.name.function.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -1563,7 +1585,7 @@ }, { "c": "(", - "t": "source.cpp meta.function.c punctuation.section.parameters.begin.bracket.round.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1574,7 +1596,7 @@ }, { "c": ")", - "t": "source.cpp meta.function.c punctuation.section.parameters.end.bracket.round.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1596,7 +1618,7 @@ }, { "c": "{", - "t": "source.cpp meta.block.c punctuation.section.block.begin.bracket.curly.c", + "t": "source.cpp meta.block.cpp punctuation.section.block.begin.bracket.curly.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1607,7 +1629,7 @@ }, { "c": " ", - "t": "source.cpp meta.block.c punctuation.whitespace.support.function.leading.c", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1618,260 +1640,7 @@ }, { "c": "printf", - "t": "source.cpp meta.block.c support.function.C99.c", - "r": { - "dark_plus": "support.function: #DCDCAA", - "light_plus": "support.function: #795E26", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "support.function: #DCDCAA" - } - }, - { - "c": "(", - "t": "source.cpp meta.block.c punctuation.section.parens.begin.bracket.round.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "\"", - "t": "source.cpp meta.block.c string.quoted.double.cpp punctuation.definition.string.begin.cpp", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": ";", - "t": "source.cpp meta.block.c string.quoted.double.cpp", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": "\"", - "t": "source.cpp meta.block.c string.quoted.double.cpp punctuation.definition.string.end.cpp", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": ")", - "t": "source.cpp meta.block.c punctuation.section.parens.end.bracket.round.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": ";", - "t": "source.cpp meta.block.c punctuation.terminator.statement.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": " ", - "t": "source.cpp meta.block.c punctuation.whitespace.comment.leading.cpp", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "//", - "t": "source.cpp meta.block.c comment.line.double-slash.cpp punctuation.definition.comment.cpp", - "r": { - "dark_plus": "comment: #6A9955", - "light_plus": "comment: #008000", - "dark_vs": "comment: #6A9955", - "light_vs": "comment: #008000", - "hc_black": "comment: #7CA668" - } - }, - { - "c": " the rest of", - "t": "source.cpp meta.block.c comment.line.double-slash.cpp", - "r": { - "dark_plus": "comment: #6A9955", - "light_plus": "comment: #008000", - "dark_vs": "comment: #6A9955", - "light_vs": "comment: #008000", - "hc_black": "comment: #7CA668" - } - }, - { - "c": " ", - "t": "source.cpp meta.block.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "asm", - "t": "source.cpp meta.block.c meta.function-call.c storage.type.c", - "r": { - "dark_plus": "storage.type: #569CD6", - "light_plus": "storage.type: #0000FF", - "dark_vs": "storage.type: #569CD6", - "light_vs": "storage.type: #0000FF", - "hc_black": "storage.type: #569CD6" - } - }, - { - "c": "(", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.section.parens.begin.bracket.round.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "\"", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp punctuation.definition.string.begin.cpp", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": "movw $0x38, ", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": "%a", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp constant.other.placeholder.c", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": "x; ltr ", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": "%a", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp constant.other.placeholder.c", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": "x", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": "\"", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp punctuation.definition.string.end.cpp", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": ")", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.section.parens.end.bracket.round.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": ";", - "t": "source.cpp meta.block.c punctuation.terminator.statement.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": " ", - "t": "source.cpp meta.block.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "fn", - "t": "source.cpp meta.block.c meta.function-call.c entity.name.function.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp entity.name.function.call.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -1882,7 +1651,7 @@ }, { "c": "(", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.section.arguments.begin.bracket.round.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.section.arguments.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1893,7 +1662,7 @@ }, { "c": "\"", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp punctuation.definition.string.begin.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp punctuation.definition.string.begin.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1903,8 +1672,8 @@ } }, { - "c": "{};", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp", + "c": ";", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1915,7 +1684,7 @@ }, { "c": "\"", - "t": "source.cpp meta.block.c meta.function-call.c string.quoted.double.cpp punctuation.definition.string.end.cpp", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp punctuation.definition.string.end.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1926,7 +1695,7 @@ }, { "c": ")", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.section.arguments.end.bracket.round.c", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.section.arguments.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1937,7 +1706,7 @@ }, { "c": ";", - "t": "source.cpp meta.block.c punctuation.terminator.statement.c", + "t": "source.cpp meta.block.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1948,7 +1717,7 @@ }, { "c": " ", - "t": "source.cpp meta.block.c punctuation.whitespace.comment.leading.cpp", + "t": "source.cpp meta.block.cpp punctuation.whitespace.comment.leading.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1959,7 +1728,7 @@ }, { "c": "//", - "t": "source.cpp meta.block.c comment.line.double-slash.cpp punctuation.definition.comment.cpp", + "t": "source.cpp meta.block.cpp comment.line.double-slash.cpp punctuation.definition.comment.cpp", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", @@ -1970,7 +1739,260 @@ }, { "c": " the rest of", - "t": "source.cpp meta.block.c comment.line.double-slash.cpp", + "t": "source.cpp meta.block.cpp comment.line.double-slash.cpp", + "r": { + "dark_plus": "comment: #6A9955", + "light_plus": "comment: #008000", + "dark_vs": "comment: #6A9955", + "light_vs": "comment: #008000", + "hc_black": "comment: #7CA668" + } + }, + { + "c": " ", + "t": "source.cpp meta.block.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "asm", + "t": "source.cpp meta.block.cpp meta.function-call.cpp storage.type.asm.cpp", + "r": { + "dark_plus": "storage.type: #569CD6", + "light_plus": "storage.type: #0000FF", + "dark_vs": "storage.type: #569CD6", + "light_vs": "storage.type: #0000FF", + "hc_black": "storage.type: #569CD6" + } + }, + { + "c": "(", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.section.parens.begin.bracket.round.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "\"", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp punctuation.definition.string.begin.cpp", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": "movw $0x38, ", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": "%a", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp constant.other.placeholder.cpp", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": "x; ltr ", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": "%a", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp constant.other.placeholder.cpp", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": "x", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": "\"", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp punctuation.definition.string.end.cpp", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": ")", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.section.parens.end.bracket.round.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": ";", + "t": "source.cpp meta.block.cpp punctuation.terminator.statement.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": " ", + "t": "source.cpp meta.block.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "fn", + "t": "source.cpp meta.block.cpp meta.function-call.cpp entity.name.function.call.cpp", + "r": { + "dark_plus": "entity.name.function: #DCDCAA", + "light_plus": "entity.name.function: #795E26", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "entity.name.function: #DCDCAA" + } + }, + { + "c": "(", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.section.arguments.begin.bracket.round.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "\"", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp punctuation.definition.string.begin.cpp", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": "{};", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": "\"", + "t": "source.cpp meta.block.cpp meta.function-call.cpp string.quoted.double.cpp punctuation.definition.string.end.cpp", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": ")", + "t": "source.cpp meta.block.cpp meta.function-call.cpp punctuation.section.arguments.end.bracket.round.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": ";", + "t": "source.cpp meta.block.cpp punctuation.terminator.statement.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": " ", + "t": "source.cpp meta.block.cpp punctuation.whitespace.comment.leading.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "//", + "t": "source.cpp meta.block.cpp comment.line.double-slash.cpp punctuation.definition.comment.cpp", + "r": { + "dark_plus": "comment: #6A9955", + "light_plus": "comment: #008000", + "dark_vs": "comment: #6A9955", + "light_vs": "comment: #008000", + "hc_black": "comment: #7CA668" + } + }, + { + "c": " the rest of", + "t": "source.cpp meta.block.cpp comment.line.double-slash.cpp", "r": { "dark_plus": "comment: #6A9955", "light_plus": "comment: #008000", @@ -1981,7 +2003,7 @@ }, { "c": "}", - "t": "source.cpp meta.block.c punctuation.section.block.end.bracket.curly.c", + "t": "source.cpp meta.block.cpp punctuation.section.block.end.bracket.curly.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", diff --git a/extensions/cpp/test/colorize-results/test_cpp.json b/extensions/cpp/test/colorize-results/test_cpp.json index b3c9a841cc4..134c8274ca7 100644 --- a/extensions/cpp/test/colorize-results/test_cpp.json +++ b/extensions/cpp/test/colorize-results/test_cpp.json @@ -23,7 +23,7 @@ }, { "c": "#", - "t": "source.cpp meta.preprocessor.include.c keyword.control.directive.include.c punctuation.definition.directive.c", + "t": "source.cpp meta.preprocessor.include.cpp keyword.control.directive.include.cpp punctuation.definition.directive.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -34,7 +34,7 @@ }, { "c": "include", - "t": "source.cpp meta.preprocessor.include.c keyword.control.directive.include.c", + "t": "source.cpp meta.preprocessor.include.cpp keyword.control.directive.include.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -45,7 +45,7 @@ }, { "c": " ", - "t": "source.cpp meta.preprocessor.include.c", + "t": "source.cpp meta.preprocessor.include.cpp", "r": { "dark_plus": "meta.preprocessor: #569CD6", "light_plus": "meta.preprocessor: #0000FF", @@ -56,7 +56,7 @@ }, { "c": "<", - "t": "source.cpp meta.preprocessor.include.c string.quoted.other.lt-gt.include.c punctuation.definition.string.begin.c", + "t": "source.cpp meta.preprocessor.include.cpp string.quoted.other.lt-gt.include.cpp punctuation.definition.string.begin.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -67,7 +67,7 @@ }, { "c": "iostream", - "t": "source.cpp meta.preprocessor.include.c string.quoted.other.lt-gt.include.c", + "t": "source.cpp meta.preprocessor.include.cpp string.quoted.other.lt-gt.include.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -78,7 +78,7 @@ }, { "c": ">", - "t": "source.cpp meta.preprocessor.include.c string.quoted.other.lt-gt.include.c punctuation.definition.string.end.c", + "t": "source.cpp meta.preprocessor.include.cpp string.quoted.other.lt-gt.include.cpp punctuation.definition.string.end.cpp", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -89,13 +89,13 @@ }, { "c": "using", - "t": "source.cpp meta.using-namespace-declaration.cpp keyword.control.cpp", + "t": "source.cpp meta.using-namespace-declaration.cpp keyword.other.using.directive.cpp", "r": { - "dark_plus": "keyword.control: #C586C0", - "light_plus": "keyword.control: #AF00DB", - "dark_vs": "keyword.control: #569CD6", - "light_vs": "keyword.control: #0000FF", - "hc_black": "keyword.control: #C586C0" + "dark_plus": "keyword: #569CD6", + "light_plus": "keyword: #0000FF", + "dark_vs": "keyword: #569CD6", + "light_vs": "keyword: #0000FF", + "hc_black": "keyword: #569CD6" } }, { @@ -111,13 +111,13 @@ }, { "c": "namespace", - "t": "source.cpp meta.using-namespace-declaration.cpp storage.type.cpp", + "t": "source.cpp meta.using-namespace-declaration.cpp keyword.other.namespace.directive.cpp", "r": { - "dark_plus": "storage.type: #569CD6", - "light_plus": "storage.type: #0000FF", - "dark_vs": "storage.type: #569CD6", - "light_vs": "storage.type: #0000FF", - "hc_black": "storage.type: #569CD6" + "dark_plus": "keyword: #569CD6", + "light_plus": "keyword: #0000FF", + "dark_vs": "keyword: #569CD6", + "light_vs": "keyword: #0000FF", + "hc_black": "keyword: #569CD6" } }, { @@ -133,7 +133,7 @@ }, { "c": "std", - "t": "source.cpp meta.using-namespace-declaration.cpp entity.name.type.cpp", + "t": "source.cpp meta.using-namespace-declaration.cpp entity.name.type.namespace.cpp", "r": { "dark_plus": "entity.name.type: #4EC9B0", "light_plus": "entity.name.type: #267F99", @@ -144,7 +144,7 @@ }, { "c": ";", - "t": "source.cpp meta.using-namespace-declaration.cpp", + "t": "source.cpp meta.using-namespace-declaration.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -155,7 +155,7 @@ }, { "c": "class", - "t": "source.cpp meta.class-struct-block.cpp storage.type.cpp", + "t": "source.cpp meta.class-struct-block.cpp storage.type.class.cpp", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -221,7 +221,7 @@ }, { "c": "int", - "t": "source.cpp meta.class-struct-block.cpp storage.type.c", + "t": "source.cpp meta.class-struct-block.cpp storage.type.language.primitive.cpp", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -243,7 +243,7 @@ }, { "c": ",", - "t": "source.cpp meta.class-struct-block.cpp punctuation.separator.delimiter.c", + "t": "source.cpp meta.class-struct-block.cpp punctuation.separator.delimiter.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -265,7 +265,7 @@ }, { "c": ";", - "t": "source.cpp meta.class-struct-block.cpp punctuation.terminator.statement.c", + "t": "source.cpp meta.class-struct-block.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -287,13 +287,13 @@ }, { "c": "public:", - "t": "source.cpp meta.class-struct-block.cpp storage.modifier.cpp", + "t": "source.cpp meta.class-struct-block.cpp storage.type.modifier.access.control.public.cpp", "r": { - "dark_plus": "storage.modifier: #569CD6", - "light_plus": "storage.modifier: #0000FF", - "dark_vs": "storage.modifier: #569CD6", - "light_vs": "storage.modifier: #0000FF", - "hc_black": "storage.modifier: #569CD6" + "dark_plus": "storage.type: #569CD6", + "light_plus": "storage.type: #0000FF", + "dark_vs": "storage.type: #569CD6", + "light_vs": "storage.type: #0000FF", + "hc_black": "storage.type: #569CD6" } }, { @@ -309,7 +309,7 @@ }, { "c": "void", - "t": "source.cpp meta.class-struct-block.cpp storage.type.c", + "t": "source.cpp meta.class-struct-block.cpp storage.type.language.primitive.cpp", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -331,7 +331,7 @@ }, { "c": "set_values", - "t": "source.cpp meta.class-struct-block.cpp meta.function.c entity.name.function.c", + "t": "source.cpp meta.class-struct-block.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp entity.name.function.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -342,7 +342,7 @@ }, { "c": " ", - "t": "source.cpp meta.class-struct-block.cpp meta.function.c", + "t": "source.cpp meta.class-struct-block.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -353,7 +353,7 @@ }, { "c": "(", - "t": "source.cpp meta.class-struct-block.cpp meta.function.c punctuation.section.parameters.begin.bracket.round.c", + "t": "source.cpp meta.class-struct-block.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -364,7 +364,7 @@ }, { "c": "int", - "t": "source.cpp meta.class-struct-block.cpp meta.function.c storage.type.c", + "t": "source.cpp meta.class-struct-block.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp storage.type.language.primitive.cpp", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -375,7 +375,7 @@ }, { "c": ",", - "t": "source.cpp meta.class-struct-block.cpp meta.function.c punctuation.separator.delimiter.c", + "t": "source.cpp meta.class-struct-block.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.separator.delimiter.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -386,7 +386,7 @@ }, { "c": "int", - "t": "source.cpp meta.class-struct-block.cpp meta.function.c storage.type.c", + "t": "source.cpp meta.class-struct-block.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp storage.type.language.primitive.cpp", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -397,7 +397,7 @@ }, { "c": ")", - "t": "source.cpp meta.class-struct-block.cpp meta.function.c punctuation.section.parameters.end.bracket.round.c", + "t": "source.cpp meta.class-struct-block.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -408,7 +408,7 @@ }, { "c": ";", - "t": "source.cpp meta.class-struct-block.cpp punctuation.terminator.statement.c", + "t": "source.cpp meta.class-struct-block.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -430,7 +430,7 @@ }, { "c": "int", - "t": "source.cpp meta.class-struct-block.cpp storage.type.c", + "t": "source.cpp meta.class-struct-block.cpp storage.type.language.primitive.cpp", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -452,7 +452,7 @@ }, { "c": "area", - "t": "source.cpp meta.class-struct-block.cpp meta.function.c entity.name.function.c", + "t": "source.cpp meta.class-struct-block.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp entity.name.function.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -463,7 +463,7 @@ }, { "c": "(", - "t": "source.cpp meta.class-struct-block.cpp meta.function.c punctuation.section.parameters.begin.bracket.round.c", + "t": "source.cpp meta.class-struct-block.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -474,7 +474,7 @@ }, { "c": ")", - "t": "source.cpp meta.class-struct-block.cpp meta.function.c punctuation.section.parameters.end.bracket.round.c", + "t": "source.cpp meta.class-struct-block.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -496,7 +496,7 @@ }, { "c": "{", - "t": "source.cpp meta.class-struct-block.cpp meta.block.c punctuation.section.block.begin.bracket.curly.c", + "t": "source.cpp meta.class-struct-block.cpp meta.block.cpp punctuation.section.block.begin.bracket.curly.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -507,7 +507,7 @@ }, { "c": "return", - "t": "source.cpp meta.class-struct-block.cpp meta.block.c keyword.control.c", + "t": "source.cpp meta.class-struct-block.cpp meta.block.cpp keyword.control.return.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -518,7 +518,7 @@ }, { "c": " width", - "t": "source.cpp meta.class-struct-block.cpp meta.block.c", + "t": "source.cpp meta.class-struct-block.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -529,7 +529,7 @@ }, { "c": "*", - "t": "source.cpp meta.class-struct-block.cpp meta.block.c keyword.operator.c", + "t": "source.cpp meta.class-struct-block.cpp meta.block.cpp keyword.operator.cpp", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -540,7 +540,7 @@ }, { "c": "height", - "t": "source.cpp meta.class-struct-block.cpp meta.block.c", + "t": "source.cpp meta.class-struct-block.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -551,7 +551,7 @@ }, { "c": ";", - "t": "source.cpp meta.class-struct-block.cpp meta.block.c punctuation.terminator.statement.c", + "t": "source.cpp meta.class-struct-block.cpp meta.block.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -562,7 +562,7 @@ }, { "c": "}", - "t": "source.cpp meta.class-struct-block.cpp meta.block.c punctuation.section.block.end.bracket.curly.c", + "t": "source.cpp meta.class-struct-block.cpp meta.block.cpp punctuation.section.block.end.bracket.curly.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -584,7 +584,7 @@ }, { "c": ";", - "t": "source.cpp punctuation.terminator.statement.c", + "t": "source.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -595,7 +595,7 @@ }, { "c": "void", - "t": "source.cpp storage.type.c", + "t": "source.cpp storage.type.language.primitive.cpp", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -606,7 +606,7 @@ }, { "c": " ", - "t": "source.cpp", + "t": "source.cpp punctuation.separator.namespace.access.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -616,8 +616,30 @@ } }, { - "c": "Rectangle::set_values", - "t": "source.cpp meta.function.c entity.name.function.c", + "c": "Rectangle", + "t": "source.cpp punctuation.separator.namespace.access.cpp entity.scope.name.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "::", + "t": "source.cpp punctuation.separator.namespace.access.cpp punctuation.separator.namespace.access.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "set_values", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp entity.name.function.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -628,7 +650,7 @@ }, { "c": " ", - "t": "source.cpp meta.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -639,7 +661,7 @@ }, { "c": "(", - "t": "source.cpp meta.function.c punctuation.section.parameters.begin.bracket.round.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -650,7 +672,7 @@ }, { "c": "int", - "t": "source.cpp meta.function.c storage.type.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp storage.type.language.primitive.cpp", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -660,8 +682,8 @@ } }, { - "c": " x", - "t": "source.cpp meta.function.c", + "c": " ", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -670,9 +692,20 @@ "hc_black": "default: #FFFFFF" } }, + { + "c": "x", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp variable.parameter.probably.cpp", + "r": { + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "variable: #9CDCFE" + } + }, { "c": ",", - "t": "source.cpp meta.function.c punctuation.separator.delimiter.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.separator.delimiter.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -683,7 +716,7 @@ }, { "c": " ", - "t": "source.cpp meta.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -694,7 +727,7 @@ }, { "c": "int", - "t": "source.cpp meta.function.c storage.type.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp storage.type.language.primitive.cpp", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -704,8 +737,8 @@ } }, { - "c": " y", - "t": "source.cpp meta.function.c", + "c": " ", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -714,9 +747,20 @@ "hc_black": "default: #FFFFFF" } }, + { + "c": "y", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp variable.parameter.probably.cpp", + "r": { + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "variable: #9CDCFE" + } + }, { "c": ")", - "t": "source.cpp meta.function.c punctuation.section.parameters.end.bracket.round.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -738,7 +782,7 @@ }, { "c": "{", - "t": "source.cpp meta.block.c punctuation.section.block.begin.bracket.curly.c", + "t": "source.cpp meta.block.cpp punctuation.section.block.begin.bracket.curly.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -749,7 +793,7 @@ }, { "c": " width ", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -760,7 +804,7 @@ }, { "c": "=", - "t": "source.cpp meta.block.c keyword.operator.assignment.c", + "t": "source.cpp meta.block.cpp keyword.operator.assignment.cpp", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -771,7 +815,7 @@ }, { "c": " x", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -782,7 +826,7 @@ }, { "c": ";", - "t": "source.cpp meta.block.c punctuation.terminator.statement.c", + "t": "source.cpp meta.block.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -793,7 +837,7 @@ }, { "c": " height ", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -804,7 +848,7 @@ }, { "c": "=", - "t": "source.cpp meta.block.c keyword.operator.assignment.c", + "t": "source.cpp meta.block.cpp keyword.operator.assignment.cpp", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -815,7 +859,7 @@ }, { "c": " y", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -826,7 +870,7 @@ }, { "c": ";", - "t": "source.cpp meta.block.c punctuation.terminator.statement.c", + "t": "source.cpp meta.block.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -837,7 +881,7 @@ }, { "c": "}", - "t": "source.cpp meta.block.c punctuation.section.block.end.bracket.curly.c", + "t": "source.cpp meta.block.cpp punctuation.section.block.end.bracket.curly.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -848,7 +892,7 @@ }, { "c": "int", - "t": "source.cpp storage.type.c", + "t": "source.cpp storage.type.language.primitive.cpp", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -870,7 +914,7 @@ }, { "c": "main", - "t": "source.cpp meta.function.c entity.name.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp entity.name.function.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -881,7 +925,7 @@ }, { "c": " ", - "t": "source.cpp meta.function.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -892,7 +936,7 @@ }, { "c": "(", - "t": "source.cpp meta.function.c punctuation.section.parameters.begin.bracket.round.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.begin.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -903,7 +947,7 @@ }, { "c": ")", - "t": "source.cpp meta.function.c punctuation.section.parameters.end.bracket.round.c", + "t": "source.cpp meta.function.definition.cpp meta.function.definition.parameters.cpp punctuation.section.parameters.end.bracket.round.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -925,7 +969,7 @@ }, { "c": "{", - "t": "source.cpp meta.block.c punctuation.section.block.begin.bracket.curly.c", + "t": "source.cpp meta.block.cpp punctuation.section.block.begin.bracket.curly.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -936,7 +980,7 @@ }, { "c": " Rectangle rect", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -947,271 +991,7 @@ }, { "c": ";", - "t": "source.cpp meta.block.c punctuation.terminator.statement.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": " rect", - "t": "source.cpp meta.block.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": ".", - "t": "source.cpp meta.block.c punctuation.separator.dot-access.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "set_values", - "t": "source.cpp meta.block.c meta.function-call.c entity.name.function.c", - "r": { - "dark_plus": "entity.name.function: #DCDCAA", - "light_plus": "entity.name.function: #795E26", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "entity.name.function: #DCDCAA" - } - }, - { - "c": " ", - "t": "source.cpp meta.block.c meta.function-call.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "(", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.section.arguments.begin.bracket.round.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "3", - "t": "source.cpp meta.block.c meta.function-call.c constant.numeric.c", - "r": { - "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", - "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", - "hc_black": "constant.numeric: #B5CEA8" - } - }, - { - "c": ",", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.separator.delimiter.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "4", - "t": "source.cpp meta.block.c meta.function-call.c constant.numeric.c", - "r": { - "dark_plus": "constant.numeric: #B5CEA8", - "light_plus": "constant.numeric: #09885A", - "dark_vs": "constant.numeric: #B5CEA8", - "light_vs": "constant.numeric: #09885A", - "hc_black": "constant.numeric: #B5CEA8" - } - }, - { - "c": ")", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.section.arguments.end.bracket.round.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": ";", - "t": "source.cpp meta.block.c punctuation.terminator.statement.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": " cout ", - "t": "source.cpp meta.block.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "<<", - "t": "source.cpp meta.block.c keyword.operator.bitwise.shift.c", - "r": { - "dark_plus": "keyword.operator: #D4D4D4", - "light_plus": "keyword.operator: #000000", - "dark_vs": "keyword.operator: #D4D4D4", - "light_vs": "keyword.operator: #000000", - "hc_black": "keyword.operator: #D4D4D4" - } - }, - { - "c": " ", - "t": "source.cpp meta.block.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "\"", - "t": "source.cpp meta.block.c string.quoted.double.cpp punctuation.definition.string.begin.cpp", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": "area: ", - "t": "source.cpp meta.block.c string.quoted.double.cpp", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": "\"", - "t": "source.cpp meta.block.c string.quoted.double.cpp punctuation.definition.string.end.cpp", - "r": { - "dark_plus": "string: #CE9178", - "light_plus": "string: #A31515", - "dark_vs": "string: #CE9178", - "light_vs": "string: #A31515", - "hc_black": "string: #CE9178" - } - }, - { - "c": " ", - "t": "source.cpp meta.block.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "<<", - "t": "source.cpp meta.block.c keyword.operator.bitwise.shift.c", - "r": { - "dark_plus": "keyword.operator: #D4D4D4", - "light_plus": "keyword.operator: #000000", - "dark_vs": "keyword.operator: #D4D4D4", - "light_vs": "keyword.operator: #000000", - "hc_black": "keyword.operator: #D4D4D4" - } - }, - { - "c": " rect", - "t": "source.cpp meta.block.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": ".", - "t": "source.cpp meta.block.c punctuation.separator.dot-access.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "area", - "t": "source.cpp meta.block.c meta.function-call.c entity.name.function.c", - "r": { - "dark_plus": "entity.name.function: #DCDCAA", - "light_plus": "entity.name.function: #795E26", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "entity.name.function: #DCDCAA" - } - }, - { - "c": "(", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.section.arguments.begin.bracket.round.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": ")", - "t": "source.cpp meta.block.c meta.function-call.c punctuation.section.arguments.end.bracket.round.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": ";", - "t": "source.cpp meta.block.c punctuation.terminator.statement.c", + "t": "source.cpp meta.block.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1222,7 +1002,293 @@ }, { "c": " ", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "rect", + "t": "source.cpp meta.block.cpp variable.object.access.cpp variable.object.cpp", + "r": { + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "variable: #9CDCFE" + } + }, + { + "c": ".", + "t": "source.cpp meta.block.cpp variable.object.access.cpp punctuation.separator.dot-access.cpp", + "r": { + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "variable: #9CDCFE" + } + }, + { + "c": "set_values", + "t": "source.cpp meta.block.cpp variable.object.access.cpp variable.other.member.cpp", + "r": { + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "variable: #9CDCFE" + } + }, + { + "c": " ", + "t": "source.cpp meta.block.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "(", + "t": "source.cpp meta.block.cpp meta.block.parens.cpp punctuation.section.parens.begin.bracket.round.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "3", + "t": "source.cpp meta.block.cpp meta.block.parens.cpp constant.numeric.cpp", + "r": { + "dark_plus": "constant.numeric: #B5CEA8", + "light_plus": "constant.numeric: #09885A", + "dark_vs": "constant.numeric: #B5CEA8", + "light_vs": "constant.numeric: #09885A", + "hc_black": "constant.numeric: #B5CEA8" + } + }, + { + "c": ",", + "t": "source.cpp meta.block.cpp meta.block.parens.cpp punctuation.separator.delimiter.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "4", + "t": "source.cpp meta.block.cpp meta.block.parens.cpp constant.numeric.cpp", + "r": { + "dark_plus": "constant.numeric: #B5CEA8", + "light_plus": "constant.numeric: #09885A", + "dark_vs": "constant.numeric: #B5CEA8", + "light_vs": "constant.numeric: #09885A", + "hc_black": "constant.numeric: #B5CEA8" + } + }, + { + "c": ")", + "t": "source.cpp meta.block.cpp meta.block.parens.cpp punctuation.section.parens.end.bracket.round.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": ";", + "t": "source.cpp meta.block.cpp punctuation.terminator.statement.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": " cout ", + "t": "source.cpp meta.block.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "<<", + "t": "source.cpp meta.block.cpp keyword.operator.bitwise.shift.cpp", + "r": { + "dark_plus": "keyword.operator: #D4D4D4", + "light_plus": "keyword.operator: #000000", + "dark_vs": "keyword.operator: #D4D4D4", + "light_vs": "keyword.operator: #000000", + "hc_black": "keyword.operator: #D4D4D4" + } + }, + { + "c": " ", + "t": "source.cpp meta.block.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "\"", + "t": "source.cpp meta.block.cpp string.quoted.double.cpp punctuation.definition.string.begin.cpp", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": "area: ", + "t": "source.cpp meta.block.cpp string.quoted.double.cpp", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": "\"", + "t": "source.cpp meta.block.cpp string.quoted.double.cpp punctuation.definition.string.end.cpp", + "r": { + "dark_plus": "string: #CE9178", + "light_plus": "string: #A31515", + "dark_vs": "string: #CE9178", + "light_vs": "string: #A31515", + "hc_black": "string: #CE9178" + } + }, + { + "c": " ", + "t": "source.cpp meta.block.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "<<", + "t": "source.cpp meta.block.cpp keyword.operator.bitwise.shift.cpp", + "r": { + "dark_plus": "keyword.operator: #D4D4D4", + "light_plus": "keyword.operator: #000000", + "dark_vs": "keyword.operator: #D4D4D4", + "light_vs": "keyword.operator: #000000", + "hc_black": "keyword.operator: #D4D4D4" + } + }, + { + "c": " ", + "t": "source.cpp meta.block.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "rect", + "t": "source.cpp meta.block.cpp meta.function-call.member.cpp variable.object.cpp", + "r": { + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "variable: #9CDCFE" + } + }, + { + "c": ".", + "t": "source.cpp meta.block.cpp meta.function-call.member.cpp punctuation.separator.dot-access.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "area", + "t": "source.cpp meta.block.cpp meta.function-call.member.cpp entity.name.function.member.cpp", + "r": { + "dark_plus": "entity.name.function: #DCDCAA", + "light_plus": "entity.name.function: #795E26", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "entity.name.function: #DCDCAA" + } + }, + { + "c": "(", + "t": "source.cpp meta.block.cpp meta.function-call.member.cpp punctuation.section.arguments.begin.bracket.round.function.member.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": ")", + "t": "source.cpp meta.block.cpp meta.function-call.member.cpp punctuation.section.arguments.end.bracket.round.function.member.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": ";", + "t": "source.cpp meta.block.cpp punctuation.terminator.statement.cpp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": " ", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1233,7 +1299,7 @@ }, { "c": "return", - "t": "source.cpp meta.block.c keyword.control.c", + "t": "source.cpp meta.block.cpp keyword.control.return.cpp", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -1244,7 +1310,7 @@ }, { "c": " ", - "t": "source.cpp meta.block.c", + "t": "source.cpp meta.block.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1255,7 +1321,7 @@ }, { "c": "0", - "t": "source.cpp meta.block.c constant.numeric.c", + "t": "source.cpp meta.block.cpp constant.numeric.cpp", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -1266,7 +1332,7 @@ }, { "c": ";", - "t": "source.cpp meta.block.c punctuation.terminator.statement.c", + "t": "source.cpp meta.block.cpp punctuation.terminator.statement.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1277,7 +1343,7 @@ }, { "c": "}", - "t": "source.cpp meta.block.c punctuation.section.block.end.bracket.curly.c", + "t": "source.cpp meta.block.cpp punctuation.section.block.end.bracket.curly.cpp", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", diff --git a/extensions/objective-c/test/colorize-results/test_m.json b/extensions/objective-c/test/colorize-results/test_m.json index 9a4926acad5..dc53e9cd713 100644 --- a/extensions/objective-c/test/colorize-results/test_m.json +++ b/extensions/objective-c/test/colorize-results/test_m.json @@ -298,7 +298,7 @@ }, { "c": "void", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc meta.return-type.objc storage.type.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc meta.return-type.objc storage.type.built-in.primitive.c", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -639,7 +639,7 @@ }, { "c": "(", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.block punctuation.section.parens.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -650,7 +650,7 @@ }, { "c": "NSDocumentDirectory", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c support.constant.cocoa", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.block support.constant.cocoa", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -661,7 +661,7 @@ }, { "c": ",", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.separator.delimiter.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.block punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -672,7 +672,7 @@ }, { "c": " ", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.block", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -683,7 +683,7 @@ }, { "c": "NSUserDomainMask", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c support.constant.cocoa", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.block support.constant.cocoa", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -694,7 +694,7 @@ }, { "c": ",", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.separator.delimiter.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.block punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -705,7 +705,7 @@ }, { "c": " ", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.block", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -716,7 +716,7 @@ }, { "c": "true", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c constant.language.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.block constant.language.c", "r": { "dark_plus": "constant.language: #569CD6", "light_plus": "constant.language: #0000FF", @@ -727,7 +727,7 @@ }, { "c": ")", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.block punctuation.section.parens.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -738,7 +738,7 @@ }, { "c": "[", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.begin.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.begin.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -749,7 +749,7 @@ }, { "c": "0", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c constant.numeric.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c constant.numeric.c", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -760,7 +760,7 @@ }, { "c": "]", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.end.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.end.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -848,7 +848,7 @@ }, { "c": "[", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.begin.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.begin.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -859,7 +859,7 @@ }, { "c": "NSOpenPanel", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c support.class.cocoa", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c support.class.cocoa", "r": { "dark_plus": "support.class: #4EC9B0", "light_plus": "support.class: #267F99", @@ -870,7 +870,7 @@ }, { "c": " openPanel", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -881,7 +881,7 @@ }, { "c": "]", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.end.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.end.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -914,7 +914,7 @@ }, { "c": "[", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.begin.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.begin.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -925,7 +925,7 @@ }, { "c": "panel setAllowedFileTypes:", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -935,8 +935,19 @@ } }, { - "c": "[[", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.begin.bracket.square.c", + "c": "[", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c punctuation.definition.begin.bracket.square.c", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "[", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c meta.bracket.square.access.c punctuation.definition.begin.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -947,7 +958,7 @@ }, { "c": "NSArray", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c support.class.cocoa", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c meta.bracket.square.access.c support.class.cocoa", "r": { "dark_plus": "support.class: #4EC9B0", "light_plus": "support.class: #267F99", @@ -958,7 +969,7 @@ }, { "c": " alloc", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -969,7 +980,7 @@ }, { "c": "]", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.end.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c meta.bracket.square.access.c punctuation.definition.end.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -980,7 +991,7 @@ }, { "c": " initWithObjects:", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -991,7 +1002,7 @@ }, { "c": "@\"", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c string.quoted.double.objc punctuation.definition.string.begin.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c string.quoted.double.objc punctuation.definition.string.begin.objc", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1002,7 +1013,7 @@ }, { "c": "ipa", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c string.quoted.double.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c string.quoted.double.objc", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1013,7 +1024,7 @@ }, { "c": "\"", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c string.quoted.double.objc punctuation.definition.string.end.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c string.quoted.double.objc punctuation.definition.string.end.objc", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1024,7 +1035,7 @@ }, { "c": ",", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.separator.delimiter.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1035,7 +1046,7 @@ }, { "c": " ", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1046,7 +1057,7 @@ }, { "c": "@\"", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c string.quoted.double.objc punctuation.definition.string.begin.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c string.quoted.double.objc punctuation.definition.string.begin.objc", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1057,7 +1068,7 @@ }, { "c": "xcarchive", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c string.quoted.double.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c string.quoted.double.objc", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1068,7 +1079,7 @@ }, { "c": "\"", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c string.quoted.double.objc punctuation.definition.string.end.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c string.quoted.double.objc punctuation.definition.string.end.objc", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1079,7 +1090,7 @@ }, { "c": ",", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.separator.delimiter.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1090,7 +1101,7 @@ }, { "c": " ", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1101,7 +1112,7 @@ }, { "c": "@\"", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c string.quoted.double.objc punctuation.definition.string.begin.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c string.quoted.double.objc punctuation.definition.string.begin.objc", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1112,7 +1123,7 @@ }, { "c": "app", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c string.quoted.double.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c string.quoted.double.objc", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1123,7 +1134,7 @@ }, { "c": "\"", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c string.quoted.double.objc punctuation.definition.string.end.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c string.quoted.double.objc punctuation.definition.string.end.objc", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -1134,7 +1145,7 @@ }, { "c": ",", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.separator.delimiter.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c punctuation.separator.delimiter.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1145,7 +1156,7 @@ }, { "c": " ", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1156,7 +1167,7 @@ }, { "c": "nil", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c constant.language.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c constant.language.objc", "r": { "dark_plus": "constant.language: #569CD6", "light_plus": "constant.language: #0000FF", @@ -1166,8 +1177,19 @@ } }, { - "c": "]]", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.end.bracket.square.c", + "c": "]", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c punctuation.definition.end.bracket.square.c", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "]", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.end.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1200,7 +1222,7 @@ }, { "c": "[", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.begin.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.begin.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1211,7 +1233,7 @@ }, { "c": "panel beginWithCompletionHandler:", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1222,7 +1244,7 @@ }, { "c": "^", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c keyword.operator.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c keyword.operator.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -1233,7 +1255,7 @@ }, { "c": "(", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.section.parens.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1244,7 +1266,7 @@ }, { "c": "NSInteger", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c support.type.cocoa.leopard", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c support.type.cocoa.leopard", "r": { "dark_plus": "support.type: #4EC9B0", "light_plus": "support.type: #267F99", @@ -1255,7 +1277,7 @@ }, { "c": " result", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1266,7 +1288,7 @@ }, { "c": ")", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.section.parens.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1277,7 +1299,7 @@ }, { "c": " ", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1288,7 +1310,7 @@ }, { "c": "{", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.block.begin.bracket.curly.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.section.block.begin.bracket.curly.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1299,7 +1321,7 @@ }, { "c": " ", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1310,7 +1332,7 @@ }, { "c": "if", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c keyword.control.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c keyword.control.c", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -1321,7 +1343,7 @@ }, { "c": " ", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1332,7 +1354,7 @@ }, { "c": "(", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.begin.bracket.round.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.section.parens.block punctuation.section.parens.begin.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1343,7 +1365,7 @@ }, { "c": "result ", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.section.parens.block", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1354,7 +1376,7 @@ }, { "c": "==", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c keyword.operator.comparison.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.section.parens.block keyword.operator.comparison.c", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -1365,7 +1387,7 @@ }, { "c": " ", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.section.parens.block", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1376,7 +1398,7 @@ }, { "c": "NSFileHandlingPanelOKButton", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c support.constant.cocoa", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.section.parens.block support.constant.cocoa", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1387,7 +1409,7 @@ }, { "c": ")", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.parens.end.bracket.round.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.section.parens.block punctuation.section.parens.end.bracket.round.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1398,7 +1420,7 @@ }, { "c": " ", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1409,7 +1431,7 @@ }, { "c": "[", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.begin.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c punctuation.definition.begin.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1420,29 +1442,29 @@ }, { "c": "self", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c variable.object.access.c variable.object.c", "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" + "hc_black": "variable: #9CDCFE" } }, { "c": ".", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.separator.dot-access.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c variable.object.access.c punctuation.separator.dot-access.c", "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" + "hc_black": "variable: #9CDCFE" } }, { "c": "inputTextField", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c variable.other.member.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c variable.object.access.c variable.other.member.c", "r": { "dark_plus": "variable: #9CDCFE", "light_plus": "variable: #001080", @@ -1453,7 +1475,7 @@ }, { "c": " setStringValue:", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1464,7 +1486,7 @@ }, { "c": "[", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.begin.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c meta.bracket.square.access.c punctuation.definition.begin.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1475,29 +1497,29 @@ }, { "c": "panel", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c meta.bracket.square.access.c variable.object.access.c variable.object.c", "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" + "hc_black": "variable: #9CDCFE" } }, { "c": ".", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.separator.dot-access.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c meta.bracket.square.access.c variable.object.access.c punctuation.separator.dot-access.c", "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" + "hc_black": "variable: #9CDCFE" } }, { "c": "URL", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c variable.other.member.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c meta.bracket.square.access.c variable.object.access.c variable.other.member.c", "r": { "dark_plus": "variable: #9CDCFE", "light_plus": "variable: #001080", @@ -1508,51 +1530,7 @@ }, { "c": " path", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "]]", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.end.bracket.square.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": ";", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.terminator.statement.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": " ", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "}", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.section.block.end.bracket.curly.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1563,7 +1541,62 @@ }, { "c": "]", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.end.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c meta.bracket.square.access.c punctuation.definition.end.bracket.square.c", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "]", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c punctuation.definition.end.bracket.square.c", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": ";", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.terminator.statement.c", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": " ", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "}", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.section.block.end.bracket.curly.c", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "]", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.end.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1651,7 +1684,7 @@ }, { "c": "int", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c storage.type.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c storage.type.built-in.primitive.c", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -1728,7 +1761,7 @@ }, { "c": "float", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c storage.type.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c storage.type.built-in.primitive.c", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -2299,8 +2332,19 @@ } }, { - "c": "[[", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.begin.bracket.square.c", + "c": "[", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.begin.bracket.square.c", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "[", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c punctuation.definition.begin.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2311,7 +2355,7 @@ }, { "c": "UITapGestureRecognizer alloc", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2322,7 +2366,7 @@ }, { "c": "]", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.end.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.bracket.square.access.c punctuation.definition.end.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2333,7 +2377,7 @@ }, { "c": " initWithTarget:self action:", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2344,7 +2388,7 @@ }, { "c": "@", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.selector.objc storage.type.objc punctuation.definition.storage.type.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.selector.objc storage.type.objc punctuation.definition.storage.type.objc", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -2355,7 +2399,7 @@ }, { "c": "selector", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.selector.objc storage.type.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.selector.objc storage.type.objc", "r": { "dark_plus": "storage.type: #569CD6", "light_plus": "storage.type: #0000FF", @@ -2366,7 +2410,7 @@ }, { "c": "(", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.selector.objc punctuation.definition.storage.type.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.selector.objc punctuation.definition.storage.type.objc", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2377,7 +2421,7 @@ }, { "c": "handleTap:", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.selector.objc meta.selector.method-name.objc support.function.any-method.name-of-parameter.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.selector.objc meta.selector.method-name.objc support.function.any-method.name-of-parameter.objc", "r": { "dark_plus": "support.function: #DCDCAA", "light_plus": "support.function: #795E26", @@ -2388,7 +2432,7 @@ }, { "c": ")", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.selector.objc punctuation.definition.storage.type.objc", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c meta.selector.objc punctuation.definition.storage.type.objc", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2399,7 +2443,7 @@ }, { "c": "]", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.end.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.end.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2498,7 +2542,7 @@ }, { "c": "[", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.begin.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.begin.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2509,7 +2553,7 @@ }, { "c": "NSMutableArray", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c support.class.cocoa", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c support.class.cocoa", "r": { "dark_plus": "support.class: #4EC9B0", "light_plus": "support.class: #267F99", @@ -2520,7 +2564,7 @@ }, { "c": " array", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2531,7 +2575,7 @@ }, { "c": "]", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.end.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.end.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2564,7 +2608,7 @@ }, { "c": "[", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.begin.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.begin.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2575,7 +2619,7 @@ }, { "c": "gestureRecognizers addObject:tapGesture", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2586,7 +2630,7 @@ }, { "c": "]", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.end.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.end.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2619,7 +2663,7 @@ }, { "c": "[", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.begin.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.begin.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2629,8 +2673,8 @@ } }, { - "c": "gestureRecognizers addObjectsFromArray:scnView", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", + "c": "gestureRecognizers addObjectsFromArray:", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2639,20 +2683,31 @@ "hc_black": "default: #FFFFFF" } }, + { + "c": "scnView", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c variable.object.access.c variable.object.c", + "r": { + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "variable: #9CDCFE" + } + }, { "c": ".", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.separator.dot-access.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c variable.object.access.c punctuation.separator.dot-access.c", "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" + "hc_black": "variable: #9CDCFE" } }, { "c": "gestureRecognizers", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c variable.other.member.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c variable.object.access.c variable.other.member.c", "r": { "dark_plus": "variable: #9CDCFE", "light_plus": "variable: #001080", @@ -2663,7 +2718,7 @@ }, { "c": "]", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.definition.end.bracket.square.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c meta.bracket.square.access.c punctuation.definition.end.bracket.square.c", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2684,7 +2739,7 @@ } }, { - "c": " scnView", + "c": " ", "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c", "r": { "dark_plus": "default: #D4D4D4", @@ -2695,19 +2750,30 @@ } }, { - "c": ".", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c punctuation.separator.dot-access.c", + "c": "scnView", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c variable.object.access.c variable.object.c", "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" + "hc_black": "variable: #9CDCFE" + } + }, + { + "c": ".", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c variable.object.access.c punctuation.separator.dot-access.c", + "r": { + "dark_plus": "variable: #9CDCFE", + "light_plus": "variable: #001080", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "variable: #9CDCFE" } }, { "c": "gestureRecognizers", - "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c variable.other.member.c", + "t": "source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.c variable.object.access.c variable.other.member.c", "r": { "dark_plus": "variable: #9CDCFE", "light_plus": "variable: #001080", From 489dfec1e94fcce83f165351f1b0f840d8b60104 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 4 Mar 2019 11:18:23 +0100 Subject: [PATCH 78/90] fix #69141 --- src/vs/code/electron-main/main.ts | 2 +- .../common/instantiationService.ts | 29 +++++++++++++- .../node/instantiationService.ts | 39 ------------------- src/vs/workbench/electron-browser/main.ts | 2 +- 4 files changed, 29 insertions(+), 43 deletions(-) delete mode 100644 src/vs/platform/instantiation/node/instantiationService.ts diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index 49668099824..f89af11d2aa 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -16,7 +16,7 @@ import { LifecycleService, ILifecycleService } from 'vs/platform/lifecycle/elect import { Server, serve, connect } from 'vs/base/parts/ipc/node/ipc.net'; import { LaunchChannelClient } from 'vs/platform/launch/electron-main/launchService'; import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { InstantiationService } from 'vs/platform/instantiation/node/instantiationService'; +import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { ILogService, ConsoleLogMainService, MultiplexLogService, getLogLevel } from 'vs/platform/log/common/log'; diff --git a/src/vs/platform/instantiation/common/instantiationService.ts b/src/vs/platform/instantiation/common/instantiationService.ts index 231666949c4..a0141e4853f 100644 --- a/src/vs/platform/instantiation/common/instantiationService.ts +++ b/src/vs/platform/instantiation/common/instantiationService.ts @@ -9,10 +9,17 @@ import { Graph } from 'vs/platform/instantiation/common/graph'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { ServiceIdentifier, IInstantiationService, ServicesAccessor, _util, optional } from 'vs/platform/instantiation/common/instantiation'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; +import { IdleValue } from 'vs/base/common/async'; // TRACING const _enableTracing = false; +// PROXY +// Ghetto-declare of the global Proxy object. This isn't the proper way +// but allows us to run this code in the browser without IE11. +declare var Proxy: any; +const _canUseProxy = typeof Proxy === 'function'; + export class InstantiationService implements IInstantiationService { _serviceBrand: any; @@ -205,8 +212,26 @@ export class InstantiationService implements IInstantiationService { } } - protected _createServiceInstance(ctor: any, args: any[] = [], _supportsDelayedInstantiation: boolean, _trace: Trace): T { - return this._createInstance(ctor, args, _trace); + private _createServiceInstance(ctor: any, args: any[] = [], _supportsDelayedInstantiation: boolean, _trace: Trace): T { + if (!_supportsDelayedInstantiation || !_canUseProxy) { + // eager instantiation or no support JS proxies (e.g. IE11) + return this._createInstance(ctor, args, _trace); + + } else { + // Return a proxy object that's backed by an idle value. That + // strategy is to instantiate services in our idle time or when actually + // needed but not when injected into a consumer + const idle = new IdleValue(() => this._createInstance(ctor, args, _trace)); + return new Proxy(Object.create(null), { + get(_target: T, prop: PropertyKey): any { + return idle.getValue()[prop]; + }, + set(_target: T, p: PropertyKey, value: any): boolean { + idle.getValue()[p] = value; + return true; + } + }); + } } } diff --git a/src/vs/platform/instantiation/node/instantiationService.ts b/src/vs/platform/instantiation/node/instantiationService.ts deleted file mode 100644 index c888491b365..00000000000 --- a/src/vs/platform/instantiation/node/instantiationService.ts +++ /dev/null @@ -1,39 +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 { IdleValue } from 'vs/base/common/async'; -import { InstantiationService as BaseInstantiationService } from 'vs/platform/instantiation/common/instantiationService'; -import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; - -// this is in the /node/-layer because it depends on Proxy which isn't available -// in IE11 and therefore not in the /common/-layer - -export class InstantiationService extends BaseInstantiationService { - - createChild(services: ServiceCollection): IInstantiationService { - return new InstantiationService(services, this._strict, this); - } - - protected _createServiceInstance(ctor: any, args: any[] = [], supportsDelayedInstantiation: boolean, _trace): T { - if (supportsDelayedInstantiation) { - return InstantiationService._newIdleProxyService(() => super._createServiceInstance(ctor, args, supportsDelayedInstantiation, _trace)); - } else { - return super._createServiceInstance(ctor, args, supportsDelayedInstantiation, _trace); - } - } - - private static _newIdleProxyService(executor: () => T): T { - const idle = new IdleValue(executor); - return new Proxy(Object.create(null), { - get(_target: T, prop: PropertyKey): any { - return idle.getValue()[prop]; - }, - set(_target: T, p: PropertyKey, value: any): boolean { - idle.getValue()[p] = value; - return true; - } - }); - } -} diff --git a/src/vs/workbench/electron-browser/main.ts b/src/vs/workbench/electron-browser/main.ts index 518080ab90d..258e2733a3f 100644 --- a/src/vs/workbench/electron-browser/main.ts +++ b/src/vs/workbench/electron-browser/main.ts @@ -47,7 +47,7 @@ import { GlobalStorageDatabaseChannelClient } from 'vs/platform/storage/node/sto import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IStorageService } from 'vs/platform/storage/common/storage'; -import { InstantiationService } from 'vs/platform/instantiation/node/instantiationService'; +import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; import { Disposable } from 'vs/base/common/lifecycle'; import { registerWindowDriver } from 'vs/platform/driver/electron-browser/driver'; From a731d2e28887c3df4763510400dcd6c2952dcb0e Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 4 Mar 2019 11:31:50 +0100 Subject: [PATCH 79/90] debt - move more services to use registerSingleton() --- .../workbench/electron-browser/workbench.ts | 31 +------------------ .../configuration/node/jsonEditingService.ts | 3 ++ .../dialogs/electron-browser/dialogService.ts | 6 +++- .../preferences/browser/preferencesService.ts | 3 ++ .../textfile/common/textFileService.ts | 3 ++ .../common/textModelResolverService.ts | 3 ++ src/vs/workbench/workbench.main.ts | 5 +++ 7 files changed, 23 insertions(+), 31 deletions(-) diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index 7aaab4a467a..4267b0ceed9 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -38,7 +38,6 @@ import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/ import { IStorageService, StorageScope, IWillSaveStateEvent, WillSaveStateReason } from 'vs/platform/storage/common/storage'; import { ContextMenuService as HTMLContextMenuService } from 'vs/platform/contextview/browser/contextMenuService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IJSONEditingService } from 'vs/workbench/services/configuration/common/jsonEditing'; import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; @@ -51,10 +50,6 @@ import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen'; import { IHistoryService } from 'vs/workbench/services/history/common/history'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; -import { TextFileService } from 'vs/workbench/services/textfile/common/textFileService'; -import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; -import { TextModelResolverService } from 'vs/workbench/services/textmodelResolver/common/textModelResolverService'; -import { ITextModelService } from 'vs/editor/common/services/resolverService'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { LifecyclePhase, StartupKind, ILifecycleService, WillShutdownEvent } from 'vs/platform/lifecycle/common/lifecycle'; import { IWindowService, IWindowConfiguration, IPath, MenuBarVisibility, getTitleBarStyle, IWindowsService } from 'vs/platform/windows/common/windows'; @@ -71,14 +66,11 @@ import { NotificationsAlerts } from 'vs/workbench/browser/parts/notifications/no import { NotificationsStatus } from 'vs/workbench/browser/parts/notifications/notificationsStatus'; import { registerNotificationCommands } from 'vs/workbench/browser/parts/notifications/notificationsCommands'; import { NotificationsToasts } from 'vs/workbench/browser/parts/notifications/notificationsToasts'; -import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences'; -import { PreferencesService } from 'vs/workbench/services/preferences/browser/preferencesService'; import { IEditorService, IResourceEditor } from 'vs/workbench/services/editor/common/editorService'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { EditorService } from 'vs/workbench/services/editor/browser/editorService'; import { ContextViewService } from 'vs/platform/contextview/browser/contextViewService'; import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService'; -import { IFileDialogService, IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { Sizing, Direction, Grid, View } from 'vs/base/browser/ui/grid/grid'; import { IEditor } from 'vs/editor/common/editorCommon'; import { WorkbenchLayout } from 'vs/workbench/browser/layout'; @@ -116,7 +108,6 @@ import { WorkbenchContextKeysHandler } from 'vs/workbench/browser/contextkeys'; // import@node import { BackupFileService, InMemoryBackupFileService } from 'vs/workbench/services/backup/node/backupFileService'; import { WorkspaceService } from 'vs/workbench/services/configuration/node/configurationService'; -import { JSONEditingService } from 'vs/workbench/services/configuration/node/jsonEditingService'; import { getDelayedChannel } from 'vs/base/parts/ipc/node/ipc'; import { connect as connectNet } from 'vs/base/parts/ipc/node/ipc.net'; import { DialogChannel } from 'vs/platform/dialogs/node/dialogIpc'; @@ -140,7 +131,6 @@ import { RemoteFileService } from 'vs/workbench/services/files/node/remoteFileSe import { ContextMenuService as NativeContextMenuService } from 'vs/workbench/services/contextmenu/electron-browser/contextmenuService'; import { WorkbenchKeybindingService } from 'vs/workbench/services/keybinding/electron-browser/keybindingService'; import { LifecycleService } from 'vs/platform/lifecycle/electron-browser/lifecycleService'; -import { DialogService, FileDialogService } from 'vs/workbench/services/dialogs/electron-browser/dialogService'; import { WindowService } from 'vs/platform/windows/electron-browser/windowService'; import { RemoteAuthorityResolverService } from 'vs/platform/remote/electron-browser/remoteAuthorityResolverService'; import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl'; @@ -412,13 +402,9 @@ export class Workbench extends Disposable implements IPartService { serviceCollection.set(ITelemetryService, this.telemetryService); this._register(configurationTelemetry(this.telemetryService, this.configurationService)); - // Dialogs - serviceCollection.set(IDialogService, new SyncDescriptor(DialogService, undefined, true)); - // Lifecycle this.lifecycleService = this.instantiationService.createInstance(LifecycleService); serviceCollection.set(ILifecycleService, this.lifecycleService); - this._register(this.lifecycleService.onWillShutdown(event => this._onWillShutdown.fire(event))); this._register(this.lifecycleService.onShutdown(() => { this._onShutdown.fire(); @@ -456,7 +442,7 @@ export class Workbench extends Disposable implements IPartService { serviceCollection.set(IExtensionEnablementService, new SyncDescriptor(ExtensionEnablementService, undefined, true)); // Extensions - serviceCollection.set(IExtensionService, this.instantiationService.createInstance(ExtensionService)); + serviceCollection.set(IExtensionService, new SyncDescriptor(ExtensionService)); // Theming this.themeService = this.instantiationService.createInstance(WorkbenchThemeService, document.body); @@ -546,9 +532,6 @@ export class Workbench extends Disposable implements IPartService { // History serviceCollection.set(IHistoryService, new SyncDescriptor(HistoryService)); - // File Dialogs - serviceCollection.set(IFileDialogService, new SyncDescriptor(FileDialogService, undefined, true)); - // Backup File Service if (this.configuration.backupPath) { this.backupFileService = this.instantiationService.createInstance(BackupFileService, this.configuration.backupPath); @@ -557,15 +540,6 @@ export class Workbench extends Disposable implements IPartService { } serviceCollection.set(IBackupFileService, this.backupFileService); - // Text File Service - serviceCollection.set(ITextFileService, new SyncDescriptor(TextFileService)); - - // Text Model Resolver Service - serviceCollection.set(ITextModelService, new SyncDescriptor(TextModelResolverService, undefined, true)); - - // JSON Editing - serviceCollection.set(IJSONEditingService, new SyncDescriptor(JSONEditingService, undefined, true)); - // Quick open service (quick open controller) this.quickOpen = this.instantiationService.createInstance(QuickOpenController); serviceCollection.set(IQuickOpenService, this.quickOpen); @@ -574,9 +548,6 @@ export class Workbench extends Disposable implements IPartService { this.quickInput = this.instantiationService.createInstance(QuickInputService); serviceCollection.set(IQuickInputService, this.quickInput); - // PreferencesService - serviceCollection.set(IPreferencesService, new SyncDescriptor(PreferencesService)); - // Contributed services const contributedServices = getServices(); for (let contributedService of contributedServices) { diff --git a/src/vs/workbench/services/configuration/node/jsonEditingService.ts b/src/vs/workbench/services/configuration/node/jsonEditingService.ts index c02b276b524..838bd333dd0 100644 --- a/src/vs/workbench/services/configuration/node/jsonEditingService.ts +++ b/src/vs/workbench/services/configuration/node/jsonEditingService.ts @@ -20,6 +20,7 @@ import { IFileService } from 'vs/platform/files/common/files'; import { ITextModelService, ITextEditorModel } from 'vs/editor/common/services/resolverService'; import { IJSONEditingService, IJSONValue, JSONEditingError, JSONEditingErrorCode } from 'vs/workbench/services/configuration/common/jsonEditing'; import { ITextModel } from 'vs/editor/common/model'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class JSONEditingService implements IJSONEditingService { @@ -131,3 +132,5 @@ export class JSONEditingService implements IJSONEditingService { } } } + +registerSingleton(IJSONEditingService, JSONEditingService, true); \ No newline at end of file diff --git a/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts b/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts index cec0ec1ff07..bf501e161f9 100644 --- a/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts +++ b/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts @@ -22,6 +22,7 @@ import { RemoteFileDialog } from 'vs/workbench/services/dialogs/electron-browser import { WORKSPACE_EXTENSION } from 'vs/platform/workspaces/common/workspaces'; import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; interface IMassagedMessageBoxOptions { @@ -388,4 +389,7 @@ export class FileDialogService implements IFileDialogService { function isUntitledWorkspace(path: URI, environmentService: IEnvironmentService): boolean { return resources.isEqualOrParent(path, environmentService.untitledWorkspacesHome); -} \ No newline at end of file +} + +registerSingleton(IFileDialogService, FileDialogService, true); +registerSingleton(IDialogService, DialogService, true); \ No newline at end of file diff --git a/src/vs/workbench/services/preferences/browser/preferencesService.ts b/src/vs/workbench/services/preferences/browser/preferencesService.ts index 9646b53859d..e5cd0c64ab7 100644 --- a/src/vs/workbench/services/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/services/preferences/browser/preferencesService.ts @@ -36,6 +36,7 @@ import { GroupDirection, IEditorGroup, IEditorGroupsService } from 'vs/workbench import { DEFAULT_SETTINGS_EDITOR_SETTING, FOLDER_SETTINGS_PATH, getSettingsTargetName, IPreferencesEditorModel, IPreferencesService, ISetting, ISettingsEditorOptions, SettingsEditorOptions, USE_SPLIT_JSON_SETTING } from 'vs/workbench/services/preferences/common/preferences'; import { DefaultPreferencesEditorInput, KeybindingsEditorInput, PreferencesEditorInput, SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput'; import { defaultKeybindingsContents, DefaultKeybindingsEditorModel, DefaultSettings, DefaultSettingsEditorModel, Settings2EditorModel, SettingsEditorModel, WorkspaceConfigurationEditorModel, DefaultRawSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; const emptyEditableSettingsContent = '{\n}'; @@ -590,3 +591,5 @@ export class PreferencesService extends Disposable implements IPreferencesServic super.dispose(); } } + +registerSingleton(IPreferencesService, PreferencesService); \ No newline at end of file diff --git a/src/vs/workbench/services/textfile/common/textFileService.ts b/src/vs/workbench/services/textfile/common/textFileService.ts index 5d98f0e093a..6504cd43b20 100644 --- a/src/vs/workbench/services/textfile/common/textFileService.ts +++ b/src/vs/workbench/services/textfile/common/textFileService.ts @@ -37,6 +37,7 @@ import { IModeService } from 'vs/editor/common/services/modeService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { coalesce } from 'vs/base/common/arrays'; import { trim } from 'vs/base/common/strings'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export interface IBackupResult { didBackup: boolean; @@ -978,3 +979,5 @@ export class TextFileService extends Disposable implements ITextFileService { super.dispose(); } } + +registerSingleton(ITextFileService, TextFileService); \ No newline at end of file diff --git a/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts b/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts index 3b011295c08..1c6388a5929 100644 --- a/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts +++ b/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts @@ -16,6 +16,7 @@ import { ITextModelService, ITextModelContentProvider, ITextEditorModel } from ' import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService'; import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel'; import { IFileService } from 'vs/platform/files/common/files'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; class ResourceModelCollection extends ReferenceCollection> { @@ -171,3 +172,5 @@ export class TextModelResolverService implements ITextModelService { return this.resourceModelCollection.hasTextModelContentProvider(scheme); } } + +registerSingleton(ITextModelService, TextModelResolverService, true); \ No newline at end of file diff --git a/src/vs/workbench/workbench.main.ts b/src/vs/workbench/workbench.main.ts index 178d700f976..3320291414a 100644 --- a/src/vs/workbench/workbench.main.ts +++ b/src/vs/workbench/workbench.main.ts @@ -68,6 +68,11 @@ import 'vs/workbench/services/search/node/searchService'; import 'vs/workbench/services/progress/browser/progressService2'; import 'vs/workbench/services/editor/browser/codeEditorService'; import 'vs/workbench/services/broadcast/electron-browser/broadcastService'; +import 'vs/workbench/services/preferences/browser/preferencesService'; +import 'vs/workbench/services/configuration/node/jsonEditingService'; +import 'vs/workbench/services/textmodelResolver/common/textModelResolverService'; +import 'vs/workbench/services/textfile/common/textFileService'; +import 'vs/workbench/services/dialogs/electron-browser/dialogService'; registerSingleton(IMenuService, MenuService, true); registerSingleton(IListService, ListService, true); From 5518580b308017d62f3e95a19a54edb53114eabb Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Mon, 4 Mar 2019 02:42:14 -0800 Subject: [PATCH 80/90] Make list.inactiveFocusBackground null by default (#69673) --- src/vs/platform/theme/common/colorRegistry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/platform/theme/common/colorRegistry.ts b/src/vs/platform/theme/common/colorRegistry.ts index 0f0914915ba..6a74d3719ec 100644 --- a/src/vs/platform/theme/common/colorRegistry.ts +++ b/src/vs/platform/theme/common/colorRegistry.ts @@ -227,7 +227,7 @@ export const listActiveSelectionBackground = registerColor('list.activeSelection export const listActiveSelectionForeground = registerColor('list.activeSelectionForeground', { dark: Color.white, light: Color.white, hc: null }, nls.localize('listActiveSelectionForeground', "List/Tree foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")); export const listInactiveSelectionBackground = registerColor('list.inactiveSelectionBackground', { dark: '#37373D', light: '#E4E6F1', hc: null }, nls.localize('listInactiveSelectionBackground', "List/Tree background color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")); export const listInactiveSelectionForeground = registerColor('list.inactiveSelectionForeground', { dark: null, light: null, hc: null }, nls.localize('listInactiveSelectionForeground', "List/Tree foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")); -export const listInactiveFocusBackground = registerColor('list.inactiveFocusBackground', { dark: '#313135', light: '#d8dae6', hc: null }, nls.localize('listInactiveFocusBackground', "List/Tree background color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")); +export const listInactiveFocusBackground = registerColor('list.inactiveFocusBackground', { dark: null, light: null, hc: null }, nls.localize('listInactiveFocusBackground', "List/Tree background color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")); export const listHoverBackground = registerColor('list.hoverBackground', { dark: '#2A2D2E', light: '#F0F0F0', hc: null }, nls.localize('listHoverBackground', "List/Tree background when hovering over items using the mouse.")); export const listHoverForeground = registerColor('list.hoverForeground', { dark: null, light: null, hc: null }, nls.localize('listHoverForeground', "List/Tree foreground when hovering over items using the mouse.")); export const listDropBackground = registerColor('list.dropBackground', { dark: listFocusBackground, light: listFocusBackground, hc: null }, nls.localize('listDropBackground', "List/Tree drag and drop background when moving items around using the mouse.")); From 265644d08a061e500fa7cfbb275b5673663277b8 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 4 Mar 2019 11:45:19 +0100 Subject: [PATCH 81/90] debt - use our assert util --- src/vs/workbench/api/node/extHostDocumentsAndEditors.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/api/node/extHostDocumentsAndEditors.ts b/src/vs/workbench/api/node/extHostDocumentsAndEditors.ts index 0455b24ecbf..57868da0161 100644 --- a/src/vs/workbench/api/node/extHostDocumentsAndEditors.ts +++ b/src/vs/workbench/api/node/extHostDocumentsAndEditors.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as assert from 'assert'; +import * as assert from 'vs/base/common/assert'; import { Emitter, Event } from 'vs/base/common/event'; import { dispose } from 'vs/base/common/lifecycle'; import { URI } from 'vs/base/common/uri'; From ca0b1b38b020a63e2b6908da8a21814fe320edd7 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 4 Mar 2019 11:46:34 +0100 Subject: [PATCH 82/90] debt - make target location optional and let service decide --- src/vs/platform/download/common/download.ts | 4 ++-- src/vs/platform/download/node/downloadIpc.ts | 12 +++++++----- src/vs/platform/download/node/downloadService.ts | 11 +++++++---- src/vs/workbench/api/node/apiCommands.ts | 9 ++------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/vs/platform/download/common/download.ts b/src/vs/platform/download/common/download.ts index 9856da753ee..83bd30bdaa5 100644 --- a/src/vs/platform/download/common/download.ts +++ b/src/vs/platform/download/common/download.ts @@ -13,6 +13,6 @@ export interface IDownloadService { _serviceBrand: any; - download(uri: URI, to: string, cancellationToken?: CancellationToken): Promise; + download(uri: URI, to?: string, cancellationToken?: CancellationToken): Promise; -} \ No newline at end of file +} diff --git a/src/vs/platform/download/node/downloadIpc.ts b/src/vs/platform/download/node/downloadIpc.ts index 53144c3f1db..52ca30256fe 100644 --- a/src/vs/platform/download/node/downloadIpc.ts +++ b/src/vs/platform/download/node/downloadIpc.ts @@ -11,6 +11,8 @@ import { Event, Emitter } from 'vs/base/common/event'; import { IDownloadService } from 'vs/platform/download/common/download'; import { mkdirp } from 'vs/base/node/pfs'; import { IURITransformer } from 'vs/base/common/uriIpc'; +import { tmpdir } from 'os'; +import { generateUuid } from 'vs/base/common/uuid'; export type UploadResponse = Buffer | string | undefined; @@ -46,21 +48,21 @@ export class DownloadServiceChannelClient implements IDownloadService { constructor(private channel: IChannel, private getUriTransformer: () => IURITransformer) { } - download(from: URI, to: string): Promise { + download(from: URI, to: string = path.join(tmpdir(), generateUuid())): Promise { from = this.getUriTransformer().transformOutgoingURI(from); const dirName = path.dirname(to); let out: fs.WriteStream; - return new Promise((c, e) => { + return new Promise((c, e) => { return mkdirp(dirName) .then(() => { out = fs.createWriteStream(to); - out.once('close', () => c()); + out.once('close', () => c(to)); out.once('error', e); const uploadStream = this.channel.listen('upload', from); const disposable = uploadStream(result => { if (result === undefined) { disposable.dispose(); - out.end(c); + out.end(() => c(to)); } else if (Buffer.isBuffer(result)) { out.write(result); } else if (typeof result === 'string') { @@ -71,4 +73,4 @@ export class DownloadServiceChannelClient implements IDownloadService { }); }); } -} \ No newline at end of file +} diff --git a/src/vs/platform/download/node/downloadService.ts b/src/vs/platform/download/node/downloadService.ts index c20cbd1a8d5..7822ed2253d 100644 --- a/src/vs/platform/download/node/downloadService.ts +++ b/src/vs/platform/download/node/downloadService.ts @@ -10,6 +10,9 @@ import { copy } from 'vs/base/node/pfs'; import { IRequestService } from 'vs/platform/request/node/request'; import { asText, download } from 'vs/base/node/request'; import { CancellationToken } from 'vs/base/common/cancellation'; +import { join } from 'vs/base/common/path'; +import { tmpdir } from 'os'; +import { generateUuid } from 'vs/base/common/uuid'; export class DownloadService implements IDownloadService { @@ -19,18 +22,18 @@ export class DownloadService implements IDownloadService { @IRequestService private readonly requestService: IRequestService ) { } - download(uri: URI, target: string, cancellationToken: CancellationToken = CancellationToken.None): Promise { + download(uri: URI, target: string = join(tmpdir(), generateUuid()), cancellationToken: CancellationToken = CancellationToken.None): Promise { if (uri.scheme === Schemas.file) { - return copy(uri.fsPath, target); + return copy(uri.fsPath, target).then(() => target); } const options = { type: 'GET', url: uri.toString() }; return this.requestService.request(options, cancellationToken) .then(context => { if (context.res.statusCode === 200) { - return download(target, context); + return download(target, context).then(() => target); } return asText(context) .then(message => Promise.reject(new Error(`Expected 200, got back ${context.res.statusCode} instead.\n\n${message}`))); }); } -} \ No newline at end of file +} diff --git a/src/vs/workbench/api/node/apiCommands.ts b/src/vs/workbench/api/node/apiCommands.ts index f2cc8adc5a6..8f748f3efb6 100644 --- a/src/vs/workbench/api/node/apiCommands.ts +++ b/src/vs/workbench/api/node/apiCommands.ts @@ -3,8 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { tmpdir } from 'os'; -import { join } from 'vs/base/common/path'; import * as vscode from 'vscode'; import { URI } from 'vs/base/common/uri'; import { isMalformedFileUri } from 'vs/base/common/resources'; @@ -17,7 +15,6 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces'; import { IWindowsService } from 'vs/platform/windows/common/windows'; import { IDownloadService } from 'vs/platform/download/common/download'; -import { generateUuid } from 'vs/base/common/uuid'; // ----------------------------------------------------------------- // The following commands are registered on both sides separately. @@ -158,7 +155,5 @@ CommandsRegistry.registerCommand({ CommandsRegistry.registerCommand('_workbench.downloadResource', function (accessor: ServicesAccessor, resource: URI) { const downloadService = accessor.get(IDownloadService); - const location = join(tmpdir(), generateUuid()); - - return downloadService.download(resource, location).then(() => URI.file(location)); -}); \ No newline at end of file + return downloadService.download(resource).then(location => URI.file(location)); +}); From 472a1abbe22fc1895c200d3c55dd63c35ce3eb52 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Mon, 4 Mar 2019 12:06:55 +0100 Subject: [PATCH 83/90] fixes #69667 --- src/vs/workbench/contrib/outline/browser/outlinePanel.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/vs/workbench/contrib/outline/browser/outlinePanel.ts b/src/vs/workbench/contrib/outline/browser/outlinePanel.ts index 0df0b100107..86d3df7c5ea 100644 --- a/src/vs/workbench/contrib/outline/browser/outlinePanel.ts +++ b/src/vs/workbench/contrib/outline/browser/outlinePanel.ts @@ -522,8 +522,6 @@ export class OutlinePanel extends ViewletPanel { await this._tree.setInput(newModel, state); } - this._tree.layout(); - // transfer focus from domNode to the tree if (this._domNode === document.activeElement) { this._tree.domFocus(); From 88c1f67f64d2a29dd323b172e0156c7bf813ad8b Mon Sep 17 00:00:00 2001 From: Christof Marti Date: Mon, 4 Mar 2019 11:09:52 +0000 Subject: [PATCH 84/90] Move watermark to 'browser' (fixes #69117) --- .../watermark/{electron-browser => browser}/watermark.css | 0 .../watermark/{electron-browser => browser}/watermark.ts | 7 ++++--- src/vs/workbench/workbench.main.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) rename src/vs/workbench/contrib/watermark/{electron-browser => browser}/watermark.css (100%) rename src/vs/workbench/contrib/watermark/{electron-browser => browser}/watermark.ts (97%) diff --git a/src/vs/workbench/contrib/watermark/electron-browser/watermark.css b/src/vs/workbench/contrib/watermark/browser/watermark.css similarity index 100% rename from src/vs/workbench/contrib/watermark/electron-browser/watermark.css rename to src/vs/workbench/contrib/watermark/browser/watermark.css diff --git a/src/vs/workbench/contrib/watermark/electron-browser/watermark.ts b/src/vs/workbench/contrib/watermark/browser/watermark.ts similarity index 97% rename from src/vs/workbench/contrib/watermark/electron-browser/watermark.ts rename to src/vs/workbench/contrib/watermark/browser/watermark.ts index 6e7a0f9f557..b82746b3d30 100644 --- a/src/vs/workbench/contrib/watermark/electron-browser/watermark.ts +++ b/src/vs/workbench/contrib/watermark/browser/watermark.ts @@ -15,7 +15,6 @@ import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/ import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { OpenRecentAction } from 'vs/workbench/electron-browser/actions/windowActions'; import { GlobalNewUntitledFileAction } from 'vs/workbench/contrib/files/browser/fileActions'; import { OpenFolderAction, OpenFileFolderAction, OpenFileAction } from 'vs/workbench/browser/actions/workspaceActions'; import { ShowAllCommandsAction } from 'vs/workbench/contrib/quickopen/browser/commandsHandler'; @@ -27,6 +26,7 @@ import { TERMINAL_COMMAND_ID } from 'vs/workbench/contrib/terminal/common/termin import * as dom from 'vs/base/browser/dom'; import { KeybindingLabel } from 'vs/base/browser/ui/keybindingLabel/keybindingLabel'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; +import { CommandsRegistry } from 'vs/platform/commands/common/commands'; const $ = dom.$; @@ -61,7 +61,7 @@ const openFileOrFolderMacOnly: WatermarkEntry = { }; const openRecent: WatermarkEntry = { text: nls.localize('watermark.openRecent', "Open Recent"), - id: OpenRecentAction.ID + id: 'workbench.action.openRecent' }; const newUntitledFile: WatermarkEntry = { text: nls.localize('watermark.newUntitledFile', "New Untitled File"), @@ -157,7 +157,8 @@ export class WatermarkContribution implements IWorkbenchContribution { const box = dom.append(this.watermark, $('.watermark-box')); const folder = this.workbenchState !== WorkbenchState.EMPTY; const selected = folder ? folderEntries : noFolderEntries - .filter(entry => !('mac' in entry) || entry.mac === isMacintosh); + .filter(entry => !('mac' in entry) || entry.mac === isMacintosh) + .filter(entry => !!CommandsRegistry.getCommand(entry.id)); const update = () => { dom.clearNode(box); selected.map(entry => { diff --git a/src/vs/workbench/workbench.main.ts b/src/vs/workbench/workbench.main.ts index 3320291414a..0c3e4e534c6 100644 --- a/src/vs/workbench/workbench.main.ts +++ b/src/vs/workbench/workbench.main.ts @@ -204,7 +204,7 @@ import 'vs/workbench/contrib/themes/browser/themes.contribution'; import 'vs/workbench/contrib/themes/test/electron-browser/themes.test.contribution'; // Watermark -import 'vs/workbench/contrib/watermark/electron-browser/watermark'; +import 'vs/workbench/contrib/watermark/browser/watermark'; // Welcome import 'vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThrough.contribution'; From d2239c2473fda8ae7898f75a453f8a9eb0fdad1d Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 4 Mar 2019 12:21:17 +0100 Subject: [PATCH 85/90] uris without scheme and without strict-parse fallback to the file-scheme, #66802 --- src/vs/base/common/uri.ts | 17 ++++++++++++++++- src/vs/vscode.d.ts | 7 ++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/vs/base/common/uri.ts b/src/vs/base/common/uri.ts index 29524b9d7f0..80941c5c1d3 100644 --- a/src/vs/base/common/uri.ts +++ b/src/vs/base/common/uri.ts @@ -56,6 +56,21 @@ function _validateUri(ret: URI, _strict?: boolean): void { } } +// for a while we allowed uris *without* schemes and this is the migration +// for them, e.g. an uri without scheme and without strict-mode warns and falls +// back to the file-scheme. that should cause the least carnage and still be a +// clear warning +function _schemeFix(scheme: string, _strict: boolean): string { + if (_strict || _throwOnMissingSchema) { + return scheme || _empty; + } + if (!scheme) { + console.trace('BAD uri lacks scheme, falling back to file-scheme.'); + scheme = 'file'; + } + return scheme; +} + // implements a bit of https://tools.ietf.org/html/rfc3986#section-5 function _referenceResolution(scheme: string, path: string): string { @@ -166,7 +181,7 @@ export class URI implements UriComponents { // that creates uri components. // _validateUri(this); } else { - this.scheme = schemeOrData || _empty; + this.scheme = _schemeFix(schemeOrData, _strict); this.authority = authority || _empty; this.path = _referenceResolution(this.scheme, path || _empty); this.query = query || _empty; diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 9305f29a4c3..1b773f2da31 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -1235,11 +1235,16 @@ declare module 'vscode' { * Create an URI from a string, e.g. `http://www.msft.com/some/path`, * `file:///usr/home`, or `scheme:with/path`. * + * *Note* that for a while uris without a `scheme` were accepted. That is not correct + * as all uris should have a scheme. To avoid breakage of existing code the optional + * `strict`-argument has been added. We *strongly* advise to use it, e.g. `Uri.parse('my:uri', true)` + * * @see [Uri.toString](#Uri.toString) * @param value The string value of an Uri. + * @param strict Throw an error when `value` is empty or when no `scheme` can be parsed. * @return A new Uri instance. */ - static parse(value: string): Uri; + static parse(value: string, strict?: boolean): Uri; /** * Create an URI from a file system path. The [scheme](#Uri.scheme) From 64f715b1e9ff96ada348bfd3947231e0305be5cb Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 4 Mar 2019 12:35:11 +0100 Subject: [PATCH 86/90] move registerActions to common/action.ts, #69036 --- src/vs/platform/actions/common/actions.ts | 64 ++++++++++++++++++- .../markers/browser/markers.contribution.ts | 63 +----------------- 2 files changed, 64 insertions(+), 63 deletions(-) diff --git a/src/vs/platform/actions/common/actions.ts b/src/vs/platform/actions/common/actions.ts index ead87925df7..e615685b30b 100644 --- a/src/vs/platform/actions/common/actions.ts +++ b/src/vs/platform/actions/common/actions.ts @@ -6,9 +6,9 @@ import { Action } from 'vs/base/common/actions'; import { SyncDescriptor0, createSyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { IConstructorSignature2, createDecorator } from 'vs/platform/instantiation/common/instantiation'; -import { IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { IKeybindings, KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { ICommandService } from 'vs/platform/commands/common/commands'; +import { ICommandService, ICommandHandler, CommandsRegistry } from 'vs/platform/commands/common/commands'; import { IDisposable } from 'vs/base/common/lifecycle'; import { Event, Emitter } from 'vs/base/common/event'; import { URI, UriComponents } from 'vs/base/common/uri'; @@ -321,3 +321,63 @@ export class SyncActionDescriptor { return this._keybindingWeight; } } + + +export interface IActionDescriptor { + id: string; + handler: ICommandHandler; + + // ICommandUI + title?: ILocalizedString; + category?: string; + f1?: boolean; + + // + menu?: { + menuId: MenuId, + when?: ContextKeyExpr; + group?: string; + }; + + // + keybinding?: { + when?: ContextKeyExpr; + weight?: number; + keys: IKeybindings; + }; +} + + +export function registerAction(desc: IActionDescriptor) { + + const { id, handler, title, category, menu, keybinding } = desc; + + // 1) register as command + CommandsRegistry.registerCommand(id, handler); + + // 2) menus + if (menu && title) { + let command = { id, title, category }; + let { menuId, when, group } = menu; + MenuRegistry.appendMenuItem(menuId, { + command, + when, + group + }); + } + + // 3) keybindings + if (keybinding) { + let { when, weight, keys } = keybinding; + KeybindingsRegistry.registerKeybindingRule({ + id, + when, + weight: weight || 0, + primary: keys.primary, + secondary: keys.secondary, + linux: keys.linux, + mac: keys.mac, + win: keys.win + }); + } +} diff --git a/src/vs/workbench/contrib/markers/browser/markers.contribution.ts b/src/vs/workbench/contrib/markers/browser/markers.contribution.ts index 2176ac7a9ef..5bd59feaed1 100644 --- a/src/vs/workbench/contrib/markers/browser/markers.contribution.ts +++ b/src/vs/workbench/contrib/markers/browser/markers.contribution.ts @@ -4,17 +4,16 @@ *--------------------------------------------------------------------------------------------*/ import 'vs/workbench/contrib/markers/browser/markersFileDecorations'; -import { CommandsRegistry, ICommandHandler } from 'vs/platform/commands/common/commands'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; -import { KeybindingsRegistry, KeybindingWeight, IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { localize } from 'vs/nls'; import { Marker, RelatedInformation } from 'vs/workbench/contrib/markers/browser/markersModel'; import { MarkersPanel } from 'vs/workbench/contrib/markers/browser/markersPanel'; -import { MenuId, MenuRegistry, SyncActionDescriptor, ILocalizedString } from 'vs/platform/actions/common/actions'; +import { MenuId, MenuRegistry, SyncActionDescriptor, registerAction } from 'vs/platform/actions/common/actions'; import { PanelRegistry, Extensions as PanelExtensions, PanelDescriptor } from 'vs/workbench/browser/panel'; import { Registry } from 'vs/platform/registry/common/platform'; import { ToggleMarkersPanelAction, ShowProblemsPanelAction } from 'vs/workbench/contrib/markers/browser/markersPanelActions'; @@ -246,64 +245,6 @@ function focusProblemsFilter(panelService: IPanelService) { } } -interface IActionDescriptor { - id: string; - handler: ICommandHandler; - - // ICommandUI - title?: ILocalizedString; - category?: string; - f1?: boolean; - - // - menu?: { - menuId: MenuId, - when?: ContextKeyExpr; - group?: string; - }; - - // - keybinding?: { - when?: ContextKeyExpr; - weight?: number; - keys: IKeybindings; - }; -} - -function registerAction(desc: IActionDescriptor) { - - const { id, handler, title, category, menu, keybinding } = desc; - - // 1) register as command - CommandsRegistry.registerCommand(id, handler); - - // 2) menus - let command = { id, title, category }; - if (menu) { - let { menuId, when, group } = menu; - MenuRegistry.appendMenuItem(menuId, { - command, - when, - group - }); - } - - // 3) keybindings - if (keybinding) { - let { when, weight, keys } = keybinding; - KeybindingsRegistry.registerKeybindingRule({ - id, - when, - weight, - primary: keys.primary, - secondary: keys.secondary, - linux: keys.linux, - mac: keys.mac, - win: keys.win - }); - } -} - MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, { group: '4_panels', command: { From fc1c69ccafd62b3e88ec56d13c8815d80c8fb07b Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 4 Mar 2019 12:37:43 +0100 Subject: [PATCH 87/90] strict null trouble --- src/vs/base/common/uri.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/base/common/uri.ts b/src/vs/base/common/uri.ts index 80941c5c1d3..8fbecabfd80 100644 --- a/src/vs/base/common/uri.ts +++ b/src/vs/base/common/uri.ts @@ -169,7 +169,7 @@ export class URI implements UriComponents { /** * @internal */ - protected constructor(schemeOrData: string | UriComponents, authority?: string, path?: string, query?: string, fragment?: string, _strict?: boolean) { + protected constructor(schemeOrData: string | UriComponents, authority?: string, path?: string, query?: string, fragment?: string, _strict: boolean = false) { if (typeof schemeOrData === 'object') { this.scheme = schemeOrData.scheme || _empty; From 61d7bc4b265e64d3b2129bc104d940df21f7b148 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 4 Mar 2019 12:40:01 +0100 Subject: [PATCH 88/90] adopt shared registerAction-function, #69036 --- .../electron-browser/output.contribution.ts | 68 +------------------ 1 file changed, 1 insertion(+), 67 deletions(-) diff --git a/src/vs/workbench/contrib/output/electron-browser/output.contribution.ts b/src/vs/workbench/contrib/output/electron-browser/output.contribution.ts index d759e524208..e217ba7ab9e 100644 --- a/src/vs/workbench/contrib/output/electron-browser/output.contribution.ts +++ b/src/vs/workbench/contrib/output/electron-browser/output.contribution.ts @@ -7,16 +7,13 @@ import * as nls from 'vs/nls'; import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes'; import { ModesRegistry } from 'vs/editor/common/modes/modesRegistry'; import { Registry } from 'vs/platform/registry/common/platform'; -import { MenuId, MenuRegistry, SyncActionDescriptor, ILocalizedString } from 'vs/platform/actions/common/actions'; -import { KeybindingsRegistry, IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { MenuId, MenuRegistry, SyncActionDescriptor, registerAction } from 'vs/platform/actions/common/actions'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; import { OutputService, LogContentProvider } from 'vs/workbench/contrib/output/electron-browser/outputServices'; import { ToggleOutputAction, ClearOutputAction, OpenLogOutputFile, ShowLogsOutputChannelAction, OpenOutputLogFileAction } from 'vs/workbench/contrib/output/browser/outputActions'; import { OUTPUT_MODE_ID, OUTPUT_MIME, OUTPUT_PANEL_ID, IOutputService, CONTEXT_IN_OUTPUT, LOG_SCHEME, LOG_MODE_ID, LOG_MIME, CONTEXT_ACTIVE_LOG_OUTPUT } from 'vs/workbench/contrib/output/common/output'; import { PanelRegistry, Extensions, PanelDescriptor } from 'vs/workbench/browser/panel'; -import { CommandsRegistry, ICommandHandler } from 'vs/platform/commands/common/commands'; -import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { OutputPanel } from 'vs/workbench/contrib/output/browser/outputPanel'; import { IEditorRegistry, Extensions as EditorExtensions, EditorDescriptor } from 'vs/workbench/browser/editor'; import { LogViewer, LogViewerInput } from 'vs/workbench/contrib/output/browser/logViewer'; @@ -93,69 +90,6 @@ const devCategory = nls.localize('developer', "Developer"); actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowLogsOutputChannelAction, ShowLogsOutputChannelAction.ID, ShowLogsOutputChannelAction.LABEL), 'Developer: Show Logs...', devCategory); actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenOutputLogFileAction, OpenOutputLogFileAction.ID, OpenOutputLogFileAction.LABEL), 'Developer: Open Log File...', devCategory); -interface IActionDescriptor { - id: string; - handler: ICommandHandler; - - // ICommandUI - title: ILocalizedString; - category?: string; - f1?: boolean; - - // menus - menu?: { - menuId: MenuId, - when?: ContextKeyExpr; - group?: string; - }; - - // keybindings - keybinding?: { - when?: ContextKeyExpr; - weight: number; - keys: IKeybindings; - }; -} - -function registerAction(desc: IActionDescriptor) { - - const { id, handler, title, category, f1, menu, keybinding } = desc; - - // 1) register as command - CommandsRegistry.registerCommand(id, handler); - - // 2) command palette - let command = { id, title, category }; - if (f1) { - MenuRegistry.addCommand(command); - } - - // 3) menus - if (menu) { - let { menuId, when, group } = menu; - MenuRegistry.appendMenuItem(menuId, { - command, - when, - group - }); - } - - // 4) keybindings - if (keybinding) { - let { when, weight, keys } = keybinding; - KeybindingsRegistry.registerKeybindingRule({ - id, - when, - weight, - primary: keys.primary, - secondary: keys.secondary, - linux: keys.linux, - mac: keys.mac, - win: keys.win - }); - } -} - // Define clear command, contribute to editor context menu registerAction({ id: 'editor.action.clearoutput', From ceb8d830f88e516ff7074127189ef01497b2feb2 Mon Sep 17 00:00:00 2001 From: Christof Marti Date: Mon, 4 Mar 2019 11:42:12 +0000 Subject: [PATCH 89/90] Move welcome page and walkthrough to 'common' and 'browser' (#69116) --- .../{electron-browser => common}/extensionsUtils.ts | 6 ------ .../electron-browser/extensionTipsService.ts | 4 ++-- .../electron-browser/extensions.contribution.ts | 2 +- .../extensions/electron-browser/extensionsViews.ts | 5 +++-- .../vs_code_welcome_page.ts | 0 .../welcomePage.contribution.ts | 2 +- .../page/{electron-browser => browser}/welcomePage.css | 0 .../page/{electron-browser => browser}/welcomePage.ts | 10 +++++----- .../editor/editorWalkThrough.ts | 2 +- .../editor/vs_code_editor_walkthrough.md | 0 .../walkThrough.contribution.ts | 10 +++++----- .../walkThroughActions.ts | 2 +- .../{electron-browser => browser}/walkThroughPart.css | 0 .../{electron-browser => browser}/walkThroughPart.ts | 4 ++-- .../{node => common}/walkThroughContentProvider.ts | 0 .../walkThrough/{node => common}/walkThroughInput.ts | 0 .../walkThrough/{node => common}/walkThroughUtils.ts | 0 .../test/electron-browser/colorRegistry.releaseTest.ts | 4 ++-- src/vs/workbench/workbench.main.ts | 4 ++-- 19 files changed, 25 insertions(+), 30 deletions(-) rename src/vs/workbench/contrib/extensions/{electron-browser => common}/extensionsUtils.ts (96%) rename src/vs/workbench/contrib/welcome/page/{electron-browser => browser}/vs_code_welcome_page.ts (100%) rename src/vs/workbench/contrib/welcome/page/{electron-browser => browser}/welcomePage.contribution.ts (97%) rename src/vs/workbench/contrib/welcome/page/{electron-browser => browser}/welcomePage.css (100%) rename src/vs/workbench/contrib/welcome/page/{electron-browser => browser}/welcomePage.ts (99%) rename src/vs/workbench/contrib/welcome/walkThrough/{electron-browser => browser}/editor/editorWalkThrough.ts (97%) rename src/vs/workbench/contrib/welcome/walkThrough/{electron-browser => browser}/editor/vs_code_editor_walkthrough.md (100%) rename src/vs/workbench/contrib/welcome/walkThrough/{electron-browser => browser}/walkThrough.contribution.ts (91%) rename src/vs/workbench/contrib/welcome/walkThrough/{electron-browser => browser}/walkThroughActions.ts (97%) rename src/vs/workbench/contrib/welcome/walkThrough/{electron-browser => browser}/walkThroughPart.css (100%) rename src/vs/workbench/contrib/welcome/walkThrough/{electron-browser => browser}/walkThroughPart.ts (99%) rename src/vs/workbench/contrib/welcome/walkThrough/{node => common}/walkThroughContentProvider.ts (100%) rename src/vs/workbench/contrib/welcome/walkThrough/{node => common}/walkThroughInput.ts (100%) rename src/vs/workbench/contrib/welcome/walkThrough/{node => common}/walkThroughUtils.ts (100%) diff --git a/src/vs/workbench/contrib/extensions/electron-browser/extensionsUtils.ts b/src/vs/workbench/contrib/extensions/common/extensionsUtils.ts similarity index 96% rename from src/vs/workbench/contrib/extensions/electron-browser/extensionsUtils.ts rename to src/vs/workbench/contrib/extensions/common/extensionsUtils.ts index 0284d7fc7b7..91f521c2d94 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/extensionsUtils.ts +++ b/src/vs/workbench/contrib/extensions/common/extensionsUtils.ts @@ -15,7 +15,6 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { Severity, INotificationService } from 'vs/platform/notification/common/notification'; -import product from 'vs/platform/product/node/product'; export interface IExtensionStatus { identifier: IExtensionIdentifier; @@ -137,8 +136,3 @@ export function isKeymapExtension(tipsService: IExtensionTipsService, extension: const cats = extension.local.manifest.categories; return cats && cats.indexOf('Keymaps') !== -1 || tipsService.getKeymapRecommendations().some(({ extensionId }) => areSameExtensions({ id: extensionId }, extension.local.identifier)); } - -export function getKeywordsForExtension(extension: string): string[] { - const keywords = product.extensionKeywords || {}; - return keywords[extension] || []; -} \ No newline at end of file diff --git a/src/vs/workbench/contrib/extensions/electron-browser/extensionTipsService.ts b/src/vs/workbench/contrib/extensions/electron-browser/extensionTipsService.ts index 5b401acdbcd..df036e95dbc 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/extensionTipsService.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/extensionTipsService.ts @@ -43,7 +43,6 @@ import { URI } from 'vs/base/common/uri'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { IExperimentService, ExperimentActionType, ExperimentState } from 'vs/workbench/contrib/experiments/node/experimentService'; import { CancellationToken } from 'vs/base/common/cancellation'; -import { getKeywordsForExtension } from 'vs/workbench/contrib/extensions/electron-browser/extensionsUtils'; import { ExtensionType } from 'vs/platform/extensions/common/extensions'; import { extname } from 'vs/base/common/resources'; @@ -759,7 +758,8 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe return; } - const keywords = getKeywordsForExtension(fileExtension); + const lookup = product.extensionKeywords || {}; + const keywords = lookup[fileExtension] || []; this._galleryService.query({ text: `tag:"__ext_${fileExtension}" ${keywords.map(tag => `tag:"${tag}"`)}` }).then(pager => { if (!pager || !pager.firstPage || !pager.firstPage.length) { return; 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 fab31c3e8d7..9611f624c74 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/extensions.contribution.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/extensions.contribution.ts @@ -33,7 +33,7 @@ import * as jsonContributionRegistry from 'vs/platform/jsonschemas/common/jsonCo import { ExtensionsConfigurationSchema, ExtensionsConfigurationSchemaId } from 'vs/workbench/contrib/extensions/common/extensionsFileTemplate'; import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { KeymapExtensions } from 'vs/workbench/contrib/extensions/electron-browser/extensionsUtils'; +import { KeymapExtensions } from 'vs/workbench/contrib/extensions/common/extensionsUtils'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { GalleryExtensionsHandler, ExtensionsHandler } from 'vs/workbench/contrib/extensions/browser/extensionsQuickOpen'; import { EditorDescriptor, IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/browser/editor'; diff --git a/src/vs/workbench/contrib/extensions/electron-browser/extensionsViews.ts b/src/vs/workbench/contrib/extensions/electron-browser/extensionsViews.ts index 4d6d70c410e..51177b7ca33 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/extensionsViews.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/extensionsViews.ts @@ -40,10 +40,10 @@ import { alert } from 'vs/base/browser/ui/aria/aria'; import { IListContextMenuEvent } from 'vs/base/browser/ui/list/list'; import { createErrorWithActions } from 'vs/base/common/errorsWithActions'; import { CancellationToken } from 'vs/base/common/cancellation'; -import { getKeywordsForExtension } from 'vs/workbench/contrib/extensions/electron-browser/extensionsUtils'; import { IAction } from 'vs/base/common/actions'; import { ExtensionType } from 'vs/platform/extensions/common/extensions'; import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService'; +import product from 'vs/platform/product/node/product'; class ExtensionsViewState extends Disposable implements IExtensionsViewState { @@ -366,7 +366,8 @@ export class ExtensionsListView extends ViewletPanel { text = query.value.replace(extensionRegex, (m, ext) => { // Get curated keywords - const keywords = getKeywordsForExtension(ext); + const lookup = product.extensionKeywords || {}; + const keywords = lookup[ext] || []; // Get mode name const modeId = this.modeService.getModeIdByFilepathOrFirstLine(`.${ext}`); diff --git a/src/vs/workbench/contrib/welcome/page/electron-browser/vs_code_welcome_page.ts b/src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts similarity index 100% rename from src/vs/workbench/contrib/welcome/page/electron-browser/vs_code_welcome_page.ts rename to src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts diff --git a/src/vs/workbench/contrib/welcome/page/electron-browser/welcomePage.contribution.ts b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.contribution.ts similarity index 97% rename from src/vs/workbench/contrib/welcome/page/electron-browser/welcomePage.contribution.ts rename to src/vs/workbench/contrib/welcome/page/browser/welcomePage.contribution.ts index 3346ebedbe3..0b8457849d8 100644 --- a/src/vs/workbench/contrib/welcome/page/electron-browser/welcomePage.contribution.ts +++ b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.contribution.ts @@ -6,7 +6,7 @@ import { localize } from 'vs/nls'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { Registry } from 'vs/platform/registry/common/platform'; -import { WelcomePageContribution, WelcomePageAction, WelcomeInputFactory } from 'vs/workbench/contrib/welcome/page/electron-browser/welcomePage'; +import { WelcomePageContribution, WelcomePageAction, WelcomeInputFactory } from 'vs/workbench/contrib/welcome/page/browser/welcomePage'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry'; diff --git a/src/vs/workbench/contrib/welcome/page/electron-browser/welcomePage.css b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.css similarity index 100% rename from src/vs/workbench/contrib/welcome/page/electron-browser/welcomePage.css rename to src/vs/workbench/contrib/welcome/page/browser/welcomePage.css diff --git a/src/vs/workbench/contrib/welcome/page/electron-browser/welcomePage.ts b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts similarity index 99% rename from src/vs/workbench/contrib/welcome/page/electron-browser/welcomePage.ts rename to src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts index cba26a0edd4..3564664a988 100644 --- a/src/vs/workbench/contrib/welcome/page/electron-browser/welcomePage.ts +++ b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts @@ -9,7 +9,7 @@ import * as strings from 'vs/base/common/strings'; import * as path from 'vs/base/common/path'; import { ICommandService } from 'vs/platform/commands/common/commands'; import * as arrays from 'vs/base/common/arrays'; -import { WalkThroughInput } from 'vs/workbench/contrib/welcome/walkThrough/node/walkThroughInput'; +import { WalkThroughInput } from 'vs/workbench/contrib/welcome/walkThrough/common/walkThroughInput'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; @@ -23,15 +23,15 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { Schemas } from 'vs/base/common/network'; import { IBackupFileService } from 'vs/workbench/services/backup/common/backup'; -import { getInstalledExtensions, IExtensionStatus, onExtensionChanged, isKeymapExtension } from 'vs/workbench/contrib/extensions/electron-browser/extensionsUtils'; +import { getInstalledExtensions, IExtensionStatus, onExtensionChanged, isKeymapExtension } from 'vs/workbench/contrib/extensions/common/extensionsUtils'; import { IExtensionEnablementService, IExtensionManagementService, IExtensionGalleryService, IExtensionTipsService, EnablementState, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement'; -import { used } from 'vs/workbench/contrib/welcome/page/electron-browser/vs_code_welcome_page'; +import { used } from 'vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page'; import { ILifecycleService, StartupKind } from 'vs/platform/lifecycle/common/lifecycle'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { tildify, getBaseLabel } from 'vs/base/common/labels'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { registerColor, focusBorder, textLinkForeground, textLinkActiveForeground, foreground, descriptionForeground, contrastBorder, activeContrastBorder } from 'vs/platform/theme/common/colorRegistry'; -import { getExtraColor } from 'vs/workbench/contrib/welcome/walkThrough/node/walkThroughUtils'; +import { getExtraColor } from 'vs/workbench/contrib/welcome/walkThrough/common/walkThroughUtils'; import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions'; import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces'; import { IEditorInputFactory, EditorInput } from 'vs/workbench/common/editor'; @@ -274,7 +274,7 @@ class WelcomePage { const resource = URI.parse(require.toUrl('./vs_code_welcome_page')) .with({ scheme: Schemas.walkThrough, - query: JSON.stringify({ moduleId: 'vs/workbench/contrib/welcome/page/electron-browser/vs_code_welcome_page' }) + query: JSON.stringify({ moduleId: 'vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page' }) }); this.editorInput = this.instantiationService.createInstance(WalkThroughInput, { typeId: welcomeInputTypeId, diff --git a/src/vs/workbench/contrib/welcome/walkThrough/electron-browser/editor/editorWalkThrough.ts b/src/vs/workbench/contrib/welcome/walkThrough/browser/editor/editorWalkThrough.ts similarity index 97% rename from src/vs/workbench/contrib/welcome/walkThrough/electron-browser/editor/editorWalkThrough.ts rename to src/vs/workbench/contrib/welcome/walkThrough/browser/editor/editorWalkThrough.ts index 3d69628cdbe..7a95ffda9e4 100644 --- a/src/vs/workbench/contrib/welcome/walkThrough/electron-browser/editor/editorWalkThrough.ts +++ b/src/vs/workbench/contrib/welcome/walkThrough/browser/editor/editorWalkThrough.ts @@ -8,7 +8,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic import { Action } from 'vs/base/common/actions'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { URI } from 'vs/base/common/uri'; -import { WalkThroughInput, WalkThroughInputOptions } from 'vs/workbench/contrib/welcome/walkThrough/node/walkThroughInput'; +import { WalkThroughInput, WalkThroughInputOptions } from 'vs/workbench/contrib/welcome/walkThrough/common/walkThroughInput'; import { Schemas } from 'vs/base/common/network'; import { IEditorInputFactory, EditorInput } from 'vs/workbench/common/editor'; diff --git a/src/vs/workbench/contrib/welcome/walkThrough/electron-browser/editor/vs_code_editor_walkthrough.md b/src/vs/workbench/contrib/welcome/walkThrough/browser/editor/vs_code_editor_walkthrough.md similarity index 100% rename from src/vs/workbench/contrib/welcome/walkThrough/electron-browser/editor/vs_code_editor_walkthrough.md rename to src/vs/workbench/contrib/welcome/walkThrough/browser/editor/vs_code_editor_walkthrough.md diff --git a/src/vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThrough.contribution.ts b/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThrough.contribution.ts similarity index 91% rename from src/vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThrough.contribution.ts rename to src/vs/workbench/contrib/welcome/walkThrough/browser/walkThrough.contribution.ts index 8d508626bdb..9eed29a774f 100644 --- a/src/vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThrough.contribution.ts +++ b/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThrough.contribution.ts @@ -4,11 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import { localize } from 'vs/nls'; -import { WalkThroughInput } from 'vs/workbench/contrib/welcome/walkThrough/node/walkThroughInput'; -import { WalkThroughPart } from 'vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThroughPart'; -import { WalkThroughArrowUp, WalkThroughArrowDown, WalkThroughPageUp, WalkThroughPageDown } from 'vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThroughActions'; -import { WalkThroughContentProvider, WalkThroughSnippetContentProvider } from 'vs/workbench/contrib/welcome/walkThrough/node/walkThroughContentProvider'; -import { EditorWalkThroughAction, EditorWalkThroughInputFactory } from 'vs/workbench/contrib/welcome/walkThrough/electron-browser/editor/editorWalkThrough'; +import { WalkThroughInput } from 'vs/workbench/contrib/welcome/walkThrough/common/walkThroughInput'; +import { WalkThroughPart } from 'vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart'; +import { WalkThroughArrowUp, WalkThroughArrowDown, WalkThroughPageUp, WalkThroughPageDown } from 'vs/workbench/contrib/welcome/walkThrough/browser/walkThroughActions'; +import { WalkThroughContentProvider, WalkThroughSnippetContentProvider } from 'vs/workbench/contrib/welcome/walkThrough/common/walkThroughContentProvider'; +import { EditorWalkThroughAction, EditorWalkThroughInputFactory } from 'vs/workbench/contrib/welcome/walkThrough/browser/editor/editorWalkThrough'; import { Registry } from 'vs/platform/registry/common/platform'; import { Extensions as EditorInputExtensions, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; diff --git a/src/vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThroughActions.ts b/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughActions.ts similarity index 97% rename from src/vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThroughActions.ts rename to src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughActions.ts index 95ba85eb935..cd4caf83cb7 100644 --- a/src/vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThroughActions.ts +++ b/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughActions.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { WalkThroughPart, WALK_THROUGH_FOCUS } from 'vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThroughPart'; +import { WalkThroughPart, WALK_THROUGH_FOCUS } from 'vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart'; import { ICommandAndKeybindingRule, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; diff --git a/src/vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThroughPart.css b/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.css similarity index 100% rename from src/vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThroughPart.css rename to src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.css diff --git a/src/vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThroughPart.ts b/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.ts similarity index 99% rename from src/vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThroughPart.ts rename to src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.ts index 4840870a992..a51b73abb56 100644 --- a/src/vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThroughPart.ts +++ b/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.ts @@ -12,7 +12,7 @@ import { IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle'; import { EditorOptions, IEditorMemento } from 'vs/workbench/common/editor'; import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { WalkThroughInput } from 'vs/workbench/contrib/welcome/walkThrough/node/walkThroughInput'; +import { WalkThroughInput } from 'vs/workbench/contrib/welcome/walkThrough/common/walkThroughInput'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import * as marked from 'vs/base/common/marked/marked'; import { IModelService } from 'vs/editor/common/services/modelService'; @@ -29,7 +29,7 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { registerColor, focusBorder, textLinkForeground, textLinkActiveForeground, textPreformatForeground, contrastBorder, textBlockQuoteBackground, textBlockQuoteBorder } from 'vs/platform/theme/common/colorRegistry'; -import { getExtraColor } from 'vs/workbench/contrib/welcome/walkThrough/node/walkThroughUtils'; +import { getExtraColor } from 'vs/workbench/contrib/welcome/walkThrough/common/walkThroughUtils'; import { UILabelProvider } from 'vs/base/common/keybindingLabels'; import { OS, OperatingSystem } from 'vs/base/common/platform'; import { deepClone } from 'vs/base/common/objects'; diff --git a/src/vs/workbench/contrib/welcome/walkThrough/node/walkThroughContentProvider.ts b/src/vs/workbench/contrib/welcome/walkThrough/common/walkThroughContentProvider.ts similarity index 100% rename from src/vs/workbench/contrib/welcome/walkThrough/node/walkThroughContentProvider.ts rename to src/vs/workbench/contrib/welcome/walkThrough/common/walkThroughContentProvider.ts diff --git a/src/vs/workbench/contrib/welcome/walkThrough/node/walkThroughInput.ts b/src/vs/workbench/contrib/welcome/walkThrough/common/walkThroughInput.ts similarity index 100% rename from src/vs/workbench/contrib/welcome/walkThrough/node/walkThroughInput.ts rename to src/vs/workbench/contrib/welcome/walkThrough/common/walkThroughInput.ts diff --git a/src/vs/workbench/contrib/welcome/walkThrough/node/walkThroughUtils.ts b/src/vs/workbench/contrib/welcome/walkThrough/common/walkThroughUtils.ts similarity index 100% rename from src/vs/workbench/contrib/welcome/walkThrough/node/walkThroughUtils.ts rename to src/vs/workbench/contrib/welcome/walkThrough/common/walkThroughUtils.ts diff --git a/src/vs/workbench/test/electron-browser/colorRegistry.releaseTest.ts b/src/vs/workbench/test/electron-browser/colorRegistry.releaseTest.ts index 32f092e1c11..096e70ce7d2 100644 --- a/src/vs/workbench/test/electron-browser/colorRegistry.releaseTest.ts +++ b/src/vs/workbench/test/electron-browser/colorRegistry.releaseTest.ts @@ -10,8 +10,8 @@ import { overviewRulerModifiedForeground } from 'vs/workbench/contrib/scm/electr import { STATUS_BAR_DEBUGGING_BACKGROUND } from 'vs/workbench/contrib/debug/browser/statusbarColorProvider'; import { debugExceptionWidgetBackground } from 'vs/workbench/contrib/debug/browser/exceptionWidget'; import { debugToolBarBackground } from 'vs/workbench/contrib/debug/browser/debugToolbar'; -import { buttonBackground } from 'vs/workbench/contrib/welcome/page/electron-browser/welcomePage'; -import { embeddedEditorBackground } from 'vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThroughPart'; +import { buttonBackground } from 'vs/workbench/contrib/welcome/page/browser/welcomePage'; +import { embeddedEditorBackground } from 'vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart'; import { request, asText } from 'vs/base/node/request'; import * as pfs from 'vs/base/node/pfs'; import * as path from 'vs/base/common/path'; diff --git a/src/vs/workbench/workbench.main.ts b/src/vs/workbench/workbench.main.ts index 0c3e4e534c6..7fc0c7748e1 100644 --- a/src/vs/workbench/workbench.main.ts +++ b/src/vs/workbench/workbench.main.ts @@ -207,10 +207,10 @@ import 'vs/workbench/contrib/themes/test/electron-browser/themes.test.contributi import 'vs/workbench/contrib/watermark/browser/watermark'; // Welcome -import 'vs/workbench/contrib/welcome/walkThrough/electron-browser/walkThrough.contribution'; +import 'vs/workbench/contrib/welcome/walkThrough/browser/walkThrough.contribution'; import 'vs/workbench/contrib/welcome/gettingStarted/electron-browser/gettingStarted.contribution'; import 'vs/workbench/contrib/welcome/overlay/browser/welcomeOverlay'; -import 'vs/workbench/contrib/welcome/page/electron-browser/welcomePage.contribution'; +import 'vs/workbench/contrib/welcome/page/browser/welcomePage.contribution'; // Outline import 'vs/workbench/contrib/outline/browser/outline.contribution'; From 4c593835a103ce0584e5d65738495a40059bcfd2 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 4 Mar 2019 12:54:02 +0100 Subject: [PATCH 90/90] fix compile error --- extensions/git/src/decorationProvider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/git/src/decorationProvider.ts b/extensions/git/src/decorationProvider.ts index 0c27365bc51..97a6a41997f 100644 --- a/extensions/git/src/decorationProvider.ts +++ b/extensions/git/src/decorationProvider.ts @@ -119,7 +119,7 @@ class GitDecorationProvider implements DecorationProvider { const uris = new Set([...this.decorations.keys()].concat([...newDecorations.keys()])); this.decorations = newDecorations; - this._onDidChangeDecorations.fire([...uris.values()].map(Uri.parse)); + this._onDidChangeDecorations.fire([...uris.values()].map(value => Uri.parse(value, true))); } private collectDecorationData(group: GitResourceGroup, bucket: Map): void {