From f0c543908ad0435605ee5845bb6339cb9d8d7790 Mon Sep 17 00:00:00 2001 From: weartist Date: Sat, 17 Jun 2023 16:31:21 +0800 Subject: [PATCH 1/7] Fix #185343 --- .../contrib/terminal/common/terminalConfiguration.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts index f247f219344..62275b88a3a 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts @@ -503,16 +503,13 @@ const terminalConfiguration: IConfigurationNode = { [TerminalSettingId.LocalEchoStyle]: { description: localize('terminal.integrated.localEchoStyle', "Terminal style of locally echoed text; either a font style or an RGB color."), default: 'dim', - oneOf: [ + anyOf: [ { - type: 'string', - default: 'dim', - enum: ['bold', 'dim', 'italic', 'underlined', 'inverted'], + enum: ['bold', 'dim', 'italic', 'underlined', 'inverted', '#ff0000'], }, { type: 'string', format: 'color-hex', - default: '#ff0000', } ] }, From 9123c5712af47eac921aae20c96667fa440e6e60 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 28 Jul 2023 12:27:46 -0700 Subject: [PATCH 2/7] fix #188822 --- .../services/hover/browser/hoverService.ts | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/services/hover/browser/hoverService.ts b/src/vs/workbench/services/hover/browser/hoverService.ts index 819b4d9f0a9..76dc502587f 100644 --- a/src/vs/workbench/services/hover/browser/hoverService.ts +++ b/src/vs/workbench/services/hover/browser/hoverService.ts @@ -17,6 +17,7 @@ import { addDisposableListener, EventType } from 'vs/base/browser/dom'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { ResultKind } from 'vs/platform/keybinding/common/keybindingResolver'; +import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; export class HoverService implements IHoverService { declare readonly _serviceBrand: undefined; @@ -31,23 +32,26 @@ export class HoverService implements IHoverService { @IInstantiationService private readonly _instantiationService: IInstantiationService, @IContextViewService private readonly _contextViewService: IContextViewService, @IContextMenuService contextMenuService: IContextMenuService, - @IKeybindingService private readonly _keybindingService: IKeybindingService + @IKeybindingService private readonly _keybindingService: IKeybindingService, + @IAccessibilityService private readonly _accessibilityService: IAccessibilityService ) { contextMenuService.onDidShowContextMenu(() => this.hideHover()); } - showHover(options: IHoverOptions, focus?: boolean): IHoverWidget | undefined { + showHover(options: IHoverOptions, focus?: boolean, skipLastFocusedUpdate?: boolean): IHoverWidget | undefined { if (getHoverOptionsIdentity(this._currentHoverOptions) === getHoverOptionsIdentity(options)) { return undefined; } this._currentHoverOptions = options; this._lastHoverOptions = options; - if (options.trapFocus && document.activeElement) { - this._lastFocusedElementBeforeOpen = document.activeElement as HTMLElement; - } else { - this._lastFocusedElementBeforeOpen = undefined; + options.trapFocus = options.trapFocus || this._accessibilityService.isScreenReaderOptimized(); + if (!skipLastFocusedUpdate) { + if (options.trapFocus && document.activeElement) { + this._lastFocusedElementBeforeOpen = document.activeElement as HTMLElement; + } else { + this._lastFocusedElementBeforeOpen = undefined; + } } - const hoverDisposables = new DisposableStore(); const hover = this._instantiationService.createInstance(HoverWidget, options); hover.onDispose(() => { @@ -114,7 +118,7 @@ export class HoverService implements IHoverService { if (!this._lastHoverOptions) { return; } - this.showHover(this._lastHoverOptions, true); + this.showHover(this._lastHoverOptions, true, true); } private _keyDown(e: KeyboardEvent, hover: HoverWidget, hideOnKeyDown: boolean) { From a3d2eb55fd334ad5c649bc90c3cad49ebad499dd Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 28 Jul 2023 12:33:39 -0700 Subject: [PATCH 3/7] Use readonly for hover options as they should not be touched Fixes #189187 --- src/vs/workbench/services/hover/browser/hover.ts | 2 +- src/vs/workbench/services/hover/browser/hoverService.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/services/hover/browser/hover.ts b/src/vs/workbench/services/hover/browser/hover.ts index 8f2e241b7d2..53b369f5bc6 100644 --- a/src/vs/workbench/services/hover/browser/hover.ts +++ b/src/vs/workbench/services/hover/browser/hover.ts @@ -30,7 +30,7 @@ export interface IHoverService { * }); * ``` */ - showHover(options: IHoverOptions, focus?: boolean): IHoverWidget | undefined; + showHover(options: Readonly, focus?: boolean): IHoverWidget | undefined; /** * Hides the hover if it was visible. This call will be ignored if the the hover is currently diff --git a/src/vs/workbench/services/hover/browser/hoverService.ts b/src/vs/workbench/services/hover/browser/hoverService.ts index 819b4d9f0a9..25bdc3f447e 100644 --- a/src/vs/workbench/services/hover/browser/hoverService.ts +++ b/src/vs/workbench/services/hover/browser/hoverService.ts @@ -36,7 +36,7 @@ export class HoverService implements IHoverService { contextMenuService.onDidShowContextMenu(() => this.hideHover()); } - showHover(options: IHoverOptions, focus?: boolean): IHoverWidget | undefined { + showHover(options: Readonly, focus?: boolean): IHoverWidget | undefined { if (getHoverOptionsIdentity(this._currentHoverOptions) === getHoverOptionsIdentity(options)) { return undefined; } From 2b61214c3f171bef09b835cb9a44ec4ee8104940 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 28 Jul 2023 12:34:43 -0700 Subject: [PATCH 4/7] Add comment --- src/vs/workbench/services/hover/browser/hoverService.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/services/hover/browser/hoverService.ts b/src/vs/workbench/services/hover/browser/hoverService.ts index 76dc502587f..4d49a9d2929 100644 --- a/src/vs/workbench/services/hover/browser/hoverService.ts +++ b/src/vs/workbench/services/hover/browser/hoverService.ts @@ -44,9 +44,10 @@ export class HoverService implements IHoverService { } this._currentHoverOptions = options; this._lastHoverOptions = options; - options.trapFocus = options.trapFocus || this._accessibilityService.isScreenReaderOptimized(); + // HACK, remove when #189076 is fixed + const trapFocus = options.trapFocus || this._accessibilityService.isScreenReaderOptimized(); if (!skipLastFocusedUpdate) { - if (options.trapFocus && document.activeElement) { + if (trapFocus && document.activeElement) { this._lastFocusedElementBeforeOpen = document.activeElement as HTMLElement; } else { this._lastFocusedElementBeforeOpen = undefined; From ca091e2795a4ba704ebef97d363ee10cb43bec40 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 28 Jul 2023 12:46:59 -0700 Subject: [PATCH 5/7] move comment, add one --- src/vs/workbench/services/hover/browser/hover.ts | 1 + src/vs/workbench/services/hover/browser/hoverService.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/services/hover/browser/hover.ts b/src/vs/workbench/services/hover/browser/hover.ts index 8f2e241b7d2..365b03e7d9f 100644 --- a/src/vs/workbench/services/hover/browser/hover.ts +++ b/src/vs/workbench/services/hover/browser/hover.ts @@ -145,6 +145,7 @@ export interface IHoverOptions { * Whether to trap focus in the following ways: * - When the hover closes, focus goes to the element that had focus before the hover opened * - If there are elements in the hover to focus, focus stays inside of the hover when tabbing + * Note that this is overridden to true when in screen reader optimized mode. */ trapFocus?: boolean; diff --git a/src/vs/workbench/services/hover/browser/hoverService.ts b/src/vs/workbench/services/hover/browser/hoverService.ts index 4d49a9d2929..7da8c0d2002 100644 --- a/src/vs/workbench/services/hover/browser/hoverService.ts +++ b/src/vs/workbench/services/hover/browser/hoverService.ts @@ -44,8 +44,8 @@ export class HoverService implements IHoverService { } this._currentHoverOptions = options; this._lastHoverOptions = options; - // HACK, remove when #189076 is fixed const trapFocus = options.trapFocus || this._accessibilityService.isScreenReaderOptimized(); + // HACK, remove this check when #189076 is fixed if (!skipLastFocusedUpdate) { if (trapFocus && document.activeElement) { this._lastFocusedElementBeforeOpen = document.activeElement as HTMLElement; From e1a9077571818432002c7273e0243e7031a4124d Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Fri, 28 Jul 2023 14:47:23 -0700 Subject: [PATCH 6/7] tunnels: fix redundant quick pick group name (#189198) Fixes #188825 --- .../electron-sandbox/remoteTunnel.contribution.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/contrib/remoteTunnel/electron-sandbox/remoteTunnel.contribution.ts b/src/vs/workbench/contrib/remoteTunnel/electron-sandbox/remoteTunnel.contribution.ts index d05dee033ac..c71388d51fb 100644 --- a/src/vs/workbench/contrib/remoteTunnel/electron-sandbox/remoteTunnel.contribution.ts +++ b/src/vs/workbench/contrib/remoteTunnel/electron-sandbox/remoteTunnel.contribution.ts @@ -397,11 +397,11 @@ export class RemoteTunnelWorkbenchContribution extends Disposable implements IWo private async createQuickpickItems(sessions: ExistingSessionItem[]): Promise<(ExistingSessionItem | AuthenticationProviderOption | IQuickPickSeparator | IQuickPickItem & { canceledAuthentication: boolean })[]> { const options: (ExistingSessionItem | AuthenticationProviderOption | IQuickPickSeparator | IQuickPickItem & { canceledAuthentication: boolean })[] = []; - options.push({ type: 'separator', label: localize('signed in', "Signed In") }); - - options.push(...sessions); - - options.push({ type: 'separator', label: localize('others', "Others") }); + if (sessions.length) { + options.push({ type: 'separator', label: localize('signed in', "Signed In") }); + options.push(...sessions); + options.push({ type: 'separator', label: localize('others', "Others") }); + } for (const authenticationProvider of (await this.getAuthenticationProviders())) { const signedInForProvider = sessions.some(account => account.providerId === authenticationProvider.id); From 34116a4275502616759f551d4c48698f1497d591 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Fri, 28 Jul 2023 16:17:20 -0700 Subject: [PATCH 7/7] testing: fix expected vs actual widget does not close on ESC (#189202) Fixes #188775 --- .../testing/browser/testingOutputPeek.ts | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/vs/workbench/contrib/testing/browser/testingOutputPeek.ts b/src/vs/workbench/contrib/testing/browser/testingOutputPeek.ts index 4d9df1c05db..c8d85cb827a 100644 --- a/src/vs/workbench/contrib/testing/browser/testingOutputPeek.ts +++ b/src/vs/workbench/contrib/testing/browser/testingOutputPeek.ts @@ -34,8 +34,8 @@ import { ICodeEditor, IDiffEditorConstructionOptions, isCodeEditor } from 'vs/ed import { EditorAction2 } from 'vs/editor/browser/editorExtensions'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget'; -import { DiffEditorWidget } from 'vs/editor/browser/widget/diffEditorWidget'; -import { EmbeddedCodeEditorWidget, EmbeddedDiffEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget'; +import { DiffEditorWidget2 } from 'vs/editor/browser/widget/diffEditorWidget2/diffEditorWidget2'; +import { EmbeddedCodeEditorWidget, EmbeddedDiffEditorWidget2 } from 'vs/editor/browser/widget/embeddedCodeEditorWidget'; import { IDiffEditorOptions, IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; @@ -54,6 +54,7 @@ import { ContextKeyExpr, IContextKey, IContextKeyService } from 'vs/platform/con import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { ITextEditorOptions } from 'vs/platform/editor/common/editor'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { WorkbenchCompressibleObjectTree } from 'vs/platform/list/browser/listService'; @@ -801,8 +802,8 @@ class TestResultsPeek extends PeekViewWidget { private static lastHeightInLines?: number; private readonly visibilityChange = this._disposables.add(new Emitter()); - private readonly content: TestResultsViewContent; - private scopedContextKeyService?: IContextKeyService; + private content!: TestResultsViewContent; + private scopedContextKeyService!: IContextKeyService; private dimension?: dom.Dimension; public current?: InspectSubject; @@ -810,7 +811,7 @@ class TestResultsPeek extends PeekViewWidget { editor: ICodeEditor, @IThemeService themeService: IThemeService, @IPeekViewService peekViewService: IPeekViewService, - @ITestingPeekOpener testingPeek: ITestingPeekOpener, + @ITestingPeekOpener private readonly testingPeek: ITestingPeekOpener, @IContextKeyService private readonly contextKeyService: IContextKeyService, @IMenuService private readonly menuService: IMenuService, @IInstantiationService instantiationService: IInstantiationService, @@ -820,7 +821,6 @@ class TestResultsPeek extends PeekViewWidget { this._disposables.add(themeService.onDidColorThemeChange(this.applyTheme, this)); this._disposables.add(this.onDidClose(() => this.visibilityChange.fire(false))); - this.content = this._disposables.add(instantiationService.createInstance(TestResultsViewContent, editor, { historyVisible: testingPeek.historyVisible, showRevealLocationOnMessages: false })); this.applyTheme(themeService.getColorTheme()); peekViewService.addExclusiveWidget(editor, this); } @@ -841,11 +841,14 @@ class TestResultsPeek extends PeekViewWidget { if (!this.scopedContextKeyService) { this.scopedContextKeyService = this._disposables.add(this.contextKeyService.createScoped(container)); TestingContextKeys.isInPeek.bindTo(this.scopedContextKeyService).set(true); + const instaService = this.instantiationService.createChild(new ServiceCollection([IContextKeyService, this.scopedContextKeyService])); + this.content = this._disposables.add(instaService.createInstance(TestResultsViewContent, this.editor, { historyVisible: this.testingPeek.historyVisible, showRevealLocationOnMessages: false })); } super._fillContainer(container); } + protected override _fillHead(container: HTMLElement): void { super._fillHead(container); @@ -1025,7 +1028,7 @@ const isDiffable = (message: ITestMessage): message is ITestErrorMessage & { act message.type === TestMessageType.Error && message.actual !== undefined && message.expected !== undefined; class DiffContentProvider extends Disposable implements IPeekOutputRenderer { - private readonly widget = this._register(new MutableDisposable()); + private readonly widget = this._register(new MutableDisposable()); private readonly model = this._register(new MutableDisposable()); private dimension?: dom.IDimension; @@ -1055,13 +1058,13 @@ class DiffContentProvider extends Disposable implements IPeekOutputRenderer { const model = this.model.value = new SimpleDiffEditorModel(original, modified); if (!this.widget.value) { this.widget.value = this.editor ? this.instantiationService.createInstance( - EmbeddedDiffEditorWidget, + EmbeddedDiffEditorWidget2, this.container, diffEditorOptions, {}, this.editor, ) : this.instantiationService.createInstance( - DiffEditorWidget, + DiffEditorWidget2, this.container, diffEditorOptions, {}, @@ -1406,7 +1409,7 @@ function getOuterEditorFromDiffEditor(codeEditorService: ICodeEditorService): IC const diffEditors = codeEditorService.listDiffEditors(); for (const diffEditor of diffEditors) { - if (diffEditor.hasTextFocus() && diffEditor instanceof EmbeddedDiffEditorWidget) { + if (diffEditor.hasTextFocus() && diffEditor instanceof EmbeddedDiffEditorWidget2) { return diffEditor.getParentEditor(); } }