From 4d688fe6e33155e75f5e4e2c2414629a89605219 Mon Sep 17 00:00:00 2001 From: Nilesh Date: Tue, 3 Jul 2018 21:59:01 +0530 Subject: [PATCH 01/93] New new setting Added workbench.settings.openDefaultKeybindings setting --- src/vs/workbench/electron-browser/main.contribution.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index 6518e436b43..1b88775c87b 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -259,6 +259,11 @@ configurationRegistry.registerConfiguration({ 'description': nls.localize('openDefaultSettings', "Controls if opening settings also opens an editor showing all default settings."), 'default': true }, + 'workbench.settings.openDefaultKeybindings': { + 'type': 'boolean', + 'description': nls.localize('openDefaultKeybindings', "Controls if opening keybinding settings also opens an editor showing all default keybindings."), + 'default': true + }, 'workbench.sideBar.location': { 'type': 'string', 'enum': ['left', 'right'], From 73025ec465a2fb55a73117b0b1cafc0000de7054 Mon Sep 17 00:00:00 2001 From: Nilesh Date: Wed, 4 Jul 2018 01:20:36 +0530 Subject: [PATCH 02/93] Added new Actions --- .../preferences/browser/preferencesActions.ts | 36 +++++++++++++++++++ .../preferences.contribution.ts | 4 ++- .../preferences/browser/preferencesService.ts | 36 +++++++++++++++---- .../preferences/common/preferences.ts | 2 ++ 4 files changed, 70 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/parts/preferences/browser/preferencesActions.ts b/src/vs/workbench/parts/preferences/browser/preferencesActions.ts index 4c19890f0f3..f976de2927c 100644 --- a/src/vs/workbench/parts/preferences/browser/preferencesActions.ts +++ b/src/vs/workbench/parts/preferences/browser/preferencesActions.ts @@ -125,6 +125,42 @@ export class OpenGlobalKeybindingsFileAction extends Action { } } +export class OpenRawDefaultKeybindingsAction extends Action { + + public static readonly ID = 'workbench.action.openRawDefaultKeybindings'; + public static readonly LABEL = nls.localize('openRawDefaultKeybindings', "Open Default Keyboard Shortcuts File"); + + constructor( + id: string, + label: string, + @IPreferencesService private preferencesService: IPreferencesService + ) { + super(id, label); + } + + public run(event?: any): TPromise { + return this.preferencesService.openRawDefaultKeybindings(); + } +} + +export class OpenRawUserKeybindingsAction extends Action { + + public static readonly ID = 'workbench.action.openRawUserKeybindings'; + public static readonly LABEL = nls.localize('openRawUserKeybindings', "Open User Keyboard Shortcuts File"); + + constructor( + id: string, + label: string, + @IPreferencesService private preferencesService: IPreferencesService + ) { + super(id, label); + } + + public run(event?: any): TPromise { + return this.preferencesService.openRawUserKeybindings(); + } +} + export class OpenWorkspaceSettingsAction extends Action { public static readonly ID = 'workbench.action.openWorkspaceSettings'; diff --git a/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts b/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts index a38ea158de6..d046efb6896 100644 --- a/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts +++ b/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts @@ -19,7 +19,7 @@ import { PreferencesEditor } from 'vs/workbench/parts/preferences/browser/prefer import { SettingsEditor2 } from 'vs/workbench/parts/preferences/browser/settingsEditor2'; import { DefaultPreferencesEditorInput, PreferencesEditorInput, KeybindingsEditorInput, SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput'; import { KeybindingsEditor } from 'vs/workbench/parts/preferences/browser/keybindingsEditor'; -import { OpenRawDefaultSettingsAction, OpenSettingsAction, OpenGlobalSettingsAction, OpenGlobalKeybindingsFileAction, OpenWorkspaceSettingsAction, OpenFolderSettingsAction, ConfigureLanguageBasedSettingsAction, OPEN_FOLDER_SETTINGS_COMMAND, OpenGlobalKeybindingsAction, OpenSettings2Action } from 'vs/workbench/parts/preferences/browser/preferencesActions'; +import { OpenRawDefaultKeybindingsAction, OpenRawUserKeybindingsAction, OpenRawDefaultSettingsAction, OpenSettingsAction, OpenGlobalSettingsAction, OpenGlobalKeybindingsFileAction, OpenWorkspaceSettingsAction, OpenFolderSettingsAction, ConfigureLanguageBasedSettingsAction, OPEN_FOLDER_SETTINGS_COMMAND, OpenGlobalKeybindingsAction, OpenSettings2Action } from 'vs/workbench/parts/preferences/browser/preferencesActions'; import { IKeybindingsEditor, IPreferencesSearchService, CONTEXT_KEYBINDING_FOCUS, CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDINGS_SEARCH_FOCUS, KEYBINDINGS_EDITOR_COMMAND_DEFINE, KEYBINDINGS_EDITOR_COMMAND_REMOVE, KEYBINDINGS_EDITOR_COMMAND_SEARCH, KEYBINDINGS_EDITOR_COMMAND_COPY, KEYBINDINGS_EDITOR_COMMAND_RESET, KEYBINDINGS_EDITOR_COMMAND_COPY_COMMAND, KEYBINDINGS_EDITOR_COMMAND_SHOW_SIMILAR, KEYBINDINGS_EDITOR_COMMAND_FOCUS_KEYBINDINGS, KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, SETTINGS_EDITOR_COMMAND_SEARCH, CONTEXT_SETTINGS_EDITOR, SETTINGS_EDITOR_COMMAND_FOCUS_FILE, CONTEXT_SETTINGS_SEARCH_FOCUS, SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, SETTINGS_EDITOR_COMMAND_FOCUS_NEXT_SETTING, SETTINGS_EDITOR_COMMAND_FOCUS_PREVIOUS_SETTING, SETTINGS_EDITOR_COMMAND_EDIT_FOCUSED_SETTING, SETTINGS_EDITOR_COMMAND_FOCUS_SEARCH_FROM_SETTINGS, SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_FROM_SEARCH, CONTEXT_SETTINGS_FIRST_ROW_FOCUS, CONTEXT_SETTINGS_ROW_FOCUS, CONTEXT_TOC_ROW_FOCUS, SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_LIST @@ -195,6 +195,8 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettingsAction, Op registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettings2Action, OpenSettings2Action.ID, OpenSettings2Action.LABEL), 'Preferences: Open Settings (Preview)', category); registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalSettingsAction, OpenGlobalSettingsAction.ID, OpenGlobalSettingsAction.LABEL), 'Preferences: Open User Settings', category); registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalKeybindingsAction, OpenGlobalKeybindingsAction.ID, OpenGlobalKeybindingsAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_S) }), 'Preferences: Open Keyboard Shortcuts', category); +registry.registerWorkbenchAction(new SyncActionDescriptor(OpenRawDefaultKeybindingsAction, OpenRawDefaultKeybindingsAction.ID, OpenRawDefaultKeybindingsAction.LABEL), 'Preferences: Open Raw Default Settings', category); +registry.registerWorkbenchAction(new SyncActionDescriptor(OpenRawUserKeybindingsAction, OpenRawUserKeybindingsAction.ID, OpenRawUserKeybindingsAction.LABEL), 'Preferences: Open Raw Default Settings', category); registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalKeybindingsFileAction, OpenGlobalKeybindingsFileAction.ID, OpenGlobalKeybindingsFileAction.LABEL, { primary: null }), 'Preferences: Open Keyboard Shortcuts File', category); registry.registerWorkbenchAction(new SyncActionDescriptor(ConfigureLanguageBasedSettingsAction, ConfigureLanguageBasedSettingsAction.ID, ConfigureLanguageBasedSettingsAction.LABEL), 'Preferences: Configure Language Specific Settings...', category); diff --git a/src/vs/workbench/services/preferences/browser/preferencesService.ts b/src/vs/workbench/services/preferences/browser/preferencesService.ts index f963de4c85d..e2ddd17755c 100644 --- a/src/vs/workbench/services/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/services/preferences/browser/preferencesService.ts @@ -91,6 +91,10 @@ export class PreferencesService extends Disposable implements IPreferencesServic return this.getEditableSettingsURI(ConfigurationTarget.USER); } + get userKeybindingsResource(): URI { + return this.getEditableSettingsURI(ConfigurationTarget.USER); + } + get workspaceSettingsResource(): URI { return this.getEditableSettingsURI(ConfigurationTarget.WORKSPACE); } @@ -217,25 +221,43 @@ export class PreferencesService extends Disposable implements IPreferencesServic "textual" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true } } */ + const openDefaultKeybindings = !!this.configurationService.getValue('workbench.settings.openDefaultKeybindings'); this.telemetryService.publicLog('openKeybindings', { textual }); if (textual) { const emptyContents = '// ' + nls.localize('emptyKeybindingsHeader', "Place your key bindings in this file to overwrite the defaults") + '\n[\n]'; const editableKeybindings = URI.file(this.environmentService.appKeybindingsPath); // Create as needed and open in editor - return this.createIfNotExists(editableKeybindings, emptyContents).then(() => { - const activeEditorGroup = this.editorGroupService.activeGroup; - const sideEditorGroup = this.editorGroupService.addGroup(activeEditorGroup.id, GroupDirection.RIGHT); + if (openDefaultKeybindings) { + return this.createIfNotExists(editableKeybindings, emptyContents).then(() => { + const activeEditorGroup = this.editorGroupService.activeGroup; + const sideEditorGroup = this.editorGroupService.addGroup(activeEditorGroup.id, GroupDirection.RIGHT); - return TPromise.join([ - this.editorService.openEditor({ resource: this.defaultKeybindingsResource, options: { pinned: true, preserveFocus: true }, label: nls.localize('defaultKeybindings', "Default Keybindings"), description: '' }), - this.editorService.openEditor({ resource: editableKeybindings, options: { pinned: true } }, sideEditorGroup.id) - ]).then(editors => void 0); + return TPromise.join([ + this.editorService.openEditor({ resource: this.defaultKeybindingsResource, options: { pinned: true, preserveFocus: true }, label: nls.localize('defaultKeybindings', "Default Keybindings"), description: '' }), + this.editorService.openEditor({ resource: editableKeybindings, options: { pinned: true } }, sideEditorGroup.id) + ]).then(editors => void 0); + }); + } + return this.createIfNotExists(editableKeybindings, emptyContents).then(() => { + return this.editorService.openEditor({ resource: editableKeybindings, options: { pinned: true } }).then(editors => void 0); }); } return this.editorService.openEditor(this.instantiationService.createInstance(KeybindingsEditorInput), { pinned: true }).then(() => null); } + openRawDefaultKeybindings(): TPromise { + return this.editorService.openEditor({ resource: this.defaultKeybindingsResource }); + } + + openRawUserKeybindings(): TPromise { + const emptyContents = '// ' + nls.localize('emptyKeybindingsHeader', "Place your key bindings in this file to overwrite the defaults") + '\n[\n]'; + const editableKeybindings = URI.file(this.environmentService.appKeybindingsPath); + return this.createIfNotExists(editableKeybindings, emptyContents).then(() => { + return this.editorService.openEditor({ resource: editableKeybindings, options: { pinned: true } }).then(editors => void 0); + }); + } + configureSettingsForLanguage(language: string): void { this.openGlobalSettings() .then(editor => this.createPreferencesEditorModel(this.userSettingsResource) diff --git a/src/vs/workbench/services/preferences/common/preferences.ts b/src/vs/workbench/services/preferences/common/preferences.ts index 8c649215708..4b1817234cb 100644 --- a/src/vs/workbench/services/preferences/common/preferences.ts +++ b/src/vs/workbench/services/preferences/common/preferences.ts @@ -151,6 +151,8 @@ export interface IPreferencesService { openFolderSettings(folder: URI, options?: IEditorOptions, group?: IEditorGroup): TPromise; switchSettings(target: ConfigurationTarget, resource: URI): TPromise; openGlobalKeybindingSettings(textual: boolean): TPromise; + openRawDefaultKeybindings(): TPromise; + openRawUserKeybindings(): TPromise; configureSettingsForLanguage(language: string): void; } From 1dadf35221e90db843e7f2510efb72a030b5bcb1 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 6 Jul 2018 15:18:58 +0200 Subject: [PATCH 03/93] capture & restore dimensions and background colors of our parts --- .../electron-browser/bootstrap/index.js | 19 ++++++++++-- src/vs/workbench/electron-browser/shell.ts | 31 +++++++++++++++++-- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/electron-browser/bootstrap/index.js b/src/vs/workbench/electron-browser/bootstrap/index.js index 692122631e7..51d96fc815c 100644 --- a/src/vs/workbench/electron-browser/bootstrap/index.js +++ b/src/vs/workbench/electron-browser/bootstrap/index.js @@ -70,8 +70,8 @@ function uriFromPath(_path) { } function readFile(file) { - return new Promise(function(resolve, reject) { - fs.readFile(file, 'utf8', function(err, data) { + return new Promise(function (resolve, reject) { + fs.readFile(file, 'utf8', function (err, data) { if (err) { reject(err); return; @@ -81,6 +81,17 @@ function readFile(file) { }); } +function showPartsSplash(folder) { + const storageKey = `storage://workspace${folder}/_splash_`; + const structure = window.localStorage.getItem(storageKey); + if (structure) { + let splash = document.createElement('div'); + splash.innerHTML = structure; + document.body.appendChild(splash); + window.localStorage.removeItem(storageKey); + } +} + const writeFile = (file, content) => new Promise((c, e) => fs.writeFile(file, content, 'utf8', err => err ? e(err) : c())); function registerListeners(enableDeveloperTools) { @@ -159,6 +170,8 @@ function main() { assign(process.env, configuration.userEnv); perf.importEntries(configuration.perfEntries); + showPartsSplash(configuration.folderPath); + // Get the nls configuration into the process.env as early as possible. var nlsConfig = { availableLanguages: {} }; const config = process.env['VSCODE_NLS_CONFIG']; @@ -171,7 +184,7 @@ function main() { if (nlsConfig._resolvedLanguagePackCoreLocation) { let bundles = Object.create(null); - nlsConfig.loadBundle = function(bundle, language, cb) { + nlsConfig.loadBundle = function (bundle, language, cb) { let result = bundles[bundle]; if (result) { cb(undefined, result); diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index 1096104def6..9dcb12c72d3 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -42,7 +42,7 @@ import { IIntegrityService } from 'vs/platform/integrity/common/integrity'; import { EditorWorkerServiceImpl } from 'vs/editor/common/services/editorWorkerServiceImpl'; import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService'; import { ExtensionService } from 'vs/workbench/services/extensions/electron-browser/extensionService'; -import { IStorageService } from 'vs/platform/storage/common/storage'; +import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; @@ -93,7 +93,7 @@ import { NotificationService } from 'vs/workbench/services/notification/common/n import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { DialogService } from 'vs/workbench/services/dialogs/electron-browser/dialogService'; import { DialogChannel } from 'vs/platform/dialogs/common/dialogIpc'; -import { EventType, addDisposableListener, addClass, getClientArea } from 'vs/base/browser/dom'; +import { EventType, addDisposableListener, addClass, getClientArea, getDomNodePagePosition } from 'vs/base/browser/dom'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import { OpenerService } from 'vs/editor/browser/services/openerService'; import { SearchHistoryService } from 'vs/workbench/services/search/node/searchHistoryService'; @@ -200,6 +200,9 @@ export class WorkbenchShell extends Disposable { // Startup Workbench workbench.startup().done(startupInfos => { + // Remove splash screen + this._removePartsSplash(); + // Set lifecycle phase to `Runnning` so that other contributions can now do something this.lifecycleService.phase = LifecyclePhase.Running; @@ -536,13 +539,37 @@ export class WorkbenchShell extends Disposable { // Keep font info for next startup around saveFontInfo(this.storageService); + this._savePartsSplash(); + // Dispose Workbench if (this.workbench) { this.workbench.dispose(reason); } } + + private _savePartsSplash() { + let html = '
'; + let parts = this.container.querySelectorAll('.part'); + for (let i = 0; i < parts.length; i++) { + let part = parts.item(i) as HTMLElement; + let pos = getDomNodePagePosition(part); + let { backgroundColor } = window.getComputedStyle(part); + + html += `
`; + } + html += '
'; + this.storageService.store('_splash_', html, StorageScope.WORKSPACE); + } + + private _removePartsSplash(): void { + let element = document.getElementById('monaco-parts-splash'); + if (element) { + element.remove(); + } + } } + registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => { // Foreground From bedb3b53ad15a1c9708a6490ed910dcef01f81ba Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 6 Jul 2018 16:08:17 +0200 Subject: [PATCH 04/93] support empty, folder, and workspace case --- .../electron-browser/bootstrap/index.js | 19 ++++++++++++++----- src/vs/workbench/electron-browser/shell.ts | 11 ++++++++++- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/electron-browser/bootstrap/index.js b/src/vs/workbench/electron-browser/bootstrap/index.js index 51d96fc815c..9c75d474a8a 100644 --- a/src/vs/workbench/electron-browser/bootstrap/index.js +++ b/src/vs/workbench/electron-browser/bootstrap/index.js @@ -81,14 +81,23 @@ function readFile(file) { }); } -function showPartsSplash(folder) { - const storageKey = `storage://workspace${folder}/_splash_`; - const structure = window.localStorage.getItem(storageKey); +function showPartsSplash(configuration) { + + let key; + if (configuration.folderPath) { + key = `storage://workspace/${configuration.folderPath.replace(/^\//, '')}/parts-splash`; + } else if (configuration.workspace) { + key = `storage://workspace/root:${configuration.workspace.id}/parts-splash`; + } else { + key = `storage://global/parts-splash`; + } + + let structure = window.localStorage.getItem(key); if (structure) { let splash = document.createElement('div'); splash.innerHTML = structure; document.body.appendChild(splash); - window.localStorage.removeItem(storageKey); + window.localStorage.removeItem(key); } } @@ -170,7 +179,7 @@ function main() { assign(process.env, configuration.userEnv); perf.importEntries(configuration.perfEntries); - showPartsSplash(configuration.folderPath); + showPartsSplash(configuration); // Get the nls configuration into the process.env as early as possible. var nlsConfig = { availableLanguages: {} }; diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index 9dcb12c72d3..af5bae75d64 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -548,6 +548,8 @@ export class WorkbenchShell extends Disposable { } private _savePartsSplash() { + + // capture html-structure let html = '
'; let parts = this.container.querySelectorAll('.part'); for (let i = 0; i < parts.length; i++) { @@ -558,7 +560,14 @@ export class WorkbenchShell extends Disposable { html += `
`; } html += '
'; - this.storageService.store('_splash_', html, StorageScope.WORKSPACE); + + // store per workspace or globally + let state = this.contextService.getWorkbenchState(); + if (state === WorkbenchState.EMPTY) { + this.storageService.store('parts-splash', html, StorageScope.GLOBAL); + } else { + this.storageService.store('parts-splash', html, StorageScope.WORKSPACE); + } } private _removePartsSplash(): void { From af0bb1b9875e8b3de90da4e0a237705f80a33c55 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 6 Jul 2018 16:47:27 +0200 Subject: [PATCH 05/93] special handling for status bar part --- src/vs/workbench/electron-browser/shell.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index af5bae75d64..1273977944a 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -99,6 +99,7 @@ import { OpenerService } from 'vs/editor/browser/services/openerService'; import { SearchHistoryService } from 'vs/workbench/services/search/node/searchHistoryService'; import { MulitExtensionManagementService } from 'vs/platform/extensionManagement/common/multiExtensionManagement'; import { ExtensionManagementServerService } from 'vs/workbench/services/extensions/node/extensionManagementServerService'; +import { Parts } from 'vs/workbench/services/part/common/partService'; /** * Services that we require for the Shell @@ -551,15 +552,21 @@ export class WorkbenchShell extends Disposable { // capture html-structure let html = '
'; - let parts = this.container.querySelectorAll('.part'); - for (let i = 0; i < parts.length; i++) { - let part = parts.item(i) as HTMLElement; - let pos = getDomNodePagePosition(part); - let { backgroundColor } = window.getComputedStyle(part); + let parts = [Parts.ACTIVITYBAR_PART, Parts.EDITOR_PART, Parts.MENUBAR_PART, Parts.PANEL_PART, Parts.SIDEBAR_PART, Parts.STATUSBAR_PART, Parts.TITLEBAR_PART]; + for (const part of parts) { + let container = this.workbench.getContainer(part); + let pos = getDomNodePagePosition(container); + let bg = container.style.backgroundColor || 'inhert'; - html += `
`; + if (part === Parts.STATUSBAR_PART) { + // status bar get special treatment because we want to + // be at the bottom on the page + html += `\n
`; + } else { + html += `\n
`; + } } - html += '
'; + html += '\n'; // store per workspace or globally let state = this.contextService.getWorkbenchState(); From fe0ee2bacfbbcbd9d0ee402c913d29100c85b877 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 6 Jul 2018 17:36:30 +0200 Subject: [PATCH 06/93] select sidebar, activitypart, and statusbar --- .../electron-browser/bootstrap/index.js | 4 ++ src/vs/workbench/electron-browser/shell.ts | 41 +++++++++++++------ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/vs/workbench/electron-browser/bootstrap/index.js b/src/vs/workbench/electron-browser/bootstrap/index.js index 9c75d474a8a..0c9fc1a8b37 100644 --- a/src/vs/workbench/electron-browser/bootstrap/index.js +++ b/src/vs/workbench/electron-browser/bootstrap/index.js @@ -84,12 +84,14 @@ function readFile(file) { function showPartsSplash(configuration) { let key; + let keep = false; if (configuration.folderPath) { key = `storage://workspace/${configuration.folderPath.replace(/^\//, '')}/parts-splash`; } else if (configuration.workspace) { key = `storage://workspace/root:${configuration.workspace.id}/parts-splash`; } else { key = `storage://global/parts-splash`; + keep = true; } let structure = window.localStorage.getItem(key); @@ -97,6 +99,8 @@ function showPartsSplash(configuration) { let splash = document.createElement('div'); splash.innerHTML = structure; document.body.appendChild(splash); + } + if (!keep) { window.localStorage.removeItem(key); } } diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index 1273977944a..a89de640768 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -99,7 +99,7 @@ import { OpenerService } from 'vs/editor/browser/services/openerService'; import { SearchHistoryService } from 'vs/workbench/services/search/node/searchHistoryService'; import { MulitExtensionManagementService } from 'vs/platform/extensionManagement/common/multiExtensionManagement'; import { ExtensionManagementServerService } from 'vs/workbench/services/extensions/node/extensionManagementServerService'; -import { Parts } from 'vs/workbench/services/part/common/partService'; +import { Parts, Position } from 'vs/workbench/services/part/common/partService'; /** * Services that we require for the Shell @@ -552,20 +552,35 @@ export class WorkbenchShell extends Disposable { // capture html-structure let html = '
'; - let parts = [Parts.ACTIVITYBAR_PART, Parts.EDITOR_PART, Parts.MENUBAR_PART, Parts.PANEL_PART, Parts.SIDEBAR_PART, Parts.STATUSBAR_PART, Parts.TITLEBAR_PART]; - for (const part of parts) { - let container = this.workbench.getContainer(part); - let pos = getDomNodePagePosition(container); - let bg = container.style.backgroundColor || 'inhert'; - if (part === Parts.STATUSBAR_PART) { - // status bar get special treatment because we want to - // be at the bottom on the page - html += `\n
`; - } else { - html += `\n
`; - } + // activitybar-part + let left = this.workbench.getSideBarPosition() === Position.LEFT; + let activityPartWidth: number; + { + let part = this.workbench.getContainer(Parts.ACTIVITYBAR_PART); + let pos = getDomNodePagePosition(part); + let bg = part.style.backgroundColor || 'inhert'; + html += `
`; + activityPartWidth = pos.width; } + + // sidebar-part + { + let part = this.workbench.getContainer(Parts.SIDEBAR_PART); + let pos = getDomNodePagePosition(part); + let bg = part.style.backgroundColor || 'inhert'; + html += `
`; + } + + // statusbar-part + { + let part = this.workbench.getContainer(Parts.STATUSBAR_PART); + let pos = getDomNodePagePosition(part); + let bg = part.style.backgroundColor || 'inhert'; + + html += `
`; + } + html += '\n
'; // store per workspace or globally From 93cfe58e5963cbb87aa3761084198bacdb9bb04f Mon Sep 17 00:00:00 2001 From: Nilesh Date: Sat, 7 Jul 2018 21:28:04 +0530 Subject: [PATCH 07/93] keybindingsEditor GUI follows settings now. --- .../parts/preferences/browser/keybindingsEditor.ts | 1 + .../services/preferences/browser/preferencesService.ts | 10 +++++++++- .../preferences/common/preferencesEditorInput.ts | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts b/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts index 4d91fd39cb5..0ac81a6c8ac 100644 --- a/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts +++ b/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts @@ -110,6 +110,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor } setInput(input: KeybindingsEditorInput, options: EditorOptions, token: CancellationToken): Thenable { + this.searchWidget.setValue(input.defaultSearchValue); return super.setInput(input, options, token) .then(() => this.render(options && options.preserveFocus, token)); } diff --git a/src/vs/workbench/services/preferences/browser/preferencesService.ts b/src/vs/workbench/services/preferences/browser/preferencesService.ts index e2ddd17755c..6c4bf2ed9fe 100644 --- a/src/vs/workbench/services/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/services/preferences/browser/preferencesService.ts @@ -243,7 +243,15 @@ export class PreferencesService extends Disposable implements IPreferencesServic return this.editorService.openEditor({ resource: editableKeybindings, options: { pinned: true } }).then(editors => void 0); }); } - return this.editorService.openEditor(this.instantiationService.createInstance(KeybindingsEditorInput), { pinned: true }).then(() => null); + + const keybindingsEditorInput = this.instantiationService.createInstance(KeybindingsEditorInput); + if (openDefaultKeybindings) { + keybindingsEditorInput.setDefaultSearchValue('@source:uesr'); + } else { + keybindingsEditorInput.setDefaultSearchValue(); + } + + return this.editorService.openEditor(keybindingsEditorInput, { pinned: true }).then(() => null); } openRawDefaultKeybindings(): TPromise { diff --git a/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts b/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts index b81ca559188..0faa13eea81 100644 --- a/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts +++ b/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts @@ -56,6 +56,7 @@ export class KeybindingsEditorInput extends EditorInput { public static readonly ID: string = 'workbench.input.keybindings'; public readonly keybindingsModel: KeybindingsEditorModel; + public defaultSearchValue: string; constructor(@IInstantiationService instantiationService: IInstantiationService) { super(); @@ -77,6 +78,10 @@ export class KeybindingsEditorInput extends EditorInput { matches(otherInput: any): boolean { return otherInput instanceof KeybindingsEditorInput; } + + setDefaultSearchValue(defaultSearchValue = ''): void { + this.defaultSearchValue = defaultSearchValue; + } } export class SettingsEditor2Input extends EditorInput { From 2e3fe4bc0697546d9063cdc88835e13d049ea7b2 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 10 Jul 2018 10:24:51 +0200 Subject: [PATCH 08/93] consider title part --- src/vs/workbench/electron-browser/shell.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index a89de640768..d652678bab7 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -553,6 +553,16 @@ export class WorkbenchShell extends Disposable { // capture html-structure let html = '
'; + // title part + let titleHeight: number; + { + let part = this.workbench.getContainer(Parts.TITLEBAR_PART); + let pos = getDomNodePagePosition(part); + let bg = part.style.backgroundColor || 'inhert'; + html += `
`; + titleHeight = pos.height; + } + // activitybar-part let left = this.workbench.getSideBarPosition() === Position.LEFT; let activityPartWidth: number; @@ -560,7 +570,7 @@ export class WorkbenchShell extends Disposable { let part = this.workbench.getContainer(Parts.ACTIVITYBAR_PART); let pos = getDomNodePagePosition(part); let bg = part.style.backgroundColor || 'inhert'; - html += `
`; + html += `
`; activityPartWidth = pos.width; } @@ -569,7 +579,7 @@ export class WorkbenchShell extends Disposable { let part = this.workbench.getContainer(Parts.SIDEBAR_PART); let pos = getDomNodePagePosition(part); let bg = part.style.backgroundColor || 'inhert'; - html += `
`; + html += `
`; } // statusbar-part From d0ec236f1574aff99d0684f1eb385a25ae488e1b Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 13 Jul 2018 12:51:58 +0200 Subject: [PATCH 09/93] hide overflow --- src/vs/workbench/electron-browser/shell.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index 1eebf7f27a6..c842e616681 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -523,7 +523,7 @@ export class WorkbenchShell extends Disposable { private _savePartsSplash() { // capture html-structure - let html = '
'; + let html = '
'; // title part let titleHeight: number; From 7881241762ad9c0b0fd7ec984f5e4dcdc80217aa Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 18 Jul 2018 11:26:44 +0200 Subject: [PATCH 10/93] reliable way of creating workspace key --- package.json | 1 + src/vs/workbench/electron-browser/bootstrap/index.js | 4 +++- yarn.lock | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 659b83a3944..24a1a93a5b3 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "vscode-nsfw": "1.0.17", "vscode-ripgrep": "^1.0.1", "vscode-textmate": "^4.0.1", + "vscode-uri": "1.0.5", "vscode-xterm": "3.6.0-beta3", "yauzl": "^2.9.1" }, diff --git a/src/vs/workbench/electron-browser/bootstrap/index.js b/src/vs/workbench/electron-browser/bootstrap/index.js index 0c9fc1a8b37..fce3512c554 100644 --- a/src/vs/workbench/electron-browser/bootstrap/index.js +++ b/src/vs/workbench/electron-browser/bootstrap/index.js @@ -85,8 +85,10 @@ function showPartsSplash(configuration) { let key; let keep = false; + // this is the logic of StorageService#getWorkspaceKey and StorageService#toStorageKey if (configuration.folderPath) { - key = `storage://workspace/${configuration.folderPath.replace(/^\//, '')}/parts-splash`; + let workspaceKey = require('vscode-uri').default.file(configuration.folderPath).toString().replace('file:///', '').replace(/^\//, ''); + key = `storage://workspace/${workspaceKey}/parts-splash`; } else if (configuration.workspace) { key = `storage://workspace/root:${configuration.workspace.id}/parts-splash`; } else { diff --git a/yarn.lock b/yarn.lock index cb804128177..c652fdd80c5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6256,6 +6256,10 @@ vscode-textmate@^4.0.1: dependencies: oniguruma "^7.0.0" +vscode-uri@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-1.0.5.tgz#3b899a8ef71c37f3054d79bdbdda31c7bf36f20d" + vscode-xterm@3.6.0-beta3: version "3.6.0-beta3" resolved "https://registry.yarnpkg.com/vscode-xterm/-/vscode-xterm-3.6.0-beta3.tgz#fe383ff8df66603088e36c1f9ac987b0de68bd1b" From 8860af0407525fc0092cd1259ee70a88fbf2fb6f Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 18 Jul 2018 12:05:16 +0200 Subject: [PATCH 11/93] fix color for title bar part --- src/vs/workbench/electron-browser/shell.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index c842e616681..3782eebbf63 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -531,7 +531,7 @@ export class WorkbenchShell extends Disposable { let part = this.workbench.getContainer(Parts.TITLEBAR_PART); let pos = getDomNodePagePosition(part); let bg = part.style.backgroundColor || 'inhert'; - html += `
`; + html += `
`; titleHeight = pos.height; } From 8fa044a8b67edc8f531d022e4f5aa3531d46fa54 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 18 Jul 2018 12:36:14 +0200 Subject: [PATCH 12/93] fix scrollbar issue --- src/vs/workbench/electron-browser/shell.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index 3782eebbf63..4275569b95d 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -523,7 +523,7 @@ export class WorkbenchShell extends Disposable { private _savePartsSplash() { // capture html-structure - let html = '
'; + let html = '
'; // title part let titleHeight: number; @@ -542,7 +542,7 @@ export class WorkbenchShell extends Disposable { let part = this.workbench.getContainer(Parts.ACTIVITYBAR_PART); let pos = getDomNodePagePosition(part); let bg = part.style.backgroundColor || 'inhert'; - html += `
`; + html += `
`; activityPartWidth = pos.width; } @@ -551,7 +551,7 @@ export class WorkbenchShell extends Disposable { let part = this.workbench.getContainer(Parts.SIDEBAR_PART); let pos = getDomNodePagePosition(part); let bg = part.style.backgroundColor || 'inhert'; - html += `
`; + html += `
`; } // statusbar-part From ad86b598754dbfbb5970130784a1e4e44dfa84cd Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 18 Jul 2018 16:00:02 +0200 Subject: [PATCH 13/93] move perf-mark for local storage access to index.js --- src/vs/workbench/electron-browser/bootstrap/index.js | 9 +++++++-- src/vs/workbench/electron-browser/main.ts | 3 --- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/electron-browser/bootstrap/index.js b/src/vs/workbench/electron-browser/bootstrap/index.js index fce3512c554..231a22d172e 100644 --- a/src/vs/workbench/electron-browser/bootstrap/index.js +++ b/src/vs/workbench/electron-browser/bootstrap/index.js @@ -96,14 +96,19 @@ function showPartsSplash(configuration) { keep = true; } - let structure = window.localStorage.getItem(key); + // TODO@Ben remove me after a while + perf.mark('willAccessLocalStorage'); + let storage = window.localStorage; + perf.mark('didAccessLocalStorage'); + + let structure = storage.getItem(key); if (structure) { let splash = document.createElement('div'); splash.innerHTML = structure; document.body.appendChild(splash); } if (!keep) { - window.localStorage.removeItem(key); + storage.removeItem(key); } } diff --git a/src/vs/workbench/electron-browser/main.ts b/src/vs/workbench/electron-browser/main.ts index e8b8ff1a771..e9ae397db28 100644 --- a/src/vs/workbench/electron-browser/main.ts +++ b/src/vs/workbench/electron-browser/main.ts @@ -195,10 +195,7 @@ function createStorageService(workspaceService: IWorkspaceContextService, enviro if (disableStorage) { storage = inMemoryLocalStorageInstance; } else { - // TODO@Ben remove me after a while - perf.mark('willAccessLocalStorage'); storage = window.localStorage; - perf.mark('didAccessLocalStorage'); } return new StorageService(storage, storage, workspaceId, secondaryWorkspaceId); From 92e4b2a7d51781bcae55d20f515079b3a3a157fe Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Sun, 22 Jul 2018 21:17:50 -0700 Subject: [PATCH 14/93] Fix #54837 - cancel search and properly get events from A to B --- src/vs/base/parts/ipc/common/ipc.ts | 3 ++- src/vs/base/parts/ipc/node/ipc.cp.ts | 1 + src/vs/workbench/services/search/node/searchService.ts | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/vs/base/parts/ipc/common/ipc.ts b/src/vs/base/parts/ipc/common/ipc.ts index 37555c26b07..67376daaf3d 100644 --- a/src/vs/base/parts/ipc/common/ipc.ts +++ b/src/vs/base/parts/ipc/common/ipc.ts @@ -260,7 +260,8 @@ export class ChannelClient implements IChannelClient, IDisposable { let uninitializedPromise: TPromise | null = null; const emitter = new Emitter({ onFirstListenerAdd: () => { - uninitializedPromise = this.whenInitialized().then(() => { + uninitializedPromise = this.whenInitialized(); + uninitializedPromise.then(() => { uninitializedPromise = null; this.send(request.raw); }); diff --git a/src/vs/base/parts/ipc/node/ipc.cp.ts b/src/vs/base/parts/ipc/node/ipc.cp.ts index 38a8a96f813..3d863aa9e0b 100644 --- a/src/vs/base/parts/ipc/node/ipc.cp.ts +++ b/src/vs/base/parts/ipc/node/ipc.cp.ts @@ -150,6 +150,7 @@ export class Client implements IChannelClient, IDisposable { } this.activeRequests.splice(this.activeRequests.indexOf(listener), 1); + listener.dispose(); if (this.activeRequests.length === 0) { this.disposeDelayer.trigger(() => this.disposeClient()); diff --git a/src/vs/workbench/services/search/node/searchService.ts b/src/vs/workbench/services/search/node/searchService.ts index 7053106bc18..33fad2e2062 100644 --- a/src/vs/workbench/services/search/node/searchService.ts +++ b/src/vs/workbench/services/search/node/searchService.ts @@ -376,9 +376,10 @@ export class DiskSearch implements ISearchResultProvider { } public static collectResultsFromEvent(event: Event): PPromise { + let listener: IDisposable; const promise = new PPromise((c, e, p) => { setTimeout(() => { - const listener = event(ev => { + listener = event(ev => { if (isSerializedSearchComplete(ev)) { if (isSerializedSearchSuccess(ev)) { c(ev); @@ -391,7 +392,7 @@ export class DiskSearch implements ISearchResultProvider { } }); }, 0); - }); + }, () => listener.dispose()); return DiskSearch.collectResults(promise); } From bacfddadd0d29948c5d7fee7db9cfb4f66e6d9d4 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 23 Jul 2018 18:43:26 +0200 Subject: [PATCH 15/93] Implement #47502 --- src/vs/workbench/browser/labels.ts | 1 + .../browser/parts/views/customView.ts | 19 +++++--------- .../browser/parts/views/media/views.css | 25 ++++++++++++------- src/vs/workbench/common/views.ts | 5 ++++ 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/vs/workbench/browser/labels.ts b/src/vs/workbench/browser/labels.ts index 35768b3f5fa..2de5aa211ec 100644 --- a/src/vs/workbench/browser/labels.ts +++ b/src/vs/workbench/browser/labels.ts @@ -183,6 +183,7 @@ export class ResourceLabel extends IconLabel { title: '', italic: this.options && this.options.italic, matches: this.options && this.options.matches, + extraClasses: [] }; const resource = this.label.resource; diff --git a/src/vs/workbench/browser/parts/views/customView.ts b/src/vs/workbench/browser/parts/views/customView.ts index 54306015001..48a034e299e 100644 --- a/src/vs/workbench/browser/parts/views/customView.ts +++ b/src/vs/workbench/browser/parts/views/customView.ts @@ -442,7 +442,6 @@ class TreeDataSource implements IDataSource { } interface ITreeExplorerTemplateData { - label: HTMLElement; resourceLabel: ResourceLabel; icon: HTMLElement; actionBar: ActionBar; @@ -475,37 +474,31 @@ class TreeRenderer implements IRenderer { DOM.addClass(container, 'custom-view-tree-node-item'); const icon = DOM.append(container, DOM.$('.custom-view-tree-node-item-icon')); - const label = DOM.append(container, DOM.$('.custom-view-tree-node-item-label')); const resourceLabel = this.instantiationService.createInstance(ResourceLabel, container, {}); - const actionsContainer = DOM.append(container, DOM.$('.actions')); + DOM.addClass(resourceLabel.element, 'custom-view-tree-node-item-resourceLabel'); + const actionsContainer = DOM.append(resourceLabel.element, DOM.$('.actions')); const actionBar = new ActionBar(actionsContainer, { actionItemProvider: this.actionItemProvider, actionRunner: new MultipleSelectionActionRunner(() => tree.getSelection()) }); - return { label, resourceLabel, icon, actionBar, aligner: new Aligner(container, tree, this.themeService) }; + return { resourceLabel, icon, actionBar, aligner: new Aligner(container, tree, this.themeService) }; } renderElement(tree: ITree, node: ITreeItem, templateId: string, templateData: ITreeExplorerTemplateData): void { const resource = node.resourceUri ? URI.revive(node.resourceUri) : null; const label = node.label ? node.label : resource ? basename(resource.path) : ''; const icon = this.themeService.getTheme().type === LIGHT ? node.icon : node.iconDark; + const title = node.tooltip ? node.tooltip : resource ? void 0 : label; // reset templateData.resourceLabel.clear(); templateData.actionBar.clear(); - templateData.label.textContent = ''; - DOM.removeClass(templateData.label, 'custom-view-tree-node-item-label'); - DOM.removeClass(templateData.resourceLabel.element, 'custom-view-tree-node-item-resourceLabel'); if ((resource || node.themeIcon) && !icon) { - const title = node.tooltip ? node.tooltip : resource ? void 0 : label; - templateData.resourceLabel.setLabel({ name: label, resource: resource ? resource : URI.parse('_icon_resource') }, { fileKind: this.getFileKind(node), title }); - DOM.addClass(templateData.resourceLabel.element, 'custom-view-tree-node-item-resourceLabel'); + templateData.resourceLabel.setLabel({ name: label, resource: resource ? resource : URI.parse('_icon_resource') }, { fileKind: this.getFileKind(node), title, fileDecorations: node.decorations, extraClasses: ['custom-view-tree-node-item-resourceLabel'] }); } else { - templateData.label.textContent = label; - DOM.addClass(templateData.label, 'custom-view-tree-node-item-label'); - templateData.label.title = typeof node.tooltip === 'string' ? node.tooltip : label; + templateData.resourceLabel.setLabel({ name: label }, { title, hideIcon: true, extraClasses: ['custom-view-tree-node-item-resourceLabel'] }); } templateData.icon.style.backgroundImage = icon ? `url('${icon}')` : ''; diff --git a/src/vs/workbench/browser/parts/views/media/views.css b/src/vs/workbench/browser/parts/views/media/views.css index 7d9c1184814..597a1fcc597 100644 --- a/src/vs/workbench/browser/parts/views/media/views.css +++ b/src/vs/workbench/browser/parts/views/media/views.css @@ -58,6 +58,10 @@ display: inline-block; } +.tree-explorer-viewlet-tree-view .monaco-tree .monaco-tree-row { + padding-right: 12px; +} + .tree-explorer-viewlet-tree-view .monaco-tree .monaco-tree-row .custom-view-tree-node-item { display: flex; height: 22px; @@ -68,8 +72,7 @@ flex-wrap: nowrap } -.tree-explorer-viewlet-tree-view .monaco-tree .monaco-tree-row .custom-view-tree-node-item .custom-view-tree-node-item-resourceLabel, -.tree-explorer-viewlet-tree-view .monaco-tree .monaco-tree-row .custom-view-tree-node-item > .custom-view-tree-node-item-label { +.tree-explorer-viewlet-tree-view .monaco-tree .monaco-tree-row .custom-view-tree-node-item .custom-view-tree-node-item-resourceLabel { flex: 1; text-overflow: ellipsis; overflow: hidden; @@ -85,18 +88,22 @@ -webkit-font-smoothing: antialiased; } -.tree-explorer-viewlet-tree-view .monaco-tree .monaco-tree-row .custom-view-tree-node-item > .actions { - display: none; - padding-right: 6px; +.tree-explorer-viewlet-tree-view .monaco-tree .monaco-tree-row .custom-view-tree-node-item > .custom-view-tree-node-item-resourceLabel::after { + padding-right: 0px; } -.tree-explorer-viewlet-tree-view .monaco-tree .monaco-tree-row:hover .custom-view-tree-node-item > .actions, -.tree-explorer-viewlet-tree-view .monaco-tree .monaco-tree-row.selected .custom-view-tree-node-item > .actions, -.tree-explorer-viewlet-tree-view .monaco-tree .monaco-tree-row.focused .custom-view-tree-node-item > .actions { +.tree-explorer-viewlet-tree-view .monaco-tree .monaco-tree-row .custom-view-tree-node-item > .custom-view-tree-node-item-resourceLabel > .actions { + display: none; + flex-grow: 100; +} + +.tree-explorer-viewlet-tree-view .monaco-tree .monaco-tree-row:hover .custom-view-tree-node-item > .custom-view-tree-node-item-resourceLabel > .actions, +.tree-explorer-viewlet-tree-view .monaco-tree .monaco-tree-row.selected .custom-view-tree-node-item > .custom-view-tree-node-item-resourceLabel > .actions, +.tree-explorer-viewlet-tree-view .monaco-tree .monaco-tree-row.focused .custom-view-tree-node-item > .custom-view-tree-node-item-resourceLabel > .actions { display: block; } -.tree-explorer-viewlet-tree-view .monaco-tree .custom-view-tree-node-item > .actions .action-label { +.tree-explorer-viewlet-tree-view .monaco-tree .custom-view-tree-node-item > .custom-view-tree-node-item-resourceLabel > .actions .action-label { width: 16px; height: 100%; background-position: 50% 50%; diff --git a/src/vs/workbench/common/views.ts b/src/vs/workbench/common/views.ts index ba637549b16..0a1bee98c3c 100644 --- a/src/vs/workbench/common/views.ts +++ b/src/vs/workbench/common/views.ts @@ -289,6 +289,11 @@ export interface ITreeItem { children?: ITreeItem[]; + decorations?: { + colors: boolean, + badges: boolean + }; + } export interface ITreeViewDataProvider { From 1e8884e6832b8257e55370390e3bc08c1bc51d09 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 23 Jul 2018 10:30:56 -0700 Subject: [PATCH 16/93] Search - Don't show full paths to workspace folders in search results, to clean it up and match the explorer --- .../parts/search/browser/searchResultsView.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/parts/search/browser/searchResultsView.ts b/src/vs/workbench/parts/search/browser/searchResultsView.ts index dd4b0933013..a401c67d8ac 100644 --- a/src/vs/workbench/parts/search/browser/searchResultsView.ts +++ b/src/vs/workbench/parts/search/browser/searchResultsView.ts @@ -238,11 +238,11 @@ export class SearchRenderer extends Disposable implements IRenderer { private renderFolderMatch(tree: ITree, folderMatch: FolderMatch, templateData: IFolderMatchTemplate): void { if (folderMatch.hasRoot()) { const workspaceFolder = this.contextService.getWorkspaceFolder(folderMatch.resource()); - const fileKind = workspaceFolder && resources.isEqual(workspaceFolder.uri, folderMatch.resource()) ? - FileKind.ROOT_FOLDER : - FileKind.FOLDER; - - templateData.label.setFile(folderMatch.resource(), { fileKind }); + if (workspaceFolder && resources.isEqual(workspaceFolder.uri, folderMatch.resource())) { + templateData.label.setFile(folderMatch.resource(), { fileKind: FileKind.ROOT_FOLDER, hidePath: true }); + } else { + templateData.label.setFile(folderMatch.resource(), { fileKind: FileKind.FOLDER }); + } } else { templateData.label.setValue(nls.localize('searchFolderMatch.other.label', "Other files")); } From a131b356e6616fe15c73963e5a9f9cefe5a52647 Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Mon, 23 Jul 2018 10:32:24 -0700 Subject: [PATCH 17/93] Update badge in panel title --- .../workbench/browser/parts/panel/media/panelpart.css | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/browser/parts/panel/media/panelpart.css b/src/vs/workbench/browser/parts/panel/media/panelpart.css index 0c58440f0d4..cfd1137cf35 100644 --- a/src/vs/workbench/browser/parts/panel/media/panelpart.css +++ b/src/vs/workbench/browser/parts/panel/media/panelpart.css @@ -81,16 +81,19 @@ } .monaco-workbench > .part.panel > .title > .panel-switcher-container > .monaco-action-bar .badge { - margin-left: 4px; + margin-left: 8px; } .monaco-workbench > .part.panel > .title > .panel-switcher-container > .monaco-action-bar .badge .badge-content { - padding: 0.2em 0.5em; + padding: 0.3em 0.5em; border-radius: 1em; font-weight: normal; text-align: center; - display: inline; -} + display: inline-block; + min-width: 1.6em; + line-height: 1em; + box-sizing: border-box; + } /** Actions */ From 2a2a3f6ead8f95144e1d4d701f0dae851af3d971 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 23 Jul 2018 11:04:08 -0700 Subject: [PATCH 18/93] More terminal settings polish Part of #54690 --- .../electron-browser/terminal.contribution.ts | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts index 74c5d15af9b..c727f871a02 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts @@ -75,12 +75,12 @@ configurationRegistry.registerConfiguration({ type: 'object', properties: { 'terminal.integrated.shell.linux': { - description: nls.localize('terminal.integrated.shell.linux', "The path of the shell that the terminal uses on Linux."), + description: nls.localize('terminal.integrated.shell.linux', "The path of the shell that the terminal uses on Linux. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."), type: 'string', default: getTerminalDefaultShellUnixLike() }, 'terminal.integrated.shellArgs.linux': { - description: nls.localize('terminal.integrated.shellArgs.linux', "The command line arguments to use when on the Linux terminal."), + description: nls.localize('terminal.integrated.shellArgs.linux', "The command line arguments to use when on the Linux terminal. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."), type: 'array', items: { type: 'string' @@ -88,12 +88,12 @@ configurationRegistry.registerConfiguration({ default: [] }, 'terminal.integrated.shell.osx': { - description: nls.localize('terminal.integrated.shell.osx', "The path of the shell that the terminal uses on macOS."), + description: nls.localize('terminal.integrated.shell.osx', "The path of the shell that the terminal uses on macOS. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."), type: 'string', default: getTerminalDefaultShellUnixLike() }, 'terminal.integrated.shellArgs.osx': { - description: nls.localize('terminal.integrated.shellArgs.osx', "The command line arguments to use when on the macOS terminal."), + description: nls.localize('terminal.integrated.shellArgs.osx', "The command line arguments to use when on the macOS terminal. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."), type: 'array', items: { type: 'string' @@ -104,12 +104,12 @@ configurationRegistry.registerConfiguration({ default: ['-l'] }, 'terminal.integrated.shell.windows': { - description: nls.localize('terminal.integrated.shell.windows', "The path of the shell that the terminal uses on Windows. When using shells shipped with Windows (cmd, PowerShell or Bash on Ubuntu)."), + description: nls.localize('terminal.integrated.shell.windows', "The path of the shell that the terminal uses on Windows. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."), type: 'string', default: getTerminalDefaultShellWindows() }, 'terminal.integrated.shellArgs.windows': { - description: nls.localize('terminal.integrated.shellArgs.windows', "The command line arguments to use when on the Windows terminal."), + description: nls.localize('terminal.integrated.shellArgs.windows', "The command line arguments to use when on the Windows terminal. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."), type: 'array', items: { type: 'string' @@ -117,22 +117,22 @@ configurationRegistry.registerConfiguration({ default: [] }, 'terminal.integrated.macOptionIsMeta': { - description: nls.localize('terminal.integrated.macOptionIsMeta', "Treat the option key as the meta key in the terminal on macOS."), + description: nls.localize('terminal.integrated.macOptionIsMeta', "Controls whather to treat the option key as the meta key in the terminal on macOS."), type: 'boolean', default: false }, 'terminal.integrated.macOptionClickForcesSelection': { - description: nls.localize('terminal.integrated.macOptionClickForcesSelection', "Whether to force selection when using Option+click on macOS. This will force a regular (line) selection and disallow the use of column selection mode. This enables copying and pasting using the regular terminal selection, for example, when mouse mode is enabled in tmux."), + description: nls.localize('terminal.integrated.macOptionClickForcesSelection', "Controls whether to force selection when using Option+click on macOS. This will force a regular (line) selection and disallow the use of column selection mode. This enables copying and pasting using the regular terminal selection, for example, when mouse mode is enabled in tmux."), type: 'boolean', default: false }, 'terminal.integrated.copyOnSelection': { - description: nls.localize('terminal.integrated.copyOnSelection', "When set, text selected in the terminal will be copied to the clipboard."), + description: nls.localize('terminal.integrated.copyOnSelection', "Controls whether text selected in the terminal will be copied to the clipboard."), type: 'boolean', default: false }, 'terminal.integrated.drawBoldTextInBrightColors': { - description: nls.localize('terminal.integrated.drawBoldTextInBrightColors', "When set, bold text in the terminal will always use the \"bright\" ANSI color variant."), + description: nls.localize('terminal.integrated.drawBoldTextInBrightColors', "Controls whether bold text in the terminal will always use the \"bright\" ANSI color variant."), type: 'boolean', default: true }, @@ -221,12 +221,12 @@ configurationRegistry.registerConfiguration({ default: undefined }, 'terminal.integrated.confirmOnExit': { - description: nls.localize('terminal.integrated.confirmOnExit', "Whether to confirm on exit if there are active terminal sessions."), + description: nls.localize('terminal.integrated.confirmOnExit', "Controls whether to confirm on exit if there are active terminal sessions."), type: 'boolean', default: false }, 'terminal.integrated.enableBell': { - description: nls.localize('terminal.integrated.enableBell', "Whether the terminal bell is enabled or not."), + description: nls.localize('terminal.integrated.enableBell', "Controls whether the terminal bell is enabled."), type: 'boolean', default: false }, @@ -353,12 +353,12 @@ configurationRegistry.registerConfiguration({ default: {} }, 'terminal.integrated.showExitAlert': { - description: nls.localize('terminal.integrated.showExitAlert', "Show alert \"The terminal process terminated with exit code\" when exit code is non-zero."), + description: nls.localize('terminal.integrated.showExitAlert', "Controls whether to show the alert \"The terminal process terminated with exit code\" when exit code is non-zero."), type: 'boolean', default: true }, 'terminal.integrated.experimentalRestore': { - description: nls.localize('terminal.integrated.experimentalRestore', "Whether to restore terminal sessions for the workspace automatically when launching VS Code. This is an experimental setting; it may be buggy and could change or be removed in the future."), + description: nls.localize('terminal.integrated.experimentalRestore', "Controls whether to restore terminal sessions for the workspace automatically when launching VS Code. This is an experimental setting; it may be buggy and could change or be removed in the future."), type: 'boolean', default: false }, From 7050df254708f7887728c2975ef6816507944ddd Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 23 Jul 2018 11:06:02 -0700 Subject: [PATCH 19/93] Fix typo --- .../parts/terminal/electron-browser/terminal.contribution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts index c727f871a02..bca78f3fb2f 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts @@ -117,7 +117,7 @@ configurationRegistry.registerConfiguration({ default: [] }, 'terminal.integrated.macOptionIsMeta': { - description: nls.localize('terminal.integrated.macOptionIsMeta', "Controls whather to treat the option key as the meta key in the terminal on macOS."), + description: nls.localize('terminal.integrated.macOptionIsMeta', "Controls whether to treat the option key as the meta key in the terminal on macOS."), type: 'boolean', default: false }, From 1546e74ce60c72e3cce29a61860527084e971ec4 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 23 Jul 2018 10:52:56 -0700 Subject: [PATCH 20/93] #53887 - remove more PPromise usage --- src/vs/platform/search/common/search.ts | 4 +- .../services/search/node/searchService.ts | 151 +++++++++--------- 2 files changed, 74 insertions(+), 81 deletions(-) diff --git a/src/vs/platform/search/common/search.ts b/src/vs/platform/search/common/search.ts index d2613c57504..cc733b5967f 100644 --- a/src/vs/platform/search/common/search.ts +++ b/src/vs/platform/search/common/search.ts @@ -10,7 +10,7 @@ import { IDisposable } from 'vs/base/common/lifecycle'; import * as objects from 'vs/base/common/objects'; import * as paths from 'vs/base/common/paths'; import uri, { UriComponents } from 'vs/base/common/uri'; -import { PPromise, TPromise } from 'vs/base/common/winjs.base'; +import { TPromise } from 'vs/base/common/winjs.base'; import { IFilesConfiguration } from 'vs/platform/files/common/files'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; @@ -46,7 +46,7 @@ export interface ISearchHistoryService { } export interface ISearchResultProvider { - search(query: ISearchQuery): PPromise; + search(query: ISearchQuery, onProgress: (p: ISearchProgressItem) => void): TPromise; clearCache(cacheKey: string): TPromise; } diff --git a/src/vs/workbench/services/search/node/searchService.ts b/src/vs/workbench/services/search/node/searchService.ts index 33fad2e2062..1015a4e011e 100644 --- a/src/vs/workbench/services/search/node/searchService.ts +++ b/src/vs/workbench/services/search/node/searchService.ts @@ -4,29 +4,29 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import { PPromise, TPromise } from 'vs/base/common/winjs.base'; -import uri from 'vs/base/common/uri'; import * as arrays from 'vs/base/common/arrays'; +import { onUnexpectedError } from 'vs/base/common/errors'; +import { Event } from 'vs/base/common/event'; +import { IDisposable, toDisposable } from 'vs/base/common/lifecycle'; +import { ResourceMap } from 'vs/base/common/map'; +import { Schemas } from 'vs/base/common/network'; import * as objects from 'vs/base/common/objects'; import * as strings from 'vs/base/common/strings'; +import uri from 'vs/base/common/uri'; +import { PPromise, TPromise } from 'vs/base/common/winjs.base'; +import * as pfs from 'vs/base/node/pfs'; import { getNextTickChannel } from 'vs/base/parts/ipc/common/ipc'; import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp'; -import { IProgress, LineMatch, FileMatch, ISearchComplete, ISearchProgressItem, QueryType, IFileMatch, ISearchQuery, IFolderQuery, ISearchConfiguration, ISearchService, pathIncludedInQuery, ISearchResultProvider } from 'vs/platform/search/common/search'; -import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService'; import { IModelService } from 'vs/editor/common/services/modelService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IRawSearch, ISerializedSearchComplete, ISerializedSearchProgressItem, ISerializedFileMatch, IRawSearchService, ITelemetryEvent, isSerializedSearchComplete, isSerializedSearchSuccess, ISerializedSearchSuccess } from './search'; -import { ISearchChannel, SearchChannelClient } from './searchIpc'; -import { IEnvironmentService, IDebugParams } from 'vs/platform/environment/common/environment'; -import { ResourceMap } from 'vs/base/common/map'; -import { IDisposable, toDisposable } from 'vs/base/common/lifecycle'; -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { onUnexpectedError } from 'vs/base/common/errors'; -import { Schemas } from 'vs/base/common/network'; -import * as pfs from 'vs/base/node/pfs'; +import { IDebugParams, IEnvironmentService } from 'vs/platform/environment/common/environment'; import { ILogService } from 'vs/platform/log/common/log'; +import { FileMatch, IFileMatch, IFolderQuery, IProgress, ISearchComplete, ISearchConfiguration, ISearchProgressItem, ISearchQuery, ISearchResultProvider, ISearchService, LineMatch, pathIncludedInQuery, QueryType } from 'vs/platform/search/common/search'; +import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; -import { Event } from 'vs/base/common/event'; +import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService'; +import { IRawSearch, IRawSearchService, ISerializedFileMatch, ISerializedSearchComplete, ISerializedSearchProgressItem, isSerializedSearchComplete, isSerializedSearchSuccess, ITelemetryEvent } from './search'; +import { ISearchChannel, SearchChannelClient } from './searchIpc'; export class SearchService implements ISearchService { public _serviceBrand: any; @@ -105,24 +105,24 @@ export class SearchService implements ISearchService { this.logService.trace('SearchService#search', JSON.stringify(query)); - const startTime = Date.now(); - const searchWithProvider = (provider: ISearchResultProvider) => TPromise.wrap(provider.search(query)).then(e => e, - null, - progress => { - if (progress.resource) { - // Match - if (!localResults.has(progress.resource) && onProgress) { // don't override local results - onProgress(progress); - } - } else if (onProgress) { - // Progress - onProgress(progress); + const onProviderProgress = progress => { + if (progress.resource) { + // Match + if (!localResults.has(progress.resource) && onProgress) { // don't override local results + onProgress(progress); } + } else if (onProgress) { + // Progress + onProgress(progress); + } - if (progress.message) { - this.logService.debug('SearchService#search', progress.message); - } - }); + if (progress.message) { + this.logService.debug('SearchService#search', progress.message); + } + }; + + const startTime = Date.now(); + const searchWithProvider = (provider: ISearchResultProvider) => TPromise.as(provider.search(query, onProviderProgress)); const schemesInQuery = query.folderQueries.map(fq => fq.folder.scheme); const providerActivations = schemesInQuery.map(scheme => this.extensionService.activateByEvent(`onSearch:${scheme}`)); @@ -316,7 +316,7 @@ export class DiskSearch implements ISearchResultProvider { this.raw = new SearchChannelClient(channel); } - public search(query: ISearchQuery): PPromise { + public search(query: ISearchQuery, onProgress?: (p: ISearchProgressItem) => void): TPromise { const folderQueries = query.folderQueries || []; return TPromise.join(folderQueries.map(q => q.folder.scheme === Schemas.file && pfs.exists(q.folder.fsPath))) .then(exists => { @@ -330,7 +330,7 @@ export class DiskSearch implements ISearchResultProvider { event = this.raw.textSearch(rawSearch); } - return DiskSearch.collectResultsFromEvent(event); + return DiskSearch.collectResultsFromEvent(event, onProgress); }); } @@ -375,59 +375,52 @@ export class DiskSearch implements ISearchResultProvider { return rawSearch; } - public static collectResultsFromEvent(event: Event): PPromise { - let listener: IDisposable; - const promise = new PPromise((c, e, p) => { - setTimeout(() => { - listener = event(ev => { - if (isSerializedSearchComplete(ev)) { - if (isSerializedSearchSuccess(ev)) { - c(ev); - } else { - e(ev.error); - } - listener.dispose(); - } else { - p(ev); - } - }); - }, 0); - }, () => listener.dispose()); - - return DiskSearch.collectResults(promise); - } - - public static collectResults(request: PPromise): PPromise { + public static collectResultsFromEvent(event: Event, onProgress?: (p: ISearchProgressItem) => void): TPromise { let result: IFileMatch[] = []; - return new PPromise((c, e, p) => { - request.done((complete) => { - c({ - limitHit: complete.limitHit, - results: result, - stats: complete.stats - }); - }, e, (data) => { - // Matches - if (Array.isArray(data)) { - const fileMatches = data.map(d => this.createFileMatch(d)); - result = result.concat(fileMatches); - fileMatches.forEach(p); - } + let listener: IDisposable; + return new TPromise((c, e) => { + listener = event(ev => { + if (isSerializedSearchComplete(ev)) { + if (isSerializedSearchSuccess(ev)) { + c({ + limitHit: ev.limitHit, + results: result, + stats: ev.stats + }); + } else { + e(ev.error); + } - // Match - else if ((data).path) { - const fileMatch = this.createFileMatch(data); - result.push(fileMatch); - p(fileMatch); - } + listener.dispose(); + } else { + // Matches + if (Array.isArray(ev)) { + const fileMatches = ev.map(d => this.createFileMatch(d)); + result = result.concat(fileMatches); + if (onProgress) { + fileMatches.forEach(onProgress); + } + } - // Progress - else { - p(data); + // Match + else if ((ev).path) { + const fileMatch = this.createFileMatch(ev); + result.push(fileMatch); + + if (onProgress) { + onProgress(fileMatch); + } + } + + // Progress + else if (onProgress) { + onProgress(ev); + } } }); - }, () => request.cancel()); + }, + () => listener && listener.dispose()); } private static createFileMatch(data: ISerializedFileMatch): FileMatch { From b28ea40d727b06017308063eb14c5c9cc3764643 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 23 Jul 2018 11:04:15 -0700 Subject: [PATCH 21/93] Remove more PPromise - #53887 --- src/vs/platform/search/common/search.ts | 2 +- .../api/electron-browser/mainThreadSearch.ts | 6 ++-- .../services/search/node/searchService.ts | 33 +++++++------------ .../search/test/node/searchService.test.ts | 10 +++--- 4 files changed, 21 insertions(+), 30 deletions(-) diff --git a/src/vs/platform/search/common/search.ts b/src/vs/platform/search/common/search.ts index cc733b5967f..7cacfe626a9 100644 --- a/src/vs/platform/search/common/search.ts +++ b/src/vs/platform/search/common/search.ts @@ -46,7 +46,7 @@ export interface ISearchHistoryService { } export interface ISearchResultProvider { - search(query: ISearchQuery, onProgress: (p: ISearchProgressItem) => void): TPromise; + search(query: ISearchQuery, onProgress?: (p: ISearchProgressItem) => void): TPromise; clearCache(cacheKey: string): TPromise; } diff --git a/src/vs/workbench/api/electron-browser/mainThreadSearch.ts b/src/vs/workbench/api/electron-browser/mainThreadSearch.ts index 7e3224c1de2..d2fa937424f 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadSearch.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadSearch.ts @@ -97,7 +97,7 @@ class RemoteSearchProvider implements ISearchResultProvider, IDisposable { dispose(this._registrations); } - search(query: ISearchQuery): PPromise { + search(query: ISearchQuery, onProgress?: (p: ISearchProgressItem) => void): TPromise { if (isFalsyOrEmpty(query.folderQueries)) { return PPromise.as(undefined); @@ -115,9 +115,9 @@ class RemoteSearchProvider implements ISearchResultProvider, IDisposable { let outer: TPromise; - return new PPromise((resolve, reject, report) => { + return new TPromise((resolve, reject) => { - const search = new SearchOperation(report); + const search = new SearchOperation(onProgress); this._searches.set(search.id, search); outer = query.type === QueryType.File diff --git a/src/vs/workbench/services/search/node/searchService.ts b/src/vs/workbench/services/search/node/searchService.ts index 1015a4e011e..dad4ec17770 100644 --- a/src/vs/workbench/services/search/node/searchService.ts +++ b/src/vs/workbench/services/search/node/searchService.ts @@ -5,15 +5,14 @@ 'use strict'; import * as arrays from 'vs/base/common/arrays'; -import { onUnexpectedError } from 'vs/base/common/errors'; import { Event } from 'vs/base/common/event'; -import { IDisposable, toDisposable } from 'vs/base/common/lifecycle'; +import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle'; import { ResourceMap } from 'vs/base/common/map'; import { Schemas } from 'vs/base/common/network'; import * as objects from 'vs/base/common/objects'; import * as strings from 'vs/base/common/strings'; import uri from 'vs/base/common/uri'; -import { PPromise, TPromise } from 'vs/base/common/winjs.base'; +import { TPromise } from 'vs/base/common/winjs.base'; import * as pfs from 'vs/base/node/pfs'; import { getNextTickChannel } from 'vs/base/parts/ipc/common/ipc'; import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp'; @@ -28,13 +27,12 @@ import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/un import { IRawSearch, IRawSearchService, ISerializedFileMatch, ISerializedSearchComplete, ISerializedSearchProgressItem, isSerializedSearchComplete, isSerializedSearchSuccess, ITelemetryEvent } from './search'; import { ISearchChannel, SearchChannelClient } from './searchIpc'; -export class SearchService implements ISearchService { +export class SearchService extends Disposable implements ISearchService { public _serviceBrand: any; private diskSearch: DiskSearch; private readonly searchProviders: ISearchResultProvider[] = []; private fileSearchProvider: ISearchResultProvider; - private forwardingTelemetry: PPromise; constructor( @IModelService private modelService: IModelService, @@ -45,7 +43,11 @@ export class SearchService implements ISearchService { @ILogService private logService: ILogService, @IExtensionService private extensionService: IExtensionService ) { + super(); this.diskSearch = new DiskSearch(!environmentService.isBuilt || environmentService.verbose, /*timeout=*/undefined, environmentService.debugSearch); + this._register(this.diskSearch.onTelemetry(event => { + this.telemetryService.publicLog(event.eventName, event.data); + })); } public registerSearchResultProvider(scheme: string, provider: ISearchResultProvider): IDisposable { @@ -90,8 +92,6 @@ export class SearchService implements ISearchService { } public search(query: ISearchQuery, onProgress?: (item: ISearchProgressItem) => void): TPromise { - this.forwardTelemetry(); - let combinedPromise: TPromise; return new TPromise((onComplete, onError) => { @@ -268,15 +268,6 @@ export class SearchService implements ISearchService { ].map(provider => provider && provider.clearCache(cacheKey))) .then(() => { }); } - - private forwardTelemetry() { - if (!this.forwardingTelemetry) { - this.forwardingTelemetry = this.diskSearch.fetchTelemetry() - .then(null, onUnexpectedError, event => { - this.telemetryService.publicLog(event.eventName, event.data); - }); - } - } } export class DiskSearch implements ISearchResultProvider { @@ -316,6 +307,10 @@ export class DiskSearch implements ISearchResultProvider { this.raw = new SearchChannelClient(channel); } + public get onTelemetry(): Event { + return this.raw.onTelemetry; + } + public search(query: ISearchQuery, onProgress?: (p: ISearchProgressItem) => void): TPromise { const folderQueries = query.folderQueries || []; return TPromise.join(folderQueries.map(q => q.folder.scheme === Schemas.file && pfs.exists(q.folder.fsPath))) @@ -436,10 +431,4 @@ export class DiskSearch implements ISearchResultProvider { public clearCache(cacheKey: string): TPromise { return this.raw.clearCache(cacheKey); } - - public fetchTelemetry(): PPromise { - return new PPromise((c, e, p) => { - this.raw.onTelemetry(p); - }); - } } diff --git a/src/vs/workbench/services/search/test/node/searchService.test.ts b/src/vs/workbench/services/search/test/node/searchService.test.ts index 9ceecbfa748..eb205675ab0 100644 --- a/src/vs/workbench/services/search/test/node/searchService.test.ts +++ b/src/vs/workbench/services/search/test/node/searchService.test.ts @@ -165,13 +165,15 @@ suite('SearchService', () => { } const progressResults = []; - return DiskSearch.collectResultsFromEvent(fileSearch(rawSearch, 10)) + const onProgress = match => { + assert.strictEqual(match.resource.path, uriPath); + progressResults.push(match); + }; + + return DiskSearch.collectResultsFromEvent(fileSearch(rawSearch, 10), onProgress) .then(result => { assert.strictEqual(result.results.length, 25, 'Result'); assert.strictEqual(progressResults.length, 25, 'Progress'); - }, null, match => { - assert.strictEqual(match.resource.path, uriPath); - progressResults.push(match); }); }); From 8fcfcb505827ba9984184f2a8a2c2c9074238cfe Mon Sep 17 00:00:00 2001 From: Arjun Attam Date: Mon, 23 Jul 2018 23:47:27 +0530 Subject: [PATCH 22/93] Adds webview select-all command (#54851) --- .../webview/electron-browser/baseWebviewEditor.ts | 6 ++++++ .../webview/electron-browser/webview.contribution.ts | 10 +++++++++- .../parts/webview/electron-browser/webviewCommands.ts | 11 +++++++++++ .../parts/webview/electron-browser/webviewElement.ts | 4 ++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/parts/webview/electron-browser/baseWebviewEditor.ts b/src/vs/workbench/parts/webview/electron-browser/baseWebviewEditor.ts index aca88aff9df..7cbbbb07f67 100644 --- a/src/vs/workbench/parts/webview/electron-browser/baseWebviewEditor.ts +++ b/src/vs/workbench/parts/webview/electron-browser/baseWebviewEditor.ts @@ -77,4 +77,10 @@ export abstract class BaseWebviewEditor extends BaseEditor { this._webview.focus(); } } + + public selectAll(): void { + if (this._webview) { + this._webview.selectAll(); + } + } } diff --git a/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts b/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts index 3b34b5184ee..dbef116693f 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts @@ -16,7 +16,7 @@ import { Extensions as ActionExtensions, IWorkbenchActionRegistry } from 'vs/wor import { Extensions as EditorInputExtensions, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor'; import { WebviewEditorInputFactory } from 'vs/workbench/parts/webview/electron-browser/webviewEditorInputFactory'; import { KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE } from './baseWebviewEditor'; -import { HideWebViewEditorFindCommand, OpenWebviewDeveloperToolsAction, ReloadWebviewAction, ShowWebViewEditorFindWidgetCommand } from './webviewCommands'; +import { HideWebViewEditorFindCommand, OpenWebviewDeveloperToolsAction, ReloadWebviewAction, ShowWebViewEditorFindWidgetCommand, SelectAllWebviewEditorCommand } from './webviewCommands'; import { WebviewEditor } from './webviewEditor'; import { WebviewEditorInput } from './webviewEditorInput'; import { IWebviewEditorService, WebviewEditorService } from './webviewEditorService'; @@ -58,6 +58,14 @@ const hideCommand = new HideWebViewEditorFindCommand({ }); KeybindingsRegistry.registerCommandAndKeybindingRule(hideCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); +const selectAllCommand = new SelectAllWebviewEditorCommand({ + id: SelectAllWebviewEditorCommand.ID, + precondition: KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS, + kbOpts: { + primary: KeyMod.CtrlCmd | KeyCode.KEY_A + } +}); +KeybindingsRegistry.registerCommandAndKeybindingRule(selectAllCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); actionRegistry.registerWorkbenchAction( new SyncActionDescriptor(OpenWebviewDeveloperToolsAction, OpenWebviewDeveloperToolsAction.ID, OpenWebviewDeveloperToolsAction.LABEL), diff --git a/src/vs/workbench/parts/webview/electron-browser/webviewCommands.ts b/src/vs/workbench/parts/webview/electron-browser/webviewCommands.ts index c30d4fa8c85..5866fcdbec6 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webviewCommands.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webviewCommands.ts @@ -33,6 +33,17 @@ export class HideWebViewEditorFindCommand extends Command { } } +export class SelectAllWebviewEditorCommand extends Command { + public static readonly ID = 'editor.action.webvieweditor.selectAll'; + + public runCommand(accessor: ServicesAccessor, args: any): void { + const webViewEditor = getActiveWebviewEditor(accessor); + if (webViewEditor) { + webViewEditor.selectAll(); + } + } +} + export class OpenWebviewDeveloperToolsAction extends Action { static readonly ID = 'workbench.action.webview.openDeveloperTools'; static readonly LABEL = nls.localize('openToolsLabel', "Open Webview Developer Tools"); diff --git a/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts b/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts index a97e8f8fd1c..330e72730c4 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts @@ -443,6 +443,10 @@ export class WebviewElement extends Disposable { public reload() { this.contents = this._contents; } + + public selectAll() { + this._webview.selectAll(); + } } From 74c270e8878ceeed9a85e11b2621779eaa525bac Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Mon, 23 Jul 2018 20:34:08 +0200 Subject: [PATCH 23/93] update grammars --- .../fsharp/syntaxes/fsharp.tmLanguage.json | 658 ++++++++++++++++-- .../fsharp/test/colorize-results/test_fs.json | 331 ++++++--- .../git/syntaxes/git-rebase.tmLanguage.json | 20 +- extensions/java/syntaxes/java.tmLanguage.json | 20 +- .../test/colorize-results/basic_java.json | 44 +- extensions/lua/syntaxes/lua.tmLanguage.json | 16 +- .../lua/test/colorize-results/test_lua.json | 26 +- .../test/colorize-results/test-33886_md.json | 36 +- .../test/colorize-results/test_md.json | 140 ++-- .../colorize-results/issue-28354_php.json | 14 +- .../php/test/colorize-results/test_php.json | 48 +- .../syntaxes/MagicPython.tmLanguage.json | 54 +- .../test/colorize-results/test_cshtml.json | 470 +++++++------ extensions/xml/syntaxes/xml.tmLanguage.json | 40 +- 14 files changed, 1349 insertions(+), 568 deletions(-) diff --git a/extensions/fsharp/syntaxes/fsharp.tmLanguage.json b/extensions/fsharp/syntaxes/fsharp.tmLanguage.json index 84356109cde..4b280955153 100644 --- a/extensions/fsharp/syntaxes/fsharp.tmLanguage.json +++ b/extensions/fsharp/syntaxes/fsharp.tmLanguage.json @@ -4,19 +4,19 @@ "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/ionide/ionide-fsgrammar/commit/bd8d1225f93894a50bc8da6f5a76409b024d3d22", + "version": "https://github.com/ionide/ionide-fsgrammar/commit/67c9f45ebbbd5a12d89ffad1661caf8452f1d552", "name": "fsharp", "scopeName": "source.fsharp", "patterns": [ + { + "include": "#compiler_directives" + }, { "include": "#comments" }, { "include": "#constants" }, - { - "include": "#structure" - }, { "include": "#strings" }, @@ -30,10 +30,10 @@ "include": "#definition" }, { - "include": "#attributes" + "include": "#abstract_definition" }, { - "include": "#method_calls" + "include": "#attributes" }, { "include": "#modules" @@ -44,6 +44,9 @@ { "include": "#du_declaration" }, + { + "include": "#record_declaration" + }, { "include": "#keywords" }, @@ -58,6 +61,96 @@ } ], "repository": { + "generic_declaration": { + "patterns": [ + { + "match": "([^<>,])", + "captures": { + "1": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "begin": "(<)", + "end": "(>)", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "match": "([^<>,])", + "captures": { + "1": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "include": "#generic_declaration" + } + ] + }, + { + "include": "#keywords" + } + ] + }, + "record_signature": { + "patterns": [ + { + "match": "[[:alpha:]0-9'`^_ ]+(=)([[:alpha:]0-9'`^_ ]+)", + "captures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "variable.parameter.fsharp" + } + } + }, + { + "begin": "({)", + "end": "(})", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "match": "[[:alpha:]0-9'`^_ ]+(=)([[:alpha:]0-9'`^_ ]+)", + "captures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "variable.parameter.fsharp" + } + } + }, + { + "include": "#record_signature" + } + ] + }, + { + "include": "#keywords" + } + ] + }, "anonymous_functions": { "patterns": [ { @@ -66,15 +159,32 @@ "end": "(->)", "beginCaptures": { "1": { - "name": "keyword.other.function-definition.fsharp" + "name": "keyword.fsharp" } }, "endCaptures": { "1": { - "name": "keyword.other.fsharp" + "name": "keyword.fsharp" } }, "patterns": [ + { + "include": "#comments" + }, + { + "include": "#member_declaration" + }, + { + "match": "(:)(\\s*([?[:alpha:]0-9'`<>^._ ]+))*", + "captures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "entity.name.type.fsharp" + } + } + }, { "include": "#variables" } @@ -87,7 +197,7 @@ { "name": "support.function.attribute.fsharp", "begin": "\\[\\<", - "end": "\\>\\]", + "end": "\\>\\]|\\]", "patterns": [ { "include": "$self" @@ -178,57 +288,189 @@ } ] }, + "abstract_definition": { + "name": "abstract.definition.fsharp", + "begin": "\\b(abstract)\\s+(member)?(\\s+\\[\\<.*\\>\\])?\\s*([_[:alpha:]0-9,\\._`\\s]+)(:)", + "end": "\\s*(with)\\b|=|$", + "beginCaptures": { + "1": { + "name": "keyword.fsharp" + }, + "2": { + "name": "keyword.fsharp" + }, + "3": { + "name": "support.function.attribute.fsharp" + }, + "5": { + "name": "keyword.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.fsharp" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#common_declaration" + }, + { + "match": "\\?{0,1}([[:alpha:]0-9'`^._ ]+)\\s*(:)(\\s*([?[:alpha:]0-9'`^._ ]+)){0,1}", + "captures": { + "1": { + "name": "variable.parameter.fsharp" + }, + "2": { + "name": "keyword.symbol.fsharp" + }, + "3": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "match": "(?!with|get|set\\b)\\b([\\w0-9'`^._]+)", + "comments": "Here we need the \\w modifier in order to check that the words isn't blacklisted", + "captures": { + "1": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "include": "#keywords" + } + ] + }, "definition": { "patterns": [ { "name": "binding.fsharp", - "begin": "\\b(val mutable|val|let mutable|let inline|let|member|static member|override|let!)(\\s+rec|mutable)?(\\s+\\[\\<.*\\>\\])?\\s*(private|internal|public)?\\s+(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9,\\._]|(?<=,)\\s)*|``[_[:alpha:]]([_[:alpha:]0-9,\\._`\\s]|(?<=,)\\s)*)?", - "end": "((``.*``)|(with)\\b|=|$)", + "begin": "\\b(val mutable|val|let mutable|let inline|let|member val|member|static member|override|let!)(\\s+rec|mutable)?(\\s+\\[\\<.*\\>\\])?\\s*(private|internal|public)?\\s+(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9,\\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9,\\._`\\s]+|(?<=,)\\s)*)?", + "end": "\\s*(with\\b|=|\\n+=)", "beginCaptures": { "1": { - "name": "keyword.other.binding.fsharp" + "name": "keyword.fsharp" }, "2": { - "name": "keyword.other.function-recursive.fsharp" + "name": "keyword.fsharp" }, "3": { "name": "support.function.attribute.fsharp" }, "4": { - "name": "keyword.other.access.fsharp" + "name": "keyword.fsharp" }, "5": { - "name": "variable.other.binding.fsharp" + "name": "variable.fsharp" } }, "endCaptures": { "1": { - "name": "keyword.other.fsharp" - }, - "2": { - "name": "variable.other.binding.fsharp" - }, - "3": { - "name": "keyword.other.fsharp" + "name": "keyword.fsharp" } }, "patterns": [ { - "include": "#variables" + "include": "#comments" }, { - "include": "#member_declaration" - }, - { - "match": "(:)(\\s*([?[:alpha:]0-9'<>^._ ]+))*", + "match": "(:)\\s*(\\()?\\s*(([?[:alpha:]0-9'`^._ ]+))*", "captures": { "1": { - "name": "keyword.other.fsharp" + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "keyword.symbol.fsharp" + }, + "3": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "match": "(\\*\\s*\\()\\s*(([?[:alpha:]0-9'`^._ ]+))*", + "captures": { + "1": { + "name": "keyword.symbol.fsharp" }, "2": { "name": "entity.name.type.fsharp" } } + }, + { + "match": "(->)\\s*(\\()?\\s*([?[:alpha:]0-9'`^._ ]+)*", + "captures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "keyword.symbol.fsharp" + }, + "3": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "match": "(\\*)(\\s*([?[:alpha:]0-9'`^._ ]+))*", + "captures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "begin": "(<)", + "end": "(>)", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "include": "#generic_declaration" + } + ] + }, + { + "begin": "({)", + "end": "(})", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "include": "#record_signature" + } + ] + }, + { + "include": "#variables" + }, + { + "include": "#keywords" } ] } @@ -242,23 +484,26 @@ "end": "$|(\\|)", "beginCaptures": { "1": { - "name": "keyword.other.fsharp" + "name": "keyword.fsharp" } }, "endCaptures": { "1": { - "name": "keyword.other.fsharp" + "name": "keyword.symbol.fsharp" } }, "patterns": [ { - "match": "([[:alpha:]0-9'`<>^._]+)\\s*(:)\\s*([[:alpha:]0-9'`<>^._]+)", + "include": "#comments" + }, + { + "match": "([[:alpha:]0-9'`<>^._]+|``[[:alpha:]0-9' <>^._]+``)\\s*(:)\\s*([[:alpha:]0-9'`<>^._]+|``[[:alpha:]0-9' <>^._]+``)", "captures": { "1": { "name": "variable.parameter.fsharp" }, "2": { - "name": "keyword.other.fsharp" + "name": "keyword.symbol.fsharp" }, "3": { "name": "entity.name.type.fsharp" @@ -266,17 +511,7 @@ } }, { - "match": "([[:alpha:]0-9'`<>^._]+)", - "captures": { - "1": { - "name": "entity.name.type.fsharp" - } - } - }, - { - "begin": "\\(", - "end": "\\)", - "match": "([[:alpha:]0-9'`<>^._]+)", + "match": "([[:alpha:]0-9'`^._]+)|``([[:alpha:]0-9'^._ ]+)``", "captures": { "1": { "name": "entity.name.type.fsharp" @@ -293,17 +528,12 @@ "keywords": { "patterns": [ { - "name": "keyword.other.fsharp", + "name": "keyword.fsharp", "match": "\\b(private|to|public|internal|function|yield!|yield|class|exception|match|delegate|of|new|in|as|if|then|else|elif|for|begin|end|inherit|do|let\\!|return\\!|return|interface|with|abstract|property|union|enum|member|try|finally|and|when|use|use\\!|struct|while|mutable)(?!')\\b" }, { - "name": "meta.preprocessor.fsharp", - "begin": "^\\s*#\\s*(light)\\b", - "end": "(\\s|$)" - }, - { - "name": "keyword.other.fsharp", - "match": "(&&&|\\|\\|\\||\\^\\^\\^|~~~|<<<|>>>|\\|>|\\->|\\<\\-|:>|:\\?>|:|\\[|\\]|\\;|<>|=|@|\\|\\||&&|{|}|\\||_|\\.\\.|\\+|\\-|\\*|\\/|\\^|\\!|\\>|\\>\\=|\\>\\>|\\<|\\<\\=|\\<\\<)" + "name": "keyword.symbol.fsharp", + "match": "(&&&|\\|\\|\\||\\^\\^\\^|~~~|<<<|>>>|\\|>|\\->|\\<\\-|:>|:\\?>|:|\\[|\\]|\\;|<>|=|@|\\|\\||&&|{|}|\\||_|\\.\\.|\\,|\\+|\\-|\\*|\\/|\\^|\\!|\\>|\\>\\=|\\>\\>|\\<|\\<\\=|\\(|\\)|\\<\\<)" } ] }, @@ -312,18 +542,23 @@ { "name": "entity.name.section.fsharp", "begin": "\\b(namespace|module)\\s*(public|internal|private)?\\s+([[:alpha:]][[:alpha:]0-9'_. ]*)", - "end": "(\\s|$)", + "end": "(\\s?=|\\s|$)", "beginCaptures": { "1": { - "name": "keyword.other.fsharp" + "name": "keyword.fsharp" }, "2": { - "name": "keyword.other.fsharp" + "name": "keyword.fsharp" }, "3": { "name": "entity.name.section.fsharp" } }, + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, "patterns": [ { "name": "entity.name.section.fsharp", @@ -345,7 +580,7 @@ "end": "(\\s|$)", "beginCaptures": { "1": { - "name": "keyword.other.fsharp" + "name": "keyword.fsharp" }, "2": { "name": "entity.name.section.fsharp" @@ -372,7 +607,7 @@ "end": "(\\s|$)", "beginCaptures": { "1": { - "name": "keyword.other.namespace-definition.fsharp" + "name": "keyword.fsharp" }, "2": { "name": "entity.name.type.namespace.fsharp" @@ -485,7 +720,7 @@ "match": "(%0?-?(\\d+)?((a|t)|(\\.\\d+)?(f|F|e|E|g|G|M)|(b|c|s|d|i|x|X|o)|(s|b|O)|(\\+?A)))", "captures": { "1": { - "name": "keyword.other.format.specifier.fsharp" + "name": "keyword.format.specifier.fsharp" } } } @@ -499,29 +734,132 @@ }, { "name": "variable.parameter.fsharp", - "match": "[[:alpha:]'_]\\w*" + "match": "[[:alpha:]0-9'`<>^._ ]\\w*" + } + ] + }, + "common_declaration": { + "patterns": [ + { + "begin": "\\s*(->)\\s*([[:alpha:]0-9'`^._ ]+)(<)", + "end": "(>)", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "entity.name.type.fsharp" + }, + "3": { + "name": "keyword.symbol.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "match": "([[:alpha:]0-9'`^._ ]+)", + "captures": { + "1": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "include": "#keywords" + } + ] + }, + { + "match": "\\s*(->)\\s*([[:alpha:]0-9'`^._ ]+)", + "captures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "begin": "\\?{0,1}([[:alpha:]0-9'`^._ ]+)\\s*(:)(\\s*([?[:alpha:]0-9'`^._ ]+)(<))", + "end": "(>)", + "beginCaptures": { + "1": { + "name": "variable.parameter.fsharp" + }, + "2": { + "name": "keyword.symbol.fsharp" + }, + "3": { + "name": "keyword.symbol.fsharp" + }, + "4": { + "name": "entity.name.type.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "match": "([[:alpha:]0-9'`^._ ]+)", + "captures": { + "1": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "include": "#keywords" + } + ] } ] }, "member_declaration": { "patterns": [ { - "begin": "\\(", - "end": "\\)", + "begin": "(\\()", + "end": "(\\))", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, "patterns": [ { - "match": "\\?{0,1}([[:alpha:]0-9'`<>^._]+)\\s*(:{0,1})(\\s*([?[:alpha:]0-9'<>^._ ]+)){0,1}", + "include": "#comments" + }, + { + "include": "#common_declaration" + }, + { + "match": "\\?{0,1}([[:alpha:]0-9'`^._ ]+)\\s*(:{0,1})(\\s*([?[:alpha:]0-9'`<>^._ ]+)){0,1}", "captures": { "1": { "name": "variable.parameter.fsharp" }, "2": { - "name": "keyword.other.fsharp" + "name": "keyword.symbol.fsharp" }, "3": { "name": "entity.name.type.fsharp" } } + }, + { + "include": "#keywords" } ] } @@ -550,45 +888,210 @@ "patterns": [ { "name": "record.fsharp", - "begin": "(type)[\\s]+(private|internal|public)?[\\s]*([[:alpha:]0-9'<>^:,._]+)[\\s]?(private|internal|public)?[\\s]*", - "end": "[\\s]*((with)|((as) ([[:alpha:]0-9']+))|(=)|[\\n=]|(\\(\\)))", + "begin": "\\b(type)[\\s]+(private|internal|public)?(\\s*\\[\\<.*\\>\\])?[\\s]*([[:alpha:]0-9'`^:,._]+|``[[:alpha:]0-9'`^:,._ ]+``)(<)", + "end": "\\s*((with)|((as)\\s*([[:alpha:]0-9']+))|(=)|[\\n=]|(\\(\\)))", "beginCaptures": { "1": { - "name": "keyword.other.fsharp" + "name": "keyword.fsharp" }, "2": { - "name": "keyword.other.fsharp" + "name": "keyword.fsharp" }, "3": { - "name": "entity.name.type.fsharp" + "name": "support.function.attribute.fsharp" }, "4": { - "name": "keyword.other.fsharp" + "name": "entity.name.type.fsharp" + }, + "5": { + "name": "keyword.symbol.fsharp" } }, "endCaptures": { "2": { - "name": "keyword.other.fsharp" + "name": "keyword.fsharp" }, "3": { - "name": "keyword.other.fsharp" + "name": "keyword.fsharp" }, "4": { - "name": "keyword.other.fsharp" + "name": "keyword.fsharp" }, "5": { "name": "variable.parameter.fsharp" }, "6": { - "name": "keyword.other.fsharp" + "name": "keyword.symbol.fsharp" }, "7": { "name": "constant.language.unit.fsharp" } }, "patterns": [ + { + "include": "#comments" + }, + { + "match": "\\s*(>)\\s*(private|internal|public)?", + "captures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "keyword.fsharp" + } + } + }, + { + "match": "([[:alpha:]0-9'`^._ ]+)", + "captures": { + "1": { + "name": "entity.name.type.fsharp" + } + } + }, { "include": "#member_declaration" + }, + { + "include": "#keywords" + } + ] + }, + { + "name": "record.fsharp", + "begin": "\\b(type)[\\s]+(private|internal|public)?(\\s*\\[\\<.*\\>\\])?[\\s]*([[:alpha:]0-9'`^:,._]+<(.*)>|[[:alpha:]0-9'^:,._]+|``[[:alpha:]0-9'`^:,._ ]+``)[\\s]?(private|internal|public)?[\\s]*", + "end": "\\s*((with)|((as)\\s*([[:alpha:]0-9']+))|(=)|[\\n=]|(\\(\\)))", + "beginCaptures": { + "1": { + "name": "keyword.fsharp" + }, + "2": { + "name": "keyword.fsharp" + }, + "3": { + "name": "support.function.attribute.fsharp" + }, + "4": { + "name": "entity.name.type.fsharp" + }, + "6": { + "name": "keyword.fsharp" + } + }, + "endCaptures": { + "2": { + "name": "keyword.fsharp" + }, + "3": { + "name": "keyword.fsharp" + }, + "4": { + "name": "keyword.fsharp" + }, + "5": { + "name": "variable.parameter.fsharp" + }, + "6": { + "name": "keyword.symbol.fsharp" + }, + "7": { + "name": "constant.language.unit.fsharp" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#member_declaration" + } + ] + } + ] + }, + "record_declaration": { + "patterns": [ + { + "begin": "(\\{)", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "end": "(?<=\\})", + "patterns": [ + { + "include": "#comments" + }, + { + "begin": "(((mutable)\\s[[:alpha:]]+)|[[:alpha:]0-9'`<>^._]*)\\s*((?=", - "t": "source.fsharp keyword.other.fsharp", + "t": "source.fsharp keyword.symbol.fsharp", "r": { "dark_plus": "keyword: #569CD6", "light_plus": "keyword: #0000FF", @@ -925,7 +1046,7 @@ }, { "c": "override", - "t": "source.fsharp binding.fsharp keyword.other.binding.fsharp", + "t": "source.fsharp binding.fsharp keyword.fsharp", "r": { "dark_plus": "keyword: #569CD6", "light_plus": "keyword: #0000FF", @@ -947,7 +1068,7 @@ }, { "c": "this.ToString", - "t": "source.fsharp binding.fsharp variable.other.binding.fsharp", + "t": "source.fsharp binding.fsharp variable.fsharp", "r": { "dark_plus": "variable: #9CDCFE", "light_plus": "variable: #001080", @@ -958,13 +1079,13 @@ }, { "c": " ", - "t": "source.fsharp binding.fsharp", + "t": "source.fsharp binding.fsharp variable.parameter.fsharp", "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" } }, { @@ -991,7 +1112,7 @@ }, { "c": "=", - "t": "source.fsharp binding.fsharp keyword.other.fsharp", + "t": "source.fsharp binding.fsharp keyword.fsharp", "r": { "dark_plus": "keyword: #569CD6", "light_plus": "keyword: #0000FF", @@ -1057,7 +1178,7 @@ }, { "c": "+", - "t": "source.fsharp keyword.other.fsharp", + "t": "source.fsharp keyword.symbol.fsharp", "r": { "dark_plus": "keyword: #569CD6", "light_plus": "keyword: #0000FF", @@ -1079,7 +1200,7 @@ }, { "c": "+", - "t": "source.fsharp keyword.other.fsharp", + "t": "source.fsharp keyword.symbol.fsharp", "r": { "dark_plus": "keyword: #569CD6", "light_plus": "keyword: #0000FF", @@ -1145,7 +1266,7 @@ }, { "c": "+", - "t": "source.fsharp keyword.other.fsharp", + "t": "source.fsharp keyword.symbol.fsharp", "r": { "dark_plus": "keyword: #569CD6", "light_plus": "keyword: #0000FF", @@ -1211,7 +1332,7 @@ }, { "c": "+", - "t": "source.fsharp keyword.other.fsharp", + "t": "source.fsharp keyword.symbol.fsharp", "r": { "dark_plus": "keyword: #569CD6", "light_plus": "keyword: #0000FF", @@ -1221,7 +1342,51 @@ } }, { - "c": " (string)internalAge", + "c": " ", + "t": "source.fsharp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "(", + "t": "source.fsharp keyword.symbol.fsharp", + "r": { + "dark_plus": "keyword: #569CD6", + "light_plus": "keyword: #0000FF", + "dark_vs": "keyword: #569CD6", + "light_vs": "keyword: #0000FF", + "hc_black": "keyword: #569CD6" + } + }, + { + "c": "string", + "t": "source.fsharp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": ")", + "t": "source.fsharp keyword.symbol.fsharp", + "r": { + "dark_plus": "keyword: #569CD6", + "light_plus": "keyword: #0000FF", + "dark_vs": "keyword: #569CD6", + "light_vs": "keyword: #0000FF", + "hc_black": "keyword: #569CD6" + } + }, + { + "c": "internalAge", "t": "source.fsharp", "r": { "dark_plus": "default: #D4D4D4", diff --git a/extensions/git/syntaxes/git-rebase.tmLanguage.json b/extensions/git/syntaxes/git-rebase.tmLanguage.json index 3ee481bede1..a2c116bd09b 100644 --- a/extensions/git/syntaxes/git-rebase.tmLanguage.json +++ b/extensions/git/syntaxes/git-rebase.tmLanguage.json @@ -4,7 +4,7 @@ "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/textmate/git.tmbundle/commit/d1db42c2d71948662098183a6df519fb53a7a15b", + "version": "https://github.com/textmate/git.tmbundle/commit/3f6ad2138200db14b57a090ecb2d2e733275ca3e", "name": "Git Rebase Message", "scopeName": "text.git-rebase", "patterns": [ @@ -29,7 +29,23 @@ "name": "meta.commit-message.git-rebase" } }, - "match": "^\\s*(pick|p|reword|r|edit|e|squash|s|fixup|f|exec|x|drop|d)\\s+([0-9a-f]+)\\s+(.*)$", + "match": "^\\s*(pick|p|reword|r|edit|e|squash|s|fixup|f|drop|d)\\s+([0-9a-f]+)\\s+(.*)$", + "name": "meta.commit-command.git-rebase" + }, + { + "captures": { + "1": { + "name": "support.function.git-rebase" + }, + "2": { + "patterns": [ + { + "include": "source.shell" + } + ] + } + }, + "match": "^\\s*(exec|x)\\s+(.*)$", "name": "meta.commit-command.git-rebase" } ] diff --git a/extensions/java/syntaxes/java.tmLanguage.json b/extensions/java/syntaxes/java.tmLanguage.json index b629f66dc70..b19cc7b4754 100644 --- a/extensions/java/syntaxes/java.tmLanguage.json +++ b/extensions/java/syntaxes/java.tmLanguage.json @@ -4,7 +4,7 @@ "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-java/commit/b9f1a853a69184363b0fb15f52da07c9660bf730", + "version": "https://github.com/atom/language-java/commit/2f20bc5a5b07686ec0139e2969431210d81b6991", "name": "Java", "scopeName": "source.java", "patterns": [ @@ -1424,7 +1424,7 @@ }, "variables": { "begin": "(?x)\n(?=\n (\n (void|boolean|byte|char|short|int|float|long|double)\n |\n (?>(\\w+\\.)*[A-Z]+\\w*) # e.g. `javax.ws.rs.Response`, or `String`\n )\n (\n <[\\w<>,\\.?\\s\\[\\]]*> # e.g. `HashMap`, or `List`\n )?\n (\n (\\[\\])* # int[][]\n )?\n \\s+\n [A-Za-z_$][\\w$]* # At least one identifier after space\n ([\\w\\[\\],$][\\w\\[\\],\\s]*)? # possibly primitive array or additional identifiers\n \\s*(=|;)\n)", - "end": "(?=;)", + "end": "(?=\\=|;)", "name": "meta.definition.variable.java", "patterns": [ { @@ -1438,20 +1438,6 @@ { "include": "#all-types" }, - { - "begin": "=", - "beginCaptures": { - "0": { - "name": "keyword.operator.assignment.java" - } - }, - "end": "(?=;)", - "patterns": [ - { - "include": "#code" - } - ] - }, { "include": "#code" } @@ -1459,7 +1445,7 @@ }, "member-variables": { "begin": "(?=private|protected|public|native|synchronized|abstract|threadsafe|transient|static|final)", - "end": "(?=;)", + "end": "(?=\\=|;)", "patterns": [ { "include": "#storage-modifiers" diff --git a/extensions/java/test/colorize-results/basic_java.json b/extensions/java/test/colorize-results/basic_java.json index 1ef3a8ff324..665268f9e6a 100644 --- a/extensions/java/test/colorize-results/basic_java.json +++ b/extensions/java/test/colorize-results/basic_java.json @@ -727,7 +727,7 @@ }, { "c": "=", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java keyword.operator.assignment.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java keyword.operator.assignment.java", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -738,7 +738,7 @@ }, { "c": " ", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -749,7 +749,7 @@ }, { "c": "0.0", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java constant.numeric.decimal.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java constant.numeric.decimal.java", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -826,7 +826,7 @@ }, { "c": "=", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java keyword.operator.assignment.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java keyword.operator.assignment.java", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -837,7 +837,7 @@ }, { "c": " ", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -848,7 +848,7 @@ }, { "c": "10e3", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java constant.numeric.decimal.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java constant.numeric.decimal.java", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -925,7 +925,7 @@ }, { "c": "=", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java keyword.operator.assignment.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java keyword.operator.assignment.java", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -936,7 +936,7 @@ }, { "c": " ", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -947,7 +947,7 @@ }, { "c": "134l", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java constant.numeric.decimal.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java constant.numeric.decimal.java", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -1398,7 +1398,7 @@ }, { "c": "=", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java keyword.operator.assignment.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java keyword.operator.assignment.java", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -1409,7 +1409,7 @@ }, { "c": " ", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1420,7 +1420,7 @@ }, { "c": "0", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java constant.numeric.decimal.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java constant.numeric.decimal.java", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -2047,7 +2047,7 @@ }, { "c": "=", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java keyword.operator.assignment.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java keyword.operator.assignment.java", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -2058,7 +2058,7 @@ }, { "c": " ", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2069,7 +2069,7 @@ }, { "c": "0x5", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java constant.numeric.hex.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java constant.numeric.hex.java", "r": { "dark_plus": "constant.numeric: #B5CEA8", "light_plus": "constant.numeric: #09885A", @@ -2179,7 +2179,7 @@ }, { "c": "=", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java keyword.operator.assignment.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java keyword.operator.assignment.java", "r": { "dark_plus": "keyword.operator: #D4D4D4", "light_plus": "keyword.operator: #000000", @@ -2190,7 +2190,7 @@ }, { "c": " ", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2201,7 +2201,7 @@ }, { "c": "new", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java keyword.control.new.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java keyword.control.new.java", "r": { "dark_plus": "keyword.control: #C586C0", "light_plus": "keyword.control: #AF00DB", @@ -2212,7 +2212,7 @@ }, { "c": " ", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2223,7 +2223,7 @@ }, { "c": "Vector", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java meta.function-call.java entity.name.function.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.function-call.java entity.name.function.java", "r": { "dark_plus": "entity.name.function: #DCDCAA", "light_plus": "entity.name.function: #795E26", @@ -2234,7 +2234,7 @@ }, { "c": "(", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java meta.function-call.java punctuation.definition.parameters.begin.bracket.round.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.function-call.java punctuation.definition.parameters.begin.bracket.round.java", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2245,7 +2245,7 @@ }, { "c": ")", - "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.definition.variable.java meta.function-call.java punctuation.definition.parameters.end.bracket.round.java", + "t": "source.java meta.class.java meta.class.body.java meta.method.java meta.method.body.java meta.function-call.java punctuation.definition.parameters.end.bracket.round.java", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", diff --git a/extensions/lua/syntaxes/lua.tmLanguage.json b/extensions/lua/syntaxes/lua.tmLanguage.json index 8adc657f806..c2b31570531 100644 --- a/extensions/lua/syntaxes/lua.tmLanguage.json +++ b/extensions/lua/syntaxes/lua.tmLanguage.json @@ -4,23 +4,25 @@ "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/textmate/lua.tmbundle/commit/42da2c6ff5d86c068f72520f856190f413911a80", + "version": "https://github.com/textmate/lua.tmbundle/commit/8ae5641365b28f697121ba1133890e8d81f5b00e", "name": "Lua", "scopeName": "source.lua", - "comment": "Lua Syntax: version 0.8", "patterns": [ { - "begin": "\\b((local\\b)\\s+)?(function)\\s*(\\s+[a-zA-Z_][a-zA-Z0-9_]*(\\.[a-zA-Z_][a-zA-Z0-9_]*)*(:[a-zA-Z_][a-zA-Z0-9_]*)?\\s*)?(\\()", + "begin": "\\b(?:(local)\\s+)?(function)\\s*(?:\\s+([a-zA-Z_][a-zA-Z0-9_]*(?:([\\.:])[a-zA-Z_][a-zA-Z0-9_]*)?)\\s*)?(\\()", "beginCaptures": { "1": { "name": "storage.modifier.local.lua" }, - "3": { + "2": { "name": "keyword.control.lua" }, - "4": { + "3": { "name": "entity.name.function.lua" }, + "4": { + "name": "punctuation.separator.parameter.lua" + }, "5": { "name": "punctuation.definition.parameters.begin.lua" } @@ -36,6 +38,10 @@ { "match": "[a-zA-Z_][a-zA-Z0-9_]*", "name": "variable.parameter.function.lua" + }, + { + "match": ",", + "name": "punctuation.separator.arguments.lua" } ] }, diff --git a/extensions/lua/test/colorize-results/test_lua.json b/extensions/lua/test/colorize-results/test_lua.json index bc041f3ac30..c1495f2253e 100644 --- a/extensions/lua/test/colorize-results/test_lua.json +++ b/extensions/lua/test/colorize-results/test_lua.json @@ -55,7 +55,18 @@ } }, { - "c": " fact ", + "c": " ", + "t": "source.lua meta.function.lua", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "fact", "t": "source.lua meta.function.lua entity.name.function.lua", "r": { "dark_plus": "entity.name.function: #DCDCAA", @@ -66,7 +77,7 @@ } }, { - "c": "(", + "c": " ", "t": "source.lua meta.function.lua", "r": { "dark_plus": "default: #D4D4D4", @@ -76,6 +87,17 @@ "hc_black": "default: #FFFFFF" } }, + { + "c": "(", + "t": "source.lua meta.function.lua punctuation.definition.parameters.begin.lua", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, { "c": "n", "t": "source.lua meta.function.lua variable.parameter.function.lua", diff --git a/extensions/markdown-basics/test/colorize-results/test-33886_md.json b/extensions/markdown-basics/test/colorize-results/test-33886_md.json index 185d172e8af..179172a5738 100644 --- a/extensions/markdown-basics/test/colorize-results/test-33886_md.json +++ b/extensions/markdown-basics/test/colorize-results/test-33886_md.json @@ -34,7 +34,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.tag.structure.pre.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -45,7 +45,7 @@ }, { "c": "pre", - "t": "text.html.markdown meta.tag.block.any.html entity.name.tag.block.any.html", + "t": "text.html.markdown meta.tag.structure.pre.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -56,7 +56,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.structure.pre.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -67,7 +67,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.tag.inline.any.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.tag.inline.code.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -78,7 +78,7 @@ }, { "c": "code", - "t": "text.html.markdown meta.tag.inline.any.html entity.name.tag.inline.any.html", + "t": "text.html.markdown meta.tag.inline.code.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -89,7 +89,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.inline.code.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -111,7 +111,7 @@ }, { "c": "", - "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.code.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -144,7 +144,7 @@ }, { "c": "", - "t": "text.html.markdown meta.paragraph.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.paragraph.markdown meta.tag.structure.pre.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -210,7 +210,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.tag.structure.pre.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -221,7 +221,7 @@ }, { "c": "pre", - "t": "text.html.markdown meta.tag.block.any.html entity.name.tag.block.any.html", + "t": "text.html.markdown meta.tag.structure.pre.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -232,7 +232,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.structure.pre.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -265,7 +265,7 @@ }, { "c": "", - "t": "text.html.markdown meta.paragraph.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.paragraph.markdown meta.tag.structure.pre.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", diff --git a/extensions/markdown-basics/test/colorize-results/test_md.json b/extensions/markdown-basics/test/colorize-results/test_md.json index eb09a71c815..4eb1e2fc5d9 100644 --- a/extensions/markdown-basics/test/colorize-results/test_md.json +++ b/extensions/markdown-basics/test/colorize-results/test_md.json @@ -331,7 +331,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.tag.structure.div.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -342,7 +342,7 @@ }, { "c": "div", - "t": "text.html.markdown meta.tag.block.any.html entity.name.tag.block.any.html", + "t": "text.html.markdown meta.tag.structure.div.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -353,7 +353,7 @@ }, { "c": " ", - "t": "text.html.markdown meta.tag.block.any.html", + "t": "text.html.markdown meta.tag.structure.div.start.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -364,7 +364,7 @@ }, { "c": "class", - "t": "text.html.markdown meta.tag.block.any.html entity.other.attribute-name.html", + "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.class.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -375,7 +375,7 @@ }, { "c": "=", - "t": "text.html.markdown meta.tag.block.any.html", + "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.class.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -386,7 +386,7 @@ }, { "c": "\"", - "t": "text.html.markdown meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.class.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -397,7 +397,7 @@ }, { "c": "custom-class", - "t": "text.html.markdown meta.tag.block.any.html string.quoted.double.html", + "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.class.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -408,7 +408,7 @@ }, { "c": "\"", - "t": "text.html.markdown meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.class.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -419,7 +419,7 @@ }, { "c": " ", - "t": "text.html.markdown meta.tag.block.any.html", + "t": "text.html.markdown meta.tag.structure.div.start.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -430,7 +430,7 @@ }, { "c": "markdown", - "t": "text.html.markdown meta.tag.block.any.html entity.other.attribute-name.html", + "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.unrecognized.markdown.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -441,7 +441,7 @@ }, { "c": "=", - "t": "text.html.markdown meta.tag.block.any.html", + "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.unrecognized.markdown.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -452,7 +452,7 @@ }, { "c": "\"", - "t": "text.html.markdown meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.unrecognized.markdown.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -463,7 +463,7 @@ }, { "c": "1", - "t": "text.html.markdown meta.tag.block.any.html string.quoted.double.html", + "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.unrecognized.markdown.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -474,7 +474,7 @@ }, { "c": "\"", - "t": "text.html.markdown meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.unrecognized.markdown.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -485,7 +485,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.structure.div.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -507,7 +507,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.tag.structure.div.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -518,7 +518,7 @@ }, { "c": "div", - "t": "text.html.markdown meta.tag.block.any.html entity.name.tag.block.any.html", + "t": "text.html.markdown meta.tag.structure.div.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -529,7 +529,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.structure.div.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -562,7 +562,7 @@ }, { "c": "", - "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.structure.div.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -606,7 +606,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -617,7 +617,7 @@ }, { "c": "script", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html entity.name.tag.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -628,7 +628,7 @@ }, { "c": " ", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", @@ -639,7 +639,7 @@ }, { "c": "type", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html entity.other.attribute-name.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html meta.attribute.type.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -650,7 +650,7 @@ }, { "c": "=", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html meta.attribute.type.html punctuation.separator.key-value.html", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", @@ -661,7 +661,7 @@ }, { "c": "'", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html string.quoted.single.html punctuation.definition.string.begin.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html meta.attribute.type.html string.quoted.single.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.single.html: #0000FF", @@ -672,7 +672,7 @@ }, { "c": "text/x-koka", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html string.quoted.single.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html meta.attribute.type.html string.quoted.single.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.single.html: #0000FF", @@ -683,7 +683,7 @@ }, { "c": "'", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html string.quoted.single.html punctuation.definition.string.end.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html meta.attribute.type.html string.quoted.single.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.single.html: #0000FF", @@ -694,7 +694,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -727,7 +727,7 @@ }, { "c": "", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -770,29 +770,7 @@ } }, { - "c": " and a ", - "t": "text.html.markdown", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "&", - "t": "text.html.markdown invalid.illegal.bad-ampersand.html", - "r": { - "dark_plus": "invalid: #F44747", - "light_plus": "invalid: #CD3131", - "dark_vs": "invalid: #F44747", - "light_vs": "invalid: #CD3131", - "hc_black": "invalid: #F44747" - } - }, - { - "c": " ", + "c": " and a & ", "t": "text.html.markdown", "r": { "dark_plus": "default: #D4D4D4", @@ -804,7 +782,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.tag.inline.any.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.tag.inline.b.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -815,7 +793,7 @@ }, { "c": "b", - "t": "text.html.markdown meta.tag.inline.any.html entity.name.tag.inline.any.html", + "t": "text.html.markdown meta.tag.inline.b.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -826,7 +804,7 @@ }, { "c": " ", - "t": "text.html.markdown meta.tag.inline.any.html", + "t": "text.html.markdown meta.tag.inline.b.start.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -837,7 +815,7 @@ }, { "c": "class", - "t": "text.html.markdown meta.tag.inline.any.html entity.other.attribute-name.html", + "t": "text.html.markdown meta.tag.inline.b.start.html meta.attribute.class.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -848,7 +826,7 @@ }, { "c": "=", - "t": "text.html.markdown meta.tag.inline.any.html", + "t": "text.html.markdown meta.tag.inline.b.start.html meta.attribute.class.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -859,7 +837,7 @@ }, { "c": "\"", - "t": "text.html.markdown meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.markdown meta.tag.inline.b.start.html meta.attribute.class.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -870,7 +848,7 @@ }, { "c": "bold", - "t": "text.html.markdown meta.tag.inline.any.html string.quoted.double.html", + "t": "text.html.markdown meta.tag.inline.b.start.html meta.attribute.class.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -881,7 +859,7 @@ }, { "c": "\"", - "t": "text.html.markdown meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.markdown meta.tag.inline.b.start.html meta.attribute.class.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -892,7 +870,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.inline.b.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -914,7 +892,7 @@ }, { "c": "", - "t": "text.html.markdown meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.inline.b.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -969,7 +947,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -980,7 +958,7 @@ }, { "c": "style", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.html entity.name.tag.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -991,7 +969,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1156,7 +1134,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.html punctuation.definition.tag.begin.html source.css", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.begin.html source.css", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1167,7 +1145,7 @@ }, { "c": "/", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1178,7 +1156,7 @@ }, { "c": "style", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.html entity.name.tag.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.end.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1189,7 +1167,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1200,7 +1178,7 @@ }, { "c": "", - "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.structure.div.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2520,7 +2498,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.any.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.abbr.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2531,7 +2509,7 @@ }, { "c": "abbr", - "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.any.html entity.name.tag.inline.any.html", + "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.abbr.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2542,7 +2520,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.abbr.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", diff --git a/extensions/php/test/colorize-results/issue-28354_php.json b/extensions/php/test/colorize-results/issue-28354_php.json index cc9924d3945..12e439430fb 100644 --- a/extensions/php/test/colorize-results/issue-28354_php.json +++ b/extensions/php/test/colorize-results/issue-28354_php.json @@ -1,7 +1,7 @@ [ { "c": "<", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.begin.html", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -12,7 +12,7 @@ }, { "c": "script", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.html entity.name.tag.html", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -23,7 +23,7 @@ }, { "c": ">", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.end.html", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -496,7 +496,7 @@ }, { "c": "<", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.begin.html source.js", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -507,7 +507,7 @@ }, { "c": "/", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.begin.html", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -518,7 +518,7 @@ }, { "c": "script", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.html entity.name.tag.html", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -529,7 +529,7 @@ }, { "c": ">", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.end.html", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", diff --git a/extensions/php/test/colorize-results/test_php.json b/extensions/php/test/colorize-results/test_php.json index 4cb58182b1a..a5d89ab4214 100644 --- a/extensions/php/test/colorize-results/test_php.json +++ b/extensions/php/test/colorize-results/test_php.json @@ -1,7 +1,7 @@ [ { "c": "<", - "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.php meta.tag.structure.html.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -12,7 +12,7 @@ }, { "c": "html", - "t": "text.html.php meta.tag.structure.any.html entity.name.tag.structure.any.html", + "t": "text.html.php meta.tag.structure.html.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -23,7 +23,7 @@ }, { "c": ">", - "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.php meta.tag.structure.html.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -34,7 +34,7 @@ }, { "c": "<", - "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.php meta.tag.structure.head.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -45,7 +45,7 @@ }, { "c": "head", - "t": "text.html.php meta.tag.structure.any.html entity.name.tag.structure.any.html", + "t": "text.html.php meta.tag.structure.head.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -56,7 +56,7 @@ }, { "c": ">", - "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.php meta.tag.structure.head.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -78,7 +78,7 @@ }, { "c": "<", - "t": "text.html.php meta.tag.inline.any.html punctuation.definition.tag.begin.html", + "t": "text.html.php meta.tag.metadata.title.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -89,7 +89,7 @@ }, { "c": "title", - "t": "text.html.php meta.tag.inline.any.html entity.name.tag.inline.any.html", + "t": "text.html.php meta.tag.metadata.title.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -100,7 +100,7 @@ }, { "c": ">", - "t": "text.html.php meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.php meta.tag.metadata.title.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -122,7 +122,7 @@ }, { "c": "", - "t": "text.html.php meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.php meta.tag.metadata.title.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -155,7 +155,7 @@ }, { "c": "", - "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.php meta.tag.structure.head.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -188,7 +188,7 @@ }, { "c": "<", - "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.php meta.tag.structure.body.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -199,7 +199,7 @@ }, { "c": "body", - "t": "text.html.php meta.tag.structure.any.html entity.name.tag.structure.any.html", + "t": "text.html.php meta.tag.structure.body.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -210,7 +210,7 @@ }, { "c": ">", - "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.php meta.tag.structure.body.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3565,7 +3565,7 @@ }, { "c": "", - "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.php meta.tag.structure.body.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3598,7 +3598,7 @@ }, { "c": "", - "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.php meta.tag.structure.html.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", diff --git a/extensions/python/syntaxes/MagicPython.tmLanguage.json b/extensions/python/syntaxes/MagicPython.tmLanguage.json index 44a995bc046..fc32d74cec5 100644 --- a/extensions/python/syntaxes/MagicPython.tmLanguage.json +++ b/extensions/python/syntaxes/MagicPython.tmLanguage.json @@ -4,7 +4,7 @@ "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/MagicStack/MagicPython/commit/b453f26ed856c9b16a053517c41207e3a72cc7d5", + "version": "https://github.com/MagicStack/MagicPython/commit/fb56c6a98d684e30bed1b0f9647e85741a48f914", "name": "MagicPython", "scopeName": "source.python", "patterns": [ @@ -97,7 +97,8 @@ }, "docstring-statement": { "begin": "^(?=\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))", - "end": "(?<=\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\")", + "comment": "the string either terminates correctly or by the beginning of a new line (this is for single line docstrings that aren't terminated) AND it's not followed by another docstring", + "end": "((?<=\\1)|^)(?!\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))", "patterns": [ { "include": "#docstring" @@ -164,7 +165,7 @@ { "name": "string.quoted.docstring.single.python", "begin": "(\\'|\\\")", - "end": "(\\1)|((?=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?\n })\n )\n", + "name": "meta.format.brace.python", + "match": "(?x)\n (\n {{ | }}\n | (?:\n {\n \\w*? (\\.[[:alpha:]_]\\w*? | \\[[^\\]'\"]+\\])*?\n (![rsa])?\n ( : \\w? [<>=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?\n })\n )\n", "captures": { - "2": { - "name": "storage.type.format.python" + "1": { + "name": "constant.character.format.placeholder.other.python" }, "3": { "name": "storage.type.format.python" + }, + "4": { + "name": "storage.type.format.python" } } }, { - "name": "constant.character.format.placeholder.other.python", - "begin": "(?x)\n \\{\n \\w*? (\\.[[:alpha:]_]\\w*? | \\[[^\\]'\"]+\\])*?\n (![rsa])?\n (:)\n (?=[^'\"}\\n]*\\})\n", - "end": "\\}", - "beginCaptures": { - "2": { - "name": "storage.type.format.python" + "name": "meta.format.brace.python", + "match": "(?x)\n (\n {\n \\w*? (\\.[[:alpha:]_]\\w*? | \\[[^\\]'\"]+\\])*?\n (![rsa])?\n (:)\n (\n [^'\"{}\\n]+?\n |\n \\{ [^'\"}\\n]*? \\}\n )*\n }\n )\n", + "captures": { + "1": { + "name": "constant.character.format.placeholder.other.python" }, "3": { "name": "storage.type.format.python" + }, + "4": { + "name": "storage.type.format.python" } - }, - "patterns": [ - { - "match": "(?x) \\{ [^'\"}\\n]*? \\} (?=.*?\\})\n" - } - ] + } } ] }, @@ -4537,7 +4543,7 @@ }, "string-quoted-single-line": { "name": "string.quoted.single.python", - "begin": "(\\b[rR](?=[uU]))?([uU])?((['\"]))", + "begin": "(?:\\b([rR])(?=[uU]))?([uU])?((['\"]))", "end": "(\\3)|((?", - "t": "text.html.cshtml meta.tag.sgml.html punctuation.definition.tag.html", - "r": { - "dark_plus": "punctuation.definition.tag: #808080", - "light_plus": "punctuation.definition.tag: #800000", - "dark_vs": "punctuation.definition.tag: #808080", - "light_vs": "punctuation.definition.tag: #800000", - "hc_black": "punctuation.definition.tag: #808080" - } - }, - { - "c": "<", - "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", - "r": { - "dark_plus": "punctuation.definition.tag: #808080", - "light_plus": "punctuation.definition.tag: #800000", - "dark_vs": "punctuation.definition.tag: #808080", - "light_vs": "punctuation.definition.tag: #800000", - "hc_black": "punctuation.definition.tag: #808080" - } - }, - { - "c": "html", - "t": "text.html.cshtml meta.tag.structure.any.html entity.name.tag.structure.any.html", + "c": "DOCTYPE", + "t": "text.html.cshtml meta.tag.metadata.doctype.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1464,7 +1431,62 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.structure.any.html", + "t": "text.html.cshtml meta.tag.metadata.doctype.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "html", + "t": "text.html.cshtml meta.tag.metadata.doctype.html entity.other.attribute-name.html", + "r": { + "dark_plus": "entity.other.attribute-name: #9CDCFE", + "light_plus": "entity.other.attribute-name: #FF0000", + "dark_vs": "entity.other.attribute-name: #9CDCFE", + "light_vs": "entity.other.attribute-name: #FF0000", + "hc_black": "entity.other.attribute-name: #9CDCFE" + } + }, + { + "c": ">", + "t": "text.html.cshtml meta.tag.metadata.doctype.html punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "<", + "t": "text.html.cshtml meta.tag.structure.html.start.html punctuation.definition.tag.begin.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "html", + "t": "text.html.cshtml meta.tag.structure.html.start.html entity.name.tag.html", + "r": { + "dark_plus": "entity.name.tag: #569CD6", + "light_plus": "entity.name.tag: #800000", + "dark_vs": "entity.name.tag: #569CD6", + "light_vs": "entity.name.tag: #800000", + "hc_black": "entity.name.tag: #569CD6" + } + }, + { + "c": " ", + "t": "text.html.cshtml meta.tag.structure.html.start.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1475,7 +1497,7 @@ }, { "c": "lang", - "t": "text.html.cshtml meta.tag.structure.any.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.structure.html.start.html meta.attribute.lang.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -1486,7 +1508,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.structure.any.html", + "t": "text.html.cshtml meta.tag.structure.html.start.html meta.attribute.lang.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1497,7 +1519,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.structure.html.start.html meta.attribute.lang.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -1508,7 +1530,7 @@ }, { "c": "en", - "t": "text.html.cshtml meta.tag.structure.any.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.structure.html.start.html meta.attribute.lang.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -1519,7 +1541,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.structure.html.start.html meta.attribute.lang.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -1530,7 +1552,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.cshtml meta.tag.structure.html.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1552,7 +1574,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.cshtml meta.tag.structure.head.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1563,7 +1585,7 @@ }, { "c": "head", - "t": "text.html.cshtml meta.tag.structure.any.html entity.name.tag.structure.any.html", + "t": "text.html.cshtml meta.tag.structure.head.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1574,7 +1596,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.cshtml meta.tag.structure.head.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1596,7 +1618,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.metadata.title.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1607,7 +1629,7 @@ }, { "c": "title", - "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.metadata.title.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1618,7 +1640,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.metadata.title.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1640,7 +1662,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.metadata.title.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1684,7 +1706,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.metadata.meta.void.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1695,7 +1717,7 @@ }, { "c": "meta", - "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.metadata.meta.void.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1706,7 +1728,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.metadata.meta.void.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1717,7 +1739,7 @@ }, { "c": "charset", - "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.metadata.meta.void.html meta.attribute.charset.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -1728,7 +1750,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.metadata.meta.void.html meta.attribute.charset.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1739,7 +1761,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.metadata.meta.void.html meta.attribute.charset.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -1750,7 +1772,7 @@ }, { "c": "utf-8", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.metadata.meta.void.html meta.attribute.charset.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -1761,7 +1783,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.metadata.meta.void.html meta.attribute.charset.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -1771,8 +1793,19 @@ } }, { - "c": " />", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", + "c": " ", + "t": "text.html.cshtml meta.tag.metadata.meta.void.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "/>", + "t": "text.html.cshtml meta.tag.metadata.meta.void.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1794,7 +1827,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.cshtml meta.tag.structure.head.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1827,7 +1860,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.cshtml meta.tag.structure.body.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1838,7 +1871,7 @@ }, { "c": "body", - "t": "text.html.cshtml meta.tag.structure.any.html entity.name.tag.structure.any.html", + "t": "text.html.cshtml meta.tag.structure.body.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1849,7 +1882,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.cshtml meta.tag.structure.body.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1871,7 +1904,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1882,7 +1915,7 @@ }, { "c": "p", - "t": "text.html.cshtml meta.tag.block.any.html entity.name.tag.block.any.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1893,7 +1926,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1915,7 +1948,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.inline.strong.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1926,7 +1959,7 @@ }, { "c": "strong", - "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.inline.strong.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1937,7 +1970,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.inline.strong.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1959,7 +1992,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.inline.strong.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2003,7 +2036,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.p.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2047,7 +2080,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.form.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2058,7 +2091,7 @@ }, { "c": "form", - "t": "text.html.cshtml meta.tag.block.any.html entity.name.tag.block.any.html", + "t": "text.html.cshtml meta.tag.structure.form.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2069,7 +2102,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.block.any.html", + "t": "text.html.cshtml meta.tag.structure.form.start.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2080,7 +2113,7 @@ }, { "c": "action", - "t": "text.html.cshtml meta.tag.block.any.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.action.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2091,7 +2124,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.block.any.html", + "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.action.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2102,7 +2135,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.action.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2113,7 +2146,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.action.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2124,7 +2157,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.block.any.html", + "t": "text.html.cshtml meta.tag.structure.form.start.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2135,7 +2168,7 @@ }, { "c": "method", - "t": "text.html.cshtml meta.tag.block.any.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.method.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2146,7 +2179,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.block.any.html", + "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.method.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2157,7 +2190,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.method.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2168,7 +2201,7 @@ }, { "c": "post", - "t": "text.html.cshtml meta.tag.block.any.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.method.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2179,7 +2212,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.method.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2190,7 +2223,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.form.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2212,7 +2245,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2223,7 +2256,7 @@ }, { "c": "p", - "t": "text.html.cshtml meta.tag.block.any.html entity.name.tag.block.any.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2234,7 +2267,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2245,7 +2278,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2256,7 +2289,7 @@ }, { "c": "label", - "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2267,7 +2300,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2278,7 +2311,7 @@ }, { "c": "for", - "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2289,7 +2322,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2300,7 +2333,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2311,7 +2344,7 @@ }, { "c": "text1", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2322,7 +2355,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2333,7 +2366,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2355,7 +2388,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.label.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2399,7 +2432,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2410,7 +2443,7 @@ }, { "c": "input", - "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2421,7 +2454,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2432,7 +2465,7 @@ }, { "c": "type", - "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2443,7 +2476,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2454,7 +2487,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2465,7 +2498,7 @@ }, { "c": "text", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2476,7 +2509,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2487,7 +2520,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2498,7 +2531,7 @@ }, { "c": "name", - "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2509,7 +2542,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2520,7 +2553,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2531,7 +2564,7 @@ }, { "c": "text1", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2542,7 +2575,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2552,8 +2585,19 @@ } }, { - "c": " />", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", + "c": " ", + "t": "text.html.cshtml meta.tag.structure.input.void.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "/>", + "t": "text.html.cshtml meta.tag.structure.input.void.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2575,7 +2619,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.p.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2619,7 +2663,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2630,7 +2674,7 @@ }, { "c": "p", - "t": "text.html.cshtml meta.tag.block.any.html entity.name.tag.block.any.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2641,7 +2685,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2652,7 +2696,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2663,7 +2707,7 @@ }, { "c": "label", - "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2674,7 +2718,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2685,7 +2729,7 @@ }, { "c": "for", - "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2696,7 +2740,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2707,7 +2751,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2718,7 +2762,7 @@ }, { "c": "text2", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2729,7 +2773,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2740,7 +2784,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.label.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2762,7 +2806,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.label.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2806,7 +2850,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2817,7 +2861,7 @@ }, { "c": "input", - "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2828,7 +2872,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2839,7 +2883,7 @@ }, { "c": "type", - "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2850,7 +2894,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2861,7 +2905,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2872,7 +2916,7 @@ }, { "c": "text", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2883,7 +2927,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2894,7 +2938,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2905,7 +2949,7 @@ }, { "c": "name", - "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2916,7 +2960,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2927,7 +2971,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2938,7 +2982,7 @@ }, { "c": "text2", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2949,7 +2993,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2959,8 +3003,19 @@ } }, { - "c": " />", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", + "c": " ", + "t": "text.html.cshtml meta.tag.structure.input.void.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "/>", + "t": "text.html.cshtml meta.tag.structure.input.void.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2982,7 +3037,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.p.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3026,7 +3081,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3037,7 +3092,7 @@ }, { "c": "p", - "t": "text.html.cshtml meta.tag.block.any.html entity.name.tag.block.any.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -3048,7 +3103,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3059,7 +3114,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3070,7 +3125,7 @@ }, { "c": "input", - "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -3081,7 +3136,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -3092,7 +3147,7 @@ }, { "c": "type", - "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -3103,7 +3158,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -3114,7 +3169,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -3125,7 +3180,7 @@ }, { "c": "submit", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -3136,7 +3191,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -3147,7 +3202,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -3158,7 +3213,7 @@ }, { "c": "value", - "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.value.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -3169,7 +3224,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.inline.any.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.value.html punctuation.separator.key-value.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -3180,7 +3235,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.value.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -3191,7 +3246,7 @@ }, { "c": "Add", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.value.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -3202,7 +3257,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.value.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -3212,8 +3267,19 @@ } }, { - "c": " />", - "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", + "c": " ", + "t": "text.html.cshtml meta.tag.structure.input.void.html", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "/>", + "t": "text.html.cshtml meta.tag.structure.input.void.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3224,7 +3290,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.p.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3268,7 +3334,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.form.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3334,7 +3400,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3345,7 +3411,7 @@ }, { "c": "p", - "t": "text.html.cshtml meta.tag.block.any.html entity.name.tag.block.any.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -3356,7 +3422,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3400,7 +3466,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3411,7 +3477,7 @@ }, { "c": "p", - "t": "text.html.cshtml meta.tag.block.any.html entity.name.tag.block.any.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -3422,7 +3488,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3510,7 +3576,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.p.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3565,7 +3631,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.cshtml meta.tag.structure.body.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3598,7 +3664,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", + "t": "text.html.cshtml meta.tag.structure.html.end.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", diff --git a/extensions/xml/syntaxes/xml.tmLanguage.json b/extensions/xml/syntaxes/xml.tmLanguage.json index 532e3908f25..acebb5275ed 100644 --- a/extensions/xml/syntaxes/xml.tmLanguage.json +++ b/extensions/xml/syntaxes/xml.tmLanguage.json @@ -4,7 +4,7 @@ "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-xml/commit/27352842917b911383122bdcf98ed0d69d55c179", + "version": "https://github.com/atom/language-xml/commit/bd810deb404a12bea8ec5799fda2909349ba2654", "name": "XML", "scopeName": "text.xml", "patterns": [ @@ -350,14 +350,38 @@ ] }, "comments": { - "begin": "<[!%]--", - "captures": { - "0": { - "name": "punctuation.definition.comment.xml" + "patterns": [ + { + "begin": "<%--", + "captures": { + "0": { + "name": "punctuation.definition.comment.xml" + }, + "end": "--%>", + "name": "comment.block.xml" + } + }, + { + "begin": "", + "name": "comment.block.xml", + "patterns": [ + { + "begin": "--(?!>)", + "captures": { + "0": { + "name": "invalid.illegal.bad-comments-or-CDATA.xml" + } + } + } + ] } - }, - "end": "--%?>", - "name": "comment.block.xml" + ] } } } \ No newline at end of file From c4f336d1d69aeb8e04d6b3de3de7cbee27c6f291 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 23 Jul 2018 14:07:44 -0700 Subject: [PATCH 24/93] Fix #53887 - remove remaining PPromise usage in search --- .../api/electron-browser/mainThreadSearch.ts | 10 +-- src/vs/workbench/api/node/extHostSearch.ts | 89 +++++++++---------- 2 files changed, 47 insertions(+), 52 deletions(-) diff --git a/src/vs/workbench/api/electron-browser/mainThreadSearch.ts b/src/vs/workbench/api/electron-browser/mainThreadSearch.ts index d2fa937424f..caffd57767b 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadSearch.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadSearch.ts @@ -5,14 +5,14 @@ 'use strict'; import { isFalsyOrEmpty } from 'vs/base/common/arrays'; -import { IDisposable, dispose } from 'vs/base/common/lifecycle'; +import { dispose, IDisposable } from 'vs/base/common/lifecycle'; import { values } from 'vs/base/common/map'; import URI, { UriComponents } from 'vs/base/common/uri'; -import { PPromise, TPromise } from 'vs/base/common/winjs.base'; -import { IFileMatch, ISearchComplete, ISearchProgressItem, ISearchQuery, ISearchResultProvider, ISearchService, QueryType, IRawFileMatch2, ISearchCompleteStats } from 'vs/platform/search/common/search'; +import { TPromise } from 'vs/base/common/winjs.base'; +import { IFileMatch, IRawFileMatch2, ISearchComplete, ISearchCompleteStats, ISearchProgressItem, ISearchQuery, ISearchResultProvider, ISearchService, QueryType } from 'vs/platform/search/common/search'; +import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers'; import { ExtHostContext, ExtHostSearchShape, IExtHostContext, MainContext, MainThreadSearchShape } from '../node/extHost.protocol'; -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; @extHostNamedCustomer(MainContext.MainThreadSearch) export class MainThreadSearch implements MainThreadSearchShape { @@ -100,7 +100,7 @@ class RemoteSearchProvider implements ISearchResultProvider, IDisposable { search(query: ISearchQuery, onProgress?: (p: ISearchProgressItem) => void): TPromise { if (isFalsyOrEmpty(query.folderQueries)) { - return PPromise.as(undefined); + return TPromise.as(undefined); } const folderQueriesForScheme = query.folderQueries.filter(fq => fq.folder.scheme === this._scheme); diff --git a/src/vs/workbench/api/node/extHostSearch.ts b/src/vs/workbench/api/node/extHostSearch.ts index 35f121e588c..e7bcb39550d 100644 --- a/src/vs/workbench/api/node/extHostSearch.ts +++ b/src/vs/workbench/api/node/extHostSearch.ts @@ -10,7 +10,7 @@ import { toErrorMessage } from 'vs/base/common/errorMessage'; import * as glob from 'vs/base/common/glob'; import * as resources from 'vs/base/common/resources'; import URI, { UriComponents } from 'vs/base/common/uri'; -import { PPromise, TPromise } from 'vs/base/common/winjs.base'; +import { TPromise } from 'vs/base/common/winjs.base'; import * as extfs from 'vs/base/node/extfs'; import { IFileMatch, IFolderQuery, IPatternInfo, IRawSearchQuery, ISearchCompleteStats, ISearchQuery } from 'vs/platform/search/common/search'; import * as vscode from 'vscode'; @@ -58,12 +58,9 @@ export class ExtHostSearch implements ExtHostSearchShape { } const query = reviveQuery(rawQuery); - return this._fileSearchManager.fileSearch(query, provider).then( - null, - null, - progress => { - this._proxy.$handleFileMatch(handle, session, progress.map(p => p.resource)); - }); + return this._fileSearchManager.fileSearch(query, provider, progress => { + this._proxy.$handleFileMatch(handle, session, progress.map(p => p.resource)); + }); } $clearCache(handle: number, cacheKey: string): TPromise { @@ -84,12 +81,7 @@ export class ExtHostSearch implements ExtHostSearchShape { const query = reviveQuery(rawQuery); const engine = new TextSearchEngine(pattern, query, provider, this._extfs); - return engine.search().then( - null, - null, - progress => { - this._proxy.$handleTextMatch(handle, session, progress); - }); + return engine.search(progress => this._proxy.$handleTextMatch(handle, session, progress)); } } @@ -380,11 +372,11 @@ class TextSearchEngine { this.activeCancellationTokens = new Set(); } - public search(): PPromise<{ limitHit: boolean }, IFileMatch[]> { + public search(onProgress: (matches: IFileMatch[]) => void): TPromise<{ limitHit: boolean }> { const folderQueries = this.config.folderQueries; - return new PPromise<{ limitHit: boolean }, IFileMatch[]>((resolve, reject, _onResult) => { - this.collector = new TextSearchResultsCollector(_onResult); + return new TPromise<{ limitHit: boolean }>((resolve, reject) => { + this.collector = new TextSearchResultsCollector(onProgress); const onResult = (match: vscode.TextSearchResult, folderIdx: number) => { if (this.isCanceled) { @@ -403,8 +395,8 @@ class TextSearchEngine { }; // For each root folder - PPromise.join(folderQueries.map((fq, i) => { - return this.searchInFolder(fq).then(null, null, r => onResult(r, i)); + TPromise.join(folderQueries.map((fq, i) => { + return this.searchInFolder(fq, r => onResult(r, i)); })).then(() => { this.collector.flush(); resolve({ limitHit: this.isLimitHit }); @@ -418,9 +410,9 @@ class TextSearchEngine { }); } - private searchInFolder(folderQuery: IFolderQuery): PPromise { + private searchInFolder(folderQuery: IFolderQuery, onResult: (result: vscode.TextSearchResult) => void): TPromise { let cancellation = new CancellationTokenSource(); - return new PPromise((resolve, reject, onResult) => { + return new TPromise((resolve, reject) => { const queryTester = new QueryGlobTester(this.config, folderQuery); const testingPs = []; @@ -532,10 +524,10 @@ class FileSearchEngine { this.activeCancellationTokens = new Set(); } - public search(): PPromise { + public search(_onResult: (match: IInternalFileMatch) => void): TPromise { const folderQueries = this.config.folderQueries; - return new PPromise((resolve, reject, _onResult) => { + return new TPromise((resolve, reject) => { const onResult = (match: IInternalFileMatch) => { this.resultCount++; _onResult(match); @@ -562,8 +554,8 @@ class FileSearchEngine { } // For each root folder - PPromise.join(folderQueries.map(fq => { - return this.searchInFolder(fq).then(null, null, onResult); + TPromise.join(folderQueries.map(fq => { + return this.searchInFolder(fq, onResult); })).then(cacheKeys => { resolve({ limitHit: this.isLimitHit, cacheKeys }); }, (errs: Error[]) => { @@ -576,9 +568,9 @@ class FileSearchEngine { }); } - private searchInFolder(fq: IFolderQuery): PPromise { + private searchInFolder(fq: IFolderQuery, onResult: (match: IInternalFileMatch) => void): TPromise { let cancellation = new CancellationTokenSource(); - return new PPromise((resolve, reject, onResult) => { + return new TPromise((resolve, reject) => { const options = this.getSearchOptionsForFolder(fq); const tree = this.initDirectoryTree(); @@ -748,12 +740,16 @@ class FileSearchManager { private readonly expandedCacheKeys = new Map(); - fileSearch(config: ISearchQuery, provider: vscode.SearchProvider): PPromise { - let searchP: PPromise; - return new PPromise((c, e, p) => { + fileSearch(config: ISearchQuery, provider: vscode.SearchProvider, onResult: (matches: IFileMatch[]) => void): TPromise { + let searchP: TPromise; + return new TPromise((c, e) => { const engine = new FileSearchEngine(config, provider); - searchP = this.doSearch(engine, FileSearchManager.BATCH_SIZE).then( + const onInternalResult = (progress: IInternalFileMatch[]) => { + onResult(progress.map(m => this.rawMatchToSearchItem(m))); + }; + + searchP = this.doSearch(engine, FileSearchManager.BATCH_SIZE, onInternalResult).then( result => { if (config.cacheKey) { this.expandedCacheKeys.set(config.cacheKey, result.cacheKeys); @@ -763,10 +759,7 @@ class FileSearchManager { limitHit: result.limitHit }); }, - e, - progress => { - p(progress.map(m => this.rawMatchToSearchItem(m))); - }); + e); }, () => { if (searchP) { searchP.cancel(); @@ -789,29 +782,31 @@ class FileSearchManager { }; } - private doSearch(engine: FileSearchEngine, batchSize: number): PPromise { - return new PPromise((c, e, p) => { + private doSearch(engine: FileSearchEngine, batchSize: number, onResultBatch: (matches: IInternalFileMatch[]) => void): TPromise { + return new TPromise((c, e) => { + const _onResult = match => { + if (match) { + batch.push(match); + if (batchSize > 0 && batch.length >= batchSize) { + onResultBatch(batch); + batch = []; + } + } + }; + let batch: IInternalFileMatch[] = []; - engine.search().then(result => { + engine.search(_onResult).then(result => { if (batch.length) { - p(batch); + onResultBatch(batch); } c(result); }, error => { if (batch.length) { - p(batch); + onResultBatch(batch); } e(error); - }, match => { - if (match) { - batch.push(match); - if (batchSize > 0 && batch.length >= batchSize) { - p(batch); - batch = []; - } - } }); }, () => { engine.cancel(); From b9d02589ac2070581cc6ea33b8c3478164512293 Mon Sep 17 00:00:00 2001 From: Ramya Achutha Rao Date: Mon, 23 Jul 2018 14:52:50 -0700 Subject: [PATCH 25/93] Update opt out msg --- .../electron-browser/telemetryOptOut.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/telemetryOptOut.ts b/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/telemetryOptOut.ts index 32cd90f5570..257d791463e 100644 --- a/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/telemetryOptOut.ts +++ b/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/telemetryOptOut.ts @@ -45,29 +45,30 @@ export class TelemetryOptOut implements IWorkbenchContribution { } storageService.store(TelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, true); + const optOutUrl = product.telemetryOptOutUrl; + const privacyUrl = product.privacyStatementUrl || product.telemetryOptOutUrl; + if (experimentState && experimentState.state === ExperimentState.Run && telemetryService.isOptedIn) { notificationService.prompt( Severity.Info, - localize('telemetryOptOut.optOutOption', "Microsoft collects usage data to improve VS Code. You may choose to opt out."), + localize('telemetryOptOut.optOutOption', "Please help Microsoft improve Visual Studio Code by allowing the collection of usage data. Read our [privacy statement]({0}) for more details.", privacyUrl), [ { - label: localize('telemetryOptOut.OptOut', "Opt out"), + label: localize('telemetryOptOut.OptIn', "Yes, glad to help"), + run: () => { } + }, + { + label: localize('telemetryOptOut.OptOut', "No, thanks"), run: () => { configurationService.updateValue('telemetry.enableTelemetry', false); configurationService.updateValue('telemetry.enableCrashReporter', false); } - }, - { - label: localize('telemetryOptOut.readMore', "Read More"), - run: () => openerService.open(URI.parse(product.telemetryOptOutUrl)) }] ); experimentService.markAsCompleted(experimentId); return; } - const optOutUrl = product.telemetryOptOutUrl; - const privacyUrl = product.privacyStatementUrl || product.telemetryOptOutUrl; const optOutNotice = localize('telemetryOptOut.optOutNotice', "Help improve VS Code by allowing Microsoft to collect usage data. Read our [privacy statement]({0}) and learn how to [opt out]({1}).", privacyUrl, optOutUrl); const optInNotice = localize('telemetryOptOut.optInNotice', "Help improve VS Code by allowing Microsoft to collect usage data. Read our [privacy statement]({0}) and learn how to [opt in]({1}).", privacyUrl, optOutUrl); From a7e3183cee6a1df053788a5f19726386eb7e69d3 Mon Sep 17 00:00:00 2001 From: Ramya Achutha Rao Date: Mon, 23 Jul 2018 14:53:08 -0700 Subject: [PATCH 26/93] Enable experiments --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a0af247bb1f..c6edb5d8f3a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.26.0", - "distro": "ba277984505f7010dbff765d57412a25891b4dea", + "distro": "4b5c6aa6ea6f222d62d08ca5653049b200be93a5", "author": { "name": "Microsoft Corporation" }, From e9fb3b2eaac3f038934d1f05403ee71248980846 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 23 Jul 2018 15:00:44 -0700 Subject: [PATCH 27/93] Remove old show unused settings You should use `editor.showUnused` instead. Possibly with a language specific setting: ``` "[typescript]": { "editor.showUnused": false } ``` --- extensions/typescript-language-features/package.json | 12 ------------ .../typescript-language-features/package.nls.json | 1 - 2 files changed, 13 deletions(-) diff --git a/extensions/typescript-language-features/package.json b/extensions/typescript-language-features/package.json index 6ad08cfc974..64333012a25 100644 --- a/extensions/typescript-language-features/package.json +++ b/extensions/typescript-language-features/package.json @@ -477,18 +477,6 @@ "description": "%typescript.preferences.importModuleSpecifier%", "scope": "resource" }, - "javascript.showUnused": { - "type": "boolean", - "default": true, - "description": "%typescript.showUnused%", - "scope": "resource" - }, - "typescript.showUnused": { - "type": "boolean", - "default": true, - "description": "%typescript.showUnused%", - "scope": "resource" - }, "typescript.updateImportsOnFileMove.enabled": { "type": "string", "enum": [ diff --git a/extensions/typescript-language-features/package.nls.json b/extensions/typescript-language-features/package.nls.json index 6876a3706ab..76a98bca9ca 100644 --- a/extensions/typescript-language-features/package.nls.json +++ b/extensions/typescript-language-features/package.nls.json @@ -54,7 +54,6 @@ "typescript.suggestionActions.enabled": "Enable/disable suggestion diagnostics for TypeScript files in the editor. Requires using TypeScript 2.8 or newer in the workspace.", "typescript.preferences.quoteStyle": "Preferred quote style to use for quick fixes: 'single' quotes, 'double' quotes, or 'auto' infer quote type from existing imports. Requires using TypeScript 2.9 or newer in the workspace.", "typescript.preferences.importModuleSpecifier": "Preferred path style for auto imports:\n- \"relative\" to the file location.\n- \"non-relative\" based on the 'baseUrl' configured in your 'jsconfig.json' / 'tsconfig.json'.\n- \"auto\" infer the shortest path type.\nRequires using TypeScript 2.9 or newer in the workspace.", - "typescript.showUnused": "Enable/disable highlighting of unused variables in code. Requires using TypeScript 2.9 or newer in the workspace.", "typescript.updateImportsOnFileMove.enabled": "Enable/disable automatic updating of import paths when you rename or move a file in VS Code. Possible values are: 'prompt' on each rename, 'always' update paths automatically, and 'never' rename paths and don't prompt me. Requires using TypeScript 2.9 or newer in the workspace.", "typescript.autoClosingTags": "Enable/disable automatic closing of JSX tags. Requires using TypeScript 3.0 or newer in the workspace." } From f0b8ca75026cebdc261366ade668997bcd44c436 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 23 Jul 2018 15:09:09 -0700 Subject: [PATCH 28/93] Prevent duplicate terminal API data and input events from firing Fixes #54096 --- .../mainThreadTerminalService.ts | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts b/src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts index ccf129ce117..c25e31ae085 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts @@ -16,6 +16,8 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape private _proxy: ExtHostTerminalServiceShape; private _toDispose: IDisposable[] = []; private _terminalProcesses: { [id: number]: ITerminalProcessExtHostProxy } = {}; + private _terminalOnDidWriteDataListeners: { [id: number]: IDisposable } = {}; + private _terminalOnDidAcceptInputListeners: { [id: number]: IDisposable } = {}; constructor( extHostContext: IExtHostContext, @@ -114,9 +116,18 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape public $terminalRendererRegisterOnInputListener(terminalId: number): void { const terminalInstance = this.terminalService.getInstanceFromId(terminalId); - if (terminalInstance) { - terminalInstance.addDisposable(terminalInstance.onRendererInput(data => this._onTerminalRendererInput(terminalId, data))); + if (!terminalInstance) { + return; } + + // Listener already registered + if (this._terminalOnDidAcceptInputListeners.hasOwnProperty(terminalId)) { + return; + } + + // Register + this._terminalOnDidAcceptInputListeners[terminalId] = terminalInstance.onRendererInput(data => this._onTerminalRendererInput(terminalId, data)); + terminalInstance.addDisposable(this._terminalOnDidAcceptInputListeners[terminalId]); } public $sendText(terminalId: number, text: string, addNewLine: boolean): void { @@ -128,11 +139,20 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape public $registerOnDataListener(terminalId: number): void { const terminalInstance = this.terminalService.getInstanceFromId(terminalId); - if (terminalInstance) { - terminalInstance.addDisposable(terminalInstance.onData(data => { - this._onTerminalData(terminalId, data); - })); + if (!terminalInstance) { + return; } + + // Listener already registered + if (this._terminalOnDidWriteDataListeners[terminalId]) { + return; + } + + // Register + this._terminalOnDidWriteDataListeners[terminalId] = terminalInstance.onData(data => { + this._onTerminalData(terminalId, data); + }); + terminalInstance.addDisposable(this._terminalOnDidWriteDataListeners[terminalId]); } private _onActiveTerminalChanged(terminalId: number | undefined): void { From caeb292922e0e2a4be26f915881ec44fe37cbdd9 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 23 Jul 2018 15:16:57 -0700 Subject: [PATCH 29/93] Upgrade vscode-xterm - Fix dom renderer argument order bug - Fix isWrapped NPE - Fix charset drawing (bug with static char atlas) Fixes #54131 --- package.json | 4 ++-- yarn.lock | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c6edb5d8f3a..a1160502b0d 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "vscode-nsfw": "1.0.17", "vscode-ripgrep": "^1.0.1", "vscode-textmate": "^4.0.1", - "vscode-xterm": "3.6.0-beta3", + "vscode-xterm": "3.6.0-beta4", "yauzl": "^2.9.1" }, "devDependencies": { @@ -138,4 +138,4 @@ "windows-mutex": "^0.2.0", "windows-process-tree": "0.2.2" } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index cb804128177..61ba73fadd6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6256,9 +6256,9 @@ vscode-textmate@^4.0.1: dependencies: oniguruma "^7.0.0" -vscode-xterm@3.6.0-beta3: - version "3.6.0-beta3" - resolved "https://registry.yarnpkg.com/vscode-xterm/-/vscode-xterm-3.6.0-beta3.tgz#fe383ff8df66603088e36c1f9ac987b0de68bd1b" +vscode-xterm@3.6.0-beta4: + version "3.6.0-beta4" + resolved "https://registry.yarnpkg.com/vscode-xterm/-/vscode-xterm-3.6.0-beta4.tgz#27ffa2d6c0acf33bb6a1c8499455d9156b9035ae" vso-node-api@^6.1.2-preview: version "6.1.2-preview" From b096fb256d8d27f0c10486fb654859be0dea2601 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 23 Jul 2018 15:11:54 -0700 Subject: [PATCH 30/93] Use enumDescriptions --- extensions/typescript-language-features/package.json | 5 +++++ extensions/typescript-language-features/package.nls.json | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/extensions/typescript-language-features/package.json b/extensions/typescript-language-features/package.json index 64333012a25..3692fc231fa 100644 --- a/extensions/typescript-language-features/package.json +++ b/extensions/typescript-language-features/package.json @@ -462,6 +462,11 @@ "relative", "non-relative" ], + "enumDescriptions": [ + "%typescript.preferences.importModuleSpecifier.auto%", + "%typescript.preferences.importModuleSpecifier.relative%", + "%typescript.preferences.importModuleSpecifier.nonRelative%" + ], "default": "auto", "description": "%typescript.preferences.importModuleSpecifier%", "scope": "resource" diff --git a/extensions/typescript-language-features/package.nls.json b/extensions/typescript-language-features/package.nls.json index 76a98bca9ca..8b7c103ded0 100644 --- a/extensions/typescript-language-features/package.nls.json +++ b/extensions/typescript-language-features/package.nls.json @@ -53,7 +53,10 @@ "javascript.suggestionActions.enabled": "Enable/disable suggestion diagnostics for JavaScript files in the editor. Requires using TypeScript 2.8 or newer in the workspace.", "typescript.suggestionActions.enabled": "Enable/disable suggestion diagnostics for TypeScript files in the editor. Requires using TypeScript 2.8 or newer in the workspace.", "typescript.preferences.quoteStyle": "Preferred quote style to use for quick fixes: 'single' quotes, 'double' quotes, or 'auto' infer quote type from existing imports. Requires using TypeScript 2.9 or newer in the workspace.", - "typescript.preferences.importModuleSpecifier": "Preferred path style for auto imports:\n- \"relative\" to the file location.\n- \"non-relative\" based on the 'baseUrl' configured in your 'jsconfig.json' / 'tsconfig.json'.\n- \"auto\" infer the shortest path type.\nRequires using TypeScript 2.9 or newer in the workspace.", + "typescript.preferences.importModuleSpecifier": "Preferred path style for auto imports.", + "typescript.preferences.importModuleSpecifier.auto": "Infer the shortest path type.", + "typescript.preferences.importModuleSpecifier.relative": "Relative to the file location.", + "typescript.preferences.importModuleSpecifier.nonRelative": "Based on the `baseUrl` configured in your `jsconfig.json` / `tsconfig.json`.", "typescript.updateImportsOnFileMove.enabled": "Enable/disable automatic updating of import paths when you rename or move a file in VS Code. Possible values are: 'prompt' on each rename, 'always' update paths automatically, and 'never' rename paths and don't prompt me. Requires using TypeScript 2.9 or newer in the workspace.", "typescript.autoClosingTags": "Enable/disable automatic closing of JSX tags. Requires using TypeScript 3.0 or newer in the workspace." -} +} \ No newline at end of file From 5a148fa9a3b5a2c65a54aae8da7d37ee66872b00 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 23 Jul 2018 15:13:50 -0700 Subject: [PATCH 31/93] Use code in setting --- extensions/typescript-language-features/package.nls.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/typescript-language-features/package.nls.json b/extensions/typescript-language-features/package.nls.json index 8b7c103ded0..737a4fe5e21 100644 --- a/extensions/typescript-language-features/package.nls.json +++ b/extensions/typescript-language-features/package.nls.json @@ -15,7 +15,7 @@ "javascript.format.enable": "Enable/disable default JavaScript formatter.", "format.insertSpaceAfterCommaDelimiter": "Defines space handling after a comma delimiter.", "format.insertSpaceAfterConstructor": "Defines space handling after the constructor keyword. Requires using TypeScript 2.3.0 or newer in the workspace.", - "format.insertSpaceAfterSemicolonInForStatements": " Defines space handling after a semicolon in a for statement.", + "format.insertSpaceAfterSemicolonInForStatements": "Defines space handling after a semicolon in a for statement.", "format.insertSpaceBeforeAndAfterBinaryOperators": "Defines space handling after a binary operator.", "format.insertSpaceAfterKeywordsInControlFlowStatements": "Defines space handling after keywords in a control flow statement.", "format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": "Defines space handling after function keyword for anonymous functions.", @@ -47,7 +47,7 @@ "typescript.problemMatchers.tscWatch.label": "TypeScript problems (watch mode)", "typescript.quickSuggestionsForPaths": "Enable/disable quick suggestions when typing out an import path.", "typescript.locale": "Sets the locale used to report JavaScript and TypeScript errors. Requires using TypeScript 2.6.0 or newer in the workspace. Default of 'null' uses VS Code's locale.", - "javascript.implicitProjectConfig.experimentalDecorators": "Enable/disable 'experimentalDecorators' for JavaScript files that are not part of a project. Existing jsconfig.json or tsconfig.json files override this setting. Requires using TypeScript 2.3.1 or newer in the workspace.", + "javascript.implicitProjectConfig.experimentalDecorators": "Enable/disable `experimentalDecorators` for JavaScript files that are not part of a project. Existing jsconfig.json or tsconfig.json files override this setting. Requires using TypeScript 2.3.1 or newer in the workspace.", "typescript.autoImportSuggestions.enabled": "Enable/disable auto import suggestions. Requires using TypeScript 2.6.1 or newer in the workspace.", "taskDefinition.tsconfig.description": "The tsconfig file that defines the TS build.", "javascript.suggestionActions.enabled": "Enable/disable suggestion diagnostics for JavaScript files in the editor. Requires using TypeScript 2.8 or newer in the workspace.", From 1f69e116243aa2399012c4a64af235c5366255da Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 23 Jul 2018 15:15:30 -0700 Subject: [PATCH 32/93] Add periods for setting descriptions --- .../editor/common/config/commonEditorConfig.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index deb7e9526c3..9757d591dfc 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -510,13 +510,13 @@ const editorConfiguration: IConfigurationNode = { 'editor.suggestOnTriggerCharacters': { 'type': 'boolean', 'default': EDITOR_DEFAULTS.contribInfo.suggestOnTriggerCharacters, - 'description': nls.localize('suggestOnTriggerCharacters', "Controls if suggestions should automatically show up when typing trigger characters") + 'description': nls.localize('suggestOnTriggerCharacters', "Controls if suggestions should automatically show up when typing trigger characters.") }, 'editor.acceptSuggestionOnEnter': { 'type': 'string', 'enum': ['on', 'smart', 'off'], 'default': EDITOR_DEFAULTS.contribInfo.acceptSuggestionOnEnter, - 'description': nls.localize('acceptSuggestionOnEnter', "Controls if suggestions should be accepted on 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions. The value 'smart' means only accept a suggestion with Enter when it makes a textual change") + 'description': nls.localize('acceptSuggestionOnEnter', "Controls if suggestions should be accepted on 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions. The value 'smart' means only accept a suggestion with Enter when it makes a textual change.") }, 'editor.acceptSuggestionOnCommitCharacter': { 'type': 'boolean', @@ -560,13 +560,13 @@ const editorConfiguration: IConfigurationNode = { 'type': 'integer', 'default': 0, 'minimum': 0, - 'description': nls.localize('suggestFontSize', "Font size for the suggest widget") + 'description': nls.localize('suggestFontSize', "Font size for the suggest widget.") }, 'editor.suggestLineHeight': { 'type': 'integer', 'default': 0, 'minimum': 0, - 'description': nls.localize('suggestLineHeight', "Line height for the suggest widget") + 'description': nls.localize('suggestLineHeight', "Line height for the suggest widget.") }, 'editor.suggest.filterGraceful': { type: 'boolean', @@ -586,12 +586,12 @@ const editorConfiguration: IConfigurationNode = { 'editor.occurrencesHighlight': { 'type': 'boolean', 'default': EDITOR_DEFAULTS.contribInfo.occurrencesHighlight, - 'description': nls.localize('occurrencesHighlight', "Controls whether the editor should highlight semantic symbol occurrences") + 'description': nls.localize('occurrencesHighlight', "Controls whether the editor should highlight semantic symbol occurrences.") }, 'editor.overviewRulerLanes': { 'type': 'integer', 'default': 3, - 'description': nls.localize('overviewRulerLanes', "Controls the number of decorations that can show up at the same position in the overview ruler") + 'description': nls.localize('overviewRulerLanes', "Controls the number of decorations that can show up at the same position in the overview ruler.") }, 'editor.overviewRulerBorder': { 'type': 'boolean', @@ -607,7 +607,7 @@ const editorConfiguration: IConfigurationNode = { 'editor.mouseWheelZoom': { 'type': 'boolean', 'default': EDITOR_DEFAULTS.viewInfo.mouseWheelZoom, - 'description': nls.localize('mouseWheelZoom', "Zoom the font of the editor when using mouse wheel and holding Ctrl") + 'description': nls.localize('mouseWheelZoom', "Zoom the font of the editor when using mouse wheel and holding Ctrl.") }, 'editor.cursorStyle': { 'type': 'string', @@ -644,12 +644,12 @@ const editorConfiguration: IConfigurationNode = { 'editor.renderControlCharacters': { 'type': 'boolean', default: EDITOR_DEFAULTS.viewInfo.renderControlCharacters, - description: nls.localize('renderControlCharacters', "Controls whether the editor should render control characters") + description: nls.localize('renderControlCharacters', "Controls whether the editor should render control characters.") }, 'editor.renderIndentGuides': { 'type': 'boolean', default: EDITOR_DEFAULTS.viewInfo.renderIndentGuides, - description: nls.localize('renderIndentGuides', "Controls whether the editor should render indent guides") + description: nls.localize('renderIndentGuides', "Controls whether the editor should render indent guides.") }, 'editor.highlightActiveIndentGuide': { 'type': 'boolean', From 9246087c0419bf0ede9f44978b8dee3539ea648f Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 23 Jul 2018 15:22:51 -0700 Subject: [PATCH 33/93] Updatting setting descriptions --- src/vs/editor/common/config/commonEditorConfig.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index 9757d591dfc..adaf242cb6f 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -276,7 +276,7 @@ const editorConfiguration: IConfigurationNode = { 'editor.wordSeparators': { 'type': 'string', 'default': EDITOR_DEFAULTS.wordSeparators, - 'description': nls.localize('wordSeparators', "Characters that will be used as word separators when doing word related navigations or operations") + 'description': nls.localize('wordSeparators', "Characters that will be used as word separators when doing word related navigations or operations.") }, 'editor.tabSize': { 'type': 'number', @@ -418,8 +418,14 @@ const editorConfiguration: IConfigurationNode = { 'editor.wrappingIndent': { 'type': 'string', 'enum': ['none', 'same', 'indent', 'deepIndent'], + enumDescriptions: [ + nls.localize('wrappingIndent.none', "No indentation. Wrapped lines begin at column 1."), + nls.localize('wrappingIndent.same', "Wrapped lines get the same indentation as the parent."), + nls.localize('wrappingIndent.indent', "Wrapped lines get +1 indentation toward the parent."), + nls.localize('wrappingIndent.deepIndent', "Wrapped lines get +2 indentation toward the parent."), + ], 'default': 'same', - 'description': nls.localize('wrappingIndent', "Controls the indentation of wrapped lines. Can be one of 'none', 'same', 'indent' or 'deepIndent'.") + 'description': nls.localize('wrappingIndent', "Controls the indentation of wrapped lines."), }, 'editor.mouseWheelScrollSensitivity': { 'type': 'number', @@ -701,12 +707,12 @@ const editorConfiguration: IConfigurationNode = { 'editor.useTabStops': { 'type': 'boolean', 'default': EDITOR_DEFAULTS.useTabStops, - 'description': nls.localize('useTabStops', "Inserting and deleting whitespace follows tab stops") + 'description': nls.localize('useTabStops', "Inserting and deleting whitespace follows tab stops.") }, 'editor.trimAutoWhitespace': { 'type': 'boolean', 'default': EDITOR_MODEL_DEFAULTS.trimAutoWhitespace, - 'description': nls.localize('trimAutoWhitespace', "Remove trailing auto inserted whitespace") + 'description': nls.localize('trimAutoWhitespace', "Remove trailing auto inserted whitespace.") }, 'editor.stablePeek': { 'type': 'boolean', From f9eeb0759f6dc8cf06205a5337072ee353b28cd3 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 23 Jul 2018 15:26:21 -0700 Subject: [PATCH 34/93] Cleaning up emmet setting descriptions --- extensions/emmet/package.nls.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/extensions/emmet/package.nls.json b/extensions/emmet/package.nls.json index d43ba09bc46..3f3bf912fd8 100644 --- a/extensions/emmet/package.nls.json +++ b/extensions/emmet/package.nls.json @@ -25,10 +25,10 @@ "command.decrementNumberByTen": "Decrement by 10", "emmetSyntaxProfiles": "Define profile for specified syntax or use your own profile with specific rules.", "emmetExclude": "An array of languages where Emmet abbreviations should not be expanded.", - "emmetExtensionsPath": "Path to a folder containing Emmet profiles and snippets.'", - "emmetShowExpandedAbbreviation": "Shows expanded Emmet abbreviations as suggestions.\nThe option \"inMarkupAndStylesheetFilesOnly\" applies to html, haml, jade, slim, xml, xsl, css, scss, sass, less and stylus.\nThe option \"always\" applies to all parts of the file regardless of markup/css.", - "emmetShowAbbreviationSuggestions": "Shows possible Emmet abbreviations as suggestions. Not applicable in stylesheets or when emmet.showExpandedAbbreviation is set to \"never\".", - "emmetIncludeLanguages": "Enable Emmet abbreviations in languages that are not supported by default. Add a mapping here between the language and emmet supported language.\n E.g.: {\"vue-html\": \"html\", \"javascript\": \"javascriptreact\"}", + "emmetExtensionsPath": "Path to a folder containing Emmet profiles and snippets.", + "emmetShowExpandedAbbreviation": "Shows expanded Emmet abbreviations as suggestions.\nThe option `\"inMarkupAndStylesheetFilesOnly\"` applies to html, haml, jade, slim, xml, xsl, css, scss, sass, less and stylus.\nThe option `\"always\"` applies to all parts of the file regardless of markup/css.", + "emmetShowAbbreviationSuggestions": "Shows possible Emmet abbreviations as suggestions. Not applicable in stylesheets or when emmet.showExpandedAbbreviation is set to `\"never\"`.", + "emmetIncludeLanguages": "Enable Emmet abbreviations in languages that are not supported by default. Add a mapping here between the language and emmet supported language.\n E.g.: `{\"vue-html\": \"html\", \"javascript\": \"javascriptreact\"}`", "emmetVariables": "Variables to be used in Emmet snippets", "emmetTriggerExpansionOnTab": "When enabled, Emmet abbreviations are expanded when pressing TAB.", "emmetPreferences": "Preferences used to modify behavior of some actions and resolvers of Emmet.", @@ -40,7 +40,7 @@ "emmetPreferencesCssBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations", "emmetPreferencesSassBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Sass files", "emmetPreferencesStylusBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Stylus files", - "emmetShowSuggestionsAsSnippets": "If true, then Emmet suggestions will show up as snippets allowing you to order them as per editor.snippetSuggestions setting.", + "emmetShowSuggestionsAsSnippets": "If `true`, then Emmet suggestions will show up as snippets allowing you to order them as per `#editor.snippetSuggestions#` setting.", "emmetPreferencesBemElementSeparator": "Element separator used for classes when using the BEM filter", "emmetPreferencesBemModifierSeparator": "Modifier separator used for classes when using the BEM filter", "emmetPreferencesFilterCommentBefore": "A definition of comment that should be placed before matched element when comment filter is applied.", @@ -54,5 +54,5 @@ "emmetPreferencesCssOProperties": "Comma separated CSS properties that get the 'o' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'o' prefix.", "emmetPreferencesCssMsProperties": "Comma separated CSS properties that get the 'ms' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'ms' prefix.", "emmetPreferencesCssFuzzySearchMinScore": "The minimum score (from 0 to 1) that fuzzy-matched abbreviation should achieve. Lower values may produce many false-positive matches, higher values may reduce possible matches.", - "emmetOptimizeStylesheetParsing": "When set to false, the whole file is parsed to determine if current position is valid for expanding Emmet abbreviations. When set to true, only the content around the current position in css/scss/less files is parsed." + "emmetOptimizeStylesheetParsing": "When set to `false`, the whole file is parsed to determine if current position is valid for expanding Emmet abbreviations. When set to `true`, only the content around the current position in css/scss/less files is parsed." } From b8c522b175f554f227327a4e340c2d78daa96b66 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 23 Jul 2018 15:31:32 -0700 Subject: [PATCH 35/93] Updating colorization tests --- .../test/colorize-results/test-33886_md.json | 36 +- .../test/colorize-results/test_md.json | 140 +++--- .../colorize-results/issue-28354_php.json | 14 +- .../php/test/colorize-results/test_php.json | 48 +- .../test/colorize-results/test_cshtml.json | 410 ++++++++---------- 5 files changed, 302 insertions(+), 346 deletions(-) diff --git a/extensions/markdown-basics/test/colorize-results/test-33886_md.json b/extensions/markdown-basics/test/colorize-results/test-33886_md.json index 179172a5738..185d172e8af 100644 --- a/extensions/markdown-basics/test/colorize-results/test-33886_md.json +++ b/extensions/markdown-basics/test/colorize-results/test-33886_md.json @@ -34,7 +34,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.tag.structure.pre.start.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -45,7 +45,7 @@ }, { "c": "pre", - "t": "text.html.markdown meta.tag.structure.pre.start.html entity.name.tag.html", + "t": "text.html.markdown meta.tag.block.any.html entity.name.tag.block.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -56,7 +56,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.tag.structure.pre.start.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -67,7 +67,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.tag.inline.code.start.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.tag.inline.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -78,7 +78,7 @@ }, { "c": "code", - "t": "text.html.markdown meta.tag.inline.code.start.html entity.name.tag.html", + "t": "text.html.markdown meta.tag.inline.any.html entity.name.tag.inline.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -89,7 +89,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.tag.inline.code.start.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -111,7 +111,7 @@ }, { "c": "", - "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.code.end.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -144,7 +144,7 @@ }, { "c": "", - "t": "text.html.markdown meta.paragraph.markdown meta.tag.structure.pre.end.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.paragraph.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -210,7 +210,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.tag.structure.pre.start.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -221,7 +221,7 @@ }, { "c": "pre", - "t": "text.html.markdown meta.tag.structure.pre.start.html entity.name.tag.html", + "t": "text.html.markdown meta.tag.block.any.html entity.name.tag.block.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -232,7 +232,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.tag.structure.pre.start.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -265,7 +265,7 @@ }, { "c": "", - "t": "text.html.markdown meta.paragraph.markdown meta.tag.structure.pre.end.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.paragraph.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", diff --git a/extensions/markdown-basics/test/colorize-results/test_md.json b/extensions/markdown-basics/test/colorize-results/test_md.json index 4eb1e2fc5d9..eb09a71c815 100644 --- a/extensions/markdown-basics/test/colorize-results/test_md.json +++ b/extensions/markdown-basics/test/colorize-results/test_md.json @@ -331,7 +331,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.tag.structure.div.start.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -342,7 +342,7 @@ }, { "c": "div", - "t": "text.html.markdown meta.tag.structure.div.start.html entity.name.tag.html", + "t": "text.html.markdown meta.tag.block.any.html entity.name.tag.block.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -353,7 +353,7 @@ }, { "c": " ", - "t": "text.html.markdown meta.tag.structure.div.start.html", + "t": "text.html.markdown meta.tag.block.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -364,7 +364,7 @@ }, { "c": "class", - "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.class.html entity.other.attribute-name.html", + "t": "text.html.markdown meta.tag.block.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -375,7 +375,7 @@ }, { "c": "=", - "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.class.html punctuation.separator.key-value.html", + "t": "text.html.markdown meta.tag.block.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -386,7 +386,7 @@ }, { "c": "\"", - "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.class.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.markdown meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -397,7 +397,7 @@ }, { "c": "custom-class", - "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.class.html string.quoted.double.html", + "t": "text.html.markdown meta.tag.block.any.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -408,7 +408,7 @@ }, { "c": "\"", - "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.class.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.markdown meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -419,7 +419,7 @@ }, { "c": " ", - "t": "text.html.markdown meta.tag.structure.div.start.html", + "t": "text.html.markdown meta.tag.block.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -430,7 +430,7 @@ }, { "c": "markdown", - "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.unrecognized.markdown.html entity.other.attribute-name.html", + "t": "text.html.markdown meta.tag.block.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -441,7 +441,7 @@ }, { "c": "=", - "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.unrecognized.markdown.html punctuation.separator.key-value.html", + "t": "text.html.markdown meta.tag.block.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -452,7 +452,7 @@ }, { "c": "\"", - "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.unrecognized.markdown.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.markdown meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -463,7 +463,7 @@ }, { "c": "1", - "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.unrecognized.markdown.html string.quoted.double.html", + "t": "text.html.markdown meta.tag.block.any.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -474,7 +474,7 @@ }, { "c": "\"", - "t": "text.html.markdown meta.tag.structure.div.start.html meta.attribute.unrecognized.markdown.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.markdown meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -485,7 +485,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.tag.structure.div.start.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -507,7 +507,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.tag.structure.div.start.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -518,7 +518,7 @@ }, { "c": "div", - "t": "text.html.markdown meta.tag.structure.div.start.html entity.name.tag.html", + "t": "text.html.markdown meta.tag.block.any.html entity.name.tag.block.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -529,7 +529,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.tag.structure.div.start.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -562,7 +562,7 @@ }, { "c": "", - "t": "text.html.markdown meta.tag.structure.div.end.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -606,7 +606,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -617,7 +617,7 @@ }, { "c": "script", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html entity.name.tag.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -628,7 +628,7 @@ }, { "c": " ", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", @@ -639,7 +639,7 @@ }, { "c": "type", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html meta.attribute.type.html entity.other.attribute-name.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -650,7 +650,7 @@ }, { "c": "=", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html meta.attribute.type.html punctuation.separator.key-value.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html", "r": { "dark_plus": "meta.embedded: #D4D4D4", "light_plus": "meta.embedded: #000000", @@ -661,7 +661,7 @@ }, { "c": "'", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html meta.attribute.type.html string.quoted.single.html punctuation.definition.string.begin.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html string.quoted.single.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.single.html: #0000FF", @@ -672,7 +672,7 @@ }, { "c": "text/x-koka", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html meta.attribute.type.html string.quoted.single.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html string.quoted.single.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.single.html: #0000FF", @@ -683,7 +683,7 @@ }, { "c": "'", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html meta.attribute.type.html string.quoted.single.html punctuation.definition.string.end.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html string.quoted.single.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.single.html: #0000FF", @@ -694,7 +694,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -727,7 +727,7 @@ }, { "c": "", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -770,7 +770,29 @@ } }, { - "c": " and a & ", + "c": " and a ", + "t": "text.html.markdown", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "&", + "t": "text.html.markdown invalid.illegal.bad-ampersand.html", + "r": { + "dark_plus": "invalid: #F44747", + "light_plus": "invalid: #CD3131", + "dark_vs": "invalid: #F44747", + "light_vs": "invalid: #CD3131", + "hc_black": "invalid: #F44747" + } + }, + { + "c": " ", "t": "text.html.markdown", "r": { "dark_plus": "default: #D4D4D4", @@ -782,7 +804,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.tag.inline.b.start.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.tag.inline.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -793,7 +815,7 @@ }, { "c": "b", - "t": "text.html.markdown meta.tag.inline.b.start.html entity.name.tag.html", + "t": "text.html.markdown meta.tag.inline.any.html entity.name.tag.inline.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -804,7 +826,7 @@ }, { "c": " ", - "t": "text.html.markdown meta.tag.inline.b.start.html", + "t": "text.html.markdown meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -815,7 +837,7 @@ }, { "c": "class", - "t": "text.html.markdown meta.tag.inline.b.start.html meta.attribute.class.html entity.other.attribute-name.html", + "t": "text.html.markdown meta.tag.inline.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -826,7 +848,7 @@ }, { "c": "=", - "t": "text.html.markdown meta.tag.inline.b.start.html meta.attribute.class.html punctuation.separator.key-value.html", + "t": "text.html.markdown meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -837,7 +859,7 @@ }, { "c": "\"", - "t": "text.html.markdown meta.tag.inline.b.start.html meta.attribute.class.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.markdown meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -848,7 +870,7 @@ }, { "c": "bold", - "t": "text.html.markdown meta.tag.inline.b.start.html meta.attribute.class.html string.quoted.double.html", + "t": "text.html.markdown meta.tag.inline.any.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -859,7 +881,7 @@ }, { "c": "\"", - "t": "text.html.markdown meta.tag.inline.b.start.html meta.attribute.class.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.markdown meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -870,7 +892,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.tag.inline.b.start.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -892,7 +914,7 @@ }, { "c": "", - "t": "text.html.markdown meta.tag.inline.b.end.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -947,7 +969,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.start.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -958,7 +980,7 @@ }, { "c": "style", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.start.html entity.name.tag.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -969,7 +991,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.start.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1134,7 +1156,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.begin.html source.css", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.html punctuation.definition.tag.begin.html source.css", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1145,7 +1167,7 @@ }, { "c": "/", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1156,7 +1178,7 @@ }, { "c": "style", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.end.html entity.name.tag.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1167,7 +1189,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.embedded.block.html meta.tag.metadata.style.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1178,7 +1200,7 @@ }, { "c": "", - "t": "text.html.markdown meta.tag.structure.div.end.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2498,7 +2520,7 @@ }, { "c": "<", - "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.abbr.start.html punctuation.definition.tag.begin.html", + "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2509,7 +2531,7 @@ }, { "c": "abbr", - "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.abbr.start.html entity.name.tag.html", + "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.any.html entity.name.tag.inline.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2520,7 +2542,7 @@ }, { "c": ">", - "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.abbr.start.html punctuation.definition.tag.end.html", + "t": "text.html.markdown meta.paragraph.markdown meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", diff --git a/extensions/php/test/colorize-results/issue-28354_php.json b/extensions/php/test/colorize-results/issue-28354_php.json index 12e439430fb..cc9924d3945 100644 --- a/extensions/php/test/colorize-results/issue-28354_php.json +++ b/extensions/php/test/colorize-results/issue-28354_php.json @@ -1,7 +1,7 @@ [ { "c": "<", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.begin.html", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -12,7 +12,7 @@ }, { "c": "script", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.start.html entity.name.tag.html", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -23,7 +23,7 @@ }, { "c": ">", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.end.html", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -496,7 +496,7 @@ }, { "c": "<", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.begin.html source.js", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -507,7 +507,7 @@ }, { "c": "/", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -518,7 +518,7 @@ }, { "c": "script", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html entity.name.tag.html", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.html entity.name.tag.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -529,7 +529,7 @@ }, { "c": ">", - "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.end.html", + "t": "text.html.php meta.embedded.block.html meta.tag.metadata.script.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", diff --git a/extensions/php/test/colorize-results/test_php.json b/extensions/php/test/colorize-results/test_php.json index a5d89ab4214..4cb58182b1a 100644 --- a/extensions/php/test/colorize-results/test_php.json +++ b/extensions/php/test/colorize-results/test_php.json @@ -1,7 +1,7 @@ [ { "c": "<", - "t": "text.html.php meta.tag.structure.html.start.html punctuation.definition.tag.begin.html", + "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -12,7 +12,7 @@ }, { "c": "html", - "t": "text.html.php meta.tag.structure.html.start.html entity.name.tag.html", + "t": "text.html.php meta.tag.structure.any.html entity.name.tag.structure.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -23,7 +23,7 @@ }, { "c": ">", - "t": "text.html.php meta.tag.structure.html.start.html punctuation.definition.tag.end.html", + "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -34,7 +34,7 @@ }, { "c": "<", - "t": "text.html.php meta.tag.structure.head.start.html punctuation.definition.tag.begin.html", + "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -45,7 +45,7 @@ }, { "c": "head", - "t": "text.html.php meta.tag.structure.head.start.html entity.name.tag.html", + "t": "text.html.php meta.tag.structure.any.html entity.name.tag.structure.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -56,7 +56,7 @@ }, { "c": ">", - "t": "text.html.php meta.tag.structure.head.start.html punctuation.definition.tag.end.html", + "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -78,7 +78,7 @@ }, { "c": "<", - "t": "text.html.php meta.tag.metadata.title.start.html punctuation.definition.tag.begin.html", + "t": "text.html.php meta.tag.inline.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -89,7 +89,7 @@ }, { "c": "title", - "t": "text.html.php meta.tag.metadata.title.start.html entity.name.tag.html", + "t": "text.html.php meta.tag.inline.any.html entity.name.tag.inline.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -100,7 +100,7 @@ }, { "c": ">", - "t": "text.html.php meta.tag.metadata.title.start.html punctuation.definition.tag.end.html", + "t": "text.html.php meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -122,7 +122,7 @@ }, { "c": "", - "t": "text.html.php meta.tag.metadata.title.end.html punctuation.definition.tag.end.html", + "t": "text.html.php meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -155,7 +155,7 @@ }, { "c": "", - "t": "text.html.php meta.tag.structure.head.end.html punctuation.definition.tag.end.html", + "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -188,7 +188,7 @@ }, { "c": "<", - "t": "text.html.php meta.tag.structure.body.start.html punctuation.definition.tag.begin.html", + "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -199,7 +199,7 @@ }, { "c": "body", - "t": "text.html.php meta.tag.structure.body.start.html entity.name.tag.html", + "t": "text.html.php meta.tag.structure.any.html entity.name.tag.structure.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -210,7 +210,7 @@ }, { "c": ">", - "t": "text.html.php meta.tag.structure.body.start.html punctuation.definition.tag.end.html", + "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3565,7 +3565,7 @@ }, { "c": "", - "t": "text.html.php meta.tag.structure.body.end.html punctuation.definition.tag.end.html", + "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3598,7 +3598,7 @@ }, { "c": "", - "t": "text.html.php meta.tag.structure.html.end.html punctuation.definition.tag.end.html", + "t": "text.html.php meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", diff --git a/extensions/razor/test/colorize-results/test_cshtml.json b/extensions/razor/test/colorize-results/test_cshtml.json index b9434918a44..a0988149bbf 100644 --- a/extensions/razor/test/colorize-results/test_cshtml.json +++ b/extensions/razor/test/colorize-results/test_cshtml.json @@ -1409,7 +1409,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.metadata.doctype.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.sgml.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1464,7 +1442,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.html.start.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1475,7 +1453,7 @@ }, { "c": "html", - "t": "text.html.cshtml meta.tag.structure.html.start.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.structure.any.html entity.name.tag.structure.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1486,7 +1464,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.structure.html.start.html", + "t": "text.html.cshtml meta.tag.structure.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1497,7 +1475,7 @@ }, { "c": "lang", - "t": "text.html.cshtml meta.tag.structure.html.start.html meta.attribute.lang.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.structure.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -1508,7 +1486,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.structure.html.start.html meta.attribute.lang.html punctuation.separator.key-value.html", + "t": "text.html.cshtml meta.tag.structure.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1519,7 +1497,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.html.start.html meta.attribute.lang.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.structure.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -1530,7 +1508,7 @@ }, { "c": "en", - "t": "text.html.cshtml meta.tag.structure.html.start.html meta.attribute.lang.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.structure.any.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -1541,7 +1519,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.html.start.html meta.attribute.lang.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.structure.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -1552,7 +1530,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.html.start.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1574,7 +1552,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.head.start.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1585,7 +1563,7 @@ }, { "c": "head", - "t": "text.html.cshtml meta.tag.structure.head.start.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.structure.any.html entity.name.tag.structure.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1596,7 +1574,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.head.start.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1618,7 +1596,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.metadata.title.start.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1629,7 +1607,7 @@ }, { "c": "title", - "t": "text.html.cshtml meta.tag.metadata.title.start.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1640,7 +1618,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.metadata.title.start.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1662,7 +1640,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.metadata.title.end.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1706,7 +1684,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.metadata.meta.void.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1717,7 +1695,7 @@ }, { "c": "meta", - "t": "text.html.cshtml meta.tag.metadata.meta.void.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1728,7 +1706,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.metadata.meta.void.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1739,7 +1717,7 @@ }, { "c": "charset", - "t": "text.html.cshtml meta.tag.metadata.meta.void.html meta.attribute.charset.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -1750,7 +1728,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.metadata.meta.void.html meta.attribute.charset.html punctuation.separator.key-value.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1761,7 +1739,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.metadata.meta.void.html meta.attribute.charset.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -1772,7 +1750,7 @@ }, { "c": "utf-8", - "t": "text.html.cshtml meta.tag.metadata.meta.void.html meta.attribute.charset.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -1783,7 +1761,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.metadata.meta.void.html meta.attribute.charset.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -1793,19 +1771,8 @@ } }, { - "c": " ", - "t": "text.html.cshtml meta.tag.metadata.meta.void.html", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "/>", - "t": "text.html.cshtml meta.tag.metadata.meta.void.html punctuation.definition.tag.end.html", + "c": " />", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1827,7 +1794,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.structure.head.end.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1860,7 +1827,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.body.start.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1871,7 +1838,7 @@ }, { "c": "body", - "t": "text.html.cshtml meta.tag.structure.body.start.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.structure.any.html entity.name.tag.structure.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1882,7 +1849,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.body.start.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1904,7 +1871,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1915,7 +1882,7 @@ }, { "c": "p", - "t": "text.html.cshtml meta.tag.structure.p.start.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.block.any.html entity.name.tag.block.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1926,7 +1893,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1948,7 +1915,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.inline.strong.start.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1959,7 +1926,7 @@ }, { "c": "strong", - "t": "text.html.cshtml meta.tag.inline.strong.start.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -1970,7 +1937,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.inline.strong.start.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -1992,7 +1959,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.inline.strong.end.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2036,7 +2003,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.structure.p.end.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2080,7 +2047,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.form.start.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2091,7 +2058,7 @@ }, { "c": "form", - "t": "text.html.cshtml meta.tag.structure.form.start.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.block.any.html entity.name.tag.block.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2102,7 +2069,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.structure.form.start.html", + "t": "text.html.cshtml meta.tag.block.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2113,7 +2080,7 @@ }, { "c": "action", - "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.action.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.block.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2124,7 +2091,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.action.html punctuation.separator.key-value.html", + "t": "text.html.cshtml meta.tag.block.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2135,7 +2102,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.action.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2146,7 +2113,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.action.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2157,7 +2124,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.structure.form.start.html", + "t": "text.html.cshtml meta.tag.block.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2168,7 +2135,7 @@ }, { "c": "method", - "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.method.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.block.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2179,7 +2146,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.method.html punctuation.separator.key-value.html", + "t": "text.html.cshtml meta.tag.block.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2190,7 +2157,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.method.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2201,7 +2168,7 @@ }, { "c": "post", - "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.method.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.block.any.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2212,7 +2179,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.form.start.html meta.attribute.method.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.block.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2223,7 +2190,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.form.start.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2245,7 +2212,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2256,7 +2223,7 @@ }, { "c": "p", - "t": "text.html.cshtml meta.tag.structure.p.start.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.block.any.html entity.name.tag.block.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2267,7 +2234,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2278,7 +2245,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.label.start.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2289,7 +2256,7 @@ }, { "c": "label", - "t": "text.html.cshtml meta.tag.structure.label.start.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2300,7 +2267,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.structure.label.start.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2311,7 +2278,7 @@ }, { "c": "for", - "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2322,7 +2289,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html punctuation.separator.key-value.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2333,7 +2300,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2344,7 +2311,7 @@ }, { "c": "text1", - "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2355,7 +2322,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2366,7 +2333,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.label.start.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2388,7 +2355,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.structure.label.end.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2432,7 +2399,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.input.void.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2443,7 +2410,7 @@ }, { "c": "input", - "t": "text.html.cshtml meta.tag.structure.input.void.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2454,7 +2421,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.structure.input.void.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2465,7 +2432,7 @@ }, { "c": "type", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2476,7 +2443,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html punctuation.separator.key-value.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2487,7 +2454,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2498,7 +2465,7 @@ }, { "c": "text", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2509,7 +2476,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2520,7 +2487,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.structure.input.void.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2531,7 +2498,7 @@ }, { "c": "name", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2542,7 +2509,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html punctuation.separator.key-value.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2553,7 +2520,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2564,7 +2531,7 @@ }, { "c": "text1", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2575,7 +2542,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2585,19 +2552,8 @@ } }, { - "c": " ", - "t": "text.html.cshtml meta.tag.structure.input.void.html", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "/>", - "t": "text.html.cshtml meta.tag.structure.input.void.html punctuation.definition.tag.end.html", + "c": " />", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2619,7 +2575,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.structure.p.end.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2663,7 +2619,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2674,7 +2630,7 @@ }, { "c": "p", - "t": "text.html.cshtml meta.tag.structure.p.start.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.block.any.html entity.name.tag.block.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2685,7 +2641,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2696,7 +2652,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.label.start.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2707,7 +2663,7 @@ }, { "c": "label", - "t": "text.html.cshtml meta.tag.structure.label.start.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2718,7 +2674,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.structure.label.start.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2729,7 +2685,7 @@ }, { "c": "for", - "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2740,7 +2696,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html punctuation.separator.key-value.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2751,7 +2707,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2762,7 +2718,7 @@ }, { "c": "text2", - "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2773,7 +2729,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.label.start.html meta.attribute.for.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2784,7 +2740,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.label.start.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2806,7 +2762,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.structure.label.end.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2850,7 +2806,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.input.void.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -2861,7 +2817,7 @@ }, { "c": "input", - "t": "text.html.cshtml meta.tag.structure.input.void.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -2872,7 +2828,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.structure.input.void.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2883,7 +2839,7 @@ }, { "c": "type", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2894,7 +2850,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html punctuation.separator.key-value.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2905,7 +2861,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2916,7 +2872,7 @@ }, { "c": "text", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2927,7 +2883,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2938,7 +2894,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.structure.input.void.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2949,7 +2905,7 @@ }, { "c": "name", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -2960,7 +2916,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html punctuation.separator.key-value.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -2971,7 +2927,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2982,7 +2938,7 @@ }, { "c": "text2", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -2993,7 +2949,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.name.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -3003,19 +2959,8 @@ } }, { - "c": " ", - "t": "text.html.cshtml meta.tag.structure.input.void.html", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "/>", - "t": "text.html.cshtml meta.tag.structure.input.void.html punctuation.definition.tag.end.html", + "c": " />", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3037,7 +2982,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.structure.p.end.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3081,7 +3026,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3092,7 +3037,7 @@ }, { "c": "p", - "t": "text.html.cshtml meta.tag.structure.p.start.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.block.any.html entity.name.tag.block.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -3103,7 +3048,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3114,7 +3059,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.input.void.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3125,7 +3070,7 @@ }, { "c": "input", - "t": "text.html.cshtml meta.tag.structure.input.void.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.name.tag.inline.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -3136,7 +3081,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.structure.input.void.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -3147,7 +3092,7 @@ }, { "c": "type", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -3158,7 +3103,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html punctuation.separator.key-value.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -3169,7 +3114,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -3180,7 +3125,7 @@ }, { "c": "submit", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -3191,7 +3136,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.type.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -3202,7 +3147,7 @@ }, { "c": " ", - "t": "text.html.cshtml meta.tag.structure.input.void.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -3213,7 +3158,7 @@ }, { "c": "value", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.value.html entity.other.attribute-name.html", + "t": "text.html.cshtml meta.tag.inline.any.html entity.other.attribute-name.html", "r": { "dark_plus": "entity.other.attribute-name: #9CDCFE", "light_plus": "entity.other.attribute-name: #FF0000", @@ -3224,7 +3169,7 @@ }, { "c": "=", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.value.html punctuation.separator.key-value.html", + "t": "text.html.cshtml meta.tag.inline.any.html", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -3235,7 +3180,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.value.html string.quoted.double.html punctuation.definition.string.begin.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.begin.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -3246,7 +3191,7 @@ }, { "c": "Add", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.value.html string.quoted.double.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -3257,7 +3202,7 @@ }, { "c": "\"", - "t": "text.html.cshtml meta.tag.structure.input.void.html meta.attribute.value.html string.quoted.double.html punctuation.definition.string.end.html", + "t": "text.html.cshtml meta.tag.inline.any.html string.quoted.double.html punctuation.definition.string.end.html", "r": { "dark_plus": "string: #CE9178", "light_plus": "string.quoted.double.html: #0000FF", @@ -3267,19 +3212,8 @@ } }, { - "c": " ", - "t": "text.html.cshtml meta.tag.structure.input.void.html", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, - { - "c": "/>", - "t": "text.html.cshtml meta.tag.structure.input.void.html punctuation.definition.tag.end.html", + "c": " />", + "t": "text.html.cshtml meta.tag.inline.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3290,7 +3224,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.structure.p.end.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3334,7 +3268,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.structure.form.end.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3400,7 +3334,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3411,7 +3345,7 @@ }, { "c": "p", - "t": "text.html.cshtml meta.tag.structure.p.start.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.block.any.html entity.name.tag.block.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -3422,7 +3356,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3466,7 +3400,7 @@ }, { "c": "<", - "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.begin.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.begin.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3477,7 +3411,7 @@ }, { "c": "p", - "t": "text.html.cshtml meta.tag.structure.p.start.html entity.name.tag.html", + "t": "text.html.cshtml meta.tag.block.any.html entity.name.tag.block.any.html", "r": { "dark_plus": "entity.name.tag: #569CD6", "light_plus": "entity.name.tag: #800000", @@ -3488,7 +3422,7 @@ }, { "c": ">", - "t": "text.html.cshtml meta.tag.structure.p.start.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3576,7 +3510,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.structure.p.end.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.block.any.html punctuation.definition.tag.end.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3631,7 +3565,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.structure.body.end.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", @@ -3664,7 +3598,7 @@ }, { "c": "", - "t": "text.html.cshtml meta.tag.structure.html.end.html punctuation.definition.tag.end.html", + "t": "text.html.cshtml meta.tag.structure.any.html punctuation.definition.tag.html", "r": { "dark_plus": "punctuation.definition.tag: #808080", "light_plus": "punctuation.definition.tag: #800000", From 260ac2760f3c414c1034e0ef679fcc1b4ce26aea Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 23 Jul 2018 15:41:01 -0700 Subject: [PATCH 36/93] Upgrade vscode-xterm Fixes #54132 --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a1160502b0d..8d1b75d32d0 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "vscode-nsfw": "1.0.17", "vscode-ripgrep": "^1.0.1", "vscode-textmate": "^4.0.1", - "vscode-xterm": "3.6.0-beta4", + "vscode-xterm": "3.6.0-beta5", "yauzl": "^2.9.1" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 61ba73fadd6..9e322ec55d9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6256,9 +6256,9 @@ vscode-textmate@^4.0.1: dependencies: oniguruma "^7.0.0" -vscode-xterm@3.6.0-beta4: - version "3.6.0-beta4" - resolved "https://registry.yarnpkg.com/vscode-xterm/-/vscode-xterm-3.6.0-beta4.tgz#27ffa2d6c0acf33bb6a1c8499455d9156b9035ae" +vscode-xterm@3.6.0-beta5: + version "3.6.0-beta5" + resolved "https://registry.yarnpkg.com/vscode-xterm/-/vscode-xterm-3.6.0-beta5.tgz#b44fd70451944624f148bd9f0be4925b52b7a7e0" vso-node-api@^6.1.2-preview: version "6.1.2-preview" From 5916baa42e7b96d83dcb257b1a085ba2975c5dbb Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Mon, 23 Jul 2018 15:54:19 -0700 Subject: [PATCH 37/93] Update settings text for my chunk --- extensions/html-language-features/package.nls.json | 12 ++++++------ src/vs/platform/request/node/request.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/extensions/html-language-features/package.nls.json b/extensions/html-language-features/package.nls.json index 73c94b4acf6..8714274a078 100644 --- a/extensions/html-language-features/package.nls.json +++ b/extensions/html-language-features/package.nls.json @@ -6,7 +6,7 @@ "html.format.unformatted.desc": "List of tags, comma separated, that shouldn't be reformatted. 'null' defaults to all tags listed at https://www.w3.org/TR/html5/dom.html#phrasing-content.", "html.format.contentUnformatted.desc": "List of tags, comma separated, where the content shouldn't be reformatted. 'null' defaults to the 'pre' tag.", "html.format.indentInnerHtml.desc": "Indent and sections.", - "html.format.preserveNewLines.desc": "Whether existing line breaks before elements should be preserved. Only works before elements, not inside tags or for text.", + "html.format.preserveNewLines.desc": "Controls whether existing line breaks before elements should be preserved. Only works before elements, not inside tags or for text.", "html.format.maxPreserveNewLines.desc": "Maximum number of line breaks to be preserved in one chunk. Use 'null' for unlimited.", "html.format.indentHandlebars.desc": "Format and indent {{#foo}} and {{/foo}}.", "html.format.endWithNewline.desc": "End with a newline.", @@ -16,11 +16,11 @@ "html.format.wrapAttributes.force": "Wrap each attribute except first.", "html.format.wrapAttributes.forcealign": "Wrap each attribute except first and keep aligned.", "html.format.wrapAttributes.forcemultiline": "Wrap each attribute.", - "html.suggest.angular1.desc": "Configures if the built-in HTML language support suggests Angular V1 tags and properties.", - "html.suggest.ionic.desc": "Configures if the built-in HTML language support suggests Ionic tags, properties and values.", - "html.suggest.html5.desc":"Configures if the built-in HTML language support suggests HTML5 tags, properties and values.", + "html.suggest.angular1.desc": "Controls whether the built-in HTML language support suggests Angular V1 tags and properties.", + "html.suggest.ionic.desc": "Controls whether the built-in HTML language support suggests Ionic tags, properties and values.", + "html.suggest.html5.desc": "Controls whether the built-in HTML language support suggests HTML5 tags, properties and values.", "html.trace.server.desc": "Traces the communication between VS Code and the HTML language server.", - "html.validate.scripts": "Configures if the built-in HTML language support validates embedded scripts.", - "html.validate.styles": "Configures if the built-in HTML language support validates embedded styles.", + "html.validate.scripts": "Controls whether the built-in HTML language support validates embedded scripts.", + "html.validate.styles": "Controls whether the built-in HTML language support validates embedded styles.", "html.autoClosingTags": "Enable/disable autoclosing of HTML tags." } \ No newline at end of file diff --git a/src/vs/platform/request/node/request.ts b/src/vs/platform/request/node/request.ts index b8d501fa2b5..7dcf4fae4f9 100644 --- a/src/vs/platform/request/node/request.ts +++ b/src/vs/platform/request/node/request.ts @@ -42,7 +42,7 @@ Registry.as(Extensions.Configuration) 'http.proxyStrictSSL': { type: 'boolean', default: true, - description: localize('strictSSL', "Whether the proxy server certificate should be verified against the list of supplied CAs.") + description: localize('strictSSL', "Controls whether the proxy server certificate should be verified against the list of supplied CAs.") }, 'http.proxyAuthorization': { type: ['null', 'string'], From f99a1e6505b499ff2532947f16ebc85cd687697b Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Mon, 23 Jul 2018 16:02:21 -0700 Subject: [PATCH 38/93] Dots --- extensions/git/package.nls.json | 2 +- extensions/html-language-features/package.nls.json | 2 +- src/vs/platform/request/node/request.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 7dc623f9c8e..7b56fd9e95a 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -51,7 +51,7 @@ "command.stashPop": "Pop Stash...", "command.stashPopLatest": "Pop Latest Stash", "config.enabled": "Whether git is enabled", - "config.path": "Path to the git executable", + "config.path": "Path to the git executable.", "config.autoRepositoryDetection": "Configures when repositories should be automatically detected.", "config.autorefresh": "Whether auto refreshing is enabled", "config.autofetch": "Whether auto fetching is enabled", diff --git a/extensions/html-language-features/package.nls.json b/extensions/html-language-features/package.nls.json index 8714274a078..077075780c3 100644 --- a/extensions/html-language-features/package.nls.json +++ b/extensions/html-language-features/package.nls.json @@ -1,7 +1,7 @@ { "displayName": "HTML Language Features", "description": "Provides rich language support for HTML, Razor, and Handlebar files", - "html.format.enable.desc": "Enable/disable default HTML formatter", + "html.format.enable.desc": "Enable/disable default HTML formatter.", "html.format.wrapLineLength.desc": "Maximum amount of characters per line (0 = disable).", "html.format.unformatted.desc": "List of tags, comma separated, that shouldn't be reformatted. 'null' defaults to all tags listed at https://www.w3.org/TR/html5/dom.html#phrasing-content.", "html.format.contentUnformatted.desc": "List of tags, comma separated, where the content shouldn't be reformatted. 'null' defaults to the 'pre' tag.", diff --git a/src/vs/platform/request/node/request.ts b/src/vs/platform/request/node/request.ts index 7dcf4fae4f9..878a5c4a334 100644 --- a/src/vs/platform/request/node/request.ts +++ b/src/vs/platform/request/node/request.ts @@ -37,7 +37,7 @@ Registry.as(Extensions.Configuration) 'http.proxy': { type: 'string', pattern: '^https?://([^:]*(:[^@]*)?@)?([^:]+)(:\\d+)?/?$|^$', - description: localize('proxy', "The proxy setting to use. If not set will be taken from the http_proxy and https_proxy environment variables") + description: localize('proxy', "The proxy setting to use. If not set will be taken from the http_proxy and https_proxy environment variables.") }, 'http.proxyStrictSSL': { type: 'boolean', From befea2253626b1918352df04477cae83eee618ac Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 23 Jul 2018 17:54:42 -0700 Subject: [PATCH 39/93] Pick up new TS insiders version --- extensions/package.json | 2 +- extensions/yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/package.json b/extensions/package.json index 7b4fd5a5bd0..1c3a19a4f02 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.0.1-insiders.20180713" + "typescript": "3.0.1-insiders.20180723" }, "scripts": { "postinstall": "node ./postinstall" diff --git a/extensions/yarn.lock b/extensions/yarn.lock index 6ed3a9d31c4..1d5962931ac 100644 --- a/extensions/yarn.lock +++ b/extensions/yarn.lock @@ -2,6 +2,6 @@ # yarn lockfile v1 -typescript@3.0.1-insiders.20180713: - version "3.0.1-insiders.20180713" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1-insiders.20180713.tgz#02775b5197ab02b79ed5b84e7483c18ed164e55e" +typescript@3.0.1-insiders.20180723: + version "3.0.1-insiders.20180723" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1-insiders.20180723.tgz#266fbafb349a6429777ab3525cda3bb0a2adc661" From f6064affd1e46bda7b25089067628a3369d6b19d Mon Sep 17 00:00:00 2001 From: Erich Gamma Date: Tue, 24 Jul 2018 08:30:35 +0200 Subject: [PATCH 40/93] update to tasks 2.0 --- extensions/npm/.vscode/tasks.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/extensions/npm/.vscode/tasks.json b/extensions/npm/.vscode/tasks.json index 0a411c1c867..b7c8a281635 100644 --- a/extensions/npm/.vscode/tasks.json +++ b/extensions/npm/.vscode/tasks.json @@ -1,8 +1,10 @@ { - "version": "0.1.0", + "version": "2.0.0", "command": "npm", - "isShellCommand": true, - "showOutput": "silent", + "type": "shell", + "presentation": { + "reveal": "silent", + }, "args": ["run", "compile"], "isBackground": true, "problemMatcher": "$tsc-watch" From 5406591ac76f43827b91702a304a4ffbc336a19c Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Jul 2018 09:42:39 +0200 Subject: [PATCH 41/93] Adopt folderUri changes --- src/vs/workbench/electron-browser/bootstrap/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/electron-browser/bootstrap/index.js b/src/vs/workbench/electron-browser/bootstrap/index.js index 231a22d172e..51700d6f0b3 100644 --- a/src/vs/workbench/electron-browser/bootstrap/index.js +++ b/src/vs/workbench/electron-browser/bootstrap/index.js @@ -86,8 +86,8 @@ function showPartsSplash(configuration) { let key; let keep = false; // this is the logic of StorageService#getWorkspaceKey and StorageService#toStorageKey - if (configuration.folderPath) { - let workspaceKey = require('vscode-uri').default.file(configuration.folderPath).toString().replace('file:///', '').replace(/^\//, ''); + if (configuration.folderUri) { + let workspaceKey = require('vscode-uri').default.revive(configuration.folderUri).toString().replace('file:///', '').replace(/^\//, ''); key = `storage://workspace/${workspaceKey}/parts-splash`; } else if (configuration.workspace) { key = `storage://workspace/root:${configuration.workspace.id}/parts-splash`; From 14b387d296b060d362cad4698a67c36989fae1c0 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 24 Jul 2018 09:44:08 +0200 Subject: [PATCH 42/93] Handle URIs with no scheme --- src/vs/code/electron-main/windows.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index 4979ce9df99..67c1aa41616 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -964,7 +964,7 @@ export class WindowsManager implements IWindowsMainService { } private parseUri(anyUri: URI, options?: { ignoreFileNotFound?: boolean, gotoLineMode?: boolean, forceOpenWorkspaceAsFile?: boolean; }): IPathToOpen { - if (!anyUri) { + if (!anyUri || !anyUri.scheme) { return null; } From 46e347797931e9e59f167d2b8308930f216622e2 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Jul 2018 10:23:31 +0200 Subject: [PATCH 43/93] don't show ... when outline model is empty, #54744 --- .../contrib/documentSymbols/outlineModel.ts | 19 +++++++++++-- .../browser/parts/editor/breadcrumbsModel.ts | 27 +++++++++++-------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/vs/editor/contrib/documentSymbols/outlineModel.ts b/src/vs/editor/contrib/documentSymbols/outlineModel.ts index 28db38d0d47..38157732bfa 100644 --- a/src/vs/editor/contrib/documentSymbols/outlineModel.ts +++ b/src/vs/editor/contrib/documentSymbols/outlineModel.ts @@ -21,10 +21,14 @@ export abstract class TreeElement { abstract id: string; abstract children: { [id: string]: TreeElement }; - abstract parent: TreeElement | any; + abstract parent: TreeElement; abstract adopt(newParent: TreeElement): TreeElement; + remove(): void { + delete this.parent.children[this.id]; + } + static findId(candidate: DocumentSymbol | string, container: TreeElement): string { // complex id-computation which contains the origin/extension, // the parent path, and some dedupe logic when names collide @@ -73,6 +77,13 @@ export abstract class TreeElement { } return res; } + + static empty(element: TreeElement): boolean { + for (const _key in element.children) { + return false; + } + return true; + } } export class OutlineElement extends TreeElement { @@ -297,7 +308,11 @@ export class OutlineModel extends TreeElement { onUnexpectedExternalError(err); return group; }).then(group => { - result._groups[id] = group; + if (!TreeElement.empty(group)) { + result._groups[id] = group; + } else { + group.remove(); + } }); }); diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts index f29efc47db1..6ce3e9ad8ab 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts @@ -18,7 +18,7 @@ import URI from 'vs/base/common/uri'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { IPosition } from 'vs/editor/common/core/position'; import { DocumentSymbolProviderRegistry } from 'vs/editor/common/modes'; -import { OutlineElement, OutlineGroup, OutlineModel } from 'vs/editor/contrib/documentSymbols/outlineModel'; +import { OutlineElement, OutlineGroup, OutlineModel, TreeElement } from 'vs/editor/contrib/documentSymbols/outlineModel'; import { IWorkspaceContextService, IWorkspaceFolder, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { Schemas } from 'vs/base/common/network'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -163,18 +163,23 @@ export class EditorBreadcrumbsModel { }); OutlineModel.create(buffer, source.token).then(model => { + if (TreeElement.empty(model)) { + // empty -> no outline elements + this._updateOutlineElements([]); - // copy the model - model = model.adopt(); + } else { + // copy the model + model = model.adopt(); - this._updateOutlineElements(this._getOutlineElements(model, this._editor.getPosition())); - this._outlineDisposables.push(this._editor.onDidChangeCursorPosition(_ => { - timeout.cancelAndSet(() => { - if (!buffer.isDisposed() && versionIdThen === buffer.getVersionId()) { - this._updateOutlineElements(this._getOutlineElements(model, this._editor.getPosition())); - } - }, 150); - })); + this._updateOutlineElements(this._getOutlineElements(model, this._editor.getPosition())); + this._outlineDisposables.push(this._editor.onDidChangeCursorPosition(_ => { + timeout.cancelAndSet(() => { + if (!buffer.isDisposed() && versionIdThen === buffer.getVersionId()) { + this._updateOutlineElements(this._getOutlineElements(model, this._editor.getPosition())); + } + }, 150); + })); + } }).catch(err => { this._updateOutlineElements([]); onUnexpectedError(err); From 9b1da7900e5c1c4cb57561ed3f93115059c321f8 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Jul 2018 10:28:28 +0200 Subject: [PATCH 44/93] show no symbols found message in outline tree, #54744 --- .../workbench/parts/outline/electron-browser/outlinePanel.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts b/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts index 3634c35da04..08c5b28df2b 100644 --- a/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts +++ b/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts @@ -489,6 +489,10 @@ export class OutlinePanel extends ViewletPanel { return; } + if (TreeElement.empty(model)) { + return this._showMessage(localize('no-symbols', "No symbols found in document '{0}'", posix.basename(textModel.uri.path))); + } + let newSize = TreeElement.size(model); if (newSize > 7500) { // this is a workaround for performance issues with the tree: https://github.com/Microsoft/vscode/issues/18180 From 54c821367a07b595d4bd84b4a3404c9dd8a3ddee Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 24 Jul 2018 10:26:14 +0200 Subject: [PATCH 45/93] fixes #54853 --- .../parts/debug/electron-browser/watchExpressionsView.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/parts/debug/electron-browser/watchExpressionsView.ts b/src/vs/workbench/parts/debug/electron-browser/watchExpressionsView.ts index 3ff99dc0765..0963de50db7 100644 --- a/src/vs/workbench/parts/debug/electron-browser/watchExpressionsView.ts +++ b/src/vs/workbench/parts/debug/electron-browser/watchExpressionsView.ts @@ -177,7 +177,7 @@ class WatchExpressionsActionProvider implements IActionProvider { if (element instanceof Variable) { const variable = element; if (!variable.hasChildren) { - actions.push(new CopyValueAction(CopyValueAction.ID, CopyValueAction.LABEL, variable.value, this.debugService)); + actions.push(new CopyValueAction(CopyValueAction.ID, CopyValueAction.LABEL, variable, this.debugService)); } actions.push(new Separator()); } From 891e518f09533e43933c04a87de10f41910fdd56 Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 24 Jul 2018 10:31:13 +0200 Subject: [PATCH 46/93] breakpoint checkboxes with tabindex = -1 #52299 --- .../parts/debug/browser/breakpointsView.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/parts/debug/browser/breakpointsView.ts b/src/vs/workbench/parts/debug/browser/breakpointsView.ts index edf399c0e2a..ef55c3cdac8 100644 --- a/src/vs/workbench/parts/debug/browser/breakpointsView.ts +++ b/src/vs/workbench/parts/debug/browser/breakpointsView.ts @@ -39,6 +39,14 @@ import { ViewletPanel, IViewletPanelOptions } from 'vs/workbench/browser/parts/v const $ = dom.$; +function createCheckbox(): HTMLInputElement { + const checkbox = $('input'); + checkbox.type = 'checkbox'; + checkbox.tabIndex = -1; + + return checkbox; +} + export class BreakpointsView extends ViewletPanel { private static readonly MAX_VISIBLE_FILES = 9; @@ -297,8 +305,7 @@ class BreakpointsRenderer implements IRenderer$('input'); - data.checkbox.type = 'checkbox'; + data.checkbox = createCheckbox(); data.toDispose = []; data.toDispose.push(dom.addStandardDisposableListener(data.checkbox, 'change', (e) => { this.debugService.enableOrDisableBreakpoints(!data.context.enabled, data.context); @@ -365,8 +372,7 @@ class ExceptionBreakpointsRenderer implements IRenderer$('input'); - data.checkbox.type = 'checkbox'; + data.checkbox = createCheckbox(); data.toDispose = []; data.toDispose.push(dom.addStandardDisposableListener(data.checkbox, 'change', (e) => { this.debugService.enableOrDisableBreakpoints(!data.context.enabled, data.context); @@ -416,8 +422,7 @@ class FunctionBreakpointsRenderer implements IRenderer$('input'); - data.checkbox.type = 'checkbox'; + data.checkbox = createCheckbox(); data.toDispose = []; data.toDispose.push(dom.addStandardDisposableListener(data.checkbox, 'change', (e) => { this.debugService.enableOrDisableBreakpoints(!data.context.enabled, data.context); From 415c19c39b1cb77081b83d52ad4ed858dae80c20 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Jul 2018 10:41:53 +0200 Subject: [PATCH 47/93] use selection range for quick outline, #54857 --- src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts b/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts index 0fa751696fc..e3a598f0ff5 100644 --- a/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts +++ b/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts @@ -450,7 +450,7 @@ export class GotoSymbolHandler extends QuickOpenHandler { // Add results.push(new SymbolEntry(i, label, icon, description, `symbol-icon ${icon}`, - element.range, null, this.editorService, this + element.selectionRange || element.range, null, this.editorService, this )); } From fc78c209e8bca39609f8dd9af8d9333449c30416 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Jul 2018 10:46:30 +0200 Subject: [PATCH 48/93] use range for hightlight and selectionRange for revealing, #54857 --- .../parts/quickopen/browser/gotoSymbolHandler.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts b/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts index e3a598f0ff5..2880d33cb38 100644 --- a/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts +++ b/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts @@ -239,9 +239,10 @@ class SymbolEntry extends EditorQuickOpenEntryGroup { private icon: string; private description: string; private range: IRange; + private revealRange: IRange; private handler: GotoSymbolHandler; - constructor(index: number, name: string, type: string, description: string, icon: string, range: IRange, highlights: IHighlight[], editorService: IEditorService, handler: GotoSymbolHandler) { + constructor(index: number, name: string, type: string, description: string, icon: string, range: IRange, revealRange: IRange, highlights: IHighlight[], editorService: IEditorService, handler: GotoSymbolHandler) { super(); this.index = index; @@ -250,6 +251,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup { this.icon = icon; this.description = description; this.range = range; + this.revealRange = revealRange || range; this.setHighlights(highlights); this.editorService = editorService; this.handler = handler; @@ -342,10 +344,10 @@ class SymbolEntry extends EditorQuickOpenEntryGroup { private toSelection(): IRange { return { - startLineNumber: this.range.startLineNumber, - startColumn: this.range.startColumn || 1, - endLineNumber: this.range.startLineNumber, - endColumn: this.range.startColumn || 1 + startLineNumber: this.revealRange.startLineNumber, + startColumn: this.revealRange.startColumn || 1, + endLineNumber: this.revealRange.startLineNumber, + endColumn: this.revealRange.startColumn || 1 }; } } @@ -450,7 +452,7 @@ export class GotoSymbolHandler extends QuickOpenHandler { // Add results.push(new SymbolEntry(i, label, icon, description, `symbol-icon ${icon}`, - element.selectionRange || element.range, null, this.editorService, this + element.range, element.selectionRange, null, this.editorService, this )); } From 580a0aa79d8a274c645009acee3837f1fe9b7dfa Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 24 Jul 2018 10:39:02 +0200 Subject: [PATCH 49/93] clean up test name --- .../test/electron-browser/api/mainThreadEditors.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0589271ab33..39d428c8f1d 100644 --- a/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts +++ b/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts @@ -129,7 +129,7 @@ suite('MainThreadEditors', () => { }); }); - test(`pasero applyWorkspaceEdit with only resource edit`, () => { + test(`applyWorkspaceEdit with only resource edit`, () => { return editors.$tryApplyWorkspaceEdit({ edits: [ { oldUri: resource, newUri: resource, options: undefined }, From 44f1b6866c338678117b88424581242978400f56 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 24 Jul 2018 11:00:10 +0200 Subject: [PATCH 50/93] Fixes #54773: Check model version id right before applying the edits --- .../electron-browser/bulkEditService.ts | 26 +++++++++++ .../api/mainThreadEditors.test.ts | 44 ++++++++++++++++++- 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/services/bulkEdit/electron-browser/bulkEditService.ts b/src/vs/workbench/services/bulkEdit/electron-browser/bulkEditService.ts index a0a69bf0c88..dd3d391644c 100644 --- a/src/vs/workbench/services/bulkEdit/electron-browser/bulkEditService.ts +++ b/src/vs/workbench/services/bulkEdit/electron-browser/bulkEditService.ts @@ -47,11 +47,14 @@ abstract class Recording { abstract hasChanged(resource: URI): boolean; } +type ValidationResult = { canApply: true } | { canApply: false, reason: URI }; + class ModelEditTask implements IDisposable { private readonly _model: ITextModel; protected _edits: IIdentifiedSingleEditOperation[]; + private _expectedModelVersionId: number | undefined; protected _newEol: EndOfLineSequence; constructor(private readonly _modelReference: IReference) { @@ -64,6 +67,7 @@ class ModelEditTask implements IDisposable { } addEdit(resourceEdit: ResourceTextEdit): void { + this._expectedModelVersionId = resourceEdit.modelVersionId; for (const edit of resourceEdit.edits) { if (typeof edit.eol === 'number') { // honor eol-change @@ -82,6 +86,13 @@ class ModelEditTask implements IDisposable { } } + validate(): ValidationResult { + if (typeof this._expectedModelVersionId === 'undefined' || this._model.getVersionId() === this._expectedModelVersionId) { + return { canApply: true }; + } + return { canApply: false, reason: this._model.uri }; + } + apply(): void { if (this._edits.length > 0) { this._edits = mergeSort(this._edits, (a, b) => Range.compareRangesUsingStarts(a.range, b.range)); @@ -191,6 +202,16 @@ class BulkEditModel implements IDisposable { return this; } + validate(): ValidationResult { + for (const task of this._tasks) { + const result = task.validate(); + if (!result.canApply) { + return result; + } + } + return { canApply: true }; + } + apply(): void { for (const task of this._tasks) { task.apply(); @@ -330,6 +351,11 @@ export class BulkEdit { throw new Error(localize('conflict', "These files have changed in the meantime: {0}", conflicts.join(', '))); } + const validationResult = model.validate(); + if (validationResult.canApply === false) { + throw new Error(`${validationResult.reason.toString()} has changed in the meantime`); + } + await model.apply(); model.dispose(); } 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 39d428c8f1d..fdb4b5575c3 100644 --- a/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts +++ b/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts @@ -26,6 +26,8 @@ import { TPromise } from 'vs/base/common/winjs.base'; import { ResourceTextEdit } from 'vs/editor/common/modes'; import { BulkEditService } from 'vs/workbench/services/bulkEdit/electron-browser/bulkEditService'; import { NullLogService } from 'vs/platform/log/common/log'; +import { ITextModelService, ITextEditorModel } from 'vs/editor/common/services/resolverService'; +import { IReference, ImmortalReference } from 'vs/base/common/lifecycle'; suite('MainThreadEditors', () => { @@ -71,8 +73,16 @@ suite('MainThreadEditors', () => { }; const workbenchEditorService = new TestEditorService(); const editorGroupService = new TestEditorGroupsService(); + const textModelService = new class extends mock() { + createModelReference(resource: URI): TPromise> { + const textEditorModel: ITextEditorModel = new class extends mock() { + textEditorModel = modelService.getModel(resource); + }; + return TPromise.as(new ImmortalReference(textEditorModel)); + } + }; - const bulkEditService = new BulkEditService(new NullLogService(), modelService, new TestEditorService(), null, new TestFileService(), textFileService, TestEnvironmentService, new TestContextService()); + const bulkEditService = new BulkEditService(new NullLogService(), modelService, new TestEditorService(), textModelService, new TestFileService(), textFileService, TestEnvironmentService, new TestContextService()); const rpcProtocol = new TestRPCProtocol(); rpcProtocol.set(ExtHostContext.ExtHostDocuments, new class extends mock() { @@ -129,6 +139,38 @@ suite('MainThreadEditors', () => { }); }); + test(`issue #54773: applyWorkspaceEdit checks model version in race situation`, () => { + + let model = modelService.createModel('something', null, resource); + + let workspaceResourceEdit1: ResourceTextEdit = { + resource: resource, + modelVersionId: model.getVersionId(), + edits: [{ + text: 'asdfg', + range: new Range(1, 1, 1, 1) + }] + }; + let workspaceResourceEdit2: ResourceTextEdit = { + resource: resource, + modelVersionId: model.getVersionId(), + edits: [{ + text: 'asdfg', + range: new Range(1, 1, 1, 1) + }] + }; + + let p1 = editors.$tryApplyWorkspaceEdit({ edits: [workspaceResourceEdit1] }).then((result) => { + // first edit request succeeds + assert.equal(result, true); + }); + let p2 = editors.$tryApplyWorkspaceEdit({ edits: [workspaceResourceEdit2] }).then((result) => { + // second edit request fails + assert.equal(result, false); + }); + return TPromise.join([p1, p2]); + }); + test(`applyWorkspaceEdit with only resource edit`, () => { return editors.$tryApplyWorkspaceEdit({ edits: [ From 25f44fb0f21f2fdd0899e90660aeacd00f69f69e Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Jul 2018 11:14:36 +0200 Subject: [PATCH 51/93] more fields --- src/vs/workbench/electron-browser/shell.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index 4275569b95d..268a71c670b 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -520,10 +520,12 @@ export class WorkbenchShell extends Disposable { } } + private static readonly PARTS_SPLASH_ID = 'monaco-parts-splash'; + private _savePartsSplash() { // capture html-structure - let html = '
'; + let html = `
`; // title part let titleHeight: number; @@ -575,7 +577,7 @@ export class WorkbenchShell extends Disposable { } private _removePartsSplash(): void { - let element = document.getElementById('monaco-parts-splash'); + let element = document.getElementById(WorkbenchShell.PARTS_SPLASH_ID); if (element) { element.remove(); } From 26edb37b1c65763e6a47025c35dee635f041924c Mon Sep 17 00:00:00 2001 From: Nilesh Date: Tue, 24 Jul 2018 14:53:28 +0530 Subject: [PATCH 52/93] Reverted some changes. Reverted changes regareding kebindingsEditor and removed some actions. --- .../preferences/browser/keybindingsEditor.ts | 1 - .../preferences/browser/preferencesActions.ts | 18 --------------- .../preferences.contribution.ts | 3 +-- .../preferences/browser/preferencesService.ts | 23 ++----------------- .../preferences/common/preferences.ts | 1 - .../common/preferencesEditorInput.ts | 5 ---- 6 files changed, 3 insertions(+), 48 deletions(-) diff --git a/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts b/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts index 0ac81a6c8ac..4d91fd39cb5 100644 --- a/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts +++ b/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts @@ -110,7 +110,6 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor } setInput(input: KeybindingsEditorInput, options: EditorOptions, token: CancellationToken): Thenable { - this.searchWidget.setValue(input.defaultSearchValue); return super.setInput(input, options, token) .then(() => this.render(options && options.preserveFocus, token)); } diff --git a/src/vs/workbench/parts/preferences/browser/preferencesActions.ts b/src/vs/workbench/parts/preferences/browser/preferencesActions.ts index f976de2927c..ca361afc387 100644 --- a/src/vs/workbench/parts/preferences/browser/preferencesActions.ts +++ b/src/vs/workbench/parts/preferences/browser/preferencesActions.ts @@ -143,24 +143,6 @@ export class OpenRawDefaultKeybindingsAction extends Action { } } -export class OpenRawUserKeybindingsAction extends Action { - - public static readonly ID = 'workbench.action.openRawUserKeybindings'; - public static readonly LABEL = nls.localize('openRawUserKeybindings', "Open User Keyboard Shortcuts File"); - - constructor( - id: string, - label: string, - @IPreferencesService private preferencesService: IPreferencesService - ) { - super(id, label); - } - - public run(event?: any): TPromise { - return this.preferencesService.openRawUserKeybindings(); - } -} - export class OpenWorkspaceSettingsAction extends Action { public static readonly ID = 'workbench.action.openWorkspaceSettings'; diff --git a/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts b/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts index d046efb6896..3075be4193d 100644 --- a/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts +++ b/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts @@ -19,7 +19,7 @@ import { PreferencesEditor } from 'vs/workbench/parts/preferences/browser/prefer import { SettingsEditor2 } from 'vs/workbench/parts/preferences/browser/settingsEditor2'; import { DefaultPreferencesEditorInput, PreferencesEditorInput, KeybindingsEditorInput, SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput'; import { KeybindingsEditor } from 'vs/workbench/parts/preferences/browser/keybindingsEditor'; -import { OpenRawDefaultKeybindingsAction, OpenRawUserKeybindingsAction, OpenRawDefaultSettingsAction, OpenSettingsAction, OpenGlobalSettingsAction, OpenGlobalKeybindingsFileAction, OpenWorkspaceSettingsAction, OpenFolderSettingsAction, ConfigureLanguageBasedSettingsAction, OPEN_FOLDER_SETTINGS_COMMAND, OpenGlobalKeybindingsAction, OpenSettings2Action } from 'vs/workbench/parts/preferences/browser/preferencesActions'; +import { OpenRawDefaultKeybindingsAction, OpenRawDefaultSettingsAction, OpenSettingsAction, OpenGlobalSettingsAction, OpenGlobalKeybindingsFileAction, OpenWorkspaceSettingsAction, OpenFolderSettingsAction, ConfigureLanguageBasedSettingsAction, OPEN_FOLDER_SETTINGS_COMMAND, OpenGlobalKeybindingsAction, OpenSettings2Action } from 'vs/workbench/parts/preferences/browser/preferencesActions'; import { IKeybindingsEditor, IPreferencesSearchService, CONTEXT_KEYBINDING_FOCUS, CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDINGS_SEARCH_FOCUS, KEYBINDINGS_EDITOR_COMMAND_DEFINE, KEYBINDINGS_EDITOR_COMMAND_REMOVE, KEYBINDINGS_EDITOR_COMMAND_SEARCH, KEYBINDINGS_EDITOR_COMMAND_COPY, KEYBINDINGS_EDITOR_COMMAND_RESET, KEYBINDINGS_EDITOR_COMMAND_COPY_COMMAND, KEYBINDINGS_EDITOR_COMMAND_SHOW_SIMILAR, KEYBINDINGS_EDITOR_COMMAND_FOCUS_KEYBINDINGS, KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, SETTINGS_EDITOR_COMMAND_SEARCH, CONTEXT_SETTINGS_EDITOR, SETTINGS_EDITOR_COMMAND_FOCUS_FILE, CONTEXT_SETTINGS_SEARCH_FOCUS, SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, SETTINGS_EDITOR_COMMAND_FOCUS_NEXT_SETTING, SETTINGS_EDITOR_COMMAND_FOCUS_PREVIOUS_SETTING, SETTINGS_EDITOR_COMMAND_EDIT_FOCUSED_SETTING, SETTINGS_EDITOR_COMMAND_FOCUS_SEARCH_FROM_SETTINGS, SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_FROM_SEARCH, CONTEXT_SETTINGS_FIRST_ROW_FOCUS, CONTEXT_SETTINGS_ROW_FOCUS, CONTEXT_TOC_ROW_FOCUS, SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_LIST @@ -196,7 +196,6 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettings2Action, O registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalSettingsAction, OpenGlobalSettingsAction.ID, OpenGlobalSettingsAction.LABEL), 'Preferences: Open User Settings', category); registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalKeybindingsAction, OpenGlobalKeybindingsAction.ID, OpenGlobalKeybindingsAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_S) }), 'Preferences: Open Keyboard Shortcuts', category); registry.registerWorkbenchAction(new SyncActionDescriptor(OpenRawDefaultKeybindingsAction, OpenRawDefaultKeybindingsAction.ID, OpenRawDefaultKeybindingsAction.LABEL), 'Preferences: Open Raw Default Settings', category); -registry.registerWorkbenchAction(new SyncActionDescriptor(OpenRawUserKeybindingsAction, OpenRawUserKeybindingsAction.ID, OpenRawUserKeybindingsAction.LABEL), 'Preferences: Open Raw Default Settings', category); registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalKeybindingsFileAction, OpenGlobalKeybindingsFileAction.ID, OpenGlobalKeybindingsFileAction.LABEL, { primary: null }), 'Preferences: Open Keyboard Shortcuts File', category); registry.registerWorkbenchAction(new SyncActionDescriptor(ConfigureLanguageBasedSettingsAction, ConfigureLanguageBasedSettingsAction.ID, ConfigureLanguageBasedSettingsAction.LABEL), 'Preferences: Configure Language Specific Settings...', category); diff --git a/src/vs/workbench/services/preferences/browser/preferencesService.ts b/src/vs/workbench/services/preferences/browser/preferencesService.ts index 6c4bf2ed9fe..1a5000f09d1 100644 --- a/src/vs/workbench/services/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/services/preferences/browser/preferencesService.ts @@ -91,10 +91,6 @@ export class PreferencesService extends Disposable implements IPreferencesServic return this.getEditableSettingsURI(ConfigurationTarget.USER); } - get userKeybindingsResource(): URI { - return this.getEditableSettingsURI(ConfigurationTarget.USER); - } - get workspaceSettingsResource(): URI { return this.getEditableSettingsURI(ConfigurationTarget.WORKSPACE); } @@ -221,11 +217,11 @@ export class PreferencesService extends Disposable implements IPreferencesServic "textual" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true } } */ - const openDefaultKeybindings = !!this.configurationService.getValue('workbench.settings.openDefaultKeybindings'); this.telemetryService.publicLog('openKeybindings', { textual }); if (textual) { const emptyContents = '// ' + nls.localize('emptyKeybindingsHeader', "Place your key bindings in this file to overwrite the defaults") + '\n[\n]'; const editableKeybindings = URI.file(this.environmentService.appKeybindingsPath); + const openDefaultKeybindings = !!this.configurationService.getValue('workbench.settings.openDefaultKeybindings'); // Create as needed and open in editor if (openDefaultKeybindings) { @@ -244,28 +240,13 @@ export class PreferencesService extends Disposable implements IPreferencesServic }); } - const keybindingsEditorInput = this.instantiationService.createInstance(KeybindingsEditorInput); - if (openDefaultKeybindings) { - keybindingsEditorInput.setDefaultSearchValue('@source:uesr'); - } else { - keybindingsEditorInput.setDefaultSearchValue(); - } - - return this.editorService.openEditor(keybindingsEditorInput, { pinned: true }).then(() => null); + return this.editorService.openEditor(this.instantiationService.createInstance(KeybindingsEditorInput), { pinned: true }).then(() => null); } openRawDefaultKeybindings(): TPromise { return this.editorService.openEditor({ resource: this.defaultKeybindingsResource }); } - openRawUserKeybindings(): TPromise { - const emptyContents = '// ' + nls.localize('emptyKeybindingsHeader', "Place your key bindings in this file to overwrite the defaults") + '\n[\n]'; - const editableKeybindings = URI.file(this.environmentService.appKeybindingsPath); - return this.createIfNotExists(editableKeybindings, emptyContents).then(() => { - return this.editorService.openEditor({ resource: editableKeybindings, options: { pinned: true } }).then(editors => void 0); - }); - } - configureSettingsForLanguage(language: string): void { this.openGlobalSettings() .then(editor => this.createPreferencesEditorModel(this.userSettingsResource) diff --git a/src/vs/workbench/services/preferences/common/preferences.ts b/src/vs/workbench/services/preferences/common/preferences.ts index 4b1817234cb..31c7c443b36 100644 --- a/src/vs/workbench/services/preferences/common/preferences.ts +++ b/src/vs/workbench/services/preferences/common/preferences.ts @@ -152,7 +152,6 @@ export interface IPreferencesService { switchSettings(target: ConfigurationTarget, resource: URI): TPromise; openGlobalKeybindingSettings(textual: boolean): TPromise; openRawDefaultKeybindings(): TPromise; - openRawUserKeybindings(): TPromise; configureSettingsForLanguage(language: string): void; } diff --git a/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts b/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts index 0faa13eea81..b81ca559188 100644 --- a/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts +++ b/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts @@ -56,7 +56,6 @@ export class KeybindingsEditorInput extends EditorInput { public static readonly ID: string = 'workbench.input.keybindings'; public readonly keybindingsModel: KeybindingsEditorModel; - public defaultSearchValue: string; constructor(@IInstantiationService instantiationService: IInstantiationService) { super(); @@ -78,10 +77,6 @@ export class KeybindingsEditorInput extends EditorInput { matches(otherInput: any): boolean { return otherInput instanceof KeybindingsEditorInput; } - - setDefaultSearchValue(defaultSearchValue = ''): void { - this.defaultSearchValue = defaultSearchValue; - } } export class SettingsEditor2Input extends EditorInput { From 37183ce4ce988bd1289c542e3d2af70069289f0a Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Jul 2018 11:48:31 +0200 Subject: [PATCH 53/93] ignore sidebar when workspace is empty --- src/vs/workbench/electron-browser/shell.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index 268a71c670b..188621fa6c6 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -525,6 +525,7 @@ export class WorkbenchShell extends Disposable { private _savePartsSplash() { // capture html-structure + let state = this.contextService.getWorkbenchState(); let html = `
`; // title part @@ -548,8 +549,8 @@ export class WorkbenchShell extends Disposable { activityPartWidth = pos.width; } - // sidebar-part - { + // sidebar-part (only for folder/workspace cases) + if (state !== WorkbenchState.EMPTY) { let part = this.workbench.getContainer(Parts.SIDEBAR_PART); let pos = getDomNodePagePosition(part); let bg = part.style.backgroundColor || 'inhert'; @@ -568,12 +569,7 @@ export class WorkbenchShell extends Disposable { html += '\n
'; // store per workspace or globally - let state = this.contextService.getWorkbenchState(); - if (state === WorkbenchState.EMPTY) { - this.storageService.store('parts-splash', html, StorageScope.GLOBAL); - } else { - this.storageService.store('parts-splash', html, StorageScope.WORKSPACE); - } + this.storageService.store('parts-splash', html, state === WorkbenchState.EMPTY ? StorageScope.GLOBAL : StorageScope.WORKSPACE); } private _removePartsSplash(): void { From 94cfde6813413f3d6f8c41953c27e06ff312c000 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 24 Jul 2018 11:55:22 +0200 Subject: [PATCH 54/93] Fix #53741 --- .../parts/search/browser/searchView.ts | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/vs/workbench/parts/search/browser/searchView.ts b/src/vs/workbench/parts/search/browser/searchView.ts index 510fc37cab1..34ca78e2aba 100644 --- a/src/vs/workbench/parts/search/browser/searchView.ts +++ b/src/vs/workbench/parts/search/browser/searchView.ts @@ -5,6 +5,7 @@ 'use strict'; +import 'vs/css!./media/searchview'; import { $, Builder } from 'vs/base/browser/builder'; import * as dom from 'vs/base/browser/dom'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; @@ -14,15 +15,14 @@ import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox'; import { IAction } from 'vs/base/common/actions'; import { Delayer } from 'vs/base/common/async'; import * as errors from 'vs/base/common/errors'; -import { debounceEvent, Emitter } from 'vs/base/common/event'; +import { debounceEvent, Emitter, anyEvent } from 'vs/base/common/event'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import * as paths from 'vs/base/common/paths'; import * as env from 'vs/base/common/platform'; import * as strings from 'vs/base/common/strings'; import URI from 'vs/base/common/uri'; import { TPromise } from 'vs/base/common/winjs.base'; -import { IFocusEvent, ITree } from 'vs/base/parts/tree/browser/tree'; -import 'vs/css!./media/searchview'; +import { ITree } from 'vs/base/parts/tree/browser/tree'; import { ICodeEditor, isCodeEditor, isDiffEditor } from 'vs/editor/browser/editorBrowser'; import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; import * as nls from 'vs/nls'; @@ -35,7 +35,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { TreeResourceNavigator, WorkbenchTree } from 'vs/platform/list/browser/listService'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { IProgressService } from 'vs/platform/progress/common/progress'; -import { IPatternInfo, IQueryOptions, ISearchComplete, ISearchConfiguration, ISearchHistoryService, ISearchProgressItem, ISearchQuery, VIEW_ID } from 'vs/platform/search/common/search'; +import { IPatternInfo, IQueryOptions, ISearchComplete, ISearchConfiguration, ISearchHistoryService, ISearchProgressItem, ISearchQuery, VIEW_ID, IFileMatch } from 'vs/platform/search/common/search'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { diffInserted, diffInsertedOutline, diffRemoved, diffRemovedOutline, editorFindMatchHighlight, editorFindMatchHighlightBorder } from 'vs/platform/theme/common/colorRegistry'; @@ -582,14 +582,9 @@ export class SearchView extends Viewlet implements IViewlet, IPanel { } })); - let treeHasFocus = false; - this.tree.onDidFocus(() => { - treeHasFocus = true; - }); - - this._register(this.tree.onDidChangeFocus((e: IFocusEvent) => { - if (treeHasFocus) { - const focus = e.focus; + this._register(anyEvent(this.tree.onDidFocus, this.tree.onDidChangeFocus)(() => { + if (this.tree.isDOMFocused()) { + const focus = this.tree.getFocus(); this.firstMatchFocused.set(this.tree.getNavigator().first() === focus); this.fileMatchOrMatchFocused.set(!!focus); this.fileMatchFocused.set(focus instanceof FileMatch); @@ -600,7 +595,6 @@ export class SearchView extends Viewlet implements IViewlet, IPanel { })); this._register(this.tree.onDidBlur(e => { - treeHasFocus = false; this.firstMatchFocused.reset(); this.fileMatchOrMatchFocused.reset(); this.fileMatchFocused.reset(); From 3a7fa5f30acbb722feb9d661cabef89da05c626a Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Jul 2018 12:08:56 +0200 Subject: [PATCH 55/93] replace getDomNodePagePosition with more specific functions --- src/vs/workbench/electron-browser/shell.ts | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index 188621fa6c6..24e8b1f7cc7 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -91,7 +91,7 @@ import { NotificationService } from 'vs/workbench/services/notification/common/n import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { DialogService } from 'vs/workbench/services/dialogs/electron-browser/dialogService'; import { DialogChannel } from 'vs/platform/dialogs/common/dialogIpc'; -import { EventType, addDisposableListener, addClass, getDomNodePagePosition } from 'vs/base/browser/dom'; +import { EventType, addDisposableListener, addClass, getTotalHeight, getTotalWidth } from 'vs/base/browser/dom'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import { OpenerService } from 'vs/editor/browser/services/openerService'; import { SearchHistoryService } from 'vs/workbench/services/search/node/searchHistoryService'; @@ -532,10 +532,10 @@ export class WorkbenchShell extends Disposable { let titleHeight: number; { let part = this.workbench.getContainer(Parts.TITLEBAR_PART); - let pos = getDomNodePagePosition(part); + let height = getTotalHeight(part); let bg = part.style.backgroundColor || 'inhert'; - html += `
`; - titleHeight = pos.height; + html += `
`; + titleHeight = height; } // activitybar-part @@ -543,27 +543,26 @@ export class WorkbenchShell extends Disposable { let activityPartWidth: number; { let part = this.workbench.getContainer(Parts.ACTIVITYBAR_PART); - let pos = getDomNodePagePosition(part); + let width = getTotalWidth(part); let bg = part.style.backgroundColor || 'inhert'; - html += `
`; - activityPartWidth = pos.width; + html += `
`; + activityPartWidth = width; } // sidebar-part (only for folder/workspace cases) if (state !== WorkbenchState.EMPTY) { let part = this.workbench.getContainer(Parts.SIDEBAR_PART); - let pos = getDomNodePagePosition(part); + let width = getTotalWidth(part); let bg = part.style.backgroundColor || 'inhert'; - html += `
`; + html += `
`; } // statusbar-part { let part = this.workbench.getContainer(Parts.STATUSBAR_PART); - let pos = getDomNodePagePosition(part); + let height = getTotalHeight(part); let bg = part.style.backgroundColor || 'inhert'; - - html += `
`; + html += `
`; } html += '\n
'; From f18ee4b08708ea1778a7d835dfa99ba77c253992 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 24 Jul 2018 12:14:20 +0200 Subject: [PATCH 56/93] remove unused imports --- src/vs/workbench/parts/search/browser/searchView.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/parts/search/browser/searchView.ts b/src/vs/workbench/parts/search/browser/searchView.ts index 34ca78e2aba..85bd5d5d603 100644 --- a/src/vs/workbench/parts/search/browser/searchView.ts +++ b/src/vs/workbench/parts/search/browser/searchView.ts @@ -35,7 +35,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { TreeResourceNavigator, WorkbenchTree } from 'vs/platform/list/browser/listService'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { IProgressService } from 'vs/platform/progress/common/progress'; -import { IPatternInfo, IQueryOptions, ISearchComplete, ISearchConfiguration, ISearchHistoryService, ISearchProgressItem, ISearchQuery, VIEW_ID, IFileMatch } from 'vs/platform/search/common/search'; +import { IPatternInfo, IQueryOptions, ISearchComplete, ISearchConfiguration, ISearchHistoryService, ISearchProgressItem, ISearchQuery, VIEW_ID } from 'vs/platform/search/common/search'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { diffInserted, diffInsertedOutline, diffRemoved, diffRemovedOutline, editorFindMatchHighlight, editorFindMatchHighlightBorder } from 'vs/platform/theme/common/colorRegistry'; From 1616ea11935857a077657756eb957be36b7fe756 Mon Sep 17 00:00:00 2001 From: Erich Gamma Date: Tue, 24 Jul 2018 12:17:55 +0200 Subject: [PATCH 57/93] Disable npm code lens by default --- extensions/npm/README.md | 2 +- extensions/npm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/npm/README.md b/extensions/npm/README.md index c3dd9437203..6c8fa19625d 100644 --- a/extensions/npm/README.md +++ b/extensions/npm/README.md @@ -29,5 +29,5 @@ The extension provides code lense actions to run or debug a script from the edit - `npm.exclude` - Glob patterns for folders that should be excluded from automatic script detection. The pattern is matched against the **absolute path** of the package.json. For example, to exclude all test folders use '**/test/**'. - `npm.enableScriptExplorer` - Enable an explorer view for npm scripts. - `npm.scriptExplorerAction` - The default click action: `open` or `run`, the default is `open`. -- `npm.scriptCodeLens.enable` - Enable/disable the code lenses to run a script. +- `npm.scriptCodeLens.enable` - Enable/disable the code lenses to run a script, the default is `false`. diff --git a/extensions/npm/package.json b/extensions/npm/package.json index 7f4b794ee0c..434f7ea20b1 100644 --- a/extensions/npm/package.json +++ b/extensions/npm/package.json @@ -180,7 +180,7 @@ }, "npm.scriptCodeLens.enable": { "type": "boolean", - "default": true, + "default": false, "scope": "resource", "description": "%config.scriptCodeLens.enable%" }, From 44b3d6f297f99ec7948a19a28813f6e09f64a3b0 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 24 Jul 2018 12:33:15 +0200 Subject: [PATCH 58/93] Fix #53110 --- .../extensionManagement/node/extensionManagementService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/platform/extensionManagement/node/extensionManagementService.ts b/src/vs/platform/extensionManagement/node/extensionManagementService.ts index 5cc1c5b5bb7..84989938f78 100644 --- a/src/vs/platform/extensionManagement/node/extensionManagementService.ts +++ b/src/vs/platform/extensionManagement/node/extensionManagementService.ts @@ -250,7 +250,7 @@ export class ExtensionManagementService extends Disposable implements IExtension const existingExtension = installed.filter(i => areSameExtensions(i.galleryIdentifier, extension.identifier))[0]; operation = existingExtension ? InstallOperation.Update : InstallOperation.Install; return this.downloadInstallableExtension(extension, operation) - .then(installableExtension => this.installExtension(installableExtension)) + .then(installableExtension => this.installExtension(installableExtension).then(local => always(pfs.rimraf(installableExtension.zipPath), () => null).then(() => local))) .then(local => this.installDependenciesAndPackExtensions(local, existingExtension) .then(() => local, error => this.uninstall(local, true).then(() => TPromise.wrapError(error), () => TPromise.wrapError(error)))); }) @@ -331,7 +331,7 @@ export class ExtensionManagementService extends Disposable implements IExtension return this.galleryService.download(extension, operation) .then( zipPath => { - this.logService.info('Downloaded extension:', extension.name); + this.logService.info('Downloaded extension:', extension.name, zipPath); return validateLocalExtension(zipPath) .then( manifest => ({ zipPath, id: getLocalExtensionIdFromManifest(manifest), metadata }), From 5a3595e291413dbc2991c408cc3777ef5ca11fa8 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 24 Jul 2018 14:45:45 +0200 Subject: [PATCH 59/93] Implement #47502 --- src/vs/workbench/browser/parts/views/customView.ts | 14 +++++++++++--- src/vs/workbench/common/views.ts | 6 ------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/vs/workbench/browser/parts/views/customView.ts b/src/vs/workbench/browser/parts/views/customView.ts index 48a034e299e..bf04ef7a0c0 100644 --- a/src/vs/workbench/browser/parts/views/customView.ts +++ b/src/vs/workbench/browser/parts/views/customView.ts @@ -202,12 +202,18 @@ export class CustomTreeViewer extends Disposable implements ITreeViewer { @IExtensionService private extensionService: IExtensionService, @IWorkbenchThemeService private themeService: IWorkbenchThemeService, @IInstantiationService private instantiationService: IInstantiationService, - @ICommandService private commandService: ICommandService + @ICommandService private commandService: ICommandService, + @IConfigurationService private configurationService: IConfigurationService ) { super(); this.root = new Root(); this._register(this.themeService.onDidFileIconThemeChange(() => this.doRefresh([this.root]) /** soft refresh **/)); this._register(this.themeService.onThemeChange(() => this.doRefresh([this.root]) /** soft refresh **/)); + this._register(this.configurationService.onDidChangeConfiguration(e => { + if (e.affectsConfiguration('explorer.decorations')) { + this.doRefresh([this.root]); /** soft refresh **/ + } + })); } get dataProvider(): ITreeViewDataProvider { @@ -458,7 +464,8 @@ class TreeRenderer implements IRenderer { private menus: TreeMenus, private actionItemProvider: IActionItemProvider, @IInstantiationService private instantiationService: IInstantiationService, - @IWorkbenchThemeService private themeService: IWorkbenchThemeService + @IWorkbenchThemeService private themeService: IWorkbenchThemeService, + @IConfigurationService private configurationService: IConfigurationService, ) { } @@ -496,7 +503,8 @@ class TreeRenderer implements IRenderer { templateData.actionBar.clear(); if ((resource || node.themeIcon) && !icon) { - templateData.resourceLabel.setLabel({ name: label, resource: resource ? resource : URI.parse('_icon_resource') }, { fileKind: this.getFileKind(node), title, fileDecorations: node.decorations, extraClasses: ['custom-view-tree-node-item-resourceLabel'] }); + const fileDecorations = this.configurationService.getValue<{ colors: boolean, badges: boolean }>('explorer.decorations'); + templateData.resourceLabel.setLabel({ name: label, resource: resource ? resource : URI.parse('_icon_resource') }, { fileKind: this.getFileKind(node), title, fileDecorations: fileDecorations, extraClasses: ['custom-view-tree-node-item-resourceLabel'] }); } else { templateData.resourceLabel.setLabel({ name: label }, { title, hideIcon: true, extraClasses: ['custom-view-tree-node-item-resourceLabel'] }); } diff --git a/src/vs/workbench/common/views.ts b/src/vs/workbench/common/views.ts index 0a1bee98c3c..b1049fab080 100644 --- a/src/vs/workbench/common/views.ts +++ b/src/vs/workbench/common/views.ts @@ -288,12 +288,6 @@ export interface ITreeItem { command?: Command; children?: ITreeItem[]; - - decorations?: { - colors: boolean, - badges: boolean - }; - } export interface ITreeViewDataProvider { From b1f7de5b4f549fba7b521d726f942ac4fbafeced Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Jul 2018 15:12:55 +0200 Subject: [PATCH 60/93] fix #54741 --- src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts index 5a49481c2ec..a2c94bbd01e 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts @@ -102,7 +102,7 @@ export abstract class BreadcrumbsPicker { this._tree.setInput(actualInput).then(() => { let selection = this._getInitialSelection(this._tree, input); if (selection) { - this._tree.reveal(selection).then(() => { + this._tree.reveal(selection, .5).then(() => { this._tree.setSelection([selection], this._tree); this._tree.setFocus(selection); this._tree.domFocus(); From f6d4c244a9a71ea7b7a1de1bf0dc3c1b4d5264b4 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Jul 2018 15:22:15 +0200 Subject: [PATCH 61/93] don't show title for symbol, #54747 --- src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts index c8a2110bfd2..e2fdd803f15 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts @@ -76,9 +76,9 @@ class Item extends BreadcrumbsItem { let label = this._instantiationService.createInstance(FileLabel, container, {}); label.setFile(this.element.uri, { hidePath: true, - fileKind: this.element.isFile ? FileKind.FILE : FileKind.FOLDER, hideIcon: !this.element.isFile || !this.options.showFileIcons, - fileDecorations: { colors: this.options.showDecorationColors, badges: false } + fileKind: this.element.isFile ? FileKind.FILE : FileKind.FOLDER, + fileDecorations: { colors: this.options.showDecorationColors, badges: false }, }); this._disposables.push(label); dom.toggleClass(container, 'file', this.element.isFile); @@ -105,7 +105,7 @@ class Item extends BreadcrumbsItem { } let label = new IconLabel(container); let title = this.element.symbol.name.replace(/\r|\n|\r\n/g, '\u23CE'); - label.setValue(title, undefined, { title }); + label.setValue(title); this._disposables.push(label); } } From ca4f1bef4239a3e223b9ae5404d51f466cc72e26 Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 24 Jul 2018 15:54:51 +0200 Subject: [PATCH 62/93] history navigation: read out changes to screen reader fixes #52401 --- src/vs/base/browser/ui/inputbox/inputBox.ts | 2 ++ src/vs/workbench/parts/debug/electron-browser/repl.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/vs/base/browser/ui/inputbox/inputBox.ts b/src/vs/base/browser/ui/inputbox/inputBox.ts index 17b36ec3dea..1691821da48 100644 --- a/src/vs/base/browser/ui/inputbox/inputBox.ts +++ b/src/vs/base/browser/ui/inputbox/inputBox.ts @@ -535,6 +535,7 @@ export class HistoryInputBox extends InputBox implements IHistoryNavigationWidge if (next) { this.value = next; + aria.status(this.value); } } @@ -550,6 +551,7 @@ export class HistoryInputBox extends InputBox implements IHistoryNavigationWidge if (previous) { this.value = previous; + aria.status(this.value); } } diff --git a/src/vs/workbench/parts/debug/electron-browser/repl.ts b/src/vs/workbench/parts/debug/electron-browser/repl.ts index 35b974a511b..fdd2f9ac975 100644 --- a/src/vs/workbench/parts/debug/electron-browser/repl.ts +++ b/src/vs/workbench/parts/debug/electron-browser/repl.ts @@ -11,6 +11,7 @@ import { TPromise } from 'vs/base/common/winjs.base'; import * as errors from 'vs/base/common/errors'; import { IAction } from 'vs/base/common/actions'; import * as dom from 'vs/base/browser/dom'; +import * as aria from 'vs/base/browser/ui/aria/aria'; import { isMacintosh } from 'vs/base/common/platform'; import { CancellationToken } from 'vs/base/common/cancellation'; import { KeyCode } from 'vs/base/common/keyCodes'; @@ -210,6 +211,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati const historyInput = previous ? this.history.previous() : this.history.next(); if (historyInput) { this.replInput.setValue(historyInput); + aria.status(historyInput); // always leave cursor at the end. this.replInput.setPosition({ lineNumber: 1, column: historyInput.length + 1 }); this.historyNavigationEnablement.set(true); From 46f0f8bd61b0a59b1f98136b64a81c79f7333424 Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 24 Jul 2018 16:13:46 +0200 Subject: [PATCH 63/93] anounce once debug console and output get cleared via actions fixes #52399 --- src/vs/workbench/parts/debug/browser/debugActions.ts | 2 ++ src/vs/workbench/parts/output/browser/outputActions.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/vs/workbench/parts/debug/browser/debugActions.ts b/src/vs/workbench/parts/debug/browser/debugActions.ts index 26931ec59c2..04fd4058642 100644 --- a/src/vs/workbench/parts/debug/browser/debugActions.ts +++ b/src/vs/workbench/parts/debug/browser/debugActions.ts @@ -9,6 +9,7 @@ import * as lifecycle from 'vs/base/common/lifecycle'; import { TPromise } from 'vs/base/common/winjs.base'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { ICommandService } from 'vs/platform/commands/common/commands'; +import * as aria from 'vs/base/browser/ui/aria/aria'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IFileService } from 'vs/platform/files/common/files'; import { IDebugService, State, ISession, IThread, IEnablement, IBreakpoint, IStackFrame, REPL_ID, SessionState } @@ -691,6 +692,7 @@ export class ClearReplAction extends AbstractDebugAction { public run(): TPromise { this.debugService.removeReplExpressions(); + aria.status(nls.localize('debugConsoleCleared', "Debug console was cleared")); // focus back to repl return this.panelService.openPanel(REPL_ID, true); diff --git a/src/vs/workbench/parts/output/browser/outputActions.ts b/src/vs/workbench/parts/output/browser/outputActions.ts index 8543c9bb2b0..4334f2886d6 100644 --- a/src/vs/workbench/parts/output/browser/outputActions.ts +++ b/src/vs/workbench/parts/output/browser/outputActions.ts @@ -6,6 +6,7 @@ import { TPromise } from 'vs/base/common/winjs.base'; import * as nls from 'vs/nls'; +import * as aria from 'vs/base/browser/ui/aria/aria'; import { IAction, Action } from 'vs/base/common/actions'; import { IOutputService, OUTPUT_PANEL_ID, IOutputChannelRegistry, Extensions as OutputExt, IOutputChannelIdentifier, COMMAND_OPEN_LOG_VIEWER } from 'vs/workbench/parts/output/common/output'; import { SelectActionItem } from 'vs/base/browser/ui/actionbar/actionbar'; @@ -49,6 +50,7 @@ export class ClearOutputAction extends Action { public run(): TPromise { this.outputService.getActiveChannel().clear(); + aria.status(nls.localize('outputCleared', "Output was cleared")); return TPromise.as(true); } From 32ecb994de7e0b286beb1102cc474e4442939ea4 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 24 Jul 2018 16:13:58 +0200 Subject: [PATCH 64/93] do not support folder paths on windows as folder uris --- src/vs/code/electron-main/windows.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index 67c1aa41616..482676324a4 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -851,7 +851,7 @@ export class WindowsManager implements IWindowsMainService { if (cli['folder-uri'] && cli['folder-uri'].length) { const arg = cli['folder-uri']; const folderUris: string[] = typeof arg === 'string' ? [arg] : arg; - pathsToOpen.push(...arrays.coalesce(folderUris.map(candidate => this.parseUri(URI.parse(candidate), { ignoreFileNotFound: true, gotoLineMode: cli.goto })))); + pathsToOpen.push(...arrays.coalesce(folderUris.map(candidate => this.parseUri(this.parseFolderUriArg(candidate), { ignoreFileNotFound: true, gotoLineMode: cli.goto })))); } // folder or file paths @@ -963,6 +963,14 @@ export class WindowsManager implements IWindowsMainService { return restoreWindows; } + private parseFolderUriArg(arg: string): URI { + // Do not support if user has passed folder path on Windows + if (isWindows && /^([a-z])\:(.*)$/i.test(arg)) { + return null; + } + return URI.parse(arg); + } + private parseUri(anyUri: URI, options?: { ignoreFileNotFound?: boolean, gotoLineMode?: boolean, forceOpenWorkspaceAsFile?: boolean; }): IPathToOpen { if (!anyUri || !anyUri.scheme) { return null; @@ -1110,7 +1118,7 @@ export class WindowsManager implements IWindowsMainService { if (openConfig.cli['folder-uri']) { const arg = openConfig.cli['folder-uri']; const folderUris: string[] = typeof arg === 'string' ? [arg] : arg; - if (folderUris.some(uri => !!findWindowOnWorkspaceOrFolderUri(WindowsManager.WINDOWS, URI.parse(uri)))) { + if (folderUris.some(uri => !!findWindowOnWorkspaceOrFolderUri(WindowsManager.WINDOWS, this.parseFolderUriArg(uri)))) { openConfig.cli['folder-uri'] = []; } } From 0aee16bab6bdb9a14c0f4f76f6f8528e38a550ac Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 24 Jul 2018 16:24:25 +0200 Subject: [PATCH 65/93] Fix #52944 --- src/vs/workbench/api/node/extHost.api.impl.ts | 2 +- src/vs/workbench/api/node/extHostTreeViews.ts | 10 ++++++---- .../test/electron-browser/api/extHostTreeViews.test.ts | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index ed91294b6c5..4ca5751ecef 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -110,7 +110,7 @@ export function createApiFactory( const extHostDocumentSaveParticipant = rpcProtocol.set(ExtHostContext.ExtHostDocumentSaveParticipant, new ExtHostDocumentSaveParticipant(extHostLogService, extHostDocuments, rpcProtocol.getProxy(MainContext.MainThreadTextEditors))); const extHostEditors = rpcProtocol.set(ExtHostContext.ExtHostEditors, new ExtHostEditors(rpcProtocol, extHostDocumentsAndEditors)); const extHostCommands = rpcProtocol.set(ExtHostContext.ExtHostCommands, new ExtHostCommands(rpcProtocol, extHostHeapService, extHostLogService)); - const extHostTreeViews = rpcProtocol.set(ExtHostContext.ExtHostTreeViews, new ExtHostTreeViews(rpcProtocol.getProxy(MainContext.MainThreadTreeViews), extHostCommands)); + const extHostTreeViews = rpcProtocol.set(ExtHostContext.ExtHostTreeViews, new ExtHostTreeViews(rpcProtocol.getProxy(MainContext.MainThreadTreeViews), extHostCommands, extHostLogService)); rpcProtocol.set(ExtHostContext.ExtHostWorkspace, extHostWorkspace); rpcProtocol.set(ExtHostContext.ExtHostConfiguration, extHostConfiguration); const extHostDiagnostics = rpcProtocol.set(ExtHostContext.ExtHostDiagnostics, new ExtHostDiagnostics(rpcProtocol)); diff --git a/src/vs/workbench/api/node/extHostTreeViews.ts b/src/vs/workbench/api/node/extHostTreeViews.ts index a63e56f9972..811fc4b464b 100644 --- a/src/vs/workbench/api/node/extHostTreeViews.ts +++ b/src/vs/workbench/api/node/extHostTreeViews.ts @@ -18,6 +18,7 @@ import { asWinJsPromise } from 'vs/base/common/async'; import { TreeItemCollapsibleState, ThemeIcon } from 'vs/workbench/api/node/extHostTypes'; import { isUndefinedOrNull } from 'vs/base/common/types'; import { equals } from 'vs/base/common/arrays'; +import { ILogService } from 'vs/platform/log/common/log'; type TreeItemHandle = string; @@ -27,7 +28,8 @@ export class ExtHostTreeViews implements ExtHostTreeViewsShape { constructor( private _proxy: MainThreadTreeViewsShape, - private commands: ExtHostCommands + private commands: ExtHostCommands, + private logService: ILogService ) { commands.registerArgumentProcessor({ processArgument: arg => { @@ -99,7 +101,7 @@ export class ExtHostTreeViews implements ExtHostTreeViewsShape { } private createExtHostTreeViewer(id: string, dataProvider: vscode.TreeDataProvider): ExtHostTreeView { - const treeView = new ExtHostTreeView(id, dataProvider, this._proxy, this.commands.converter); + const treeView = new ExtHostTreeView(id, dataProvider, this._proxy, this.commands.converter, this.logService); this.treeViews.set(id, treeView); return treeView; } @@ -145,7 +147,7 @@ class ExtHostTreeView extends Disposable { private refreshPromise: TPromise = TPromise.as(null); - constructor(private viewId: string, private dataProvider: vscode.TreeDataProvider, private proxy: MainThreadTreeViewsShape, private commands: CommandsConverter) { + constructor(private viewId: string, private dataProvider: vscode.TreeDataProvider, private proxy: MainThreadTreeViewsShape, private commands: CommandsConverter, private logService: ILogService) { super(); this.proxy.$registerTreeViewDataProvider(viewId); if (this.dataProvider.onDidChangeTreeData) { @@ -192,7 +194,7 @@ class ExtHostTreeView extends Disposable { return this.refreshPromise .then(() => this.resolveUnknownParentChain(element)) .then(parentChain => this.resolveTreeNode(element, parentChain[parentChain.length - 1]) - .then(treeNode => this.proxy.$reveal(this.viewId, treeNode.item, parentChain.map(p => p.item), { select, focus }))); + .then(treeNode => this.proxy.$reveal(this.viewId, treeNode.item, parentChain.map(p => p.item), { select, focus })), error => this.logService.error(error)); } setExpanded(treeItemHandle: TreeItemHandle, expanded: boolean): void { 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 57894ee26cd..a62fde4bcb8 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts @@ -72,7 +72,7 @@ suite('ExtHostTreeView', function () { rpcProtocol.set(MainContext.MainThreadCommands, inst.createInstance(MainThreadCommands, rpcProtocol)); target = new RecordingShape(); - testObject = new ExtHostTreeViews(target, new ExtHostCommands(rpcProtocol, new ExtHostHeapService(), new NullLogService())); + testObject = new ExtHostTreeViews(target, new ExtHostCommands(rpcProtocol, new ExtHostHeapService(), new NullLogService()), new NullLogService()); onDidChangeTreeNode = new Emitter<{ key: string }>(); onDidChangeTreeNodeWithId = new Emitter<{ key: string }>(); testObject.createTreeView('testNodeTreeProvider', { treeDataProvider: aNodeTreeDataProvider() }); From c890e6caf6595ab647780126f4fc97e5a48a587e Mon Sep 17 00:00:00 2001 From: Aldo Donetti Date: Mon, 23 Jul 2018 19:34:48 +0200 Subject: [PATCH 66/93] typo as part of the localization effort @agriffard noticed that an english string was incorrect - fixed here --- src/vs/workbench/browser/parts/editor/breadcrumbs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbs.ts b/src/vs/workbench/browser/parts/editor/breadcrumbs.ts index ac7b2f27130..83f309f828b 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbs.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbs.ts @@ -136,7 +136,7 @@ Registry.as(Extensions.Configuration).registerConfigurat default: 'on', enum: ['on', 'off', 'last'], enumDescriptions: [ - localize('symbolpath.on', "Show all symbols the breadcrumbs view."), + localize('symbolpath.on', "Show all symbols in the breadcrumbs view."), localize('symbolpath.off', "Do not show symbols in the breadcrumbs view."), localize('symbolpath.last', "Only show the current symbol in the breadcrumbs view."), ] From 7d967a50cee238c50c4e220670753739d12d98f5 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 24 Jul 2018 16:42:31 +0200 Subject: [PATCH 67/93] Replace schema check with file service handling --- .../extensions/electron-browser/extensionTipsService.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/parts/extensions/electron-browser/extensionTipsService.ts b/src/vs/workbench/parts/extensions/electron-browser/extensionTipsService.ts index 728d2b9e9b3..ab53ea18d8b 100644 --- a/src/vs/workbench/parts/extensions/electron-browser/extensionTipsService.ts +++ b/src/vs/workbench/parts/extensions/electron-browser/extensionTipsService.ts @@ -43,7 +43,6 @@ import { assign } from 'vs/base/common/objects'; import URI from 'vs/base/common/uri'; import { areSameExtensions, getGalleryExtensionIdFromLocal } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { IExperimentService, ExperimentActionType, ExperimentState } from 'vs/workbench/parts/experiments/node/experimentService'; -import { Schemas } from 'vs/base/common/network'; const milliSecondsInADay = 1000 * 60 * 60 * 24; const choiceNever = localize('neverShowAgain', "Don't Show Again"); @@ -500,7 +499,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe let hasSuggestion = false; const uri = model.uri; - if (!uri || uri.scheme !== Schemas.file) { + if (!uri || !this.fileService.canHandleResource(uri)) { return; } @@ -892,7 +891,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe private fetchDynamicWorkspaceRecommendations(): TPromise { if (this.contextService.getWorkbenchState() !== WorkbenchState.FOLDER - || this.contextService.getWorkspace().folders[0].uri.scheme !== Schemas.file // #54483: check with @Ramya + || !this.fileService.canHandleResource(this.contextService.getWorkspace().folders[0].uri) || this._dynamicWorkspaceRecommendations.length || !this._extensionsRecommendationsUrl) { return TPromise.as(null); From 5c82fedfed58e186c179606643010e6b299abfbe Mon Sep 17 00:00:00 2001 From: Christof Marti Date: Tue, 24 Jul 2018 16:45:10 +0200 Subject: [PATCH 68/93] Include list/tree in tab order and cycle within QuickInput/Open widget (fixes #51850) --- .../parts/quickopen/browser/quickOpenWidget.ts | 13 +++++++++++-- .../browser/parts/quickinput/quickInput.ts | 18 +++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts b/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts index 2a3a7f0d15a..8341fd31256 100644 --- a/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts +++ b/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts @@ -152,6 +152,15 @@ export class QuickOpenWidget extends Disposable implements IModelProvider { DOM.EventHelper.stop(e, true); this.hide(HideReason.CANCELED); + } else if (keyboardEvent.keyCode === KeyCode.Tab && !keyboardEvent.altKey && !keyboardEvent.ctrlKey && !keyboardEvent.metaKey) { + const stops = e.currentTarget.querySelectorAll('input, .monaco-tree, .monaco-tree-row.focused .action-label.icon'); + if (keyboardEvent.shiftKey && keyboardEvent.target === stops[0]) { + DOM.EventHelper.stop(e, true); + stops[stops.length - 1].focus(); + } else if (!keyboardEvent.shiftKey && keyboardEvent.target === stops[stops.length - 1]) { + DOM.EventHelper.stop(e, true); + stops[0].focus(); + } } }) .on(DOM.EventType.CONTEXT_MENU, (e: Event) => DOM.EventHelper.stop(e, true)) // Do this to fix an issue on Mac where the menu goes into the way @@ -243,7 +252,7 @@ export class QuickOpenWidget extends Disposable implements IModelProvider { horizontalScrollMode: ScrollbarVisibility.Hidden, ariaLabel: nls.localize('treeAriaLabel', "Quick Picker"), keyboardSupport: this.options.keyboardSupport, - preventRootFocus: true + preventRootFocus: false })); this.treeElement = this.tree.getHTMLElement(); @@ -348,7 +357,7 @@ export class QuickOpenWidget extends Disposable implements IModelProvider { if (keyboardEvent.keyCode === KeyCode.DownArrow || keyboardEvent.keyCode === KeyCode.UpArrow || keyboardEvent.keyCode === KeyCode.PageDown || keyboardEvent.keyCode === KeyCode.PageUp) { DOM.EventHelper.stop(e, true); this.navigateInTree(keyboardEvent.keyCode, keyboardEvent.shiftKey); - this.inputBox.inputElement.focus(); + this.treeElement.focus(); } }); return this.builder.getHTMLElement(); diff --git a/src/vs/workbench/browser/parts/quickinput/quickInput.ts b/src/vs/workbench/browser/parts/quickinput/quickInput.ts index b56ee969d43..d5c136bce83 100644 --- a/src/vs/workbench/browser/parts/quickinput/quickInput.ts +++ b/src/vs/workbench/browser/parts/quickinput/quickInput.ts @@ -849,18 +849,22 @@ export class QuickInputService extends Component implements IQuickInputService { break; case KeyCode.Tab: if (!event.altKey && !event.ctrlKey && !event.metaKey) { - const inputs = [].slice.call(container.querySelectorAll('.action-label.icon')); + const selectors = ['.action-label.icon']; if (container.classList.contains('show-checkboxes')) { - inputs.push(...[].slice.call(container.querySelectorAll('input'))); + selectors.push('input'); } else { - inputs.push(...[].slice.call(container.querySelectorAll('input[type=text]'))); + selectors.push('input[type=text]'); } - if (event.shiftKey && event.target === inputs[0]) { + if (this.ui.list.isDisplayed()) { + selectors.push('.monaco-list'); + } + const stops = container.querySelectorAll(selectors.join(', ')); + if (event.shiftKey && event.target === stops[0]) { dom.EventHelper.stop(e, true); - inputs[inputs.length - 1].focus(); - } else if (!event.shiftKey && event.target === inputs[inputs.length - 1]) { + stops[stops.length - 1].focus(); + } else if (!event.shiftKey && event.target === stops[stops.length - 1]) { dom.EventHelper.stop(e, true); - inputs[0].focus(); + stops[0].focus(); } } break; From 48464ea52de65496ff3b85f36d0a1fc1a820879d Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 24 Jul 2018 16:59:37 +0200 Subject: [PATCH 69/93] clean up --- .../preferences/browser/preferencesActions.ts | 8 ++++---- .../electron-browser/preferences.contribution.ts | 4 ++-- .../preferences/browser/preferencesService.ts | 14 ++++++-------- .../services/preferences/common/preferences.ts | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/vs/workbench/parts/preferences/browser/preferencesActions.ts b/src/vs/workbench/parts/preferences/browser/preferencesActions.ts index ca361afc387..70beb50fe4f 100644 --- a/src/vs/workbench/parts/preferences/browser/preferencesActions.ts +++ b/src/vs/workbench/parts/preferences/browser/preferencesActions.ts @@ -125,10 +125,10 @@ export class OpenGlobalKeybindingsFileAction extends Action { } } -export class OpenRawDefaultKeybindingsAction extends Action { +export class OpenDefaultKeybindingsFileAction extends Action { - public static readonly ID = 'workbench.action.openRawDefaultKeybindings'; - public static readonly LABEL = nls.localize('openRawDefaultKeybindings', "Open Default Keyboard Shortcuts File"); + public static readonly ID = 'workbench.action.openDefaultKeybindingsFile'; + public static readonly LABEL = nls.localize('openDefaultKeybindingsFile', "Open Default Keyboard Shortcuts File"); constructor( id: string, @@ -139,7 +139,7 @@ export class OpenRawDefaultKeybindingsAction extends Action { } public run(event?: any): TPromise { - return this.preferencesService.openRawDefaultKeybindings(); + return this.preferencesService.openDefaultKeybindingsFile(); } } diff --git a/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts b/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts index 24a5d4d92bb..3e2d2137832 100644 --- a/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts +++ b/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts @@ -19,7 +19,7 @@ import { PreferencesEditor } from 'vs/workbench/parts/preferences/browser/prefer import { SettingsEditor2 } from 'vs/workbench/parts/preferences/browser/settingsEditor2'; import { DefaultPreferencesEditorInput, PreferencesEditorInput, KeybindingsEditorInput, SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput'; import { KeybindingsEditor } from 'vs/workbench/parts/preferences/browser/keybindingsEditor'; -import { OpenRawDefaultKeybindingsAction, OpenRawDefaultSettingsAction, OpenSettingsAction, OpenGlobalSettingsAction, OpenGlobalKeybindingsFileAction, OpenWorkspaceSettingsAction, OpenFolderSettingsAction, ConfigureLanguageBasedSettingsAction, OPEN_FOLDER_SETTINGS_COMMAND, OpenGlobalKeybindingsAction, OpenSettings2Action } from 'vs/workbench/parts/preferences/browser/preferencesActions'; +import { OpenDefaultKeybindingsFileAction, OpenRawDefaultSettingsAction, OpenSettingsAction, OpenGlobalSettingsAction, OpenGlobalKeybindingsFileAction, OpenWorkspaceSettingsAction, OpenFolderSettingsAction, ConfigureLanguageBasedSettingsAction, OPEN_FOLDER_SETTINGS_COMMAND, OpenGlobalKeybindingsAction, OpenSettings2Action } from 'vs/workbench/parts/preferences/browser/preferencesActions'; import { IKeybindingsEditor, IPreferencesSearchService, CONTEXT_KEYBINDING_FOCUS, CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDINGS_SEARCH_FOCUS, KEYBINDINGS_EDITOR_COMMAND_DEFINE, KEYBINDINGS_EDITOR_COMMAND_REMOVE, KEYBINDINGS_EDITOR_COMMAND_SEARCH, KEYBINDINGS_EDITOR_COMMAND_COPY, KEYBINDINGS_EDITOR_COMMAND_RESET, KEYBINDINGS_EDITOR_COMMAND_COPY_COMMAND, KEYBINDINGS_EDITOR_COMMAND_SHOW_SIMILAR, KEYBINDINGS_EDITOR_COMMAND_FOCUS_KEYBINDINGS, KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, SETTINGS_EDITOR_COMMAND_SEARCH, CONTEXT_SETTINGS_EDITOR, SETTINGS_EDITOR_COMMAND_FOCUS_FILE, CONTEXT_SETTINGS_SEARCH_FOCUS, SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, SETTINGS_EDITOR_COMMAND_FOCUS_NEXT_SETTING, SETTINGS_EDITOR_COMMAND_FOCUS_PREVIOUS_SETTING, SETTINGS_EDITOR_COMMAND_EDIT_FOCUSED_SETTING, SETTINGS_EDITOR_COMMAND_FOCUS_SEARCH_FROM_SETTINGS, SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_FROM_SEARCH, CONTEXT_SETTINGS_FIRST_ROW_FOCUS, CONTEXT_SETTINGS_ROW_FOCUS, CONTEXT_TOC_ROW_FOCUS, SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_LIST @@ -195,7 +195,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettingsAction, Op registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettings2Action, OpenSettings2Action.ID, OpenSettings2Action.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.US_COMMA }), 'Preferences: Open Settings (Preview)', category); registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalSettingsAction, OpenGlobalSettingsAction.ID, OpenGlobalSettingsAction.LABEL), 'Preferences: Open User Settings', category); registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalKeybindingsAction, OpenGlobalKeybindingsAction.ID, OpenGlobalKeybindingsAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_S) }), 'Preferences: Open Keyboard Shortcuts', category); -registry.registerWorkbenchAction(new SyncActionDescriptor(OpenRawDefaultKeybindingsAction, OpenRawDefaultKeybindingsAction.ID, OpenRawDefaultKeybindingsAction.LABEL), 'Preferences: Open Raw Default Settings', category); +registry.registerWorkbenchAction(new SyncActionDescriptor(OpenDefaultKeybindingsFileAction, OpenDefaultKeybindingsFileAction.ID, OpenDefaultKeybindingsFileAction.LABEL), 'Preferences: Open Default Keyboard Shortcuts File', category); registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalKeybindingsFileAction, OpenGlobalKeybindingsFileAction.ID, OpenGlobalKeybindingsFileAction.LABEL, { primary: null }), 'Preferences: Open Keyboard Shortcuts File', category); registry.registerWorkbenchAction(new SyncActionDescriptor(ConfigureLanguageBasedSettingsAction, ConfigureLanguageBasedSettingsAction.ID, ConfigureLanguageBasedSettingsAction.LABEL), 'Preferences: Configure Language Specific Settings...', category); diff --git a/src/vs/workbench/services/preferences/browser/preferencesService.ts b/src/vs/workbench/services/preferences/browser/preferencesService.ts index 1a5000f09d1..f0c69877821 100644 --- a/src/vs/workbench/services/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/services/preferences/browser/preferencesService.ts @@ -224,26 +224,24 @@ export class PreferencesService extends Disposable implements IPreferencesServic const openDefaultKeybindings = !!this.configurationService.getValue('workbench.settings.openDefaultKeybindings'); // Create as needed and open in editor - if (openDefaultKeybindings) { - return this.createIfNotExists(editableKeybindings, emptyContents).then(() => { + return this.createIfNotExists(editableKeybindings, emptyContents).then(() => { + if (openDefaultKeybindings) { const activeEditorGroup = this.editorGroupService.activeGroup; const sideEditorGroup = this.editorGroupService.addGroup(activeEditorGroup.id, GroupDirection.RIGHT); - return TPromise.join([ this.editorService.openEditor({ resource: this.defaultKeybindingsResource, options: { pinned: true, preserveFocus: true }, label: nls.localize('defaultKeybindings', "Default Keybindings"), description: '' }), this.editorService.openEditor({ resource: editableKeybindings, options: { pinned: true } }, sideEditorGroup.id) ]).then(editors => void 0); - }); - } - return this.createIfNotExists(editableKeybindings, emptyContents).then(() => { - return this.editorService.openEditor({ resource: editableKeybindings, options: { pinned: true } }).then(editors => void 0); + } else { + return this.editorService.openEditor({ resource: editableKeybindings, options: { pinned: true } }).then(() => void 0); + } }); } return this.editorService.openEditor(this.instantiationService.createInstance(KeybindingsEditorInput), { pinned: true }).then(() => null); } - openRawDefaultKeybindings(): TPromise { + openDefaultKeybindingsFile(): TPromise { return this.editorService.openEditor({ resource: this.defaultKeybindingsResource }); } diff --git a/src/vs/workbench/services/preferences/common/preferences.ts b/src/vs/workbench/services/preferences/common/preferences.ts index 2cb6cef8877..c3174c92663 100644 --- a/src/vs/workbench/services/preferences/common/preferences.ts +++ b/src/vs/workbench/services/preferences/common/preferences.ts @@ -152,7 +152,7 @@ export interface IPreferencesService { openFolderSettings(folder: URI, options?: IEditorOptions, group?: IEditorGroup): TPromise; switchSettings(target: ConfigurationTarget, resource: URI): TPromise; openGlobalKeybindingSettings(textual: boolean): TPromise; - openRawDefaultKeybindings(): TPromise; + openDefaultKeybindingsFile(): TPromise; configureSettingsForLanguage(language: string): void; } From cf2788274ad3273cfa6c4cb218e2b8bc68ff7479 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Jul 2018 15:41:32 +0200 Subject: [PATCH 70/93] use FileKind in FileElement, #54370 --- .../browser/parts/editor/breadcrumbsControl.ts | 7 +++---- .../browser/parts/editor/breadcrumbsModel.ts | 5 +++-- .../browser/parts/editor/breadcrumbsPicker.ts | 2 +- .../test/browser/parts/editor/breadcrumbModel.test.ts | 11 ++++++----- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts index e2fdd803f15..cd96411515f 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts @@ -76,12 +76,11 @@ class Item extends BreadcrumbsItem { let label = this._instantiationService.createInstance(FileLabel, container, {}); label.setFile(this.element.uri, { hidePath: true, - hideIcon: !this.element.isFile || !this.options.showFileIcons, - fileKind: this.element.isFile ? FileKind.FILE : FileKind.FOLDER, + hideIcon: this.element.kind !== FileKind.FILE || !this.options.showFileIcons, + fileKind: this.element.kind, fileDecorations: { colors: this.options.showDecorationColors, badges: false }, }); this._disposables.push(label); - dom.toggleClass(container, 'file', this.element.isFile); } else if (this.element instanceof OutlineModel) { // has outline element but not in one @@ -323,7 +322,7 @@ export class BreadcrumbsControl { private _revealInEditor(event: IBreadcrumbsItemEvent, data: any): void { if (data instanceof FileElement) { - if (data.isFile) { + if (data.kind === FileKind.FILE) { // open file in editor this._editorService.openEditor({ resource: data.uri }); } else { diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts index 6ce3e9ad8ab..b469b3f3614 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts @@ -23,11 +23,12 @@ import { IWorkspaceContextService, IWorkspaceFolder, WorkbenchState } from 'vs/p import { Schemas } from 'vs/base/common/network'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { BreadcrumbsConfig } from 'vs/workbench/browser/parts/editor/breadcrumbs'; +import { FileKind } from 'vs/platform/files/common/files'; export class FileElement { constructor( readonly uri: URI, - readonly isFile: boolean + readonly kind: FileKind ) { } } @@ -117,7 +118,7 @@ export class EditorBreadcrumbsModel { if (info.folder && isEqual(info.folder.uri, uri)) { break; } - info.path.unshift(new FileElement(uri, info.path.length === 0)); + info.path.unshift(new FileElement(uri, info.path.length === 0 ? FileKind.FILE : FileKind.FOLDER)); uri = uri.with({ path: paths.dirname(uri.path) }); } return info; diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts index a2c94bbd01e..875d03c81cf 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts @@ -259,7 +259,7 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker { let [first] = e.selection; let stat = first as IFileStat; if (stat && !stat.isDirectory) { - this._onDidPickElement.fire(new FileElement(stat.resource, true)); + this._onDidPickElement.fire(new FileElement(stat.resource, FileKind.FILE)); } } } diff --git a/src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts b/src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts index bb0721629f8..e524bcd9ef2 100644 --- a/src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts +++ b/src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts @@ -11,6 +11,7 @@ import { Workspace, WorkspaceFolder } from 'vs/platform/workspace/common/workspa import { EditorBreadcrumbsModel, FileElement } from 'vs/workbench/browser/parts/editor/breadcrumbsModel'; import { TestContextService } from 'vs/workbench/test/workbenchTestServices'; import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; +import { FileKind } from 'vs/platform/files/common/files'; suite('Breadcrumb Model', function () { @@ -35,9 +36,9 @@ suite('Breadcrumb Model', function () { assert.equal(elements.length, 3); let [one, two, three] = elements as FileElement[]; - assert.equal(one.isFile, false); - assert.equal(two.isFile, false); - assert.equal(three.isFile, true); + assert.equal(one.kind, FileKind.FOLDER); + assert.equal(two.kind, FileKind.FOLDER); + assert.equal(three.kind, FileKind.FILE); assert.equal(one.uri.toString(), 'foo:/bar/baz/ws/some'); assert.equal(two.uri.toString(), 'foo:/bar/baz/ws/some/path'); assert.equal(three.uri.toString(), 'foo:/bar/baz/ws/some/path/file.ts'); @@ -50,8 +51,8 @@ suite('Breadcrumb Model', function () { assert.equal(elements.length, 2); let [one, two] = elements as FileElement[]; - assert.equal(one.isFile, false); - assert.equal(two.isFile, true); + assert.equal(one.kind, FileKind.FOLDER); + assert.equal(two.kind, FileKind.FILE); assert.equal(one.uri.toString(), 'foo:/outside'); assert.equal(two.uri.toString(), 'foo:/outside/file.ts'); }); From d406fc48dfdf4a8c792011e8de05923338b38062 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Jul 2018 16:46:18 +0200 Subject: [PATCH 71/93] add workspace folders to model and picker #54370 --- src/vs/platform/workspace/common/workspace.ts | 18 +++ .../parts/editor/breadcrumbsControl.ts | 1 + .../browser/parts/editor/breadcrumbsModel.ts | 8 +- .../browser/parts/editor/breadcrumbsPicker.ts | 124 ++++++++++++------ 4 files changed, 111 insertions(+), 40 deletions(-) diff --git a/src/vs/platform/workspace/common/workspace.ts b/src/vs/platform/workspace/common/workspace.ts index 39a413b09e4..4d2a8cc88d5 100644 --- a/src/vs/platform/workspace/common/workspace.ts +++ b/src/vs/platform/workspace/common/workspace.ts @@ -77,6 +77,15 @@ export interface IWorkspaceContextService { isInsideWorkspace(resource: URI): boolean; } +export namespace IWorkspace { + export function isIWorkspace(thing: any): thing is IWorkspace { + return thing && typeof thing === 'object' + && typeof (thing as IWorkspace).id === 'string' + && typeof (thing as IWorkspace).name === 'string' + && Array.isArray((thing as IWorkspace).folders); + } +} + export interface IWorkspace { /** @@ -118,6 +127,15 @@ export interface IWorkspaceFolderData { readonly index: number; } +export namespace IWorkspaceFolder { + export function isIWorkspaceFolder(thing: any): thing is IWorkspaceFolder { + return thing && typeof thing === 'object' + && URI.isUri((thing as IWorkspaceFolder).uri) + && typeof (thing as IWorkspaceFolder).name === 'string' + && typeof (thing as IWorkspaceFolder).toResource === 'function'; + } +} + export interface IWorkspaceFolder extends IWorkspaceFolderData { /** diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts index cd96411515f..3589b5a0899 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts @@ -75,6 +75,7 @@ class Item extends BreadcrumbsItem { // file/folder let label = this._instantiationService.createInstance(FileLabel, container, {}); label.setFile(this.element.uri, { + extraClasses: [FileKind[this.element.kind].toLowerCase()], hidePath: true, hideIcon: this.element.kind !== FileKind.FILE || !this.options.showFileIcons, fileKind: this.element.kind, diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts index b469b3f3614..40d9babb573 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts @@ -34,7 +34,7 @@ export class FileElement { export type BreadcrumbElement = FileElement | OutlineModel | OutlineGroup | OutlineElement; -type FileInfo = { path: FileElement[], folder: IWorkspaceFolder, showFolder: boolean }; +type FileInfo = { path: FileElement[], folder: IWorkspaceFolder }; export class EditorBreadcrumbsModel { @@ -102,14 +102,12 @@ export class EditorBreadcrumbsModel { if (uri.scheme === Schemas.untitled) { return { - showFolder: false, folder: undefined, path: [] }; } let info: FileInfo = { - showFolder: workspaceService.getWorkbenchState() === WorkbenchState.WORKSPACE, folder: workspaceService.getWorkspaceFolder(uri), path: [] }; @@ -121,6 +119,10 @@ export class EditorBreadcrumbsModel { info.path.unshift(new FileElement(uri, info.path.length === 0 ? FileKind.FILE : FileKind.FOLDER)); uri = uri.with({ path: paths.dirname(uri.path) }); } + + if (info.folder && workspaceService.getWorkbenchState() === WorkbenchState.WORKSPACE) { + info.path.unshift(new FileElement(info.folder.uri, FileKind.ROOT_FOLDER)); + } return info; } diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts index 875d03c81cf..c29f3e10307 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts @@ -26,6 +26,7 @@ import { BreadcrumbElement, FileElement } from 'vs/workbench/browser/parts/edito import { onUnexpectedError } from 'vs/base/common/errors'; import { breadcrumbsPickerBackground } from 'vs/platform/theme/common/colorRegistry'; import { FuzzyScore, createMatches, fuzzyScore } from 'vs/base/common/filters'; +import { IWorkspaceContextService, IWorkspace, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; export function createBreadcrumbsPicker(instantiationService: IInstantiationService, parent: HTMLElement, element: BreadcrumbElement): BreadcrumbsPicker { let ctor: IConstructorSignature1 = element instanceof FileElement ? BreadcrumbsFilePicker : BreadcrumbsOutlinePicker; @@ -136,39 +137,61 @@ export abstract class BreadcrumbsPicker { export class FileDataSource implements IDataSource { - private readonly _parents = new WeakMap(); + private readonly _parents = new WeakMap(); constructor( @IFileService private readonly _fileService: IFileService, ) { } - getId(tree: ITree, element: IFileStat | URI): string { - return URI.isUri(element) ? element.toString() : element.resource.toString(); + getId(tree: ITree, element: IWorkspace | IWorkspaceFolder | IFileStat | URI): string { + if (URI.isUri(element)) { + return element.toString(); + } else if (IWorkspace.isIWorkspace(element)) { + return element.id; + } else if (IWorkspaceFolder.isIWorkspaceFolder(element)) { + return element.uri.toString(); + } else { + return element.resource.toString(); + } } - hasChildren(tree: ITree, element: IFileStat | URI): boolean { - return URI.isUri(element) || element.isDirectory; + hasChildren(tree: ITree, element: IWorkspace | IWorkspaceFolder | IFileStat | URI): boolean { + return URI.isUri(element) || IWorkspace.isIWorkspace(element) || IWorkspaceFolder.isIWorkspaceFolder(element) || element.isDirectory; } - getChildren(tree: ITree, element: IFileStat | URI): TPromise { - return this._fileService.resolveFile( - URI.isUri(element) ? element : element.resource - ).then(stat => { - for (const child of stat.children) { - this._parents.set(child, stat); + getChildren(tree: ITree, element: IWorkspace | IWorkspaceFolder | IFileStat | URI): TPromise { + if (IWorkspace.isIWorkspace(element)) { + return TPromise.as(element.folders).then(folders => { + for (let child of folders) { + this._parents.set(element, child); + } + return folders; + }); + } + let uri: URI; + if (IWorkspaceFolder.isIWorkspaceFolder(element)) { + uri = element.uri; + } else if (URI.isUri(element)) { + uri = element; + } else { + uri = element.resource; + } + return this._fileService.resolveFile(uri).then(stat => { + for (let child of stat.children) { + this._parents.set(stat, child); } return stat.children; }); } - getParent(tree: ITree, element: IFileStat | URI): TPromise { - return TPromise.as(URI.isUri(element) ? undefined : this._parents.get(element)); + getParent(tree: ITree, element: IWorkspace | URI | IWorkspaceFolder | IFileStat): TPromise { + return TPromise.as(this._parents.get(element)); } } export class FileRenderer implements IRenderer, IHighlightingRenderer { - private readonly _scores = new Map(); + private readonly _scores = new Map(); constructor( @IInstantiationService private readonly _instantiationService: IInstantiationService @@ -186,13 +209,22 @@ export class FileRenderer implements IRenderer, IHighlightingRenderer { return this._instantiationService.createInstance(FileLabel, container, { supportHighlights: true }); } - renderElement(tree: ITree, element: IFileStat, templateId: string, templateData: FileLabel): void { - templateData.setFile(element.resource, { - hidePath: true, - fileKind: element.isDirectory ? FileKind.FOLDER : FileKind.FILE, - fileDecorations: { colors: true, badges: true }, - matches: createMatches((this._scores.get(element.resource.toString()) || [, []])[1]) - }); + renderElement(tree: ITree, element: IFileStat | IWorkspaceFolder, templateId: string, templateData: FileLabel): void { + if (IWorkspaceFolder.isIWorkspaceFolder(element)) { + templateData.setFile(element.uri, { + hidePath: true, + fileKind: FileKind.ROOT_FOLDER, + fileDecorations: { colors: true, badges: true }, + matches: createMatches((this._scores.get(element) || [, []])[1]) + }); + } else { + templateData.setFile(element.resource, { + hidePath: true, + fileKind: element.isDirectory ? FileKind.FOLDER : FileKind.FILE, + fileDecorations: { colors: true, badges: true }, + matches: createMatches((this._scores.get(element) || [, []])[1]) + }); + } } disposeTemplate(tree: ITree, templateId: string, templateData: FileLabel): void { @@ -204,9 +236,9 @@ export class FileRenderer implements IRenderer, IHighlightingRenderer { let topScore: FuzzyScore; let topElement: any; while (nav.next()) { - let element = nav.current() as IFileStat; + let element = nav.current() as IFileStat | IWorkspaceFolder; let score = fuzzyScore(pattern, element.name, undefined, true); - this._scores.set(element.resource.toString(), score); + this._scores.set(element, score); if (!topScore || score && topScore[0] < score[0]) { topScore = score; topElement = element; @@ -217,31 +249,50 @@ export class FileRenderer implements IRenderer, IHighlightingRenderer { } export class FileSorter implements ISorter { - compare(tree: ITree, a: IFileStat, b: IFileStat): number { - if (a.isDirectory === b.isDirectory) { - // same type -> compare on names - return compareFileNames(a.name, b.name); - } else if (a.isDirectory) { - return -1; + compare(tree: ITree, a: IFileStat | IWorkspaceFolder, b: IFileStat | IWorkspaceFolder): number { + if (IWorkspaceFolder.isIWorkspaceFolder(a) && IWorkspaceFolder.isIWorkspaceFolder(b)) { + return a.index - b.index; } else { - return 1; + if ((a as IFileStat).isDirectory === (b as IFileStat).isDirectory) { + // same type -> compare on names + return compareFileNames(a.name, b.name); + } else if ((a as IFileStat).isDirectory) { + return -1; + } else { + return 1; + } } } } export class BreadcrumbsFilePicker extends BreadcrumbsPicker { + constructor( + parent: HTMLElement, + @IInstantiationService instantiationService: IInstantiationService, + @IThemeService themeService: IThemeService, + @IWorkspaceContextService private readonly _workspaceService: IWorkspaceContextService, + ) { + super(parent, instantiationService, themeService); + } + protected _getInput(input: BreadcrumbElement): any { - let { uri } = (input as FileElement); - return dirname(uri); + let { uri, kind } = (input as FileElement); + if (kind === FileKind.ROOT_FOLDER) { + return this._workspaceService.getWorkspace(); + } else { + return dirname(uri); + } } protected _getInitialSelection(tree: ITree, input: BreadcrumbElement): any { let { uri } = (input as FileElement); let nav = tree.getNavigator(); while (nav.next()) { - if (isEqual(uri, (nav.current() as IFileStat).resource)) { - return nav.current(); + let cur = nav.current(); + let candidate = IWorkspaceFolder.isIWorkspaceFolder(cur) ? cur.uri : (cur as IFileStat).resource; + if (isEqual(uri, candidate)) { + return cur; } } return undefined; @@ -257,9 +308,8 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker { protected _onDidChangeSelection(e: ISelectionEvent): void { let [first] = e.selection; - let stat = first as IFileStat; - if (stat && !stat.isDirectory) { - this._onDidPickElement.fire(new FileElement(stat.resource, FileKind.FILE)); + if (first && !IWorkspaceFolder.isIWorkspaceFolder(first) && !(first as IFileStat).isDirectory) { + this._onDidPickElement.fire(new FileElement((first as IFileStat).resource, FileKind.FILE)); } } } From 70b3e116e0fb9e8e621da9ff7620f0ce7bf857ab Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Jul 2018 17:09:54 +0200 Subject: [PATCH 72/93] add special rendering for no-tabs case, #54370 --- .../browser/parts/editor/breadcrumbsControl.ts | 4 ++-- .../parts/editor/media/notabstitlecontrol.css | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts index 3589b5a0899..3410582874f 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts @@ -75,12 +75,12 @@ class Item extends BreadcrumbsItem { // file/folder let label = this._instantiationService.createInstance(FileLabel, container, {}); label.setFile(this.element.uri, { - extraClasses: [FileKind[this.element.kind].toLowerCase()], hidePath: true, - hideIcon: this.element.kind !== FileKind.FILE || !this.options.showFileIcons, + hideIcon: this.element.kind === FileKind.FOLDER || !this.options.showFileIcons, fileKind: this.element.kind, fileDecorations: { colors: this.options.showDecorationColors, badges: false }, }); + dom.addClass(container, FileKind[this.element.kind].toLowerCase()); this._disposables.push(label); } else if (this.element instanceof OutlineModel) { diff --git a/src/vs/workbench/browser/parts/editor/media/notabstitlecontrol.css b/src/vs/workbench/browser/parts/editor/media/notabstitlecontrol.css index 6020090acfc..5c323a06753 100644 --- a/src/vs/workbench/browser/parts/editor/media/notabstitlecontrol.css +++ b/src/vs/workbench/browser/parts/editor/media/notabstitlecontrol.css @@ -57,11 +57,19 @@ content: '\\'; } -.monaco-workbench > .part.editor > .content .editor-group-container > .title .no-tabs-breadcrumbs.breadcrumbs-control.relative-path .monaco-breadcrumb-item:nth-child(2)::before { - /* relative path -> hide first seperator */ +.monaco-workbench > .part.editor > .content .editor-group-container > .title .no-tabs-breadcrumbs.breadcrumbs-control .monaco-breadcrumb-item.root_folder::before, +.monaco-workbench > .part.editor > .content .editor-group-container > .title .no-tabs-breadcrumbs.breadcrumbs-control .monaco-breadcrumb-item.root_folder + .monaco-breadcrumb-item::before, +.monaco-workbench > .part.editor > .content .editor-group-container > .title .no-tabs-breadcrumbs.breadcrumbs-control.relative-path .monaco-breadcrumb-item:nth-child(2)::before { + /* workspace folder, item following workspace folder, or relative path -> hide first seperator */ display: none; } +.monaco-workbench > .part.editor > .content .editor-group-container > .title .no-tabs-breadcrumbs.breadcrumbs-control .monaco-breadcrumb-item.root_folder::after { + /* use dot separator for workspace folder */ + content: '•'; + padding: 0 4px; +} + .monaco-workbench > .part.editor > .content .editor-group-container > .title .no-tabs-breadcrumbs.breadcrumbs-control .monaco-breadcrumb-item:last-child { padding-right: 4px; /* does not have trailing separator*/ } From d6fe2757bed89c11db8a2b58e90f948424c350ea Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 24 Jul 2018 08:17:47 -0700 Subject: [PATCH 73/93] Support toggling escape sequence logging Fixes #54949 --- src/typings/vscode-xterm.d.ts | 2 ++ .../parts/terminal/common/terminal.ts | 2 ++ .../parts/terminal/common/terminalCommands.ts | 1 + .../electron-browser/terminal.contribution.ts | 3 ++- .../electron-browser/terminalActions.ts | 21 +++++++++++++++++++ .../electron-browser/terminalInstance.ts | 5 +++++ 6 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/typings/vscode-xterm.d.ts b/src/typings/vscode-xterm.d.ts index eb8c87e277a..b3a6c367c60 100644 --- a/src/typings/vscode-xterm.d.ts +++ b/src/typings/vscode-xterm.d.ts @@ -680,6 +680,8 @@ declare module 'vscode-xterm' { // Modifications to official .d.ts below declare module 'vscode-xterm' { interface TerminalCore { + debug: boolean; + buffer: { y: number; ybase: number; diff --git a/src/vs/workbench/parts/terminal/common/terminal.ts b/src/vs/workbench/parts/terminal/common/terminal.ts index 3e637c51d8f..245a8ac3a6e 100644 --- a/src/vs/workbench/parts/terminal/common/terminal.ts +++ b/src/vs/workbench/parts/terminal/common/terminal.ts @@ -542,6 +542,8 @@ export interface ITerminalInstance { setDimensions(dimensions: ITerminalDimensions): void; addDisposable(disposable: IDisposable): void; + + toggleEscapeSequenceLogging(): void; } export interface ITerminalCommandTracker { diff --git a/src/vs/workbench/parts/terminal/common/terminalCommands.ts b/src/vs/workbench/parts/terminal/common/terminalCommands.ts index fa7471a2316..5a9091527a6 100644 --- a/src/vs/workbench/parts/terminal/common/terminalCommands.ts +++ b/src/vs/workbench/parts/terminal/common/terminalCommands.ts @@ -54,6 +54,7 @@ export const enum TERMINAL_COMMAND_ID { SELECT_TO_NEXT_COMMAND = 'workbench.action.terminal.selectToNextCommand', SELECT_TO_PREVIOUS_LINE = 'workbench.action.terminal.selectToPreviousLine', SELECT_TO_NEXT_LINE = 'workbench.action.terminal.selectToNextLine', + TOGGLE_ESCAPE_SEQUENCE_LOGGING = 'toggleEscapeSequenceLogging' } diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts index bca78f3fb2f..767a20f3d83 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts @@ -17,7 +17,7 @@ import { getTerminalDefaultShellUnixLike, getTerminalDefaultShellWindows } from import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; -import { KillTerminalAction, ClearSelectionTerminalAction, CopyTerminalSelectionAction, CreateNewTerminalAction, CreateNewInActiveWorkspaceTerminalAction, FocusActiveTerminalAction, FocusNextTerminalAction, FocusPreviousTerminalAction, SelectDefaultShellWindowsTerminalAction, RunSelectedTextInTerminalAction, RunActiveFileInTerminalAction, ScrollDownTerminalAction, ScrollDownPageTerminalAction, ScrollToBottomTerminalAction, ScrollUpTerminalAction, ScrollUpPageTerminalAction, ScrollToTopTerminalAction, TerminalPasteAction, ToggleTerminalAction, ClearTerminalAction, AllowWorkspaceShellTerminalCommand, DisallowWorkspaceShellTerminalCommand, RenameTerminalAction, SelectAllTerminalAction, FocusTerminalFindWidgetAction, HideTerminalFindWidgetAction, DeleteWordLeftTerminalAction, DeleteWordRightTerminalAction, QuickOpenActionTermContributor, QuickOpenTermAction, TERMINAL_PICKER_PREFIX, MoveToLineStartTerminalAction, MoveToLineEndTerminalAction, SplitTerminalAction, SplitInActiveWorkspaceTerminalAction, FocusPreviousPaneTerminalAction, FocusNextPaneTerminalAction, ResizePaneLeftTerminalAction, ResizePaneRightTerminalAction, ResizePaneUpTerminalAction, ResizePaneDownTerminalAction, ScrollToPreviousCommandAction, ScrollToNextCommandAction, SelectToPreviousCommandAction, SelectToNextCommandAction, SelectToPreviousLineAction, SelectToNextLineAction } from 'vs/workbench/parts/terminal/electron-browser/terminalActions'; +import { KillTerminalAction, ClearSelectionTerminalAction, CopyTerminalSelectionAction, CreateNewTerminalAction, CreateNewInActiveWorkspaceTerminalAction, FocusActiveTerminalAction, FocusNextTerminalAction, FocusPreviousTerminalAction, SelectDefaultShellWindowsTerminalAction, RunSelectedTextInTerminalAction, RunActiveFileInTerminalAction, ScrollDownTerminalAction, ScrollDownPageTerminalAction, ScrollToBottomTerminalAction, ScrollUpTerminalAction, ScrollUpPageTerminalAction, ScrollToTopTerminalAction, TerminalPasteAction, ToggleTerminalAction, ClearTerminalAction, AllowWorkspaceShellTerminalCommand, DisallowWorkspaceShellTerminalCommand, RenameTerminalAction, SelectAllTerminalAction, FocusTerminalFindWidgetAction, HideTerminalFindWidgetAction, DeleteWordLeftTerminalAction, DeleteWordRightTerminalAction, QuickOpenActionTermContributor, QuickOpenTermAction, TERMINAL_PICKER_PREFIX, MoveToLineStartTerminalAction, MoveToLineEndTerminalAction, SplitTerminalAction, SplitInActiveWorkspaceTerminalAction, FocusPreviousPaneTerminalAction, FocusNextPaneTerminalAction, ResizePaneLeftTerminalAction, ResizePaneRightTerminalAction, ResizePaneUpTerminalAction, ResizePaneDownTerminalAction, ScrollToPreviousCommandAction, ScrollToNextCommandAction, SelectToPreviousCommandAction, SelectToNextCommandAction, SelectToPreviousLineAction, SelectToNextLineAction, ToggleEscapeSequenceLoggingAction } from 'vs/workbench/parts/terminal/electron-browser/terminalActions'; import { Registry } from 'vs/platform/registry/common/platform'; import { ShowAllCommandsAction } from 'vs/workbench/parts/quickopen/browser/commandsHandler'; import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; @@ -544,6 +544,7 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(SelectToNextComm }, KEYBINDING_CONTEXT_TERMINAL_FOCUS), 'Terminal: Select To Next Command', category); actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(SelectToPreviousLineAction, SelectToPreviousLineAction.ID, SelectToPreviousLineAction.LABEL), 'Terminal: Select To Previous Line', category); actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(SelectToNextLineAction, SelectToNextLineAction.ID, SelectToNextLineAction.LABEL), 'Terminal: Select To Next Line', category); +actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ToggleEscapeSequenceLoggingAction, ToggleEscapeSequenceLoggingAction.ID, ToggleEscapeSequenceLoggingAction.LABEL), 'Terminal: Toggle Escape Sequence Logging', category); setupTerminalCommands(); setupTerminalMenu(); diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts index 69e8c6a7ae6..25b65e9eafc 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts @@ -1141,3 +1141,24 @@ export class SelectToNextLineAction extends Action { return TPromise.as(void 0); } } + + +export class ToggleEscapeSequenceLoggingAction extends Action { + public static readonly ID = TERMINAL_COMMAND_ID.TOGGLE_ESCAPE_SEQUENCE_LOGGING; + public static readonly LABEL = nls.localize('workbench.action.terminal.toggleEscapeSequenceLogging', "Toggle Escape Sequence Logging"); + + constructor( + id: string, label: string, + @ITerminalService private terminalService: ITerminalService + ) { + super(id, label); + } + + public run(): TPromise { + const instance = this.terminalService.getActiveInstance(); + if (instance) { + instance.toggleEscapeSequenceLogging(); + } + return TPromise.as(void 0); + } +} diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts index 6b98f364797..df30323b6a6 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts @@ -1068,6 +1068,11 @@ export class TerminalInstance implements ITerminalInstance { private _updateTheme(theme?: ITheme): void { this._xterm.setOption('theme', this._getXtermTheme(theme)); } + + public toggleEscapeSequenceLogging(): void { + this._xterm._core.debug = !this._xterm._core.debug; + this._xterm.setOption('debug', this._xterm._core.debug); + } } registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => { From f827dbb7e87c81f923df57c5433a2c730e8f1b14 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 24 Jul 2018 12:55:27 +0200 Subject: [PATCH 74/93] Add canUndo and canRedo context keys --- src/vs/editor/browser/widget/codeEditorWidget.ts | 13 +++++++++++++ src/vs/editor/common/editorContextKeys.ts | 2 ++ src/vs/editor/common/model.ts | 12 ++++++++++++ src/vs/editor/common/model/editStack.ts | 8 ++++++++ src/vs/editor/common/model/textModel.ts | 8 ++++++++ 5 files changed, 43 insertions(+) diff --git a/src/vs/editor/browser/widget/codeEditorWidget.ts b/src/vs/editor/browser/widget/codeEditorWidget.ts index 387e34f62d1..b6e5d67a9d3 100644 --- a/src/vs/editor/browser/widget/codeEditorWidget.ts +++ b/src/vs/editor/browser/widget/codeEditorWidget.ts @@ -1550,6 +1550,8 @@ class EditorContextKeysManager extends Disposable { private _editorReadonly: IContextKey; private _hasMultipleSelections: IContextKey; private _hasNonEmptySelection: IContextKey; + private _canUndo: IContextKey; + private _canRedo: IContextKey; constructor( editor: CodeEditorWidget, @@ -1567,6 +1569,8 @@ class EditorContextKeysManager extends Disposable { this._editorReadonly = EditorContextKeys.readOnly.bindTo(contextKeyService); this._hasMultipleSelections = EditorContextKeys.hasMultipleSelections.bindTo(contextKeyService); this._hasNonEmptySelection = EditorContextKeys.hasNonEmptySelection.bindTo(contextKeyService); + this._canUndo = EditorContextKeys.canUndo.bindTo(contextKeyService); + this._canRedo = EditorContextKeys.canRedo.bindTo(contextKeyService); this._register(this._editor.onDidChangeConfiguration(() => this._updateFromConfig())); this._register(this._editor.onDidChangeCursorSelection(() => this._updateFromSelection())); @@ -1574,10 +1578,13 @@ class EditorContextKeysManager extends Disposable { this._register(this._editor.onDidBlurEditorWidget(() => this._updateFromFocus())); this._register(this._editor.onDidFocusEditorText(() => this._updateFromFocus())); this._register(this._editor.onDidBlurEditorText(() => this._updateFromFocus())); + this._register(this._editor.onDidChangeModel(() => this._updateFromModel())); + this._register(this._editor.onDidChangeConfiguration(() => this._updateFromModel())); this._updateFromConfig(); this._updateFromSelection(); this._updateFromFocus(); + this._updateFromModel(); } private _updateFromConfig(): void { @@ -1603,6 +1610,12 @@ class EditorContextKeysManager extends Disposable { this._editorTextFocus.set(this._editor.hasTextFocus() && !this._editor.isSimpleWidget); this._textInputFocus.set(this._editor.hasTextFocus()); } + + private _updateFromModel(): void { + const model = this._editor.getModel(); + this._canUndo.set(model && model.canUndo()); + this._canRedo.set(model && model.canRedo()); + } } export class EditorModeContext extends Disposable { diff --git a/src/vs/editor/common/editorContextKeys.ts b/src/vs/editor/common/editorContextKeys.ts index e6cd1d9caf5..c306f76352c 100644 --- a/src/vs/editor/common/editorContextKeys.ts +++ b/src/vs/editor/common/editorContextKeys.ts @@ -30,6 +30,8 @@ export namespace EditorContextKeys { export const tabMovesFocus = new RawContextKey('editorTabMovesFocus', false); export const tabDoesNotMoveFocus: ContextKeyExpr = tabMovesFocus.toNegated(); export const isInEmbeddedEditor = new RawContextKey('isInEmbeddedEditor', undefined); + export const canUndo = new RawContextKey('canUndo', false); + export const canRedo = new RawContextKey('canRedo', false); // -- mode context keys export const languageId = new RawContextKey('editorLangId', undefined); diff --git a/src/vs/editor/common/model.ts b/src/vs/editor/common/model.ts index e4a6ba3feed..d37319c25b5 100644 --- a/src/vs/editor/common/model.ts +++ b/src/vs/editor/common/model.ts @@ -1030,6 +1030,12 @@ export interface ITextModel { */ undo(): Selection[]; + /** + * Is there anything in the undo stack? + * @internal + */ + canUndo(): boolean; + /** * Redo edit operations until the next stop point created by `pushStackElement`. * The inverse edit operations will be pushed on the undo stack. @@ -1037,6 +1043,12 @@ export interface ITextModel { */ redo(): Selection[]; + /** + * Is there anything in the redo stack? + * @internal + */ + canRedo(): boolean; + /** * @deprecated Please use `onDidChangeContent` instead. * An event emitted when the contents of the model have changed. diff --git a/src/vs/editor/common/model/editStack.ts b/src/vs/editor/common/model/editStack.ts index 13a955cf522..5f5e3066845 100644 --- a/src/vs/editor/common/model/editStack.ts +++ b/src/vs/editor/common/model/editStack.ts @@ -210,6 +210,10 @@ export class EditStack { return null; } + public canUndo(): boolean { + return (this.past.length > 0); + } + public redo(): IUndoRedoResult { if (this.future.length > 0) { @@ -233,4 +237,8 @@ export class EditStack { return null; } + + public canRedo(): boolean { + return (this.future.length > 0); + } } diff --git a/src/vs/editor/common/model/textModel.ts b/src/vs/editor/common/model/textModel.ts index 1a4005d6a1b..7bddfeb4441 100644 --- a/src/vs/editor/common/model/textModel.ts +++ b/src/vs/editor/common/model/textModel.ts @@ -1416,6 +1416,10 @@ export class TextModel extends Disposable implements model.ITextModel { } } + public canUndo(): boolean { + return this._commandManager.canUndo(); + } + private _redo(): Selection[] { this._isRedoing = true; let r = this._commandManager.redo(); @@ -1441,6 +1445,10 @@ export class TextModel extends Disposable implements model.ITextModel { } } + public canRedo(): boolean { + return this._commandManager.canRedo(); + } + //#endregion //#region Decorations From 403a5869bb26d60894cf69119d0b4515b153af21 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 24 Jul 2018 14:54:48 +0200 Subject: [PATCH 75/93] Move Edit and Selection menu registrations into the codeEditor part --- .../parts/menubar/menubar.contribution.ts | 252 ----------------- .../codeEditor/codeEditor.contribution.ts | 1 + .../electron-browser/menubarRegistrations.ts | 260 ++++++++++++++++++ 3 files changed, 261 insertions(+), 252 deletions(-) create mode 100644 src/vs/workbench/parts/codeEditor/electron-browser/menubarRegistrations.ts diff --git a/src/vs/workbench/browser/parts/menubar/menubar.contribution.ts b/src/vs/workbench/browser/parts/menubar/menubar.contribution.ts index 6c2e0b4adfc..83accf773bb 100644 --- a/src/vs/workbench/browser/parts/menubar/menubar.contribution.ts +++ b/src/vs/workbench/browser/parts/menubar/menubar.contribution.ts @@ -7,8 +7,6 @@ import * as nls from 'vs/nls'; import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; import { isMacintosh } from 'vs/base/common/platform'; -editMenuRegistration(); -selectionMenuRegistration(); goMenuRegistration(); if (isMacintosh) { @@ -19,256 +17,6 @@ helpMenuRegistration(); // Menu registration -function editMenuRegistration() { - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '1_do', - command: { - id: 'undo', - title: nls.localize({ key: 'miUndo', comment: ['&& denotes a mnemonic'] }, "&&Undo") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '1_do', - command: { - id: 'redo', - title: nls.localize({ key: 'miRedo', comment: ['&& denotes a mnemonic'] }, "&&Redo") - }, - order: 2 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '2_ccp', - command: { - id: 'editor.action.clipboardCutAction', - title: nls.localize({ key: 'miCut', comment: ['&& denotes a mnemonic'] }, "Cu&&t") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '2_ccp', - command: { - id: 'editor.action.clipboardCopyAction', - title: nls.localize({ key: 'miCopy', comment: ['&& denotes a mnemonic'] }, "&&Copy") - }, - order: 2 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '2_ccp', - command: { - id: 'editor.action.clipboardPasteAction', - title: nls.localize({ key: 'miPaste', comment: ['&& denotes a mnemonic'] }, "&&Paste") - }, - order: 3 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '3_find', - command: { - id: 'actions.find', - title: nls.localize({ key: 'miFind', comment: ['&& denotes a mnemonic'] }, "&&Find") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '3_find', - command: { - id: 'editor.action.startFindReplaceAction', - title: nls.localize({ key: 'miReplace', comment: ['&& denotes a mnemonic'] }, "&&Replace") - }, - order: 2 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '4_find_global', - command: { - id: 'workbench.action.findInFiles', - title: nls.localize({ key: 'miFindInFiles', comment: ['&& denotes a mnemonic'] }, "Find &&in Files") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '4_find_global', - command: { - - id: 'workbench.action.replaceInFiles', - title: nls.localize({ key: 'miReplaceInFiles', comment: ['&& denotes a mnemonic'] }, "Replace &&in Files") - }, - order: 2 - }); - - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '5_insert', - command: { - id: 'editor.action.commentLine', - title: nls.localize({ key: 'miToggleLineComment', comment: ['&& denotes a mnemonic'] }, "&&Toggle Line Comment") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '5_insert', - command: { - id: 'editor.action.blockComment', - title: nls.localize({ key: 'miToggleBlockComment', comment: ['&& denotes a mnemonic'] }, "Toggle &&Block Comment") - }, - order: 2 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '5_insert', - command: { - id: 'editor.emmet.action.expandAbbreviation', - title: nls.localize({ key: 'miEmmetExpandAbbreviation', comment: ['&& denotes a mnemonic'] }, "Emmet: E&&xpand Abbreviation") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '5_insert', - command: { - id: 'workbench.action.showEmmetCommands', - title: nls.localize({ key: 'miShowEmmetCommands', comment: ['&& denotes a mnemonic'] }, "E&&mmet...") - }, - order: 2 - }); -} - -function selectionMenuRegistration() { - MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { - group: '1_basic', - command: { - id: 'editor.action.selectAll', - title: nls.localize({ key: 'miSelectAll', comment: ['&& denotes a mnemonic'] }, "&&Select All") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { - group: '1_basic', - command: { - id: 'editor.action.smartSelect.grow', - title: nls.localize({ key: 'miSmartSelectGrow', comment: ['&& denotes a mnemonic'] }, "&&Expand Selection") - }, - order: 2 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { - group: '1_basic', - command: { - id: 'editor.action.smartSelect.shrink', - title: nls.localize({ key: 'miSmartSelectShrink', comment: ['&& denotes a mnemonic'] }, "&&Shrink Selection") - }, - order: 3 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { - group: '2_line', - command: { - id: 'editor.action.copyLinesUpAction', - title: nls.localize({ key: 'miCopyLinesUp', comment: ['&& denotes a mnemonic'] }, "&&Copy Line Up") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { - group: '2_line', - command: { - id: 'editor.action.copyLinesDownAction', - title: nls.localize({ key: 'miCopyLinesDown', comment: ['&& denotes a mnemonic'] }, "Co&&py Line Down") - }, - order: 2 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { - group: '2_line', - command: { - id: 'editor.action.moveLinesUpAction', - title: nls.localize({ key: 'miMoveLinesUp', comment: ['&& denotes a mnemonic'] }, "Mo&&ve Line Up") - }, - order: 3 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { - group: '2_line', - command: { - id: 'editor.action.moveLinesDownAction', - title: nls.localize({ key: 'miMoveLinesDown', comment: ['&& denotes a mnemonic'] }, "Move &&Line Down") - }, - order: 4 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { - group: '3_multi', - command: { - id: 'workbench.action.toggleMultiCursorModifier', - title: nls.localize('miMultiCursorAlt', "Switch to Alt+Click for Multi-Cursor") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { - group: '3_multi', - command: { - id: 'editor.action.insertCursorAbove', - title: nls.localize({ key: 'miInsertCursorAbove', comment: ['&& denotes a mnemonic'] }, "&&Add Cursor Above") - }, - order: 2 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { - group: '3_multi', - command: { - id: 'editor.action.insertCursorBelow', - title: nls.localize({ key: 'miInsertCursorBelow', comment: ['&& denotes a mnemonic'] }, "A&&dd Cursor Below") - }, - order: 3 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { - group: '3_multi', - command: { - id: 'editor.action.insertCursorAtEndOfEachLineSelected', - title: nls.localize({ key: 'miInsertCursorAtEndOfEachLineSelected', comment: ['&& denotes a mnemonic'] }, "Add C&&ursors to Line Ends") - }, - order: 4 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { - group: '3_multi', - command: { - id: 'editor.action.addSelectionToNextFindMatch', - title: nls.localize({ key: 'miAddSelectionToNextFindMatch', comment: ['&& denotes a mnemonic'] }, "Add &&Next Occurrence") - }, - order: 5 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { - group: '3_multi', - command: { - id: 'editor.action.addSelectionToPreviousFindMatch', - title: nls.localize({ key: 'miAddSelectionToPreviousFindMatch', comment: ['&& denotes a mnemonic'] }, "Add P&&revious Occurrence") - }, - order: 6 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { - group: '3_multi', - command: { - id: 'editor.action.selectHighlights', - title: nls.localize({ key: 'miSelectHighlights', comment: ['&& denotes a mnemonic'] }, "Select All &&Occurrences") - }, - order: 7 - }); -} - - function goMenuRegistration() { // Forward/Back MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, { diff --git a/src/vs/workbench/parts/codeEditor/codeEditor.contribution.ts b/src/vs/workbench/parts/codeEditor/codeEditor.contribution.ts index cc4c07f981a..a4085223ade 100644 --- a/src/vs/workbench/parts/codeEditor/codeEditor.contribution.ts +++ b/src/vs/workbench/parts/codeEditor/codeEditor.contribution.ts @@ -6,6 +6,7 @@ import './electron-browser/accessibility'; import './electron-browser/inspectKeybindings'; import './electron-browser/largeFileOptimizations'; +import './electron-browser/menubarRegistrations'; import './electron-browser/menuPreventer'; import './electron-browser/selectionClipboard'; import './electron-browser/textMate/inspectTMScopes'; diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/menubarRegistrations.ts b/src/vs/workbench/parts/codeEditor/electron-browser/menubarRegistrations.ts new file mode 100644 index 00000000000..fb39248beb0 --- /dev/null +++ b/src/vs/workbench/parts/codeEditor/electron-browser/menubarRegistrations.ts @@ -0,0 +1,260 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import * as nls from 'vs/nls'; +import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; + +editMenuRegistration(); +selectionMenuRegistration(); + +function editMenuRegistration() { + MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '1_do', + command: { + id: 'undo', + title: nls.localize({ key: 'miUndo', comment: ['&& denotes a mnemonic'] }, "&&Undo") + }, + order: 1 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '1_do', + command: { + id: 'redo', + title: nls.localize({ key: 'miRedo', comment: ['&& denotes a mnemonic'] }, "&&Redo") + }, + order: 2 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '2_ccp', + command: { + id: 'editor.action.clipboardCutAction', + title: nls.localize({ key: 'miCut', comment: ['&& denotes a mnemonic'] }, "Cu&&t") + }, + order: 1 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '2_ccp', + command: { + id: 'editor.action.clipboardCopyAction', + title: nls.localize({ key: 'miCopy', comment: ['&& denotes a mnemonic'] }, "&&Copy") + }, + order: 2 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '2_ccp', + command: { + id: 'editor.action.clipboardPasteAction', + title: nls.localize({ key: 'miPaste', comment: ['&& denotes a mnemonic'] }, "&&Paste") + }, + order: 3 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '3_find', + command: { + id: 'actions.find', + title: nls.localize({ key: 'miFind', comment: ['&& denotes a mnemonic'] }, "&&Find") + }, + order: 1 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '3_find', + command: { + id: 'editor.action.startFindReplaceAction', + title: nls.localize({ key: 'miReplace', comment: ['&& denotes a mnemonic'] }, "&&Replace") + }, + order: 2 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '4_find_global', + command: { + id: 'workbench.action.findInFiles', + title: nls.localize({ key: 'miFindInFiles', comment: ['&& denotes a mnemonic'] }, "Find &&in Files") + }, + order: 1 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '4_find_global', + command: { + + id: 'workbench.action.replaceInFiles', + title: nls.localize({ key: 'miReplaceInFiles', comment: ['&& denotes a mnemonic'] }, "Replace &&in Files") + }, + order: 2 + }); + + + MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '5_insert', + command: { + id: 'editor.action.commentLine', + title: nls.localize({ key: 'miToggleLineComment', comment: ['&& denotes a mnemonic'] }, "&&Toggle Line Comment") + }, + order: 1 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '5_insert', + command: { + id: 'editor.action.blockComment', + title: nls.localize({ key: 'miToggleBlockComment', comment: ['&& denotes a mnemonic'] }, "Toggle &&Block Comment") + }, + order: 2 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '5_insert', + command: { + id: 'editor.emmet.action.expandAbbreviation', + title: nls.localize({ key: 'miEmmetExpandAbbreviation', comment: ['&& denotes a mnemonic'] }, "Emmet: E&&xpand Abbreviation") + }, + order: 1 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '5_insert', + command: { + id: 'workbench.action.showEmmetCommands', + title: nls.localize({ key: 'miShowEmmetCommands', comment: ['&& denotes a mnemonic'] }, "E&&mmet...") + }, + order: 2 + }); +} + +function selectionMenuRegistration() { + MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { + group: '1_basic', + command: { + id: 'editor.action.selectAll', + title: nls.localize({ key: 'miSelectAll', comment: ['&& denotes a mnemonic'] }, "&&Select All") + }, + order: 1 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { + group: '1_basic', + command: { + id: 'editor.action.smartSelect.grow', + title: nls.localize({ key: 'miSmartSelectGrow', comment: ['&& denotes a mnemonic'] }, "&&Expand Selection") + }, + order: 2 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { + group: '1_basic', + command: { + id: 'editor.action.smartSelect.shrink', + title: nls.localize({ key: 'miSmartSelectShrink', comment: ['&& denotes a mnemonic'] }, "&&Shrink Selection") + }, + order: 3 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { + group: '2_line', + command: { + id: 'editor.action.copyLinesUpAction', + title: nls.localize({ key: 'miCopyLinesUp', comment: ['&& denotes a mnemonic'] }, "&&Copy Line Up") + }, + order: 1 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { + group: '2_line', + command: { + id: 'editor.action.copyLinesDownAction', + title: nls.localize({ key: 'miCopyLinesDown', comment: ['&& denotes a mnemonic'] }, "Co&&py Line Down") + }, + order: 2 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { + group: '2_line', + command: { + id: 'editor.action.moveLinesUpAction', + title: nls.localize({ key: 'miMoveLinesUp', comment: ['&& denotes a mnemonic'] }, "Mo&&ve Line Up") + }, + order: 3 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { + group: '2_line', + command: { + id: 'editor.action.moveLinesDownAction', + title: nls.localize({ key: 'miMoveLinesDown', comment: ['&& denotes a mnemonic'] }, "Move &&Line Down") + }, + order: 4 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { + group: '3_multi', + command: { + id: 'workbench.action.toggleMultiCursorModifier', + title: nls.localize('miMultiCursorAlt', "Switch to Alt+Click for Multi-Cursor") + }, + order: 1 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { + group: '3_multi', + command: { + id: 'editor.action.insertCursorAbove', + title: nls.localize({ key: 'miInsertCursorAbove', comment: ['&& denotes a mnemonic'] }, "&&Add Cursor Above") + }, + order: 2 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { + group: '3_multi', + command: { + id: 'editor.action.insertCursorBelow', + title: nls.localize({ key: 'miInsertCursorBelow', comment: ['&& denotes a mnemonic'] }, "A&&dd Cursor Below") + }, + order: 3 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { + group: '3_multi', + command: { + id: 'editor.action.insertCursorAtEndOfEachLineSelected', + title: nls.localize({ key: 'miInsertCursorAtEndOfEachLineSelected', comment: ['&& denotes a mnemonic'] }, "Add C&&ursors to Line Ends") + }, + order: 4 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { + group: '3_multi', + command: { + id: 'editor.action.addSelectionToNextFindMatch', + title: nls.localize({ key: 'miAddSelectionToNextFindMatch', comment: ['&& denotes a mnemonic'] }, "Add &&Next Occurrence") + }, + order: 5 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { + group: '3_multi', + command: { + id: 'editor.action.addSelectionToPreviousFindMatch', + title: nls.localize({ key: 'miAddSelectionToPreviousFindMatch', comment: ['&& denotes a mnemonic'] }, "Add P&&revious Occurrence") + }, + order: 6 + }); + + MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { + group: '3_multi', + command: { + id: 'editor.action.selectHighlights', + title: nls.localize({ key: 'miSelectHighlights', comment: ['&& denotes a mnemonic'] }, "Select All &&Occurrences") + }, + order: 7 + }); +} From 2b0800a59ecc6a8fc1b0f638e0355615495e6600 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 24 Jul 2018 17:05:58 +0200 Subject: [PATCH 76/93] Simplify Command registration --- .../editor/browser/controller/coreCommands.ts | 2 +- src/vs/editor/browser/editorExtensions.ts | 36 +++++++++++++------ .../electron-browser/extensionEditor.ts | 2 +- .../preferences.contribution.ts | 20 +++++------ .../electron-browser/webview.contribution.ts | 6 ++-- 5 files changed, 40 insertions(+), 26 deletions(-) diff --git a/src/vs/editor/browser/controller/coreCommands.ts b/src/vs/editor/browser/controller/coreCommands.ts index 05c024d8d8c..b6c64c1cc53 100644 --- a/src/vs/editor/browser/controller/coreCommands.ts +++ b/src/vs/editor/browser/controller/coreCommands.ts @@ -1620,7 +1620,7 @@ function findFocusedEditor(accessor: ServicesAccessor): ICodeEditor { } function registerCommand(command: Command) { - KeybindingsRegistry.registerCommandAndKeybindingRule(command.toCommandAndKeybindingRule(CORE_WEIGHT)); + command.register(CORE_WEIGHT); } /** diff --git a/src/vs/editor/browser/editorExtensions.ts b/src/vs/editor/browser/editorExtensions.ts index 6d9e1f04119..1327d5722fc 100644 --- a/src/vs/editor/browser/editorExtensions.ts +++ b/src/vs/editor/browser/editorExtensions.ts @@ -31,11 +31,18 @@ export interface ICommandKeybindingsOptions extends IKeybindings { kbExpr?: ContextKeyExpr; weight?: number; } +// export interface ICommandMenubarOptions { +// group?: string; +// order?: number; +// when?: ContextKeyExpr; +// title?: string; +// } export interface ICommandOptions { id: string; precondition: ContextKeyExpr; kbOpts?: ICommandKeybindingsOptions; description?: ICommandHandlerDescription; + // menubarOpts?: ICommandMenubarOptions; } export abstract class Command { public readonly id: string; @@ -50,7 +57,7 @@ export abstract class Command { this._description = opts.description; } - public toCommandAndKeybindingRule(defaultWeight: number): ICommandAndKeybindingRule { + private _toCommandAndKeybindingRule(defaultWeight: number): ICommandAndKeybindingRule { const kbOpts = this._kbOpts || { primary: 0 }; let kbWhen = kbOpts.kbExpr; @@ -78,6 +85,10 @@ export abstract class Command { }; } + public register(defaultWeight: number): void { + KeybindingsRegistry.registerCommandAndKeybindingRule(this._toCommandAndKeybindingRule(defaultWeight)); + } + public abstract runCommand(accessor: ServicesAccessor, args: any): void | TPromise; } @@ -166,7 +177,7 @@ export abstract class EditorAction extends EditorCommand { this.menuOpts = opts.menuOpts; } - public toMenuItem(): IMenuItem { + private _toMenuItem(): IMenuItem { if (!this.menuOpts) { return null; } @@ -182,6 +193,16 @@ export abstract class EditorAction extends EditorCommand { }; } + public register(defaultWeight: number): void { + + let menuItem = this._toMenuItem(); + if (menuItem) { + MenuRegistry.appendMenuItem(MenuId.EditorContext, menuItem); + } + + super.register(defaultWeight); + } + public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | TPromise { this.reportTelemetry(accessor, editor); return this.run(accessor, editor, args || {}); @@ -295,14 +316,7 @@ class EditorContributionRegistry { } public registerEditorAction(action: EditorAction) { - - let menuItem = action.toMenuItem(); - if (menuItem) { - MenuRegistry.appendMenuItem(MenuId.EditorContext, menuItem); - } - - KeybindingsRegistry.registerCommandAndKeybindingRule(action.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); - + action.register(KeybindingsRegistry.WEIGHT.editorContrib()); this.editorActions.push(action); } @@ -315,7 +329,7 @@ class EditorContributionRegistry { } public registerEditorCommand(editorCommand: EditorCommand) { - KeybindingsRegistry.registerCommandAndKeybindingRule(editorCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); + editorCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); this.editorCommands[editorCommand.id] = editorCommand; } diff --git a/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts b/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts index d7f89ad8915..26b12485999 100644 --- a/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts +++ b/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts @@ -1124,4 +1124,4 @@ const showCommand = new ShowExtensionEditorFindCommand({ primary: KeyMod.CtrlCmd | KeyCode.KEY_F } }); -KeybindingsRegistry.registerCommandAndKeybindingRule(showCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); +showCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); diff --git a/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts b/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts index 3e2d2137832..cb4dd53b20e 100644 --- a/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts +++ b/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts @@ -353,7 +353,7 @@ const startSearchCommand = new StartSearchDefaultSettingsCommand({ precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR), kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.KEY_F } }); -KeybindingsRegistry.registerCommandAndKeybindingRule(startSearchCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); +startSearchCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); class FocusSearchFromSettingsCommand extends SettingsCommand { @@ -369,7 +369,7 @@ const focusSearchFromSettingsCommand = new FocusSearchFromSettingsCommand({ precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_FIRST_ROW_FOCUS), kbOpts: { primary: KeyCode.UpArrow } }); -KeybindingsRegistry.registerCommandAndKeybindingRule(focusSearchFromSettingsCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.workbenchContrib())); +focusSearchFromSettingsCommand.register(KeybindingsRegistry.WEIGHT.workbenchContrib()); class ClearSearchResultsCommand extends SettingsCommand { @@ -386,7 +386,7 @@ const clearSearchResultsCommand = new ClearSearchResultsCommand({ precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, kbOpts: { primary: KeyCode.Escape } }); -KeybindingsRegistry.registerCommandAndKeybindingRule(clearSearchResultsCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); +clearSearchResultsCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); class FocusSettingsFileEditorCommand extends SettingsCommand { @@ -404,14 +404,14 @@ const focusSettingsFileEditorCommand = new FocusSettingsFileEditorCommand({ precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, kbOpts: { primary: KeyCode.DownArrow } }); -KeybindingsRegistry.registerCommandAndKeybindingRule(focusSettingsFileEditorCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); +focusSettingsFileEditorCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); const focusSettingsFromSearchCommand = new FocusSettingsFileEditorCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_FROM_SEARCH, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, kbOpts: { primary: KeyCode.DownArrow } }); -KeybindingsRegistry.registerCommandAndKeybindingRule(focusSettingsFromSearchCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.workbenchContrib())); +focusSettingsFromSearchCommand.register(KeybindingsRegistry.WEIGHT.workbenchContrib()); class FocusNextSearchResultCommand extends SettingsCommand { @@ -427,7 +427,7 @@ const focusNextSearchResultCommand = new FocusNextSearchResultCommand({ precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, kbOpts: { primary: KeyCode.Enter } }); -KeybindingsRegistry.registerCommandAndKeybindingRule(focusNextSearchResultCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); +focusNextSearchResultCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); class FocusPreviousSearchResultCommand extends SettingsCommand { @@ -443,7 +443,7 @@ const focusPreviousSearchResultCommand = new FocusPreviousSearchResultCommand({ precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, kbOpts: { primary: KeyMod.Shift | KeyCode.Enter } }); -KeybindingsRegistry.registerCommandAndKeybindingRule(focusPreviousSearchResultCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); +focusPreviousSearchResultCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); class EditFocusedSettingCommand extends SettingsCommand { @@ -459,7 +459,7 @@ const editFocusedSettingCommand = new EditFocusedSettingCommand({ precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.US_DOT } }); -KeybindingsRegistry.registerCommandAndKeybindingRule(editFocusedSettingCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); +editFocusedSettingCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); class EditFocusedSettingCommand2 extends SettingsCommand { @@ -476,7 +476,7 @@ const editFocusedSettingCommand2 = new EditFocusedSettingCommand2({ precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_ROW_FOCUS), kbOpts: { primary: KeyCode.Enter } }); -KeybindingsRegistry.registerCommandAndKeybindingRule(editFocusedSettingCommand2.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.workbenchContrib())); +editFocusedSettingCommand2.register(KeybindingsRegistry.WEIGHT.workbenchContrib()); class FocusSettingsListCommand extends SettingsCommand { @@ -493,7 +493,7 @@ const focusSettingsListCommand = new FocusSettingsListCommand({ precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_TOC_ROW_FOCUS), kbOpts: { primary: KeyCode.Enter } }); -KeybindingsRegistry.registerCommandAndKeybindingRule(focusSettingsListCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.workbenchContrib())); +focusSettingsListCommand.register(KeybindingsRegistry.WEIGHT.workbenchContrib()); // Preferences menu diff --git a/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts b/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts index dbef116693f..2dbb4818b37 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts @@ -45,7 +45,7 @@ const showNextFindWdigetCommand = new ShowWebViewEditorFindWidgetCommand({ primary: KeyMod.CtrlCmd | KeyCode.KEY_F } }); -KeybindingsRegistry.registerCommandAndKeybindingRule(showNextFindWdigetCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); +showNextFindWdigetCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); const hideCommand = new HideWebViewEditorFindCommand({ id: HideWebViewEditorFindCommand.ID, @@ -56,7 +56,7 @@ const hideCommand = new HideWebViewEditorFindCommand({ primary: KeyCode.Escape } }); -KeybindingsRegistry.registerCommandAndKeybindingRule(hideCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); +hideCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); const selectAllCommand = new SelectAllWebviewEditorCommand({ id: SelectAllWebviewEditorCommand.ID, @@ -65,7 +65,7 @@ const selectAllCommand = new SelectAllWebviewEditorCommand({ primary: KeyMod.CtrlCmd | KeyCode.KEY_A } }); -KeybindingsRegistry.registerCommandAndKeybindingRule(selectAllCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); +selectAllCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); actionRegistry.registerWorkbenchAction( new SyncActionDescriptor(OpenWebviewDeveloperToolsAction, OpenWebviewDeveloperToolsAction.ID, OpenWebviewDeveloperToolsAction.LABEL), From 608c07c451ea50be89aab01fc3f429257157ce50 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 24 Jul 2018 17:47:23 +0200 Subject: [PATCH 77/93] Have kbOpts.weight be mandatory --- .../editor/browser/controller/coreCommands.ts | 2 +- src/vs/editor/browser/editorExtensions.ts | 61 +++++++++++-------- src/vs/editor/browser/widget/diffReview.ts | 7 ++- .../bracketMatching/bracketMatching.ts | 4 +- .../contrib/caretOperations/transpose.ts | 4 +- src/vs/editor/contrib/clipboard/clipboard.ts | 13 ++-- .../contrib/codeAction/codeActionCommands.ts | 10 ++- src/vs/editor/contrib/comment/comment.ts | 13 ++-- .../editor/contrib/contextmenu/contextmenu.ts | 4 +- .../editor/contrib/cursorUndo/cursorUndo.ts | 4 +- src/vs/editor/contrib/find/findController.ts | 21 ++++--- src/vs/editor/contrib/folding/folding.ts | 31 +++++++--- src/vs/editor/contrib/format/formatActions.ts | 7 ++- .../goToDefinition/goToDefinitionCommands.ts | 22 ++++--- src/vs/editor/contrib/gotoError/gotoError.ts | 6 +- src/vs/editor/contrib/hover/hover.ts | 4 +- .../contrib/inPlaceReplace/inPlaceReplace.ts | 7 ++- .../linesOperations/linesOperations.ts | 40 ++++++++---- .../editor/contrib/multicursor/multicursor.ts | 22 ++++--- .../contrib/parameterHints/parameterHints.ts | 3 +- .../referenceSearch/referenceSearch.ts | 3 +- src/vs/editor/contrib/rename/rename.ts | 3 +- .../editor/contrib/smartSelect/smartSelect.ts | 7 ++- .../contrib/suggest/suggestController.ts | 3 +- .../toggleTabFocusMode/toggleTabFocusMode.ts | 4 +- .../wordHighlighter/wordHighlighter.ts | 7 ++- .../contrib/wordOperations/wordOperations.ts | 19 ++++-- .../wordPartOperations/wordPartOperations.ts | 19 ++++-- .../accessibilityHelp/accessibilityHelp.ts | 3 +- .../standalone/browser/quickOpen/gotoLine.ts | 4 +- .../browser/quickOpen/quickCommand.ts | 4 +- .../browser/quickOpen/quickOutline.ts | 4 +- .../electron-browser/accessibility.ts | 3 +- .../electron-browser/toggleWordWrap.ts | 4 +- .../parts/debug/browser/debugEditorActions.ts | 7 ++- .../electron-browser/breakpointWidget.ts | 7 ++- .../parts/debug/electron-browser/repl.ts | 4 +- .../actions/expandAbbreviation.ts | 4 +- .../electron-browser/extensionEditor.ts | 5 +- .../browser/keybindingsEditorContribution.ts | 4 +- .../preferences.contribution.ts | 40 ++++++------ .../electron-browser/dirtydiffDecorator.ts | 8 +-- .../electron-browser/webview.contribution.ts | 15 +++-- 43 files changed, 306 insertions(+), 160 deletions(-) diff --git a/src/vs/editor/browser/controller/coreCommands.ts b/src/vs/editor/browser/controller/coreCommands.ts index b6c64c1cc53..7d864dbe9c4 100644 --- a/src/vs/editor/browser/controller/coreCommands.ts +++ b/src/vs/editor/browser/controller/coreCommands.ts @@ -1620,7 +1620,7 @@ function findFocusedEditor(accessor: ServicesAccessor): ICodeEditor { } function registerCommand(command: Command) { - command.register(CORE_WEIGHT); + command.register(); } /** diff --git a/src/vs/editor/browser/editorExtensions.ts b/src/vs/editor/browser/editorExtensions.ts index 1327d5722fc..dd522f9adac 100644 --- a/src/vs/editor/browser/editorExtensions.ts +++ b/src/vs/editor/browser/editorExtensions.ts @@ -29,7 +29,7 @@ export type IEditorContributionCtor = IConstructorSignature1 this.runCommand(accessor, args), + weight: this._kbOpts.weight, + when: kbWhen, + primary: this._kbOpts.primary, + secondary: this._kbOpts.secondary, + win: this._kbOpts.win, + linux: this._kbOpts.linux, + mac: this._kbOpts.mac, + description: this._description + }; + } return { id: this.id, handler: (accessor, args) => this.runCommand(accessor, args), - weight: weight, - when: kbWhen, - primary: kbOpts.primary, - secondary: kbOpts.secondary, - win: kbOpts.win, - linux: kbOpts.linux, - mac: kbOpts.mac, + weight: undefined, + when: undefined, + primary: 0, + secondary: undefined, + win: undefined, + linux: undefined, + mac: undefined, description: this._description }; } - public register(defaultWeight: number): void { - KeybindingsRegistry.registerCommandAndKeybindingRule(this._toCommandAndKeybindingRule(defaultWeight)); + public register(): void { + KeybindingsRegistry.registerCommandAndKeybindingRule(this._toCommandAndKeybindingRule()); } public abstract runCommand(accessor: ServicesAccessor, args: any): void | TPromise; @@ -193,14 +204,14 @@ export abstract class EditorAction extends EditorCommand { }; } - public register(defaultWeight: number): void { + public register(): void { let menuItem = this._toMenuItem(); if (menuItem) { MenuRegistry.appendMenuItem(MenuId.EditorContext, menuItem); } - super.register(defaultWeight); + super.register(); } public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | TPromise { @@ -316,7 +327,7 @@ class EditorContributionRegistry { } public registerEditorAction(action: EditorAction) { - action.register(KeybindingsRegistry.WEIGHT.editorContrib()); + action.register(); this.editorActions.push(action); } @@ -329,7 +340,7 @@ class EditorContributionRegistry { } public registerEditorCommand(editorCommand: EditorCommand) { - editorCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); + editorCommand.register(); this.editorCommands[editorCommand.id] = editorCommand; } diff --git a/src/vs/editor/browser/widget/diffReview.ts b/src/vs/editor/browser/widget/diffReview.ts index c06799df4c5..37b7076b07b 100644 --- a/src/vs/editor/browser/widget/diffReview.ts +++ b/src/vs/editor/browser/widget/diffReview.ts @@ -30,6 +30,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ITextModel, TextModelResolvedOptions } from 'vs/editor/common/model'; import { ViewLineRenderingData } from 'vs/editor/common/viewModel/viewModel'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; const DIFF_LINES_PADDING = 3; @@ -810,7 +811,8 @@ class DiffReviewNext extends EditorAction { precondition: ContextKeyExpr.has('isInDiffEditor'), kbOpts: { kbExpr: null, - primary: KeyCode.F7 + primary: KeyCode.F7, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -832,7 +834,8 @@ class DiffReviewPrev extends EditorAction { precondition: ContextKeyExpr.has('isInDiffEditor'), kbOpts: { kbExpr: null, - primary: KeyMod.Shift | KeyCode.F7 + primary: KeyMod.Shift | KeyCode.F7, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts index b2573d26fa0..2071728a38e 100644 --- a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts +++ b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts @@ -22,6 +22,7 @@ import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { registerColor } from 'vs/platform/theme/common/colorRegistry'; import { TrackedRangeStickiness, IModelDeltaDecoration, OverviewRulerLane } from 'vs/editor/common/model'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; const overviewRulerBracketMatchForeground = registerColor('editorOverviewRuler.bracketMatchForeground', { dark: '#A0A0A0', light: '#A0A0A0', hc: '#A0A0A0' }, nls.localize('overviewRulerBracketMatchForeground', 'Overview ruler marker color for matching brackets.')); @@ -34,7 +35,8 @@ class JumpToBracketAction extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_BACKSLASH + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_BACKSLASH, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/caretOperations/transpose.ts b/src/vs/editor/contrib/caretOperations/transpose.ts index 6523327b253..7de35d6f796 100644 --- a/src/vs/editor/contrib/caretOperations/transpose.ts +++ b/src/vs/editor/contrib/caretOperations/transpose.ts @@ -15,6 +15,7 @@ import { registerEditorAction, EditorAction, ServicesAccessor } from 'vs/editor/ import { ReplaceCommand } from 'vs/editor/common/commands/replaceCommand'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ITextModel } from 'vs/editor/common/model'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; class TransposeLettersAction extends EditorAction { @@ -67,7 +68,8 @@ class TransposeLettersAction extends EditorAction { primary: 0, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_T - } + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/clipboard/clipboard.ts b/src/vs/editor/contrib/clipboard/clipboard.ts index 97f62935e1f..1c1ee451ef6 100644 --- a/src/vs/editor/contrib/clipboard/clipboard.ts +++ b/src/vs/editor/contrib/clipboard/clipboard.ts @@ -16,6 +16,7 @@ import { registerEditorAction, IActionOptions, EditorAction, ICommandKeybindings import { CopyOptions } from 'vs/editor/browser/controller/textAreaInput'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; const CLIPBOARD_CONTEXT_MENU_GROUP = '9_cutcopypaste'; @@ -62,7 +63,8 @@ class ExecCommandCutAction extends ExecCommandAction { let kbOpts: ICommandKeybindingsOptions = { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.KEY_X, - win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_X, secondary: [KeyMod.Shift | KeyCode.Delete] } + win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_X, secondary: [KeyMod.Shift | KeyCode.Delete] }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }; // Do not bind cut keybindings in the browser, // since browsers do that for us and it avoids security prompts @@ -99,7 +101,8 @@ class ExecCommandCopyAction extends ExecCommandAction { let kbOpts: ICommandKeybindingsOptions = { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.KEY_C, - win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_C, secondary: [KeyMod.CtrlCmd | KeyCode.Insert] } + win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_C, secondary: [KeyMod.CtrlCmd | KeyCode.Insert] }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }; // Do not bind copy keybindings in the browser, // since browsers do that for us and it avoids security prompts @@ -137,7 +140,8 @@ class ExecCommandPasteAction extends ExecCommandAction { let kbOpts: ICommandKeybindingsOptions = { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.KEY_V, - win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_V, secondary: [KeyMod.Shift | KeyCode.Insert] } + win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_V, secondary: [KeyMod.Shift | KeyCode.Insert] }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }; // Do not bind paste keybindings in the browser, // since browsers do that for us and it avoids security prompts @@ -169,7 +173,8 @@ class ExecCommandCopyWithSyntaxHighlightingAction extends ExecCommandAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.textInputFocus, - primary: null + primary: null, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/codeAction/codeActionCommands.ts b/src/vs/editor/contrib/codeAction/codeActionCommands.ts index 53870292126..773c7aa7243 100644 --- a/src/vs/editor/contrib/codeAction/codeActionCommands.ts +++ b/src/vs/editor/contrib/codeAction/codeActionCommands.ts @@ -26,6 +26,7 @@ import { CodeActionModel, CodeActionsComputeEvent, SUPPORTED_CODE_ACTIONS } from import { CodeActionAutoApply, CodeActionFilter, CodeActionKind } from './codeActionTrigger'; import { CodeActionContextMenu } from './codeActionWidget'; import { LightBulbWidget } from './lightBulbWidget'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; function contextKeyForSupportedActions(kind: CodeActionKind) { return ContextKeyExpr.regex( @@ -192,7 +193,8 @@ export class QuickFixAction extends EditorAction { precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasCodeActionsProvider), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyCode.US_DOT + primary: KeyMod.CtrlCmd | KeyCode.US_DOT, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -272,7 +274,8 @@ export class RefactorAction extends EditorAction { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_R, mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_R - } + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: '1_modification', @@ -335,7 +338,8 @@ export class OrganizeImportsAction extends EditorAction { contextKeyForSupportedActions(CodeActionKind.SourceOrganizeImports)), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_O + primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_O, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/comment/comment.ts b/src/vs/editor/contrib/comment/comment.ts index b570ff1f041..38cf5fb416c 100644 --- a/src/vs/editor/contrib/comment/comment.ts +++ b/src/vs/editor/contrib/comment/comment.ts @@ -12,6 +12,7 @@ import { registerEditorAction, IActionOptions, EditorAction, ServicesAccessor } import { BlockCommentCommand } from './blockCommentCommand'; import { LineCommentCommand, Type } from './lineCommentCommand'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; abstract class CommentLineAction extends EditorAction { @@ -52,7 +53,8 @@ class ToggleCommentLineAction extends CommentLineAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyCode.US_SLASH + primary: KeyMod.CtrlCmd | KeyCode.US_SLASH, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -67,7 +69,8 @@ class AddLineCommentAction extends CommentLineAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_C) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_C), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -82,7 +85,8 @@ class RemoveLineCommentAction extends CommentLineAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_U) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_U), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -99,7 +103,8 @@ class BlockCommentAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, - linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A } + linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/contextmenu/contextmenu.ts b/src/vs/editor/contrib/contextmenu/contextmenu.ts index a3467f32a75..9049525c110 100644 --- a/src/vs/editor/contrib/contextmenu/contextmenu.ts +++ b/src/vs/editor/contrib/contextmenu/contextmenu.ts @@ -20,6 +20,7 @@ import { IEditorContribution, IScrollEvent, ScrollType } from 'vs/editor/common/ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { registerEditorAction, registerEditorContribution, ServicesAccessor, EditorAction } from 'vs/editor/browser/editorExtensions'; import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export interface IPosition { x: number; @@ -227,7 +228,8 @@ class ShowContextMenu extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.textInputFocus, - primary: KeyMod.Shift | KeyCode.F10 + primary: KeyMod.Shift | KeyCode.F10, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/cursorUndo/cursorUndo.ts b/src/vs/editor/contrib/cursorUndo/cursorUndo.ts index dec489e7d14..f2beb917e44 100644 --- a/src/vs/editor/contrib/cursorUndo/cursorUndo.ts +++ b/src/vs/editor/contrib/cursorUndo/cursorUndo.ts @@ -12,6 +12,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { IEditorContribution, ScrollType } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; class CursorState { readonly selections: Selection[]; @@ -118,7 +119,8 @@ export class CursorUndo extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.textInputFocus, - primary: KeyMod.CtrlCmd | KeyCode.KEY_U + primary: KeyMod.CtrlCmd | KeyCode.KEY_U, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/find/findController.ts b/src/vs/editor/contrib/find/findController.ts index 73bf698e3b8..e4358fa14f5 100644 --- a/src/vs/editor/contrib/find/findController.ts +++ b/src/vs/editor/contrib/find/findController.ts @@ -386,7 +386,8 @@ export class StartFindAction extends EditorAction { precondition: null, kbOpts: { kbExpr: null, - primary: KeyMod.CtrlCmd | KeyCode.KEY_F + primary: KeyMod.CtrlCmd | KeyCode.KEY_F, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -418,7 +419,8 @@ export class StartFindWithSelectionAction extends EditorAction { primary: null, mac: { primary: KeyMod.CtrlCmd | KeyCode.KEY_E, - } + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -467,7 +469,8 @@ export class NextMatchFindAction extends MatchFindAction { kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyCode.F3, - mac: { primary: KeyMod.CtrlCmd | KeyCode.KEY_G, secondary: [KeyCode.F3] } + mac: { primary: KeyMod.CtrlCmd | KeyCode.KEY_G, secondary: [KeyCode.F3] }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -488,7 +491,8 @@ export class PreviousMatchFindAction extends MatchFindAction { kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.Shift | KeyCode.F3, - mac: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_G, secondary: [KeyMod.Shift | KeyCode.F3] } + mac: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_G, secondary: [KeyMod.Shift | KeyCode.F3] }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -533,7 +537,8 @@ export class NextSelectionMatchFindAction extends SelectionMatchFindAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyMod.CtrlCmd | KeyCode.F3 + primary: KeyMod.CtrlCmd | KeyCode.F3, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -553,7 +558,8 @@ export class PreviousSelectionMatchFindAction extends SelectionMatchFindAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F3 + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F3, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -574,7 +580,8 @@ export class StartFindReplaceAction extends EditorAction { kbOpts: { kbExpr: null, primary: KeyMod.CtrlCmd | KeyCode.KEY_H, - mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_F } + mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_F }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/folding/folding.ts b/src/vs/editor/contrib/folding/folding.ts index 43a305a49bc..9aa9bcb6a86 100644 --- a/src/vs/editor/contrib/folding/folding.ts +++ b/src/vs/editor/contrib/folding/folding.ts @@ -32,6 +32,7 @@ import { FoldingRangeProviderRegistry, FoldingRangeKind } from 'vs/editor/common import { SyntaxRangeProvider, ID_SYNTAX_PROVIDER } from './syntaxRangeProvider'; import { CancellationToken } from 'vs/base/common/cancellation'; import { InitializingRangeProvider, ID_INIT_PROVIDER } from 'vs/editor/contrib/folding/intializingRangeProvider'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export const ID = 'editor.contrib.folding'; @@ -486,7 +487,8 @@ class UnfoldAction extends FoldingAction { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_CLOSE_SQUARE_BRACKET, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_CLOSE_SQUARE_BRACKET - } + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, description: { description: 'Unfold the content in the editor', @@ -526,7 +528,8 @@ class UnFoldRecursivelyAction extends FoldingAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -549,7 +552,8 @@ class FoldAction extends FoldingAction { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_OPEN_SQUARE_BRACKET, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_OPEN_SQUARE_BRACKET - } + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, description: { description: 'Fold the content in the editor', @@ -589,7 +593,8 @@ class FoldRecursivelyAction extends FoldingAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -610,7 +615,8 @@ class FoldAllBlockCommentsAction extends FoldingAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_SLASH) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_SLASH), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -638,7 +644,8 @@ class FoldAllRegionsAction extends FoldingAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_8) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_8), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -666,7 +673,8 @@ class UnfoldAllRegionsAction extends FoldingAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_9) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_9), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -694,7 +702,8 @@ class FoldAllAction extends FoldingAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_0) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_0), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -714,7 +723,8 @@ class UnfoldAllAction extends FoldingAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_J) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_J), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -757,7 +767,8 @@ for (let i = 1; i <= 7; i++) { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | (KeyCode.KEY_0 + i)) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | (KeyCode.KEY_0 + i)), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }) ); diff --git a/src/vs/editor/contrib/format/formatActions.ts b/src/vs/editor/contrib/format/formatActions.ts index 985dd3e900e..e2db778084a 100644 --- a/src/vs/editor/contrib/format/formatActions.ts +++ b/src/vs/editor/contrib/format/formatActions.ts @@ -26,6 +26,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ISingleEditOperation } from 'vs/editor/common/model'; import { INotificationService } from 'vs/platform/notification/common/notification'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; function alertFormattingEdits(edits: ISingleEditOperation[]): void { @@ -310,7 +311,8 @@ export class FormatDocumentAction extends AbstractFormatAction { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_F, // secondary: [KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_D)], - linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_I } + linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_I }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { when: EditorContextKeys.hasDocumentFormattingProvider, @@ -341,7 +343,8 @@ export class FormatSelectionAction extends AbstractFormatAction { precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasNonEmptySelection), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_F) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_F), + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { when: ContextKeyExpr.and(EditorContextKeys.hasDocumentSelectionFormattingProvider, EditorContextKeys.hasNonEmptySelection), diff --git a/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts b/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts index 981b9fc99dc..827338a0c38 100644 --- a/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts +++ b/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts @@ -25,6 +25,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ITextModel, IWordAtPosition } from 'vs/editor/common/model'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { createCancelablePromise } from 'vs/base/common/async'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class DefinitionActionConfig { @@ -191,7 +192,8 @@ export class GoToDefinitionAction extends DefinitionAction { EditorContextKeys.isInEmbeddedEditor.toNegated()), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: goToDeclarationKb + primary: goToDeclarationKb, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: 'navigation', @@ -215,7 +217,8 @@ export class OpenDefinitionToSideAction extends DefinitionAction { EditorContextKeys.isInEmbeddedEditor.toNegated()), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, goToDeclarationKb) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, goToDeclarationKb), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -234,7 +237,8 @@ export class PeekDefinitionAction extends DefinitionAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F12, - linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F10 } + linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F10 }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: 'navigation', @@ -274,7 +278,8 @@ export class GoToImplementationAction extends ImplementationAction { EditorContextKeys.isInEmbeddedEditor.toNegated()), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyCode.F12 + primary: KeyMod.CtrlCmd | KeyCode.F12, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -294,7 +299,8 @@ export class PeekImplementationAction extends ImplementationAction { EditorContextKeys.isInEmbeddedEditor.toNegated()), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F12 + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F12, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -330,7 +336,8 @@ export class GoToTypeDefinitionAction extends TypeDefinitionAction { EditorContextKeys.isInEmbeddedEditor.toNegated()), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: 0 + primary: 0, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: 'navigation', @@ -354,7 +361,8 @@ export class PeekTypeDefinitionAction extends TypeDefinitionAction { EditorContextKeys.isInEmbeddedEditor.toNegated()), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: 0 + primary: 0, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/gotoError/gotoError.ts b/src/vs/editor/contrib/gotoError/gotoError.ts index 1c56024bc20..67da2b3d1af 100644 --- a/src/vs/editor/contrib/gotoError/gotoError.ts +++ b/src/vs/editor/contrib/gotoError/gotoError.ts @@ -401,7 +401,8 @@ class NextMarkerInFilesAction extends MarkerNavigationAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyCode.F8 + primary: KeyCode.F8, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -416,7 +417,8 @@ class PrevMarkerInFilesAction extends MarkerNavigationAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyMod.Shift | KeyCode.F8 + primary: KeyMod.Shift | KeyCode.F8, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/hover/hover.ts b/src/vs/editor/contrib/hover/hover.ts index 45f39711585..3ac5dd530f1 100644 --- a/src/vs/editor/contrib/hover/hover.ts +++ b/src/vs/editor/contrib/hover/hover.ts @@ -26,6 +26,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { MarkdownRenderer } from 'vs/editor/contrib/markdown/markdownRenderer'; import { IEmptyContentData } from 'vs/editor/browser/controller/mouseTarget'; import { HoverStartMode } from 'vs/editor/contrib/hover/hoverOperation'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class ModesHoverController implements IEditorContribution { @@ -250,7 +251,8 @@ class ShowHoverAction extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_I) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_I), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts b/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts index 3127c005bfe..19d7c00d6dd 100644 --- a/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts +++ b/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts @@ -22,6 +22,7 @@ import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { CancelablePromise, createCancelablePromise, timeout } from 'vs/base/common/async'; import { onUnexpectedError } from 'vs/base/common/errors'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; class InPlaceReplaceController implements IEditorContribution { @@ -142,7 +143,8 @@ class InPlaceReplaceUp extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_COMMA + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_COMMA, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -166,7 +168,8 @@ class InPlaceReplaceDown extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_DOT + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_DOT, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/linesOperations/linesOperations.ts b/src/vs/editor/contrib/linesOperations/linesOperations.ts index 7f2c9fb66c4..8752f7a1abd 100644 --- a/src/vs/editor/contrib/linesOperations/linesOperations.ts +++ b/src/vs/editor/contrib/linesOperations/linesOperations.ts @@ -23,6 +23,7 @@ import { MoveLinesCommand } from './moveLinesCommand'; import { TypeOperations } from 'vs/editor/common/controller/cursorTypeOperations'; import { CoreEditingCommands } from 'vs/editor/browser/controller/coreCommands'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; // copy lines @@ -60,7 +61,8 @@ class CopyLinesUpAction extends AbstractCopyLinesAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow, - linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow } + linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -76,7 +78,8 @@ class CopyLinesDownAction extends AbstractCopyLinesAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow, - linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow } + linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -119,7 +122,8 @@ class MoveLinesUpAction extends AbstractMoveLinesAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.UpArrow, - linux: { primary: KeyMod.Alt | KeyCode.UpArrow } + linux: { primary: KeyMod.Alt | KeyCode.UpArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -135,7 +139,8 @@ class MoveLinesDownAction extends AbstractMoveLinesAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.DownArrow, - linux: { primary: KeyMod.Alt | KeyCode.DownArrow } + linux: { primary: KeyMod.Alt | KeyCode.DownArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -204,7 +209,8 @@ export class TrimTrailingWhitespaceAction extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_X) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_X), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -245,7 +251,8 @@ class DeleteLinesAction extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.textInputFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_K + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_K, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -314,7 +321,8 @@ export class IndentLinesAction extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET + primary: KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -335,7 +343,8 @@ class OutdentLinesAction extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET + primary: KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -354,7 +363,8 @@ export class InsertLineBeforeAction extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -374,7 +384,8 @@ export class InsertLineAfterAction extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyCode.Enter + primary: KeyMod.CtrlCmd | KeyCode.Enter, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -434,7 +445,8 @@ export class DeleteAllLeftAction extends AbstractDeleteAllToBoundaryAction { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: null, - mac: { primary: KeyMod.CtrlCmd | KeyCode.Backspace } + mac: { primary: KeyMod.CtrlCmd | KeyCode.Backspace }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -502,7 +514,8 @@ export class DeleteAllRightAction extends AbstractDeleteAllToBoundaryAction { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: null, - mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_K, secondary: [KeyMod.CtrlCmd | KeyCode.Delete] } + mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_K, secondary: [KeyMod.CtrlCmd | KeyCode.Delete] }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -559,7 +572,8 @@ export class JoinLinesAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: 0, - mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_J } + mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_J }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/multicursor/multicursor.ts b/src/vs/editor/contrib/multicursor/multicursor.ts index 0517d7061a5..528f016f635 100644 --- a/src/vs/editor/contrib/multicursor/multicursor.ts +++ b/src/vs/editor/contrib/multicursor/multicursor.ts @@ -25,6 +25,7 @@ import { overviewRulerSelectionHighlightForeground } from 'vs/platform/theme/com import { themeColorFromId } from 'vs/platform/theme/common/themeService'; import { INewFindReplaceState, FindOptionOverride } from 'vs/editor/contrib/find/findState'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class InsertCursorAbove extends EditorAction { @@ -40,7 +41,8 @@ export class InsertCursorAbove extends EditorAction { linux: { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.UpArrow, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.UpArrow] - } + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -78,7 +80,8 @@ export class InsertCursorBelow extends EditorAction { linux: { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.DownArrow, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.DownArrow] - } + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -112,7 +115,8 @@ class InsertCursorAtEndOfEachLineSelected extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_I + primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_I, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -522,7 +526,8 @@ export class AddSelectionToNextFindMatchAction extends MultiCursorSelectionContr precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyMod.CtrlCmd | KeyCode.KEY_D + primary: KeyMod.CtrlCmd | KeyCode.KEY_D, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -554,7 +559,8 @@ export class MoveSelectionToNextFindMatchAction extends MultiCursorSelectionCont precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_D) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_D), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -586,7 +592,8 @@ export class SelectHighlightsAction extends MultiCursorSelectionControllerAction precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_L + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_L, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -604,7 +611,8 @@ export class CompatChangeAll extends MultiCursorSelectionControllerAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyCode.F2 + primary: KeyMod.CtrlCmd | KeyCode.F2, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: '1_modification', diff --git a/src/vs/editor/contrib/parameterHints/parameterHints.ts b/src/vs/editor/contrib/parameterHints/parameterHints.ts index 92d7eb7a799..5c856791d50 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHints.ts +++ b/src/vs/editor/contrib/parameterHints/parameterHints.ts @@ -68,7 +68,8 @@ export class TriggerParameterHintsAction extends EditorAction { precondition: EditorContextKeys.hasSignatureHelpProvider, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Space + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Space, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/referenceSearch/referenceSearch.ts b/src/vs/editor/contrib/referenceSearch/referenceSearch.ts index ff8515fdd1e..cc5974cf302 100644 --- a/src/vs/editor/contrib/referenceSearch/referenceSearch.ts +++ b/src/vs/editor/contrib/referenceSearch/referenceSearch.ts @@ -70,7 +70,8 @@ export class ReferenceAction extends EditorAction { EditorContextKeys.isInEmbeddedEditor.toNegated()), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.Shift | KeyCode.F12 + primary: KeyMod.Shift | KeyCode.F12, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: 'navigation', diff --git a/src/vs/editor/contrib/rename/rename.ts b/src/vs/editor/contrib/rename/rename.ts index d83828e5695..42f35cefac4 100644 --- a/src/vs/editor/contrib/rename/rename.ts +++ b/src/vs/editor/contrib/rename/rename.ts @@ -224,7 +224,8 @@ export class RenameAction extends EditorAction { precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasRenameProvider), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyCode.F2 + primary: KeyCode.F2, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: '1_modification', diff --git a/src/vs/editor/contrib/smartSelect/smartSelect.ts b/src/vs/editor/contrib/smartSelect/smartSelect.ts index 7c25548d3c9..b900d5011b2 100644 --- a/src/vs/editor/contrib/smartSelect/smartSelect.ts +++ b/src/vs/editor/contrib/smartSelect/smartSelect.ts @@ -16,6 +16,7 @@ import { registerEditorAction, ServicesAccessor, IActionOptions, EditorAction, r import { TokenSelectionSupport, ILogicalSelectionEntry } from './tokenSelectionSupport'; import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; // --- selection state machine @@ -173,7 +174,8 @@ class GrowSelectionAction extends AbstractSmartSelect { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.RightArrow, - mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.RightArrow } + mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.RightArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -189,7 +191,8 @@ class ShrinkSelectionAction extends AbstractSmartSelect { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.LeftArrow, - mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.LeftArrow } + mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.LeftArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/suggest/suggestController.ts b/src/vs/editor/contrib/suggest/suggestController.ts index f92c3459f73..58214089da4 100644 --- a/src/vs/editor/contrib/suggest/suggestController.ts +++ b/src/vs/editor/contrib/suggest/suggestController.ts @@ -325,7 +325,8 @@ export class TriggerSuggestAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.Space, - mac: { primary: KeyMod.WinCtrl | KeyCode.Space } + mac: { primary: KeyMod.WinCtrl | KeyCode.Space }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts b/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts index e3aa3349af1..e71d465233f 100644 --- a/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts +++ b/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts @@ -9,6 +9,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { registerEditorAction, ServicesAccessor, EditorAction } from 'vs/editor/browser/editorExtensions'; import { TabFocus } from 'vs/editor/common/config/commonEditorConfig'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class ToggleTabFocusModeAction extends EditorAction { @@ -23,7 +24,8 @@ export class ToggleTabFocusModeAction extends EditorAction { kbOpts: { kbExpr: null, primary: KeyMod.CtrlCmd | KeyCode.KEY_M, - mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_M } + mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_M }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts b/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts index 7f21bc957a1..be9f60bf3e4 100644 --- a/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts +++ b/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts @@ -25,6 +25,7 @@ import { firstIndex, isFalsyOrEmpty } from 'vs/base/common/arrays'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ITextModel, TrackedRangeStickiness, OverviewRulerLane, IModelDeltaDecoration } from 'vs/editor/common/model'; import { CancellationToken } from 'vs/base/common/cancellation'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export const editorWordHighlight = registerColor('editor.wordHighlightBackground', { dark: '#575757B8', light: '#57575740', hc: null }, nls.localize('wordHighlight', 'Background color of a symbol during read-access, like reading a variable. The color must not be opaque to not hide underlying decorations.'), true); export const editorWordHighlightStrong = registerColor('editor.wordHighlightStrongBackground', { dark: '#004972B8', light: '#0e639c40', hc: null }, nls.localize('wordHighlightStrong', 'Background color of a symbol during write-access, like writing to a variable. The color must not be opaque to not hide underlying decorations.'), true); @@ -459,7 +460,8 @@ class NextWordHighlightAction extends WordHighlightNavigationAction { precondition: ctxHasWordHighlights, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyCode.F7 + primary: KeyCode.F7, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -474,7 +476,8 @@ class PrevWordHighlightAction extends WordHighlightNavigationAction { precondition: ctxHasWordHighlights, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.Shift | KeyCode.F7 + primary: KeyMod.Shift | KeyCode.F7, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/wordOperations/wordOperations.ts b/src/vs/editor/contrib/wordOperations/wordOperations.ts index 528303ab72c..7d94b1a2372 100644 --- a/src/vs/editor/contrib/wordOperations/wordOperations.ts +++ b/src/vs/editor/contrib/wordOperations/wordOperations.ts @@ -19,6 +19,7 @@ import { getMapForWordSeparators, WordCharacterClassifier } from 'vs/editor/comm import { CursorState } from 'vs/editor/common/controller/cursorCommon'; import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export interface MoveWordOptions extends ICommandOptions { inSelectionMode: boolean; @@ -100,7 +101,8 @@ export class CursorWordStartLeft extends WordLeftCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.LeftArrow, - mac: { primary: KeyMod.Alt | KeyCode.LeftArrow } + mac: { primary: KeyMod.Alt | KeyCode.LeftArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -138,7 +140,8 @@ export class CursorWordStartLeftSelect extends WordLeftCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.LeftArrow, - mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow } + mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -187,7 +190,8 @@ export class CursorWordEndRight extends WordRightCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.RightArrow, - mac: { primary: KeyMod.Alt | KeyCode.RightArrow } + mac: { primary: KeyMod.Alt | KeyCode.RightArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -225,7 +229,8 @@ export class CursorWordEndRightSelect extends WordRightCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.RightArrow, - mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow } + mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -330,7 +335,8 @@ export class DeleteWordLeft extends DeleteWordLeftCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.Backspace, - mac: { primary: KeyMod.Alt | KeyCode.Backspace } + mac: { primary: KeyMod.Alt | KeyCode.Backspace }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -368,7 +374,8 @@ export class DeleteWordRight extends DeleteWordRightCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.Delete, - mac: { primary: KeyMod.Alt | KeyCode.Delete } + mac: { primary: KeyMod.Alt | KeyCode.Delete }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts b/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts index 28829ba7b31..942747eeb30 100644 --- a/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts +++ b/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts @@ -15,6 +15,7 @@ import { WordNavigationType, WordPartOperations } from 'vs/editor/common/control import { WordCharacterClassifier } from 'vs/editor/common/controller/wordCharacterClassifier'; import { DeleteWordCommand, MoveWordCommand } from '../wordOperations/wordOperations'; import { Position } from 'vs/editor/common/core/position'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class DeleteWordPartLeft extends DeleteWordCommand { constructor() { @@ -26,7 +27,8 @@ export class DeleteWordPartLeft extends DeleteWordCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Backspace, - mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.Backspace } + mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.Backspace }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -50,7 +52,8 @@ export class DeleteWordPartRight extends DeleteWordCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Delete, - mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.Delete } + mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.Delete }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -81,7 +84,8 @@ export class CursorWordPartLeft extends WordPartLeftCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.LeftArrow, - mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.LeftArrow } + mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.LeftArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -96,7 +100,8 @@ export class CursorWordPartLeftSelect extends WordPartLeftCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow, - mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow } + mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -117,7 +122,8 @@ export class CursorWordPartRight extends WordPartRightCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.RightArrow, - mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.RightArrow } + mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.RightArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -132,7 +138,8 @@ export class CursorWordPartRightSelect extends WordPartRightCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow, - mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow } + mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts b/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts index 7f6504e4607..f56ba68928d 100644 --- a/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts +++ b/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts @@ -342,7 +342,8 @@ class ShowAccessibilityHelpAction extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: (browser.isIE ? KeyMod.CtrlCmd | KeyCode.F1 : KeyMod.Alt | KeyCode.F1) + primary: (browser.isIE ? KeyMod.CtrlCmd | KeyCode.F1 : KeyMod.Alt | KeyCode.F1), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts b/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts index 9f83d8111c9..680de38a680 100644 --- a/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts +++ b/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts @@ -18,6 +18,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { ITextModel } from 'vs/editor/common/model'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; interface ParseResult { position: Position; @@ -153,7 +154,8 @@ export class GotoLineAction extends BaseEditorQuickOpenAction { kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.CtrlCmd | KeyCode.KEY_G, - mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_G } + mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_G }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts b/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts index e44e14c0da8..1ccd2cb33bc 100644 --- a/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts +++ b/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts @@ -18,6 +18,7 @@ import { registerEditorAction, ServicesAccessor } from 'vs/editor/browser/editor import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import * as browser from 'vs/base/browser/browser'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class EditorActionCommandEntry extends QuickOpenEntryGroup { private key: string; @@ -79,7 +80,8 @@ export class QuickCommandAction extends BaseEditorQuickOpenAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: (browser.isIE ? KeyMod.Alt | KeyCode.F1 : KeyCode.F1) + primary: (browser.isIE ? KeyMod.Alt | KeyCode.F1 : KeyCode.F1), + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { } diff --git a/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts b/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts index 19eeda1c9cc..c2ae838ae8d 100644 --- a/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts +++ b/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts @@ -22,6 +22,7 @@ import { registerEditorAction, ServicesAccessor } from 'vs/editor/browser/editor import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Range, IRange } from 'vs/editor/common/core/range'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; let SCOPE_PREFIX = ':'; @@ -120,7 +121,8 @@ export class QuickOutlineAction extends BaseEditorQuickOpenAction { precondition: EditorContextKeys.hasDocumentSymbolProvider, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_O + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_O, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: 'navigation', diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts b/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts index a9e4ec6741e..f694743fb2c 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts @@ -286,7 +286,8 @@ class ShowAccessibilityHelpAction extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyMod.Alt | KeyCode.F1 + primary: KeyMod.Alt | KeyCode.F1, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts b/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts index 882cd01e68b..b81dea044c7 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts @@ -18,6 +18,7 @@ import { InternalEditorOptions, EDITOR_DEFAULTS } from 'vs/editor/common/config/ import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { INotificationService } from 'vs/platform/notification/common/notification'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; const transientWordWrapState = 'transientWordWrapState'; const isWordWrapMinifiedKey = 'isWordWrapMinified'; @@ -141,7 +142,8 @@ class ToggleWordWrapAction extends EditorAction { precondition: null, kbOpts: { kbExpr: null, - primary: KeyMod.Alt | KeyCode.KEY_Z + primary: KeyMod.Alt | KeyCode.KEY_Z, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/workbench/parts/debug/browser/debugEditorActions.ts b/src/vs/workbench/parts/debug/browser/debugEditorActions.ts index a8e56c2bc4c..a8224ca4ce8 100644 --- a/src/vs/workbench/parts/debug/browser/debugEditorActions.ts +++ b/src/vs/workbench/parts/debug/browser/debugEditorActions.ts @@ -16,6 +16,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { openBreakpointSource } from 'vs/workbench/parts/debug/browser/breakpointsView'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export const TOGGLE_BREAKPOINT_ID = 'editor.debug.action.toggleBreakpoint'; class ToggleBreakpointAction extends EditorAction { @@ -27,7 +28,8 @@ class ToggleBreakpointAction extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyCode.F9 + primary: KeyCode.F9, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -197,7 +199,8 @@ class ShowDebugHoverAction extends EditorAction { precondition: CONTEXT_IN_DEBUG_MODE, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_I) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_I), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/workbench/parts/debug/electron-browser/breakpointWidget.ts b/src/vs/workbench/parts/debug/electron-browser/breakpointWidget.ts index b6781653be4..7e2a5443ce8 100644 --- a/src/vs/workbench/parts/debug/electron-browser/breakpointWidget.ts +++ b/src/vs/workbench/parts/debug/electron-browser/breakpointWidget.ts @@ -33,6 +33,7 @@ import { transparent, editorForeground } from 'vs/platform/theme/common/colorReg import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { IDecorationOptions } from 'vs/editor/common/editorCommon'; import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; const $ = dom.$; const IPrivateBreakpointWidgetService = createDecorator('privateBreakopintWidgetService'); @@ -296,7 +297,8 @@ class AcceptBreakpointWidgetInputAction extends EditorCommand { precondition: CONTEXT_BREAKPOINT_WIDGET_VISIBLE, kbOpts: { kbExpr: CONTEXT_IN_BREAKPOINT_WIDGET, - primary: KeyCode.Enter + primary: KeyCode.Enter, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -315,7 +317,8 @@ class CloseBreakpointWidgetCommand extends EditorCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyCode.Escape, - secondary: [KeyMod.Shift | KeyCode.Escape] + secondary: [KeyMod.Shift | KeyCode.Escape], + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/workbench/parts/debug/electron-browser/repl.ts b/src/vs/workbench/parts/debug/electron-browser/repl.ts index fdd2f9ac975..6d38eab3e4d 100644 --- a/src/vs/workbench/parts/debug/electron-browser/repl.ts +++ b/src/vs/workbench/parts/debug/electron-browser/repl.ts @@ -47,6 +47,7 @@ import { IDebugService, REPL_ID, DEBUG_SCHEME, CONTEXT_IN_DEBUG_REPL } from 'vs/ import { HistoryNavigator } from 'vs/base/common/history'; import { IHistoryNavigationWidget } from 'vs/base/browser/history'; import { createAndBindHistoryNavigationWidgetScopedContextKeyService } from 'vs/platform/widget/browser/contextScopedHistoryWidget'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; const $ = dom.$; @@ -315,7 +316,8 @@ class AcceptReplInputAction extends EditorAction { precondition: CONTEXT_IN_DEBUG_REPL, kbOpts: { kbExpr: EditorContextKeys.textInputFocus, - primary: KeyCode.Enter + primary: KeyCode.Enter, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts b/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts index 5a9512f8999..4532d781d2f 100644 --- a/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts +++ b/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts @@ -10,6 +10,7 @@ import { registerEditorAction } from 'vs/editor/browser/editorExtensions'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { KeyCode } from 'vs/base/common/keyCodes'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; class ExpandAbbreviationAction extends EmmetEditorAction { @@ -26,7 +27,8 @@ class ExpandAbbreviationAction extends EmmetEditorAction { EditorContextKeys.editorTextFocus, EditorContextKeys.tabDoesNotMoveFocus, ContextKeyExpr.has('config.emmet.triggerExpansionOnTab') - ) + ), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); diff --git a/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts b/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts index 26b12485999..632412c5313 100644 --- a/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts +++ b/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts @@ -1121,7 +1121,8 @@ const showCommand = new ShowExtensionEditorFindCommand({ id: 'editor.action.extensioneditor.showfind', precondition: KEYBINDING_CONTEXT_EXTENSIONEDITOR_WEBVIEW_FOCUS, kbOpts: { - primary: KeyMod.CtrlCmd | KeyCode.KEY_F + primary: KeyMod.CtrlCmd | KeyCode.KEY_F, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -showCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +showCommand.register(); diff --git a/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts b/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts index 2a3fab73b51..30a65e1aaa0 100644 --- a/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts +++ b/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts @@ -29,6 +29,7 @@ import { WindowsNativeResolvedKeybinding } from 'vs/workbench/services/keybindin import { themeColorFromId, ThemeColor } from 'vs/platform/theme/common/themeService'; import { overviewRulerInfo, overviewRulerError } from 'vs/editor/common/view/editorColorRegistry'; import { IModelDeltaDecoration, ITextModel, TrackedRangeStickiness, OverviewRulerLane } from 'vs/editor/common/model'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; const NLS_LAUNCH_MESSAGE = nls.localize('defineKeybinding.start', "Define Keybinding"); const NLS_KB_LAYOUT_ERROR_MESSAGE = nls.localize('defineKeybinding.kbLayoutErrorMessage', "You won't be able to produce this key combination under your current keyboard layout."); @@ -365,7 +366,8 @@ class DefineKeybindingCommand extends EditorCommand { precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.languageId.isEqualTo('jsonc')), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_K) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_K), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts b/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts index cb4dd53b20e..fb41da7a3f1 100644 --- a/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts +++ b/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts @@ -351,9 +351,9 @@ class StartSearchDefaultSettingsCommand extends SettingsCommand { const startSearchCommand = new StartSearchDefaultSettingsCommand({ id: SETTINGS_EDITOR_COMMAND_SEARCH, precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR), - kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.KEY_F } + kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.KEY_F, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -startSearchCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +startSearchCommand.register(); class FocusSearchFromSettingsCommand extends SettingsCommand { @@ -367,9 +367,9 @@ class FocusSearchFromSettingsCommand extends SettingsCommand { const focusSearchFromSettingsCommand = new FocusSearchFromSettingsCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_SEARCH_FROM_SETTINGS, precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_FIRST_ROW_FOCUS), - kbOpts: { primary: KeyCode.UpArrow } + kbOpts: { primary: KeyCode.UpArrow, weight: KeybindingsRegistry.WEIGHT.workbenchContrib() } }); -focusSearchFromSettingsCommand.register(KeybindingsRegistry.WEIGHT.workbenchContrib()); +focusSearchFromSettingsCommand.register(); class ClearSearchResultsCommand extends SettingsCommand { @@ -384,9 +384,9 @@ class ClearSearchResultsCommand extends SettingsCommand { const clearSearchResultsCommand = new ClearSearchResultsCommand({ id: SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyCode.Escape } + kbOpts: { primary: KeyCode.Escape, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -clearSearchResultsCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +clearSearchResultsCommand.register(); class FocusSettingsFileEditorCommand extends SettingsCommand { @@ -402,16 +402,16 @@ class FocusSettingsFileEditorCommand extends SettingsCommand { const focusSettingsFileEditorCommand = new FocusSettingsFileEditorCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_FILE, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyCode.DownArrow } + kbOpts: { primary: KeyCode.DownArrow, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -focusSettingsFileEditorCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +focusSettingsFileEditorCommand.register(); const focusSettingsFromSearchCommand = new FocusSettingsFileEditorCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_FROM_SEARCH, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyCode.DownArrow } + kbOpts: { primary: KeyCode.DownArrow, weight: KeybindingsRegistry.WEIGHT.workbenchContrib() } }); -focusSettingsFromSearchCommand.register(KeybindingsRegistry.WEIGHT.workbenchContrib()); +focusSettingsFromSearchCommand.register(); class FocusNextSearchResultCommand extends SettingsCommand { @@ -425,9 +425,9 @@ class FocusNextSearchResultCommand extends SettingsCommand { const focusNextSearchResultCommand = new FocusNextSearchResultCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_NEXT_SETTING, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyCode.Enter } + kbOpts: { primary: KeyCode.Enter, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -focusNextSearchResultCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +focusNextSearchResultCommand.register(); class FocusPreviousSearchResultCommand extends SettingsCommand { @@ -441,9 +441,9 @@ class FocusPreviousSearchResultCommand extends SettingsCommand { const focusPreviousSearchResultCommand = new FocusPreviousSearchResultCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_PREVIOUS_SETTING, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyMod.Shift | KeyCode.Enter } + kbOpts: { primary: KeyMod.Shift | KeyCode.Enter, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -focusPreviousSearchResultCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +focusPreviousSearchResultCommand.register(); class EditFocusedSettingCommand extends SettingsCommand { @@ -457,9 +457,9 @@ class EditFocusedSettingCommand extends SettingsCommand { const editFocusedSettingCommand = new EditFocusedSettingCommand({ id: SETTINGS_EDITOR_COMMAND_EDIT_FOCUSED_SETTING, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.US_DOT } + kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.US_DOT, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -editFocusedSettingCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +editFocusedSettingCommand.register(); class EditFocusedSettingCommand2 extends SettingsCommand { @@ -474,9 +474,9 @@ class EditFocusedSettingCommand2 extends SettingsCommand { const editFocusedSettingCommand2 = new EditFocusedSettingCommand2({ id: SETTINGS_EDITOR_COMMAND_EDIT_FOCUSED_SETTING, precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_ROW_FOCUS), - kbOpts: { primary: KeyCode.Enter } + kbOpts: { primary: KeyCode.Enter, weight: KeybindingsRegistry.WEIGHT.workbenchContrib() } }); -editFocusedSettingCommand2.register(KeybindingsRegistry.WEIGHT.workbenchContrib()); +editFocusedSettingCommand2.register(); class FocusSettingsListCommand extends SettingsCommand { @@ -491,9 +491,9 @@ class FocusSettingsListCommand extends SettingsCommand { const focusSettingsListCommand = new FocusSettingsListCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_LIST, precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_TOC_ROW_FOCUS), - kbOpts: { primary: KeyCode.Enter } + kbOpts: { primary: KeyCode.Enter, weight: KeybindingsRegistry.WEIGHT.workbenchContrib() } }); -focusSettingsListCommand.register(KeybindingsRegistry.WEIGHT.workbenchContrib()); +focusSettingsListCommand.register(); // Preferences menu diff --git a/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts b/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts index 90a6893cdf4..e11e00143ae 100644 --- a/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts +++ b/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts @@ -372,7 +372,7 @@ export class ShowPreviousChangeAction extends EditorAction { label: nls.localize('show previous change', "Show Previous Change"), alias: 'Show Previous Change', precondition: null, - kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F3 } + kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F3, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -406,7 +406,7 @@ export class ShowNextChangeAction extends EditorAction { label: nls.localize('show next change', "Show Next Change"), alias: 'Show Next Change', precondition: null, - kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F3 } + kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F3, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -440,7 +440,7 @@ export class MoveToPreviousChangeAction extends EditorAction { label: nls.localize('move to previous change', "Move to Previous Change"), alias: 'Move to Previous Change', precondition: null, - kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F5 } + kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F5, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -482,7 +482,7 @@ export class MoveToNextChangeAction extends EditorAction { label: nls.localize('move to next change', "Move to Next Change"), alias: 'Move to Next Change', precondition: null, - kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F5 } + kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F5, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts b/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts index 2dbb4818b37..b1d86248aec 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts @@ -42,10 +42,11 @@ const showNextFindWdigetCommand = new ShowWebViewEditorFindWidgetCommand({ id: ShowWebViewEditorFindWidgetCommand.ID, precondition: KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS, kbOpts: { - primary: KeyMod.CtrlCmd | KeyCode.KEY_F + primary: KeyMod.CtrlCmd | KeyCode.KEY_F, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -showNextFindWdigetCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +showNextFindWdigetCommand.register(); const hideCommand = new HideWebViewEditorFindCommand({ id: HideWebViewEditorFindCommand.ID, @@ -53,19 +54,21 @@ const hideCommand = new HideWebViewEditorFindCommand({ KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE), kbOpts: { - primary: KeyCode.Escape + primary: KeyCode.Escape, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -hideCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +hideCommand.register(); const selectAllCommand = new SelectAllWebviewEditorCommand({ id: SelectAllWebviewEditorCommand.ID, precondition: KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS, kbOpts: { - primary: KeyMod.CtrlCmd | KeyCode.KEY_A + primary: KeyMod.CtrlCmd | KeyCode.KEY_A, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -selectAllCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +selectAllCommand.register(); actionRegistry.registerWorkbenchAction( new SyncActionDescriptor(OpenWebviewDeveloperToolsAction, OpenWebviewDeveloperToolsAction.ID, OpenWebviewDeveloperToolsAction.LABEL), From 75a9a1fd6390b07f40ef56b5fd906afcaaaa0ea5 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 24 Jul 2018 17:58:24 +0200 Subject: [PATCH 78/93] Towards using a const enum for keybindings weights --- src/vs/editor/contrib/find/findController.ts | 16 ++++---- src/vs/editor/contrib/gotoError/gotoError.ts | 2 +- .../contrib/message/messageController.ts | 2 +- .../contrib/parameterHints/parameterHints.ts | 2 +- .../referenceSearch/referenceSearch.ts | 12 +++--- src/vs/editor/contrib/rename/rename.ts | 4 +- .../contrib/snippet/snippetController2.ts | 8 ++-- .../contrib/suggest/suggestController.ts | 2 +- .../accessibilityHelp/accessibilityHelp.ts | 2 +- .../keybinding/common/keybindingsRegistry.ts | 38 +++++++++++-------- .../parts/editor/editor.contribution.ts | 4 +- .../notifications/notificationsCommands.ts | 4 +- .../quickinput/quickInput.contribution.ts | 2 +- .../parts/quickopen/quickopen.contribution.ts | 8 ++-- src/vs/workbench/electron-browser/commands.ts | 2 +- .../electron-browser/main.contribution.ts | 4 +- .../electron-browser/accessibility.ts | 2 +- .../parts/debug/browser/debugCommands.ts | 6 +-- .../electron-browser/debug.contribution.ts | 2 +- .../fileActions.contribution.ts | 10 ++--- .../browser/quickopen.contribution.ts | 4 +- .../electron-browser/dirtydiffDecorator.ts | 2 +- .../electron-browser/terminal.contribution.ts | 2 +- .../electron-browser/keybindingService.ts | 4 +- 24 files changed, 76 insertions(+), 68 deletions(-) diff --git a/src/vs/editor/contrib/find/findController.ts b/src/vs/editor/contrib/find/findController.ts index e4358fa14f5..4f8abad1489 100644 --- a/src/vs/editor/contrib/find/findController.ts +++ b/src/vs/editor/contrib/find/findController.ts @@ -631,7 +631,7 @@ registerEditorCommand(new FindCommand({ precondition: CONTEXT_FIND_WIDGET_VISIBLE, handler: x => x.closeFindWidget(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(5), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, kbExpr: EditorContextKeys.focus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] @@ -643,7 +643,7 @@ registerEditorCommand(new FindCommand({ precondition: null, handler: x => x.toggleCaseSensitive(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(5), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, kbExpr: EditorContextKeys.focus, primary: ToggleCaseSensitiveKeybinding.primary, mac: ToggleCaseSensitiveKeybinding.mac, @@ -657,7 +657,7 @@ registerEditorCommand(new FindCommand({ precondition: null, handler: x => x.toggleWholeWords(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(5), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, kbExpr: EditorContextKeys.focus, primary: ToggleWholeWordKeybinding.primary, mac: ToggleWholeWordKeybinding.mac, @@ -671,7 +671,7 @@ registerEditorCommand(new FindCommand({ precondition: null, handler: x => x.toggleRegex(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(5), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, kbExpr: EditorContextKeys.focus, primary: ToggleRegexKeybinding.primary, mac: ToggleRegexKeybinding.mac, @@ -685,7 +685,7 @@ registerEditorCommand(new FindCommand({ precondition: null, handler: x => x.toggleSearchScope(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(5), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, kbExpr: EditorContextKeys.focus, primary: ToggleSearchScopeKeybinding.primary, mac: ToggleSearchScopeKeybinding.mac, @@ -699,7 +699,7 @@ registerEditorCommand(new FindCommand({ precondition: CONTEXT_FIND_WIDGET_VISIBLE, handler: x => x.replace(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(5), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, kbExpr: EditorContextKeys.focus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_1 } @@ -710,7 +710,7 @@ registerEditorCommand(new FindCommand({ precondition: CONTEXT_FIND_WIDGET_VISIBLE, handler: x => x.replaceAll(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(5), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, kbExpr: EditorContextKeys.focus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Enter } @@ -721,7 +721,7 @@ registerEditorCommand(new FindCommand({ precondition: CONTEXT_FIND_WIDGET_VISIBLE, handler: x => x.selectAllMatches(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(5), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, kbExpr: EditorContextKeys.focus, primary: KeyMod.Alt | KeyCode.Enter } diff --git a/src/vs/editor/contrib/gotoError/gotoError.ts b/src/vs/editor/contrib/gotoError/gotoError.ts index 67da2b3d1af..341852a5dcb 100644 --- a/src/vs/editor/contrib/gotoError/gotoError.ts +++ b/src/vs/editor/contrib/gotoError/gotoError.ts @@ -439,7 +439,7 @@ registerEditorCommand(new MarkerCommand({ precondition: CONTEXT_MARKERS_NAVIGATION_VISIBLE, handler: x => x.closeMarkersNavigation(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(50), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 50, kbExpr: EditorContextKeys.focus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] diff --git a/src/vs/editor/contrib/message/messageController.ts b/src/vs/editor/contrib/message/messageController.ts index e80d0f6b90c..e25523f00ce 100644 --- a/src/vs/editor/contrib/message/messageController.ts +++ b/src/vs/editor/contrib/message/messageController.ts @@ -114,7 +114,7 @@ registerEditorCommand(new MessageCommand({ precondition: MessageController.MESSAGE_VISIBLE, handler: c => c.closeMessage(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(30), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 30, primary: KeyCode.Escape } })); diff --git a/src/vs/editor/contrib/parameterHints/parameterHints.ts b/src/vs/editor/contrib/parameterHints/parameterHints.ts index 5c856791d50..48513371b86 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHints.ts +++ b/src/vs/editor/contrib/parameterHints/parameterHints.ts @@ -85,7 +85,7 @@ export class TriggerParameterHintsAction extends EditorAction { registerEditorContribution(ParameterHintsController); registerEditorAction(TriggerParameterHintsAction); -const weight = KeybindingsRegistry.WEIGHT.editorContrib(75); +const weight = KeybindingsRegistry.WEIGHT.editorContrib() + 75; const ParameterHintsCommand = EditorCommand.bindToContribution(ParameterHintsController.get); diff --git a/src/vs/editor/contrib/referenceSearch/referenceSearch.ts b/src/vs/editor/contrib/referenceSearch/referenceSearch.ts index cc5974cf302..02be279c806 100644 --- a/src/vs/editor/contrib/referenceSearch/referenceSearch.ts +++ b/src/vs/editor/contrib/referenceSearch/referenceSearch.ts @@ -193,7 +193,7 @@ function withController(accessor: ServicesAccessor, fn: (controller: ReferencesC KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'goToNextReference', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, primary: KeyCode.F4, when: ctxReferenceSearchVisible, handler(accessor) { @@ -205,7 +205,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'goToNextReferenceFromEmbeddedEditor', - weight: KeybindingsRegistry.WEIGHT.editorContrib(50), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 50, primary: KeyCode.F4, when: PeekContext.inPeekEditor, handler(accessor) { @@ -217,7 +217,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'goToPreviousReference', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, primary: KeyMod.Shift | KeyCode.F4, when: ctxReferenceSearchVisible, handler(accessor) { @@ -229,7 +229,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'goToPreviousReferenceFromEmbeddedEditor', - weight: KeybindingsRegistry.WEIGHT.editorContrib(50), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 50, primary: KeyMod.Shift | KeyCode.F4, when: PeekContext.inPeekEditor, handler(accessor) { @@ -241,7 +241,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'closeReferenceSearch', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape], when: ContextKeyExpr.and(ctxReferenceSearchVisible, ContextKeyExpr.not('config.editor.stablePeek')), @@ -250,7 +250,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'closeReferenceSearchEditor', - weight: KeybindingsRegistry.WEIGHT.editorContrib(-101), + weight: KeybindingsRegistry.WEIGHT.editorContrib() - 101, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape], when: ContextKeyExpr.and(PeekContext.inPeekEditor, ContextKeyExpr.not('config.editor.stablePeek')), diff --git a/src/vs/editor/contrib/rename/rename.ts b/src/vs/editor/contrib/rename/rename.ts index 42f35cefac4..7515504e01c 100644 --- a/src/vs/editor/contrib/rename/rename.ts +++ b/src/vs/editor/contrib/rename/rename.ts @@ -270,7 +270,7 @@ registerEditorCommand(new RenameCommand({ precondition: CONTEXT_RENAME_INPUT_VISIBLE, handler: x => x.acceptRenameInput(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(99), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 99, kbExpr: EditorContextKeys.focus, primary: KeyCode.Enter } @@ -281,7 +281,7 @@ registerEditorCommand(new RenameCommand({ precondition: CONTEXT_RENAME_INPUT_VISIBLE, handler: x => x.cancelRenameInput(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(99), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 99, kbExpr: EditorContextKeys.focus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] diff --git a/src/vs/editor/contrib/snippet/snippetController2.ts b/src/vs/editor/contrib/snippet/snippetController2.ts index 3022a612e99..f24300356ac 100644 --- a/src/vs/editor/contrib/snippet/snippetController2.ts +++ b/src/vs/editor/contrib/snippet/snippetController2.ts @@ -227,7 +227,7 @@ registerEditorCommand(new CommandCtor({ precondition: ContextKeyExpr.and(SnippetController2.InSnippetMode, SnippetController2.HasNextTabstop), handler: ctrl => ctrl.next(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(30), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 30, kbExpr: EditorContextKeys.editorTextFocus, primary: KeyCode.Tab } @@ -237,7 +237,7 @@ registerEditorCommand(new CommandCtor({ precondition: ContextKeyExpr.and(SnippetController2.InSnippetMode, SnippetController2.HasPrevTabstop), handler: ctrl => ctrl.prev(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(30), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 30, kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyCode.Tab } @@ -247,7 +247,7 @@ registerEditorCommand(new CommandCtor({ precondition: SnippetController2.InSnippetMode, handler: ctrl => ctrl.cancel(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(30), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 30, kbExpr: EditorContextKeys.editorTextFocus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] @@ -259,7 +259,7 @@ registerEditorCommand(new CommandCtor({ precondition: SnippetController2.InSnippetMode, handler: ctrl => ctrl.finish(), // kbOpts: { - // weight: KeybindingsRegistry.WEIGHT.editorContrib(30), + // weight: KeybindingsRegistry.WEIGHT.editorContrib() + 30, // kbExpr: EditorContextKeys.textFocus, // primary: KeyCode.Enter, // } diff --git a/src/vs/editor/contrib/suggest/suggestController.ts b/src/vs/editor/contrib/suggest/suggestController.ts index 58214089da4..eece4a1f4f2 100644 --- a/src/vs/editor/contrib/suggest/suggestController.ts +++ b/src/vs/editor/contrib/suggest/suggestController.ts @@ -345,7 +345,7 @@ export class TriggerSuggestAction extends EditorAction { registerEditorContribution(SuggestController); registerEditorAction(TriggerSuggestAction); -const weight = KeybindingsRegistry.WEIGHT.editorContrib(90); +const weight = KeybindingsRegistry.WEIGHT.editorContrib() + 90; const SuggestCommand = EditorCommand.bindToContribution(SuggestController.get); diff --git a/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts b/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts index f56ba68928d..17f30a37ac0 100644 --- a/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts +++ b/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts @@ -367,7 +367,7 @@ registerEditorCommand( precondition: CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE, handler: x => x.hide(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(100), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 100, kbExpr: EditorContextKeys.focus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] diff --git a/src/vs/platform/keybinding/common/keybindingsRegistry.ts b/src/vs/platform/keybinding/common/keybindingsRegistry.ts index 39113558334..189cce3c1c8 100644 --- a/src/vs/platform/keybinding/common/keybindingsRegistry.ts +++ b/src/vs/platform/keybinding/common/keybindingsRegistry.ts @@ -57,6 +57,14 @@ export const enum KeybindingRuleSource { Extension = 1 } +export const enum KeybindingWeight { + EditorCore = 0, + EditorContrib = 100, + WorkbenchContrib = 200, + BuiltinExtension = 300, + ExternalExtension = 400 +} + export interface ICommandAndKeybindingRule extends IKeybindingRule { handler: ICommandHandler; description?: ICommandHandlerDescription; @@ -69,11 +77,11 @@ export interface IKeybindingsRegistry { getDefaultKeybindings(): IKeybindingItem[]; WEIGHT: { - editorCore(importance?: number): number; - editorContrib(importance?: number): number; - workbenchContrib(importance?: number): number; - builtinExtension(importance?: number): number; - externalExtension(importance?: number): number; + editorCore(): number; + editorContrib(): number; + workbenchContrib(): number; + builtinExtension(): number; + externalExtension(): number; }; } @@ -83,20 +91,20 @@ class KeybindingsRegistryImpl implements IKeybindingsRegistry { private _keybindingsSorted: boolean; public WEIGHT = { - editorCore: (importance: number = 0): number => { - return 0 + importance; + editorCore: (): number => { + return KeybindingWeight.EditorCore; }, - editorContrib: (importance: number = 0): number => { - return 100 + importance; + editorContrib: (): number => { + return KeybindingWeight.EditorContrib; }, - workbenchContrib: (importance: number = 0): number => { - return 200 + importance; + workbenchContrib: (): number => { + return KeybindingWeight.WorkbenchContrib; }, - builtinExtension: (importance: number = 0): number => { - return 300 + importance; + builtinExtension: (): number => { + return KeybindingWeight.BuiltinExtension; }, - externalExtension: (importance: number = 0): number => { - return 400 + importance; + externalExtension: (): number => { + return KeybindingWeight.ExternalExtension; } }; diff --git a/src/vs/workbench/browser/parts/editor/editor.contribution.ts b/src/vs/workbench/browser/parts/editor/editor.contribution.ts index bd435ff853f..01445ee9d47 100644 --- a/src/vs/workbench/browser/parts/editor/editor.contribution.ts +++ b/src/vs/workbench/browser/parts/editor/editor.contribution.ts @@ -380,7 +380,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPreviousRecentlyUs const quickOpenNavigateNextInEditorPickerId = 'workbench.action.quickOpenNavigateNextInEditorPicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigateNextInEditorPickerId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, handler: getQuickNavigateHandler(quickOpenNavigateNextInEditorPickerId, true), when: editorPickerContext, primary: openNextEditorKeybinding.primary, @@ -390,7 +390,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const quickOpenNavigatePreviousInEditorPickerId = 'workbench.action.quickOpenNavigatePreviousInEditorPicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigatePreviousInEditorPickerId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, handler: getQuickNavigateHandler(quickOpenNavigatePreviousInEditorPickerId, false), when: editorPickerContext, primary: openPreviousEditorKeybinding.primary, diff --git a/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts b/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts index 858f3bbe848..3e13fa59dfd 100644 --- a/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts +++ b/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts @@ -88,7 +88,7 @@ export function registerNotificationCommands(center: INotificationsCenterControl // Hide Notifications Center KeybindingsRegistry.registerCommandAndKeybindingRule({ id: HIDE_NOTIFICATIONS_CENTER, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, when: NotificationsCenterVisibleContext, primary: KeyCode.Escape, handler: accessor => center.hide() @@ -166,7 +166,7 @@ export function registerNotificationCommands(center: INotificationsCenterControl // Hide Toasts KeybindingsRegistry.registerCommandAndKeybindingRule({ id: HIDE_NOTIFICATION_TOAST, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, when: NotificationsToastsVisibleContext, primary: KeyCode.Escape, handler: accessor => toasts.hide() diff --git a/src/vs/workbench/browser/parts/quickinput/quickInput.contribution.ts b/src/vs/workbench/browser/parts/quickinput/quickInput.contribution.ts index cc7fb7c7577..1b4dacb5667 100644 --- a/src/vs/workbench/browser/parts/quickinput/quickInput.contribution.ts +++ b/src/vs/workbench/browser/parts/quickinput/quickInput.contribution.ts @@ -15,4 +15,4 @@ import { inQuickOpenContext } from 'vs/workbench/browser/parts/quickopen/quickop KeybindingsRegistry.registerCommandAndKeybindingRule(QuickPickManyToggle); const registry = Registry.as(ActionExtensions.WorkbenchActions); -registry.registerWorkbenchAction(new SyncActionDescriptor(BackAction, BackAction.ID, BackAction.LABEL, { primary: null, win: { primary: KeyMod.Alt | KeyCode.LeftArrow }, mac: { primary: KeyMod.WinCtrl | KeyCode.US_MINUS }, linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_MINUS } }, inQuickOpenContext, KeybindingsRegistry.WEIGHT.workbenchContrib(50)), 'Back'); +registry.registerWorkbenchAction(new SyncActionDescriptor(BackAction, BackAction.ID, BackAction.LABEL, { primary: null, win: { primary: KeyMod.Alt | KeyCode.LeftArrow }, mac: { primary: KeyMod.WinCtrl | KeyCode.US_MINUS }, linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_MINUS } }, inQuickOpenContext, KeybindingsRegistry.WEIGHT.workbenchContrib() + 50), 'Back'); diff --git a/src/vs/workbench/browser/parts/quickopen/quickopen.contribution.ts b/src/vs/workbench/browser/parts/quickopen/quickopen.contribution.ts index 3f4ad79d9b0..5a5356cbc9e 100644 --- a/src/vs/workbench/browser/parts/quickopen/quickopen.contribution.ts +++ b/src/vs/workbench/browser/parts/quickopen/quickopen.contribution.ts @@ -70,8 +70,8 @@ MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: QUICKOPEN_ACTION_ID, title: QUICKOPEN_ACION_LABEL } }); -registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenSelectNextAction, QuickOpenSelectNextAction.ID, QuickOpenSelectNextAction.LABEL, { primary: null, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_N } }, inQuickOpenContext, KeybindingsRegistry.WEIGHT.workbenchContrib(50)), 'Select Next in Quick Open'); -registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenSelectPreviousAction, QuickOpenSelectPreviousAction.ID, QuickOpenSelectPreviousAction.LABEL, { primary: null, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_P } }, inQuickOpenContext, KeybindingsRegistry.WEIGHT.workbenchContrib(50)), 'Select Previous in Quick Open'); +registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenSelectNextAction, QuickOpenSelectNextAction.ID, QuickOpenSelectNextAction.LABEL, { primary: null, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_N } }, inQuickOpenContext, KeybindingsRegistry.WEIGHT.workbenchContrib() + 50), 'Select Next in Quick Open'); +registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenSelectPreviousAction, QuickOpenSelectPreviousAction.ID, QuickOpenSelectPreviousAction.LABEL, { primary: null, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_P } }, inQuickOpenContext, KeybindingsRegistry.WEIGHT.workbenchContrib() + 50), 'Select Previous in Quick Open'); registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenNavigateNextAction, QuickOpenNavigateNextAction.ID, QuickOpenNavigateNextAction.LABEL), 'Navigate Next in Quick Open'); registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenNavigatePreviousAction, QuickOpenNavigatePreviousAction.ID, QuickOpenNavigatePreviousAction.LABEL), 'Navigate Previous in Quick Open'); registry.registerWorkbenchAction(new SyncActionDescriptor(RemoveFromEditorHistoryAction, RemoveFromEditorHistoryAction.ID, RemoveFromEditorHistoryAction.LABEL), 'Remove From History'); @@ -79,7 +79,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(RemoveFromEditorHistor const quickOpenNavigateNextInFilePickerId = 'workbench.action.quickOpenNavigateNextInFilePicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigateNextInFilePickerId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, handler: getQuickNavigateHandler(quickOpenNavigateNextInFilePickerId, true), when: defaultQuickOpenContext, primary: globalQuickOpenKeybinding.primary, @@ -90,7 +90,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const quickOpenNavigatePreviousInFilePickerId = 'workbench.action.quickOpenNavigatePreviousInFilePicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigatePreviousInFilePickerId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, handler: getQuickNavigateHandler(quickOpenNavigatePreviousInFilePickerId, false), when: defaultQuickOpenContext, primary: globalQuickOpenKeybinding.primary | KeyMod.Shift, diff --git a/src/vs/workbench/electron-browser/commands.ts b/src/vs/workbench/electron-browser/commands.ts index 0c1ea832e8e..d3a2aaac3f2 100644 --- a/src/vs/workbench/electron-browser/commands.ts +++ b/src/vs/workbench/electron-browser/commands.ts @@ -529,7 +529,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'workbench.action.exitZenMode', - weight: KeybindingsRegistry.WEIGHT.editorContrib(-1000), + weight: KeybindingsRegistry.WEIGHT.editorContrib() - 1000, handler(accessor: ServicesAccessor, configurationOrName: any) { const partService = accessor.get(IPartService); partService.toggleZenMode(); diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index 0efc9aa09fe..95f9916597e 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -135,7 +135,7 @@ const recentFilesPickerContext = ContextKeyExpr.and(inQuickOpenContext, ContextK const quickOpenNavigateNextInRecentFilesPickerId = 'workbench.action.quickOpenNavigateNextInRecentFilesPicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigateNextInRecentFilesPickerId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, handler: getQuickNavigateHandler(quickOpenNavigateNextInRecentFilesPickerId, true), when: recentFilesPickerContext, primary: KeyMod.CtrlCmd | KeyCode.KEY_R, @@ -145,7 +145,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const quickOpenNavigatePreviousInRecentFilesPicker = 'workbench.action.quickOpenNavigatePreviousInRecentFilesPicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigatePreviousInRecentFilesPicker, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, handler: getQuickNavigateHandler(quickOpenNavigatePreviousInRecentFilesPicker, false), when: recentFilesPickerContext, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_R, diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts b/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts index f694743fb2c..8b427a60749 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts @@ -310,7 +310,7 @@ registerEditorCommand(new AccessibilityHelpCommand({ precondition: CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE, handler: x => x.hide(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(100), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 100, kbExpr: EditorContextKeys.focus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] } diff --git a/src/vs/workbench/parts/debug/browser/debugCommands.ts b/src/vs/workbench/parts/debug/browser/debugCommands.ts index bc62db248c5..a02b87a6b3a 100644 --- a/src/vs/workbench/parts/debug/browser/debugCommands.ts +++ b/src/vs/workbench/parts/debug/browser/debugCommands.ts @@ -32,7 +32,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'debug.toggleBreakpoint', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(5), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 5, when: ContextKeyExpr.and(CONTEXT_BREAKPOINTS_FOCUSED, InputFocusedContext.toNegated()), primary: KeyCode.Space, handler: (accessor) => { @@ -72,7 +72,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'debug.renameWatchExpression', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(5), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 5, when: CONTEXT_WATCH_EXPRESSIONS_FOCUSED, primary: KeyCode.F2, mac: { primary: KeyCode.Enter }, @@ -93,7 +93,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'debug.setVariable', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(5), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 5, when: CONTEXT_VARIABLES_FOCUSED, primary: KeyCode.F2, mac: { primary: KeyCode.Enter }, diff --git a/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts b/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts index a9b45955e1f..ad86a3d3d65 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts @@ -130,7 +130,7 @@ const debugCategory = nls.localize('debugCategory', "Debug"); registry.registerWorkbenchAction(new SyncActionDescriptor( StartAction, StartAction.ID, StartAction.LABEL, { primary: KeyCode.F5 }, CONTEXT_NOT_IN_DEBUG_MODE), 'Debug: Start Debugging', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(StepOverAction, StepOverAction.ID, StepOverAction.LABEL, { primary: KeyCode.F10 }, CONTEXT_IN_DEBUG_MODE), 'Debug: Step Over', debugCategory); -registry.registerWorkbenchAction(new SyncActionDescriptor(StepIntoAction, StepIntoAction.ID, StepIntoAction.LABEL, { primary: KeyCode.F11 }, CONTEXT_IN_DEBUG_MODE, KeybindingsRegistry.WEIGHT.workbenchContrib(1)), 'Debug: Step Into', debugCategory); +registry.registerWorkbenchAction(new SyncActionDescriptor(StepIntoAction, StepIntoAction.ID, StepIntoAction.LABEL, { primary: KeyCode.F11 }, CONTEXT_IN_DEBUG_MODE, KeybindingsRegistry.WEIGHT.workbenchContrib() + 1), 'Debug: Step Into', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(StepOutAction, StepOutAction.ID, StepOutAction.LABEL, { primary: KeyMod.Shift | KeyCode.F11 }, CONTEXT_IN_DEBUG_MODE), 'Debug: Step Out', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(RestartAction, RestartAction.ID, RestartAction.LABEL, { primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyCode.F5 }, CONTEXT_IN_DEBUG_MODE), 'Debug: Restart', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(StopAction, StopAction.ID, StopAction.LABEL, { primary: KeyMod.Shift | KeyCode.F5 }, CONTEXT_IN_DEBUG_MODE), 'Debug: Stop', debugCategory); diff --git a/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts b/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts index 36e761a3e9b..b75e68113c3 100644 --- a/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts +++ b/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts @@ -50,7 +50,7 @@ const explorerCommandsWeightBonus = 10; // give our commands a little bit more w const RENAME_ID = 'renameFile'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: RENAME_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(explorerCommandsWeightBonus), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerRootContext.toNegated(), ExplorerResourceNotReadonlyContext), primary: KeyCode.F2, mac: { @@ -62,7 +62,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const MOVE_FILE_TO_TRASH_ID = 'moveFileToTrash'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: MOVE_FILE_TO_TRASH_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(explorerCommandsWeightBonus), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerRootContext.toNegated(), ExplorerResourceNotReadonlyContext), primary: KeyCode.Delete, mac: { @@ -74,7 +74,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const DELETE_FILE_ID = 'deleteFile'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: DELETE_FILE_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(explorerCommandsWeightBonus), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerRootContext.toNegated(), ExplorerResourceNotReadonlyContext), primary: KeyMod.Shift | KeyCode.Delete, mac: { @@ -86,7 +86,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const COPY_FILE_ID = 'filesExplorer.copy'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: COPY_FILE_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(explorerCommandsWeightBonus), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerRootContext.toNegated()), primary: KeyMod.CtrlCmd | KeyCode.KEY_C, handler: copyFileHandler, @@ -96,7 +96,7 @@ const PASTE_FILE_ID = 'filesExplorer.paste'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: PASTE_FILE_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(explorerCommandsWeightBonus), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerResourceNotReadonlyContext), primary: KeyMod.CtrlCmd | KeyCode.KEY_V, handler: pasteFileHandler diff --git a/src/vs/workbench/parts/quickopen/browser/quickopen.contribution.ts b/src/vs/workbench/parts/quickopen/browser/quickopen.contribution.ts index 5b8cb97d750..68d3f6ca8cb 100644 --- a/src/vs/workbench/parts/quickopen/browser/quickopen.contribution.ts +++ b/src/vs/workbench/parts/quickopen/browser/quickopen.contribution.ts @@ -50,7 +50,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenViewPickerAct const quickOpenNavigateNextInViewPickerId = 'workbench.action.quickOpenNavigateNextInViewPicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigateNextInViewPickerId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, handler: getQuickNavigateHandler(quickOpenNavigateNextInViewPickerId, true), when: inViewsPickerContext, primary: viewPickerKeybinding.primary, @@ -61,7 +61,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const quickOpenNavigatePreviousInViewPickerId = 'workbench.action.quickOpenNavigatePreviousInViewPicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigatePreviousInViewPickerId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50), + weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, handler: getQuickNavigateHandler(quickOpenNavigatePreviousInViewPickerId, false), when: inViewsPickerContext, primary: viewPickerKeybinding.primary | KeyMod.Shift, diff --git a/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts b/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts index e11e00143ae..1c4492999f1 100644 --- a/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts +++ b/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts @@ -518,7 +518,7 @@ registerEditorAction(MoveToNextChangeAction); KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'closeDirtyDiff', - weight: KeybindingsRegistry.WEIGHT.editorContrib(50), + weight: KeybindingsRegistry.WEIGHT.editorContrib() + 50, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape], when: ContextKeyExpr.and(isDirtyDiffVisible), diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts index 767a20f3d83..e413f49d051 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts @@ -451,7 +451,7 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ScrollToTopTermi actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ClearTerminalAction, ClearTerminalAction.ID, ClearTerminalAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_K, linux: { primary: null } -}, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KeybindingsRegistry.WEIGHT.workbenchContrib(1)), 'Terminal: Clear', category); +}, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KeybindingsRegistry.WEIGHT.workbenchContrib() + 1), 'Terminal: Clear', category); if (platform.isWindows) { actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(SelectDefaultShellWindowsTerminalAction, SelectDefaultShellWindowsTerminalAction.ID, SelectDefaultShellWindowsTerminalAction.LABEL), 'Terminal: Select Default Shell', category); } diff --git a/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts b/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts index e7f59e3cd19..40ccd3f3c9a 100644 --- a/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts +++ b/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts @@ -485,9 +485,9 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService { let weight: number; if (isBuiltin) { - weight = KeybindingsRegistry.WEIGHT.builtinExtension(idx); + weight = KeybindingsRegistry.WEIGHT.builtinExtension() + idx; } else { - weight = KeybindingsRegistry.WEIGHT.externalExtension(idx); + weight = KeybindingsRegistry.WEIGHT.externalExtension() + idx; } let desc = { From a479a5a41fb2f03e94268ef3de6e99d620ce4a2e Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 24 Jul 2018 18:09:42 +0200 Subject: [PATCH 79/93] Use a const enum for keybindings weights --- .../editor/browser/controller/coreCommands.ts | 4 +- src/vs/editor/browser/widget/diffReview.ts | 6 +-- .../bracketMatching/bracketMatching.ts | 4 +- .../contrib/caretOperations/transpose.ts | 4 +- src/vs/editor/contrib/clipboard/clipboard.ts | 10 ++--- .../contrib/codeAction/codeActionCommands.ts | 8 ++-- src/vs/editor/contrib/comment/comment.ts | 10 ++--- .../editor/contrib/contextmenu/contextmenu.ts | 4 +- .../editor/contrib/cursorUndo/cursorUndo.ts | 4 +- src/vs/editor/contrib/find/findController.ts | 32 +++++++-------- src/vs/editor/contrib/folding/folding.ts | 22 +++++----- src/vs/editor/contrib/format/formatActions.ts | 6 +-- .../goToDefinition/goToDefinitionCommands.ts | 16 ++++---- src/vs/editor/contrib/gotoError/gotoError.ts | 8 ++-- src/vs/editor/contrib/hover/hover.ts | 4 +- .../contrib/inPlaceReplace/inPlaceReplace.ts | 6 +-- .../linesOperations/linesOperations.ts | 28 ++++++------- .../contrib/message/messageController.ts | 4 +- .../editor/contrib/multicursor/multicursor.ts | 16 ++++---- .../contrib/parameterHints/parameterHints.ts | 6 +-- .../referenceSearch/referenceSearch.ts | 18 ++++----- src/vs/editor/contrib/rename/rename.ts | 8 ++-- .../editor/contrib/smartSelect/smartSelect.ts | 6 +-- .../contrib/snippet/snippetController2.ts | 10 ++--- .../contrib/suggest/suggestController.ts | 6 +-- .../toggleTabFocusMode/toggleTabFocusMode.ts | 4 +- .../wordHighlighter/wordHighlighter.ts | 6 +-- .../contrib/wordOperations/wordOperations.ts | 14 +++---- .../wordPartOperations/wordPartOperations.ts | 14 +++---- .../accessibilityHelp/accessibilityHelp.ts | 6 +-- .../standalone/browser/quickOpen/gotoLine.ts | 4 +- .../browser/quickOpen/quickCommand.ts | 4 +- .../browser/quickOpen/quickOutline.ts | 4 +- .../browser/contextScopedHistoryWidget.ts | 6 +-- .../parts/editor/breadcrumbsControl.ts | 16 ++++---- .../parts/editor/editor.contribution.ts | 6 +-- .../browser/parts/editor/editorCommands.ts | 30 +++++++------- .../notifications/notificationsCommands.ts | 22 +++++----- .../quickinput/quickInput.contribution.ts | 4 +- .../browser/parts/quickinput/quickInput.ts | 4 +- .../parts/quickopen/quickopen.contribution.ts | 18 ++++----- src/vs/workbench/common/actions.ts | 4 +- src/vs/workbench/electron-browser/commands.ts | 40 +++++++++---------- .../electron-browser/main.contribution.ts | 6 +-- .../electron-browser/accessibility.ts | 6 +-- .../electron-browser/toggleWordWrap.ts | 4 +- .../commentsEditorContribution.ts | 4 +- .../parts/debug/browser/debugCommands.ts | 22 +++++----- .../parts/debug/browser/debugEditorActions.ts | 6 +-- .../electron-browser/breakpointWidget.ts | 6 +-- .../electron-browser/debug.contribution.ts | 4 +- .../parts/debug/electron-browser/repl.ts | 4 +- .../actions/expandAbbreviation.ts | 4 +- .../execution.contribution.ts | 4 +- .../electron-browser/extensionEditor.ts | 4 +- .../fileActions.contribution.ts | 12 +++--- .../files/electron-browser/fileCommands.ts | 20 +++++----- .../electron-browser/markers.contribution.ts | 6 +-- .../outline/electron-browser/outlinePanel.ts | 6 +-- .../browser/keybindingsEditorContribution.ts | 4 +- .../preferences.contribution.ts | 40 +++++++++---------- .../browser/quickopen.contribution.ts | 6 +-- .../electron-browser/dirtydiffDecorator.ts | 12 +++--- .../parts/search/browser/searchWidget.ts | 4 +- .../electron-browser/search.contribution.ts | 34 ++++++++-------- .../electron-browser/tabCompletion.ts | 4 +- .../electron-browser/task.contribution.ts | 4 +- .../parts/terminal/common/terminalCommands.ts | 4 +- .../electron-browser/terminal.contribution.ts | 4 +- .../electron-browser/webview.contribution.ts | 8 ++-- .../electron-browser/walkThroughActions.ts | 10 ++--- .../electron-browser/keybindingService.ts | 6 +-- 72 files changed, 357 insertions(+), 357 deletions(-) diff --git a/src/vs/editor/browser/controller/coreCommands.ts b/src/vs/editor/browser/controller/coreCommands.ts index 7d864dbe9c4..ea7ad7c7f3e 100644 --- a/src/vs/editor/browser/controller/coreCommands.ts +++ b/src/vs/editor/browser/controller/coreCommands.ts @@ -16,7 +16,7 @@ import { registerEditorCommand, ICommandOptions, EditorCommand, Command } from ' import { IColumnSelectResult, ColumnSelection } from 'vs/editor/common/controller/cursorColumnSelection'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { KeyMod, KeyCode } from 'vs/base/common/keyCodes'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import H = editorCommon.Handler; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; @@ -27,7 +27,7 @@ import { DeleteOperations } from 'vs/editor/common/controller/cursorDeleteOperat import { VerticalRevealType } from 'vs/editor/common/view/viewEvents'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -const CORE_WEIGHT = KeybindingsRegistry.WEIGHT.editorCore(); +const CORE_WEIGHT = KeybindingWeight.EditorCore; export abstract class CoreEditorCommand extends EditorCommand { public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void { diff --git a/src/vs/editor/browser/widget/diffReview.ts b/src/vs/editor/browser/widget/diffReview.ts index 37b7076b07b..fe42bf6cc0d 100644 --- a/src/vs/editor/browser/widget/diffReview.ts +++ b/src/vs/editor/browser/widget/diffReview.ts @@ -30,7 +30,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ITextModel, TextModelResolvedOptions } from 'vs/editor/common/model'; import { ViewLineRenderingData } from 'vs/editor/common/viewModel/viewModel'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; const DIFF_LINES_PADDING = 3; @@ -812,7 +812,7 @@ class DiffReviewNext extends EditorAction { kbOpts: { kbExpr: null, primary: KeyCode.F7, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -835,7 +835,7 @@ class DiffReviewPrev extends EditorAction { kbOpts: { kbExpr: null, primary: KeyMod.Shift | KeyCode.F7, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts index 2071728a38e..5ed915fe01a 100644 --- a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts +++ b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts @@ -22,7 +22,7 @@ import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { registerColor } from 'vs/platform/theme/common/colorRegistry'; import { TrackedRangeStickiness, IModelDeltaDecoration, OverviewRulerLane } from 'vs/editor/common/model'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; const overviewRulerBracketMatchForeground = registerColor('editorOverviewRuler.bracketMatchForeground', { dark: '#A0A0A0', light: '#A0A0A0', hc: '#A0A0A0' }, nls.localize('overviewRulerBracketMatchForeground', 'Overview ruler marker color for matching brackets.')); @@ -36,7 +36,7 @@ class JumpToBracketAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_BACKSLASH, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/caretOperations/transpose.ts b/src/vs/editor/contrib/caretOperations/transpose.ts index 7de35d6f796..ee59ca9c28d 100644 --- a/src/vs/editor/contrib/caretOperations/transpose.ts +++ b/src/vs/editor/contrib/caretOperations/transpose.ts @@ -15,7 +15,7 @@ import { registerEditorAction, EditorAction, ServicesAccessor } from 'vs/editor/ import { ReplaceCommand } from 'vs/editor/common/commands/replaceCommand'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ITextModel } from 'vs/editor/common/model'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; class TransposeLettersAction extends EditorAction { @@ -69,7 +69,7 @@ class TransposeLettersAction extends EditorAction { mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_T }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/clipboard/clipboard.ts b/src/vs/editor/contrib/clipboard/clipboard.ts index 1c1ee451ef6..41fb2a1b086 100644 --- a/src/vs/editor/contrib/clipboard/clipboard.ts +++ b/src/vs/editor/contrib/clipboard/clipboard.ts @@ -16,7 +16,7 @@ import { registerEditorAction, IActionOptions, EditorAction, ICommandKeybindings import { CopyOptions } from 'vs/editor/browser/controller/textAreaInput'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; const CLIPBOARD_CONTEXT_MENU_GROUP = '9_cutcopypaste'; @@ -64,7 +64,7 @@ class ExecCommandCutAction extends ExecCommandAction { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.KEY_X, win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_X, secondary: [KeyMod.Shift | KeyCode.Delete] }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }; // Do not bind cut keybindings in the browser, // since browsers do that for us and it avoids security prompts @@ -102,7 +102,7 @@ class ExecCommandCopyAction extends ExecCommandAction { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.KEY_C, win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_C, secondary: [KeyMod.CtrlCmd | KeyCode.Insert] }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }; // Do not bind copy keybindings in the browser, // since browsers do that for us and it avoids security prompts @@ -141,7 +141,7 @@ class ExecCommandPasteAction extends ExecCommandAction { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.KEY_V, win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_V, secondary: [KeyMod.Shift | KeyCode.Insert] }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }; // Do not bind paste keybindings in the browser, // since browsers do that for us and it avoids security prompts @@ -174,7 +174,7 @@ class ExecCommandCopyWithSyntaxHighlightingAction extends ExecCommandAction { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: null, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/codeAction/codeActionCommands.ts b/src/vs/editor/contrib/codeAction/codeActionCommands.ts index 773c7aa7243..1f229bfbfbc 100644 --- a/src/vs/editor/contrib/codeAction/codeActionCommands.ts +++ b/src/vs/editor/contrib/codeAction/codeActionCommands.ts @@ -26,7 +26,7 @@ import { CodeActionModel, CodeActionsComputeEvent, SUPPORTED_CODE_ACTIONS } from import { CodeActionAutoApply, CodeActionFilter, CodeActionKind } from './codeActionTrigger'; import { CodeActionContextMenu } from './codeActionWidget'; import { LightBulbWidget } from './lightBulbWidget'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; function contextKeyForSupportedActions(kind: CodeActionKind) { return ContextKeyExpr.regex( @@ -194,7 +194,7 @@ export class QuickFixAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyCode.US_DOT, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -275,7 +275,7 @@ export class RefactorAction extends EditorAction { mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_R }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }, menuOpts: { group: '1_modification', @@ -339,7 +339,7 @@ export class OrganizeImportsAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_O, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/comment/comment.ts b/src/vs/editor/contrib/comment/comment.ts index 38cf5fb416c..0011a0a5ff2 100644 --- a/src/vs/editor/contrib/comment/comment.ts +++ b/src/vs/editor/contrib/comment/comment.ts @@ -12,7 +12,7 @@ import { registerEditorAction, IActionOptions, EditorAction, ServicesAccessor } import { BlockCommentCommand } from './blockCommentCommand'; import { LineCommentCommand, Type } from './lineCommentCommand'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; abstract class CommentLineAction extends EditorAction { @@ -54,7 +54,7 @@ class ToggleCommentLineAction extends CommentLineAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyCode.US_SLASH, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -70,7 +70,7 @@ class AddLineCommentAction extends CommentLineAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_C), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -86,7 +86,7 @@ class RemoveLineCommentAction extends CommentLineAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_U), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -104,7 +104,7 @@ class BlockCommentAction extends EditorAction { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/contextmenu/contextmenu.ts b/src/vs/editor/contrib/contextmenu/contextmenu.ts index 9049525c110..75de2e1c6d1 100644 --- a/src/vs/editor/contrib/contextmenu/contextmenu.ts +++ b/src/vs/editor/contrib/contextmenu/contextmenu.ts @@ -20,7 +20,7 @@ import { IEditorContribution, IScrollEvent, ScrollType } from 'vs/editor/common/ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { registerEditorAction, registerEditorContribution, ServicesAccessor, EditorAction } from 'vs/editor/browser/editorExtensions'; import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; export interface IPosition { x: number; @@ -229,7 +229,7 @@ class ShowContextMenu extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.Shift | KeyCode.F10, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/cursorUndo/cursorUndo.ts b/src/vs/editor/contrib/cursorUndo/cursorUndo.ts index f2beb917e44..cd80e4025a1 100644 --- a/src/vs/editor/contrib/cursorUndo/cursorUndo.ts +++ b/src/vs/editor/contrib/cursorUndo/cursorUndo.ts @@ -12,7 +12,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { IEditorContribution, ScrollType } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; class CursorState { readonly selections: Selection[]; @@ -120,7 +120,7 @@ export class CursorUndo extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.KEY_U, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/find/findController.ts b/src/vs/editor/contrib/find/findController.ts index 4f8abad1489..ad70a3bd37f 100644 --- a/src/vs/editor/contrib/find/findController.ts +++ b/src/vs/editor/contrib/find/findController.ts @@ -23,7 +23,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { FindWidget, IFindController } from 'vs/editor/contrib/find/findWidget'; import { FindOptionsWidget } from 'vs/editor/contrib/find/findOptionsWidget'; import { IThemeService } from 'vs/platform/theme/common/themeService'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { optional } from 'vs/platform/instantiation/common/instantiation'; export function getSelectionSearchString(editor: ICodeEditor): string { @@ -387,7 +387,7 @@ export class StartFindAction extends EditorAction { kbOpts: { kbExpr: null, primary: KeyMod.CtrlCmd | KeyCode.KEY_F, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -420,7 +420,7 @@ export class StartFindWithSelectionAction extends EditorAction { mac: { primary: KeyMod.CtrlCmd | KeyCode.KEY_E, }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -470,7 +470,7 @@ export class NextMatchFindAction extends MatchFindAction { kbExpr: EditorContextKeys.focus, primary: KeyCode.F3, mac: { primary: KeyMod.CtrlCmd | KeyCode.KEY_G, secondary: [KeyCode.F3] }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -492,7 +492,7 @@ export class PreviousMatchFindAction extends MatchFindAction { kbExpr: EditorContextKeys.focus, primary: KeyMod.Shift | KeyCode.F3, mac: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_G, secondary: [KeyMod.Shift | KeyCode.F3] }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -538,7 +538,7 @@ export class NextSelectionMatchFindAction extends SelectionMatchFindAction { kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.CtrlCmd | KeyCode.F3, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -559,7 +559,7 @@ export class PreviousSelectionMatchFindAction extends SelectionMatchFindAction { kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F3, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -581,7 +581,7 @@ export class StartFindReplaceAction extends EditorAction { kbExpr: null, primary: KeyMod.CtrlCmd | KeyCode.KEY_H, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_F }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -631,7 +631,7 @@ registerEditorCommand(new FindCommand({ precondition: CONTEXT_FIND_WIDGET_VISIBLE, handler: x => x.closeFindWidget(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, + weight: KeybindingWeight.EditorContrib + 5, kbExpr: EditorContextKeys.focus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] @@ -643,7 +643,7 @@ registerEditorCommand(new FindCommand({ precondition: null, handler: x => x.toggleCaseSensitive(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, + weight: KeybindingWeight.EditorContrib + 5, kbExpr: EditorContextKeys.focus, primary: ToggleCaseSensitiveKeybinding.primary, mac: ToggleCaseSensitiveKeybinding.mac, @@ -657,7 +657,7 @@ registerEditorCommand(new FindCommand({ precondition: null, handler: x => x.toggleWholeWords(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, + weight: KeybindingWeight.EditorContrib + 5, kbExpr: EditorContextKeys.focus, primary: ToggleWholeWordKeybinding.primary, mac: ToggleWholeWordKeybinding.mac, @@ -671,7 +671,7 @@ registerEditorCommand(new FindCommand({ precondition: null, handler: x => x.toggleRegex(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, + weight: KeybindingWeight.EditorContrib + 5, kbExpr: EditorContextKeys.focus, primary: ToggleRegexKeybinding.primary, mac: ToggleRegexKeybinding.mac, @@ -685,7 +685,7 @@ registerEditorCommand(new FindCommand({ precondition: null, handler: x => x.toggleSearchScope(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, + weight: KeybindingWeight.EditorContrib + 5, kbExpr: EditorContextKeys.focus, primary: ToggleSearchScopeKeybinding.primary, mac: ToggleSearchScopeKeybinding.mac, @@ -699,7 +699,7 @@ registerEditorCommand(new FindCommand({ precondition: CONTEXT_FIND_WIDGET_VISIBLE, handler: x => x.replace(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, + weight: KeybindingWeight.EditorContrib + 5, kbExpr: EditorContextKeys.focus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_1 } @@ -710,7 +710,7 @@ registerEditorCommand(new FindCommand({ precondition: CONTEXT_FIND_WIDGET_VISIBLE, handler: x => x.replaceAll(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, + weight: KeybindingWeight.EditorContrib + 5, kbExpr: EditorContextKeys.focus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Enter } @@ -721,7 +721,7 @@ registerEditorCommand(new FindCommand({ precondition: CONTEXT_FIND_WIDGET_VISIBLE, handler: x => x.selectAllMatches(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 5, + weight: KeybindingWeight.EditorContrib + 5, kbExpr: EditorContextKeys.focus, primary: KeyMod.Alt | KeyCode.Enter } diff --git a/src/vs/editor/contrib/folding/folding.ts b/src/vs/editor/contrib/folding/folding.ts index 9aa9bcb6a86..a2a57574264 100644 --- a/src/vs/editor/contrib/folding/folding.ts +++ b/src/vs/editor/contrib/folding/folding.ts @@ -32,7 +32,7 @@ import { FoldingRangeProviderRegistry, FoldingRangeKind } from 'vs/editor/common import { SyntaxRangeProvider, ID_SYNTAX_PROVIDER } from './syntaxRangeProvider'; import { CancellationToken } from 'vs/base/common/cancellation'; import { InitializingRangeProvider, ID_INIT_PROVIDER } from 'vs/editor/contrib/folding/intializingRangeProvider'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; export const ID = 'editor.contrib.folding'; @@ -488,7 +488,7 @@ class UnfoldAction extends FoldingAction { mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_CLOSE_SQUARE_BRACKET }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }, description: { description: 'Unfold the content in the editor', @@ -529,7 +529,7 @@ class UnFoldRecursivelyAction extends FoldingAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -553,7 +553,7 @@ class FoldAction extends FoldingAction { mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_OPEN_SQUARE_BRACKET }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }, description: { description: 'Fold the content in the editor', @@ -594,7 +594,7 @@ class FoldRecursivelyAction extends FoldingAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -616,7 +616,7 @@ class FoldAllBlockCommentsAction extends FoldingAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_SLASH), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -645,7 +645,7 @@ class FoldAllRegionsAction extends FoldingAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_8), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -674,7 +674,7 @@ class UnfoldAllRegionsAction extends FoldingAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_9), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -703,7 +703,7 @@ class FoldAllAction extends FoldingAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_0), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -724,7 +724,7 @@ class UnfoldAllAction extends FoldingAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_J), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -768,7 +768,7 @@ for (let i = 1; i <= 7; i++) { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | (KeyCode.KEY_0 + i)), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }) ); diff --git a/src/vs/editor/contrib/format/formatActions.ts b/src/vs/editor/contrib/format/formatActions.ts index e2db778084a..25dee8a028a 100644 --- a/src/vs/editor/contrib/format/formatActions.ts +++ b/src/vs/editor/contrib/format/formatActions.ts @@ -26,7 +26,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ISingleEditOperation } from 'vs/editor/common/model'; import { INotificationService } from 'vs/platform/notification/common/notification'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; function alertFormattingEdits(edits: ISingleEditOperation[]): void { @@ -312,7 +312,7 @@ export class FormatDocumentAction extends AbstractFormatAction { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_F, // secondary: [KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_D)], linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_I }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }, menuOpts: { when: EditorContextKeys.hasDocumentFormattingProvider, @@ -344,7 +344,7 @@ export class FormatSelectionAction extends AbstractFormatAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_F), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }, menuOpts: { when: ContextKeyExpr.and(EditorContextKeys.hasDocumentSelectionFormattingProvider, EditorContextKeys.hasNonEmptySelection), diff --git a/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts b/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts index 827338a0c38..667e77dbf2d 100644 --- a/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts +++ b/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts @@ -25,7 +25,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ITextModel, IWordAtPosition } from 'vs/editor/common/model'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { createCancelablePromise } from 'vs/base/common/async'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class DefinitionActionConfig { @@ -193,7 +193,7 @@ export class GoToDefinitionAction extends DefinitionAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: goToDeclarationKb, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }, menuOpts: { group: 'navigation', @@ -218,7 +218,7 @@ export class OpenDefinitionToSideAction extends DefinitionAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, goToDeclarationKb), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -238,7 +238,7 @@ export class PeekDefinitionAction extends DefinitionAction { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F12, linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F10 }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }, menuOpts: { group: 'navigation', @@ -279,7 +279,7 @@ export class GoToImplementationAction extends ImplementationAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyCode.F12, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -300,7 +300,7 @@ export class PeekImplementationAction extends ImplementationAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F12, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -337,7 +337,7 @@ export class GoToTypeDefinitionAction extends TypeDefinitionAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: 0, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }, menuOpts: { group: 'navigation', @@ -362,7 +362,7 @@ export class PeekTypeDefinitionAction extends TypeDefinitionAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: 0, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/gotoError/gotoError.ts b/src/vs/editor/contrib/gotoError/gotoError.ts index 341852a5dcb..2ccee5cba7a 100644 --- a/src/vs/editor/contrib/gotoError/gotoError.ts +++ b/src/vs/editor/contrib/gotoError/gotoError.ts @@ -19,7 +19,7 @@ import { registerEditorAction, registerEditorContribution, ServicesAccessor, IAc import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { MarkerNavigationWidget } from './gotoErrorWidget'; import { compare } from 'vs/base/common/strings'; import { binarySearch } from 'vs/base/common/arrays'; @@ -402,7 +402,7 @@ class NextMarkerInFilesAction extends MarkerNavigationAction { kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyCode.F8, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -418,7 +418,7 @@ class PrevMarkerInFilesAction extends MarkerNavigationAction { kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.Shift | KeyCode.F8, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -439,7 +439,7 @@ registerEditorCommand(new MarkerCommand({ precondition: CONTEXT_MARKERS_NAVIGATION_VISIBLE, handler: x => x.closeMarkersNavigation(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 50, + weight: KeybindingWeight.EditorContrib + 50, kbExpr: EditorContextKeys.focus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] diff --git a/src/vs/editor/contrib/hover/hover.ts b/src/vs/editor/contrib/hover/hover.ts index 3ac5dd530f1..cfef3c6c719 100644 --- a/src/vs/editor/contrib/hover/hover.ts +++ b/src/vs/editor/contrib/hover/hover.ts @@ -26,7 +26,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { MarkdownRenderer } from 'vs/editor/contrib/markdown/markdownRenderer'; import { IEmptyContentData } from 'vs/editor/browser/controller/mouseTarget'; import { HoverStartMode } from 'vs/editor/contrib/hover/hoverOperation'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class ModesHoverController implements IEditorContribution { @@ -252,7 +252,7 @@ class ShowHoverAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_I), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts b/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts index 19d7c00d6dd..eba360f0676 100644 --- a/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts +++ b/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts @@ -22,7 +22,7 @@ import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { CancelablePromise, createCancelablePromise, timeout } from 'vs/base/common/async'; import { onUnexpectedError } from 'vs/base/common/errors'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; class InPlaceReplaceController implements IEditorContribution { @@ -144,7 +144,7 @@ class InPlaceReplaceUp extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_COMMA, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -169,7 +169,7 @@ class InPlaceReplaceDown extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_DOT, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/linesOperations/linesOperations.ts b/src/vs/editor/contrib/linesOperations/linesOperations.ts index 8752f7a1abd..4171729014e 100644 --- a/src/vs/editor/contrib/linesOperations/linesOperations.ts +++ b/src/vs/editor/contrib/linesOperations/linesOperations.ts @@ -23,7 +23,7 @@ import { MoveLinesCommand } from './moveLinesCommand'; import { TypeOperations } from 'vs/editor/common/controller/cursorTypeOperations'; import { CoreEditingCommands } from 'vs/editor/browser/controller/coreCommands'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; // copy lines @@ -62,7 +62,7 @@ class CopyLinesUpAction extends AbstractCopyLinesAction { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow, linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -79,7 +79,7 @@ class CopyLinesDownAction extends AbstractCopyLinesAction { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow, linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -123,7 +123,7 @@ class MoveLinesUpAction extends AbstractMoveLinesAction { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.UpArrow, linux: { primary: KeyMod.Alt | KeyCode.UpArrow }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -140,7 +140,7 @@ class MoveLinesDownAction extends AbstractMoveLinesAction { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.DownArrow, linux: { primary: KeyMod.Alt | KeyCode.DownArrow }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -210,7 +210,7 @@ export class TrimTrailingWhitespaceAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_X), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -252,7 +252,7 @@ class DeleteLinesAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_K, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -322,7 +322,7 @@ export class IndentLinesAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -344,7 +344,7 @@ class OutdentLinesAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -364,7 +364,7 @@ export class InsertLineBeforeAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -385,7 +385,7 @@ export class InsertLineAfterAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyCode.Enter, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -446,7 +446,7 @@ export class DeleteAllLeftAction extends AbstractDeleteAllToBoundaryAction { kbExpr: EditorContextKeys.textInputFocus, primary: null, mac: { primary: KeyMod.CtrlCmd | KeyCode.Backspace }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -515,7 +515,7 @@ export class DeleteAllRightAction extends AbstractDeleteAllToBoundaryAction { kbExpr: EditorContextKeys.textInputFocus, primary: null, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_K, secondary: [KeyMod.CtrlCmd | KeyCode.Delete] }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -573,7 +573,7 @@ export class JoinLinesAction extends EditorAction { kbExpr: EditorContextKeys.editorTextFocus, primary: 0, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_J }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/message/messageController.ts b/src/vs/editor/contrib/message/messageController.ts index e25523f00ce..38ace15a614 100644 --- a/src/vs/editor/contrib/message/messageController.ts +++ b/src/vs/editor/contrib/message/messageController.ts @@ -19,7 +19,7 @@ import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/cont import { IPosition } from 'vs/editor/common/core/position'; import { registerThemingParticipant, HIGH_CONTRAST } from 'vs/platform/theme/common/themeService'; import { inputValidationInfoBorder, inputValidationInfoBackground } from 'vs/platform/theme/common/colorRegistry'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class MessageController extends Disposable implements editorCommon.IEditorContribution { @@ -114,7 +114,7 @@ registerEditorCommand(new MessageCommand({ precondition: MessageController.MESSAGE_VISIBLE, handler: c => c.closeMessage(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 30, + weight: KeybindingWeight.EditorContrib + 30, primary: KeyCode.Escape } })); diff --git a/src/vs/editor/contrib/multicursor/multicursor.ts b/src/vs/editor/contrib/multicursor/multicursor.ts index 528f016f635..ed677d9b80f 100644 --- a/src/vs/editor/contrib/multicursor/multicursor.ts +++ b/src/vs/editor/contrib/multicursor/multicursor.ts @@ -25,7 +25,7 @@ import { overviewRulerSelectionHighlightForeground } from 'vs/platform/theme/com import { themeColorFromId } from 'vs/platform/theme/common/themeService'; import { INewFindReplaceState, FindOptionOverride } from 'vs/editor/contrib/find/findState'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class InsertCursorAbove extends EditorAction { @@ -42,7 +42,7 @@ export class InsertCursorAbove extends EditorAction { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.UpArrow, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.UpArrow] }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -81,7 +81,7 @@ export class InsertCursorBelow extends EditorAction { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.DownArrow, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.DownArrow] }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -116,7 +116,7 @@ class InsertCursorAtEndOfEachLineSelected extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_I, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -527,7 +527,7 @@ export class AddSelectionToNextFindMatchAction extends MultiCursorSelectionContr kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.CtrlCmd | KeyCode.KEY_D, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -560,7 +560,7 @@ export class MoveSelectionToNextFindMatchAction extends MultiCursorSelectionCont kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_D), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -593,7 +593,7 @@ export class SelectHighlightsAction extends MultiCursorSelectionControllerAction kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_L, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -612,7 +612,7 @@ export class CompatChangeAll extends MultiCursorSelectionControllerAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyCode.F2, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }, menuOpts: { group: '1_modification', diff --git a/src/vs/editor/contrib/parameterHints/parameterHints.ts b/src/vs/editor/contrib/parameterHints/parameterHints.ts index 48513371b86..6ec4cda8857 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHints.ts +++ b/src/vs/editor/contrib/parameterHints/parameterHints.ts @@ -15,7 +15,7 @@ import { registerEditorAction, registerEditorContribution, ServicesAccessor, Edi import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ParameterHintsWidget } from './parameterHintsWidget'; import { Context } from 'vs/editor/contrib/parameterHints/provideSignatureHelp'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; class ParameterHintsController implements IEditorContribution { @@ -69,7 +69,7 @@ export class TriggerParameterHintsAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Space, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -85,7 +85,7 @@ export class TriggerParameterHintsAction extends EditorAction { registerEditorContribution(ParameterHintsController); registerEditorAction(TriggerParameterHintsAction); -const weight = KeybindingsRegistry.WEIGHT.editorContrib() + 75; +const weight = KeybindingWeight.EditorContrib + 75; const ParameterHintsCommand = EditorCommand.bindToContribution(ParameterHintsController.get); diff --git a/src/vs/editor/contrib/referenceSearch/referenceSearch.ts b/src/vs/editor/contrib/referenceSearch/referenceSearch.ts index 02be279c806..787b9d4760d 100644 --- a/src/vs/editor/contrib/referenceSearch/referenceSearch.ts +++ b/src/vs/editor/contrib/referenceSearch/referenceSearch.ts @@ -8,7 +8,7 @@ import * as nls from 'vs/nls'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { TPromise } from 'vs/base/common/winjs.base'; import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { Position, IPosition } from 'vs/editor/common/core/position'; import * as editorCommon from 'vs/editor/common/editorCommon'; import { registerEditorAction, ServicesAccessor, EditorAction, registerEditorContribution, registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions'; @@ -71,7 +71,7 @@ export class ReferenceAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyCode.F12, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }, menuOpts: { group: 'navigation', @@ -193,7 +193,7 @@ function withController(accessor: ServicesAccessor, fn: (controller: ReferencesC KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'goToNextReference', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, + weight: KeybindingWeight.WorkbenchContrib + 50, primary: KeyCode.F4, when: ctxReferenceSearchVisible, handler(accessor) { @@ -205,7 +205,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'goToNextReferenceFromEmbeddedEditor', - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 50, + weight: KeybindingWeight.EditorContrib + 50, primary: KeyCode.F4, when: PeekContext.inPeekEditor, handler(accessor) { @@ -217,7 +217,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'goToPreviousReference', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, + weight: KeybindingWeight.WorkbenchContrib + 50, primary: KeyMod.Shift | KeyCode.F4, when: ctxReferenceSearchVisible, handler(accessor) { @@ -229,7 +229,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'goToPreviousReferenceFromEmbeddedEditor', - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 50, + weight: KeybindingWeight.EditorContrib + 50, primary: KeyMod.Shift | KeyCode.F4, when: PeekContext.inPeekEditor, handler(accessor) { @@ -241,7 +241,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'closeReferenceSearch', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, + weight: KeybindingWeight.WorkbenchContrib + 50, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape], when: ContextKeyExpr.and(ctxReferenceSearchVisible, ContextKeyExpr.not('config.editor.stablePeek')), @@ -250,7 +250,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'closeReferenceSearchEditor', - weight: KeybindingsRegistry.WEIGHT.editorContrib() - 101, + weight: KeybindingWeight.EditorContrib - 101, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape], when: ContextKeyExpr.and(PeekContext.inPeekEditor, ContextKeyExpr.not('config.editor.stablePeek')), @@ -259,7 +259,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'openReferenceToSide', - weight: KeybindingsRegistry.WEIGHT.editorContrib(), + weight: KeybindingWeight.EditorContrib, primary: KeyMod.CtrlCmd | KeyCode.Enter, mac: { primary: KeyMod.WinCtrl | KeyCode.Enter diff --git a/src/vs/editor/contrib/rename/rename.ts b/src/vs/editor/contrib/rename/rename.ts index 7515504e01c..c5eeedbb0e5 100644 --- a/src/vs/editor/contrib/rename/rename.ts +++ b/src/vs/editor/contrib/rename/rename.ts @@ -25,7 +25,7 @@ import { alert } from 'vs/base/browser/ui/aria/aria'; import { Range } from 'vs/editor/common/core/range'; import { MessageController } from 'vs/editor/contrib/message/messageController'; import { EditorState, CodeEditorStateFlag } from 'vs/editor/browser/core/editorState'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { IBulkEditService } from 'vs/editor/browser/services/bulkEditService'; import URI from 'vs/base/common/uri'; @@ -225,7 +225,7 @@ export class RenameAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyCode.F2, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }, menuOpts: { group: '1_modification', @@ -270,7 +270,7 @@ registerEditorCommand(new RenameCommand({ precondition: CONTEXT_RENAME_INPUT_VISIBLE, handler: x => x.acceptRenameInput(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 99, + weight: KeybindingWeight.EditorContrib + 99, kbExpr: EditorContextKeys.focus, primary: KeyCode.Enter } @@ -281,7 +281,7 @@ registerEditorCommand(new RenameCommand({ precondition: CONTEXT_RENAME_INPUT_VISIBLE, handler: x => x.cancelRenameInput(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 99, + weight: KeybindingWeight.EditorContrib + 99, kbExpr: EditorContextKeys.focus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] diff --git a/src/vs/editor/contrib/smartSelect/smartSelect.ts b/src/vs/editor/contrib/smartSelect/smartSelect.ts index b900d5011b2..76b6057a039 100644 --- a/src/vs/editor/contrib/smartSelect/smartSelect.ts +++ b/src/vs/editor/contrib/smartSelect/smartSelect.ts @@ -16,7 +16,7 @@ import { registerEditorAction, ServicesAccessor, IActionOptions, EditorAction, r import { TokenSelectionSupport, ILogicalSelectionEntry } from './tokenSelectionSupport'; import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; // --- selection state machine @@ -175,7 +175,7 @@ class GrowSelectionAction extends AbstractSmartSelect { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.RightArrow, mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.RightArrow }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -192,7 +192,7 @@ class ShrinkSelectionAction extends AbstractSmartSelect { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.LeftArrow, mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.LeftArrow }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/snippet/snippetController2.ts b/src/vs/editor/contrib/snippet/snippetController2.ts index f24300356ac..9a3a443b47a 100644 --- a/src/vs/editor/contrib/snippet/snippetController2.ts +++ b/src/vs/editor/contrib/snippet/snippetController2.ts @@ -18,7 +18,7 @@ import { Range } from 'vs/editor/common/core/range'; import { Choice } from 'vs/editor/contrib/snippet/snippetParser'; import { repeat } from 'vs/base/common/strings'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { ILogService } from 'vs/platform/log/common/log'; @@ -227,7 +227,7 @@ registerEditorCommand(new CommandCtor({ precondition: ContextKeyExpr.and(SnippetController2.InSnippetMode, SnippetController2.HasNextTabstop), handler: ctrl => ctrl.next(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 30, + weight: KeybindingWeight.EditorContrib + 30, kbExpr: EditorContextKeys.editorTextFocus, primary: KeyCode.Tab } @@ -237,7 +237,7 @@ registerEditorCommand(new CommandCtor({ precondition: ContextKeyExpr.and(SnippetController2.InSnippetMode, SnippetController2.HasPrevTabstop), handler: ctrl => ctrl.prev(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 30, + weight: KeybindingWeight.EditorContrib + 30, kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyCode.Tab } @@ -247,7 +247,7 @@ registerEditorCommand(new CommandCtor({ precondition: SnippetController2.InSnippetMode, handler: ctrl => ctrl.cancel(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 30, + weight: KeybindingWeight.EditorContrib + 30, kbExpr: EditorContextKeys.editorTextFocus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] @@ -259,7 +259,7 @@ registerEditorCommand(new CommandCtor({ precondition: SnippetController2.InSnippetMode, handler: ctrl => ctrl.finish(), // kbOpts: { - // weight: KeybindingsRegistry.WEIGHT.editorContrib() + 30, + // weight: KeybindingWeight.EditorContrib + 30, // kbExpr: EditorContextKeys.textFocus, // primary: KeyCode.Enter, // } diff --git a/src/vs/editor/contrib/suggest/suggestController.ts b/src/vs/editor/contrib/suggest/suggestController.ts index eece4a1f4f2..e281a671244 100644 --- a/src/vs/editor/contrib/suggest/suggestController.ts +++ b/src/vs/editor/contrib/suggest/suggestController.ts @@ -26,7 +26,7 @@ import { Context as SuggestContext } from './suggest'; import { SuggestModel, State } from './suggestModel'; import { ICompletionItem } from './completionModel'; import { SuggestWidget, ISelectedSuggestion } from './suggestWidget'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { SuggestMemories } from 'vs/editor/contrib/suggest/suggestMemory'; class AcceptOnCharacterOracle { @@ -326,7 +326,7 @@ export class TriggerSuggestAction extends EditorAction { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.Space, mac: { primary: KeyMod.WinCtrl | KeyCode.Space }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -345,7 +345,7 @@ export class TriggerSuggestAction extends EditorAction { registerEditorContribution(SuggestController); registerEditorAction(TriggerSuggestAction); -const weight = KeybindingsRegistry.WEIGHT.editorContrib() + 90; +const weight = KeybindingWeight.EditorContrib + 90; const SuggestCommand = EditorCommand.bindToContribution(SuggestController.get); diff --git a/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts b/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts index e71d465233f..87cb996bb1c 100644 --- a/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts +++ b/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts @@ -9,7 +9,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { registerEditorAction, ServicesAccessor, EditorAction } from 'vs/editor/browser/editorExtensions'; import { TabFocus } from 'vs/editor/common/config/commonEditorConfig'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class ToggleTabFocusModeAction extends EditorAction { @@ -25,7 +25,7 @@ export class ToggleTabFocusModeAction extends EditorAction { kbExpr: null, primary: KeyMod.CtrlCmd | KeyCode.KEY_M, mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_M }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts b/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts index be9f60bf3e4..8c852574b12 100644 --- a/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts +++ b/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts @@ -25,7 +25,7 @@ import { firstIndex, isFalsyOrEmpty } from 'vs/base/common/arrays'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ITextModel, TrackedRangeStickiness, OverviewRulerLane, IModelDeltaDecoration } from 'vs/editor/common/model'; import { CancellationToken } from 'vs/base/common/cancellation'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; export const editorWordHighlight = registerColor('editor.wordHighlightBackground', { dark: '#575757B8', light: '#57575740', hc: null }, nls.localize('wordHighlight', 'Background color of a symbol during read-access, like reading a variable. The color must not be opaque to not hide underlying decorations.'), true); export const editorWordHighlightStrong = registerColor('editor.wordHighlightStrongBackground', { dark: '#004972B8', light: '#0e639c40', hc: null }, nls.localize('wordHighlightStrong', 'Background color of a symbol during write-access, like writing to a variable. The color must not be opaque to not hide underlying decorations.'), true); @@ -461,7 +461,7 @@ class NextWordHighlightAction extends WordHighlightNavigationAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyCode.F7, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -477,7 +477,7 @@ class PrevWordHighlightAction extends WordHighlightNavigationAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyCode.F7, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/wordOperations/wordOperations.ts b/src/vs/editor/contrib/wordOperations/wordOperations.ts index 7d94b1a2372..237cc0bde06 100644 --- a/src/vs/editor/contrib/wordOperations/wordOperations.ts +++ b/src/vs/editor/contrib/wordOperations/wordOperations.ts @@ -19,7 +19,7 @@ import { getMapForWordSeparators, WordCharacterClassifier } from 'vs/editor/comm import { CursorState } from 'vs/editor/common/controller/cursorCommon'; import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; export interface MoveWordOptions extends ICommandOptions { inSelectionMode: boolean; @@ -102,7 +102,7 @@ export class CursorWordStartLeft extends WordLeftCommand { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.LeftArrow, mac: { primary: KeyMod.Alt | KeyCode.LeftArrow }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -141,7 +141,7 @@ export class CursorWordStartLeftSelect extends WordLeftCommand { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.LeftArrow, mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -191,7 +191,7 @@ export class CursorWordEndRight extends WordRightCommand { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.RightArrow, mac: { primary: KeyMod.Alt | KeyCode.RightArrow }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -230,7 +230,7 @@ export class CursorWordEndRightSelect extends WordRightCommand { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.RightArrow, mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -336,7 +336,7 @@ export class DeleteWordLeft extends DeleteWordLeftCommand { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.Backspace, mac: { primary: KeyMod.Alt | KeyCode.Backspace }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -375,7 +375,7 @@ export class DeleteWordRight extends DeleteWordRightCommand { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.Delete, mac: { primary: KeyMod.Alt | KeyCode.Delete }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts b/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts index 942747eeb30..229dbedfc18 100644 --- a/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts +++ b/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts @@ -15,7 +15,7 @@ import { WordNavigationType, WordPartOperations } from 'vs/editor/common/control import { WordCharacterClassifier } from 'vs/editor/common/controller/wordCharacterClassifier'; import { DeleteWordCommand, MoveWordCommand } from '../wordOperations/wordOperations'; import { Position } from 'vs/editor/common/core/position'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class DeleteWordPartLeft extends DeleteWordCommand { constructor() { @@ -28,7 +28,7 @@ export class DeleteWordPartLeft extends DeleteWordCommand { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Backspace, mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.Backspace }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -53,7 +53,7 @@ export class DeleteWordPartRight extends DeleteWordCommand { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Delete, mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.Delete }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -85,7 +85,7 @@ export class CursorWordPartLeft extends WordPartLeftCommand { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.LeftArrow, mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.LeftArrow }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -101,7 +101,7 @@ export class CursorWordPartLeftSelect extends WordPartLeftCommand { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow, mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -123,7 +123,7 @@ export class CursorWordPartRight extends WordPartRightCommand { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.RightArrow, mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.RightArrow }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -139,7 +139,7 @@ export class CursorWordPartRightSelect extends WordPartRightCommand { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow, mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts b/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts index 17f30a37ac0..b7b0b203953 100644 --- a/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts +++ b/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts @@ -30,7 +30,7 @@ import URI from 'vs/base/common/uri'; import { Selection } from 'vs/editor/common/core/selection'; import * as browser from 'vs/base/browser/browser'; import { IEditorConstructionOptions } from 'vs/editor/standalone/browser/standaloneCodeEditor'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; const CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE = new RawContextKey('accessibilityHelpWidgetVisible', false); @@ -343,7 +343,7 @@ class ShowAccessibilityHelpAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.focus, primary: (browser.isIE ? KeyMod.CtrlCmd | KeyCode.F1 : KeyMod.Alt | KeyCode.F1), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -367,7 +367,7 @@ registerEditorCommand( precondition: CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE, handler: x => x.hide(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 100, + weight: KeybindingWeight.EditorContrib + 100, kbExpr: EditorContextKeys.focus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] diff --git a/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts b/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts index 680de38a680..28bf35f5a56 100644 --- a/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts +++ b/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts @@ -18,7 +18,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { ITextModel } from 'vs/editor/common/model'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; interface ParseResult { position: Position; @@ -155,7 +155,7 @@ export class GotoLineAction extends BaseEditorQuickOpenAction { kbExpr: EditorContextKeys.focus, primary: KeyMod.CtrlCmd | KeyCode.KEY_G, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_G }, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts b/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts index 1ccd2cb33bc..a43d2325a15 100644 --- a/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts +++ b/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts @@ -18,7 +18,7 @@ import { registerEditorAction, ServicesAccessor } from 'vs/editor/browser/editor import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import * as browser from 'vs/base/browser/browser'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class EditorActionCommandEntry extends QuickOpenEntryGroup { private key: string; @@ -81,7 +81,7 @@ export class QuickCommandAction extends BaseEditorQuickOpenAction { kbOpts: { kbExpr: EditorContextKeys.focus, primary: (browser.isIE ? KeyMod.Alt | KeyCode.F1 : KeyCode.F1), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }, menuOpts: { } diff --git a/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts b/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts index c2ae838ae8d..ebc954e1b47 100644 --- a/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts +++ b/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts @@ -22,7 +22,7 @@ import { registerEditorAction, ServicesAccessor } from 'vs/editor/browser/editor import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Range, IRange } from 'vs/editor/common/core/range'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; let SCOPE_PREFIX = ':'; @@ -122,7 +122,7 @@ export class QuickOutlineAction extends BaseEditorQuickOpenAction { kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_O, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib }, menuOpts: { group: 'navigation', diff --git a/src/vs/platform/widget/browser/contextScopedHistoryWidget.ts b/src/vs/platform/widget/browser/contextScopedHistoryWidget.ts index c98eea4b962..013485d5e42 100644 --- a/src/vs/platform/widget/browser/contextScopedHistoryWidget.ts +++ b/src/vs/platform/widget/browser/contextScopedHistoryWidget.ts @@ -10,7 +10,7 @@ import { FindInput, IFindInputOptions } from 'vs/base/browser/ui/findinput/findI import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview'; import { IContextScopedWidget, getContextScopedWidget, createWidgetScopedContextKeyService, bindContextScopedWidget } from 'vs/platform/widget/common/contextScopedWidget'; import { IHistoryNavigationWidget } from 'vs/base/browser/history'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; export const HistoryNavigationWidgetContext = 'historyNavigationWidget'; @@ -53,7 +53,7 @@ export class ContextScopedFindInput extends FindInput { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'history.showPrevious', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(new ContextKeyDefinedExpr(HistoryNavigationWidgetContext), new ContextKeyEqualsExpr(HistoryNavigationEnablementContext, true)), primary: KeyCode.UpArrow, secondary: [KeyMod.Alt | KeyCode.UpArrow], @@ -65,7 +65,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'history.showNext', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: new ContextKeyAndExpr([new ContextKeyDefinedExpr(HistoryNavigationWidgetContext), new ContextKeyEqualsExpr(HistoryNavigationEnablementContext, true)]), primary: KeyCode.DownArrow, secondary: [KeyMod.Alt | KeyCode.DownArrow], diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts index 3410582874f..14ab5ecc5b8 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts @@ -23,7 +23,7 @@ import { ContextKeyExpr, IContextKey, IContextKeyService, RawContextKey } from ' import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; import { FileKind, IFileService } from 'vs/platform/files/common/files'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen'; import { attachBreadcrumbsStyler } from 'vs/platform/theme/common/styler'; import { IThemeService } from 'vs/platform/theme/common/themeService'; @@ -373,7 +373,7 @@ CommandsRegistry.registerCommand('breadcrumbs.toggle', accessor => { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'breadcrumbs.focus', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_DOT, when: BreadcrumbsControl.CK_BreadcrumbsVisible, handler(accessor) { @@ -385,7 +385,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ }); KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'breadcrumbs.focusNext', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, primary: KeyCode.RightArrow, secondary: [KeyMod.Shift | KeyCode.RightArrow], when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsActive), @@ -397,7 +397,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ }); KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'breadcrumbs.focusPrevious', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, primary: KeyCode.LeftArrow, secondary: [KeyMod.Shift | KeyCode.LeftArrow], when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsActive), @@ -409,7 +409,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ }); KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'breadcrumbs.selectFocused', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, primary: KeyCode.Enter, secondary: [KeyCode.DownArrow], when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsActive), @@ -422,7 +422,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ }); KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'breadcrumbs.revealFocused', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, primary: KeyMod.Shift | KeyCode.Enter, secondary: [KeyCode.Space], when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsActive), @@ -435,7 +435,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ }); KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'breadcrumbs.selectEditor', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape], when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsActive), @@ -449,7 +449,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ }); KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'breadcrumbs.pickFromTree', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, primary: KeyCode.Tab, when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsActive, WorkbenchListFocusContextKey), handler(accessor) { diff --git a/src/vs/workbench/browser/parts/editor/editor.contribution.ts b/src/vs/workbench/browser/parts/editor/editor.contribution.ts index 01445ee9d47..f7865c8bb40 100644 --- a/src/vs/workbench/browser/parts/editor/editor.contribution.ts +++ b/src/vs/workbench/browser/parts/editor/editor.contribution.ts @@ -43,7 +43,7 @@ import { import * as editorCommands from 'vs/workbench/browser/parts/editor/editorCommands'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { getQuickNavigateHandler, inQuickOpenContext } from 'vs/workbench/browser/parts/quickopen/quickopen'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { isMacintosh } from 'vs/base/common/platform'; import { AllEditorsPicker, ActiveEditorGroupPicker } from 'vs/workbench/browser/parts/editor/editorPicker'; @@ -380,7 +380,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPreviousRecentlyUs const quickOpenNavigateNextInEditorPickerId = 'workbench.action.quickOpenNavigateNextInEditorPicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigateNextInEditorPickerId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, + weight: KeybindingWeight.WorkbenchContrib + 50, handler: getQuickNavigateHandler(quickOpenNavigateNextInEditorPickerId, true), when: editorPickerContext, primary: openNextEditorKeybinding.primary, @@ -390,7 +390,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const quickOpenNavigatePreviousInEditorPickerId = 'workbench.action.quickOpenNavigatePreviousInEditorPicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigatePreviousInEditorPickerId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, + weight: KeybindingWeight.WorkbenchContrib + 50, handler: getQuickNavigateHandler(quickOpenNavigatePreviousInEditorPickerId, false), when: editorPickerContext, primary: openPreviousEditorKeybinding.primary, diff --git a/src/vs/workbench/browser/parts/editor/editorCommands.ts b/src/vs/workbench/browser/parts/editor/editorCommands.ts index 97918df94dc..600ece0164f 100644 --- a/src/vs/workbench/browser/parts/editor/editorCommands.ts +++ b/src/vs/workbench/browser/parts/editor/editorCommands.ts @@ -6,7 +6,7 @@ import * as nls from 'vs/nls'; import * as types from 'vs/base/common/types'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { TextCompareEditorVisibleContext, EditorInput, IEditorIdentifier, IEditorCommandsContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, CloseDirection, IEditor, IEditorInput } from 'vs/workbench/common/editor'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; @@ -75,7 +75,7 @@ const isActiveEditorMoveArg = function (arg: ActiveEditorMoveArguments): boolean function registerActiveEditorMoveCommand(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: MOVE_ACTIVE_EDITOR_COMMAND_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: EditorContextKeys.editorTextFocus, primary: null, handler: (accessor, args: any) => moveActiveEditor(args, accessor), @@ -222,7 +222,7 @@ export function mergeAllGroups(editorGroupService: IEditorGroupsService): void { function registerDiffEditorCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'workbench.action.compareEditor.nextChange', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: TextCompareEditorVisibleContext, primary: null, handler: accessor => navigateInDiffEditor(accessor, true) @@ -230,7 +230,7 @@ function registerDiffEditorCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'workbench.action.compareEditor.previousChange', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: TextCompareEditorVisibleContext, primary: null, handler: accessor => navigateInDiffEditor(accessor, false) @@ -247,7 +247,7 @@ function registerDiffEditorCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: TOGGLE_DIFF_INLINE_MODE, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: void 0, primary: void 0, handler: (accessor, resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext) => { @@ -274,7 +274,7 @@ function registerOpenEditorAtIndexCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'workbench.action.openEditorAtIndex' + visibleIndex, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: void 0, primary: KeyMod.Alt | toKeyCode(visibleIndex), mac: { primary: KeyMod.WinCtrl | toKeyCode(visibleIndex) }, @@ -318,7 +318,7 @@ function registerFocusEditorGroupAtIndexCommands(): void { for (let groupIndex = 1; groupIndex < 8; groupIndex++) { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: toCommandId(groupIndex), - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: void 0, primary: KeyMod.CtrlCmd | toKeyCode(groupIndex), handler: accessor => { @@ -422,7 +422,7 @@ function registerCloseEditorCommands() { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: CLOSE_SAVED_EDITORS_COMMAND_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: void 0, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_U), handler: (accessor, resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext) => { @@ -442,7 +442,7 @@ function registerCloseEditorCommands() { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: CLOSE_EDITORS_IN_GROUP_COMMAND_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: void 0, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_W), handler: (accessor, resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext) => { @@ -462,7 +462,7 @@ function registerCloseEditorCommands() { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: CLOSE_EDITOR_COMMAND_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: void 0, primary: KeyMod.CtrlCmd | KeyCode.KEY_W, win: { primary: KeyMod.CtrlCmd | KeyCode.F4, secondary: [KeyMod.CtrlCmd | KeyCode.KEY_W] }, @@ -490,7 +490,7 @@ function registerCloseEditorCommands() { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: CLOSE_EDITOR_GROUP_COMMAND_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext), primary: KeyMod.CtrlCmd | KeyCode.KEY_W, win: { primary: KeyMod.CtrlCmd | KeyCode.F4, secondary: [KeyMod.CtrlCmd | KeyCode.KEY_W] }, @@ -511,7 +511,7 @@ function registerCloseEditorCommands() { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: void 0, primary: void 0, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_T }, @@ -540,7 +540,7 @@ function registerCloseEditorCommands() { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: CLOSE_EDITORS_TO_THE_RIGHT_COMMAND_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: void 0, primary: void 0, handler: (accessor, resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext) => { @@ -557,7 +557,7 @@ function registerCloseEditorCommands() { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: KEEP_EDITOR_COMMAND_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: void 0, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.Enter), handler: (accessor, resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext) => { @@ -574,7 +574,7 @@ function registerCloseEditorCommands() { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: SHOW_EDITORS_IN_GROUP, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: void 0, primary: void 0, handler: (accessor, resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext) => { diff --git a/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts b/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts index 3e13fa59dfd..9519578fe60 100644 --- a/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts +++ b/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts @@ -7,7 +7,7 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { RawContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { INotificationViewItem, isNotificationViewItem } from 'vs/workbench/common/notifications'; import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; @@ -88,7 +88,7 @@ export function registerNotificationCommands(center: INotificationsCenterControl // Hide Notifications Center KeybindingsRegistry.registerCommandAndKeybindingRule({ id: HIDE_NOTIFICATIONS_CENTER, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, + weight: KeybindingWeight.WorkbenchContrib + 50, when: NotificationsCenterVisibleContext, primary: KeyCode.Escape, handler: accessor => center.hide() @@ -106,7 +106,7 @@ export function registerNotificationCommands(center: INotificationsCenterControl // Clear Notification KeybindingsRegistry.registerCommandAndKeybindingRule({ id: CLEAR_NOTIFICATION, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: NotificationFocusedContext, primary: KeyCode.Delete, mac: { @@ -123,7 +123,7 @@ export function registerNotificationCommands(center: INotificationsCenterControl // Expand Notification KeybindingsRegistry.registerCommandAndKeybindingRule({ id: EXPAND_NOTIFICATION, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: NotificationFocusedContext, primary: KeyCode.RightArrow, handler: (accessor, args?: any) => { @@ -137,7 +137,7 @@ export function registerNotificationCommands(center: INotificationsCenterControl // Collapse Notification KeybindingsRegistry.registerCommandAndKeybindingRule({ id: COLLAPSE_NOTIFICATION, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: NotificationFocusedContext, primary: KeyCode.LeftArrow, handler: (accessor, args?: any) => { @@ -151,7 +151,7 @@ export function registerNotificationCommands(center: INotificationsCenterControl // Toggle Notification KeybindingsRegistry.registerCommandAndKeybindingRule({ id: TOGGLE_NOTIFICATION, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: NotificationFocusedContext, primary: KeyCode.Space, secondary: [KeyCode.Enter], @@ -166,7 +166,7 @@ export function registerNotificationCommands(center: INotificationsCenterControl // Hide Toasts KeybindingsRegistry.registerCommandAndKeybindingRule({ id: HIDE_NOTIFICATION_TOAST, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, + weight: KeybindingWeight.WorkbenchContrib + 50, when: NotificationsToastsVisibleContext, primary: KeyCode.Escape, handler: accessor => toasts.hide() @@ -178,7 +178,7 @@ export function registerNotificationCommands(center: INotificationsCenterControl // Focus Next Toast KeybindingsRegistry.registerCommandAndKeybindingRule({ id: FOCUS_NEXT_NOTIFICATION_TOAST, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(NotificationFocusedContext, NotificationsToastsVisibleContext), primary: KeyCode.DownArrow, handler: (accessor) => { @@ -189,7 +189,7 @@ export function registerNotificationCommands(center: INotificationsCenterControl // Focus Previous Toast KeybindingsRegistry.registerCommandAndKeybindingRule({ id: FOCUS_PREVIOUS_NOTIFICATION_TOAST, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(NotificationFocusedContext, NotificationsToastsVisibleContext), primary: KeyCode.UpArrow, handler: (accessor) => { @@ -200,7 +200,7 @@ export function registerNotificationCommands(center: INotificationsCenterControl // Focus First Toast KeybindingsRegistry.registerCommandAndKeybindingRule({ id: FOCUS_FIRST_NOTIFICATION_TOAST, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(NotificationFocusedContext, NotificationsToastsVisibleContext), primary: KeyCode.PageUp, secondary: [KeyCode.Home], @@ -212,7 +212,7 @@ export function registerNotificationCommands(center: INotificationsCenterControl // Focus Last Toast KeybindingsRegistry.registerCommandAndKeybindingRule({ id: FOCUS_LAST_NOTIFICATION_TOAST, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(NotificationFocusedContext, NotificationsToastsVisibleContext), primary: KeyCode.PageDown, secondary: [KeyCode.End], diff --git a/src/vs/workbench/browser/parts/quickinput/quickInput.contribution.ts b/src/vs/workbench/browser/parts/quickinput/quickInput.contribution.ts index 1b4dacb5667..7e5bc7f43a0 100644 --- a/src/vs/workbench/browser/parts/quickinput/quickInput.contribution.ts +++ b/src/vs/workbench/browser/parts/quickinput/quickInput.contribution.ts @@ -5,7 +5,7 @@ 'use strict'; import { QuickPickManyToggle, BackAction } from 'vs/workbench/browser/parts/quickinput/quickInput'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { Registry } from 'vs/platform/registry/common/platform'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; @@ -15,4 +15,4 @@ import { inQuickOpenContext } from 'vs/workbench/browser/parts/quickopen/quickop KeybindingsRegistry.registerCommandAndKeybindingRule(QuickPickManyToggle); const registry = Registry.as(ActionExtensions.WorkbenchActions); -registry.registerWorkbenchAction(new SyncActionDescriptor(BackAction, BackAction.ID, BackAction.LABEL, { primary: null, win: { primary: KeyMod.Alt | KeyCode.LeftArrow }, mac: { primary: KeyMod.WinCtrl | KeyCode.US_MINUS }, linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_MINUS } }, inQuickOpenContext, KeybindingsRegistry.WEIGHT.workbenchContrib() + 50), 'Back'); +registry.registerWorkbenchAction(new SyncActionDescriptor(BackAction, BackAction.ID, BackAction.LABEL, { primary: null, win: { primary: KeyMod.Alt | KeyCode.LeftArrow }, mac: { primary: KeyMod.WinCtrl | KeyCode.US_MINUS }, linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_MINUS } }, inQuickOpenContext, KeybindingWeight.WorkbenchContrib + 50), 'Back'); diff --git a/src/vs/workbench/browser/parts/quickinput/quickInput.ts b/src/vs/workbench/browser/parts/quickinput/quickInput.ts index d5c136bce83..b0b274f92e1 100644 --- a/src/vs/workbench/browser/parts/quickinput/quickInput.ts +++ b/src/vs/workbench/browser/parts/quickinput/quickInput.ts @@ -34,7 +34,7 @@ import { dispose, IDisposable } from 'vs/base/common/lifecycle'; import Severity from 'vs/base/common/severity'; import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService'; import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey'; -import { ICommandAndKeybindingRule, KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { ICommandAndKeybindingRule, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { inQuickOpenContext } from 'vs/workbench/browser/parts/quickopen/quickopen'; import { ActionBar, ActionItem } from 'vs/base/browser/ui/actionbar/actionbar'; import { Action } from 'vs/base/common/actions'; @@ -1206,7 +1206,7 @@ function getIconClass(iconPath: { dark: URI; light?: URI; }) { export const QuickPickManyToggle: ICommandAndKeybindingRule = { id: 'workbench.action.quickPickManyToggle', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: inQuickOpenContext, primary: undefined, handler: accessor => { diff --git a/src/vs/workbench/browser/parts/quickopen/quickopen.contribution.ts b/src/vs/workbench/browser/parts/quickopen/quickopen.contribution.ts index 5a5356cbc9e..95a8a593377 100644 --- a/src/vs/workbench/browser/parts/quickopen/quickopen.contribution.ts +++ b/src/vs/workbench/browser/parts/quickopen/quickopen.contribution.ts @@ -9,14 +9,14 @@ import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen'; import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; import { KeyMod, KeyCode } from 'vs/base/common/keyCodes'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { RemoveFromEditorHistoryAction } from 'vs/workbench/browser/parts/quickopen/quickOpenController'; import { QuickOpenSelectNextAction, QuickOpenSelectPreviousAction, inQuickOpenContext, getQuickNavigateHandler, QuickOpenNavigateNextAction, QuickOpenNavigatePreviousAction, defaultQuickOpenContext, QUICKOPEN_ACTION_ID, QUICKOPEN_ACION_LABEL } from 'vs/workbench/browser/parts/quickopen/quickopen'; import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'workbench.action.closeQuickOpen', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: inQuickOpenContext, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape], handler: accessor => { @@ -29,7 +29,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'workbench.action.acceptSelectedQuickOpenItem', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: inQuickOpenContext, primary: null, handler: accessor => { @@ -42,7 +42,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'workbench.action.focusQuickOpen', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: inQuickOpenContext, primary: null, handler: accessor => { @@ -59,7 +59,7 @@ const globalQuickOpenKeybinding = { primary: KeyMod.CtrlCmd | KeyCode.KEY_P, sec KeybindingsRegistry.registerKeybindingRule({ id: QUICKOPEN_ACTION_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: undefined, primary: globalQuickOpenKeybinding.primary, secondary: globalQuickOpenKeybinding.secondary, @@ -70,8 +70,8 @@ MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: QUICKOPEN_ACTION_ID, title: QUICKOPEN_ACION_LABEL } }); -registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenSelectNextAction, QuickOpenSelectNextAction.ID, QuickOpenSelectNextAction.LABEL, { primary: null, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_N } }, inQuickOpenContext, KeybindingsRegistry.WEIGHT.workbenchContrib() + 50), 'Select Next in Quick Open'); -registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenSelectPreviousAction, QuickOpenSelectPreviousAction.ID, QuickOpenSelectPreviousAction.LABEL, { primary: null, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_P } }, inQuickOpenContext, KeybindingsRegistry.WEIGHT.workbenchContrib() + 50), 'Select Previous in Quick Open'); +registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenSelectNextAction, QuickOpenSelectNextAction.ID, QuickOpenSelectNextAction.LABEL, { primary: null, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_N } }, inQuickOpenContext, KeybindingWeight.WorkbenchContrib + 50), 'Select Next in Quick Open'); +registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenSelectPreviousAction, QuickOpenSelectPreviousAction.ID, QuickOpenSelectPreviousAction.LABEL, { primary: null, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_P } }, inQuickOpenContext, KeybindingWeight.WorkbenchContrib + 50), 'Select Previous in Quick Open'); registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenNavigateNextAction, QuickOpenNavigateNextAction.ID, QuickOpenNavigateNextAction.LABEL), 'Navigate Next in Quick Open'); registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenNavigatePreviousAction, QuickOpenNavigatePreviousAction.ID, QuickOpenNavigatePreviousAction.LABEL), 'Navigate Previous in Quick Open'); registry.registerWorkbenchAction(new SyncActionDescriptor(RemoveFromEditorHistoryAction, RemoveFromEditorHistoryAction.ID, RemoveFromEditorHistoryAction.LABEL), 'Remove From History'); @@ -79,7 +79,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(RemoveFromEditorHistor const quickOpenNavigateNextInFilePickerId = 'workbench.action.quickOpenNavigateNextInFilePicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigateNextInFilePickerId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, + weight: KeybindingWeight.WorkbenchContrib + 50, handler: getQuickNavigateHandler(quickOpenNavigateNextInFilePickerId, true), when: defaultQuickOpenContext, primary: globalQuickOpenKeybinding.primary, @@ -90,7 +90,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const quickOpenNavigatePreviousInFilePickerId = 'workbench.action.quickOpenNavigatePreviousInFilePicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigatePreviousInFilePickerId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, + weight: KeybindingWeight.WorkbenchContrib + 50, handler: getQuickNavigateHandler(quickOpenNavigatePreviousInFilePickerId, false), when: defaultQuickOpenContext, primary: globalQuickOpenKeybinding.primary | KeyMod.Shift, diff --git a/src/vs/workbench/common/actions.ts b/src/vs/workbench/common/actions.ts index a2533c808d4..c8bd1928dfd 100644 --- a/src/vs/workbench/common/actions.ts +++ b/src/vs/workbench/common/actions.ts @@ -6,7 +6,7 @@ import { TPromise } from 'vs/base/common/winjs.base'; import { Registry } from 'vs/platform/registry/common/platform'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { ICommandHandler, CommandsRegistry } from 'vs/platform/commands/common/commands'; import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; @@ -41,7 +41,7 @@ Registry.add(Extensions.WorkbenchActions, new class implements IWorkbenchActionR // keybinding const when = descriptor.keybindingContext; - const weight = (typeof descriptor.keybindingWeight === 'undefined' ? KeybindingsRegistry.WEIGHT.workbenchContrib() : descriptor.keybindingWeight); + const weight = (typeof descriptor.keybindingWeight === 'undefined' ? KeybindingWeight.WorkbenchContrib : descriptor.keybindingWeight); const keybindings = descriptor.keybindings; KeybindingsRegistry.registerKeybindingRule({ id: descriptor.id, diff --git a/src/vs/workbench/electron-browser/commands.ts b/src/vs/workbench/electron-browser/commands.ts index d3a2aaac3f2..3853ebdfab4 100644 --- a/src/vs/workbench/electron-browser/commands.ts +++ b/src/vs/workbench/electron-browser/commands.ts @@ -7,7 +7,7 @@ import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IPartService } from 'vs/workbench/services/part/common/partService'; import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows'; import { List } from 'vs/base/browser/ui/list/listWidget'; @@ -65,7 +65,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.focusDown', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: WorkbenchListFocusContextKey, primary: KeyCode.DownArrow, mac: { @@ -106,7 +106,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.expandSelectionDown', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(WorkbenchListFocusContextKey, WorkbenchListSupportsMultiSelectContextKey), primary: KeyMod.Shift | KeyCode.DownArrow, handler: (accessor, arg2) => { @@ -167,7 +167,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.focusUp', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: WorkbenchListFocusContextKey, primary: KeyCode.UpArrow, mac: { @@ -179,7 +179,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.expandSelectionUp', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(WorkbenchListFocusContextKey, WorkbenchListSupportsMultiSelectContextKey), primary: KeyMod.Shift | KeyCode.UpArrow, handler: (accessor, arg2) => { @@ -213,7 +213,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.collapse', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: WorkbenchListFocusContextKey, primary: KeyCode.LeftArrow, mac: { @@ -243,7 +243,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.expand', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: WorkbenchListFocusContextKey, primary: KeyCode.RightArrow, handler: (accessor) => { @@ -269,7 +269,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.focusPageUp', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: WorkbenchListFocusContextKey, primary: KeyCode.PageUp, handler: (accessor) => { @@ -298,7 +298,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.focusPageDown', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: WorkbenchListFocusContextKey, primary: KeyCode.PageDown, handler: (accessor) => { @@ -327,7 +327,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.focusFirst', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: WorkbenchListFocusContextKey, primary: KeyCode.Home, handler: accessor => listFocusFirst(accessor) @@ -335,7 +335,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.focusFirstChild', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: WorkbenchListFocusContextKey, primary: null, handler: accessor => listFocusFirst(accessor, { fromFocused: true }) @@ -366,7 +366,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.focusLast', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: WorkbenchListFocusContextKey, primary: KeyCode.End, handler: accessor => listFocusLast(accessor) @@ -374,7 +374,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.focusLastChild', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: WorkbenchListFocusContextKey, primary: null, handler: accessor => listFocusLast(accessor, { fromFocused: true }) @@ -405,7 +405,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.select', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: WorkbenchListFocusContextKey, primary: KeyCode.Enter, mac: { @@ -436,7 +436,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.selectAll', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(WorkbenchListFocusContextKey, WorkbenchListSupportsMultiSelectContextKey), primary: KeyMod.CtrlCmd | KeyCode.KEY_A, handler: (accessor) => { @@ -452,7 +452,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.toggleExpand', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: WorkbenchListFocusContextKey, primary: KeyCode.Space, handler: (accessor) => { @@ -472,7 +472,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.clear', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(WorkbenchListFocusContextKey, WorkbenchListHasSelectionOrFocus), primary: KeyCode.Escape, handler: (accessor) => { @@ -518,7 +518,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'workbench.action.closeWindow', // close the window when the last editor is closed by reusing the same keybinding - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(NoEditorsVisibleContext, SingleEditorGroupsContext), primary: KeyMod.CtrlCmd | KeyCode.KEY_W, handler: accessor => { @@ -529,7 +529,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'workbench.action.exitZenMode', - weight: KeybindingsRegistry.WEIGHT.editorContrib() - 1000, + weight: KeybindingWeight.EditorContrib - 1000, handler(accessor: ServicesAccessor, configurationOrName: any) { const partService = accessor.get(IPartService); partService.toggleZenMode(); @@ -540,7 +540,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: QUIT_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, handler(accessor: ServicesAccessor) { const windowsService = accessor.get(IWindowsService); windowsService.quit(); diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index 95f9916597e..e408207987d 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -19,7 +19,7 @@ import { registerCommands, QUIT_ID } from 'vs/workbench/electron-browser/command import { AddRootFolderAction, GlobalRemoveRootFolderAction, OpenWorkspaceAction, SaveWorkspaceAsAction, OpenWorkspaceConfigFileAction, DuplicateWorkspaceInNewWindowAction, OpenFileFolderAction, OpenFileAction, OpenFolderAction } from 'vs/workbench/browser/actions/workspaceActions'; import { ContextKeyExpr, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { inQuickOpenContext, getQuickNavigateHandler } from 'vs/workbench/browser/parts/quickopen/quickopen'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; @@ -135,7 +135,7 @@ const recentFilesPickerContext = ContextKeyExpr.and(inQuickOpenContext, ContextK const quickOpenNavigateNextInRecentFilesPickerId = 'workbench.action.quickOpenNavigateNextInRecentFilesPicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigateNextInRecentFilesPickerId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, + weight: KeybindingWeight.WorkbenchContrib + 50, handler: getQuickNavigateHandler(quickOpenNavigateNextInRecentFilesPickerId, true), when: recentFilesPickerContext, primary: KeyMod.CtrlCmd | KeyCode.KEY_R, @@ -145,7 +145,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const quickOpenNavigatePreviousInRecentFilesPicker = 'workbench.action.quickOpenNavigatePreviousInRecentFilesPicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigatePreviousInRecentFilesPicker, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, + weight: KeybindingWeight.WorkbenchContrib + 50, handler: getQuickNavigateHandler(quickOpenNavigatePreviousInRecentFilesPicker, false), when: recentFilesPickerContext, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_R, diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts b/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts index 8b427a60749..c7242e8ecdc 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts @@ -30,7 +30,7 @@ import * as platform from 'vs/base/common/platform'; import { alert } from 'vs/base/browser/ui/aria/aria'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import URI from 'vs/base/common/uri'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; const CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE = new RawContextKey('accessibilityHelpWidgetVisible', false); @@ -287,7 +287,7 @@ class ShowAccessibilityHelpAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.Alt | KeyCode.F1, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -310,7 +310,7 @@ registerEditorCommand(new AccessibilityHelpCommand({ precondition: CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE, handler: x => x.hide(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 100, + weight: KeybindingWeight.EditorContrib + 100, kbExpr: EditorContextKeys.focus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] } diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts b/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts index b81dea044c7..947ec9d0f42 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts @@ -18,7 +18,7 @@ import { InternalEditorOptions, EDITOR_DEFAULTS } from 'vs/editor/common/config/ import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { INotificationService } from 'vs/platform/notification/common/notification'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; const transientWordWrapState = 'transientWordWrapState'; const isWordWrapMinifiedKey = 'isWordWrapMinified'; @@ -143,7 +143,7 @@ class ToggleWordWrapAction extends EditorAction { kbOpts: { kbExpr: null, primary: KeyMod.Alt | KeyCode.KEY_Z, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/workbench/parts/comments/electron-browser/commentsEditorContribution.ts b/src/vs/workbench/parts/comments/electron-browser/commentsEditorContribution.ts index 1c35b032439..619170cb23a 100644 --- a/src/vs/workbench/parts/comments/electron-browser/commentsEditorContribution.ts +++ b/src/vs/workbench/parts/comments/electron-browser/commentsEditorContribution.ts @@ -19,7 +19,7 @@ import * as modes from 'vs/editor/common/modes'; import { peekViewEditorBackground, peekViewResultsBackground, peekViewResultsSelectionBackground } from 'vs/editor/contrib/referenceSearch/referencesWidget'; import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { editorForeground } from 'vs/platform/theme/common/colorRegistry'; import { IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; @@ -447,7 +447,7 @@ registerEditorAction(NextCommentThreadAction); KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'closeReviewPanel', - weight: KeybindingsRegistry.WEIGHT.editorContrib(), + weight: KeybindingWeight.EditorContrib, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape], when: ctxReviewPanelVisible, diff --git a/src/vs/workbench/parts/debug/browser/debugCommands.ts b/src/vs/workbench/parts/debug/browser/debugCommands.ts index a02b87a6b3a..7c09e489c3a 100644 --- a/src/vs/workbench/parts/debug/browser/debugCommands.ts +++ b/src/vs/workbench/parts/debug/browser/debugCommands.ts @@ -8,7 +8,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { TPromise } from 'vs/base/common/winjs.base'; import { List } from 'vs/base/browser/ui/list/listWidget'; import * as errors from 'vs/base/common/errors'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IListService } from 'vs/platform/list/browser/listService'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IDebugService, IEnablement, CONTEXT_BREAKPOINTS_FOCUSED, CONTEXT_WATCH_EXPRESSIONS_FOCUSED, CONTEXT_VARIABLES_FOCUSED, EDITOR_CONTRIBUTION_ID, IDebugEditorContribution, CONTEXT_IN_DEBUG_MODE, CONTEXT_EXPRESSION_SELECTED, CONTEXT_BREAKPOINT_SELECTED } from 'vs/workbench/parts/debug/common/debug'; @@ -32,7 +32,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'debug.toggleBreakpoint', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 5, + weight: KeybindingWeight.WorkbenchContrib + 5, when: ContextKeyExpr.and(CONTEXT_BREAKPOINTS_FOCUSED, InputFocusedContext.toNegated()), primary: KeyCode.Space, handler: (accessor) => { @@ -50,7 +50,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'debug.enableOrDisableBreakpoint', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, primary: undefined, when: EditorContextKeys.editorTextFocus, handler: (accessor) => { @@ -72,7 +72,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'debug.renameWatchExpression', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 5, + weight: KeybindingWeight.WorkbenchContrib + 5, when: CONTEXT_WATCH_EXPRESSIONS_FOCUSED, primary: KeyCode.F2, mac: { primary: KeyCode.Enter }, @@ -93,7 +93,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'debug.setVariable', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 5, + weight: KeybindingWeight.WorkbenchContrib + 5, when: CONTEXT_VARIABLES_FOCUSED, primary: KeyCode.F2, mac: { primary: KeyCode.Enter }, @@ -114,7 +114,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'debug.removeWatchExpression', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(CONTEXT_WATCH_EXPRESSIONS_FOCUSED, CONTEXT_EXPRESSION_SELECTED.toNegated()), primary: KeyCode.Delete, mac: { primary: KeyMod.CtrlCmd | KeyCode.Backspace }, @@ -135,7 +135,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'debug.removeBreakpoint', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(CONTEXT_BREAKPOINTS_FOCUSED, CONTEXT_BREAKPOINT_SELECTED.toNegated()), primary: KeyCode.Delete, mac: { primary: KeyMod.CtrlCmd | KeyCode.Backspace }, @@ -159,7 +159,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'debug.installAdditionalDebuggers', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: undefined, primary: undefined, handler: (accessor) => { @@ -175,7 +175,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: ADD_CONFIGURATION_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: undefined, primary: undefined, handler: (accessor, launchUri: string) => { @@ -220,7 +220,7 @@ export function registerCommands(): void { return TPromise.as(null); }; KeybindingsRegistry.registerCommandAndKeybindingRule({ - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, primary: KeyMod.Shift | KeyCode.F9, when: EditorContextKeys.editorTextFocus, id: TOGGLE_INLINE_BREAKPOINT_ID, @@ -246,7 +246,7 @@ export function registerCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'debug.openBreakpointToSide', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: CONTEXT_BREAKPOINTS_FOCUSED, primary: KeyMod.CtrlCmd | KeyCode.Enter, secondary: [KeyMod.Alt | KeyCode.Enter], diff --git a/src/vs/workbench/parts/debug/browser/debugEditorActions.ts b/src/vs/workbench/parts/debug/browser/debugEditorActions.ts index a8224ca4ce8..d6332e2f2ca 100644 --- a/src/vs/workbench/parts/debug/browser/debugEditorActions.ts +++ b/src/vs/workbench/parts/debug/browser/debugEditorActions.ts @@ -16,7 +16,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { openBreakpointSource } from 'vs/workbench/parts/debug/browser/breakpointsView'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; export const TOGGLE_BREAKPOINT_ID = 'editor.debug.action.toggleBreakpoint'; class ToggleBreakpointAction extends EditorAction { @@ -29,7 +29,7 @@ class ToggleBreakpointAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyCode.F9, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -200,7 +200,7 @@ class ShowDebugHoverAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_I), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/workbench/parts/debug/electron-browser/breakpointWidget.ts b/src/vs/workbench/parts/debug/electron-browser/breakpointWidget.ts index 7e2a5443ce8..c3f164601c0 100644 --- a/src/vs/workbench/parts/debug/electron-browser/breakpointWidget.ts +++ b/src/vs/workbench/parts/debug/electron-browser/breakpointWidget.ts @@ -33,7 +33,7 @@ import { transparent, editorForeground } from 'vs/platform/theme/common/colorReg import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { IDecorationOptions } from 'vs/editor/common/editorCommon'; import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; const $ = dom.$; const IPrivateBreakpointWidgetService = createDecorator('privateBreakopintWidgetService'); @@ -298,7 +298,7 @@ class AcceptBreakpointWidgetInputAction extends EditorCommand { kbOpts: { kbExpr: CONTEXT_IN_BREAKPOINT_WIDGET, primary: KeyCode.Enter, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } @@ -318,7 +318,7 @@ class CloseBreakpointWidgetCommand extends EditorCommand { kbExpr: EditorContextKeys.textInputFocus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape], - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts b/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts index ad86a3d3d65..816bea9c85c 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts @@ -10,7 +10,7 @@ import { KeyMod, KeyCode } from 'vs/base/common/keyCodes'; import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; import { Registry } from 'vs/platform/registry/common/platform'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { KeybindingsRegistry, IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight, IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry'; import { IWorkbenchActionRegistry, Extensions as WorkbenchActionRegistryExtensions } from 'vs/workbench/common/actions'; import { ToggleViewletAction, Extensions as ViewletExtensions, ViewletRegistry, ViewletDescriptor } from 'vs/workbench/browser/viewlet'; @@ -130,7 +130,7 @@ const debugCategory = nls.localize('debugCategory', "Debug"); registry.registerWorkbenchAction(new SyncActionDescriptor( StartAction, StartAction.ID, StartAction.LABEL, { primary: KeyCode.F5 }, CONTEXT_NOT_IN_DEBUG_MODE), 'Debug: Start Debugging', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(StepOverAction, StepOverAction.ID, StepOverAction.LABEL, { primary: KeyCode.F10 }, CONTEXT_IN_DEBUG_MODE), 'Debug: Step Over', debugCategory); -registry.registerWorkbenchAction(new SyncActionDescriptor(StepIntoAction, StepIntoAction.ID, StepIntoAction.LABEL, { primary: KeyCode.F11 }, CONTEXT_IN_DEBUG_MODE, KeybindingsRegistry.WEIGHT.workbenchContrib() + 1), 'Debug: Step Into', debugCategory); +registry.registerWorkbenchAction(new SyncActionDescriptor(StepIntoAction, StepIntoAction.ID, StepIntoAction.LABEL, { primary: KeyCode.F11 }, CONTEXT_IN_DEBUG_MODE, KeybindingWeight.WorkbenchContrib + 1), 'Debug: Step Into', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(StepOutAction, StepOutAction.ID, StepOutAction.LABEL, { primary: KeyMod.Shift | KeyCode.F11 }, CONTEXT_IN_DEBUG_MODE), 'Debug: Step Out', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(RestartAction, RestartAction.ID, RestartAction.LABEL, { primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyCode.F5 }, CONTEXT_IN_DEBUG_MODE), 'Debug: Restart', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(StopAction, StopAction.ID, StopAction.LABEL, { primary: KeyMod.Shift | KeyCode.F5 }, CONTEXT_IN_DEBUG_MODE), 'Debug: Stop', debugCategory); diff --git a/src/vs/workbench/parts/debug/electron-browser/repl.ts b/src/vs/workbench/parts/debug/electron-browser/repl.ts index 6d38eab3e4d..10bbf3327fa 100644 --- a/src/vs/workbench/parts/debug/electron-browser/repl.ts +++ b/src/vs/workbench/parts/debug/electron-browser/repl.ts @@ -47,7 +47,7 @@ import { IDebugService, REPL_ID, DEBUG_SCHEME, CONTEXT_IN_DEBUG_REPL } from 'vs/ import { HistoryNavigator } from 'vs/base/common/history'; import { IHistoryNavigationWidget } from 'vs/base/browser/history'; import { createAndBindHistoryNavigationWidgetScopedContextKeyService } from 'vs/platform/widget/browser/contextScopedHistoryWidget'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; const $ = dom.$; @@ -317,7 +317,7 @@ class AcceptReplInputAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyCode.Enter, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts b/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts index 4532d781d2f..c7896631af6 100644 --- a/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts +++ b/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts @@ -10,7 +10,7 @@ import { registerEditorAction } from 'vs/editor/browser/editorExtensions'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { KeyCode } from 'vs/base/common/keyCodes'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; class ExpandAbbreviationAction extends EmmetEditorAction { @@ -28,7 +28,7 @@ class ExpandAbbreviationAction extends EmmetEditorAction { EditorContextKeys.tabDoesNotMoveFocus, ContextKeyExpr.has('config.emmet.triggerExpansionOnTab') ), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); diff --git a/src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts b/src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts index c7b217c4413..8687e81f62d 100644 --- a/src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts +++ b/src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts @@ -20,7 +20,7 @@ import { getDefaultTerminalWindows, getDefaultTerminalLinuxReady, DEFAULT_TERMIN import { WinTerminalService, MacTerminalService, LinuxTerminalService } from 'vs/workbench/parts/execution/electron-browser/terminalService'; import { IHistoryService } from 'vs/workbench/services/history/common/history'; import { ResourceContextKey } from 'vs/workbench/common/resources'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IFileService } from 'vs/platform/files/common/files'; import { IListService } from 'vs/platform/list/browser/listService'; import { getMultiSelectedResources } from 'vs/workbench/parts/files/browser/files'; @@ -113,7 +113,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: OPEN_NATIVE_CONSOLE_COMMAND_ID, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_C, when: KEYBINDING_CONTEXT_TERMINAL_NOT_FOCUSED, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, handler: (accessor) => { const historyService = accessor.get(IHistoryService); const terminalService = accessor.get(ITerminalService); diff --git a/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts b/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts index 632412c5313..4f850fe16ea 100644 --- a/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts +++ b/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts @@ -43,7 +43,7 @@ import { KeybindingLabel } from 'vs/base/browser/ui/keybindingLabel/keybindingLa import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { Command } from 'vs/editor/browser/editorExtensions'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { Color } from 'vs/base/common/color'; import { assign } from 'vs/base/common/objects'; import { INotificationService } from 'vs/platform/notification/common/notification'; @@ -1122,7 +1122,7 @@ const showCommand = new ShowExtensionEditorFindCommand({ precondition: KEYBINDING_CONTEXT_EXTENSIONEDITOR_WEBVIEW_FOCUS, kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.KEY_F, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); showCommand.register(); diff --git a/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts b/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts index b75e68113c3..dbca8fb34ef 100644 --- a/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts +++ b/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts @@ -14,7 +14,7 @@ import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes'; import { openWindowCommand, REVEAL_IN_OS_COMMAND_ID, COPY_PATH_COMMAND_ID, REVEAL_IN_EXPLORER_COMMAND_ID, OPEN_TO_SIDE_COMMAND_ID, REVERT_FILE_COMMAND_ID, SAVE_FILE_COMMAND_ID, SAVE_FILE_LABEL, SAVE_FILE_AS_COMMAND_ID, SAVE_FILE_AS_LABEL, SAVE_ALL_IN_GROUP_COMMAND_ID, OpenEditorsGroupContext, COMPARE_WITH_SAVED_COMMAND_ID, COMPARE_RESOURCE_COMMAND_ID, SELECT_FOR_COMPARE_COMMAND_ID, ResourceSelectedForCompareContext, REVEAL_IN_OS_LABEL, DirtyEditorContext, COMPARE_SELECTED_COMMAND_ID, REMOVE_ROOT_FOLDER_COMMAND_ID, REMOVE_ROOT_FOLDER_LABEL, SAVE_FILES_COMMAND_ID, COPY_RELATIVE_PATH_COMMAND_ID } from 'vs/workbench/parts/files/electron-browser/fileCommands'; import { CommandsRegistry, ICommandHandler } from 'vs/platform/commands/common/commands'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { isWindows, isMacintosh } from 'vs/base/common/platform'; import { FilesExplorerFocusCondition, ExplorerRootContext, ExplorerFolderContext, ExplorerResourceNotReadonlyContext } from 'vs/workbench/parts/files/common/files'; import { ADD_ROOT_FOLDER_COMMAND_ID, ADD_ROOT_FOLDER_LABEL } from 'vs/workbench/browser/actions/workspaceCommands'; @@ -50,7 +50,7 @@ const explorerCommandsWeightBonus = 10; // give our commands a little bit more w const RENAME_ID = 'renameFile'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: RENAME_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + explorerCommandsWeightBonus, + weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerRootContext.toNegated(), ExplorerResourceNotReadonlyContext), primary: KeyCode.F2, mac: { @@ -62,7 +62,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const MOVE_FILE_TO_TRASH_ID = 'moveFileToTrash'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: MOVE_FILE_TO_TRASH_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + explorerCommandsWeightBonus, + weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerRootContext.toNegated(), ExplorerResourceNotReadonlyContext), primary: KeyCode.Delete, mac: { @@ -74,7 +74,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const DELETE_FILE_ID = 'deleteFile'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: DELETE_FILE_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + explorerCommandsWeightBonus, + weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerRootContext.toNegated(), ExplorerResourceNotReadonlyContext), primary: KeyMod.Shift | KeyCode.Delete, mac: { @@ -86,7 +86,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const COPY_FILE_ID = 'filesExplorer.copy'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: COPY_FILE_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + explorerCommandsWeightBonus, + weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerRootContext.toNegated()), primary: KeyMod.CtrlCmd | KeyCode.KEY_C, handler: copyFileHandler, @@ -96,7 +96,7 @@ const PASTE_FILE_ID = 'filesExplorer.paste'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: PASTE_FILE_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + explorerCommandsWeightBonus, + weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus, when: ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerResourceNotReadonlyContext), primary: KeyMod.CtrlCmd | KeyCode.KEY_V, handler: pasteFileHandler diff --git a/src/vs/workbench/parts/files/electron-browser/fileCommands.ts b/src/vs/workbench/parts/files/electron-browser/fileCommands.ts index 1bbf1bcaec2..5be4ed15f03 100644 --- a/src/vs/workbench/parts/files/electron-browser/fileCommands.ts +++ b/src/vs/workbench/parts/files/electron-browser/fileCommands.ts @@ -29,7 +29,7 @@ import { IFileService } from 'vs/platform/files/common/files'; import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService'; import { IEditorViewState } from 'vs/editor/common/editorCommon'; import { getCodeEditor } from 'vs/editor/browser/editorBrowser'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeyMod, KeyCode, KeyChord } from 'vs/base/common/keyCodes'; import { isWindows, isMacintosh, isLinux } from 'vs/base/common/platform'; import { ITextModelService } from 'vs/editor/common/services/resolverService'; @@ -234,7 +234,7 @@ CommandsRegistry.registerCommand({ }); KeybindingsRegistry.registerCommandAndKeybindingRule({ - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ExplorerFocusCondition, primary: KeyMod.CtrlCmd | KeyCode.Enter, mac: { @@ -272,7 +272,7 @@ let provider: FileOnDiskContentProvider; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: COMPARE_WITH_SAVED_COMMAND_ID, when: undefined, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_D), handler: (accessor, resource: URI | object) => { if (!provider) { @@ -365,7 +365,7 @@ function revealResourcesInOS(resources: URI[], windowsService: IWindowsService, KeybindingsRegistry.registerCommandAndKeybindingRule({ id: REVEAL_IN_OS_COMMAND_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: EditorContextKeys.focus.toNegated(), primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_R, win: { @@ -378,7 +378,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ }); KeybindingsRegistry.registerCommandAndKeybindingRule({ - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: undefined, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_R), id: 'workbench.action.files.revealActiveFileInWindows', @@ -419,7 +419,7 @@ function resourcesToClipboard(resources: URI[], clipboardService: IClipboardServ } KeybindingsRegistry.registerCommandAndKeybindingRule({ - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: EditorContextKeys.focus.toNegated(), primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_C, win: { @@ -433,7 +433,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ }); KeybindingsRegistry.registerCommandAndKeybindingRule({ - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: EditorContextKeys.focus.toNegated(), primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_C, win: { @@ -447,7 +447,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ }); KeybindingsRegistry.registerCommandAndKeybindingRule({ - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: undefined, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_P), id: 'workbench.action.files.copyPathOfActiveFile', @@ -486,7 +486,7 @@ CommandsRegistry.registerCommand({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: SAVE_FILE_AS_COMMAND_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: undefined, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_S, handler: (accessor, resourceOrObject: URI | object | { from: string }) => { @@ -504,7 +504,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ when: undefined, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, primary: KeyMod.CtrlCmd | KeyCode.KEY_S, id: SAVE_FILE_COMMAND_ID, handler: (accessor, resource: URI | object) => { diff --git a/src/vs/workbench/parts/markers/electron-browser/markers.contribution.ts b/src/vs/workbench/parts/markers/electron-browser/markers.contribution.ts index b9ba41a1e7a..8ed5e8f4b35 100644 --- a/src/vs/workbench/parts/markers/electron-browser/markers.contribution.ts +++ b/src/vs/workbench/parts/markers/electron-browser/markers.contribution.ts @@ -10,7 +10,7 @@ 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, IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight, IKeybindings } 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/parts/markers/electron-browser/markersModel'; @@ -27,7 +27,7 @@ import './markersFileDecorations'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: Constants.MARKER_OPEN_SIDE_ACTION_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.MarkerFocusContextKey), primary: KeyMod.CtrlCmd | KeyCode.Enter, mac: { @@ -41,7 +41,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: Constants.MARKER_SHOW_PANEL_ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: undefined, primary: undefined, handler: (accessor, args: any) => { diff --git a/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts b/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts index 08c5b28df2b..c61097b03d3 100644 --- a/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts +++ b/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts @@ -39,7 +39,7 @@ import { ContextKeyExpr, IContextKey, IContextKeyService } from 'vs/platform/con import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { WorkbenchTree } from 'vs/platform/list/browser/listService'; import { IMarkerService, MarkerSeverity } from 'vs/platform/markers/common/markers'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; @@ -721,7 +721,7 @@ async function goUpOrDownToHighligthedElement(accessor: ServicesAccessor, prev: KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'outline.focusDownHighlighted', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, primary: KeyCode.DownArrow, when: ContextKeyExpr.and(OutlineViewFiltered, OutlineViewFocused), handler: accessor => goUpOrDownToHighligthedElement(accessor, false) @@ -729,7 +729,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'outline.focusUpHighlighted', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, primary: KeyCode.UpArrow, when: ContextKeyExpr.and(OutlineViewFiltered, OutlineViewFocused), handler: accessor => goUpOrDownToHighligthedElement(accessor, true) diff --git a/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts b/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts index 30a65e1aaa0..c72f997106d 100644 --- a/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts +++ b/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts @@ -29,7 +29,7 @@ import { WindowsNativeResolvedKeybinding } from 'vs/workbench/services/keybindin import { themeColorFromId, ThemeColor } from 'vs/platform/theme/common/themeService'; import { overviewRulerInfo, overviewRulerError } from 'vs/editor/common/view/editorColorRegistry'; import { IModelDeltaDecoration, ITextModel, TrackedRangeStickiness, OverviewRulerLane } from 'vs/editor/common/model'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; const NLS_LAUNCH_MESSAGE = nls.localize('defineKeybinding.start', "Define Keybinding"); const NLS_KB_LAYOUT_ERROR_MESSAGE = nls.localize('defineKeybinding.kbLayoutErrorMessage', "You won't be able to produce this key combination under your current keyboard layout."); @@ -367,7 +367,7 @@ class DefineKeybindingCommand extends EditorCommand { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_K), - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); } diff --git a/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts b/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts index fb41da7a3f1..c8ab50f2ba7 100644 --- a/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts +++ b/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts @@ -8,7 +8,7 @@ import 'vs/css!../browser/media/preferences'; import * as nls from 'vs/nls'; import URI from 'vs/base/common/uri'; import { Registry } from 'vs/platform/registry/common/platform'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions'; import { EditorInput, IEditorInputFactory, IEditorInputFactoryRegistry, Extensions as EditorInputExtensions } from 'vs/workbench/common/editor'; import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; @@ -201,7 +201,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(ConfigureLanguageBased KeybindingsRegistry.registerCommandAndKeybindingRule({ id: KEYBINDINGS_EDITOR_COMMAND_DEFINE, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS), primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_K), handler: (accessor, args: any) => { @@ -212,7 +212,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: KEYBINDINGS_EDITOR_COMMAND_REMOVE, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS), primary: KeyCode.Delete, mac: { @@ -226,7 +226,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: KEYBINDINGS_EDITOR_COMMAND_RESET, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS), primary: null, handler: (accessor, args: any) => { @@ -237,7 +237,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: KEYBINDINGS_EDITOR_COMMAND_SEARCH, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS), primary: KeyMod.CtrlCmd | KeyCode.KEY_F, handler: (accessor, args: any) => (accessor.get(IEditorService).activeControl as IKeybindingsEditor).focusSearch() @@ -245,7 +245,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: KEYBINDINGS_EDITOR_COMMAND_SHOW_SIMILAR, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS), primary: null, handler: (accessor, args: any) => { @@ -256,7 +256,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: KEYBINDINGS_EDITOR_COMMAND_COPY, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS), primary: KeyMod.CtrlCmd | KeyCode.KEY_C, handler: (accessor, args: any) => { @@ -267,7 +267,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: KEYBINDINGS_EDITOR_COMMAND_COPY_COMMAND, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS), primary: null, handler: (accessor, args: any) => { @@ -278,7 +278,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: KEYBINDINGS_EDITOR_COMMAND_FOCUS_KEYBINDINGS, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDINGS_SEARCH_FOCUS), primary: KeyCode.DownArrow, handler: (accessor, args: any) => { @@ -289,7 +289,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDINGS_SEARCH_FOCUS), primary: KeyCode.Escape, handler: (accessor, args: any) => { @@ -351,7 +351,7 @@ class StartSearchDefaultSettingsCommand extends SettingsCommand { const startSearchCommand = new StartSearchDefaultSettingsCommand({ id: SETTINGS_EDITOR_COMMAND_SEARCH, precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR), - kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.KEY_F, weight: KeybindingsRegistry.WEIGHT.editorContrib() } + kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.KEY_F, weight: KeybindingWeight.EditorContrib } }); startSearchCommand.register(); @@ -367,7 +367,7 @@ class FocusSearchFromSettingsCommand extends SettingsCommand { const focusSearchFromSettingsCommand = new FocusSearchFromSettingsCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_SEARCH_FROM_SETTINGS, precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_FIRST_ROW_FOCUS), - kbOpts: { primary: KeyCode.UpArrow, weight: KeybindingsRegistry.WEIGHT.workbenchContrib() } + kbOpts: { primary: KeyCode.UpArrow, weight: KeybindingWeight.WorkbenchContrib } }); focusSearchFromSettingsCommand.register(); @@ -384,7 +384,7 @@ class ClearSearchResultsCommand extends SettingsCommand { const clearSearchResultsCommand = new ClearSearchResultsCommand({ id: SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyCode.Escape, weight: KeybindingsRegistry.WEIGHT.editorContrib() } + kbOpts: { primary: KeyCode.Escape, weight: KeybindingWeight.EditorContrib } }); clearSearchResultsCommand.register(); @@ -402,14 +402,14 @@ class FocusSettingsFileEditorCommand extends SettingsCommand { const focusSettingsFileEditorCommand = new FocusSettingsFileEditorCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_FILE, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyCode.DownArrow, weight: KeybindingsRegistry.WEIGHT.editorContrib() } + kbOpts: { primary: KeyCode.DownArrow, weight: KeybindingWeight.EditorContrib } }); focusSettingsFileEditorCommand.register(); const focusSettingsFromSearchCommand = new FocusSettingsFileEditorCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_FROM_SEARCH, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyCode.DownArrow, weight: KeybindingsRegistry.WEIGHT.workbenchContrib() } + kbOpts: { primary: KeyCode.DownArrow, weight: KeybindingWeight.WorkbenchContrib } }); focusSettingsFromSearchCommand.register(); @@ -425,7 +425,7 @@ class FocusNextSearchResultCommand extends SettingsCommand { const focusNextSearchResultCommand = new FocusNextSearchResultCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_NEXT_SETTING, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyCode.Enter, weight: KeybindingsRegistry.WEIGHT.editorContrib() } + kbOpts: { primary: KeyCode.Enter, weight: KeybindingWeight.EditorContrib } }); focusNextSearchResultCommand.register(); @@ -441,7 +441,7 @@ class FocusPreviousSearchResultCommand extends SettingsCommand { const focusPreviousSearchResultCommand = new FocusPreviousSearchResultCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_PREVIOUS_SETTING, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyMod.Shift | KeyCode.Enter, weight: KeybindingsRegistry.WEIGHT.editorContrib() } + kbOpts: { primary: KeyMod.Shift | KeyCode.Enter, weight: KeybindingWeight.EditorContrib } }); focusPreviousSearchResultCommand.register(); @@ -457,7 +457,7 @@ class EditFocusedSettingCommand extends SettingsCommand { const editFocusedSettingCommand = new EditFocusedSettingCommand({ id: SETTINGS_EDITOR_COMMAND_EDIT_FOCUSED_SETTING, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.US_DOT, weight: KeybindingsRegistry.WEIGHT.editorContrib() } + kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.US_DOT, weight: KeybindingWeight.EditorContrib } }); editFocusedSettingCommand.register(); @@ -474,7 +474,7 @@ class EditFocusedSettingCommand2 extends SettingsCommand { const editFocusedSettingCommand2 = new EditFocusedSettingCommand2({ id: SETTINGS_EDITOR_COMMAND_EDIT_FOCUSED_SETTING, precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_ROW_FOCUS), - kbOpts: { primary: KeyCode.Enter, weight: KeybindingsRegistry.WEIGHT.workbenchContrib() } + kbOpts: { primary: KeyCode.Enter, weight: KeybindingWeight.WorkbenchContrib } }); editFocusedSettingCommand2.register(); @@ -491,7 +491,7 @@ class FocusSettingsListCommand extends SettingsCommand { const focusSettingsListCommand = new FocusSettingsListCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_LIST, precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_TOC_ROW_FOCUS), - kbOpts: { primary: KeyCode.Enter, weight: KeybindingsRegistry.WEIGHT.workbenchContrib() } + kbOpts: { primary: KeyCode.Enter, weight: KeybindingWeight.WorkbenchContrib } }); focusSettingsListCommand.register(); diff --git a/src/vs/workbench/parts/quickopen/browser/quickopen.contribution.ts b/src/vs/workbench/parts/quickopen/browser/quickopen.contribution.ts index 68d3f6ca8cb..1ce6dc74391 100644 --- a/src/vs/workbench/parts/quickopen/browser/quickopen.contribution.ts +++ b/src/vs/workbench/parts/quickopen/browser/quickopen.contribution.ts @@ -19,7 +19,7 @@ import { HELP_PREFIX, HelpHandler } from 'vs/workbench/parts/quickopen/browser/h import { VIEW_PICKER_PREFIX, OpenViewPickerAction, QuickOpenViewPickerAction, ViewPickerHandler } from 'vs/workbench/parts/quickopen/browser/viewPickerHandler'; import { inQuickOpenContext, getQuickNavigateHandler } from 'vs/workbench/browser/parts/quickopen/quickopen'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; // Register Actions const registry = Registry.as(ActionExtensions.WorkbenchActions); @@ -50,7 +50,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenViewPickerAct const quickOpenNavigateNextInViewPickerId = 'workbench.action.quickOpenNavigateNextInViewPicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigateNextInViewPickerId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, + weight: KeybindingWeight.WorkbenchContrib + 50, handler: getQuickNavigateHandler(quickOpenNavigateNextInViewPickerId, true), when: inViewsPickerContext, primary: viewPickerKeybinding.primary, @@ -61,7 +61,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const quickOpenNavigatePreviousInViewPickerId = 'workbench.action.quickOpenNavigatePreviousInViewPicker'; KeybindingsRegistry.registerCommandAndKeybindingRule({ id: quickOpenNavigatePreviousInViewPickerId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib() + 50, + weight: KeybindingWeight.WorkbenchContrib + 50, handler: getQuickNavigateHandler(quickOpenNavigatePreviousInViewPickerId, false), when: inViewsPickerContext, primary: viewPickerKeybinding.primary | KeyMod.Shift, diff --git a/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts b/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts index 1c4492999f1..505f3c8a672 100644 --- a/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts +++ b/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts @@ -33,7 +33,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Position } from 'vs/editor/common/core/position'; import { rot } from 'vs/base/common/numbers'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { peekViewBorder, peekViewTitleBackground, peekViewTitleForeground, peekViewTitleInfoForeground } from 'vs/editor/contrib/referenceSearch/referencesWidget'; import { EmbeddedDiffEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget'; import { IDiffEditorOptions } from 'vs/editor/common/config/editorOptions'; @@ -372,7 +372,7 @@ export class ShowPreviousChangeAction extends EditorAction { label: nls.localize('show previous change', "Show Previous Change"), alias: 'Show Previous Change', precondition: null, - kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F3, weight: KeybindingsRegistry.WEIGHT.editorContrib() } + kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F3, weight: KeybindingWeight.EditorContrib } }); } @@ -406,7 +406,7 @@ export class ShowNextChangeAction extends EditorAction { label: nls.localize('show next change', "Show Next Change"), alias: 'Show Next Change', precondition: null, - kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F3, weight: KeybindingsRegistry.WEIGHT.editorContrib() } + kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F3, weight: KeybindingWeight.EditorContrib } }); } @@ -440,7 +440,7 @@ export class MoveToPreviousChangeAction extends EditorAction { label: nls.localize('move to previous change', "Move to Previous Change"), alias: 'Move to Previous Change', precondition: null, - kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F5, weight: KeybindingsRegistry.WEIGHT.editorContrib() } + kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F5, weight: KeybindingWeight.EditorContrib } }); } @@ -482,7 +482,7 @@ export class MoveToNextChangeAction extends EditorAction { label: nls.localize('move to next change', "Move to Next Change"), alias: 'Move to Next Change', precondition: null, - kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F5, weight: KeybindingsRegistry.WEIGHT.editorContrib() } + kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F5, weight: KeybindingWeight.EditorContrib } }); } @@ -518,7 +518,7 @@ registerEditorAction(MoveToNextChangeAction); KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'closeDirtyDiff', - weight: KeybindingsRegistry.WEIGHT.editorContrib() + 50, + weight: KeybindingWeight.EditorContrib + 50, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape], when: ContextKeyExpr.and(isDirtyDiffVisible), diff --git a/src/vs/workbench/parts/search/browser/searchWidget.ts b/src/vs/workbench/parts/search/browser/searchWidget.ts index 15342de2365..86bf8193435 100644 --- a/src/vs/workbench/parts/search/browser/searchWidget.ts +++ b/src/vs/workbench/parts/search/browser/searchWidget.ts @@ -14,7 +14,7 @@ import { FindInput, IFindInputOptions } from 'vs/base/browser/ui/findinput/findI import { IMessage, HistoryInputBox } from 'vs/base/browser/ui/inputbox/inputBox'; import { Button, IButtonOptions } from 'vs/base/browser/ui/button/button'; import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { ContextKeyExpr, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; @@ -473,7 +473,7 @@ export class SearchWidget extends Widget { export function registerContributions() { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: ReplaceAllAction.ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.ReplaceActiveKey, CONTEXT_FIND_WIDGET_NOT_VISIBLE), primary: KeyMod.Alt | KeyMod.CtrlCmd | KeyCode.Enter, handler: accessor => { diff --git a/src/vs/workbench/parts/search/electron-browser/search.contribution.ts b/src/vs/workbench/parts/search/electron-browser/search.contribution.ts index 23a3349681d..3c7c2f4f545 100644 --- a/src/vs/workbench/parts/search/electron-browser/search.contribution.ts +++ b/src/vs/workbench/parts/search/electron-browser/search.contribution.ts @@ -19,7 +19,7 @@ import { ExplorerFolderContext, ExplorerRootContext } from 'vs/workbench/parts/f import { SyncActionDescriptor, MenuRegistry, MenuId, ICommandAction } from 'vs/platform/actions/common/actions'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; import { QuickOpenHandlerDescriptor, IQuickOpenRegistry, Extensions as QuickOpenExtensions } from 'vs/workbench/browser/quickopen'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; @@ -68,7 +68,7 @@ const category = nls.localize('search', "Search"); KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'workbench.action.search.toggleQueryDetails', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: Constants.SearchViewVisibleKey, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_J, handler: accessor => { @@ -81,7 +81,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: Constants.FocusSearchFromResults, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.FirstMatchFocusKey), primary: KeyMod.CtrlCmd | KeyCode.UpArrow, handler: (accessor, args: any) => { @@ -92,7 +92,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: Constants.OpenMatchToSide, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.FileMatchOrMatchFocusKey), primary: KeyMod.CtrlCmd | KeyCode.Enter, mac: { @@ -107,7 +107,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: Constants.CancelActionId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, WorkbenchListFocusContextKey), primary: KeyCode.Escape, handler: (accessor, args: any) => { @@ -118,7 +118,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: Constants.RemoveActionId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.FileMatchOrMatchFocusKey), primary: KeyCode.Delete, mac: { @@ -133,7 +133,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: Constants.ReplaceActionId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.ReplaceActiveKey, Constants.MatchFocusKey), primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyCode.KEY_1, handler: (accessor, args: any) => { @@ -145,7 +145,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: Constants.ReplaceAllInFileActionId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.ReplaceActiveKey, Constants.FileFocusKey), primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyCode.KEY_1, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter], @@ -158,7 +158,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: Constants.ReplaceAllInFolderActionId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.ReplaceActiveKey, Constants.FolderFocusKey), primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyCode.KEY_1, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter], @@ -171,7 +171,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: Constants.CloseReplaceWidgetActionId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.ReplaceInputBoxFocusedKey), primary: KeyCode.Escape, handler: (accessor, args: any) => { @@ -181,7 +181,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: FocusNextInputAction.ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.InputBoxFocusedKey), primary: KeyMod.CtrlCmd | KeyCode.DownArrow, handler: (accessor, args: any) => { @@ -191,7 +191,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: FocusPreviousInputAction.ID, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.InputBoxFocusedKey, Constants.SearchInputBoxFocusedKey.toNegated()), primary: KeyMod.CtrlCmd | KeyCode.UpArrow, handler: (accessor, args: any) => { @@ -241,7 +241,7 @@ MenuRegistry.appendMenuItem(MenuId.SearchContext, { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: Constants.CopyMatchCommandId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: Constants.FileMatchOrMatchFocusKey, primary: KeyMod.CtrlCmd | KeyCode.KEY_C, handler: copyMatchCommand @@ -259,7 +259,7 @@ MenuRegistry.appendMenuItem(MenuId.SearchContext, { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: Constants.CopyPathCommandId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: Constants.FileMatchOrFolderMatchFocusKey, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_C, win: { @@ -484,21 +484,21 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(ReplaceInFilesAction, KeybindingsRegistry.registerCommandAndKeybindingRule(objects.assign({ id: Constants.ToggleCaseSensitiveCommandId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.SearchInputBoxFocusedKey), handler: toggleCaseSensitiveCommand }, ToggleCaseSensitiveKeybinding)); KeybindingsRegistry.registerCommandAndKeybindingRule(objects.assign({ id: Constants.ToggleWholeWordCommandId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.SearchInputBoxFocusedKey), handler: toggleWholeWordCommand }, ToggleWholeWordKeybinding)); KeybindingsRegistry.registerCommandAndKeybindingRule(objects.assign({ id: Constants.ToggleRegexCommandId, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.SearchInputBoxFocusedKey), handler: toggleRegexCommand }, ToggleRegexKeybinding)); diff --git a/src/vs/workbench/parts/snippets/electron-browser/tabCompletion.ts b/src/vs/workbench/parts/snippets/electron-browser/tabCompletion.ts index 9b2b047160c..93c0e82a043 100644 --- a/src/vs/workbench/parts/snippets/electron-browser/tabCompletion.ts +++ b/src/vs/workbench/parts/snippets/electron-browser/tabCompletion.ts @@ -8,7 +8,7 @@ import { localize } from 'vs/nls'; import { KeyCode } from 'vs/base/common/keyCodes'; import { RawContextKey, IContextKeyService, ContextKeyExpr, IContextKey } from 'vs/platform/contextkey/common/contextkey'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { ISnippetsService } from 'vs/workbench/parts/snippets/electron-browser/snippets.contribution'; import { getNonWhitespacePrefix, SnippetSuggestion } from 'vs/workbench/parts/snippets/electron-browser/snippetsService'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -142,7 +142,7 @@ registerEditorCommand(new TabCompletionCommand({ precondition: TabCompletionController.ContextKey, handler: x => x.performSnippetCompletions(), kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(), + weight: KeybindingWeight.EditorContrib, kbExpr: ContextKeyExpr.and( EditorContextKeys.editorTextFocus, EditorContextKeys.tabDoesNotMoveFocus, diff --git a/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts b/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts index f301f5471da..a4e284cf727 100644 --- a/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts +++ b/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts @@ -39,7 +39,7 @@ import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configur import { IFileService, IFileStat } from 'vs/platform/files/common/files'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { CommandsRegistry } from 'vs/platform/commands/common/commands'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { ProblemMatcherRegistry, NamedProblemMatcher } from 'vs/workbench/parts/tasks/common/problemMatcher'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { IProgressService2, IProgressOptions, ProgressLocation } from 'vs/workbench/services/progress/common/progress'; @@ -566,7 +566,7 @@ class TaskService implements ITaskService { KeybindingsRegistry.registerKeybindingRule({ id: 'workbench.action.tasks.build', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: undefined, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_B }); diff --git a/src/vs/workbench/parts/terminal/common/terminalCommands.ts b/src/vs/workbench/parts/terminal/common/terminalCommands.ts index 5a9091527a6..8d5345ed224 100644 --- a/src/vs/workbench/parts/terminal/common/terminalCommands.ts +++ b/src/vs/workbench/parts/terminal/common/terminalCommands.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { ITerminalService } from 'vs/workbench/parts/terminal/common/terminal'; export const enum TERMINAL_COMMAND_ID { @@ -69,7 +69,7 @@ function registerOpenTerminalAtIndexCommands(): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ id: `workbench.action.terminal.focusAtIndex${visibleIndex}`, - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: void 0, primary: null, handler: accessor => { diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts index e413f49d051..835be4cc86f 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts @@ -24,7 +24,7 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; import { TerminalService } from 'vs/workbench/parts/terminal/electron-browser/terminalService'; import { ToggleTabFocusModeAction } from 'vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { OpenNextRecentlyUsedEditorInGroupAction, OpenPreviousRecentlyUsedEditorInGroupAction, FocusActiveGroupAction, FocusFirstGroupAction, FocusLastGroupAction, OpenFirstEditorInGroup, OpenLastEditorInGroup } from 'vs/workbench/browser/parts/editor/editorActions'; import { EDITOR_FONT_DEFAULTS } from 'vs/editor/common/config/editorOptions'; import { registerColors } from 'vs/workbench/parts/terminal/common/terminalColorRegistry'; @@ -451,7 +451,7 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ScrollToTopTermi actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ClearTerminalAction, ClearTerminalAction.ID, ClearTerminalAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_K, linux: { primary: null } -}, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KeybindingsRegistry.WEIGHT.workbenchContrib() + 1), 'Terminal: Clear', category); +}, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KeybindingWeight.WorkbenchContrib + 1), 'Terminal: Clear', category); if (platform.isWindows) { actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(SelectDefaultShellWindowsTerminalAction, SelectDefaultShellWindowsTerminalAction.ID, SelectDefaultShellWindowsTerminalAction.LABEL), 'Terminal: Select Default Shell', category); } diff --git a/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts b/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts index b1d86248aec..45e3dab5b9a 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts @@ -9,7 +9,7 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { Registry } from 'vs/platform/registry/common/platform'; import { EditorDescriptor, Extensions as EditorExtensions, IEditorRegistry } from 'vs/workbench/browser/editor'; import { Extensions as ActionExtensions, IWorkbenchActionRegistry } from 'vs/workbench/common/actions'; @@ -43,7 +43,7 @@ const showNextFindWdigetCommand = new ShowWebViewEditorFindWidgetCommand({ precondition: KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS, kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.KEY_F, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); showNextFindWdigetCommand.register(); @@ -55,7 +55,7 @@ const hideCommand = new HideWebViewEditorFindCommand({ KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE), kbOpts: { primary: KeyCode.Escape, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); hideCommand.register(); @@ -65,7 +65,7 @@ const selectAllCommand = new SelectAllWebviewEditorCommand({ precondition: KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS, kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.KEY_A, - weight: KeybindingsRegistry.WEIGHT.editorContrib() + weight: KeybindingWeight.EditorContrib } }); selectAllCommand.register(); diff --git a/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughActions.ts b/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughActions.ts index 5a838046aa8..6fc211d61f6 100644 --- a/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughActions.ts +++ b/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughActions.ts @@ -6,14 +6,14 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { WalkThroughPart, WALK_THROUGH_FOCUS } from 'vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart'; -import { ICommandAndKeybindingRule, KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { ICommandAndKeybindingRule, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { KeyCode } from 'vs/base/common/keyCodes'; export const WalkThroughArrowUp: ICommandAndKeybindingRule = { id: 'workbench.action.interactivePlayground.arrowUp', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(WALK_THROUGH_FOCUS, EditorContextKeys.editorTextFocus.toNegated()), primary: KeyCode.UpArrow, handler: accessor => { @@ -27,7 +27,7 @@ export const WalkThroughArrowUp: ICommandAndKeybindingRule = { export const WalkThroughArrowDown: ICommandAndKeybindingRule = { id: 'workbench.action.interactivePlayground.arrowDown', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(WALK_THROUGH_FOCUS, EditorContextKeys.editorTextFocus.toNegated()), primary: KeyCode.DownArrow, handler: accessor => { @@ -41,7 +41,7 @@ export const WalkThroughArrowDown: ICommandAndKeybindingRule = { export const WalkThroughPageUp: ICommandAndKeybindingRule = { id: 'workbench.action.interactivePlayground.pageUp', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(WALK_THROUGH_FOCUS, EditorContextKeys.editorTextFocus.toNegated()), primary: KeyCode.PageUp, handler: accessor => { @@ -55,7 +55,7 @@ export const WalkThroughPageUp: ICommandAndKeybindingRule = { export const WalkThroughPageDown: ICommandAndKeybindingRule = { id: 'workbench.action.interactivePlayground.pageDown', - weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + weight: KeybindingWeight.WorkbenchContrib, when: ContextKeyExpr.and(WALK_THROUGH_FOCUS, EditorContextKeys.editorTextFocus.toNegated()), primary: KeyCode.PageDown, handler: accessor => { diff --git a/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts b/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts index 40ccd3f3c9a..c0521529d6e 100644 --- a/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts +++ b/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts @@ -16,7 +16,7 @@ import { KeybindingResolver } from 'vs/platform/keybinding/common/keybindingReso import { ICommandService } from 'vs/platform/commands/common/commands'; import { IKeybindingEvent, IUserFriendlyKeybinding, KeybindingSource, IKeyboardEvent } from 'vs/platform/keybinding/common/keybinding'; import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { IKeybindingItem, KeybindingsRegistry, IKeybindingRule2, KeybindingRuleSource } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { IKeybindingItem, KeybindingsRegistry, IKeybindingRule2, KeybindingRuleSource, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { Registry } from 'vs/platform/registry/common/platform'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { keybindingsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils'; @@ -485,9 +485,9 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService { let weight: number; if (isBuiltin) { - weight = KeybindingsRegistry.WEIGHT.builtinExtension() + idx; + weight = KeybindingWeight.BuiltinExtension + idx; } else { - weight = KeybindingsRegistry.WEIGHT.externalExtension() + idx; + weight = KeybindingWeight.ExternalExtension + idx; } let desc = { From f82b14800cc0ed6f21a450b684518a4db05fc260 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 24 Jul 2018 18:10:04 +0200 Subject: [PATCH 80/93] Remove unused code --- .../keybinding/common/keybindingsRegistry.ts | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/src/vs/platform/keybinding/common/keybindingsRegistry.ts b/src/vs/platform/keybinding/common/keybindingsRegistry.ts index 189cce3c1c8..3d581b4e64f 100644 --- a/src/vs/platform/keybinding/common/keybindingsRegistry.ts +++ b/src/vs/platform/keybinding/common/keybindingsRegistry.ts @@ -75,14 +75,6 @@ export interface IKeybindingsRegistry { registerKeybindingRule2(rule: IKeybindingRule2, source?: KeybindingRuleSource): void; registerCommandAndKeybindingRule(desc: ICommandAndKeybindingRule, source?: KeybindingRuleSource): void; getDefaultKeybindings(): IKeybindingItem[]; - - WEIGHT: { - editorCore(): number; - editorContrib(): number; - workbenchContrib(): number; - builtinExtension(): number; - externalExtension(): number; - }; } class KeybindingsRegistryImpl implements IKeybindingsRegistry { @@ -90,24 +82,6 @@ class KeybindingsRegistryImpl implements IKeybindingsRegistry { private _keybindings: IKeybindingItem[]; private _keybindingsSorted: boolean; - public WEIGHT = { - editorCore: (): number => { - return KeybindingWeight.EditorCore; - }, - editorContrib: (): number => { - return KeybindingWeight.EditorContrib; - }, - workbenchContrib: (): number => { - return KeybindingWeight.WorkbenchContrib; - }, - builtinExtension: (): number => { - return KeybindingWeight.BuiltinExtension; - }, - externalExtension: (): number => { - return KeybindingWeight.ExternalExtension; - } - }; - constructor() { this._keybindings = []; this._keybindingsSorted = true; From d58a9f36f36a650f25b68fa3bfcf3292e2caf574 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 24 Jul 2018 18:21:16 +0200 Subject: [PATCH 81/93] Add support for menubarOpts in commands --- src/vs/editor/browser/editorExtensions.ts | 98 +++++++++---------- .../browser/quickOpen/quickCommand.ts | 2 + 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/vs/editor/browser/editorExtensions.ts b/src/vs/editor/browser/editorExtensions.ts index dd522f9adac..9288855f4c4 100644 --- a/src/vs/editor/browser/editorExtensions.ts +++ b/src/vs/editor/browser/editorExtensions.ts @@ -9,13 +9,13 @@ import URI from 'vs/base/common/uri'; import { TPromise } from 'vs/base/common/winjs.base'; import { ServicesAccessor, IConstructorSignature1 } from 'vs/platform/instantiation/common/instantiation'; import { CommandsRegistry, ICommandHandlerDescription } from 'vs/platform/commands/common/commands'; -import { KeybindingsRegistry, ICommandAndKeybindingRule, IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeybindingsRegistry, IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { Registry } from 'vs/platform/registry/common/platform'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { Position } from 'vs/editor/common/core/position'; import * as editorCommon from 'vs/editor/common/editorCommon'; import { IModelService } from 'vs/editor/common/services/modelService'; -import { MenuId, MenuRegistry, IMenuItem } from 'vs/platform/actions/common/actions'; +import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions'; import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; @@ -31,23 +31,25 @@ export interface ICommandKeybindingsOptions extends IKeybindings { kbExpr?: ContextKeyExpr; weight: number; } -// export interface ICommandMenubarOptions { -// group?: string; -// order?: number; -// when?: ContextKeyExpr; -// title?: string; -// } +export interface ICommandMenubarOptions { + menuId: MenuId; + group: string; + order: number; + when?: ContextKeyExpr; + title: string; +} export interface ICommandOptions { id: string; precondition: ContextKeyExpr; kbOpts?: ICommandKeybindingsOptions; description?: ICommandHandlerDescription; - // menubarOpts?: ICommandMenubarOptions; + menubarOpts?: ICommandMenubarOptions; } export abstract class Command { public readonly id: string; public readonly precondition: ContextKeyExpr; private readonly _kbOpts: ICommandKeybindingsOptions; + private readonly _menubarOpts: ICommandMenubarOptions; private readonly _description: ICommandHandlerDescription; constructor(opts: ICommandOptions) { @@ -57,7 +59,21 @@ export abstract class Command { this._description = opts.description; } - private _toCommandAndKeybindingRule(): ICommandAndKeybindingRule { + public register(): void { + + if (this._menubarOpts) { + MenuRegistry.appendMenuItem(this._menubarOpts.menuId, { + group: this._menubarOpts.group, + command: { + id: this.id, + title: this._menubarOpts.title, + // precondition: this.precondition + }, + when: this._menubarOpts.when, + order: this._menubarOpts.order + }); + } + if (this._kbOpts) { let kbWhen = this._kbOpts.kbExpr; if (this.precondition) { @@ -68,7 +84,7 @@ export abstract class Command { } } - return { + KeybindingsRegistry.registerCommandAndKeybindingRule({ id: this.id, handler: (accessor, args) => this.runCommand(accessor, args), weight: this._kbOpts.weight, @@ -79,25 +95,16 @@ export abstract class Command { linux: this._kbOpts.linux, mac: this._kbOpts.mac, description: this._description - }; + }); + + } else { + + CommandsRegistry.registerCommand({ + id: this.id, + handler: (accessor, args) => this.runCommand(accessor, args), + description: this._description + }); } - - return { - id: this.id, - handler: (accessor, args) => this.runCommand(accessor, args), - weight: undefined, - when: undefined, - primary: 0, - secondary: undefined, - win: undefined, - linux: undefined, - mac: undefined, - description: this._description - }; - } - - public register(): void { - KeybindingsRegistry.registerCommandAndKeybindingRule(this._toCommandAndKeybindingRule()); } public abstract runCommand(accessor: ServicesAccessor, args: any): void | TPromise; @@ -166,8 +173,8 @@ export abstract class EditorCommand extends Command { //#region EditorAction export interface IEditorCommandMenuOptions { - group?: string; - order?: number; + group: string; + order: number; when?: ContextKeyExpr; } export interface IActionOptions extends ICommandOptions { @@ -188,27 +195,18 @@ export abstract class EditorAction extends EditorCommand { this.menuOpts = opts.menuOpts; } - private _toMenuItem(): IMenuItem { - if (!this.menuOpts) { - return null; - } - - return { - command: { - id: this.id, - title: this.label - }, - when: ContextKeyExpr.and(this.precondition, this.menuOpts.when), - group: this.menuOpts.group, - order: this.menuOpts.order - }; - } - public register(): void { - let menuItem = this._toMenuItem(); - if (menuItem) { - MenuRegistry.appendMenuItem(MenuId.EditorContext, menuItem); + if (this.menuOpts) { + MenuRegistry.appendMenuItem(MenuId.EditorContext, { + command: { + id: this.id, + title: this.label + }, + when: ContextKeyExpr.and(this.precondition, this.menuOpts.when), + group: this.menuOpts.group, + order: this.menuOpts.order + }); } super.register(); diff --git a/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts b/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts index a43d2325a15..7fe59dd0453 100644 --- a/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts +++ b/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts @@ -84,6 +84,8 @@ export class QuickCommandAction extends BaseEditorQuickOpenAction { weight: KeybindingWeight.EditorContrib }, menuOpts: { + group: 'z_commands', + order: 1 } }); } From f5494e1f748d53f90f8e24f3635b9584d1a02726 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 24 Jul 2018 18:30:28 +0200 Subject: [PATCH 82/93] Move Edit menu registrations next to the actions (#54510) --- .../editor/browser/controller/coreCommands.ts | 14 ++ src/vs/editor/contrib/clipboard/clipboard.ts | 19 +++ src/vs/editor/contrib/comment/comment.ts | 13 ++ src/vs/editor/contrib/find/findController.ts | 13 ++ .../electron-browser/menubarRegistrations.ts | 122 ------------------ .../browser/actions/showEmmetCommands.ts | 7 + .../actions/expandAbbreviation.ts | 7 + .../electron-browser/search.contribution.ts | 16 +++ 8 files changed, 89 insertions(+), 122 deletions(-) diff --git a/src/vs/editor/browser/controller/coreCommands.ts b/src/vs/editor/browser/controller/coreCommands.ts index ea7ad7c7f3e..083e0fd94a6 100644 --- a/src/vs/editor/browser/controller/coreCommands.ts +++ b/src/vs/editor/browser/controller/coreCommands.ts @@ -5,6 +5,7 @@ 'use strict'; +import * as nls from 'vs/nls'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import * as editorCommon from 'vs/editor/common/editorCommon'; @@ -26,6 +27,7 @@ import { TypeOperations } from 'vs/editor/common/controller/cursorTypeOperations import { DeleteOperations } from 'vs/editor/common/controller/cursorDeleteOperations'; import { VerticalRevealType } from 'vs/editor/common/view/viewEvents'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { MenuId } from 'vs/platform/actions/common/actions'; const CORE_WEIGHT = KeybindingWeight.EditorCore; @@ -1721,6 +1723,12 @@ registerCommand(new EditorOrNativeTextInputCommand({ weight: CORE_WEIGHT, kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.KEY_Z + }, + menubarOpts: { + menuId: MenuId.MenubarEditMenu, + group: '1_do', + title: nls.localize({ key: 'miUndo', comment: ['&& denotes a mnemonic'] }, "&&Undo"), + order: 1 } })); registerCommand(new EditorHandlerCommand('default:' + H.Undo, H.Undo)); @@ -1736,6 +1744,12 @@ registerCommand(new EditorOrNativeTextInputCommand({ primary: KeyMod.CtrlCmd | KeyCode.KEY_Y, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Z], mac: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Z } + }, + menubarOpts: { + menuId: MenuId.MenubarEditMenu, + group: '1_do', + title: nls.localize({ key: 'miRedo', comment: ['&& denotes a mnemonic'] }, "&&Redo"), + order: 2 } })); registerCommand(new EditorHandlerCommand('default:' + H.Redo, H.Redo)); diff --git a/src/vs/editor/contrib/clipboard/clipboard.ts b/src/vs/editor/contrib/clipboard/clipboard.ts index 41fb2a1b086..4d0ec22210d 100644 --- a/src/vs/editor/contrib/clipboard/clipboard.ts +++ b/src/vs/editor/contrib/clipboard/clipboard.ts @@ -17,6 +17,7 @@ import { CopyOptions } from 'vs/editor/browser/controller/textAreaInput'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { MenuId } from 'vs/platform/actions/common/actions'; const CLIPBOARD_CONTEXT_MENU_GROUP = '9_cutcopypaste'; @@ -80,6 +81,12 @@ class ExecCommandCutAction extends ExecCommandAction { menuOpts: { group: CLIPBOARD_CONTEXT_MENU_GROUP, order: 1 + }, + menubarOpts: { + menuId: MenuId.MenubarEditMenu, + group: '2_ccp', + title: nls.localize({ key: 'miCut', comment: ['&& denotes a mnemonic'] }, "Cu&&t"), + order: 1 } }); } @@ -119,6 +126,12 @@ class ExecCommandCopyAction extends ExecCommandAction { menuOpts: { group: CLIPBOARD_CONTEXT_MENU_GROUP, order: 2 + }, + menubarOpts: { + menuId: MenuId.MenubarEditMenu, + group: '2_ccp', + title: nls.localize({ key: 'miCopy', comment: ['&& denotes a mnemonic'] }, "&&Copy"), + order: 2 } }); } @@ -158,6 +171,12 @@ class ExecCommandPasteAction extends ExecCommandAction { menuOpts: { group: CLIPBOARD_CONTEXT_MENU_GROUP, order: 3 + }, + menubarOpts: { + menuId: MenuId.MenubarEditMenu, + group: '2_ccp', + title: nls.localize({ key: 'miPaste', comment: ['&& denotes a mnemonic'] }, "&&Paste"), + order: 3 } }); } diff --git a/src/vs/editor/contrib/comment/comment.ts b/src/vs/editor/contrib/comment/comment.ts index 0011a0a5ff2..264e8527e52 100644 --- a/src/vs/editor/contrib/comment/comment.ts +++ b/src/vs/editor/contrib/comment/comment.ts @@ -13,6 +13,7 @@ import { BlockCommentCommand } from './blockCommentCommand'; import { LineCommentCommand, Type } from './lineCommentCommand'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { MenuId } from 'vs/platform/actions/common/actions'; abstract class CommentLineAction extends EditorAction { @@ -55,6 +56,12 @@ class ToggleCommentLineAction extends CommentLineAction { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.CtrlCmd | KeyCode.US_SLASH, weight: KeybindingWeight.EditorContrib + }, + menubarOpts: { + menuId: MenuId.MenubarEditMenu, + group: '5_insert', + title: nls.localize({ key: 'miToggleLineComment', comment: ['&& denotes a mnemonic'] }, "&&Toggle Line Comment"), + order: 1 } }); } @@ -105,6 +112,12 @@ class BlockCommentAction extends EditorAction { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A }, weight: KeybindingWeight.EditorContrib + }, + menubarOpts: { + menuId: MenuId.MenubarEditMenu, + group: '5_insert', + title: nls.localize({ key: 'miToggleBlockComment', comment: ['&& denotes a mnemonic'] }, "Toggle &&Block Comment"), + order: 2 } }); } diff --git a/src/vs/editor/contrib/find/findController.ts b/src/vs/editor/contrib/find/findController.ts index ad70a3bd37f..5a43011b332 100644 --- a/src/vs/editor/contrib/find/findController.ts +++ b/src/vs/editor/contrib/find/findController.ts @@ -25,6 +25,7 @@ import { FindOptionsWidget } from 'vs/editor/contrib/find/findOptionsWidget'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { optional } from 'vs/platform/instantiation/common/instantiation'; +import { MenuId } from 'vs/platform/actions/common/actions'; export function getSelectionSearchString(editor: ICodeEditor): string { let selection = editor.getSelection(); @@ -388,6 +389,12 @@ export class StartFindAction extends EditorAction { kbExpr: null, primary: KeyMod.CtrlCmd | KeyCode.KEY_F, weight: KeybindingWeight.EditorContrib + }, + menubarOpts: { + menuId: MenuId.MenubarEditMenu, + group: '3_find', + title: nls.localize({ key: 'miFind', comment: ['&& denotes a mnemonic'] }, "&&Find"), + order: 1 } }); } @@ -582,6 +589,12 @@ export class StartFindReplaceAction extends EditorAction { primary: KeyMod.CtrlCmd | KeyCode.KEY_H, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_F }, weight: KeybindingWeight.EditorContrib + }, + menubarOpts: { + menuId: MenuId.MenubarEditMenu, + group: '3_find', + title: nls.localize({ key: 'miReplace', comment: ['&& denotes a mnemonic'] }, "&&Replace"), + order: 2 } }); } diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/menubarRegistrations.ts b/src/vs/workbench/parts/codeEditor/electron-browser/menubarRegistrations.ts index fb39248beb0..02d2ee2f366 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/menubarRegistrations.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/menubarRegistrations.ts @@ -7,130 +7,8 @@ import * as nls from 'vs/nls'; import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; -editMenuRegistration(); selectionMenuRegistration(); -function editMenuRegistration() { - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '1_do', - command: { - id: 'undo', - title: nls.localize({ key: 'miUndo', comment: ['&& denotes a mnemonic'] }, "&&Undo") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '1_do', - command: { - id: 'redo', - title: nls.localize({ key: 'miRedo', comment: ['&& denotes a mnemonic'] }, "&&Redo") - }, - order: 2 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '2_ccp', - command: { - id: 'editor.action.clipboardCutAction', - title: nls.localize({ key: 'miCut', comment: ['&& denotes a mnemonic'] }, "Cu&&t") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '2_ccp', - command: { - id: 'editor.action.clipboardCopyAction', - title: nls.localize({ key: 'miCopy', comment: ['&& denotes a mnemonic'] }, "&&Copy") - }, - order: 2 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '2_ccp', - command: { - id: 'editor.action.clipboardPasteAction', - title: nls.localize({ key: 'miPaste', comment: ['&& denotes a mnemonic'] }, "&&Paste") - }, - order: 3 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '3_find', - command: { - id: 'actions.find', - title: nls.localize({ key: 'miFind', comment: ['&& denotes a mnemonic'] }, "&&Find") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '3_find', - command: { - id: 'editor.action.startFindReplaceAction', - title: nls.localize({ key: 'miReplace', comment: ['&& denotes a mnemonic'] }, "&&Replace") - }, - order: 2 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '4_find_global', - command: { - id: 'workbench.action.findInFiles', - title: nls.localize({ key: 'miFindInFiles', comment: ['&& denotes a mnemonic'] }, "Find &&in Files") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '4_find_global', - command: { - - id: 'workbench.action.replaceInFiles', - title: nls.localize({ key: 'miReplaceInFiles', comment: ['&& denotes a mnemonic'] }, "Replace &&in Files") - }, - order: 2 - }); - - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '5_insert', - command: { - id: 'editor.action.commentLine', - title: nls.localize({ key: 'miToggleLineComment', comment: ['&& denotes a mnemonic'] }, "&&Toggle Line Comment") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '5_insert', - command: { - id: 'editor.action.blockComment', - title: nls.localize({ key: 'miToggleBlockComment', comment: ['&& denotes a mnemonic'] }, "Toggle &&Block Comment") - }, - order: 2 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '5_insert', - command: { - id: 'editor.emmet.action.expandAbbreviation', - title: nls.localize({ key: 'miEmmetExpandAbbreviation', comment: ['&& denotes a mnemonic'] }, "Emmet: E&&xpand Abbreviation") - }, - order: 1 - }); - - MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { - group: '5_insert', - command: { - id: 'workbench.action.showEmmetCommands', - title: nls.localize({ key: 'miShowEmmetCommands', comment: ['&& denotes a mnemonic'] }, "E&&mmet...") - }, - order: 2 - }); -} - function selectionMenuRegistration() { MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, { group: '1_basic', diff --git a/src/vs/workbench/parts/emmet/browser/actions/showEmmetCommands.ts b/src/vs/workbench/parts/emmet/browser/actions/showEmmetCommands.ts index ea18fc77506..c144579d4aa 100644 --- a/src/vs/workbench/parts/emmet/browser/actions/showEmmetCommands.ts +++ b/src/vs/workbench/parts/emmet/browser/actions/showEmmetCommands.ts @@ -12,6 +12,7 @@ import { registerEditorAction, EditorAction, ServicesAccessor } from 'vs/editor/ import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { MenuId } from 'vs/platform/actions/common/actions'; const EMMET_COMMANDS_PREFIX = '>Emmet: '; @@ -23,6 +24,12 @@ class ShowEmmetCommandsAction extends EditorAction { label: nls.localize('showEmmetCommands', "Show Emmet Commands"), alias: 'Show Emmet Commands', precondition: EditorContextKeys.writable, + menubarOpts: { + menuId: MenuId.MenubarEditMenu, + group: '5_insert', + title: nls.localize({ key: 'miShowEmmetCommands', comment: ['&& denotes a mnemonic'] }, "E&&mmet..."), + order: 4 + } }); } diff --git a/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts b/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts index c7896631af6..42968c4b846 100644 --- a/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts +++ b/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts @@ -11,6 +11,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { KeyCode } from 'vs/base/common/keyCodes'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { MenuId } from 'vs/platform/actions/common/actions'; class ExpandAbbreviationAction extends EmmetEditorAction { @@ -29,6 +30,12 @@ class ExpandAbbreviationAction extends EmmetEditorAction { ContextKeyExpr.has('config.emmet.triggerExpansionOnTab') ), weight: KeybindingWeight.EditorContrib + }, + menubarOpts: { + menuId: MenuId.MenubarEditMenu, + group: '5_insert', + title: nls.localize({ key: 'miEmmetExpandAbbreviation', comment: ['&& denotes a mnemonic'] }, "Emmet: E&&xpand Abbreviation"), + order: 3 } }); diff --git a/src/vs/workbench/parts/search/electron-browser/search.contribution.ts b/src/vs/workbench/parts/search/electron-browser/search.contribution.ts index 3c7c2f4f545..af07196b912 100644 --- a/src/vs/workbench/parts/search/electron-browser/search.contribution.ts +++ b/src/vs/workbench/parts/search/electron-browser/search.contribution.ts @@ -476,11 +476,27 @@ const registry = Registry.as(ActionExtensions.Workbenc // Show Search 'when' is redundant but if the two conflict with exactly the same keybinding and 'when' clause, then they can show up as "unbound" - #51780 registry.registerWorkbenchAction(new SyncActionDescriptor(FindInFilesAction, VIEW_ID, nls.localize('showSearchViewl', "Show Search"), { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_F }, Constants.SearchViewVisibleKey.toNegated()), 'View: Show Search', nls.localize('view', "View")); registry.registerWorkbenchAction(new SyncActionDescriptor(FindInFilesAction, Constants.FindInFilesActionId, nls.localize('findInFiles', "Find in Files"), { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_F }), 'Find in Files', category); +MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '4_find_global', + command: { + id: Constants.FindInFilesActionId, + title: nls.localize({ key: 'miFindInFiles', comment: ['&& denotes a mnemonic'] }, "Find &&in Files") + }, + order: 1 +}); registry.registerWorkbenchAction(new SyncActionDescriptor(FocusNextSearchResultAction, FocusNextSearchResultAction.ID, FocusNextSearchResultAction.LABEL, { primary: KeyCode.F4 }, ContextKeyExpr.and(Constants.HasSearchResults)), 'Focus Next Search Result', category); registry.registerWorkbenchAction(new SyncActionDescriptor(FocusPreviousSearchResultAction, FocusPreviousSearchResultAction.ID, FocusPreviousSearchResultAction.LABEL, { primary: KeyMod.Shift | KeyCode.F4 }, ContextKeyExpr.and(Constants.HasSearchResults)), 'Focus Previous Search Result', category); registry.registerWorkbenchAction(new SyncActionDescriptor(ReplaceInFilesAction, ReplaceInFilesAction.ID, ReplaceInFilesAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_H }), 'Replace in Files', category); +MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { + group: '4_find_global', + command: { + id: ReplaceInFilesAction.ID, + title: nls.localize({ key: 'miReplaceInFiles', comment: ['&& denotes a mnemonic'] }, "Replace &&in Files") + }, + order: 2 +}); KeybindingsRegistry.registerCommandAndKeybindingRule(objects.assign({ id: Constants.ToggleCaseSensitiveCommandId, From c846457041672c8e26a0e753f49a71e8bcd8686f Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 24 Jul 2018 18:35:49 +0200 Subject: [PATCH 83/93] Fix registration issue --- src/vs/editor/browser/editorExtensions.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vs/editor/browser/editorExtensions.ts b/src/vs/editor/browser/editorExtensions.ts index 9288855f4c4..1d45a7e2999 100644 --- a/src/vs/editor/browser/editorExtensions.ts +++ b/src/vs/editor/browser/editorExtensions.ts @@ -56,6 +56,7 @@ export abstract class Command { this.id = opts.id; this.precondition = opts.precondition; this._kbOpts = opts.kbOpts; + this._menubarOpts = opts.menubarOpts; this._description = opts.description; } From 605018ad757cc0d41751485c82c0b5120fb57014 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 23 Jul 2018 16:21:03 -0700 Subject: [PATCH 84/93] Settings editor - start fixing up to match new mockups --- .../browser/media/settingsEditor2.css | 28 +++++++++++++++++-- .../preferences/browser/settingsEditor2.ts | 7 ++--- .../parts/preferences/browser/settingsTree.ts | 2 +- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css b/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css index 5b926a5fcd5..4d98af70eb5 100644 --- a/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css +++ b/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css @@ -72,9 +72,9 @@ } .settings-editor > .settings-header > .settings-header-controls { - margin-top: 8px; - height: 30px; + height: 27px; display: flex; + border-bottom: solid #3c3c3c 1px; } .settings-editor > .settings-header .settings-tabs-widget > .monaco-action-bar .action-item:not(:first-child) .action-label { @@ -103,6 +103,20 @@ opacity: 0.7; } +.settings-editor > .settings-header > .settings-header-controls .settings-tabs-widget > .monaco-action-bar .action-item { + padding: 0px; /* padding must be on action-label because it has the bottom-border, because that's where the .checked class is */ +} + +.settings-editor > .settings-header > .settings-header-controls .settings-tabs-widget > .monaco-action-bar .action-item .action-label { + text-transform: none; + font-size: 13px; + + padding-bottom: 3px; + padding-top: 6px; + padding-left: 8px; + padding-right: 8px; +} + .settings-editor > .settings-body { display: flex; margin: auto; @@ -124,6 +138,8 @@ .settings-editor > .settings-body .settings-toc-container { width: 175px; margin-right: 5px; + padding-top: 4px; + box-sizing: border-box; } .settings-editor > .settings-body .settings-toc-container.hidden { @@ -142,6 +158,10 @@ display: none; } +.settings-editor > .settings-body .settings-toc-container .monaco-scrollable-element > .shadow { + display: none; +} + .settings-editor > .settings-body .settings-toc-container .monaco-tree-row .settings-toc-entry { overflow: hidden; text-overflow: ellipsis; @@ -156,6 +176,8 @@ flex: 1; max-width: 875px; margin-right: 1px; /* So the item doesn't blend into the edge of the view container */ + padding-top: 8px; + box-sizing: border-box; border-spacing: 0; border-collapse: separate; position: relative; @@ -309,7 +331,7 @@ } .settings-editor > .settings-body > .settings-tree-container .settings-group-level-1.settings-group-first { - padding-top: 4px; + padding-top: 7px; } .settings-editor > .settings-body .settings-feedback-button { diff --git a/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts b/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts index 8b6d31130d0..dba5125d2b4 100644 --- a/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts @@ -828,7 +828,7 @@ export class SettingsEditor2 extends BaseEditor { } private layoutTrees(dimension: DOM.Dimension): void { - const listHeight = dimension.height - (DOM.getDomNodePagePosition(this.headerContainer).height + 12 /*padding*/); + const listHeight = dimension.height - (DOM.getDomNodePagePosition(this.headerContainer).height + 11 /*padding*/); this.settingsTreeContainer.style.height = `${listHeight}px`; this.settingsTree.layout(listHeight, 800); @@ -837,8 +837,7 @@ export class SettingsEditor2 extends BaseEditor { this.settingsTree.refresh(selectedSetting); } - const tocHeight = listHeight - 5; // padding - this.tocTreeContainer.style.height = `${tocHeight}px`; - this.tocTree.layout(tocHeight, 175); + this.tocTreeContainer.style.height = `${listHeight}px`; + this.tocTree.layout(listHeight, 175); } } diff --git a/src/vs/workbench/parts/preferences/browser/settingsTree.ts b/src/vs/workbench/parts/preferences/browser/settingsTree.ts index 6d76e106d55..6e4c34335dd 100644 --- a/src/vs/workbench/parts/preferences/browser/settingsTree.ts +++ b/src/vs/workbench/parts/preferences/browser/settingsTree.ts @@ -508,7 +508,7 @@ export class SettingsRenderer implements IRenderer { getHeight(tree: ITree, element: SettingsTreeElement): number { if (element instanceof SettingsTreeGroupElement) { if (element.isFirstGroup) { - return 28; + return 31; } return 40 + (7 * element.level); From 2254b1c687f88466c5da7c11ed256261dd39cb4e Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Tue, 24 Jul 2018 10:05:14 -0700 Subject: [PATCH 85/93] Fix smoketest --- test/smoke/src/areas/preferences/keybindings.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/smoke/src/areas/preferences/keybindings.ts b/test/smoke/src/areas/preferences/keybindings.ts index 235621574f0..c9f1273d0c1 100644 --- a/test/smoke/src/areas/preferences/keybindings.ts +++ b/test/smoke/src/areas/preferences/keybindings.ts @@ -21,14 +21,14 @@ export class KeybindingsEditor { await this.code.waitForActiveElement(SEARCH_INPUT); await this.code.waitForSetValue(SEARCH_INPUT, command); - await this.code.waitAndClick('div[aria-label="Keybindings"] .monaco-list-row.keybinding-item'); - await this.code.waitForElement('div[aria-label="Keybindings"] .monaco-list-row.keybinding-item.focused.selected'); + await this.code.waitAndClick('.keybindings-list-container .monaco-list-row.keybinding-item'); + await this.code.waitForElement('.keybindings-list-container .monaco-list-row.keybinding-item.focused.selected'); - await this.code.waitAndClick('div[aria-label="Keybindings"] .monaco-list-row.keybinding-item .action-item .icon.add'); + await this.code.waitAndClick('.keybindings-list-container .monaco-list-row.keybinding-item .action-item .icon.add'); await this.code.waitForActiveElement('.defineKeybindingWidget .monaco-inputbox input'); await this.code.dispatchKeybinding(keybinding); await this.code.dispatchKeybinding('enter'); - await this.code.waitForElement(`div[aria-label="Keybindings"] div[aria-label="Keybinding is ${ariaLabel}."]`); + await this.code.waitForElement(`.keybindings-list-container div[aria-label="Keybinding is ${ariaLabel}."]`); } } \ No newline at end of file From edeb0a3d393dd7b29d9e628a07af17f75a80617c Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Tue, 24 Jul 2018 10:06:18 -0700 Subject: [PATCH 86/93] More settings editor changes - hide actions behind dropdown --- .../browser/media/configure-inverse.svg | 1 + .../preferences/browser/media/configure.svg | 1 + .../browser/media/settingsEditor2.css | 36 +++---- .../preferences/browser/settingsEditor2.ts | 101 +++++++++++++----- 4 files changed, 89 insertions(+), 50 deletions(-) create mode 100644 src/vs/workbench/parts/preferences/browser/media/configure-inverse.svg create mode 100644 src/vs/workbench/parts/preferences/browser/media/configure.svg diff --git a/src/vs/workbench/parts/preferences/browser/media/configure-inverse.svg b/src/vs/workbench/parts/preferences/browser/media/configure-inverse.svg new file mode 100644 index 00000000000..61baaea2b8b --- /dev/null +++ b/src/vs/workbench/parts/preferences/browser/media/configure-inverse.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/vs/workbench/parts/preferences/browser/media/configure.svg b/src/vs/workbench/parts/preferences/browser/media/configure.svg new file mode 100644 index 00000000000..3dec2ba50fd --- /dev/null +++ b/src/vs/workbench/parts/preferences/browser/media/configure.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css b/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css index 4d98af70eb5..8169c6c471a 100644 --- a/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css +++ b/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css @@ -30,19 +30,6 @@ opacity: .7; } -.settings-editor > .settings-header > .settings-advanced-customization .open-settings-button, -.settings-editor > .settings-header > .settings-advanced-customization .open-settings-button:hover, -.settings-editor > .settings-header > .settings-advanced-customization .open-settings-button:active { - padding: 0; - text-decoration: underline; - display: inline; -} - -.settings-editor > .settings-header > .settings-advanced-customization { - opacity: .7; - margin-top: 8px; -} - .settings-editor > .settings-header > .settings-preview-header > .settings-preview-warning { text-align: right; text-transform: uppercase; @@ -92,15 +79,22 @@ display: flex; } -.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right #configured-only-checkbox { - flex-shrink: 0; +.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right .toolbar-toggle-more { + display: block; + width: 16px; + height: 22px; + margin-right: 4px; + margin-left: 4px; + background-position: center; + background-repeat: no-repeat; } -.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right .configured-only-label { - white-space: nowrap; - margin-right: 10px; - margin-left: 2px; - opacity: 0.7; +.vs .settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right .toolbar-toggle-more { + background-image: url('configure.svg'); +} + +.vs-dark .settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right .toolbar-toggle-more { + background-image: url('configure-inverse.svg'); } .settings-editor > .settings-header > .settings-header-controls .settings-tabs-widget > .monaco-action-bar .action-item { @@ -138,7 +132,7 @@ .settings-editor > .settings-body .settings-toc-container { width: 175px; margin-right: 5px; - padding-top: 4px; + padding-top: 8px; box-sizing: border-box; } diff --git a/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts b/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts index dba5125d2b4..4181e4cf3dc 100644 --- a/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts @@ -5,6 +5,8 @@ import * as DOM from 'vs/base/browser/dom'; import { Button } from 'vs/base/browser/ui/button/button'; +import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar'; +import { Action } from 'vs/base/common/actions'; import * as arrays from 'vs/base/common/arrays'; import { Delayer, ThrottledDelayer } from 'vs/base/common/async'; import { CancellationToken } from 'vs/base/common/cancellation'; @@ -19,6 +21,7 @@ import 'vs/css!./media/settingsEditor2'; import { localize } from 'vs/nls'; import { ConfigurationTarget, IConfigurationOverrides, IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { WorkbenchTree, WorkbenchTreeController } from 'vs/platform/list/browser/listService'; @@ -56,8 +59,7 @@ export class SettingsEditor2 extends BaseEditor { private headerContainer: HTMLElement; private searchWidget: SearchWidget; private settingsTargetsWidget: SettingsTargetsWidget; - - private showConfiguredSettingsOnlyCheckbox: HTMLInputElement; + private toolbar: ToolBar; private settingsTreeContainer: HTMLElement; private settingsTree: WorkbenchTree; @@ -99,7 +101,8 @@ export class SettingsEditor2 extends BaseEditor { @IPreferencesSearchService private preferencesSearchService: IPreferencesSearchService, @ILogService private logService: ILogService, @IEnvironmentService private environmentService: IEnvironmentService, - @IContextKeyService contextKeyService: IContextKeyService + @IContextKeyService contextKeyService: IContextKeyService, + @IContextMenuService private contextMenuService: IContextMenuService ) { super(SettingsEditor2.ID, telemetryService, themeService); this.delayedFilterLogging = new Delayer(1000); @@ -203,26 +206,13 @@ export class SettingsEditor2 extends BaseEditor { })); this._register(this.searchWidget.onDidChange(() => this.onSearchInputChanged())); - const advancedCustomization = DOM.append(this.headerContainer, $('.settings-advanced-customization')); - const advancedCustomizationLabel = DOM.append(advancedCustomization, $('span.settings-advanced-customization-label')); - advancedCustomizationLabel.textContent = localize('advancedCustomizationLabel', "For advanced customizations open and edit") + ' '; - const openSettingsButton = this._register(new Button(advancedCustomization, { title: true, buttonBackground: null, buttonHoverBackground: null })); - this._register(attachButtonStyler(openSettingsButton, this.themeService, { - buttonBackground: Color.transparent.toString(), - buttonHoverBackground: Color.transparent.toString(), - buttonForeground: foreground - })); - openSettingsButton.label = localize('openSettingsLabel', "settings.json"); - openSettingsButton.element.classList.add('open-settings-button'); - - this._register(openSettingsButton.onDidClick(() => this.openSettingsFile())); - const headerControlsContainer = DOM.append(this.headerContainer, $('.settings-header-controls')); const targetWidgetContainer = DOM.append(headerControlsContainer, $('.settings-target-container')); this.settingsTargetsWidget = this._register(this.instantiationService.createInstance(SettingsTargetsWidget, targetWidgetContainer)); this.settingsTargetsWidget.settingsTarget = ConfigurationTarget.USER; this.settingsTargetsWidget.onDidTargetChange(() => { this.viewState.settingsTarget = this.settingsTargetsWidget.settingsTarget; + this.toolbar.context = this.settingsTargetsWidget.settingsTarget; this.settingsTreeModel.update(); this.refreshTreeAndMaintainFocus(); @@ -234,13 +224,17 @@ export class SettingsEditor2 extends BaseEditor { private createHeaderControls(parent: HTMLElement): void { const headerControlsContainerRight = DOM.append(parent, $('.settings-header-controls-right')); - this.showConfiguredSettingsOnlyCheckbox = DOM.append(headerControlsContainerRight, $('input#configured-only-checkbox')); - this.showConfiguredSettingsOnlyCheckbox.type = 'checkbox'; - const showConfiguredSettingsOnlyLabel = DOM.append(headerControlsContainerRight, $('label.configured-only-label')); - showConfiguredSettingsOnlyLabel.textContent = localize('showOverriddenOnly', "Show modified only"); - showConfiguredSettingsOnlyLabel.htmlFor = 'configured-only-checkbox'; + this.toolbar = new ToolBar(headerControlsContainerRight, this.contextMenuService, { + ariaLabel: localize('settingsToolbarLabel', "Settings Editor Actions"), + actionRunner: this.actionRunner + }); - this._register(DOM.addDisposableListener(this.showConfiguredSettingsOnlyCheckbox, 'change', e => this.onShowConfiguredOnlyClicked())); + const actions = [ + this.instantiationService.createInstance(ToggleShowModifiedOnlyAction, this, this.viewState), + this.instantiationService.createInstance(OpenSettingsAction) + ]; + this.toolbar.setActions([], actions)(); + this.toolbar.context = this.settingsTargetsWidget.settingsTarget; } private revealSetting(settingName: string): void { @@ -444,12 +438,12 @@ export class SettingsEditor2 extends BaseEditor { })); } - private onShowConfiguredOnlyClicked(): void { - this.viewState.showConfiguredOnly = this.showConfiguredSettingsOnlyCheckbox.checked; - this.refreshTreeAndMaintainFocus(); - this.tocTree.refresh(); - this.settingsTree.setScrollPosition(0); - this.expandAll(this.settingsTree); + toggleShowModifiedOnly(): TPromise { + this.viewState.showConfiguredOnly = !this.viewState.showConfiguredOnly; + return this.refreshTreeAndMaintainFocus().then(() => { + this.settingsTree.setScrollPosition(0); + this.expandAll(this.settingsTree); + }); } private onDidChangeSetting(key: string, value: any): void { @@ -841,3 +835,52 @@ export class SettingsEditor2 extends BaseEditor { this.tocTree.layout(listHeight, 175); } } + +class OpenSettingsAction extends Action { + static readonly ID = 'settings.openSettingsJson'; + static readonly LABEL = localize('openSettingsJsonLabel', "Open settings.json for advanced customizations"); + + constructor( + @IPreferencesService private readonly preferencesService: IPreferencesService, + ) { + super(OpenSettingsAction.ID, OpenSettingsAction.LABEL, 'open-settings-json'); + } + + + run(context?: SettingsTarget): TPromise { + return this._run(context) + .then(() => { }); + } + + private _run(context?: SettingsTarget): TPromise { + if (context === ConfigurationTarget.USER) { + return this.preferencesService.openGlobalSettings(); + } else if (context === ConfigurationTarget.WORKSPACE) { + return this.preferencesService.openWorkspaceSettings(); + } else if (URI.isUri(context)) { + return this.preferencesService.openFolderSettings(context); + } + + return TPromise.wrap(null); + } +} + +class ToggleShowModifiedOnlyAction extends Action { + static readonly ID = 'settings.toggleShowModifiedOnly'; + static readonly LABEL = localize('showModifiedOnlyLabel', "Show modified settings only"); + + get checked(): boolean { + return this.viewState.showConfiguredOnly; + } + + constructor( + private settingsEditor: SettingsEditor2, + private viewState: ISettingsEditorViewState + ) { + super(ToggleShowModifiedOnlyAction.ID, ToggleShowModifiedOnlyAction.LABEL, 'show-modified-only'); + } + + run(): TPromise { + return this.settingsEditor.toggleShowModifiedOnly(); + } +} From 96625aad851b7276446fc751b5f17f0b8fec0d79 Mon Sep 17 00:00:00 2001 From: SteVen Batten <6561887+sbatten@users.noreply.github.com> Date: Tue, 24 Jul 2018 10:11:44 -0700 Subject: [PATCH 87/93] fix #54723 --- src/vs/workbench/browser/parts/menubar/menubarPart.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vs/workbench/browser/parts/menubar/menubarPart.ts b/src/vs/workbench/browser/parts/menubar/menubarPart.ts index 018fded98cd..7e42894981b 100644 --- a/src/vs/workbench/browser/parts/menubar/menubarPart.ts +++ b/src/vs/workbench/browser/parts/menubar/menubarPart.ts @@ -1166,6 +1166,9 @@ class ModifierKeyEmitter extends Emitter { this.fire(this._keyStatus); } })); + this._subscriptions.push(domEvent(document.body, 'mousedown')(e => { + this._keyStatus.lastKeyPressed = undefined; + })); this._subscriptions.push(domEvent(window, 'blur')(e => { this._keyStatus.lastKeyPressed = undefined; From e918835b38b756fbbaa8e1ede949472309d085cb Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Tue, 24 Jul 2018 10:27:07 -0700 Subject: [PATCH 88/93] Settings editor - add badge to actions dropdown --- .../browser/media/settingsEditor2.css | 23 ++++++++++++++++--- .../preferences/browser/settingsEditor2.ts | 1 + .../parts/preferences/browser/settingsTree.ts | 1 + 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css b/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css index 8169c6c471a..bdffa1c3f9e 100644 --- a/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css +++ b/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css @@ -81,10 +81,8 @@ .settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right .toolbar-toggle-more { display: block; - width: 16px; + width: 22px; height: 22px; - margin-right: 4px; - margin-left: 4px; background-position: center; background-repeat: no-repeat; } @@ -97,6 +95,25 @@ background-image: url('configure-inverse.svg'); } +.vs .settings-editor.showing-modified-only > .settings-header > .settings-header-controls .settings-header-controls-right .toolbar-toggle-more::before { + border-color : #fff; +} + +.vs-dark .settings-editor.showing-modified-only > .settings-header > .settings-header-controls .settings-header-controls-right .toolbar-toggle-more::before { + border-color : #000; +} + +.settings-editor.showing-modified-only > .settings-header > .settings-header-controls .settings-header-controls-right .toolbar-toggle-more::before { + content: ""; + width: 6px; + height: 6px; + position: absolute; + top: 3px; + right: 3px; + border-radius: 10px; + border: 1px solid; +} + .settings-editor > .settings-header > .settings-header-controls .settings-tabs-widget > .monaco-action-bar .action-item { padding: 0px; /* padding must be on action-label because it has the bottom-border, because that's where the .checked class is */ } diff --git a/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts b/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts index 4181e4cf3dc..7fe7a471b59 100644 --- a/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts @@ -440,6 +440,7 @@ export class SettingsEditor2 extends BaseEditor { toggleShowModifiedOnly(): TPromise { this.viewState.showConfiguredOnly = !this.viewState.showConfiguredOnly; + DOM.toggleClass(this.rootElement, 'showing-modified-only', this.viewState.showConfiguredOnly); return this.refreshTreeAndMaintainFocus().then(() => { this.settingsTree.setScrollPosition(0); this.expandAll(this.settingsTree); diff --git a/src/vs/workbench/parts/preferences/browser/settingsTree.ts b/src/vs/workbench/parts/preferences/browser/settingsTree.ts index 6e4c34335dd..a43b504ff51 100644 --- a/src/vs/workbench/parts/preferences/browser/settingsTree.ts +++ b/src/vs/workbench/parts/preferences/browser/settingsTree.ts @@ -66,6 +66,7 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => { const modifiedItemForegroundColor = theme.getColor(modifiedItemForeground); if (modifiedItemForegroundColor) { collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-is-configured-label { color: ${modifiedItemForegroundColor}; }`); + collector.addRule(`.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right .toolbar-toggle-more::before { background-color: ${modifiedItemForegroundColor}; }`); } const checkboxBackgroundColor = theme.getColor(settingsCheckboxBackground); From 3775e829b9d6a4a488afb3a150336fd45246865b Mon Sep 17 00:00:00 2001 From: SteVen Batten <6561887+sbatten@users.noreply.github.com> Date: Tue, 24 Jul 2018 11:14:10 -0700 Subject: [PATCH 89/93] fixes #53808 --- .../browser/parts/menubar/media/menubarpart.css | 9 ++++++--- src/vs/workbench/browser/parts/menubar/menubarPart.ts | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/browser/parts/menubar/media/menubarpart.css b/src/vs/workbench/browser/parts/menubar/media/menubarpart.css index 5b52a860a93..9b4ab103998 100644 --- a/src/vs/workbench/browser/parts/menubar/media/menubarpart.css +++ b/src/vs/workbench/browser/parts/menubar/media/menubarpart.css @@ -35,12 +35,15 @@ position: absolute; left: 0px; opacity: 1; + z-index: 2000; } .menubar-menu-items-holder.monaco-menu-container { - box-shadow: 0 2px 4px; + font-family: "Segoe WPC", "Segoe UI", ".SFNSDisplay-Light", "SFUIText-Light", "HelveticaNeue-Light", sans-serif, "Droid Sans Fallback"; + outline: 0; + border: none; } -.vs-dark .menubar-menu-items-holder.monaco-menu-container { - box-shadow: 0 2px 4px; +.menubar-menu-items-holder.monaco-menu-container :focus { + outline: 0; } \ No newline at end of file diff --git a/src/vs/workbench/browser/parts/menubar/menubarPart.ts b/src/vs/workbench/browser/parts/menubar/menubarPart.ts index 7e42894981b..7515a99f803 100644 --- a/src/vs/workbench/browser/parts/menubar/menubarPart.ts +++ b/src/vs/workbench/browser/parts/menubar/menubarPart.ts @@ -867,8 +867,6 @@ export class MenubarPart extends Part { let menuHolder = $(customMenu.buttonElement).div({ class: 'menubar-menu-items-holder' }); $(menuHolder.getHTMLElement().parentElement).addClass('open'); - - menuHolder.addClass('menubar-menu-items-holder-open context-view'); menuHolder.style({ 'zoom': `${1 / browser.getZoomFactor()}`, 'top': `${this.container.getClientArea().height * browser.getZoomFactor()}px` From b94c44e719c309b6871264936da582a1ad03dace Mon Sep 17 00:00:00 2001 From: Ramya Rao Date: Tue, 24 Jul 2018 12:17:49 -0700 Subject: [PATCH 90/93] zh-hans and zh-hant are invalid locales (#54696) * zh-hans and zh-hant are invalid locales * Allow more than 1 result in the gallery query --- .../localizations.contribution.ts | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/vs/workbench/parts/localizations/electron-browser/localizations.contribution.ts b/src/vs/workbench/parts/localizations/electron-browser/localizations.contribution.ts index 340f821e0f4..ef0e09b3c44 100644 --- a/src/vs/workbench/parts/localizations/electron-browser/localizations.contribution.ts +++ b/src/vs/workbench/parts/localizations/electron-browser/localizations.contribution.ts @@ -141,19 +141,15 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo return; } - const extensionIdPostfix = this.getPossibleChineseMapping(locale); - const ceintlExtensionSearch = this.galleryService.query({ names: [`MS-CEINTL.vscode-language-pack-${extensionIdPostfix}`], pageSize: 1 }); - const tagSearch = this.galleryService.query({ text: `tag:lp-${locale}`, pageSize: 1 }); - - TPromise.join([ceintlExtensionSearch, tagSearch]).then(([ceintlResult, tagResult]) => { - if (ceintlResult.total === 0 && tagResult.total === 0) { + this.galleryService.query({ text: `tag:lp-${locale}` }).then(tagResult => { + if (tagResult.total === 0) { return; } - const extensionToInstall = ceintlResult.total === 1 ? ceintlResult.firstPage[0] : tagResult.total === 1 ? tagResult.firstPage[0] : null; - const extensionToFetchTranslationsFrom = extensionToInstall || (tagResult.total > 0 ? tagResult.firstPage[0] : null); + const extensionToInstall = tagResult.total === 1 ? tagResult.firstPage[0] : tagResult.firstPage.filter(e => e.publisher === 'MS-CEINTL' && e.name.indexOf('vscode-language-pack') === 0)[0]; + const extensionToFetchTranslationsFrom = extensionToInstall || tagResult.firstPage[0]; - if (!extensionToFetchTranslationsFrom || !extensionToFetchTranslationsFrom.assets.manifest) { + if (!extensionToFetchTranslationsFrom.assets.manifest) { return; } @@ -236,11 +232,6 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo } - private getPossibleChineseMapping(locale: string): string { - locale = locale.toLowerCase(); - return locale === 'zh-cn' ? 'zh-hans' : locale === 'zh-tw' ? 'zh-hant' : locale; - } - private getLanguagePackExtension(language: string): TPromise { return this.localizationService.getLanguageIds(LanguageType.Core) .then(coreLanguages => { From 4be0f0723091ae10b14ba20b334847d607bb7d55 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 24 Jul 2018 15:08:46 -0700 Subject: [PATCH 91/93] Add WebviewPanel.iconPath (#54912) * Add WebviewPanel.iconPath Allows webviews to provide icons used in UI. Adds a new `WebviewPanel.iconPath` property for this. Replaces the static contribution approach from #49657 Fixes #48864 * Fix doc * Move icon into mainthreadwebview * Cleaning up implementation * Cleaning up implementation --- .../src/extension.ts | 2 +- .../src/features/preview.ts | 9 +++ .../src/markdownExtensions.ts | 9 ++- .../src/test/engine.ts | 1 + src/vs/vscode.d.ts | 5 ++ .../api/electron-browser/mainThreadWebview.ts | 71 +++++++++++++++++-- src/vs/workbench/api/node/extHost.protocol.ts | 1 + src/vs/workbench/api/node/extHostWebview.ts | 28 ++++++-- .../webview/electron-browser/webviewEditor.ts | 4 +- .../electron-browser/webviewEditorInput.ts | 24 +++++-- 10 files changed, 132 insertions(+), 22 deletions(-) diff --git a/extensions/markdown-language-features/src/extension.ts b/extensions/markdown-language-features/src/extension.ts index a9d95e36ce8..7786db20216 100644 --- a/extensions/markdown-language-features/src/extension.ts +++ b/extensions/markdown-language-features/src/extension.ts @@ -24,7 +24,7 @@ export function activate(context: vscode.ExtensionContext) { const telemetryReporter = loadDefaultTelemetryReporter(); context.subscriptions.push(telemetryReporter); - const contributions = getMarkdownExtensionContributions(); + const contributions = getMarkdownExtensionContributions(context); const cspArbiter = new ExtensionContentSecurityPolicyArbiter(context.globalState, context.workspaceState); const engine = new MarkdownEngine(contributions, githubSlugifier); diff --git a/extensions/markdown-language-features/src/features/preview.ts b/extensions/markdown-language-features/src/features/preview.ts index 2f4993fa13a..f15efe24098 100644 --- a/extensions/markdown-language-features/src/features/preview.ts +++ b/extensions/markdown-language-features/src/features/preview.ts @@ -271,6 +271,14 @@ export class MarkdownPreview { this.editor.title = MarkdownPreview.getPreviewTitle(this._resource, this._locked); } + private get iconPath() { + const root = path.join(this._contributions.extensionPath, 'media'); + return { + light: vscode.Uri.file(path.join(root, 'Preview.svg')), + dark: vscode.Uri.file(path.join(root, 'Preview_inverse.svg')) + }; + } + private isPreviewOf(resource: vscode.Uri): boolean { return this._resource.fsPath === resource.fsPath; } @@ -327,6 +335,7 @@ export class MarkdownPreview { const content = await this._contentProvider.provideTextDocumentContent(document, this._previewConfigurations, this.line, this.state); if (this._resource === resource) { this.editor.title = MarkdownPreview.getPreviewTitle(this._resource, this._locked); + this.editor.iconPath = this.iconPath; this.editor.webview.options = MarkdownPreview.getWebviewOptions(resource, this._contributions); this.editor.webview.html = content; } diff --git a/extensions/markdown-language-features/src/markdownExtensions.ts b/extensions/markdown-language-features/src/markdownExtensions.ts index a9ef207cf38..55c8d76e7a4 100644 --- a/extensions/markdown-language-features/src/markdownExtensions.ts +++ b/extensions/markdown-language-features/src/markdownExtensions.ts @@ -26,6 +26,7 @@ const resolveExtensionResources = (extension: vscode.Extension, resourcePat }; export interface MarkdownContributions { + readonly extensionPath: string; readonly previewScripts: vscode.Uri[]; readonly previewStyles: vscode.Uri[]; readonly markdownItPlugins: Thenable<(md: any) => any>[]; @@ -40,6 +41,10 @@ class MarkdownExtensionContributions implements MarkdownContributions { private _loaded = false; + public constructor( + public readonly extensionPath: string, + ) { } + public get previewScripts(): vscode.Uri[] { this.ensureLoaded(); return this._scripts; @@ -111,6 +116,6 @@ class MarkdownExtensionContributions implements MarkdownContributions { } } -export function getMarkdownExtensionContributions(): MarkdownContributions { - return new MarkdownExtensionContributions(); +export function getMarkdownExtensionContributions(context: vscode.ExtensionContext): MarkdownContributions { + return new MarkdownExtensionContributions(context.extensionPath); } \ No newline at end of file diff --git a/extensions/markdown-language-features/src/test/engine.ts b/extensions/markdown-language-features/src/test/engine.ts index 860bafad7cc..a1834e057a2 100644 --- a/extensions/markdown-language-features/src/test/engine.ts +++ b/extensions/markdown-language-features/src/test/engine.ts @@ -9,6 +9,7 @@ import { MarkdownContributions } from '../markdownExtensions'; import { githubSlugifier } from '../slugify'; const emptyContributions = new class implements MarkdownContributions { + readonly extensionPath = ''; readonly previewScripts: vscode.Uri[] = []; readonly previewStyles: vscode.Uri[] = []; readonly previewResourceRoots: vscode.Uri[] = []; diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 607f418e181..ac726df3447 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -5500,6 +5500,11 @@ declare module 'vscode' { */ title: string; + /** + * Icon for the panel shown in UI. + */ + iconPath?: Uri | { light: Uri; dark: Uri }; + /** * Webview belonging to the panel. */ diff --git a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts index 8def9ec323a..9e36bedbf59 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts @@ -2,23 +2,24 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IDisposable, dispose } from 'vs/base/common/lifecycle'; +import * as dom from 'vs/base/browser/dom'; +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 { TPromise } from 'vs/base/common/winjs.base'; import { localize } from 'vs/nls'; -import { EditorViewColumn, viewColumnToEditorGroup, editorGroupToViewColumn } from 'vs/workbench/api/shared/editor'; import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import { ExtHostContext, ExtHostWebviewsShape, IExtHostContext, MainContext, MainThreadWebviewsShape, WebviewPanelHandle } from 'vs/workbench/api/node/extHost.protocol'; +import { editorGroupToViewColumn, EditorViewColumn, viewColumnToEditorGroup } from 'vs/workbench/api/shared/editor'; import { WebviewEditor } from 'vs/workbench/parts/webview/electron-browser/webviewEditor'; import { WebviewEditorInput } from 'vs/workbench/parts/webview/electron-browser/webviewEditorInput'; -import { IWebviewEditorService, WebviewInputOptions, WebviewReviver, ICreateWebViewShowOptions } from 'vs/workbench/parts/webview/electron-browser/webviewEditorService'; +import { ICreateWebViewShowOptions, IWebviewEditorService, WebviewInputOptions, WebviewReviver } from 'vs/workbench/parts/webview/electron-browser/webviewEditorService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService'; -import { extHostNamedCustomer } from './extHostCustomers'; import * as vscode from 'vscode'; +import { extHostNamedCustomer } from './extHostCustomers'; @extHostNamedCustomer(MainContext.MainThreadWebviews) export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviver { @@ -29,6 +30,39 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv private static revivalPool = 0; + private static _styleElement?: HTMLStyleElement; + + private static _icons = new Map(); + + private static updateStyleElement( + webview: WebviewEditorInput, + iconPath: { light: URI, dark: URI } | undefined + ) { + const id = webview.getId(); + if (!this._styleElement) { + this._styleElement = dom.createStyleSheet(); + this._styleElement.className = 'webview-icons'; + } + + if (!iconPath) { + this._icons.delete(id); + } else { + this._icons.set(id, iconPath); + } + + const cssRules: string[] = []; + this._icons.forEach((value, key) => { + const webviewSelector = `.show-file-icons .webview-${key}-name-file-icon::before`; + if (URI.isUri(value)) { + cssRules.push(`${webviewSelector} { content: ""; background-image: url(${value.toString()}); }`); + } else { + cssRules.push(`${webviewSelector} { content: ""; background-image: url(${value.light.toString()}); }`); + cssRules.push(`.vs-dark ${webviewSelector} { content: ""; background-image: url(${value.dark.toString()}); }`); + } + }); + this._styleElement.innerHTML = cssRules.join('\n'); + } + private _toDispose: IDisposable[] = []; private readonly _proxy: ExtHostWebviewsShape; @@ -96,6 +130,11 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv webview.setName(value); } + public $setIconPath(handle: WebviewPanelHandle, value: { light: UriComponents, dark: UriComponents } | undefined): void { + const webview = this.getWebview(handle); + MainThreadWebviews.updateStyleElement(webview, reviveWebviewIcon(value)); + } + public $setHtml(handle: WebviewPanelHandle, value: string): void { const webview = this.getWebview(handle); webview.html = value; @@ -185,9 +224,16 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv onDidClickLink: uri => this.onDidClickLink(handle, uri), onMessage: message => this._proxy.$onMessage(handle, message), onDispose: () => { + const cleanUp = () => { + const webview = this._webviews.get(handle); + if (webview) { + MainThreadWebviews.updateStyleElement(webview, undefined); + } + this._webviews.delete(handle); + }; this._proxy.$onDidDisposeWebviewPanel(handle).then( - () => this._webviews.delete(handle), - () => this._webviews.delete(handle)); + cleanUp, + cleanUp); } }; } @@ -297,3 +343,16 @@ function reviveWebviewOptions(options: WebviewInputOptions): WebviewInputOptions localResourceRoots: Array.isArray(options.localResourceRoots) ? options.localResourceRoots.map(URI.revive) : undefined }; } + +function reviveWebviewIcon( + value: { light: UriComponents, dark: UriComponents } | undefined +): { light: URI, dark: URI } | undefined { + if (!value) { + return undefined; + } + + return { + light: URI.revive(value.light), + dark: URI.revive(value.dark) + }; +} \ No newline at end of file diff --git a/src/vs/workbench/api/node/extHost.protocol.ts b/src/vs/workbench/api/node/extHost.protocol.ts index 44947586fd5..dcccdfd0bf9 100644 --- a/src/vs/workbench/api/node/extHost.protocol.ts +++ b/src/vs/workbench/api/node/extHost.protocol.ts @@ -430,6 +430,7 @@ export interface MainThreadWebviewsShape extends IDisposable { $disposeWebview(handle: WebviewPanelHandle): void; $reveal(handle: WebviewPanelHandle, viewColumn: EditorViewColumn | null, preserveFocus: boolean): void; $setTitle(handle: WebviewPanelHandle, value: string): void; + $setIconPath(handle: WebviewPanelHandle, value: { light: UriComponents, dark: UriComponents } | undefined): void; $setHtml(handle: WebviewPanelHandle, value: string): void; $setOptions(handle: WebviewPanelHandle, options: vscode.WebviewOptions): void; $postMessage(handle: WebviewPanelHandle, value: any): Thenable; diff --git a/src/vs/workbench/api/node/extHostWebview.ts b/src/vs/workbench/api/node/extHostWebview.ts index 0ad6b97fa30..78fb98240ea 100644 --- a/src/vs/workbench/api/node/extHostWebview.ts +++ b/src/vs/workbench/api/node/extHostWebview.ts @@ -3,14 +3,17 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { MainContext, MainThreadWebviewsShape, IMainContext, ExtHostWebviewsShape, WebviewPanelHandle, WebviewPanelViewState } from './extHost.protocol'; -import * as vscode from 'vscode'; -import { Event, Emitter } from 'vs/base/common/event'; +import { Emitter, Event } from 'vs/base/common/event'; +import URI from 'vs/base/common/uri'; +import { TPromise } from 'vs/base/common/winjs.base'; import * as typeConverters from 'vs/workbench/api/node/extHostTypeConverters'; import { EditorViewColumn } from 'vs/workbench/api/shared/editor'; -import { TPromise } from 'vs/base/common/winjs.base'; +import * as vscode from 'vscode'; +import { ExtHostWebviewsShape, IMainContext, MainContext, MainThreadWebviewsShape, WebviewPanelHandle, WebviewPanelViewState } from './extHost.protocol'; import { Disposable } from './extHostTypes'; -import URI from 'vs/base/common/uri'; + + +type IconPath = URI | { light: URI, dark: URI }; export class ExtHostWebview implements vscode.Webview { private readonly _handle: WebviewPanelHandle; @@ -78,6 +81,7 @@ export class ExtHostWebviewPanel implements vscode.WebviewPanel { private readonly _proxy: MainThreadWebviewsShape; private readonly _viewType: string; private _title: string; + private _iconPath: IconPath; private readonly _options: vscode.WebviewPanelOptions; private readonly _webview: ExtHostWebview; @@ -150,6 +154,20 @@ export class ExtHostWebviewPanel implements vscode.WebviewPanel { } } + get iconPath(): IconPath | undefined { + this.assertNotDisposed(); + return this._iconPath; + } + + set iconPath(value: IconPath | undefined) { + this.assertNotDisposed(); + if (this._iconPath !== value) { + this._iconPath = value; + + this._proxy.$setIconPath(this._handle, URI.isUri(value) ? { light: value, dark: value } : value); + } + } + get options() { return this._options; } diff --git a/src/vs/workbench/parts/webview/electron-browser/webviewEditor.ts b/src/vs/workbench/parts/webview/electron-browser/webviewEditor.ts index 82252859c77..8eb67ef6b68 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webviewEditor.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webviewEditor.ts @@ -5,6 +5,7 @@ import * as DOM from 'vs/base/browser/dom'; import { domEvent } from 'vs/base/browser/event'; +import { CancellationToken } from 'vs/base/common/cancellation'; import { Emitter, Event } from 'vs/base/common/event'; import { IDisposable } from 'vs/base/common/lifecycle'; import URI from 'vs/base/common/uri'; @@ -14,13 +15,12 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { EditorOptions } from 'vs/workbench/common/editor'; -import { IEditorGroup } from 'vs/workbench/services/group/common/editorGroupsService'; import { WebviewEditorInput } from 'vs/workbench/parts/webview/electron-browser/webviewEditorInput'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; +import { IEditorGroup } from 'vs/workbench/services/group/common/editorGroupsService'; import { IPartService, Parts } from 'vs/workbench/services/part/common/partService'; import { BaseWebviewEditor, KEYBINDING_CONTEXT_WEBVIEWEDITOR_FIND_WIDGET_INPUT_FOCUSED, KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE } from './baseWebviewEditor'; import { WebviewElement } from './webviewElement'; -import { CancellationToken } from 'vs/base/common/cancellation'; export class WebviewEditor extends BaseWebviewEditor { diff --git a/src/vs/workbench/parts/webview/electron-browser/webviewEditorInput.ts b/src/vs/workbench/parts/webview/electron-browser/webviewEditorInput.ts index 6d48bf36101..07f44326ef7 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webviewEditorInput.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webviewEditorInput.ts @@ -3,15 +3,16 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IDisposable, dispose } from 'vs/base/common/lifecycle'; +import { Emitter } from 'vs/base/common/event'; +import { dispose, IDisposable } from 'vs/base/common/lifecycle'; import URI from 'vs/base/common/uri'; import { TPromise } from 'vs/base/common/winjs.base'; import { IEditorModel } from 'vs/platform/editor/common/editor'; -import { EditorInput, EditorModel, IEditorInput, GroupIdentifier } from 'vs/workbench/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 { WebviewElement } from './webviewElement'; -import * as vscode from 'vscode'; export class WebviewEditorInput extends EditorInput { private static handlePool = 0; @@ -35,6 +36,7 @@ export class WebviewEditorInput extends EditorInput { private _revived: boolean = false; public readonly extensionLocation: URI | undefined; + private readonly _id: number; constructor( public readonly viewType: string, @@ -47,6 +49,7 @@ export class WebviewEditorInput extends EditorInput { @IPartService private readonly _partService: IPartService, ) { super(); + this._id = WebviewEditorInput.handlePool++; this._name = name; this._options = options; this._events = events; @@ -58,6 +61,13 @@ export class WebviewEditorInput extends EditorInput { return WebviewEditorInput.typeId; } + public getId(): number { + return this._id; + } + + private readonly _onDidChangeIcon = this._register(new Emitter()); + public readonly onDidChangeIcon = this._onDidChangeIcon.event; + public dispose() { this.disposeWebview(); @@ -76,7 +86,10 @@ export class WebviewEditorInput extends EditorInput { } public getResource(): URI { - return null; + return URI.from({ + scheme: 'webview-panel', + path: `webview-panel/webview-${this._id}` + }); } public getName(): string { @@ -169,9 +182,8 @@ export class WebviewEditorInput extends EditorInput { public get container(): HTMLElement { if (!this._container) { - const id = WebviewEditorInput.handlePool++; this._container = document.createElement('div'); - this._container.id = `webview-${id}`; + this._container.id = `webview-${this._id}`; this._partService.getContainer(Parts.EDITOR_PART).appendChild(this._container); } return this._container; From 8e92f803c8ad9302f4aa3da26490cf6b856af9ea Mon Sep 17 00:00:00 2001 From: Ramya Achutha Rao Date: Tue, 24 Jul 2018 15:20:22 -0700 Subject: [PATCH 92/93] Remove unused variable --- .../telemetry/common/telemetryService.ts | 3 +-- .../electron-browser/telemetryService.test.ts | 26 ++----------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/src/vs/platform/telemetry/common/telemetryService.ts b/src/vs/platform/telemetry/common/telemetryService.ts index dba27cde4b1..0b8470198a3 100644 --- a/src/vs/platform/telemetry/common/telemetryService.ts +++ b/src/vs/platform/telemetry/common/telemetryService.ts @@ -21,7 +21,6 @@ export interface ITelemetryServiceConfig { appender: ITelemetryAppender; commonProperties?: TPromise<{ [name: string]: any }>; piiPaths?: string[]; - userOptIn?: boolean; } export class TelemetryService implements ITelemetryService { @@ -46,7 +45,7 @@ export class TelemetryService implements ITelemetryService { this._appender = config.appender; this._commonProperties = config.commonProperties || TPromise.as({}); this._piiPaths = config.piiPaths || []; - this._userOptIn = typeof config.userOptIn === 'undefined' ? true : config.userOptIn; + this._userOptIn = true; // static cleanup pattern for: `file:///DANGEROUS/PATH/resources/app/Useful/Information` this._cleanupPatterns = [/file:\/\/\/.*?\/resources\/app\//gi]; diff --git a/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts b/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts index 83ff1f5b7a8..8cd91f0803b 100644 --- a/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts +++ b/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts @@ -14,8 +14,6 @@ import * as Errors from 'vs/base/common/errors'; import * as sinon from 'sinon'; import { getConfigurationValue } from 'vs/platform/configuration/common/configuration'; -const optInStatusEventName: string = 'optInStatus'; - class TestTelemetryAppender implements ITelemetryAppender { public events: any[]; @@ -719,29 +717,9 @@ suite('TelemetryService', () => { } })); - test('Telemetry Service respects user opt-in settings', sinon.test(function () { + test('Telemetry Service sends events when enableTelemetry is on', sinon.test(function () { let testAppender = new TestTelemetryAppender(); - let service = new TelemetryService({ userOptIn: false, appender: testAppender }, undefined); - - return service.publicLog('testEvent').then(() => { - assert.equal(testAppender.getEventsCount(), 0); - service.dispose(); - }); - })); - - test('Telemetry Service does not sent optInStatus when user opted out', sinon.test(function () { - let testAppender = new TestTelemetryAppender(); - let service = new TelemetryService({ userOptIn: false, appender: testAppender }, undefined); - - return service.publicLog(optInStatusEventName, { optIn: false }).then(() => { - assert.equal(testAppender.getEventsCount(), 0); - service.dispose(); - }); - })); - - test('Telemetry Service sends events when enableTelemetry is on even user optin is on', sinon.test(function () { - let testAppender = new TestTelemetryAppender(); - let service = new TelemetryService({ userOptIn: true, appender: testAppender }, undefined); + let service = new TelemetryService({ appender: testAppender }, undefined); return service.publicLog('testEvent').then(() => { assert.equal(testAppender.getEventsCount(), 1); From 0d2ac78d26e864c22a9e7ea2d9099c6725a48e4d Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Tue, 24 Jul 2018 15:49:34 -0700 Subject: [PATCH 93/93] Settings editor - use lighter color for headings and active TOC item --- .../browser/media/settingsEditor2.css | 61 +++++--- .../preferences/browser/settingsEditor2.ts | 92 ++++-------- .../parts/preferences/browser/settingsTree.ts | 135 +++++++++++++++--- 3 files changed, 178 insertions(+), 110 deletions(-) diff --git a/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css b/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css index bdffa1c3f9e..4301d35c32f 100644 --- a/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css +++ b/src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css @@ -8,16 +8,14 @@ } .settings-editor { - padding-top: 11px; - padding-left: 5px; - max-width: 1100px; + padding: 11px 0px 24px 0px; + max-width: 1000px; margin: auto; } /* header styling */ .settings-editor > .settings-header { - padding-left: 17px; - padding-right: 11px; + padding-right: 24px; box-sizing: border-box; margin: auto; } @@ -55,17 +53,25 @@ .settings-editor > .settings-header .search-container > .settings-search-input > .monaco-inputbox .input { font-size: 14px; - padding-left: 10px; + padding-left: 9px; } .settings-editor > .settings-header > .settings-header-controls { - height: 27px; + height: 29px; display: flex; - border-bottom: solid #3c3c3c 1px; + border-bottom: solid 1px; } -.settings-editor > .settings-header .settings-tabs-widget > .monaco-action-bar .action-item:not(:first-child) .action-label { - margin-left: 14px; +.vs .settings-editor > .settings-header > .settings-header-controls { + color: #6c6c6c; +} + +.vs-dark .settings-editor > .settings-header > .settings-header-controls { + color: #3c3c3c; +} + +.settings-editor > .settings-header .settings-tabs-widget > .monaco-action-bar .action-item .action-label { + margin-right: 0px; } .settings-editor > .settings-header .settings-tabs-widget .monaco-action-bar .action-item .dropdown-icon { @@ -75,7 +81,7 @@ .settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right { margin-left: auto; - padding-top: 3px; + padding-top: 4px; display: flex; } @@ -122,16 +128,16 @@ text-transform: none; font-size: 13px; - padding-bottom: 3px; - padding-top: 6px; - padding-left: 8px; - padding-right: 8px; + padding-bottom: 4px; + padding-top: 7px; + padding-left: 9px; + padding-right: 9px; } .settings-editor > .settings-body { display: flex; margin: auto; - max-width: 1100px; + max-width: 1000px; justify-content: space-between; } @@ -141,14 +147,13 @@ .settings-editor > .settings-body .settings-tree-container .monaco-tree-wrapper, .settings-editor > .settings-body > .settings-tree-container .setting-measure-container { - /** Allocate space for the scrollbar */ - width: calc(100% - 11px) + /** Match header padding, leave room for scrollbar on the outside */ + width: calc(100% - 24px) } .settings-editor > .settings-body .settings-toc-container { - width: 175px; - margin-right: 5px; + width: 160px; padding-top: 8px; box-sizing: border-box; } @@ -177,15 +182,29 @@ overflow: hidden; text-overflow: ellipsis; line-height: 22px; + opacity: 0.7; +} + +.settings-editor > .settings-body .settings-toc-container .monaco-tree-row.has-children > .content:before { + opacity: 0.7; +} + +.settings-editor > .settings-body .settings-toc-container .monaco-tree-row.has-children.selected > .content:before { + opacity: 1; } .settings-editor > .settings-body .settings-toc-container .monaco-tree-row .settings-toc-entry.no-results { opacity: 0.5; } +.settings-editor > .settings-body .settings-toc-container .monaco-tree-row.selected .settings-toc-entry { + font-weight: bold; + opacity: 1; +} + .settings-editor > .settings-body .settings-tree-container { flex: 1; - max-width: 875px; + max-width: 792px; margin-right: 1px; /* So the item doesn't blend into the edge of the view container */ padding-top: 8px; box-sizing: border-box; diff --git a/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts b/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts index 7fe7a471b59..161504cd879 100644 --- a/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/parts/preferences/browser/settingsEditor2.ts @@ -11,12 +11,11 @@ import * as arrays from 'vs/base/common/arrays'; import { Delayer, ThrottledDelayer } from 'vs/base/common/async'; import { CancellationToken } from 'vs/base/common/cancellation'; import * as collections from 'vs/base/common/collections'; -import { Color, RGBA } from 'vs/base/common/color'; import { getErrorMessage, isPromiseCanceledError } from 'vs/base/common/errors'; import URI from 'vs/base/common/uri'; import { TPromise } from 'vs/base/common/winjs.base'; import { ITree, ITreeConfiguration } from 'vs/base/parts/tree/browser/tree'; -import { DefaultTreestyler, OpenMode } from 'vs/base/parts/tree/browser/treeDefaults'; +import { OpenMode, DefaultTreestyler } from 'vs/base/parts/tree/browser/treeDefaults'; import 'vs/css!./media/settingsEditor2'; import { localize } from 'vs/nls'; import { ConfigurationTarget, IConfigurationOverrides, IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -27,28 +26,22 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { WorkbenchTree, WorkbenchTreeController } from 'vs/platform/list/browser/listService'; import { ILogService } from 'vs/platform/log/common/log'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { editorBackground, focusBorder, foreground, registerColor } from 'vs/platform/theme/common/colorRegistry'; import { attachButtonStyler, attachStyler } from 'vs/platform/theme/common/styler'; -import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; +import { IThemeService } from 'vs/platform/theme/common/themeService'; import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; import { EditorOptions, IEditor } from 'vs/workbench/common/editor'; import { SearchWidget, SettingsTarget, SettingsTargetsWidget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets'; import { commonlyUsedData, tocData } from 'vs/workbench/parts/preferences/browser/settingsLayout'; -import { ISettingsEditorViewState, NonExpandableTree, resolveExtensionsSettings, resolveSettingsTree, SearchResultIdx, SearchResultModel, SettingsAccessibilityProvider, SettingsDataSource, SettingsRenderer, SettingsTreeController, SettingsTreeElement, SettingsTreeFilter, SettingsTreeGroupElement, SettingsTreeModel, SettingsTreeSettingElement } from 'vs/workbench/parts/preferences/browser/settingsTree'; +import { ISettingsEditorViewState, resolveExtensionsSettings, resolveSettingsTree, SearchResultIdx, SearchResultModel, SettingsRenderer, SettingsTree, SettingsTreeElement, SettingsTreeFilter, SettingsTreeGroupElement, SettingsTreeModel, SettingsTreeSettingElement, settingsHeaderForeground } from 'vs/workbench/parts/preferences/browser/settingsTree'; import { TOCDataSource, TOCRenderer, TOCTreeModel } from 'vs/workbench/parts/preferences/browser/tocTree'; import { CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_FIRST_ROW_FOCUS, CONTEXT_SETTINGS_ROW_FOCUS, CONTEXT_SETTINGS_SEARCH_FOCUS, CONTEXT_TOC_ROW_FOCUS, IPreferencesSearchService, ISearchProvider } from 'vs/workbench/parts/preferences/common/preferences'; import { IPreferencesService, ISearchResult, ISettingsEditorModel } from 'vs/workbench/services/preferences/common/preferences'; import { SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput'; import { DefaultSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels'; +import { editorBackground, foreground } from 'vs/platform/theme/common/colorRegistry'; const $ = DOM.$; -export const settingItemInactiveSelectionBorder = registerColor('settings.inactiveSelectedItemBorder', { - dark: '#3F3F46', - light: '#CCCEDB', - hc: null -}, localize('settingItemInactiveSelectionBorder', "The color of the selected setting row border, when the settings list does not have focus.")); - export class SettingsEditor2 extends BaseEditor { public static readonly ID: string = 'workbench.editor.settings2'; @@ -63,7 +56,6 @@ export class SettingsEditor2 extends BaseEditor { private settingsTreeContainer: HTMLElement; private settingsTree: WorkbenchTree; - private treeDataSource: SettingsDataSource; private tocTreeModel: TOCTreeModel; private settingsTreeModel: SettingsTreeModel; @@ -282,12 +274,29 @@ export class SettingsEditor2 extends BaseEditor { dataSource: tocDataSource, renderer: tocRenderer, controller: this.instantiationService.createInstance(WorkbenchTreeController, { openMode: OpenMode.DOUBLE_CLICK }), - filter: this.instantiationService.createInstance(SettingsTreeFilter, this.viewState) + filter: this.instantiationService.createInstance(SettingsTreeFilter, this.viewState), + styler: new DefaultTreestyler(DOM.createStyleSheet(), 'settings-toc-tree'), }, { showLoading: false, twistiePixels: 15 }); + this.tocTree.getHTMLElement().classList.add('settings-toc-tree'); + + this._register(attachStyler(this.themeService, { + listActiveSelectionBackground: editorBackground, + listActiveSelectionForeground: settingsHeaderForeground, + listFocusAndSelectionBackground: editorBackground, + listFocusAndSelectionForeground: settingsHeaderForeground, + listFocusBackground: editorBackground, + listFocusForeground: settingsHeaderForeground, + listHoverForeground: foreground, + listHoverBackground: editorBackground, + listInactiveSelectionBackground: editorBackground, + listInactiveSelectionForeground: settingsHeaderForeground, + }, colors => { + this.tocTree.style(colors); + })); this._register(this.tocTree.onDidChangeFocus(e => { const element = e.focus; @@ -301,7 +310,6 @@ export class SettingsEditor2 extends BaseEditor { this.settingsTree.setFocus(element); } } - })); this._register(this.tocTree.onDidFocus(() => { @@ -323,66 +331,18 @@ export class SettingsEditor2 extends BaseEditor { private createSettingsTree(parent: HTMLElement): void { this.settingsTreeContainer = DOM.append(parent, $('.settings-tree-container')); - this.treeDataSource = this.instantiationService.createInstance(SettingsDataSource, this.viewState); const renderer = this.instantiationService.createInstance(SettingsRenderer, this.settingsTreeContainer); this._register(renderer.onDidChangeSetting(e => this.onDidChangeSetting(e.key, e.value))); this._register(renderer.onDidOpenSettings(() => this.openSettingsFile())); this._register(renderer.onDidClickSettingLink(settingName => this.revealSetting(settingName))); - const treeClass = 'settings-editor-tree'; - this.settingsTree = this.instantiationService.createInstance(NonExpandableTree, this.settingsTreeContainer, - { - dataSource: this.treeDataSource, - renderer, - controller: this.instantiationService.createInstance(SettingsTreeController), - accessibilityProvider: this.instantiationService.createInstance(SettingsAccessibilityProvider), - filter: this.instantiationService.createInstance(SettingsTreeFilter, this.viewState), - styler: new DefaultTreestyler(DOM.createStyleSheet(), treeClass) - }, + this.settingsTree = this.instantiationService.createInstance(SettingsTree, + this.settingsTreeContainer, + this.viewState, { - ariaLabel: localize('treeAriaLabel', "Settings"), - showLoading: false, - indentPixels: 0, - twistiePixels: 0, + renderer }); - this._register(registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => { - const activeBorderColor = theme.getColor(focusBorder); - if (activeBorderColor) { - collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .monaco-tree:focus .monaco-tree-row.focused {outline: solid 1px ${activeBorderColor}; outline-offset: -1px; }`); - } - - const inactiveBorderColor = theme.getColor(settingItemInactiveSelectionBorder); - if (inactiveBorderColor) { - collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .monaco-tree .monaco-tree-row.focused {outline: solid 1px ${inactiveBorderColor}; outline-offset: -1px; }`); - } - - const foregroundColor = theme.getColor(foreground); - if (foregroundColor) { - // Links appear inside other elements in markdown. CSS opacity acts like a mask. So we have to dynamically compute the description color to avoid - // applying an opacity to the link color. - const fgWithOpacity = new Color(new RGBA(foregroundColor.rgba.r, foregroundColor.rgba.g, foregroundColor.rgba.b, .7)); - collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-description { color: ${fgWithOpacity}; }`); - } - })); - - this.settingsTree.getHTMLElement().classList.add(treeClass); - - this._register(attachStyler(this.themeService, { - listActiveSelectionBackground: editorBackground, - listActiveSelectionForeground: foreground, - listFocusAndSelectionBackground: editorBackground, - listFocusAndSelectionForeground: foreground, - listFocusBackground: editorBackground, - listFocusForeground: foreground, - listHoverForeground: foreground, - listHoverBackground: editorBackground, - listInactiveSelectionBackground: editorBackground, - listInactiveSelectionForeground: foreground - }, colors => { - this.settingsTree.style(colors); - })); - this._register(this.settingsTree.onDidChangeFocus(e => { this.settingsTree.setSelection([e.focus]); if (this.selectedElement) { diff --git a/src/vs/workbench/parts/preferences/browser/settingsTree.ts b/src/vs/workbench/parts/preferences/browser/settingsTree.ts index a43b504ff51..195b722de7d 100644 --- a/src/vs/workbench/parts/preferences/browser/settingsTree.ts +++ b/src/vs/workbench/parts/preferences/browser/settingsTree.ts @@ -12,6 +12,7 @@ import { Checkbox } from 'vs/base/browser/ui/checkbox/checkbox'; import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox'; import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox'; import * as arrays from 'vs/base/common/arrays'; +import { Color, RGBA } from 'vs/base/common/color'; import { onUnexpectedError } from 'vs/base/common/errors'; import { Emitter, Event } from 'vs/base/common/event'; import { KeyCode } from 'vs/base/common/keyCodes'; @@ -20,47 +21,47 @@ import * as objects from 'vs/base/common/objects'; import { escapeRegExpCharacters, startsWith } from 'vs/base/common/strings'; import URI from 'vs/base/common/uri'; import { TPromise } from 'vs/base/common/winjs.base'; -import { IAccessibilityProvider, IDataSource, IFilter, ITree, IRenderer } from 'vs/base/parts/tree/browser/tree'; +import { IAccessibilityProvider, IDataSource, IFilter, IRenderer, ITree, ITreeConfiguration } from 'vs/base/parts/tree/browser/tree'; +import { DefaultTreestyler } from 'vs/base/parts/tree/browser/treeDefaults'; import { localize } from 'vs/nls'; import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; -import { WorkbenchTree, WorkbenchTreeController } from 'vs/platform/list/browser/listService'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { IListService, WorkbenchTree, WorkbenchTreeController } from 'vs/platform/list/browser/listService'; import { IOpenerService } from 'vs/platform/opener/common/opener'; -import { inputBackground, inputBorder, inputForeground, registerColor, selectBackground, selectBorder, selectForeground, textLinkForeground } from 'vs/platform/theme/common/colorRegistry'; -import { attachInputBoxStyler, attachSelectBoxStyler, attachButtonStyler } from 'vs/platform/theme/common/styler'; +import { editorBackground, focusBorder, foreground, inputBackground, inputBorder, inputForeground, registerColor, selectBackground, selectBorder, selectForeground, textLinkForeground } from 'vs/platform/theme/common/colorRegistry'; +import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler, attachStyler } from 'vs/platform/theme/common/styler'; import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets'; import { ITOCEntry } from 'vs/workbench/parts/preferences/browser/settingsLayout'; import { ISearchResult, ISetting, ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences'; -import { Color } from 'vs/base/common/color'; const $ = DOM.$; -export const modifiedItemForeground = registerColor('settings.modifiedItemForeground', { - light: '#019001', - dark: '#73C991', - hc: '#73C991' -}, localize('modifiedItemForeground', "(For settings editor preview) The foreground color for a modified setting.")); +export const settingsHeaderForeground = registerColor('settings.headerForeground', { light: '#444444', dark: '#e7e7e7', hc: '#ffffff' }, localize('headerForeground', "(For settings editor preview) The foreground color for a section header/title.")); +export const modifiedItemForeground = registerColor('settings.modifiedItemForeground', { light: '#019001', dark: '#73C991', hc: '#73C991' }, localize('modifiedItemForeground', "(For settings editor preview) The foreground color for a modified setting.")); +export const settingItemInactiveSelectionBorder = registerColor('settings.inactiveSelectedItemBorder', { dark: '#3F3F46', light: '#CCCEDB', hc: null }, localize('settingItemInactiveSelectionBorder', "(For settings editor preview) The color of the selected setting row border, when the settings list does not have focus.")); // Enum control colors -export const settingsSelectBackground = registerColor('settings.dropdownBackground', { dark: selectBackground, light: selectBackground, hc: selectBackground }, localize('settingsDropdownBackground', "Settings editor dropdown background.")); -export const settingsSelectForeground = registerColor('settings.dropdownForeground', { dark: selectForeground, light: selectForeground, hc: selectForeground }, localize('settingsDropdownForeground', "Settings editor dropdown foreground.")); -export const settingsSelectBorder = registerColor('settings.dropdownBorder', { dark: selectBorder, light: selectBorder, hc: selectBorder }, localize('settingsDropdownBorder', "Settings editor dropdown border.")); +export const settingsSelectBackground = registerColor('settings.dropdownBackground', { dark: selectBackground, light: selectBackground, hc: selectBackground }, localize('settingsDropdownBackground', "(For settings editor preview) Settings editor dropdown background.")); +export const settingsSelectForeground = registerColor('settings.dropdownForeground', { dark: selectForeground, light: selectForeground, hc: selectForeground }, localize('settingsDropdownForeground', "(For settings editor preview) Settings editor dropdown foreground.")); +export const settingsSelectBorder = registerColor('settings.dropdownBorder', { dark: selectBorder, light: selectBorder, hc: selectBorder }, localize('settingsDropdownBorder', "(For settings editor preview) Settings editor dropdown border.")); // Bool control colors -export const settingsCheckboxBackground = registerColor('settings.checkboxBackground', { dark: selectBackground, light: selectBackground, hc: selectBackground }, localize('settingsCheckboxBackground', "Settings editor checkbox background.")); -export const settingsCheckboxForeground = registerColor('settings.checkboxForeground', { dark: selectForeground, light: selectForeground, hc: selectForeground }, localize('settingsCheckboxForeground', "Settings editor checkbox foreground.")); -export const settingsCheckboxBorder = registerColor('settings.checkboxBorder', { dark: selectBorder, light: selectBorder, hc: selectBorder }, localize('settingsCheckboxBorder', "Settings editor checkbox border.")); +export const settingsCheckboxBackground = registerColor('settings.checkboxBackground', { dark: selectBackground, light: selectBackground, hc: selectBackground }, localize('settingsCheckboxBackground', "(For settings editor preview) Settings editor checkbox background.")); +export const settingsCheckboxForeground = registerColor('settings.checkboxForeground', { dark: selectForeground, light: selectForeground, hc: selectForeground }, localize('settingsCheckboxForeground', "(For settings editor preview) Settings editor checkbox foreground.")); +export const settingsCheckboxBorder = registerColor('settings.checkboxBorder', { dark: selectBorder, light: selectBorder, hc: selectBorder }, localize('settingsCheckboxBorder', "(For settings editor preview) Settings editor checkbox border.")); // Text control colors -export const settingsTextInputBackground = registerColor('settings.textInputBackground', { dark: inputBackground, light: inputBackground, hc: inputBackground }, localize('textInputBoxBackground', "Settings editor text input box background.")); -export const settingsTextInputForeground = registerColor('settings.textInputForeground', { dark: inputForeground, light: inputForeground, hc: inputForeground }, localize('textInputBoxForeground', "Settings editor text input box foreground.")); -export const settingsTextInputBorder = registerColor('settings.textInputBorder', { dark: inputBorder, light: inputBorder, hc: inputBorder }, localize('textInputBoxBorder', "Settings editor text input box border.")); +export const settingsTextInputBackground = registerColor('settings.textInputBackground', { dark: inputBackground, light: inputBackground, hc: inputBackground }, localize('textInputBoxBackground', "(For settings editor preview) Settings editor text input box background.")); +export const settingsTextInputForeground = registerColor('settings.textInputForeground', { dark: inputForeground, light: inputForeground, hc: inputForeground }, localize('textInputBoxForeground', "(For settings editor preview) Settings editor text input box foreground.")); +export const settingsTextInputBorder = registerColor('settings.textInputBorder', { dark: inputBorder, light: inputBorder, hc: inputBorder }, localize('textInputBoxBorder', "(For settings editor preview) Settings editor text input box border.")); // Number control colors -export const settingsNumberInputBackground = registerColor('settings.numberInputBackground', { dark: inputBackground, light: inputBackground, hc: inputBackground }, localize('numberInputBoxBackground', "Settings editor number input box background.")); -export const settingsNumberInputForeground = registerColor('settings.numberInputForeground', { dark: inputForeground, light: inputForeground, hc: inputForeground }, localize('numberInputBoxForeground', "Settings editor number input box foreground.")); -export const settingsNumberInputBorder = registerColor('settings.numberInputBorder', { dark: inputBorder, light: inputBorder, hc: inputBorder }, localize('numberInputBoxBorder', "Settings editor number input box border.")); +export const settingsNumberInputBackground = registerColor('settings.numberInputBackground', { dark: inputBackground, light: inputBackground, hc: inputBackground }, localize('numberInputBoxBackground', "(For settings editor preview) Settings editor number input box background.")); +export const settingsNumberInputForeground = registerColor('settings.numberInputForeground', { dark: inputForeground, light: inputForeground, hc: inputForeground }, localize('numberInputBoxForeground', "(For settings editor preview) Settings editor number input box foreground.")); +export const settingsNumberInputBorder = registerColor('settings.numberInputBorder', { dark: inputBorder, light: inputBorder, hc: inputBorder }, localize('numberInputBoxBorder', "(For settings editor preview) Settings editor number input box border.")); registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => { const modifiedItemForegroundColor = theme.getColor(modifiedItemForeground); @@ -84,6 +85,11 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => { collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-description a { color: ${link}; }`); collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-description a > code { color: ${link}; }`); } + + const headerForegroundColor = theme.getColor(settingsHeaderForeground); + if (headerForegroundColor) { + collector.addRule(`.settings-editor > .settings-header > .settings-header-controls .settings-tabs-widget .action-label.checked { color: ${headerForegroundColor}; border-bottom-color: ${headerForegroundColor} };`); + } }); export abstract class SettingsTreeElement { @@ -1157,7 +1163,7 @@ export class SearchResultModel { } } -export class NonExpandableTree extends WorkbenchTree { +class NonExpandableTree extends WorkbenchTree { expand(): TPromise { return TPromise.wrap(null); } @@ -1166,3 +1172,86 @@ export class NonExpandableTree extends WorkbenchTree { return TPromise.wrap(null); } } + +export class SettingsTree extends NonExpandableTree { + constructor( + container: HTMLElement, + viewState: ISettingsEditorViewState, + configuration: Partial, + @IContextKeyService contextKeyService: IContextKeyService, + @IListService listService: IListService, + @IThemeService themeService: IThemeService, + @IInstantiationService instantiationService: IInstantiationService, + @IConfigurationService configurationService: IConfigurationService + ) { + const treeClass = 'settings-editor-tree'; + + const fullConfiguration = { + dataSource: instantiationService.createInstance(SettingsDataSource, viewState), + controller: instantiationService.createInstance(SettingsTreeController), + accessibilityProvider: instantiationService.createInstance(SettingsAccessibilityProvider), + filter: instantiationService.createInstance(SettingsTreeFilter, viewState), + styler: new DefaultTreestyler(DOM.createStyleSheet(), treeClass), + + ...configuration + }; + + const options = { + ariaLabel: localize('treeAriaLabel', "Settings"), + showLoading: false, + indentPixels: 0, + twistiePixels: 0, + }; + + super(container, + fullConfiguration, + options, + contextKeyService, + listService, + themeService, + instantiationService, + configurationService); + + this.disposables.push(registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => { + const activeBorderColor = theme.getColor(focusBorder); + if (activeBorderColor) { + collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .monaco-tree:focus .monaco-tree-row.focused {outline: solid 1px ${activeBorderColor}; outline-offset: -1px; }`); + } + + const inactiveBorderColor = theme.getColor(settingItemInactiveSelectionBorder); + if (inactiveBorderColor) { + collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .monaco-tree .monaco-tree-row.focused {outline: solid 1px ${inactiveBorderColor}; outline-offset: -1px; }`); + } + + const foregroundColor = theme.getColor(foreground); + if (foregroundColor) { + // Links appear inside other elements in markdown. CSS opacity acts like a mask. So we have to dynamically compute the description color to avoid + // applying an opacity to the link color. + const fgWithOpacity = new Color(new RGBA(foregroundColor.rgba.r, foregroundColor.rgba.g, foregroundColor.rgba.b, .7)); + collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-description { color: ${fgWithOpacity}; }`); + } + + const headerForegroundColor = theme.getColor(settingsHeaderForeground); + if (headerForegroundColor) { + collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .settings-group-title-label { color: ${headerForegroundColor} };`); + } + })); + + this.getHTMLElement().classList.add(treeClass); + + this.disposables.push(attachStyler(themeService, { + listActiveSelectionBackground: editorBackground, + listActiveSelectionForeground: foreground, + listFocusAndSelectionBackground: editorBackground, + listFocusAndSelectionForeground: foreground, + listFocusBackground: editorBackground, + listFocusForeground: foreground, + listHoverForeground: foreground, + listHoverBackground: editorBackground, + listInactiveSelectionBackground: editorBackground, + listInactiveSelectionForeground: foreground + }, colors => { + this.style(colors); + })); + } +}