diff --git a/build/lib/i18n.resources.json b/build/lib/i18n.resources.json index ceef664b85f..a192a31e57d 100644 --- a/build/lib/i18n.resources.json +++ b/build/lib/i18n.resources.json @@ -94,6 +94,10 @@ "name": "vs/workbench/contrib/issue", "project": "vscode-workbench" }, + { + "name": "vs/workbench/contrib/keybindings", + "project": "vscode-workbench" + }, { "name": "vs/workbench/contrib/markers", "project": "vscode-workbench" diff --git a/extensions/configuration-editing/package.json b/extensions/configuration-editing/package.json index 477d530a0ed..3afe9fa4332 100644 --- a/extensions/configuration-editing/package.json +++ b/extensions/configuration-editing/package.json @@ -54,7 +54,7 @@ "url": "vscode://schemas/keybindings" }, { - "fileMatch": "vscode://defaultsettings/*/*.json", + "fileMatch": "vscode://defaultsettings/*.json", "url": "vscode://schemas/settings/default" }, { diff --git a/extensions/github/src/publish.ts b/extensions/github/src/publish.ts index 9cd79a749b7..56f1ec8a7dc 100644 --- a/extensions/github/src/publish.ts +++ b/extensions/github/src/publish.ts @@ -123,7 +123,10 @@ export async function publishRepository(gitAPI: GitAPI, repository?: Repository) try { quickpick.busy = true; - const children = (await vscode.workspace.fs.readDirectory(folder)).map(([name]) => name); + const children = (await vscode.workspace.fs.readDirectory(folder)) + .map(([name]) => name) + .filter(name => name !== '.git'); + quickpick.items = children.map(name => ({ label: name })); quickpick.selectedItems = quickpick.items; quickpick.busy = false; diff --git a/resources/web/code-web.js b/resources/web/code-web.js index b6d19a65f1b..1ab1b7cde51 100644 --- a/resources/web/code-web.js +++ b/resources/web/code-web.js @@ -36,7 +36,8 @@ const args = minimist(process.argv, { 'help', 'verbose', 'wrap-iframe', - 'enable-sync' + 'enable-sync', + 'trusted-types' ], string: [ 'scheme', @@ -53,6 +54,7 @@ if (args.help) { 'yarn web [options]\n' + ' --no-launch Do not open VSCode web in the browser\n' + ' --wrap-iframe Wrap the Web Worker Extension Host in an iframe\n' + + ' --trusted-types Enable trusted types (report only)\n' + ' --enable-sync Enable sync by default\n' + ' --scheme Protocol (https or http)\n' + ' --host Remote host\n' + @@ -396,7 +398,13 @@ async function handleRoot(req, res) { .replace('{{WEBVIEW_ENDPOINT}}', '') .replace('{{REMOTE_USER_DATA_URI}}', ''); - res.writeHead(200, { 'Content-Type': 'text/html' }); + + const headers = { 'Content-Type': 'text/html' }; + if (args['trusted-types']) { + headers['Content-Security-Policy-Report-Only'] = 'require-trusted-types-for \'script\';'; + } + + res.writeHead(200, headers); return res.end(data); } diff --git a/src/vs/base/parts/ipc/common/ipc.net.ts b/src/vs/base/parts/ipc/common/ipc.net.ts index c3fede90bf3..bc8e97c269c 100644 --- a/src/vs/base/parts/ipc/common/ipc.net.ts +++ b/src/vs/base/parts/ipc/common/ipc.net.ts @@ -533,6 +533,53 @@ class Queue { } } +class LoadEstimator { + + private static _HISTORY_LENGTH = 10; + private static _INSTANCE: LoadEstimator | null = null; + public static getInstance(): LoadEstimator { + if (!LoadEstimator._INSTANCE) { + LoadEstimator._INSTANCE = new LoadEstimator(); + } + return LoadEstimator._INSTANCE; + } + + private lastRuns: number[]; + + constructor() { + this.lastRuns = []; + const now = Date.now(); + for (let i = 0; i < LoadEstimator._HISTORY_LENGTH; i++) { + this.lastRuns[i] = now - 1000 * i; + } + setInterval(() => { + for (let i = LoadEstimator._HISTORY_LENGTH; i >= 1; i--) { + this.lastRuns[i] = this.lastRuns[i - 1]; + } + this.lastRuns[0] = Date.now(); + }, 1000); + } + + /** + * returns an estimative number, from 0 (low load) to 1 (high load) + */ + public load(): number { + const now = Date.now(); + const historyLimit = (1 + LoadEstimator._HISTORY_LENGTH) * 1000; + let score = 0; + for (let i = 0; i < LoadEstimator._HISTORY_LENGTH; i++) { + if (now - this.lastRuns[i] <= historyLimit) { + score++; + } + } + return 1 - score / LoadEstimator._HISTORY_LENGTH; + } + + public hasHighLoad(): boolean { + return this.load() >= 0.5; + } +} + /** * Same as Protocol, but will actually track messages and acks. * Moreover, it will ensure no messages are lost if there are no event listeners. @@ -559,6 +606,8 @@ export class PersistentProtocol implements IMessagePassingProtocol { private _socketReader: ProtocolReader; private _socketDisposables: IDisposable[]; + private readonly _loadEstimator = LoadEstimator.getInstance(); + private readonly _onControlMessage = new BufferedEmitter(); readonly onControlMessage: Event = this._onControlMessage.event; @@ -670,15 +719,19 @@ export class PersistentProtocol implements IMessagePassingProtocol { const timeSinceLastIncomingMsg = Date.now() - this._socketReader.lastReadTime; if (timeSinceLastIncomingMsg >= ProtocolConstants.KeepAliveTimeoutTime) { - // Trash the socket - this._onSocketTimeout.fire(undefined); - return; + // It's been a long time since we received a server message + // But this might be caused by the event loop being busy and failing to read messages + if (!this._loadEstimator.hasHighLoad()) { + // Trash the socket + this._onSocketTimeout.fire(undefined); + return; + } } this._incomingKeepAliveTimeout = setTimeout(() => { this._incomingKeepAliveTimeout = null; this._recvKeepAliveCheck(); - }, ProtocolConstants.KeepAliveTimeoutTime - timeSinceLastIncomingMsg + 5); + }, Math.max(ProtocolConstants.KeepAliveTimeoutTime - timeSinceLastIncomingMsg, 0) + 5); } public getSocket(): ISocket { @@ -821,15 +874,19 @@ export class PersistentProtocol implements IMessagePassingProtocol { const oldestUnacknowledgedMsg = this._outgoingUnackMsg.peek()!; const timeSinceOldestUnacknowledgedMsg = Date.now() - oldestUnacknowledgedMsg.writtenTime; if (timeSinceOldestUnacknowledgedMsg >= ProtocolConstants.AcknowledgeTimeoutTime) { - // Trash the socket - this._onSocketTimeout.fire(undefined); - return; + // It's been a long time since our sent message was acknowledged + // But this might be caused by the event loop being busy and failing to read messages + if (!this._loadEstimator.hasHighLoad()) { + // Trash the socket + this._onSocketTimeout.fire(undefined); + return; + } } this._outgoingAckTimeout = setTimeout(() => { this._outgoingAckTimeout = null; this._recvAckCheck(); - }, ProtocolConstants.AcknowledgeTimeoutTime - timeSinceOldestUnacknowledgedMsg + 5); + }, Math.max(ProtocolConstants.AcknowledgeTimeoutTime - timeSinceOldestUnacknowledgedMsg, 0) + 5); } private _sendAck(): void { diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts index 6cd3fa05be5..ad5272b2232 100644 --- a/src/vs/code/browser/workbench/workbench.ts +++ b/src/vs/code/browser/workbench/workbench.ts @@ -440,7 +440,13 @@ class WindowIndicator implements IWindowIndicator { // Find credentials from DOM const credentialsElement = document.getElementById('vscode-workbench-credentials'); const credentialsElementAttribute = credentialsElement ? credentialsElement.getAttribute('data-settings') : undefined; - const credentialsProvider = new LocalStorageCredentialsProvider(credentialsElementAttribute ? JSON.parse(credentialsElementAttribute) : []); + let credentials = undefined; + if (credentialsElementAttribute) { + try { + credentials = JSON.parse(credentialsElementAttribute); + } catch (error) { /* Invalid credentials are passed. Ignore. */ } + } + const credentialsProvider = new LocalStorageCredentialsProvider(credentials || []); // Finally create workbench create(document.body, { diff --git a/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts b/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts index a703cbafd2b..ef3f6e301b4 100644 --- a/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts +++ b/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts @@ -358,7 +358,7 @@ registerThemingParticipant((theme, collector) => { if (!caretBackground) { caretBackground = caret.opposite(); } - collector.addRule(`.monaco-editor .cursor { background-color: ${caret}; border-color: ${caret}; color: ${caretBackground}; }`); + collector.addRule(`.monaco-editor .cursors-layer .cursor { background-color: ${caret}; border-color: ${caret}; color: ${caretBackground}; }`); if (theme.type === 'hc') { collector.addRule(`.monaco-editor .cursors-layer.has-selection .cursor { border-left: 1px solid ${caretBackground}; border-right: 1px solid ${caretBackground}; }`); } diff --git a/src/vs/platform/keybinding/common/abstractKeybindingService.ts b/src/vs/platform/keybinding/common/abstractKeybindingService.ts index 030f84f50bb..07ad0391931 100644 --- a/src/vs/platform/keybinding/common/abstractKeybindingService.ts +++ b/src/vs/platform/keybinding/common/abstractKeybindingService.ts @@ -81,8 +81,6 @@ export abstract class AbstractKeybindingService extends Disposable implements IK protected _log(str: string): void { if (this._logging) { this._logService.info(`[KeybindingService]: ${str}`); - } else { - this._logService.trace(`[KeybindingService]: ${str}`); } } diff --git a/src/vs/workbench/api/browser/mainThreadAuthentication.ts b/src/vs/workbench/api/browser/mainThreadAuthentication.ts index a52c82ea92b..5061d83f15e 100644 --- a/src/vs/workbench/api/browser/mainThreadAuthentication.ts +++ b/src/vs/workbench/api/browser/mainThreadAuthentication.ts @@ -20,7 +20,7 @@ import { fromNow } from 'vs/base/common/date'; import { ActivationKind, IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { Platform, platform } from 'vs/base/common/platform'; -const VSO_ALLOWED_EXTENSIONS = ['github.vscode-pull-request-github', 'github.vscode-pull-request-github-insiders', 'vscode.git', 'ms-vsonline.vsonline', 'vscode.github-browser']; +const VSO_ALLOWED_EXTENSIONS = ['github.vscode-pull-request-github', 'github.vscode-pull-request-github-insiders', 'vscode.git', 'ms-vsonline.vsonline', 'vscode.github-browser', 'ms-vscode.github-browser']; interface IAccountUsage { extensionId: string; diff --git a/src/vs/workbench/browser/actions/developerActions.ts b/src/vs/workbench/browser/actions/developerActions.ts index 5e7e9499f07..3820e9c8ac8 100644 --- a/src/vs/workbench/browser/actions/developerActions.ts +++ b/src/vs/workbench/browser/actions/developerActions.ts @@ -324,8 +324,6 @@ configurationRegistry.registerConfiguration({ type: 'string', format: 'color-hex', default: '#FF0000', - minLength: 4, - maxLength: 9, description: nls.localize('screencastMode.mouseIndicatorColor', "Controls the color in hex (#RGB, #RGBA, #RRGGBB or #RRGGBBAA) of the mouse indicator in screencast mode.") }, 'screencastMode.mouseIndicatorSize': { diff --git a/src/vs/workbench/browser/parts/compositePart.ts b/src/vs/workbench/browser/parts/compositePart.ts index 57adb998ecc..b3c94885b7a 100644 --- a/src/vs/workbench/browser/parts/compositePart.ts +++ b/src/vs/workbench/browser/parts/compositePart.ts @@ -106,6 +106,11 @@ export abstract class CompositePart extends Part { return this.activeComposite; } + // We cannot open the composite if we have not been created yet + if (!this.element) { + return; + } + // Open return this.doOpenComposite(id, focus); } diff --git a/src/vs/workbench/contrib/debug/browser/debug.contribution.ts b/src/vs/workbench/contrib/debug/browser/debug.contribution.ts index e39d249dc58..ac3e89d4c89 100644 --- a/src/vs/workbench/contrib/debug/browser/debug.contribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debug.contribution.ts @@ -187,11 +187,11 @@ function registerCommandsAndActions(): void { registerDebugViewMenuItem(MenuId.DebugCallStackContext, RESTART_FRAME_ID, nls.localize('restartFrame', "Restart Frame"), 10, ContextKeyExpr.and(CONTEXT_CALLSTACK_ITEM_TYPE.isEqualTo('stackFrame'), CONTEXT_RESTART_FRAME_SUPPORTED)); registerDebugViewMenuItem(MenuId.DebugCallStackContext, COPY_STACK_TRACE_ID, nls.localize('copyStackTrace', "Copy Call Stack"), 20, CONTEXT_CALLSTACK_ITEM_TYPE.isEqualTo('stackFrame')); - registerDebugViewMenuItem(MenuId.DebugVariablesContext, SET_VARIABLE_ID, nls.localize('setValue', "Set Value"), 10, CONTEXT_SET_VARIABLE_SUPPORTED); - registerDebugViewMenuItem(MenuId.DebugVariablesContext, COPY_VALUE_ID, nls.localize('copyValue', "Copy Value"), 20); - registerDebugViewMenuItem(MenuId.DebugVariablesContext, COPY_EVALUATE_PATH_ID, nls.localize('copyAsExpression', "Copy as Expression"), 30, CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT); - registerDebugViewMenuItem(MenuId.DebugVariablesContext, ADD_TO_WATCH_ID, nls.localize('addToWatchExpressions', "Add to Watch"), 10, CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT, undefined, '3_watch'); - registerDebugViewMenuItem(MenuId.DebugVariablesContext, BREAK_WHEN_VALUE_CHANGES_ID, nls.localize('breakWhenValueChanges', "Break When Value Changes"), 20, CONTEXT_BREAK_WHEN_VALUE_CHANGES_SUPPORTED, undefined, '5_breakpoint'); + registerDebugViewMenuItem(MenuId.DebugVariablesContext, SET_VARIABLE_ID, nls.localize('setValue', "Set Value"), 10, CONTEXT_SET_VARIABLE_SUPPORTED, undefined, '3_modification'); + registerDebugViewMenuItem(MenuId.DebugVariablesContext, COPY_VALUE_ID, nls.localize('copyValue', "Copy Value"), 10, undefined, undefined, '5_cutcopypaste'); + registerDebugViewMenuItem(MenuId.DebugVariablesContext, COPY_EVALUATE_PATH_ID, nls.localize('copyAsExpression', "Copy as Expression"), 20, CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT, undefined, '5_cutcopypaste'); + registerDebugViewMenuItem(MenuId.DebugVariablesContext, ADD_TO_WATCH_ID, nls.localize('addToWatchExpressions', "Add to Watch"), 100, CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT, undefined, 'z_commands'); + registerDebugViewMenuItem(MenuId.DebugVariablesContext, BREAK_WHEN_VALUE_CHANGES_ID, nls.localize('breakWhenValueChanges', "Break When Value Changes"), 200, CONTEXT_BREAK_WHEN_VALUE_CHANGES_SUPPORTED, undefined, 'z_commands'); // Touch Bar if (isMacintosh) { diff --git a/src/vs/workbench/contrib/debug/browser/replFilter.ts b/src/vs/workbench/contrib/debug/browser/replFilter.ts index a4073b7a2d3..7cfdef6dde9 100644 --- a/src/vs/workbench/contrib/debug/browser/replFilter.ts +++ b/src/vs/workbench/contrib/debug/browser/replFilter.ts @@ -22,6 +22,7 @@ import { KeyCode } from 'vs/base/common/keyCodes'; import { ContextScopedHistoryInputBox } from 'vs/platform/browser/contextScopedHistoryWidget'; import { attachInputBoxStyler } from 'vs/platform/theme/common/styler'; import { IThemeService } from 'vs/platform/theme/common/themeService'; +import { ReplEvaluationResult, ReplEvaluationInput } from 'vs/workbench/contrib/debug/common/replModel'; type ParsedQuery = { @@ -51,6 +52,11 @@ export class ReplFilter implements ITreeFilter { } filter(element: IReplElement, parentVisibility: TreeVisibility): TreeFilterResult { + if (element instanceof ReplEvaluationInput || element instanceof ReplEvaluationResult) { + // Only filter the output events, everything else is visible https://github.com/microsoft/vscode/issues/105863 + return TreeVisibility.Visible; + } + let includeQueryPresent = false; let includeQueryMatched = false; @@ -107,7 +113,7 @@ export class ReplFilterActionViewItem extends BaseActionViewItem { @IThemeService private readonly themeService: IThemeService, @IContextViewService private readonly contextViewService: IContextViewService) { super(null, action); - this.delayedFilterUpdate = new Delayer(200); + this.delayedFilterUpdate = new Delayer(400); this._register(toDisposable(() => this.delayedFilterUpdate.cancel())); } diff --git a/src/vs/workbench/contrib/debug/common/replModel.ts b/src/vs/workbench/contrib/debug/common/replModel.ts index df443ddd23f..85f6d1dd32f 100644 --- a/src/vs/workbench/contrib/debug/common/replModel.ts +++ b/src/vs/workbench/contrib/debug/common/replModel.ts @@ -27,7 +27,7 @@ export class SimpleReplElement implements IReplElement { ) { } toString(): string { - const sourceStr = this.sourceData ? ` ${this.sourceData.source.name}:${this.sourceData.lineNumber}` : ''; + const sourceStr = this.sourceData ? ` ${this.sourceData.source.name}` : ''; return this.value + sourceStr; } @@ -145,7 +145,7 @@ export class ReplGroup implements IReplElement { } toString(): string { - const sourceStr = this.sourceData ? ` ${this.sourceData.source.name}:${this.sourceData.lineNumber}` : ''; + const sourceStr = this.sourceData ? ` ${this.sourceData.source.name}` : ''; return this.name + sourceStr; } diff --git a/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.ts b/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.ts new file mode 100644 index 00000000000..c0a56f2914b --- /dev/null +++ b/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.ts @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as nls from 'vs/nls'; +import { Action2, registerAction2 } from 'vs/platform/actions/common/actions'; +import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; +import { rendererLogChannelId } from 'vs/workbench/contrib/logs/common/logConstants'; +import { IOutputService } from 'vs/workbench/contrib/output/common/output'; + +const developerCategory = { value: nls.localize({ key: 'developer', comment: ['A developer on Code itself or someone diagnosing issues in Code'] }, "Developer"), original: 'Developer' }; + +class ToggleKeybindingsLogAction extends Action2 { + + constructor() { + super({ + id: 'workbench.action.toggleKeybindingsLog', + title: { value: nls.localize('toggleKeybindingsLog', "Toggle Keyboard Shortcuts Troubleshooting"), original: 'Toggle Keyboard Shortcuts Troubleshooting' }, + category: developerCategory, + f1: true + }); + } + + run(accessor: ServicesAccessor): void { + const logging = accessor.get(IKeybindingService).toggleLogging(); + if (logging) { + const outputService = accessor.get(IOutputService); + outputService.showChannel(rendererLogChannelId); + } + } +} + +registerAction2(ToggleKeybindingsLogAction); diff --git a/src/vs/workbench/contrib/markers/browser/markersViewActions.ts b/src/vs/workbench/contrib/markers/browser/markersViewActions.ts index 48d031cea16..0f85b179dc5 100644 --- a/src/vs/workbench/contrib/markers/browser/markersViewActions.ts +++ b/src/vs/workbench/contrib/markers/browser/markersViewActions.ts @@ -274,7 +274,7 @@ export class MarkersFilterActionViewItem extends BaseActionViewItem { ) { super(null, action); this.focusContextKey = Constants.MarkerViewFilterFocusContextKey.bindTo(contextKeyService); - this.delayedFilterUpdate = new Delayer(200); + this.delayedFilterUpdate = new Delayer(400); this._register(toDisposable(() => this.delayedFilterUpdate.cancel())); this._register(filterController.onDidFocusFilter(() => this.focus())); this._register(filterController.onDidClearFilterText(() => this.clearFilterText())); diff --git a/src/vs/workbench/contrib/notebook/browser/diff/notebookTextDiffEditor.ts b/src/vs/workbench/contrib/notebook/browser/diff/notebookTextDiffEditor.ts index ac5dcb33d4d..78bcd753b76 100644 --- a/src/vs/workbench/contrib/notebook/browser/diff/notebookTextDiffEditor.ts +++ b/src/vs/workbench/contrib/notebook/browser/diff/notebookTextDiffEditor.ts @@ -209,7 +209,6 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD } async updateLayout() { - console.log('update layout'); if (!this._model) { return; } diff --git a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts index ebecbd0af7f..1bbae8210d7 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts @@ -387,7 +387,7 @@ export class NotebookContribution extends Disposable implements IWorkbenchContri const existingEditors = group.editors.filter(editor => editor.resource && isEqual(editor.resource, notebookUri) && !(editor instanceof NotebookEditorInput)); if (existingEditors.length) { - return { override: this.editorService.openEditor(existingEditors[0]) }; + return undefined; } const userAssociatedEditors = this.getUserAssociatedEditors(notebookUri); diff --git a/src/vs/workbench/contrib/notebook/browser/notebookDiffEditorInput.ts b/src/vs/workbench/contrib/notebook/browser/notebookDiffEditorInput.ts index 3fee6eb3189..6ab3652eaba 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookDiffEditorInput.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookDiffEditorInput.ts @@ -44,9 +44,8 @@ class NotebookDiffEditorModel extends EditorModel implements INotebookDiffEditor } dispose(): void { - + super.dispose(); } - } export class NotebookDiffEditorInput extends EditorInput { diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts index 9389b3e9856..f10ef127e49 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts @@ -192,7 +192,6 @@ export type ToWebviewMessage = | IHideOutputMessage | IShowOutputMessage | IUpdatePreloadResourceMessage - | IFocusOutputMessage | IUpdateDecorationsMessage | ICustomRendererMessage; diff --git a/src/vs/workbench/contrib/outline/browser/outlinePane.ts b/src/vs/workbench/contrib/outline/browser/outlinePane.ts index a277a22ed17..26fd54407ff 100644 --- a/src/vs/workbench/contrib/outline/browser/outlinePane.ts +++ b/src/vs/workbench/contrib/outline/browser/outlinePane.ts @@ -561,7 +561,7 @@ export class OutlinePane extends ViewPane { return; } - this._revealTreeSelection(newModel, e.element, !!e.editorOptions.preserveFocus || !e.editorOptions.pinned, e.sideBySide); + this._revealTreeSelection(newModel, e.element, !!e.editorOptions.preserveFocus, !!e.editorOptions.pinned, e.sideBySide); })); // feature: reveal editor selection in outline @@ -615,12 +615,13 @@ export class OutlinePane extends ViewPane { })); } - private async _revealTreeSelection(model: OutlineModel, element: OutlineElement, preserveFocus: boolean, aside: boolean): Promise { + private async _revealTreeSelection(model: OutlineModel, element: OutlineElement, preserveFocus: boolean, pinned: boolean, aside: boolean): Promise { await this._editorService.openCodeEditor( { resource: model.uri, options: { preserveFocus, + pinned, selection: Range.collapseToStart(element.symbol.selectionRange), selectionRevealType: TextEditorSelectionRevealType.NearTopIfOutsideViewport, } diff --git a/src/vs/workbench/contrib/views/browser/treeView.ts b/src/vs/workbench/contrib/views/browser/treeView.ts index e55d6f10f36..a2b075b4c56 100644 --- a/src/vs/workbench/contrib/views/browser/treeView.ts +++ b/src/vs/workbench/contrib/views/browser/treeView.ts @@ -706,7 +706,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer('editor.hover.delay'); + this.hoverDelay = 500; // milliseconds } get templateId(): string { @@ -811,12 +811,17 @@ class TreeRenderer extends Disposable implements ITreeRenderer { if (node instanceof ResolvableTreeItem) { await node.resolve(); @@ -830,9 +835,12 @@ class TreeRenderer extends Disposable implements ITreeRendererhoverOptions.target).x = e.x; + if (mouseX !== undefined) { + (hoverOptions.target).x = mouseX; + } hoverService.showHover(hoverOptions); } + this.removeEventListener(DOM.EventType.MOUSE_MOVE, mouseMove); this.removeEventListener(DOM.EventType.MOUSE_LEAVE, mouseLeave); }, hoverDelay); } diff --git a/src/vs/workbench/services/keybinding/browser/keybindingService.ts b/src/vs/workbench/services/keybinding/browser/keybindingService.ts index 891bc801a59..976b4670e71 100644 --- a/src/vs/workbench/services/keybinding/browser/keybindingService.ts +++ b/src/vs/workbench/services/keybinding/browser/keybindingService.ts @@ -31,7 +31,7 @@ import { IUserKeybindingItem, KeybindingIO, OutputBuilder } from 'vs/workbench/s import { IKeyboardMapper } from 'vs/workbench/services/keybinding/common/keyboardMapper'; import { IHostService } from 'vs/workbench/services/host/browser/host'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; -import { Action2, MenuRegistry, registerAction2 } from 'vs/platform/actions/common/actions'; +import { MenuRegistry } from 'vs/platform/actions/common/actions'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { commandsExtensionPoint } from 'vs/workbench/api/common/menusExtensionPoint'; import { Disposable } from 'vs/base/common/lifecycle'; @@ -48,7 +48,6 @@ import { ScanCode, ScanCodeUtils, IMMUTABLE_CODE_TO_KEY_CODE } from 'vs/base/com import { flatten } from 'vs/base/common/arrays'; import { BrowserFeatures, KeyboardSupport } from 'vs/base/browser/canIUse'; import { ILogService } from 'vs/platform/log/common/log'; -import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; interface ContributedKeyBinding { @@ -745,26 +744,6 @@ let schema: IJSONSchema = { } }; -const preferencesCategory = nls.localize('preferences', "Preferences"); - -class ToggleKeybindingsLogAction extends Action2 { - - constructor() { - super({ - id: 'workbench.action.toggleKeybindingsLog', - title: { value: nls.localize('toggleKeybindingsLog', "Toggle Keyboard Shortcuts Troubleshooting"), original: 'Toggle Keyboard Shortcuts Troubleshooting' }, - category: preferencesCategory, - f1: true - }); - } - - run(accessor: ServicesAccessor): void { - accessor.get(IKeybindingService).toggleLogging(); - } -} - -registerAction2(ToggleKeybindingsLogAction); - let schemaRegistry = Registry.as(Extensions.JSONContribution); schemaRegistry.registerSchema(schemaId, schema); diff --git a/src/vs/workbench/services/preferences/common/preferencesValidation.ts b/src/vs/workbench/services/preferences/common/preferencesValidation.ts index 6a205333596..40b916d16ae 100644 --- a/src/vs/workbench/services/preferences/common/preferencesValidation.ts +++ b/src/vs/workbench/services/preferences/common/preferencesValidation.ts @@ -3,9 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { JSONSchemaType } from 'vs/base/common/jsonSchema'; -import { isArray } from 'vs/base/common/types'; import * as nls from 'vs/nls'; +import { JSONSchemaType } from 'vs/base/common/jsonSchema'; +import { Color } from 'vs/base/common/color'; +import { isArray } from 'vs/base/common/types'; import { IConfigurationPropertySchema } from 'vs/platform/configuration/common/configurationRegistry'; type Validator = { enabled: boolean, isValid: (value: T) => boolean; message: string }; @@ -111,6 +112,11 @@ function getStringValidators(prop: IConfigurationPropertySchema) { isValid: ((value: string) => patternRegex!.test(value)), message: prop.patternErrorMessage || nls.localize('validations.regex', "Value must match regex `{0}`.", prop.pattern) }, + { + enabled: prop.format === 'color-hex', + isValid: ((value: string) => Color.Format.CSS.parseHex(value)), + message: nls.localize('validations.colorFormat', "Invalid color format. Use #RGB, #RGBA, #RRGGBB or #RRGGBBAA.") + } ].filter(validation => validation.enabled); } diff --git a/src/vs/workbench/workbench.common.main.ts b/src/vs/workbench/workbench.common.main.ts index 6b38f0bcc3c..5df13214978 100644 --- a/src/vs/workbench/workbench.common.main.ts +++ b/src/vs/workbench/workbench.common.main.ts @@ -232,6 +232,9 @@ import 'vs/workbench/contrib/emmet/browser/emmet.contribution'; // CodeEditor Contributions import 'vs/workbench/contrib/codeEditor/browser/codeEditor.contribution'; +// Keybindings Contributions +import 'vs/workbench/contrib/keybindings/browser/keybindings.contribution'; + // Execution import 'vs/workbench/contrib/externalTerminal/browser/externalTerminal.contribution'; diff --git a/yarn.lock b/yarn.lock index 0126c976cb8..140ed883c1a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1236,9 +1236,9 @@ bindings@^1.5.0: file-uri-to-path "1.0.0" bl@^4.0.1, bl@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/bl/-/bl-4.0.2.tgz#52b71e9088515d0606d9dd9cc7aa48dc1f98e73a" - integrity sha512-j4OH8f6Qg2bGuWfRiltT2HYGx0e1QcBTrK9KAHNMwMZdQnDZFk0ZSYIpADjYCB3U12nicC5tVJwSIhwOWjb4RQ== + version "4.0.3" + resolved "https://registry.yarnpkg.com/bl/-/bl-4.0.3.tgz#12d6287adc29080e22a705e5764b2a9522cdc489" + integrity sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg== dependencies: buffer "^5.5.0" inherits "^2.0.4"