From 0b4911870f55568d2c5ff83a48630eb8d395c6fe Mon Sep 17 00:00:00 2001 From: Neelesh Bodas Date: Wed, 16 Aug 2023 12:16:39 -0700 Subject: [PATCH 001/117] Remove incorrect role from the title bar. --- src/vs/workbench/browser/workbench.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/browser/workbench.ts b/src/vs/workbench/browser/workbench.ts index 28863e8e434..8fae627d8f6 100644 --- a/src/vs/workbench/browser/workbench.ts +++ b/src/vs/workbench/browser/workbench.ts @@ -342,7 +342,7 @@ export class Workbench extends Layout { // Create Parts for (const { id, role, classes, options } of [ - { id: Parts.TITLEBAR_PART, role: 'contentinfo', classes: ['titlebar'] }, + { id: Parts.TITLEBAR_PART, role: 'none', classes: ['titlebar'] }, { id: Parts.BANNER_PART, role: 'banner', classes: ['banner'] }, { id: Parts.ACTIVITYBAR_PART, role: 'none', classes: ['activitybar', this.getSideBarPosition() === Position.LEFT ? 'left' : 'right'] }, // Use role 'none' for some parts to make screen readers less chatty #114892 { id: Parts.SIDEBAR_PART, role: 'none', classes: ['sidebar', this.getSideBarPosition() === Position.LEFT ? 'left' : 'right'] }, From 3b4fdca0cda60b5d79a3c95abb56184b0232341f Mon Sep 17 00:00:00 2001 From: meganrogge Date: Mon, 28 Aug 2023 11:39:57 -0700 Subject: [PATCH 002/117] fix #189776 --- src/vs/platform/terminal/common/terminal.ts | 1 + .../terminal/browser/terminalActions.ts | 18 ++++++++++++++++-- .../terminal/common/terminalConfiguration.ts | 11 +++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/vs/platform/terminal/common/terminal.ts b/src/vs/platform/terminal/common/terminal.ts index 235d8efdbe8..e7e9dbe82e2 100644 --- a/src/vs/platform/terminal/common/terminal.ts +++ b/src/vs/platform/terminal/common/terminal.ts @@ -114,6 +114,7 @@ export const enum TerminalSettingId { EnableImages = 'terminal.integrated.enableImages', SmoothScrolling = 'terminal.integrated.smoothScrolling', IgnoreBracketedPasteMode = 'terminal.integrated.ignoreBracketedPasteMode', + FocusAfterRun = 'terminal.integrated.focusAfterRun', // Debug settings that are hidden from user diff --git a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts index 8e58f90c8fc..62b3605a7d7 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts @@ -15,7 +15,7 @@ import { URI } from 'vs/base/common/uri'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { EndOfLinePreference } from 'vs/editor/common/model'; import { localize } from 'vs/nls'; -import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vs/platform/accessibility/common/accessibility'; +import { CONTEXT_ACCESSIBILITY_MODE_ENABLED, IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; import { Action2, registerAction2, IAction2Options } from 'vs/platform/actions/common/actions'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -131,6 +131,7 @@ export class TerminalLaunchHelpAction extends Action { } } + /** * A wrapper function around registerAction2 to help make registering terminal actions more concise. * The following default options are used if undefined: @@ -206,6 +207,7 @@ export function registerActiveXtermAction( }); } + export interface ITerminalServicesCollection { service: ITerminalService; groupService: ITerminalGroupService; @@ -547,6 +549,8 @@ export function registerTerminalActions() { title: { value: localize('workbench.action.terminal.runSelectedText', "Run Selected Text In Active Terminal"), original: 'Run Selected Text In Active Terminal' }, run: async (c, accessor) => { const codeEditorService = accessor.get(ICodeEditorService); + const configurationService = accessor.get(IConfigurationService); + const accessibilityService = accessor.get(IAccessibilityService); const editor = codeEditorService.getActiveCodeEditor(); if (!editor || !editor.hasModel()) { return; @@ -560,8 +564,18 @@ export function registerTerminalActions() { const endOfLinePreference = isWindows ? EndOfLinePreference.LF : EndOfLinePreference.CRLF; text = editor.getModel().getValueInRange(selection, endOfLinePreference); } - instance.sendText(text, true, true); + await instance.sendText(text, true, true); await c.service.revealActiveTerminal(); + const focusAfterRun = configurationService.getValue(TerminalSettingId.FocusAfterRun); + const focusTerminal = focusAfterRun === 'terminal' || (focusAfterRun === 'auto' && accessibilityService.isScreenReaderOptimized()); + if (focusTerminal) { + instance.focus(true); + } else if (focusAfterRun === 'accessible-buffer') { + const contribution = instance.getContribution('terminal.accessible-buffer'); + if (contribution) { + (contribution as any).show(); + } + } } }); diff --git a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts index d92eac5fe3f..07dcce63ce9 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts @@ -609,6 +609,17 @@ const terminalConfiguration: IConfigurationNode = { type: 'boolean', default: true }, + [TerminalSettingId.FocusAfterRun]: { + markdownDescription: localize('terminal.integrated.focusAfterRun', "Controls whether the terminal, accessible buffer, or neither will be focused after `Terminal: Run Selected Text In Active Terminal` has been run."), + enum: ['auto', 'terminal', 'accessible-buffer', 'none'], + default: 'auto', + markdownEnumDescriptions: [ + localize('terminal.integrated.focusAfterRun.auto', "Set to `terminal` when in screen reader optimized mode and `none` otherwise."), + localize('terminal.integrated.focusAfterRun.terminal', "Always focus the terminal."), + localize('terminal.integrated.focusAfterRun.accessible-buffer', "Always focus the accessible buffer."), + localize('terminal.integrated.focusAfterRun.none', "Keep the focus in the editor."), + ] + } } }; From bf1d725ef44f65ac38d7bee5c8167814a43e8197 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Mon, 28 Aug 2023 11:40:47 -0700 Subject: [PATCH 003/117] add accessibility tag --- .../workbench/contrib/terminal/common/terminalConfiguration.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts index 07dcce63ce9..b997c5e3c72 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts @@ -613,6 +613,7 @@ const terminalConfiguration: IConfigurationNode = { markdownDescription: localize('terminal.integrated.focusAfterRun', "Controls whether the terminal, accessible buffer, or neither will be focused after `Terminal: Run Selected Text In Active Terminal` has been run."), enum: ['auto', 'terminal', 'accessible-buffer', 'none'], default: 'auto', + tags: ['accessibility'], markdownEnumDescriptions: [ localize('terminal.integrated.focusAfterRun.auto', "Set to `terminal` when in screen reader optimized mode and `none` otherwise."), localize('terminal.integrated.focusAfterRun.terminal', "Always focus the terminal."), From d6c486841b7bb9f39467d9d47b5dc8dc0057d99c Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Mon, 28 Aug 2023 11:41:39 -0700 Subject: [PATCH 004/117] Apply suggestions from code review --- src/vs/workbench/contrib/terminal/browser/terminalActions.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts index 62b3605a7d7..dfcfe77d906 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts @@ -131,7 +131,6 @@ export class TerminalLaunchHelpAction extends Action { } } - /** * A wrapper function around registerAction2 to help make registering terminal actions more concise. * The following default options are used if undefined: @@ -207,7 +206,6 @@ export function registerActiveXtermAction( }); } - export interface ITerminalServicesCollection { service: ITerminalService; groupService: ITerminalGroupService; From 6dd57c91d05a84dd430ddf177fca0f8915e37eaf Mon Sep 17 00:00:00 2001 From: meganrogge Date: Mon, 28 Aug 2023 13:16:06 -0700 Subject: [PATCH 005/117] change none description --- .../workbench/contrib/terminal/common/terminalConfiguration.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts index b997c5e3c72..1e097672b6b 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts @@ -618,7 +618,7 @@ const terminalConfiguration: IConfigurationNode = { localize('terminal.integrated.focusAfterRun.auto', "Set to `terminal` when in screen reader optimized mode and `none` otherwise."), localize('terminal.integrated.focusAfterRun.terminal', "Always focus the terminal."), localize('terminal.integrated.focusAfterRun.accessible-buffer', "Always focus the accessible buffer."), - localize('terminal.integrated.focusAfterRun.none', "Keep the focus in the editor."), + localize('terminal.integrated.focusAfterRun.none', "Do nothing."), ] } } From 8d43226a4a92db3e78e90642a4a03919458a8bf4 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Mon, 28 Aug 2023 13:20:51 -0700 Subject: [PATCH 006/117] add requestFocus --- src/vs/workbench/contrib/terminal/browser/terminal.ts | 1 + .../workbench/contrib/terminal/browser/terminalActions.ts | 7 +++---- .../browser/terminal.accessibility.contribution.ts | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.ts b/src/vs/workbench/contrib/terminal/browser/terminal.ts index 28b600107aa..bba8941c31b 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.ts @@ -40,6 +40,7 @@ export const ITerminalInstanceService = createDecorator Date: Tue, 29 Aug 2023 05:52:08 -0700 Subject: [PATCH 007/117] Add GNU style link 'r-c.ce', 'r.c-re.ce' See https://www.gnu.org/prep/standards/html_node/Errors.html sourcefile:line1.column1-line2.column2: message sourcefile:line1.column1-column2: message sourcefile:line1-line2: message Fixes #190350 --- .../links/browser/terminalLinkParsing.ts | 12 ++++++++---- .../links/test/browser/terminalLinkParsing.test.ts | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/terminalContrib/links/browser/terminalLinkParsing.ts b/src/vs/workbench/contrib/terminalContrib/links/browser/terminalLinkParsing.ts index 1e8b5bec80f..0c1a3dd16a0 100644 --- a/src/vs/workbench/contrib/terminalContrib/links/browser/terminalLinkParsing.ts +++ b/src/vs/workbench/contrib/terminalContrib/links/browser/terminalLinkParsing.ts @@ -63,9 +63,11 @@ function generateLinkSuffixRegex(eolOnly: boolean) { // The comments in the regex below use real strings/numbers for better readability, here's // the legend: - // - Path = foo - // - Row = 339 - // - Col = 12 + // - Path = foo + // - Row = 339 + // - Col = 12 + // - RowEnd = 341 + // - ColEnd = 14 // // These all support single quote ' in the place of " and [] in the place of () const lineAndColumnRegexClauses = [ @@ -78,7 +80,9 @@ function generateLinkSuffixRegex(eolOnly: boolean) { // "foo",339 // "foo",339:12 // "foo",339.12 - `(?::| |['"],)${r()}([:.]${c()})?` + eolSuffix, + // "foo",339.12-14 + // "foo",339.12-341.14 + `(?::| |['"],)${r()}([:.]${c()}(?:-(?:${re()}\.)?${ce()})?)?` + eolSuffix, // The quotes below are optional [#171652] // "foo", line 339 [#40468] // "foo", line 339, col 12 diff --git a/src/vs/workbench/contrib/terminalContrib/links/test/browser/terminalLinkParsing.test.ts b/src/vs/workbench/contrib/terminalContrib/links/test/browser/terminalLinkParsing.test.ts index c200c575208..453b1f95ec4 100644 --- a/src/vs/workbench/contrib/terminalContrib/links/test/browser/terminalLinkParsing.test.ts +++ b/src/vs/workbench/contrib/terminalContrib/links/test/browser/terminalLinkParsing.test.ts @@ -47,6 +47,8 @@ const testLinks: ITestLink[] = [ { link: 'foo 339', prefix: undefined, suffix: ' 339', hasRow: true, hasCol: false }, { link: 'foo 339:12', prefix: undefined, suffix: ' 339:12', hasRow: true, hasCol: true }, { link: 'foo 339.12', prefix: undefined, suffix: ' 339.12', hasRow: true, hasCol: true }, + { link: 'foo 339.12-14', prefix: undefined, suffix: ' 339.12-14', hasRow: true, hasCol: true, hasRowEnd: false, hasColEnd: true }, + { link: 'foo 339.12-341.14', prefix: undefined, suffix: ' 339.12-341.14', hasRow: true, hasCol: true, hasRowEnd: true, hasColEnd: true }, // Double quotes { link: '"foo",339', prefix: '"', suffix: '",339', hasRow: true, hasCol: false }, From 24946e782463e5bd32601e5a0dfe32b3d97d39be Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 29 Aug 2023 15:13:28 +0200 Subject: [PATCH 008/117] fix #191374 --- .../environment/electron-main/environmentMainService.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vs/platform/environment/electron-main/environmentMainService.ts b/src/vs/platform/environment/electron-main/environmentMainService.ts index 748ff075783..aab03b3130f 100644 --- a/src/vs/platform/environment/electron-main/environmentMainService.ts +++ b/src/vs/platform/environment/electron-main/environmentMainService.ts @@ -6,6 +6,7 @@ import { memoize } from 'vs/base/common/decorators'; import { join } from 'vs/base/common/path'; import { isLinux } from 'vs/base/common/platform'; +import { URI } from 'vs/base/common/uri'; import { createStaticIPCHandle } from 'vs/base/parts/ipc/node/ipc.net'; import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; @@ -68,6 +69,9 @@ export class EnvironmentMainService extends NativeEnvironmentService implements @memoize get useCodeCache(): boolean { return !!this.codeCachePath; } + @memoize + override get userRoamingDataHome(): URI { return this.appSettingsHome; } + unsetSnapExportedVariables() { if (!isLinux) { return; From fbd61d106cd10077bd941abbd8a55af6858200ef Mon Sep 17 00:00:00 2001 From: Robo Date: Wed, 30 Aug 2023 00:14:02 +0900 Subject: [PATCH 009/117] chore: update distro (#191633) --- package.json | 2 +- remote/.yarnrc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4dbaa275413..276a62f924f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.82.0", - "distro": "49cc0fbc0a8e222bcce2a7c3bf62e0d23f20d258", + "distro": "2100ad274ed566f978bb917f327b3d99f95d59f2", "author": { "name": "Microsoft Corporation" }, diff --git a/remote/.yarnrc b/remote/.yarnrc index c4421581246..26dc815d0f8 100644 --- a/remote/.yarnrc +++ b/remote/.yarnrc @@ -1,5 +1,5 @@ disturl "https://nodejs.org/dist" target "18.15.0" -ms_build_id "223745" +ms_build_id "229541" runtime "node" build_from_source "true" From 72d5c4d06c322e9d2602337cde5e7fea3eb2b90d Mon Sep 17 00:00:00 2001 From: Andrea Mah <31675041+andreamah@users.noreply.github.com> Date: Tue, 29 Aug 2023 08:20:30 -0700 Subject: [PATCH 010/117] quick search - file highlight decoration isn't showing up on search (#191544) Fixes #191539 --- .../quickTextSearch/textSearchQuickAccess.ts | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess.ts b/src/vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess.ts index 6324613fbfd..14b1636c0b8 100644 --- a/src/vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess.ts +++ b/src/vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { CancellationToken } from 'vs/base/common/cancellation'; import { IMatch } from 'vs/base/common/filters'; -import { DisposableStore } from 'vs/base/common/lifecycle'; +import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle'; import { basenameOrAuthority, dirname } from 'vs/base/common/resources'; import { ThemeIcon } from 'vs/base/common/themables'; import { IRange, Range } from 'vs/editor/common/core/range'; @@ -15,8 +15,8 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { ILabelService } from 'vs/platform/label/common/label'; import { WorkbenchCompressibleObjectTree, getSelectionKeyboardEvent } from 'vs/platform/list/browser/listService'; import { FastAndSlowPicks, IPickerQuickAccessItem, PickerQuickAccessProvider, Picks } from 'vs/platform/quickinput/browser/pickerQuickAccess'; -import { DefaultQuickAccessFilterValue } from 'vs/platform/quickinput/common/quickAccess'; -import { IKeyMods, IQuickPickItem, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput'; +import { DefaultQuickAccessFilterValue, IQuickAccessProviderRunOptions } from 'vs/platform/quickinput/common/quickAccess'; +import { IKeyMods, IQuickPick, IQuickPickItem, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput'; import { IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { IWorkbenchEditorConfiguration } from 'vs/workbench/common/editor'; import { IViewsService } from 'vs/workbench/common/views'; @@ -75,6 +75,19 @@ export class TextSearchQuickAccess extends PickerQuickAccessProvider, token: CancellationToken, runOptions?: IQuickAccessProviderRunOptions): IDisposable { + const disposables = new DisposableStore(); + disposables.add(super.provide(picker, token, runOptions)); + disposables.add(picker.onDidHide(() => this.searchModel.searchResult.toggleHighlights(false))); + disposables.add(picker.onDidAccept(() => this.searchModel.searchResult.toggleHighlights(false))); + return disposables; + } + private get configuration() { const editorConfig = this._configurationService.getValue().workbench?.editor; const searchConfig = this._configurationService.getValue().search; @@ -247,6 +260,9 @@ export class TextSearchQuickAccess extends PickerQuickAccessProvider 0) { + this.searchModel.searchResult.toggleHighlights(true); + } if (matches.length >= MAX_FILES_SHOWN) { return syncResult; @@ -254,9 +270,14 @@ export class TextSearchQuickAccess extends PickerQuickAccessProvider { - return this._getPicksFromMatches(asyncResults, MAX_FILES_SHOWN - matches.length); - }) + additionalPicks: allMatches.asyncResults + .then(asyncResults => this._getPicksFromMatches(asyncResults, MAX_FILES_SHOWN - matches.length)) + .then(picks => { + if (picks.length > 0) { + this.searchModel.searchResult.toggleHighlights(true); + } + return picks; + }) }; } From 4056fc822ab355a7d1603f4f5d701f8863be5cd6 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 29 Aug 2023 08:43:14 -0700 Subject: [PATCH 011/117] Dim settings and keybindings editors Fixes #191612 Fixes #191611 --- .../accessibility/browser/unfocusedViewDimmingContribution.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts b/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts index 1dc2b4b3605..5012089fda7 100644 --- a/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts +++ b/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts @@ -46,6 +46,10 @@ export class UnfocusedViewDimmingContribution extends Disposable implements IWor rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .monaco-editor { ${filterRule} }`); // Terminal editors rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .terminal-wrapper { ${filterRule} }`); + // Settings editor + rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .settings-editor { ${filterRule} }`); + // Keybindings editor + rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .keybindings-editor { ${filterRule} }`); cssTextContent = [...rules].join('\n'); } From a56713bb39e86aa4f0396dc892faecafaf7d4702 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Tue, 29 Aug 2023 08:43:17 -0700 Subject: [PATCH 012/117] add onDidRunText --- .../contrib/terminal/browser/terminal.ts | 1 + .../terminal/browser/terminalActions.ts | 11 +---------- .../terminal/browser/terminalInstance.ts | 3 +++ .../terminal.accessibility.contribution.ts | 18 +++++++++++++++--- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.ts b/src/vs/workbench/contrib/terminal/browser/terminal.ts index bba8941c31b..c69c05e99d0 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.ts @@ -591,6 +591,7 @@ export interface ITerminalInstance { onDidBlur: Event; onDidInputData: Event; onDidChangeSelection: Event; + onDidRunText: Event; /** * An event that fires when a terminal is dropped on this instance via drag and drop. diff --git a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts index 38423fb1e4c..2cc1e80827a 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts @@ -15,7 +15,7 @@ import { URI } from 'vs/base/common/uri'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { EndOfLinePreference } from 'vs/editor/common/model'; import { localize } from 'vs/nls'; -import { CONTEXT_ACCESSIBILITY_MODE_ENABLED, IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; +import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vs/platform/accessibility/common/accessibility'; import { Action2, registerAction2, IAction2Options } from 'vs/platform/actions/common/actions'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -549,8 +549,6 @@ export function registerTerminalActions() { title: { value: localize('workbench.action.terminal.runSelectedText', "Run Selected Text In Active Terminal"), original: 'Run Selected Text In Active Terminal' }, run: async (c, accessor) => { const codeEditorService = accessor.get(ICodeEditorService); - const configurationService = accessor.get(IConfigurationService); - const accessibilityService = accessor.get(IAccessibilityService); const editor = codeEditorService.getActiveCodeEditor(); if (!editor || !editor.hasModel()) { return; @@ -566,13 +564,6 @@ export function registerTerminalActions() { } await instance.sendText(text, true, true); await c.service.revealActiveTerminal(); - const focusAfterRun = configurationService.getValue(TerminalSettingId.FocusAfterRun); - const focusTerminal = focusAfterRun === 'terminal' || (focusAfterRun === 'auto' && accessibilityService.isScreenReaderOptimized()); - if (focusTerminal) { - instance.focus(true); - } else if (focusAfterRun === 'accessible-buffer') { - instance.getContribution('terminal.accessible-buffer')?.requestFocus?.(); - } } }); diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index 3262f52d621..449e9fce543 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -322,6 +322,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { readonly onRequestAddInstanceToGroup = this._onRequestAddInstanceToGroup.event; private readonly _onDidChangeHasChildProcesses = this._register(new Emitter()); readonly onDidChangeHasChildProcesses = this._onDidChangeHasChildProcesses.event; + private readonly _onDidRunText = this._register(new Emitter()); + readonly onDidRunText = this._onDidRunText.event; constructor( private readonly _terminalShellTypeContextKey: IContextKey, @@ -1255,6 +1257,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { this._onDidInputData.fire(this); this.xterm?.suggestController?.handleNonXtermData(text); this.xterm?.scrollToBottom(); + this._onDidRunText.fire(); } async sendPath(originalPath: string | URI, addNewLine: boolean): Promise { diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminal.accessibility.contribution.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminal.accessibility.contribution.ts index 253c0837c09..0bdcf0a7803 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminal.accessibility.contribution.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminal.accessibility.contribution.ts @@ -6,12 +6,13 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Disposable, DisposableStore } from 'vs/base/common/lifecycle'; import { localize } from 'vs/nls'; -import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vs/platform/accessibility/common/accessibility'; +import { CONTEXT_ACCESSIBILITY_MODE_ENABLED, IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IQuickPick, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput'; -import { terminalTabFocusModeContextKey } from 'vs/platform/terminal/common/terminal'; +import { TerminalSettingId, terminalTabFocusModeContextKey } from 'vs/platform/terminal/common/terminal'; import { IAccessibleViewService } from 'vs/workbench/contrib/accessibility/browser/accessibleView'; import { AccessibilityHelpAction } from 'vs/workbench/contrib/accessibility/browser/accessibleViewActions'; import { ITerminalContribution, ITerminalInstance, ITerminalService, IXtermTerminal } from 'vs/workbench/contrib/terminal/browser/terminal'; @@ -59,9 +60,20 @@ class AccessibleBufferContribution extends DisposableStore implements ITerminalC private readonly _instance: ITerminalInstance, processManager: ITerminalProcessManager, widgetManager: TerminalWidgetManager, - @IInstantiationService private readonly _instantiationService: IInstantiationService + @IInstantiationService private readonly _instantiationService: IInstantiationService, + @IConfigurationService configurationService: IConfigurationService, + @IAccessibilityService accessibilityService: IAccessibilityService ) { super(); + this.add(_instance.onDidRunText(() => { + const focusAfterRun = configurationService.getValue(TerminalSettingId.FocusAfterRun); + const focusTerminal = focusAfterRun === 'terminal' || (focusAfterRun === 'auto' && accessibilityService.isScreenReaderOptimized()); + if (focusTerminal) { + _instance.focus(true); + } else if (focusAfterRun === 'accessible-buffer') { + _instance.getContribution('terminal.accessible-buffer')?.requestFocus?.(); + } + })); } layout(xterm: IXtermTerminal & { raw: Terminal }): void { this._xterm = xterm; From 406091a9a2a4dd85f32f9dddc0aaa022e15d073c Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 29 Aug 2023 08:47:09 -0700 Subject: [PATCH 013/117] Dim breadcrumbs Fixes #191608 --- .../accessibility/browser/unfocusedViewDimmingContribution.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts b/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts index 5012089fda7..f507e5b1d4c 100644 --- a/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts +++ b/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts @@ -44,6 +44,8 @@ export class UnfocusedViewDimmingContribution extends Disposable implements IWor rules.add(`.monaco-workbench .pane-body.integrated-terminal .terminal-wrapper:not(:focus-within) { ${filterRule} }`); // Text editors rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .monaco-editor { ${filterRule} }`); + // Breadcrumbs + rules.add(`.monaco-workbench .editor-group-container:not(.active) .tabs-breadcrumbs { ${filterRule} }`); // Terminal editors rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .terminal-wrapper { ${filterRule} }`); // Settings editor From ea3214b632b2cefe27eb20b20b4996b2e1ba83e1 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Tue, 29 Aug 2023 08:47:42 -0700 Subject: [PATCH 014/117] revert some changes --- src/vs/workbench/contrib/terminal/browser/terminal.ts | 1 - src/vs/workbench/contrib/terminal/browser/terminalActions.ts | 4 +--- .../browser/terminal.accessibility.contribution.ts | 5 +---- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.ts b/src/vs/workbench/contrib/terminal/browser/terminal.ts index c69c05e99d0..4092072afd7 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.ts @@ -40,7 +40,6 @@ export const ITerminalInstanceService = createDecorator Date: Tue, 29 Aug 2023 08:50:47 -0700 Subject: [PATCH 015/117] Prefer .editor-group-container over .editor-instance --- .../browser/unfocusedViewDimmingContribution.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts b/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts index f507e5b1d4c..97e68034743 100644 --- a/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts +++ b/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts @@ -43,15 +43,15 @@ export class UnfocusedViewDimmingContribution extends Disposable implements IWor // Terminals rules.add(`.monaco-workbench .pane-body.integrated-terminal .terminal-wrapper:not(:focus-within) { ${filterRule} }`); // Text editors - rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .monaco-editor { ${filterRule} }`); + rules.add(`.monaco-workbench .editor-group-container:not(.active) .monaco-editor { ${filterRule} }`); // Breadcrumbs rules.add(`.monaco-workbench .editor-group-container:not(.active) .tabs-breadcrumbs { ${filterRule} }`); // Terminal editors - rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .terminal-wrapper { ${filterRule} }`); + rules.add(`.monaco-workbench .editor-group-container:not(.active) .terminal-wrapper { ${filterRule} }`); // Settings editor - rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .settings-editor { ${filterRule} }`); + rules.add(`.monaco-workbench .editor-group-container:not(.active) .settings-editor { ${filterRule} }`); // Keybindings editor - rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .keybindings-editor { ${filterRule} }`); + rules.add(`.monaco-workbench .editor-group-container:not(.active) .keybindings-editor { ${filterRule} }`); cssTextContent = [...rules].join('\n'); } From caa82e0443e3267ba053139098fe527f2a840b75 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 29 Aug 2023 08:54:16 -0700 Subject: [PATCH 016/117] Dim editor placeholder Fixes #191614 --- .../accessibility/browser/unfocusedViewDimmingContribution.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts b/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts index 97e68034743..fade15e0f6e 100644 --- a/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts +++ b/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts @@ -36,6 +36,8 @@ export class UnfocusedViewDimmingContribution extends Disposable implements IWor ); if (opacity !== 1) { + // These filter rules are more specific than may be expected as the `filter` + // rule can cause problems if it's used inside the element like on editor hovers const rules = new Set(); const filterRule = `filter: opacity(${opacity});`; // Terminal tabs @@ -52,6 +54,8 @@ export class UnfocusedViewDimmingContribution extends Disposable implements IWor rules.add(`.monaco-workbench .editor-group-container:not(.active) .settings-editor { ${filterRule} }`); // Keybindings editor rules.add(`.monaco-workbench .editor-group-container:not(.active) .keybindings-editor { ${filterRule} }`); + // Editor placeholder (error case) + rules.add(`.monaco-workbench .editor-group-container:not(.active) .monaco-editor-pane-placeholder { ${filterRule} }`); cssTextContent = [...rules].join('\n'); } From b37772b7990e9cf699a1c29a1d543d5c86d55818 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 29 Aug 2023 08:55:40 -0700 Subject: [PATCH 017/117] Dim welcome editor Fixes #191613 --- .../accessibility/browser/unfocusedViewDimmingContribution.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts b/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts index fade15e0f6e..19712c0fa6e 100644 --- a/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts +++ b/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts @@ -56,6 +56,8 @@ export class UnfocusedViewDimmingContribution extends Disposable implements IWor rules.add(`.monaco-workbench .editor-group-container:not(.active) .keybindings-editor { ${filterRule} }`); // Editor placeholder (error case) rules.add(`.monaco-workbench .editor-group-container:not(.active) .monaco-editor-pane-placeholder { ${filterRule} }`); + // Welcome editor + rules.add(`.monaco-workbench .editor-group-container:not(.active) .gettingStartedContainer { ${filterRule} }`); cssTextContent = [...rules].join('\n'); } From 64f1488b7e388e744cd80cd1bf5b238c9f193b0a Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 29 Aug 2023 09:05:38 -0700 Subject: [PATCH 018/117] Dim unfocused setting feedback Fixes #191618 --- .../browser/accessibilityConfiguration.ts | 12 ++++++------ .../browser/unfocusedViewDimmingContribution.ts | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts b/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts index 2cd52bc8311..325a0afea94 100644 --- a/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts +++ b/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts @@ -21,8 +21,8 @@ export const accessibleViewCurrentProviderId = new RawContextKey('access * were better to live under workbench for discoverability. */ export const enum AccessibilityWorkbenchSettingId { - ViewDimUnfocusedEnabled = 'workbench.view.dimUnfocused.enabled', - ViewDimUnfocusedOpacity = 'workbench.view.dimUnfocused.opacity' + DimUnfocusedEnabled = 'accessibility.dimUnfocused.enabled', + DimUnfocusedOpacity = 'accessibility.dimUnfocused.opacity' } export const enum ViewDimUnfocusedOpacityProperties { @@ -120,15 +120,15 @@ export function registerAccessibilityConfiguration() { registry.registerConfiguration({ ...workbenchConfigurationNodeBase, properties: { - [AccessibilityWorkbenchSettingId.ViewDimUnfocusedEnabled]: { - description: localize('dimUnfocusedEnabled', 'Whether to dim unfocused editors and terminals, making the focused view more obvious.'), + [AccessibilityWorkbenchSettingId.DimUnfocusedEnabled]: { + description: localize('dimUnfocusedEnabled', 'Whether to dim unfocused editors and terminals, which makes it more clear where typed input will go to. This works with the majority of editors with the notable exceptions of those that utilize iframes like notebooks and extension webview editors.'), type: 'boolean', default: false, tags: ['accessibility'], scope: ConfigurationScope.APPLICATION, }, - [AccessibilityWorkbenchSettingId.ViewDimUnfocusedOpacity]: { - description: localize('dimUnfocusedOpacity', 'The opacity fraction (0.2 to 1.0) to use for unfocused editors and terminals. This will only take effect when {0} is enabled.', `\`#${AccessibilityWorkbenchSettingId.ViewDimUnfocusedEnabled}#\``), + [AccessibilityWorkbenchSettingId.DimUnfocusedOpacity]: { + description: localize('dimUnfocusedOpacity', 'The opacity fraction (0.2 to 1.0) to use for unfocused editors and terminals. This will only take effect when {0} is enabled.', `\`#${AccessibilityWorkbenchSettingId.DimUnfocusedEnabled}#\``), type: 'number', minimum: ViewDimUnfocusedOpacityProperties.Minimum, maximum: ViewDimUnfocusedOpacityProperties.Maximum, diff --git a/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts b/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts index 19712c0fa6e..d4c7a06284c 100644 --- a/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts +++ b/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts @@ -21,16 +21,16 @@ export class UnfocusedViewDimmingContribution extends Disposable implements IWor this._register(toDisposable(() => this._removeStyleElement())); this._register(Event.runAndSubscribe(configurationService.onDidChangeConfiguration, e => { - if (e && !e.affectsConfiguration(AccessibilityWorkbenchSettingId.ViewDimUnfocusedEnabled) && !e.affectsConfiguration(AccessibilityWorkbenchSettingId.ViewDimUnfocusedOpacity)) { + if (e && !e.affectsConfiguration(AccessibilityWorkbenchSettingId.DimUnfocusedEnabled) && !e.affectsConfiguration(AccessibilityWorkbenchSettingId.DimUnfocusedOpacity)) { return; } let cssTextContent = ''; - const enabled = ensureBoolean(configurationService.getValue(AccessibilityWorkbenchSettingId.ViewDimUnfocusedEnabled), false); + const enabled = ensureBoolean(configurationService.getValue(AccessibilityWorkbenchSettingId.DimUnfocusedEnabled), false); if (enabled) { const opacity = clamp( - ensureNumber(configurationService.getValue(AccessibilityWorkbenchSettingId.ViewDimUnfocusedOpacity), ViewDimUnfocusedOpacityProperties.Default), + ensureNumber(configurationService.getValue(AccessibilityWorkbenchSettingId.DimUnfocusedOpacity), ViewDimUnfocusedOpacityProperties.Default), ViewDimUnfocusedOpacityProperties.Minimum, ViewDimUnfocusedOpacityProperties.Maximum ); From 2af3045474f52bad8f14f01b09acfd5912e7fb5a Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Tue, 29 Aug 2023 10:28:37 -0700 Subject: [PATCH 019/117] tunnels: fix forwarding attempts wrong path to tunnel binary on linux (#191657) Fixes #191621 --- extensions/tunnel-forwarding/src/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/tunnel-forwarding/src/extension.ts b/extensions/tunnel-forwarding/src/extension.ts index 3dd6fdfef19..83789934df5 100644 --- a/extensions/tunnel-forwarding/src/extension.ts +++ b/extensions/tunnel-forwarding/src/extension.ts @@ -25,7 +25,7 @@ const cliPath = process.env.VSCODE_FORWARDING_IS_DEV ? path.join(__dirname, '../../../cli/target/debug/code') : path.join( vscode.env.appRoot, - process.platform === 'win32' ? '../../bin' : 'bin', + process.platform === 'darwin' ? 'bin' : '../../bin', vscode.env.appQuality === 'stable' ? 'code-tunnel' : 'code-tunnel-insiders', ) + (process.platform === 'win32' ? '.exe' : ''); From a76ad82cad11dc5b0019585c61ae30ffa79d523b Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Tue, 29 Aug 2023 18:13:23 +0000 Subject: [PATCH 020/117] Amend --- src/vscode-dts/vscode.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vscode-dts/vscode.d.ts b/src/vscode-dts/vscode.d.ts index 5a146bee7bb..4f5c61daaa7 100644 --- a/src/vscode-dts/vscode.d.ts +++ b/src/vscode-dts/vscode.d.ts @@ -11457,6 +11457,9 @@ declare module 'vscode' { clear(): void; } + /** + * A collection of mutations that an extension can apply to a process environment. Applies to all scopes. + */ export interface GlobalEnvironmentVariableCollection extends EnvironmentVariableCollection { /** * Gets scope-specific environment variable collection for the extension. This enables alterations to @@ -11471,6 +11474,8 @@ declare module 'vscode' { * If a scope parameter is omitted, collection applicable to all relevant scopes for that parameter is * returned. For instance, if the 'workspaceFolder' parameter is not specified, the collection that applies * across all workspace folders will be returned. + * + * @return Environment variable collection for the passed in scope. */ getScoped(scope: EnvironmentVariableScope): EnvironmentVariableCollection; } From 96ddbc4daad3129d444e9a0b49d5fa86177a8c3f Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 29 Aug 2023 21:13:55 +0200 Subject: [PATCH 021/117] Notification and notification buttons lack border radius (fix #191532) (#191557) --- .../browser/parts/notifications/notificationsViewer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts b/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts index 0be6eaf64c0..cb9d9b7ce0e 100644 --- a/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts +++ b/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts @@ -93,7 +93,7 @@ export class NotificationsListDelegate implements IListVirtualDelegate 1 */)}px`; // Render message into offset helper const renderedMessage = NotificationMessageRenderer.render(notification.message); From c63ccaba1c9f6659859645e134f67bc146e62781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moreno?= Date: Tue, 29 Aug 2023 21:32:59 +0200 Subject: [PATCH 022/117] add screencastMode.keyboardOptions.showKeybindings (#191686) fixes #179541 --- src/vs/workbench/browser/actions/developerActions.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/browser/actions/developerActions.ts b/src/vs/workbench/browser/actions/developerActions.ts index 91297a82197..48c3f08a46e 100644 --- a/src/vs/workbench/browser/actions/developerActions.ts +++ b/src/vs/workbench/browser/actions/developerActions.ts @@ -94,6 +94,7 @@ class InspectContextKeysAction extends Action2 { interface IScreencastKeyboardOptions { readonly showKeys?: boolean; + readonly showKeybindings?: boolean; readonly showCommands?: boolean; readonly showCommandGroups?: boolean; readonly showSingleEditorCursorMoves?: boolean; @@ -315,7 +316,7 @@ class ToggleScreencastModeAction extends Action2 { append(keyboardMarker, $('span.title', {}, `${commandAndGroupLabel} `)); } - if (options.showKeys ?? true) { + if ((options.showKeys ?? true) || (command && (options.showKeybindings ?? true))) { // Fix label for arrow keys keyLabel = keyLabel?.replace('UpArrow', '↑') ?.replace('DownArrow', '↓') @@ -435,6 +436,11 @@ configurationRegistry.registerConfiguration({ default: true, description: localize('screencastMode.keyboardOptions.showKeys', "Show raw keys.") }, + 'showKeybindings': { + type: 'boolean', + default: true, + description: localize('screencastMode.keyboardOptions.showKeybindings', "Show keyboard shortcuts.") + }, 'showCommands': { type: 'boolean', default: true, @@ -453,6 +459,7 @@ configurationRegistry.registerConfiguration({ }, default: { 'showKeys': true, + 'showKeybindings': true, 'showCommands': true, 'showCommandGroups': false, 'showSingleEditorCursorMoves': true From 350bdb4b1be87cbe4ac2a612d9edcb70297a5a75 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 29 Aug 2023 12:50:28 -0700 Subject: [PATCH 023/117] Fix dim unfocused settings link Fixes #191643 --- .../contrib/accessibility/browser/accessibilityConfiguration.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts b/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts index 325a0afea94..05812456635 100644 --- a/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts +++ b/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts @@ -128,7 +128,7 @@ export function registerAccessibilityConfiguration() { scope: ConfigurationScope.APPLICATION, }, [AccessibilityWorkbenchSettingId.DimUnfocusedOpacity]: { - description: localize('dimUnfocusedOpacity', 'The opacity fraction (0.2 to 1.0) to use for unfocused editors and terminals. This will only take effect when {0} is enabled.', `\`#${AccessibilityWorkbenchSettingId.DimUnfocusedEnabled}#\``), + markdownDescription: localize('dimUnfocusedOpacity', 'The opacity fraction (0.2 to 1.0) to use for unfocused editors and terminals. This will only take effect when {0} is enabled.', `\`#${AccessibilityWorkbenchSettingId.DimUnfocusedEnabled}#\``), type: 'number', minimum: ViewDimUnfocusedOpacityProperties.Minimum, maximum: ViewDimUnfocusedOpacityProperties.Maximum, From 1157f145b608edb87b90146536e64d68292990e3 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Tue, 29 Aug 2023 13:31:39 -0700 Subject: [PATCH 024/117] Use correct check for just focusing (#191696) fixes https://github.com/microsoft/vscode-internalbacklog/issues/4580 --- src/vs/workbench/contrib/chat/browser/chatQuick.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/chat/browser/chatQuick.ts b/src/vs/workbench/contrib/chat/browser/chatQuick.ts index 03420bc79b4..5545e1a5d03 100644 --- a/src/vs/workbench/contrib/chat/browser/chatQuick.ts +++ b/src/vs/workbench/contrib/chat/browser/chatQuick.ts @@ -59,8 +59,9 @@ export class QuickChatService extends Disposable implements IQuickChatService { this.open(providerId, query); } } + open(providerId?: string, query?: string | undefined): void { - if (this.focused) { + if (this._input) { return this.focus(); } From 9858757c41ab641b72b68845278b910c6fea8cdc Mon Sep 17 00:00:00 2001 From: Justin Chen <54879025+justschen@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:33:29 -0700 Subject: [PATCH 025/117] Action widget fuzzyMatch fix (#191687) fixes fuzzy matching confusion - makes sure only finds exact matching --- src/vs/base/browser/ui/list/listWidget.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/vs/base/browser/ui/list/listWidget.ts b/src/vs/base/browser/ui/list/listWidget.ts index ee900068b4b..b077aa3ff69 100644 --- a/src/vs/base/browser/ui/list/listWidget.ts +++ b/src/vs/base/browser/ui/list/listWidget.ts @@ -532,13 +532,16 @@ class TypeNavigationController implements IDisposable { const prefix = matchesPrefix(word, labelStr); const fuzzy = matchesFuzzy2(word, labelStr); - // ensures that when fuzzy matching, it doesn't clash with prefix matching (1 input vs 1+ should be prefix and fuzzy respecitvely) - const fuzzyScore = fuzzy ? fuzzy[0].end - fuzzy[0].start : 0; - if (prefix || fuzzyScore > 1) { - this.previouslyFocused = start; - this.list.setFocus([index]); - this.list.reveal(index); - return; + if (fuzzy) { + const fuzzyScore = fuzzy[0].end - fuzzy[0].start; + + // ensures that when fuzzy matching, doesn't clash with prefix matching (1 input vs 1+ should be prefix and fuzzy respecitvely). Also makes sure that exact matches are prioritized. + if (prefix || (fuzzyScore > 1 && fuzzy.length === 1)) { + this.previouslyFocused = start; + this.list.setFocus([index]); + this.list.reveal(index); + return; + } } } } else { From 5413247e57fb7e3d29cd36f08266005fe72bbde4 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Tue, 29 Aug 2023 13:57:48 -0700 Subject: [PATCH 026/117] serve-web: delete socket file on server shutdown (#191692) Fixes #191691 --- cli/src/commands/serve_web.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/cli/src/commands/serve_web.rs b/cli/src/commands/serve_web.rs index 8d37427dd33..2181c6339a4 100644 --- a/cli/src/commands/serve_web.rs +++ b/cli/src/commands/serve_web.rs @@ -25,6 +25,7 @@ use crate::download_cache::DownloadCache; use crate::log; use crate::options::Quality; use crate::state::{LauncherPaths, PersistedState}; +use crate::tunnels::shutdown_signal::ShutdownRequest; use crate::update_service::{ unzip_downloaded_release, Platform, Release, TargetKind, UpdateService, }; @@ -98,12 +99,20 @@ pub async fn serve_web(ctx: CommandContext, mut args: ServeWebArgs) -> Result(service) } }; + let mut shutdown = ShutdownRequest::create_rx([ShutdownRequest::CtrlC]); let r = if let Some(s) = args.socket_path { - let socket = listen_socket_rw_stream(&PathBuf::from(&s)).await?; - ctx.log.result(format!("Web UI available on {}", s)); - Server::builder(socket.into_pollable()) + let s = PathBuf::from(&s); + let socket = listen_socket_rw_stream(&s).await?; + ctx.log + .result(format!("Web UI available on {}", s.display())); + let r = Server::builder(socket.into_pollable()) .serve(make_service_fn(|_| make_svc())) - .await + .with_graceful_shutdown(async { + let _ = shutdown.wait().await; + }) + .await; + let _ = std::fs::remove_file(&s); // cleanup + r } else { let addr: SocketAddr = match &args.host { Some(h) => { @@ -120,6 +129,9 @@ pub async fn serve_web(ctx: CommandContext, mut args: ServeWebArgs) -> Result Date: Tue, 29 Aug 2023 14:05:13 -0700 Subject: [PATCH 027/117] fix #191591 --- .../accessibility/browser/terminalAccessibilityHelp.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibilityHelp.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibilityHelp.ts index 206e04d47cc..9205be2e624 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibilityHelp.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibilityHelp.ts @@ -60,7 +60,14 @@ export class TerminalAccessibleContentProvider extends Disposable implements IAc const kb = this._keybindingService.lookupKeybindings(commandId); // Run recent command has multiple keybindings. lookupKeybinding just returns the first one regardless of the when context. // Thus, we have to check if accessibility mode is enabled to determine which keybinding to use. - return this._accessibilityService.isScreenReaderOptimized() ? format(msg, kb[1].getAriaLabel()) : format(msg, kb[0].getAriaLabel()); + const isScreenReaderOptimized = this._accessibilityService.isScreenReaderOptimized(); + if (isScreenReaderOptimized && kb[1]) { + format(msg, kb[1].getAriaLabel()); + } else if (kb[0]) { + format(msg, kb[0].getAriaLabel()); + } else { + return format(noKbMsg, commandId); + } } const kb = this._keybindingService.lookupKeybinding(commandId, this._contextKeyService)?.getAriaLabel(); return !kb ? format(noKbMsg, commandId) : format(msg, kb); From 16c0c5796ed44db224741b6899cd3e0b7c464d1e Mon Sep 17 00:00:00 2001 From: meganrogge Date: Tue, 29 Aug 2023 14:24:58 -0700 Subject: [PATCH 028/117] fix #191672 --- .../workbench/contrib/accessibility/browser/accessibleView.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/accessibility/browser/accessibleView.ts b/src/vs/workbench/contrib/accessibility/browser/accessibleView.ts index 42e95d10c93..1f82f5c1e9b 100644 --- a/src/vs/workbench/contrib/accessibility/browser/accessibleView.ts +++ b/src/vs/workbench/contrib/accessibility/browser/accessibleView.ts @@ -506,9 +506,9 @@ class AccessibleView extends Disposable { let hint = ''; const disableKeybinding = this._keybindingService.lookupKeybinding(AccessibilityCommandId.DisableVerbosityHint, this._contextKeyService)?.getAriaLabel(); if (disableKeybinding) { - hint = localize('acessibleViewDisableHint', "Disable the aria label hint to open this ({0}).\n", disableKeybinding); + hint = localize('acessibleViewDisableHint', "Disable accessibility verbosity for this feature ({0}). This will disable the hint to open the accessible view for example.\n", disableKeybinding); } else { - hint = localize('accessibleViewDisableHintNoKb', "Add a keybinding for the command Disable Accessible View Hint to disable this hint.\n"); + hint = localize('accessibleViewDisableHintNoKb', "Add a keybinding for the command Disable Accessible View Hint, which disables accessibility verbosity for this feature.\n"); } return hint; } From 3a597af3e6260df6dba8f47025b4c077eed4aa78 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Tue, 29 Aug 2023 14:33:50 -0700 Subject: [PATCH 029/117] fix #191684 --- .../accessibility/browser/accessibilityContributions.ts | 4 ++++ .../contrib/accessibility/browser/accessibleViewActions.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/accessibility/browser/accessibilityContributions.ts b/src/vs/workbench/contrib/accessibility/browser/accessibilityContributions.ts index 720720b02df..90544aabea6 100644 --- a/src/vs/workbench/contrib/accessibility/browser/accessibilityContributions.ts +++ b/src/vs/workbench/contrib/accessibility/browser/accessibilityContributions.ts @@ -258,6 +258,10 @@ function getActionsFromNotification(notification: INotificationViewItem): IActio }; } } + const manageExtension = actions?.find(a => a.label.includes('Manage Extension')); + if (manageExtension) { + manageExtension.class = ThemeIcon.asClassName(Codicon.gear); + } if (actions) { actions.push({ id: 'clearNotification', label: localize('clearNotification', "Clear Notification"), tooltip: localize('clearNotification', "Clear Notification"), run: () => notification.close(), enabled: true, class: ThemeIcon.asClassName(Codicon.clearAll) }); } diff --git a/src/vs/workbench/contrib/accessibility/browser/accessibleViewActions.ts b/src/vs/workbench/contrib/accessibility/browser/accessibleViewActions.ts index 21547678e51..0721b08a570 100644 --- a/src/vs/workbench/contrib/accessibility/browser/accessibleViewActions.ts +++ b/src/vs/workbench/contrib/accessibility/browser/accessibleViewActions.ts @@ -160,7 +160,7 @@ class AccessibleViewDisableHintAction extends Action2 { primary: KeyMod.Alt | KeyCode.F6, weight: KeybindingWeight.WorkbenchContrib }, - icon: Codicon.treeFilterClear, + icon: Codicon.bellSlash, menu: [ commandPalette, { From 5c3a9678d8098374cf09bd184784f43b93817773 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Tue, 29 Aug 2023 14:46:55 -0700 Subject: [PATCH 030/117] fix #191722 --- .../accessibility/browser/accessibilityConfiguration.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts b/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts index 05812456635..384572c7402 100644 --- a/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts +++ b/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts @@ -42,7 +42,7 @@ export const enum AccessibilityVerbositySettingId { Editor = 'accessibility.verbosity.editor', Hover = 'accessibility.verbosity.hover', Notification = 'accessibility.verbosity.notification', - EditorUntitledHint = 'accessibility.verbosity.editor.untitledHint' + EditorUntitledHint = 'accessibility.verbosity.untitledHint' } export const enum AccessibleViewProviderId { @@ -107,7 +107,7 @@ const configuration: IConfigurationNode = { ...baseProperty }, [AccessibilityVerbositySettingId.EditorUntitledHint]: { - description: localize('verbosity.editor.untitledhint', 'Provide information about relevant actions in an untitled text editor.'), + description: localize('verbosity.untitledhint', 'Provide information about relevant actions in an untitled text editor.'), ...baseProperty } } From 86a82d46a838fc516cc19e3b4a69249232bf74c3 Mon Sep 17 00:00:00 2001 From: Michael Lively Date: Tue, 29 Aug 2023 15:42:20 -0700 Subject: [PATCH 031/117] Skip Nb Sticky Scroll testing on web platform. (#191716) * test change * skip notebook sticky scroll testing on web --- .../notebook/test/browser/notebookStickyScroll.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/test/browser/notebookStickyScroll.test.ts b/src/vs/workbench/contrib/notebook/test/browser/notebookStickyScroll.test.ts index 708b8b7aea8..99cb8117b61 100644 --- a/src/vs/workbench/contrib/notebook/test/browser/notebookStickyScroll.test.ts +++ b/src/vs/workbench/contrib/notebook/test/browser/notebookStickyScroll.test.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; +import { isWeb } from 'vs/base/common/platform'; import { Event } from 'vs/base/common/event'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { mock } from 'vs/base/test/common/mock'; @@ -19,7 +20,7 @@ import { createNotebookCellList, setupInstantiationService, withTestNotebook } f import { OutlineTarget } from 'vs/workbench/services/outline/browser/outline'; -suite('NotebookEditorStickyScroll', () => { +(isWeb ? suite.skip : suite)('NotebookEditorStickyScroll', () => { let disposables: DisposableStore; let instantiationService: TestInstantiationService; @@ -92,7 +93,6 @@ suite('NotebookEditorStickyScroll', () => { const notebookOutlineEntries = getOutline(editor).entries; const resultingMap = nbStickyTestHelper(domNode, editor, cellList, notebookOutlineEntries); - await assertSnapshot(resultingMap); }); }); From 4b82860e269125af32a53be167edf7f88c461845 Mon Sep 17 00:00:00 2001 From: Andrea Mah <31675041+andreamah@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:45:50 -0700 Subject: [PATCH 032/117] Clicking into notebook markdown search result clears result (#191731) Fixes #191666 --- src/vs/workbench/contrib/search/browser/searchView.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/vs/workbench/contrib/search/browser/searchView.ts b/src/vs/workbench/contrib/search/browser/searchView.ts index b87d1347816..dd150169376 100644 --- a/src/vs/workbench/contrib/search/browser/searchView.ts +++ b/src/vs/workbench/contrib/search/browser/searchView.ts @@ -1894,7 +1894,6 @@ export class SearchView extends ViewPane { pinned, selection, revealIfVisible: true, - indexedCellOptions: element instanceof MatchInNotebook ? { index: element.cellIndex, selection: element.range() } : undefined, }; try { From 20f00913476c551011c0ffc81f03493e8da72eb7 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Tue, 29 Aug 2023 17:46:46 -0700 Subject: [PATCH 033/117] Don't allow taking action on codeblocks in filtered responses (#191732) Fix microsoft/vscode-copilot#1148 --- .../browser/actions/chatCodeblockActions.ts | 24 +++++++++++++++++-- .../chat/browser/actions/chatTitleActions.ts | 4 ++-- .../contrib/chat/browser/chatListRenderer.ts | 13 ++++++++-- .../contrib/chat/common/chatContextKeys.ts | 1 + 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.ts index 3761e137dc5..8439a5d14fd 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.ts @@ -11,8 +11,10 @@ import { ServicesAccessor } from 'vs/editor/browser/editorExtensions'; import { IBulkEditService, ResourceTextEdit } from 'vs/editor/browser/services/bulkEditService'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { Range } from 'vs/editor/common/core/range'; +import { RelatedContextItem, WorkspaceEdit } from 'vs/editor/common/languages'; import { ILanguageService } from 'vs/editor/common/languages/language'; import { ITextModel } from 'vs/editor/common/model'; +import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures'; import { CopyAction } from 'vs/editor/contrib/clipboard/browser/clipboard'; import { localize } from 'vs/nls'; import { Action2, MenuId, registerAction2 } from 'vs/platform/actions/common/actions'; @@ -31,8 +33,6 @@ import { CellKind, NOTEBOOK_EDITOR_ID } from 'vs/workbench/contrib/notebook/comm import { ITerminalEditorService, ITerminalGroupService, ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; -import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures'; -import { WorkspaceEdit, RelatedContextItem } from 'vs/editor/common/languages'; export interface IChatCodeBlockActionContext { code: string; @@ -92,6 +92,11 @@ export function registerChatCodeBlockActions() { return; } + if (context.element.errorDetails?.responseIsFiltered) { + // When run from command palette + return; + } + const clipboardService = accessor.get(IClipboardService); clipboardService.writeText(context.code); @@ -183,6 +188,11 @@ export function registerChatCodeBlockActions() { const editorService = accessor.get(IEditorService); const textFileService = accessor.get(ITextFileService); + if (context.element.errorDetails?.responseIsFiltered) { + // When run from command palette + return; + } + if (editorService.activeEditorPane?.getId() === NOTEBOOK_EDITOR_ID) { return this.handleNotebookEditor(accessor, editorService.activeEditorPane.getControl() as INotebookEditor, context); } @@ -312,6 +322,11 @@ export function registerChatCodeBlockActions() { } override async runWithContext(accessor: ServicesAccessor, context: IChatCodeBlockActionContext) { + if (context.element.errorDetails?.responseIsFiltered) { + // When run from command palette + return; + } + const editorService = accessor.get(IEditorService); const chatService = accessor.get(IChatService); editorService.openEditor({ contents: context.code, languageId: context.languageId, resource: undefined }); @@ -358,6 +373,11 @@ export function registerChatCodeBlockActions() { } override async runWithContext(accessor: ServicesAccessor, context: IChatCodeBlockActionContext) { + if (context.element.errorDetails?.responseIsFiltered) { + // When run from command palette + return; + } + const chatService = accessor.get(IChatService); const terminalService = accessor.get(ITerminalService); const editorService = accessor.get(IEditorService); diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.ts index 19bd054e7b8..6d7a399b006 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.ts @@ -15,7 +15,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis import { ResourceNotebookCellEdit } from 'vs/workbench/contrib/bulkEdit/browser/bulkCellEdits'; import { CHAT_CATEGORY } from 'vs/workbench/contrib/chat/browser/actions/chatActions'; import { IChatWidgetService } from 'vs/workbench/contrib/chat/browser/chat'; -import { CONTEXT_IN_CHAT_INPUT, CONTEXT_IN_CHAT_SESSION, CONTEXT_REQUEST, CONTEXT_RESPONSE, CONTEXT_RESPONSE_VOTE } from 'vs/workbench/contrib/chat/common/chatContextKeys'; +import { CONTEXT_IN_CHAT_INPUT, CONTEXT_IN_CHAT_SESSION, CONTEXT_REQUEST, CONTEXT_RESPONSE, CONTEXT_RESPONSE_FILTERED, CONTEXT_RESPONSE_VOTE } from 'vs/workbench/contrib/chat/common/chatContextKeys'; import { IChatService, IChatUserActionEvent, InteractiveSessionVoteDirection } from 'vs/workbench/contrib/chat/common/chatService'; import { isRequestVM, isResponseVM } from 'vs/workbench/contrib/chat/common/chatViewModel'; import { INotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; @@ -119,7 +119,7 @@ export function registerChatTitleActions() { id: MenuId.ChatMessageTitle, group: 'navigation', isHiddenByDefault: true, - when: ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, CONTEXT_RESPONSE) + when: ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, CONTEXT_RESPONSE, CONTEXT_RESPONSE_FILTERED.negate()) } }); } diff --git a/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts b/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts index 1208e6134c3..06f2c24dfb6 100644 --- a/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts +++ b/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts @@ -61,7 +61,7 @@ import { IChatCodeBlockActionContext } from 'vs/workbench/contrib/chat/browser/a import { ChatTreeItem, IChatCodeBlockInfo, IChatFileTreeInfo } from 'vs/workbench/contrib/chat/browser/chat'; import { ChatFollowups } from 'vs/workbench/contrib/chat/browser/chatFollowups'; import { ChatEditorOptions } from 'vs/workbench/contrib/chat/browser/chatOptions'; -import { CONTEXT_REQUEST, CONTEXT_RESPONSE, CONTEXT_RESPONSE_HAS_PROVIDER_ID, CONTEXT_RESPONSE_VOTE } from 'vs/workbench/contrib/chat/common/chatContextKeys'; +import { CONTEXT_REQUEST, CONTEXT_RESPONSE, CONTEXT_RESPONSE_FILTERED, CONTEXT_RESPONSE_HAS_PROVIDER_ID, CONTEXT_RESPONSE_VOTE } from 'vs/workbench/contrib/chat/common/chatContextKeys'; import { IChatReplyFollowup, IChatResponseProgressFileTreeData, IChatService, ISlashCommand, InteractiveSessionVoteDirection } from 'vs/workbench/contrib/chat/common/chatService'; import { IChatResponseMarkdownRenderData, IChatResponseRenderData, IChatResponseViewModel, IChatWelcomeMessageViewModel, isRequestVM, isResponseVM, isWelcomeVM } from 'vs/workbench/contrib/chat/common/chatViewModel'; import { IWordCountResult, getNWords } from 'vs/workbench/contrib/chat/common/chatWordCounter'; @@ -268,10 +268,13 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer('chatSessionResponseHasProviderId', false, { type: 'boolean', description: localize('interactiveSessionResponseHasProviderId', "True when the provider has assigned an id to this response.") }); export const CONTEXT_RESPONSE_VOTE = new RawContextKey('chatSessionResponseVote', '', { type: 'string', description: localize('interactiveSessionResponseVote', "When the response has been voted up, is set to 'up'. When voted down, is set to 'down'. Otherwise an empty string.") }); +export const CONTEXT_RESPONSE_FILTERED = new RawContextKey('chatSessionResponseFiltered', false, { type: 'boolean', description: localize('chatResponseFiltered', "True when the chat response was filtered out by the server.") }); export const CONTEXT_CHAT_REQUEST_IN_PROGRESS = new RawContextKey('chatSessionRequestInProgress', false, { type: 'boolean', description: localize('interactiveSessionRequestInProgress', "True when the current request is still in progress.") }); export const CONTEXT_RESPONSE = new RawContextKey('chatResponse', false, { type: 'boolean', description: localize('chatResponse', "The chat item is a response.") }); From 046cfbf6d0b50a0cbd74d722451870bdcdacd30c Mon Sep 17 00:00:00 2001 From: Hans Date: Wed, 30 Aug 2023 09:04:15 +0800 Subject: [PATCH 034/117] add custom hover for quick open (#191416) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add custom hover for quick open * 💄 * 💄 * adjust delayer create logic --- .../platform/quickinput/browser/quickInput.ts | 2 +- .../browser/quickInputController.ts | 5 +- .../quickinput/browser/quickInputList.ts | 88 ++++++++++--------- .../quickinput/browser/quickInputService.ts | 6 -- 4 files changed, 51 insertions(+), 50 deletions(-) diff --git a/src/vs/platform/quickinput/browser/quickInput.ts b/src/vs/platform/quickinput/browser/quickInput.ts index 173bbc88096..4258cd0640a 100644 --- a/src/vs/platform/quickinput/browser/quickInput.ts +++ b/src/vs/platform/quickinput/browser/quickInput.ts @@ -47,7 +47,7 @@ export interface IQuickInputOptions { renderers: IListRenderer[], options: IListOptions, ): List; - hoverDelegate: IHoverDelegate; + hoverDelegate?: IHoverDelegate; styles: IQuickInputStyles; } diff --git a/src/vs/platform/quickinput/browser/quickInputController.ts b/src/vs/platform/quickinput/browser/quickInputController.ts index 85780828ce1..932eec180e1 100644 --- a/src/vs/platform/quickinput/browser/quickInputController.ts +++ b/src/vs/platform/quickinput/browser/quickInputController.ts @@ -83,12 +83,13 @@ export class QuickInputController extends Disposable { const titleBar = dom.append(container, $('.quick-input-titlebar')); - const leftActionBar = this._register(new ActionBar(titleBar)); + const actionBarOption = this.options.hoverDelegate ? { hoverDelegate: this.options.hoverDelegate } : undefined; + const leftActionBar = this._register(new ActionBar(titleBar, actionBarOption)); leftActionBar.domNode.classList.add('quick-input-left-action-bar'); const title = dom.append(titleBar, $('.quick-input-title')); - const rightActionBar = this._register(new ActionBar(titleBar)); + const rightActionBar = this._register(new ActionBar(titleBar, actionBarOption)); rightActionBar.domNode.classList.add('quick-input-right-action-bar'); const headerContainer = dom.append(container, $('.quick-input-header')); diff --git a/src/vs/platform/quickinput/browser/quickInputList.ts b/src/vs/platform/quickinput/browser/quickInputList.ts index e5914bfef84..bb8dc4c1429 100644 --- a/src/vs/platform/quickinput/browser/quickInputList.ts +++ b/src/vs/platform/quickinput/browser/quickInputList.ts @@ -541,46 +541,49 @@ export class QuickInputList { } })); - const delayer = new ThrottledDelayer(options.hoverDelegate.delay); - // onMouseOver triggers every time a new element has been moused over - // even if it's on the same list item. - this.disposables.push(this.list.onMouseOver(async e => { - // If we hover over an anchor element, we don't want to show the hover because - // the anchor may have a tooltip that we want to show instead. - if (e.browserEvent.target instanceof HTMLAnchorElement) { - delayer.cancel(); - return; - } - if ( - // anchors are an exception as called out above so we skip them here - !(e.browserEvent.relatedTarget instanceof HTMLAnchorElement) && - // check if the mouse is still over the same element - dom.isAncestor(e.browserEvent.relatedTarget as Node, e.element?.element as Node) - ) { - return; - } - try { - await delayer.trigger(async () => { - if (e.element) { - this.showHover(e.element); - } - }); - } catch (e) { - // Ignore cancellation errors due to mouse out - if (!isCancellationError(e)) { - throw e; + if (options.hoverDelegate) { + const delayer = new ThrottledDelayer(options.hoverDelegate.delay); + // onMouseOver triggers every time a new element has been moused over + // even if it's on the same list item. + this.disposables.push(this.list.onMouseOver(async e => { + // If we hover over an anchor element, we don't want to show the hover because + // the anchor may have a tooltip that we want to show instead. + if (e.browserEvent.target instanceof HTMLAnchorElement) { + delayer.cancel(); + return; } - } - })); - this.disposables.push(this.list.onMouseOut(e => { - // onMouseOut triggers every time a new element has been moused over - // even if it's on the same list item. We only want one event, so we - // check if the mouse is still over the same element. - if (dom.isAncestor(e.browserEvent.relatedTarget as Node, e.element?.element as Node)) { - return; - } - delayer.cancel(); - })); + if ( + // anchors are an exception as called out above so we skip them here + !(e.browserEvent.relatedTarget instanceof HTMLAnchorElement) && + // check if the mouse is still over the same element + dom.isAncestor(e.browserEvent.relatedTarget as Node, e.element?.element as Node) + ) { + return; + } + try { + await delayer.trigger(async () => { + if (e.element) { + this.showHover(e.element); + } + }); + } catch (e) { + // Ignore cancellation errors due to mouse out + if (!isCancellationError(e)) { + throw e; + } + } + })); + this.disposables.push(this.list.onMouseOut(e => { + // onMouseOut triggers every time a new element has been moused over + // even if it's on the same list item. We only want one event, so we + // check if the mouse is still over the same element. + if (dom.isAncestor(e.browserEvent.relatedTarget as Node, e.element?.element as Node)) { + return; + } + delayer.cancel(); + })); + this.disposables.push(delayer); + } this.disposables.push(this._listElementChecked.event(_ => this.fireCheckedEvents())); this.disposables.push( this._onChangedAllVisibleChecked, @@ -590,8 +593,7 @@ export class QuickInputList { this._onButtonTriggered, this._onSeparatorButtonTriggered, this._onLeave, - this._onKeyDown, - delayer + this._onKeyDown ); } @@ -839,10 +841,14 @@ export class QuickInputList { * @param element The element to show the hover for */ private showHover(element: IListElement): void { + if (this.options.hoverDelegate === undefined) { + return; + } if (this._lastHover && !this._lastHover.isDisposed) { this.options.hoverDelegate.onDidHideHover?.(); this._lastHover?.dispose(); } + if (!element.element || !element.saneTooltip) { return; } diff --git a/src/vs/platform/quickinput/browser/quickInputService.ts b/src/vs/platform/quickinput/browser/quickInputService.ts index c4d20832264..924e6b83ef6 100644 --- a/src/vs/platform/quickinput/browser/quickInputService.ts +++ b/src/vs/platform/quickinput/browser/quickInputService.ts @@ -86,12 +86,6 @@ export class QuickInputService extends Themable implements IQuickInputService { renderers: IListRenderer[], options: IWorkbenchListOptions ) => this.instantiationService.createInstance(WorkbenchList, user, container, delegate, renderers, options) as List, - hoverDelegate: { - showHover(options, focus) { - return undefined; - }, - delay: 200 - }, styles: this.computeStyles() }; From ed40013ae9fc09ae0ed47fbc46115701c3323813 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Tue, 29 Aug 2023 20:28:51 -0700 Subject: [PATCH 035/117] Only decorate complete @ variables (#191733) --- .../browser/contrib/chatInputEditorContrib.ts | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.ts b/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.ts index 8be40c833c1..d4ff01aec83 100644 --- a/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.ts +++ b/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { CancellationToken } from 'vs/base/common/cancellation'; +import { Iterable } from 'vs/base/common/iterator'; import { Disposable } from 'vs/base/common/lifecycle'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { Position } from 'vs/editor/common/core/position'; @@ -44,6 +45,7 @@ class InputEditorDecorations extends Disposable { @ICodeEditorService private readonly codeEditorService: ICodeEditorService, @IThemeService private readonly themeService: IThemeService, @IChatService private readonly chatService: IChatService, + @IChatVariablesService private readonly chatVariablesService: IChatVariablesService, ) { super(); @@ -175,21 +177,22 @@ class InputEditorDecorations extends Disposable { this.widget.inputEditor.setDecorationsByType(decorationDescription, slashCommandTextDecorationType, []); } - // const variables = this.chatVariablesService.getVariables(); + const variables = this.chatVariablesService.getVariables(); const variableReg = /(^|\s)@(\w+)(:\d+)?(?=(\s|$))/ig; let match: RegExpMatchArray | null; const varDecorations: IDecorationOptions[] = []; while (match = variableReg.exec(inputValue)) { - // const candidate = match[2]; - // if (Iterable.find(variables, v => v.name === candidate)) - varDecorations.push({ - range: { - startLineNumber: 1, - endLineNumber: 1, - startColumn: match.index! + match[1].length + 1, - endColumn: match.index! + match[0].length + 1 - } - }); + const varName = match[2]; + if (Iterable.find(variables, v => v.name === varName)) { + varDecorations.push({ + range: { + startLineNumber: 1, + endLineNumber: 1, + startColumn: match.index! + match[1].length + 1, + endColumn: match.index! + match[0].length + 1 + } + }); + } } this.widget.inputEditor.setDecorationsByType(decorationDescription, variableTextDecorationType, varDecorations); From 35be9bf683eace09796e59d54f1f225bbc3a7866 Mon Sep 17 00:00:00 2001 From: Robo Date: Wed, 30 Aug 2023 13:03:40 +0900 Subject: [PATCH 036/117] chore: update electron@25.7.0 (#191282) * chore: update electron@25.7.0 * chore: update internal build id * chore: bump distro --- .yarnrc | 4 +- build/checksums/electron.txt | 54 +++++++++---------- cgmanifest.json | 4 +- package.json | 4 +- .../api/node/extensionHostProcess.ts | 10 ---- yarn.lock | 8 +-- 6 files changed, 37 insertions(+), 47 deletions(-) diff --git a/.yarnrc b/.yarnrc index 8f658afd4a9..7b3fff4b526 100644 --- a/.yarnrc +++ b/.yarnrc @@ -1,5 +1,5 @@ disturl "https://electronjs.org/headers" -target "25.5.0" -ms_build_id "23084831" +target "25.7.0" +ms_build_id "23434598" runtime "electron" build_from_source "true" diff --git a/build/checksums/electron.txt b/build/checksums/electron.txt index f5c22bc1c23..a19497f08e8 100644 --- a/build/checksums/electron.txt +++ b/build/checksums/electron.txt @@ -1,27 +1,27 @@ -c3fb8cb4804143eb25fce55a179a6f2df8c215ed709104ec235c96e357b20f42 *electron-v25.5.0-darwin-arm64-symbols.zip -e6d2a09348d4fe7c9fbd92bf796489a95e625642f0f1ce96169212554cfa6841 *electron-v25.5.0-darwin-arm64.zip -15c28e613dfee0f7e46a296bb4aed64e17f9644d7ef19129aeb6480b8da230ab *electron-v25.5.0-darwin-x64-symbols.zip -a5c5c0b621daf8242258c89edb2387fbdf1c69125c984f8564d89b87927373e3 *electron-v25.5.0-darwin-x64.zip -69d60a69b7f692b9069cdf9e518bcbaca9cec561f40199cc87196929936a34ce *electron-v25.5.0-linux-arm64-symbols.zip -adec2ba09faf5f8d8af8997c8bed43c7712eba5546db1e7d06f8357bf4613921 *electron-v25.5.0-linux-arm64.zip -0fe7a5d152c9c401671e02ebcd9da34ab9bb0c28598ede3657077a79f8b3e70a *electron-v25.5.0-linux-armv7l-symbols.zip -eccb66e4a308a0bd2d90474894370e3d687e32f78672e6b5077c1822c7bc526b *electron-v25.5.0-linux-armv7l.zip -82bd9bc9e66f8ae802fe48a51b8d7e2fb599403e9715fa4b859190200a7376b1 *electron-v25.5.0-linux-x64-symbols.zip -485cbeb206fccfb4ed42f694100eebb80c9db6639b3537a95823c4fcb7f210cd *electron-v25.5.0-linux-x64.zip -ed2c2a7da571b53bcb336b9a2a024753a272df82ece45df83df888df51bf1912 *electron-v25.5.0-win32-arm64-pdb.zip -c316f6364e9b4cd61e19d4763c96abda7247a2c31ae7d30e81219c9a7754f11a *electron-v25.5.0-win32-arm64-symbols.zip -582ccbfc5a85a093f5639ee476bb5fef18c2d25dab4a60e5f5cb47e64c99f7fb *electron-v25.5.0-win32-arm64.zip -5776e650c23e3847b0c52d850f61c57a84a4fa30943c3cc82197250112911b5b *electron-v25.5.0-win32-ia32-pdb.zip -730b429ad2c4cae0fe3ba9600a6ee86c79dada77976bac1c75ca2404993495bc *electron-v25.5.0-win32-ia32-symbols.zip -7e6e68aa33a89c0d647575b06daf415a2401feb170ebb9cd795e221af321f751 *electron-v25.5.0-win32-ia32.zip -0792665fda9255b340a829cdd24601887a2ca8f04cc49f9a6d4557db0c0cd2f2 *electron-v25.5.0-win32-x64-pdb.zip -dc2459546951f8418e866857e9111dd83a0789d401906b2200c2f8dd59d9146b *electron-v25.5.0-win32-x64-symbols.zip -9bf7980fbc024ba77ea8ab3e2d32088a5f69bf32506a7d2db72ede17028abdf4 *electron-v25.5.0-win32-x64.zip -5b1ea601b737842eacf88d7456c4d14e697822753e9a08ede889cce9e20bafb2 *ffmpeg-v25.5.0-darwin-arm64.zip -37bf5c75edefc0b6735b44d0b5b06fdd427179a8501f6e93df9840283cdb4a95 *ffmpeg-v25.5.0-darwin-x64.zip -bd52d57ff97fb56ac01a3482af905d04f0d4e9c13c53858c6d9f99957eca82da *ffmpeg-v25.5.0-linux-arm64.zip -9b3d09177fa1e63e2a6beecfa70aeec30aeb5c1873ff21128a68051c4e23f95d *ffmpeg-v25.5.0-linux-armv7l.zip -edc7b1c9f1a0733f109a2c0375a4e40c5bfe0bf28b7f06dcc76e1ada0aa2f125 *ffmpeg-v25.5.0-linux-x64.zip -2e28767b3570ea247869a20988cddd23af710eb994d6099404f123390cedeba6 *ffmpeg-v25.5.0-win32-arm64.zip -715568eefd7267573a30186ade3de901587baeb1f013200d8ae50b35941b613f *ffmpeg-v25.5.0-win32-ia32.zip -29876504452aaa505f696642178968e24b8dc8cc4b055071e6f0f3f073088acc *ffmpeg-v25.5.0-win32-x64.zip +efbcf77eb1a0783766f9579ffb9f9b68f04fea8cb091eab7ab8484ba0cd13fbf *electron-v25.7.0-darwin-arm64-symbols.zip +76a415165d212a345a5689de83078adc715fc10562bfaa35d7323094780ba683 *electron-v25.7.0-darwin-arm64.zip +07b9049848e877019d1dce71e06713125b605dda8ac5d0b8ab3aa899cf40551d *electron-v25.7.0-darwin-x64-symbols.zip +dea726ae9adc1c36206ce8d20ce32f630bcd684b869e0cb302f97c8bd26616d6 *electron-v25.7.0-darwin-x64.zip +b6c8ba123353984b2d3ffd6ccd52aec2d3238f71611c4c94bab75aa92804eebf *electron-v25.7.0-linux-arm64-symbols.zip +19e1e2c7ea1ab024f069e3dad6a26605e14b2c605e134484196343118fccf925 *electron-v25.7.0-linux-arm64.zip +ba0bbe84ea626c8064809c66487a3b77ad39bcf8b1daa0d9421428f78ad4d665 *electron-v25.7.0-linux-armv7l-symbols.zip +832a68cddb20eb847aca982b89f89e145f50dd483c71c8a705bbb9248fb7c665 *electron-v25.7.0-linux-armv7l.zip +2e616b446112533d3aa69ed1074ab1e0be5400996129aa636273d01462dc9506 *electron-v25.7.0-linux-x64-symbols.zip +002641e8103b77060e23b9c77c51ffb942372d01306210cdc3d32fc6ae5d112b *electron-v25.7.0-linux-x64.zip +162e0f7ca9fc1c17b8d84e9b9eccc65bb0f527a67f6339a19292d798085848e4 *electron-v25.7.0-win32-arm64-pdb.zip +7d98734ffcf10e1d002c30a212dd1f203b1418a295da67410490f83e9ced388c *electron-v25.7.0-win32-arm64-symbols.zip +9777d47f74d129f7c68ebffad640a6a527b83895c173c7d344f80fc9588bad85 *electron-v25.7.0-win32-arm64.zip +c805c6356378dccb21b5725004934534e187bdaf8149a6a457fdd60d243b41e4 *electron-v25.7.0-win32-ia32-pdb.zip +5f1a3b09153cf934f24f3b1853ad1788e7c27c6ddceb80e52fe07e2e69b6bb2b *electron-v25.7.0-win32-ia32-symbols.zip +fdf8e100c3d3cdb75b54ced1ecae96d6206eca08ebb07c5d8f08740e5e703509 *electron-v25.7.0-win32-ia32.zip +aa56314a675351e9457355f2cb0660c62a3be62cc340dad76fd216741064824d *electron-v25.7.0-win32-x64-pdb.zip +25d664dfe0823e1a12269feb6eb3886dba44b2d130b8787c4d58d3d0cbcf1c22 *electron-v25.7.0-win32-x64-symbols.zip +7ddb0b38207fd837cdf4e2b2778c365751315e321b09d346c8bb8476300d0ec0 *electron-v25.7.0-win32-x64.zip +02619733aadb13b6bf21df966e04775506d0d7595a0795003fed45631c4a0af6 *ffmpeg-v25.7.0-darwin-arm64.zip +69a8e2021e48f504021913c15633cbef2b4a7b28656c51cd238acdbf7c94e358 *ffmpeg-v25.7.0-darwin-x64.zip +bd52d57ff97fb56ac01a3482af905d04f0d4e9c13c53858c6d9f99957eca82da *ffmpeg-v25.7.0-linux-arm64.zip +9b3d09177fa1e63e2a6beecfa70aeec30aeb5c1873ff21128a68051c4e23f95d *ffmpeg-v25.7.0-linux-armv7l.zip +edc7b1c9f1a0733f109a2c0375a4e40c5bfe0bf28b7f06dcc76e1ada0aa2f125 *ffmpeg-v25.7.0-linux-x64.zip +7076d4593f2e2e2abf0dc9ad8f6490d72b2fa89710def822f39da4363e49e504 *ffmpeg-v25.7.0-win32-arm64.zip +bd07183c1b6a93586d73c4106ceef0faae77f46763d15d6901d5954c2c5bba1b *ffmpeg-v25.7.0-win32-ia32.zip +b056e71a7c59441c551d5bbc1a8d99f2464a5809a3ba17d41540dc7174cab7b7 *ffmpeg-v25.7.0-win32-x64.zip diff --git a/cgmanifest.json b/cgmanifest.json index 574ec75d24d..df2f75f3209 100644 --- a/cgmanifest.json +++ b/cgmanifest.json @@ -528,12 +528,12 @@ "git": { "name": "electron", "repositoryUrl": "https://github.com/electron/electron", - "commitHash": "34be316c404e84cdd967fa0e10fceeb6424eed90" + "commitHash": "f818ec3295c9688585e3cfea532ccc5b705746bb" } }, "isOnlyProductionDependency": true, "license": "MIT", - "version": "25.5.0" + "version": "25.7.0" }, { "component": { diff --git a/package.json b/package.json index 276a62f924f..0af191524ed 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.82.0", - "distro": "2100ad274ed566f978bb917f327b3d99f95d59f2", + "distro": "c7d53f94cfb25168c3c3ae9a6f4902d32643a0ee", "author": { "name": "Microsoft Corporation" }, @@ -150,7 +150,7 @@ "cssnano": "^4.1.11", "debounce": "^1.0.0", "deemon": "^1.8.0", - "electron": "25.5.0", + "electron": "25.7.0", "eslint": "8.36.0", "eslint-plugin-header": "3.1.1", "eslint-plugin-jsdoc": "^39.3.2", diff --git a/src/vs/workbench/api/node/extensionHostProcess.ts b/src/vs/workbench/api/node/extensionHostProcess.ts index 860800e3f84..bb3cbfbca7b 100644 --- a/src/vs/workbench/api/node/extensionHostProcess.ts +++ b/src/vs/workbench/api/node/extensionHostProcess.ts @@ -6,7 +6,6 @@ import * as nativeWatchdog from 'native-watchdog'; import * as net from 'net'; import * as minimist from 'minimist'; -import * as dns from 'dns'; import * as performance from 'vs/base/common/performance'; import type { MessagePortMain } from 'vs/base/parts/sandbox/node/electronTypes'; import { isCancellationError, isSigPipeError, onUnexpectedError } from 'vs/base/common/errors'; @@ -47,15 +46,6 @@ interface ParsedExtHostArgs { } })(); -// TODO(deepak1556): Remove this once -// https://github.com/electron/electron/pull/39376 -// is available. The following API call is needed to get our -// remote integration tests to pass. -(function configureDnsResultOrder() { - // Refs https://github.com/microsoft/vscode/issues/189805 - dns.setDefaultResultOrder('ipv4first'); -})(); - const args = minimist(process.argv.slice(2), { boolean: [ 'transformURIs', diff --git a/yarn.lock b/yarn.lock index 582d6e845a1..e171d0e0f55 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3587,10 +3587,10 @@ electron-to-chromium@^1.4.202: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.207.tgz#9c3310ebace2952903d05dcaba8abe3a4ed44c01" integrity sha512-piH7MJDJp4rJCduWbVvmUd59AUne1AFBJ8JaRQvk0KzNTSUnZrVXHCZc+eg+CGE4OujkcLJznhGKD6tuAshj5Q== -electron@25.5.0: - version "25.5.0" - resolved "https://registry.yarnpkg.com/electron/-/electron-25.5.0.tgz#6465d49c0731424e3e48776628c35771697caf11" - integrity sha512-w1DNj1LuAk0Vaas1rQ0pAkTe2gZ5YG75J27mC2m88y0G6Do5b5YoFDaF84fOGQHeQ4j8tC5LngSgWhbwmqDlrw== +electron@25.7.0: + version "25.7.0" + resolved "https://registry.yarnpkg.com/electron/-/electron-25.7.0.tgz#0076c2e6acfe363f666a7b77d826a6f8a3028bcd" + integrity sha512-P82EzYZ8k9J21x5syhXV7EkezDmEXwycReXnagfzS0kwepnrlWzq1aDIUWdNvzTdHobky4m/nYcL98qd73mEVA== dependencies: "@electron/get" "^2.0.0" "@types/node" "^18.11.18" From 82348c380c484b77a3ad03566534a4735fa391c6 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 30 Aug 2023 11:19:11 +0200 Subject: [PATCH 037/117] fix #191734 (#191756) --- .../node/extensionManagementService.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/vs/platform/extensionManagement/node/extensionManagementService.ts b/src/vs/platform/extensionManagement/node/extensionManagementService.ts index 677149f937b..9b8ba9a1b42 100644 --- a/src/vs/platform/extensionManagement/node/extensionManagementService.ts +++ b/src/vs/platform/extensionManagement/node/extensionManagementService.ts @@ -152,12 +152,13 @@ export class ExtensionManagementService extends AbstractExtensionManagementServi throw new Error(nls.localize('incompatible', "Unable to install extension '{0}' as it is not compatible with VS Code '{1}'.", extensionId, this.productService.version)); } - const result = await this.installExtensions([{ manifest, extension: location, options }]); - if (result[0]?.local) { - return result[0]?.local; + const results = await this.installExtensions([{ manifest, extension: location, options }]); + const result = results.find(({ identifier }) => areSameExtensions(identifier, { id: extensionId })); + if (result?.local) { + return result.local; } - if (result[0]?.error) { - throw result[0].error; + if (result?.error) { + throw result.error; } throw toExtensionManagementError(new Error(`Unknown error while installing extension ${extensionId}`)); } finally { From 4a0169c45c6614c59ffa81daf2c9bf963a007957 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 30 Aug 2023 11:50:58 +0200 Subject: [PATCH 038/117] fix #191022 (#191760) --- .../common/extensionManagementChannelClient.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/services/extensionManagement/common/extensionManagementChannelClient.ts b/src/vs/workbench/services/extensionManagement/common/extensionManagementChannelClient.ts index 305332829c9..c0815fcd50f 100644 --- a/src/vs/workbench/services/extensionManagement/common/extensionManagementChannelClient.ts +++ b/src/vs/workbench/services/extensionManagement/common/extensionManagementChannelClient.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ILocalExtension, IGalleryExtension, InstallOptions, InstallVSIXOptions, UninstallOptions, Metadata, DidUninstallExtensionEvent, InstallExtensionEvent, InstallExtensionResult, UninstallExtensionEvent } from 'vs/platform/extensionManagement/common/extensionManagement'; +import { ILocalExtension, IGalleryExtension, InstallOptions, InstallVSIXOptions, UninstallOptions, Metadata, DidUninstallExtensionEvent, InstallExtensionEvent, InstallExtensionResult, UninstallExtensionEvent, InstallExtensionInfo } from 'vs/platform/extensionManagement/common/extensionManagement'; import { URI } from 'vs/base/common/uri'; import { ExtensionIdentifier, ExtensionType, IExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; import { ExtensionManagementChannelClient as BaseExtensionManagementChannelClient, ExtensionEventResult } from 'vs/platform/extensionManagement/common/extensionManagementIpc'; @@ -76,6 +76,14 @@ export abstract class ProfileAwareExtensionManagementChannelClient extends BaseE return super.installFromGallery(extension, installOptions); } + override async installGalleryExtensions(extensions: InstallExtensionInfo[]): Promise { + const infos: InstallExtensionInfo[] = []; + for (const extension of extensions) { + infos.push({ ...extension, options: { ...extension.options, profileLocation: extension.options?.profileLocation ? (await this.getProfileLocation(extension.options?.profileLocation)) : undefined } }); + } + return super.installGalleryExtensions(infos); + } + override async uninstall(extension: ILocalExtension, options?: UninstallOptions): Promise { options = { ...options, profileLocation: await this.getProfileLocation(options?.profileLocation) }; return super.uninstall(extension, options); From 32d0dbf4d08633d305bd0a893eeebd9100a69cd5 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Wed, 30 Aug 2023 11:42:58 +0200 Subject: [PATCH 039/117] Fixes #191664 --- .../browser/widget/diffEditorWidget2/unchangedRanges.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.ts b/src/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.ts index 5b5c4ecc2a9..73d56045a0e 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.ts @@ -94,7 +94,7 @@ export class UnchangedRangesFeature extends Disposable { const d = derived(reader => /** @description hiddenOriginalRangeStart */ r.getHiddenOriginalRange(reader).startLineNumber - 1); const origVz = new PlaceholderViewZone(d, 24); origViewZones.push(origVz); - store.add(new CollapsedCodeOverlayWidget(this._editors.original, origVz, r, r.originalRange, !sideBySide, modifiedOutlineSource, l => this._diffModel.get()!.ensureOriginalLineIsVisible(l, undefined), this._options)); + store.add(new CollapsedCodeOverlayWidget(this._editors.original, origVz, r, r.originalRange, !sideBySide, modifiedOutlineSource, l => this._diffModel.get()!.ensureModifiedLineIsVisible(l, undefined), this._options)); } { const d = derived(reader => /** @description hiddenModifiedRangeStart */ r.getHiddenModifiedRange(reader).startLineNumber - 1); @@ -265,7 +265,7 @@ class CollapsedCodeOverlayWidget extends ViewZoneOverlayWidget { private readonly _unchangedRegionRange: LineRange, private readonly hide: boolean, private readonly _modifiedOutlineSource: OutlineSource, - private readonly _revealHiddenLine: (lineNumber: number) => void, + private readonly _revealModifiedHiddenLine: (lineNumber: number) => void, private readonly _options: DiffEditorOptions, ) { const root = h('div.diff-hidden-lines-widget'); @@ -396,7 +396,7 @@ class CollapsedCodeOverlayWidget extends ViewZoneOverlayWidget { ]).root; children.push(divItem); divItem.onclick = () => { - this._revealHiddenLine(item.startLineNumber); + this._revealModifiedHiddenLine(item.startLineNumber); }; } } From e77c84f0a744563a1753f6243898eafcbf3301f3 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 30 Aug 2023 12:07:53 +0200 Subject: [PATCH 040/117] Configure Tunnel Name leads to empty settings page for WSL (#191761) --- .../electron-sandbox/remoteTunnel.contribution.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 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 c71388d51fb..145c7c81a1e 100644 --- a/src/vs/workbench/contrib/remoteTunnel/electron-sandbox/remoteTunnel.contribution.ts +++ b/src/vs/workbench/contrib/remoteTunnel/electron-sandbox/remoteTunnel.contribution.ts @@ -789,7 +789,7 @@ Registry.as(ConfigurationExtensions.Configuration).regis [CONFIGURATION_KEY_HOST_NAME]: { description: localize('remoteTunnelAccess.machineName', "The name under which the remote tunnel access is registered. If not set, the host name is used."), type: 'string', - scope: ConfigurationScope.MACHINE, + scope: ConfigurationScope.APPLICATION, pattern: '^(\\w[\\w-]*)?$', patternErrorMessage: localize('remoteTunnelAccess.machineNameRegex', "The name must only consist of letters, numbers, underscore and dash. It must not start with a dash."), maxLength: 20, @@ -798,7 +798,7 @@ Registry.as(ConfigurationExtensions.Configuration).regis [CONFIGURATION_KEY_PREVENT_SLEEP]: { description: localize('remoteTunnelAccess.preventSleep', "Prevent the computer from sleeping when remote tunnel access is turned on."), type: 'boolean', - scope: ConfigurationScope.MACHINE, + scope: ConfigurationScope.APPLICATION, default: false, } } From 662ce156c09b569a24c1de6141c5ef2b9c66dc4f Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Wed, 30 Aug 2023 12:03:55 +0200 Subject: [PATCH 041/117] Fixes #191637 --- .../editor/browser/widget/diffEditorWidget2/unchangedRanges.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.ts b/src/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.ts index 73d56045a0e..bd1af6d94f9 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.ts @@ -250,7 +250,7 @@ class CollapsedCodeOverlayWidget extends ViewZoneOverlayWidget { private readonly _nodes = h('div.diff-hidden-lines', [ h('div.top@top', { title: localize('diff.hiddenLines.top', 'Click or drag to show more above') }), h('div.center@content', { style: { display: 'flex' } }, [ - h('div@first', { style: { display: 'flex', justifyContent: 'center', alignItems: 'center' } }, + h('div@first', { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', flexShrink: '0' } }, [$('a', { title: localize('showAll', 'Show all'), role: 'button', onclick: () => { this.showAll(); } }, ...renderLabelWithIcons('$(unfold)'))] ), h('div@others', { style: { display: 'flex', justifyContent: 'center', alignItems: 'center' } }), From c39b2fffa65713e69c56f77a64bd0bc76483b6d6 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Wed, 30 Aug 2023 12:05:18 +0200 Subject: [PATCH 042/117] Fixes #191600 --- .../editor/browser/widget/diffEditorWidget2/unchangedRanges.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.ts b/src/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.ts index bd1af6d94f9..a61dc81803b 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.ts @@ -365,7 +365,7 @@ class CollapsedCodeOverlayWidget extends ViewZoneOverlayWidget { const children: HTMLElement[] = []; if (!this.hide) { const lineCount = _unchangedRegion.getHiddenModifiedRange(reader).length; - const linesHiddenText = localize('hiddenLines', '{0} Hidden Lines', lineCount); + const linesHiddenText = localize('hiddenLines', '{0} hidden lines', lineCount); const span = $('span', { title: localize('diff.hiddenLines.expandAll', 'Double click to unfold') }, linesHiddenText); span.addEventListener('dblclick', e => { if (e.button !== 0) { return; } From 19c238294cb6793aa4d34c8fcdd7746e237cb101 Mon Sep 17 00:00:00 2001 From: troy351 <914053923@qq.com> Date: Wed, 30 Aug 2023 18:24:37 +0800 Subject: [PATCH 043/117] listWidget: remove redundant logic (#191054) --- src/vs/base/browser/ui/list/listWidget.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/vs/base/browser/ui/list/listWidget.ts b/src/vs/base/browser/ui/list/listWidget.ts index b077aa3ff69..262d3ca9e2e 100644 --- a/src/vs/base/browser/ui/list/listWidget.ts +++ b/src/vs/base/browser/ui/list/listWidget.ts @@ -732,10 +732,6 @@ export class MouseController implements IDisposable { return; } - if (this.isSelectionRangeChangeEvent(e)) { - return this.changeSelection(e); - } - if (this.isSelectionChangeEvent(e)) { return this.changeSelection(e); } From 4bd1ea339fa9c1e0d5c6a8f39c5b351ae167a4c5 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Wed, 30 Aug 2023 12:19:07 +0200 Subject: [PATCH 044/117] Fixes #191603 --- .../editor/browser/widget/diffEditorWidget2/movedBlocksLines.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/editor/browser/widget/diffEditorWidget2/movedBlocksLines.ts b/src/vs/editor/browser/widget/diffEditorWidget2/movedBlocksLines.ts index 27a9f8f46fb..8a3ac863ddc 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget2/movedBlocksLines.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget2/movedBlocksLines.ts @@ -324,7 +324,7 @@ class MovedBlockOverlayWidget extends ViewZoneOverlayWidget { true, () => { this._editor.focus(); - this._diffModel.movedTextToCompare.set(this._diffModel.movedTextToCompare.get() ? undefined : this._move, undefined); + this._diffModel.movedTextToCompare.set(this._diffModel.movedTextToCompare.get() === _move ? undefined : this._move, undefined); }, ); this._register(autorun(reader => { From adf839e3564d0a3522249c4f94df518b8ed49067 Mon Sep 17 00:00:00 2001 From: Aiday Marlen Kyzy Date: Wed, 30 Aug 2023 12:42:51 +0200 Subject: [PATCH 045/117] changing the setting text --- src/vs/editor/common/config/editorOptions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index f338f7b0817..35979acc29f 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -2799,7 +2799,7 @@ class EditorStickyScroll extends BaseEditorOption Date: Wed, 30 Aug 2023 14:42:02 +0200 Subject: [PATCH 046/117] voice - fix issues around stopping transcription (#191774) --- src/vs/base/common/event.ts | 18 ++ src/vs/base/test/common/event.test.ts | 44 ++- .../actions/voiceChatActions.ts | 257 +++++++++++------- .../browser/inlineChatController.ts | 1 + 4 files changed, 218 insertions(+), 102 deletions(-) diff --git a/src/vs/base/common/event.ts b/src/vs/base/common/event.ts index 52a4b2d20f6..c26c0271f39 100644 --- a/src/vs/base/common/event.ts +++ b/src/vs/base/common/event.ts @@ -557,6 +557,24 @@ export namespace Event { return new Promise(resolve => once(event)(resolve)); } + /** + * Creates an event out of a promise that fires once when the promise is + * resolved with the result of the promise or `undefined`. + */ + export function fromPromise(promise: Promise): Event { + const result = new Emitter(); + + promise.then(res => { + result.fire(res); + }, () => { + result.fire(undefined); + }).finally(() => { + result.dispose(); + }); + + return result.event; + } + /** * Adds a listener to an event and calls the listener immediately with undefined as the event object. * diff --git a/src/vs/base/test/common/event.test.ts b/src/vs/base/test/common/event.test.ts index 8f14d7d47cd..30320370f2a 100644 --- a/src/vs/base/test/common/event.test.ts +++ b/src/vs/base/test/common/event.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; import { stub } from 'sinon'; -import { timeout } from 'vs/base/common/async'; +import { DeferredPromise, timeout } from 'vs/base/common/async'; import { CancellationToken } from 'vs/base/common/cancellation'; import { errorHandler, setUnexpectedErrorHandler } from 'vs/base/common/errors'; import { AsyncEmitter, DebounceEmitter, DynamicListEventMultiplexer, Emitter, Event, EventBufferer, EventMultiplexer, IWaitUntil, MicrotaskEmitter, PauseableEmitter, Relay, createEventDeliveryQueue } from 'vs/base/common/event'; @@ -1158,6 +1158,48 @@ suite('Event utils', () => { listener.dispose(); // should not crash }); + suite('fromPromise', () => { + + test('not yet resolved', async function () { + return new Promise(resolve => { + let promise = new DeferredPromise(); + + Event.fromPromise(promise.p)(e => { + assert.strictEqual(e, 1); + + promise = new DeferredPromise(); + + Event.fromPromise(promise.p)(() => { + resolve(); + }); + + promise.error(undefined); + }); + + promise.complete(1); + }); + }); + + test('already resolved', async function () { + return new Promise(resolve => { + let promise = new DeferredPromise(); + promise.complete(1); + + Event.fromPromise(promise.p)(e => { + assert.strictEqual(e, 1); + + promise = new DeferredPromise(); + promise.error(undefined); + + Event.fromPromise(promise.p)(() => { + resolve(); + }); + }); + + }); + }); + }); + suite('Relay', () => { test('should input work', () => { const e1 = new Emitter(); diff --git a/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts b/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts index 8773eff46d5..467a7c20d8a 100644 --- a/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts +++ b/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts @@ -7,7 +7,7 @@ import { Event } from 'vs/base/common/event'; import { firstOrDefault } from 'vs/base/common/arrays'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { Codicon } from 'vs/base/common/codicons'; -import { Disposable, DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle'; +import { DisposableStore, toDisposable } from 'vs/base/common/lifecycle'; import { equalsIgnoreCase } from 'vs/base/common/strings'; import { ServicesAccessor } from 'vs/editor/browser/editorExtensions'; import { localize } from 'vs/nls'; @@ -24,11 +24,14 @@ import { CONTEXT_PROVIDER_EXISTS } from 'vs/workbench/contrib/chat/common/chatCo import { InlineChatController } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { getCodeEditor } from 'vs/editor/browser/editorBrowser'; -import { isExecuteActionContext } from 'vs/workbench/contrib/chat/browser/actions/chatExecuteActions'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { process } from 'vs/base/parts/sandbox/electron-sandbox/globals'; import product from 'vs/platform/product/common/product'; import { ActiveEditorContext } from 'vs/workbench/common/contextkeys'; +import { IViewsService } from 'vs/workbench/common/views'; +import { IChatContributionService } from 'vs/workbench/contrib/chat/common/chatContributionService'; +import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { KeyCode } from 'vs/base/common/keyCodes'; const CONTEXT_VOICE_CHAT_GETTING_READY = new RawContextKey('voiceChatGettingReady', false, { type: 'boolean', description: localize('voiceChatGettingReady', "True when getting ready for receiving voice input from the microphone.") }); const CONTEXT_VOICE_CHAT_IN_PROGRESS = new RawContextKey('voiceChatInProgress', false, { type: 'boolean', description: localize('voiceChatInProgress', "True when voice recording from microphone is in progress.") }); @@ -36,29 +39,123 @@ const CONTEXT_VOICE_CHAT_IN_PROGRESS = new RawContextKey('voiceChatInPr interface IVoiceChatSessionController { readonly onDidAcceptInput: Event; + readonly onDidCancelInput: Event; focusInput(): void; acceptInput(): void; updateInput(text: string): void; } -function getController(controller: InlineChatController): IVoiceChatSessionController; -function getController(context: unknown): IVoiceChatSessionController | undefined; -function getController(context: unknown): IVoiceChatSessionController | undefined { - if (context instanceof InlineChatController) { - return { - onDidAcceptInput: context.onDidAcceptInput, - focusInput: () => context.focus(), - acceptInput: () => context.acceptInput(), - updateInput: text => context.updateInput(text) - }; - } +class VoiceChatSessionControllerFactory { - if (isExecuteActionContext(context)) { - return context.widget; - } + static create(accessor: ServicesAccessor, context: 'inline'): Promise; + static create(accessor: ServicesAccessor, context: 'quick'): Promise; + static create(accessor: ServicesAccessor, context: 'view'): Promise; + static create(accessor: ServicesAccessor, context: 'focussed'): Promise; + static async create(accessor: ServicesAccessor, context: 'inline' | 'quick' | 'view' | 'focussed'): Promise { + const chatWidgetService = accessor.get(IChatWidgetService); + const chatService = accessor.get(IChatService); + const viewsService = accessor.get(IViewsService); + const chatContributionService = accessor.get(IChatContributionService); + const editorService = accessor.get(IEditorService); + const quickChatService = accessor.get(IQuickChatService); - return undefined; + // Currently Focussed Context + if (context === 'focussed') { + + // Try with the chat widget service, which currently + // only supports the chat view and quick chat + // https://github.com/microsoft/vscode/issues/191191 + const chatInput = chatWidgetService.lastFocusedWidget; + if (chatInput?.hasInputFocus()) { + return { + onDidAcceptInput: chatInput.onDidAcceptInput, + onDidCancelInput: Event.any( + // Since we do not know if the view or the quick chat + // is container of the chat input, we need to listen + // to both events here... + Event.filter(viewsService.onDidChangeViewVisibility, e => e.id === chatContributionService.getViewIdForProvider(chatInput.providerId)), + quickChatService.onDidClose + ), + focusInput: () => chatInput.focusInput(), + acceptInput: () => chatInput.acceptInput(), + updateInput: text => chatInput.updateInput(text) + }; + } + + // Try with the inline chat + const activeCodeEditor = getCodeEditor(editorService.activeTextEditorControl); + if (activeCodeEditor) { + const inlineChat = InlineChatController.get(activeCodeEditor); + if (inlineChat?.hasFocus()) { + return { + onDidAcceptInput: inlineChat.onDidAcceptInput, + onDidCancelInput: inlineChat.onDidCancelInput, + focusInput: () => inlineChat.focus(), + acceptInput: () => inlineChat.acceptInput(), + updateInput: text => inlineChat.updateInput(text) + }; + } + } + } + + // View Chat + if (context === 'view') { + const provider = firstOrDefault(chatService.getProviderInfos()); + if (provider) { + const chatView = await chatWidgetService.revealViewForProvider(provider.id); + if (chatView) { + return { + onDidAcceptInput: chatView.onDidAcceptInput, + onDidCancelInput: Event.filter(viewsService.onDidChangeViewVisibility, e => e.id === chatContributionService.getViewIdForProvider(provider.id)), + focusInput: () => chatView.focusInput(), + acceptInput: () => chatView.acceptInput(), + updateInput: text => chatView.updateInput(text) + }; + } + } + } + + // Inline Chat + if (context === 'inline') { + const activeCodeEditor = getCodeEditor(editorService.activeTextEditorControl); + if (activeCodeEditor) { + const inlineChat = InlineChatController.get(activeCodeEditor); + if (inlineChat) { + const inlineChatSession = inlineChat.run(); + + return { + onDidAcceptInput: inlineChat.onDidAcceptInput, + onDidCancelInput: Event.any( + inlineChat.onDidCancelInput, + Event.fromPromise(inlineChatSession) + ), + focusInput: () => inlineChat.focus(), + acceptInput: () => inlineChat.acceptInput(), + updateInput: text => inlineChat.updateInput(text) + }; + } + } + } + + // Quick Chat + if (context === 'quick') { + quickChatService.open(); + + const quickChat = chatWidgetService.lastFocusedWidget; + if (quickChat) { + return { + onDidAcceptInput: quickChat.onDidAcceptInput, + onDidCancelInput: quickChatService.onDidClose, + focusInput: () => quickChat.focusInput(), + acceptInput: () => quickChat.acceptInput(), + updateInput: text => quickChat.updateInput(text) + }; + } + } + + return undefined; + } } class VoiceChatSession { @@ -83,33 +180,41 @@ class VoiceChatSession { @IWorkbenchVoiceRecognitionService private readonly voiceRecognitionService: IWorkbenchVoiceRecognitionService ) { } - async start(context: IVoiceChatSessionController): Promise { + async start(controller: IVoiceChatSessionController): Promise { this.stop(); - this.voiceChatGettingReadyKey.set(true); + const voiceChatSessionId = ++this.voiceChatSessionIds; this.currentVoiceChatSession = new DisposableStore(); const cts = new CancellationTokenSource(); this.currentVoiceChatSession.add(toDisposable(() => cts.dispose(true))); - context.focusInput(); + this.currentVoiceChatSession.add(controller.onDidAcceptInput(() => this.stop(voiceChatSessionId))); + this.currentVoiceChatSession.add(controller.onDidCancelInput(() => this.stop(voiceChatSessionId))); + + controller.focusInput(); + + this.voiceChatGettingReadyKey.set(true); const onDidTranscribe = await this.voiceRecognitionService.transcribe(cts.token, { onDidCancel: () => this.stop(voiceChatSessionId) }); - if (cts.token.isCancellationRequested) { - return Disposable.None; - } - const voiceChatSessionId = ++this.voiceChatSessionIds; + if (cts.token.isCancellationRequested) { + return; + } this.voiceChatGettingReadyKey.set(false); this.voiceChatInProgressKey.set(true); + this.registerTranscriptionListener(controller, onDidTranscribe, this.currentVoiceChatSession); + } + + private registerTranscriptionListener(controller: IVoiceChatSessionController, onDidTranscribe: Event, disposables: DisposableStore) { let lastText: string | undefined = undefined; let lastTextSimilarCount = 0; - this.currentVoiceChatSession.add(onDidTranscribe(text => { + disposables.add(onDidTranscribe(text => { if (!text && lastText) { text = lastText; } @@ -123,17 +228,13 @@ class VoiceChatSession { } if (lastTextSimilarCount >= 2) { - context.acceptInput(); + controller.acceptInput(); } else { - context.updateInput(text); + controller.updateInput(text); } } })); - - this.currentVoiceChatSession.add(context.onDidAcceptInput(() => this.stop(voiceChatSessionId))); - - return toDisposable(() => this.stop(voiceChatSessionId)); } private isSimilarTranscription(textA: string, textB: string): boolean { @@ -151,11 +252,10 @@ class VoiceChatSession { } stop(voiceChatSessionId = this.voiceChatSessionIds): void { - if (!this.currentVoiceChatSession) { - return; - } - - if (this.voiceChatSessionIds !== voiceChatSessionId) { + if ( + !this.currentVoiceChatSession || + this.voiceChatSessionIds !== voiceChatSessionId + ) { return; } @@ -185,16 +285,11 @@ class VoiceChatInChatViewAction extends Action2 { } async run(accessor: ServicesAccessor): Promise { - const chatWidgetService = accessor.get(IChatWidgetService); - const chatService = accessor.get(IChatService); const instantiationService = accessor.get(IInstantiationService); - const provider = firstOrDefault(chatService.getProviderInfos()); - if (provider) { - const controller = await chatWidgetService.revealViewForProvider(provider.id); - if (controller) { - VoiceChatSession.getInstance(instantiationService).start(controller); - } + const controller = await VoiceChatSessionControllerFactory.create(accessor, 'view'); + if (controller) { + VoiceChatSession.getInstance(instantiationService).start(controller); } } } @@ -217,23 +312,12 @@ class InlineVoiceChatAction extends Action2 { } async run(accessor: ServicesAccessor): Promise { - const editorService = accessor.get(IEditorService); const instantiationService = accessor.get(IInstantiationService); - const activeCodeEditor = getCodeEditor(editorService.activeTextEditorControl); - if (!activeCodeEditor) { - return; + const controller = await VoiceChatSessionControllerFactory.create(accessor, 'inline'); + if (controller) { + VoiceChatSession.getInstance(instantiationService).start(controller); } - - const controller = InlineChatController.get(activeCodeEditor); - if (!controller) { - return; - } - - const inlineChatSession = controller.run(); - - const disposable = await VoiceChatSession.getInstance(instantiationService).start(getController(controller)); - inlineChatSession.finally(() => disposable.dispose()); } } @@ -255,16 +339,11 @@ class QuickVoiceChatAction extends Action2 { } async run(accessor: ServicesAccessor): Promise { - const quickChatService = accessor.get(IQuickChatService); - const chatWidgetService = accessor.get(IChatWidgetService); const instantiationService = accessor.get(IInstantiationService); - quickChatService.open(); - - const controller = chatWidgetService.lastFocusedWidget; + const controller = await VoiceChatSessionControllerFactory.create(accessor, 'quick'); if (controller) { - const disposable = await VoiceChatSession.getInstance(instantiationService).start(controller); - Event.once(quickChatService.onDidClose)(() => disposable.dispose()); + VoiceChatSession.getInstance(instantiationService).start(controller); } } } @@ -296,46 +375,17 @@ class StartVoiceChatAction extends Action2 { }); } - async run(accessor: ServicesAccessor, context: unknown): Promise { - const editorService = accessor.get(IEditorService); - const chatWidgetService = accessor.get(IChatWidgetService); + async run(accessor: ServicesAccessor): Promise { const instantiationService = accessor.get(IInstantiationService); const commandService = accessor.get(ICommandService); - let controller = getController(context); - if (!controller) { - - // Without a controller, this action potentially executed from - // a global keybinding, and thus we have to find the chat - // input that is currently focussed, or have a fallback - - // 1.) a chat input widget has focus - if (chatWidgetService.lastFocusedWidget?.hasInputFocus()) { - controller = chatWidgetService.lastFocusedWidget; - } - - // 2.) a inline chat input widget has focus - if (!controller) { - const activeCodeEditor = getCodeEditor(editorService.activeTextEditorControl); - if (activeCodeEditor) { - const chatInput = InlineChatController.get(activeCodeEditor); - if (chatInput?.hasFocus()) { - controller = getController(chatInput); - } - } - } - - // 3.) open a quick chat view - if (!controller) { - return commandService.executeCommand(QuickVoiceChatAction.ID); - } + const controller = await VoiceChatSessionControllerFactory.create(accessor, 'focussed'); + if (controller) { + VoiceChatSession.getInstance(instantiationService).start(controller); + } else { + // fallback to Quick Voice Chat command + commandService.executeCommand(QuickVoiceChatAction.ID); } - - if (!controller) { - return; - } - - VoiceChatSession.getInstance(instantiationService).start(controller); } } @@ -352,6 +402,11 @@ class StopVoiceChatAction extends Action2 { }, category: CHAT_CATEGORY, f1: true, + keybinding: { + weight: KeybindingWeight.WorkbenchContrib + 100, + when: CONTEXT_VOICE_CHAT_IN_PROGRESS, + primary: KeyCode.Escape + }, precondition: CONTEXT_VOICE_CHAT_IN_PROGRESS, icon: spinningLoading, menu: [{ diff --git a/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts b/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts index 023fee9cfd2..1d8cacb2985 100644 --- a/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts +++ b/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts @@ -101,6 +101,7 @@ export class InlineChatController implements IEditorContribution { private _messages = this._store.add(new Emitter()); readonly onDidAcceptInput = Event.filter(this._messages.event, m => m === Message.ACCEPT_INPUT, this._store); + readonly onDidCancelInput = Event.filter(this._messages.event, m => m === Message.CANCEL_INPUT || m === Message.CANCEL_SESSION, this._store); private readonly _sessionStore: DisposableStore = this._store.add(new DisposableStore()); private readonly _stashedSession: MutableDisposable = this._store.add(new MutableDisposable()); From eef56ce7d3aefa1aadec4ec46f411d9e815abe3f Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 30 Aug 2023 05:44:32 -0700 Subject: [PATCH 047/117] Fix another `var()` fallback case (#191721) One more case of #190968 --- .../workbench/contrib/interactive/browser/interactiveEditor.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/interactive/browser/interactiveEditor.css b/src/vs/workbench/contrib/interactive/browser/interactiveEditor.css index 491aa3e8c17..d43c6a6e98b 100644 --- a/src/vs/workbench/contrib/interactive/browser/interactiveEditor.css +++ b/src/vs/workbench/contrib/interactive/browser/interactiveEditor.css @@ -17,5 +17,5 @@ .interactive-editor .input-cell-container .monaco-editor-background, .interactive-editor .input-cell-container .margin-view-overlays { - background-color: var(--vscode-notebook-cellEditorBackground, --vscode-editor-background); + background-color: var(--vscode-notebook-cellEditorBackground, var(--vscode-editor-background)); } From bee68cee69f701e3fdcea4190ef6d14aab00fa48 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 30 Aug 2023 15:24:37 +0200 Subject: [PATCH 048/117] allow workspace edit to "create" untitled files (#191779) https://github.com/microsoft/vscode-copilot/issues/1261 --- .../src/singlefolder-tests/workspace.test.ts | 16 ++++++++++++++++ .../contrib/bulkEdit/browser/bulkFileEdits.ts | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts index 6e0c8e59404..e69eecff5d1 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts @@ -977,6 +977,22 @@ suite('vscode API - workspace', () => { assert.strictEqual(document.getText(), expected); }); + + test('[Bug] Failed to create new test file when in an untitled file #1261', async function () { + const uri = vscode.Uri.parse('untitled:Untitled-5.test'); + const contents = `Hello Test File ${uri.toString()}`; + const we = new vscode.WorkspaceEdit(); + we.createFile(uri, { ignoreIfExists: true }); + we.replace(uri, new vscode.Range(0, 0, 0, 0), contents); + + const success = await vscode.workspace.applyEdit(we); + + assert.ok(success); + + const doc = await vscode.workspace.openTextDocument(uri); + assert.strictEqual(doc.getText(), contents); + }); + test('Should send a single FileWillRenameEvent instead of separate events when moving multiple files at once#111867, 1/3', async function () { const file1 = await createRandomFile(); diff --git a/src/vs/workbench/contrib/bulkEdit/browser/bulkFileEdits.ts b/src/vs/workbench/contrib/bulkEdit/browser/bulkFileEdits.ts index c21f9e7f6c6..9f895d8b8a7 100644 --- a/src/vs/workbench/contrib/bulkEdit/browser/bulkFileEdits.ts +++ b/src/vs/workbench/contrib/bulkEdit/browser/bulkFileEdits.ts @@ -18,6 +18,7 @@ import { ResourceFileEdit } from 'vs/editor/browser/services/bulkEditService'; import { CancellationToken } from 'vs/base/common/cancellation'; import { tail } from 'vs/base/common/arrays'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; +import { Schemas } from 'vs/base/common/network'; interface IFileOperation { uris: URI[]; @@ -173,6 +174,9 @@ class CreateOperation implements IFileOperation { const undoes: DeleteEdit[] = []; for (const edit of this._edits) { + if (edit.newUri.scheme === Schemas.untitled) { + continue; // ignore, will be handled by a later edit + } if (edit.options.overwrite === undefined && edit.options.ignoreIfExists && await this._fileService.exists(edit.newUri)) { continue; // not overwriting, but ignoring, and the target file exists } From 0e3926c62a5c779c0d1ac8e267dce6bbc82624c4 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 30 Aug 2023 15:34:27 +0200 Subject: [PATCH 049/117] voice - fix bad controller when using toolbar actions (#191780) --- .../chat/electron-sandbox/actions/voiceChatActions.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts b/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts index 467a7c20d8a..97a1c2efcbd 100644 --- a/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts +++ b/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts @@ -32,6 +32,7 @@ import { IViewsService } from 'vs/workbench/common/views'; import { IChatContributionService } from 'vs/workbench/contrib/chat/common/chatContributionService'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeyCode } from 'vs/base/common/keyCodes'; +import { isExecuteActionContext } from 'vs/workbench/contrib/chat/browser/actions/chatExecuteActions'; const CONTEXT_VOICE_CHAT_GETTING_READY = new RawContextKey('voiceChatGettingReady', false, { type: 'boolean', description: localize('voiceChatGettingReady', "True when getting ready for receiving voice input from the microphone.") }); const CONTEXT_VOICE_CHAT_IN_PROGRESS = new RawContextKey('voiceChatInProgress', false, { type: 'boolean', description: localize('voiceChatInProgress', "True when voice recording from microphone is in progress.") }); @@ -375,10 +376,18 @@ class StartVoiceChatAction extends Action2 { }); } - async run(accessor: ServicesAccessor): Promise { + async run(accessor: ServicesAccessor, context: unknown): Promise { const instantiationService = accessor.get(IInstantiationService); const commandService = accessor.get(ICommandService); + if (isExecuteActionContext(context)) { + // if we already get a context when the action is executed + // from a toolbar within the chat widget, then make sure + // to move focus into the input field so that the controller + // is properly retrieved + context.widget.focusInput(); + } + const controller = await VoiceChatSessionControllerFactory.create(accessor, 'focussed'); if (controller) { VoiceChatSession.getInstance(instantiationService).start(controller); From fdcc959e0a6dfc365d9a6a8a595ac76457db2f65 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:43:56 +0200 Subject: [PATCH 050/117] Git - update Explorer welcome view context key (#191788) --- extensions/git/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/git/package.json b/extensions/git/package.json index 105491916ca..37212410bfe 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -2950,13 +2950,13 @@ { "view": "scm", "contents": "%view.workbench.scm.folder%", - "when": "config.git.enabled && !git.missing && git.state == initialized && workbenchState == folder && scmRepositoryCount == 0 && git.parentRepositoryCount == 0 && git.unsafeRepositoryCount == 0 && git.closedRepositoryCount == 0 && remoteName != 'codespaces'", + "when": "config.git.enabled && !git.missing && git.state == initialized && workbenchState == folder && scm.providerCount == 0 && git.parentRepositoryCount == 0 && git.unsafeRepositoryCount == 0 && git.closedRepositoryCount == 0 && remoteName != 'codespaces'", "group": "5_scm@1" }, { "view": "scm", "contents": "%view.workbench.scm.workspace%", - "when": "config.git.enabled && !git.missing && git.state == initialized && workbenchState == workspace && workspaceFolderCount != 0 && scmRepositoryCount == 0 && git.parentRepositoryCount == 0 && git.unsafeRepositoryCount == 0 && git.closedRepositoryCount == 0 && remoteName != 'codespaces'", + "when": "config.git.enabled && !git.missing && git.state == initialized && workbenchState == workspace && workspaceFolderCount != 0 && scm.providerCount == 0 && git.parentRepositoryCount == 0 && git.unsafeRepositoryCount == 0 && git.closedRepositoryCount == 0 && remoteName != 'codespaces'", "group": "5_scm@1" }, { @@ -2992,13 +2992,13 @@ { "view": "explorer", "contents": "%view.workbench.cloneRepository%", - "when": "config.git.enabled && git.state == initialized && scmRepositoryCount == 0", + "when": "config.git.enabled && git.state == initialized && scm.providerCount == 0", "group": "5_scm@1" }, { "view": "explorer", "contents": "%view.workbench.learnMore%", - "when": "config.git.enabled && git.state == initialized && scmRepositoryCount == 0", + "when": "config.git.enabled && git.state == initialized && scm.providerCount == 0", "group": "5_scm@10" } ] From 4538c811ebacf7eee5defab22d560dd57fdcd785 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Wed, 30 Aug 2023 15:39:01 +0200 Subject: [PATCH 051/117] Fixes #191323 --- src/vs/base/common/arrays.ts | 4 + .../common/diff/advancedLinesDiffComputer.ts | 93 +++++++++++++++++-- 2 files changed, 90 insertions(+), 7 deletions(-) diff --git a/src/vs/base/common/arrays.ts b/src/vs/base/common/arrays.ts index 22c2859f5e9..94966dc1b6f 100644 --- a/src/vs/base/common/arrays.ts +++ b/src/vs/base/common/arrays.ts @@ -666,6 +666,10 @@ export namespace CompareResult { return result < 0; } + export function isLessThanOrEqual(result: CompareResult): boolean { + return result <= 0; + } + export function isGreaterThan(result: CompareResult): boolean { return result > 0; } diff --git a/src/vs/editor/common/diff/advancedLinesDiffComputer.ts b/src/vs/editor/common/diff/advancedLinesDiffComputer.ts index a7d9605d78c..55166f1ad82 100644 --- a/src/vs/editor/common/diff/advancedLinesDiffComputer.ts +++ b/src/vs/editor/common/diff/advancedLinesDiffComputer.ts @@ -3,10 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { compareBy, equals, findLastIndex, numberComparator, reverseOrder } from 'vs/base/common/arrays'; +import { Comparator, CompareResult, compareBy, equals, findLastIndex, numberComparator, reverseOrder } from 'vs/base/common/arrays'; import { assertFn, checkAdjacentItems } from 'vs/base/common/assert'; import { CharCode } from 'vs/base/common/charCode'; import { SetMap } from 'vs/base/common/collections'; +import { BugIndicatingError } from 'vs/base/common/errors'; import { LineRange } from 'vs/editor/common/core/lineRange'; import { OffsetRange } from 'vs/editor/common/core/offsetRange'; import { Position } from 'vs/editor/common/core/position'; @@ -302,7 +303,7 @@ export class AdvancedLinesDiffComputer implements ILinesDiffComputer { if (moves.length === 0) { return []; } - const joinedMoves = [moves[0]]; + let joinedMoves = [moves[0]]; for (let i = 1; i < moves.length; i++) { const last = joinedMoves[joinedMoves.length - 1]; const current = moves[i]; @@ -324,6 +325,19 @@ export class AdvancedLinesDiffComputer implements ILinesDiffComputer { joinedMoves.push(current); } + // Ignore non moves + const originalChanges = MonotonousFinder.createOfSorted(changes, c => c.originalRange.endLineNumberExclusive, numberComparator); + joinedMoves = joinedMoves.filter(m => { + const diffBeforeOriginalMove = originalChanges.findLastItemBeforeOrEqual(m.original.startLineNumber) + || new LineRangeMapping(new LineRange(1, 1), new LineRange(1, 1), []); + + const modifiedDistToPrevDiff = m.modified.startLineNumber - diffBeforeOriginalMove.modifiedRange.endLineNumberExclusive; + const originalDistToPrevDiff = m.original.startLineNumber - diffBeforeOriginalMove.originalRange.endLineNumberExclusive; + + const differentDistances = modifiedDistToPrevDiff !== originalDistToPrevDiff; + return differentDistances; + }); + const fullMoves = joinedMoves.map(m => { const moveChanges = this.refineDiff(originalLines, modifiedLines, new SequenceDiff( m.original.toOffsetRange(), @@ -366,6 +380,60 @@ export class AdvancedLinesDiffComputer implements ILinesDiffComputer { } } +class MonotonousFinder { + public static create( + items: TItem[], + itemToDomain: (item: TItem) => TDomain, + domainComparator: Comparator, + ): MonotonousFinder { + items.sort((a, b) => domainComparator(itemToDomain(a), itemToDomain(b))); + return new MonotonousFinder(items, itemToDomain, domainComparator); + } + + public static createOfSorted( + items: TItem[], + itemToDomain: (item: TItem) => TDomain, + domainComparator: Comparator, + ): MonotonousFinder { + return new MonotonousFinder(items, itemToDomain, domainComparator); + } + + private _currentIdx = 0; // All values with index lower than this are smaller than or equal to _lastValue and vice versa. + private _lastValue: TDomain | undefined = undefined; // Represents a smallest value. + private _hasLastValue = false; + + private constructor( + private readonly _items: TItem[], + private readonly _itemToDomain: (item: TItem) => TDomain, + private readonly _domainComparator: Comparator, + ) { + } + + /** + * Assumes the values are monotonously increasing. + */ + findLastItemBeforeOrEqual(value: TDomain): TItem | undefined { + if (this._hasLastValue && CompareResult.isLessThan(this._domainComparator(value, this._lastValue!))) { + // Values must be monotonously increasing + throw new BugIndicatingError(); + } + this._lastValue = value; + this._hasLastValue = true; + + while ( + this._currentIdx < this._items.length + && CompareResult.isLessThanOrEqual(this._domainComparator( + this._itemToDomain(this._items[this._currentIdx]), + value + )) + ) { + this._currentIdx++; + } + + return this._currentIdx === 0 ? undefined : this._items[this._currentIdx - 1]; + } +} + function intersectRanges(ranges1: LineRange[], ranges2: LineRange[]): LineRange[] { const result: LineRange[] = []; @@ -839,16 +907,15 @@ export class LinesSliceCharSequence implements ISequence { } public extendToFullLines(range: OffsetRange): OffsetRange { - const firstIdx = findLastIdxMonotonous(this.firstCharOffsetByLineMinusOne, x => x <= range.start); - const lastIdx = findFirstIdxMonotonous(this.firstCharOffsetByLineMinusOne, x => range.endExclusive <= x); - - const start = firstIdx === -1 ? 0 : this.firstCharOffsetByLineMinusOne[firstIdx]; - const end = lastIdx === this.firstCharOffsetByLineMinusOne.length ? this.elements.length : this.firstCharOffsetByLineMinusOne[lastIdx]; + const start = findLastMonotonous(this.firstCharOffsetByLineMinusOne, x => x <= range.start) ?? 0; + const end = findFirstMonotonous(this.firstCharOffsetByLineMinusOne, x => range.endExclusive <= x) ?? this.elements.length; return new OffsetRange(start, end); } } /** + * `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`! + * * @returns -1 if predicate is false for all items */ function findLastIdxMonotonous(arr: T[], predicate: (item: T) => boolean): number { @@ -865,7 +932,14 @@ function findLastIdxMonotonous(arr: T[], predicate: (item: T) => boolean): nu return i - 1; } +export function findLastMonotonous(arr: T[], predicate: (item: T) => boolean): T | undefined { + const idx = findLastIdxMonotonous(arr, predicate); + return idx === -1 ? undefined : arr[idx]; +} + /** + * `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`! + * * @returns arr.length if predicate is false for all items */ function findFirstIdxMonotonous(arr: T[], predicate: (item: T) => boolean): number { @@ -882,6 +956,11 @@ function findFirstIdxMonotonous(arr: T[], predicate: (item: T) => boolean): n return i; } +export function findFirstMonotonous(arr: T[], predicate: (item: T) => boolean): T | undefined { + const idx = findFirstIdxMonotonous(arr, predicate); + return idx === arr.length ? undefined : arr[idx]; +} + function isWordChar(charCode: number): boolean { return charCode >= CharCode.a && charCode <= CharCode.z || charCode >= CharCode.A && charCode <= CharCode.Z From ec9aa5cfdf18ac4f5d3fb2b384869dca46f6451f Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 30 Aug 2023 16:50:40 +0200 Subject: [PATCH 052/117] Revert "fix #190228 (#191207)" (#191789) This reverts commit cafcb59c16b5fcb2ae2db76cea0ba2596df8b7db. --- .../workbench/contrib/extensions/browser/extensionEditor.ts | 6 ++++-- .../contrib/extensions/browser/media/extensionEditor.css | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts b/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts index 0cb4cdeab43..16a37dc27c9 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts @@ -855,10 +855,12 @@ export class ExtensionEditor extends EditorPane { extensionPackReadme.style.maxWidth = '882px'; const extensionPack = append(extensionPackReadme, $('div', { class: 'extension-pack' })); - if (manifest.extensionPack!.length < 3) { + if (manifest.extensionPack!.length <= 3) { extensionPackReadme.classList.add('one-row'); - } else if (manifest.extensionPack!.length < 5) { + } else if (manifest.extensionPack!.length <= 6) { extensionPackReadme.classList.add('two-rows'); + } else if (manifest.extensionPack!.length <= 9) { + extensionPackReadme.classList.add('three-rows'); } else { extensionPackReadme.classList.add('more-rows'); } diff --git a/src/vs/workbench/contrib/extensions/browser/media/extensionEditor.css b/src/vs/workbench/contrib/extensions/browser/media/extensionEditor.css index 575e6870b54..174b332538b 100644 --- a/src/vs/workbench/contrib/extensions/browser/media/extensionEditor.css +++ b/src/vs/workbench/contrib/extensions/browser/media/extensionEditor.css @@ -517,6 +517,10 @@ height: 224px; } +.extension-editor > .body > .content > .details > .readme-container > .extension-pack-readme.three-rows > .extension-pack { + height: 306px; +} + .extension-editor > .body > .content > .details > .readme-container > .extension-pack-readme.more-rows > .extension-pack { height: 326px; } From 6b9018f059cbe1d8a9ea75c3b026d0a85e27eb5b Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 30 Aug 2023 08:06:33 -0700 Subject: [PATCH 053/117] Workaround slow update webgl issue on Windows Fixes #190195 --- .../terminal/browser/xterm/xtermTerminal.ts | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts b/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts index fcf7a078831..7d968e8818f 100644 --- a/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts +++ b/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts @@ -43,6 +43,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService import { debounce } from 'vs/base/common/decorators'; import { MouseWheelClassifier } from 'vs/base/browser/ui/scrollbar/scrollableElement'; import { IMouseWheelEvent, StandardWheelEvent } from 'vs/base/browser/mouseEvent'; +import { isWindows } from 'vs/base/common/platform'; const enum RenderConstants { /** @@ -120,6 +121,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal, ID readonly raw: RawXtermTerminal; private _core: IXtermCore; private static _suggestedRendererType: 'canvas' | 'dom' | undefined = undefined; + private static _checkedWebglCompatible = false; private _attached?: { container: HTMLElement; options: IXtermAttachToElementOptions }; private _isPhysicalMouseWheel = MouseWheelClassifier.INSTANCE.isPhysicalMouseWheel(); @@ -677,6 +679,25 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal, ID if (!this.raw.element || this._webglAddon) { return; } + + // Check if the the WebGL renderer is compatible with xterm.js: + // - https://github.com/microsoft/vscode/issues/190195 + // - https://github.com/xtermjs/xterm.js/issues/4665 + // - https://bugs.chromium.org/p/chromium/issues/detail?id=1476475 + if (!XtermTerminal._checkedWebglCompatible && isWindows) { + XtermTerminal._checkedWebglCompatible = true; + const checkCanvas = document.createElement('canvas'); + const checkGl = checkCanvas.getContext('webgl2'); + const debugInfo = checkGl?.getExtension('WEBGL_debug_renderer_info'); + if (checkGl && debugInfo) { + const renderer = checkGl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL); + if (renderer.startsWith('ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (Subzero)')) { + this._disableWebglForThisSession(); + return; + } + } + } + const Addon = await this._getWebglAddonConstructor(); this._webglAddon = new Addon(); this._disposeOfCanvasRenderer(); @@ -701,12 +722,16 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal, ID if (!neverMeasureRenderTime && this._configHelper.config.gpuAcceleration !== 'off') { this._measureRenderTime(); } - XtermTerminal._suggestedRendererType = 'canvas'; - this._disposeOfWebglRenderer(); - this._enableCanvasRenderer(); + this._disableWebglForThisSession(); } } + private _disableWebglForThisSession() { + XtermTerminal._suggestedRendererType = 'canvas'; + this._disposeOfWebglRenderer(); + this._enableCanvasRenderer(); + } + private async _enableCanvasRenderer(): Promise { if (!this.raw.element || this._canvasAddon) { return; From 5cc83f79943d1de0abefa00d650a2533e30be99a Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 30 Aug 2023 08:20:08 -0700 Subject: [PATCH 054/117] cli: verify vscode server integrity before committing to cache (#191792) Fixes #191469 --- cli/src/tunnels/code_server.rs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/cli/src/tunnels/code_server.rs b/cli/src/tunnels/code_server.rs index 5bc5e39514a..16655533754 100644 --- a/cli/src/tunnels/code_server.rs +++ b/cli/src/tunnels/code_server.rs @@ -14,7 +14,7 @@ use crate::tunnels::paths::{get_server_folder_name, SERVER_FOLDER_NAME}; use crate::update_service::{ unzip_downloaded_release, Platform, Release, TargetKind, UpdateService, }; -use crate::util::command::{capture_command, kill_tree}; +use crate::util::command::{capture_command, capture_command_and_check_status, kill_tree}; use crate::util::errors::{wrap, AnyError, CodeError, ExtensionInstallFailed, WrappedError}; use crate::util::http::{self, BoxedHttp}; use crate::util::io::SilentCopyProgress; @@ -416,11 +416,23 @@ impl<'a> ServerBuilder<'a> { ) .await?; - unzip_downloaded_release( - &archive_path, - &target_dir.join(SERVER_FOLDER_NAME), - SilentCopyProgress(), - )?; + let server_dir = target_dir.join(SERVER_FOLDER_NAME); + unzip_downloaded_release(&archive_path, &server_dir, SilentCopyProgress())?; + + let output = capture_command_and_check_status( + server_dir + .join("bin") + .join(self.server_params.release.quality.server_entrypoint()), + &["--version"], + ) + .await + .map_err(|e| wrap(e, "error checking server integrity"))?; + + trace!( + self.logger, + "Server integrity verified, version: {}", + String::from_utf8_lossy(&output.stdout).replace('\n', " / ") + ); Ok(()) }) From d46d86dd75cd99f652a183e02a091dbae31d5164 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 30 Aug 2023 17:36:04 +0200 Subject: [PATCH 055/117] voice - replace codicon when hovering over stop button (#191777) --- .../actions/media/voiceChatActions.css | 14 ++++++++++++++ .../electron-sandbox/actions/voiceChatActions.ts | 1 + 2 files changed, 15 insertions(+) create mode 100644 src/vs/workbench/contrib/chat/electron-sandbox/actions/media/voiceChatActions.css diff --git a/src/vs/workbench/contrib/chat/electron-sandbox/actions/media/voiceChatActions.css b/src/vs/workbench/contrib/chat/electron-sandbox/actions/media/voiceChatActions.css new file mode 100644 index 00000000000..53e4022e443 --- /dev/null +++ b/src/vs/workbench/contrib/chat/electron-sandbox/actions/media/voiceChatActions.css @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-workbench .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled):hover, +.monaco-workbench .inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled):hover { + animation: none; /* stop the running voice recording animation for showing another codicon to stop */ +} + +.monaco-workbench .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled):hover::before, +.monaco-workbench .inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled):hover::before { + content: "\eba5"; /* use `stop-circle` icon unicode for hovering over running voice recording */ +} diff --git a/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts b/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts index 97a1c2efcbd..792071aab04 100644 --- a/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts +++ b/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts @@ -3,6 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import 'vs/css!./media/voiceChatActions'; import { Event } from 'vs/base/common/event'; import { firstOrDefault } from 'vs/base/common/arrays'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; From 8813aca70522f4e5e4b3996db46dac2cb921564b Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 30 Aug 2023 08:37:00 -0700 Subject: [PATCH 056/117] cli: recycle all tunnels the cli creates for all scenarios (#191800) Fixes #191749 --- cli/src/tunnels/dev_tunnels.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cli/src/tunnels/dev_tunnels.rs b/cli/src/tunnels/dev_tunnels.rs index b77f6da5f2e..e7b84ed4112 100644 --- a/cli/src/tunnels/dev_tunnels.rs +++ b/cli/src/tunnels/dev_tunnels.rs @@ -212,6 +212,7 @@ impl ActiveTunnel { const VSCODE_CLI_TUNNEL_TAG: &str = "vscode-server-launcher"; const VSCODE_CLI_FORWARDING_TAG: &str = "vscode-port-forward"; +const OWNED_TUNNEL_TAGS: &[&str] = &[VSCODE_CLI_TUNNEL_TAG, VSCODE_CLI_FORWARDING_TAG]; const MAX_TUNNEL_NAME_LENGTH: usize = 20; fn get_host_token_from_tunnel(tunnel: &Tunnel) -> String { @@ -635,7 +636,7 @@ impl DevTunnels { "Tunnel limit hit, trying to recycle an old tunnel" ); - let existing_tunnels = self.list_all_server_tunnels().await?; + let existing_tunnels = self.list_tunnels_with_tag(OWNED_TUNNEL_TAGS).await?; let recyclable = existing_tunnels .iter() @@ -667,13 +668,15 @@ impl DevTunnels { } } - async fn list_all_server_tunnels(&mut self) -> Result, AnyError> { + async fn list_tunnels_with_tag( + &mut self, + tags: &[&'static str], + ) -> Result, AnyError> { let tunnels = spanf!( self.log, self.log.span("dev-tunnel.listall"), self.client.list_all_tunnels(&TunnelRequestOptions { - tags: vec![self.tag.to_string()], - require_all_tags: true, + tags: tags.iter().map(|t| t.to_string()).collect(), ..Default::default() }) ) @@ -711,7 +714,7 @@ impl DevTunnels { preferred_name: Option<&str>, mut use_random_name: bool, ) -> Result { - let existing_tunnels = self.list_all_server_tunnels().await?; + let existing_tunnels = self.list_tunnels_with_tag(&[self.tag]).await?; let is_name_free = |n: &str| { !existing_tunnels.iter().any(|v| { v.status From afa0d9fd750cdeaf6c03504fb84e8603eea0cc2e Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 30 Aug 2023 17:47:42 +0200 Subject: [PATCH 057/117] voice - make stop icon more explicit --- .../chat/electron-sandbox/actions/media/voiceChatActions.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/chat/electron-sandbox/actions/media/voiceChatActions.css b/src/vs/workbench/contrib/chat/electron-sandbox/actions/media/voiceChatActions.css index 53e4022e443..b081c2c8d2f 100644 --- a/src/vs/workbench/contrib/chat/electron-sandbox/actions/media/voiceChatActions.css +++ b/src/vs/workbench/contrib/chat/electron-sandbox/actions/media/voiceChatActions.css @@ -10,5 +10,5 @@ .monaco-workbench .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled):hover::before, .monaco-workbench .inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled):hover::before { - content: "\eba5"; /* use `stop-circle` icon unicode for hovering over running voice recording */ + content: "\ead7"; /* use `debug-stop` icon unicode for hovering over running voice recording */ } From 1e4020e70c32d3f836f44ce816bbca6f761743be Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 30 Aug 2023 08:50:59 -0700 Subject: [PATCH 058/117] set default focusAfterRun to none --- .../contrib/terminal/common/terminalConfiguration.ts | 5 ++--- .../browser/terminal.accessibility.contribution.ts | 8 +++----- .../accessibility/browser/terminalAccessibilityHelp.ts | 3 ++- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts index 1f8820b634f..dde5c45fd5c 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts @@ -611,11 +611,10 @@ const terminalConfiguration: IConfigurationNode = { }, [TerminalSettingId.FocusAfterRun]: { markdownDescription: localize('terminal.integrated.focusAfterRun', "Controls whether the terminal, accessible buffer, or neither will be focused after `Terminal: Run Selected Text In Active Terminal` has been run."), - enum: ['auto', 'terminal', 'accessible-buffer', 'none'], - default: 'auto', + enum: ['terminal', 'accessible-buffer', 'none'], + default: 'none', tags: ['accessibility'], markdownEnumDescriptions: [ - localize('terminal.integrated.focusAfterRun.auto', "Set to `terminal` when in screen reader optimized mode and `none` otherwise."), localize('terminal.integrated.focusAfterRun.terminal', "Always focus the terminal."), localize('terminal.integrated.focusAfterRun.accessible-buffer', "Always focus the accessible buffer."), localize('terminal.integrated.focusAfterRun.none', "Do nothing."), diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminal.accessibility.contribution.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminal.accessibility.contribution.ts index 8c3ef5b48eb..682d14ccde1 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminal.accessibility.contribution.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminal.accessibility.contribution.ts @@ -6,7 +6,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Disposable, DisposableStore } from 'vs/base/common/lifecycle'; import { localize } from 'vs/nls'; -import { CONTEXT_ACCESSIBILITY_MODE_ENABLED, IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; +import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vs/platform/accessibility/common/accessibility'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; @@ -61,14 +61,12 @@ class AccessibleBufferContribution extends DisposableStore implements ITerminalC processManager: ITerminalProcessManager, widgetManager: TerminalWidgetManager, @IInstantiationService private readonly _instantiationService: IInstantiationService, - @IConfigurationService configurationService: IConfigurationService, - @IAccessibilityService accessibilityService: IAccessibilityService + @IConfigurationService configurationService: IConfigurationService ) { super(); this.add(_instance.onDidRunText(() => { const focusAfterRun = configurationService.getValue(TerminalSettingId.FocusAfterRun); - const focusTerminal = focusAfterRun === 'terminal' || (focusAfterRun === 'auto' && accessibilityService.isScreenReaderOptimized()); - if (focusTerminal) { + if (focusAfterRun === 'terminal') { _instance.focus(true); } else if (focusAfterRun === 'accessible-buffer') { this.show(); diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibilityHelp.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibilityHelp.ts index 9205be2e624..340427fd528 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibilityHelp.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibilityHelp.ts @@ -11,7 +11,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { ShellIntegrationStatus, WindowsShellType } from 'vs/platform/terminal/common/terminal'; +import { ShellIntegrationStatus, TerminalSettingId, WindowsShellType } from 'vs/platform/terminal/common/terminal'; import { AccessibilityVerbositySettingId } from 'vs/workbench/contrib/accessibility/browser/accessibilityConfiguration'; import { AccessibleViewType, IAccessibleContentProvider, IAccessibleViewOptions } from 'vs/workbench/contrib/accessibility/browser/accessibleView'; import { ITerminalInstance, IXtermTerminal } from 'vs/workbench/contrib/terminal/browser/terminal'; @@ -93,6 +93,7 @@ export class TerminalAccessibleContentProvider extends Disposable implements IAc } content.push(this._descriptionForCommand(TerminalCommandId.OpenDetectedLink, localize('openDetectedLink', 'The Open Detected Link ({0}) command enables screen readers to easily open links found in the terminal.'), localize('openDetectedLinkNoKb', 'The Open Detected Link command enables screen readers to easily open links found in the terminal and is currently not triggerable by a keybinding.'))); content.push(this._descriptionForCommand(TerminalCommandId.NewWithProfile, localize('newWithProfile', 'The Create New Terminal (With Profile) ({0}) command allows for easy terminal creation using a specific profile.'), localize('newWithProfileNoKb', 'The Create New Terminal (With Profile) command allows for easy terminal creation using a specific profile and is currently not triggerable by a keybinding.'))); + content.push(localize('focusAfterRun', 'Configure what gets focused after running selected text in the terminal with `{0}`.', TerminalSettingId.FocusAfterRun)); content.push(localize('accessibilitySettings', 'Access accessibility settings such as `terminal.integrated.tabFocusMode` via the Preferences: Open Accessibility Settings command.')); return content.join('\n\n'); } From 65dd28d745a5369653196d67b83b0390cd2a82bf Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 30 Aug 2023 17:53:35 +0200 Subject: [PATCH 059/117] voice - add a new action to stop and accept voice input (#191802) --- .../actions/voiceChatActions.ts | 87 ++++++++++++++----- 1 file changed, 65 insertions(+), 22 deletions(-) diff --git a/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts b/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts index 792071aab04..05e454d36a2 100644 --- a/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts +++ b/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts @@ -160,21 +160,26 @@ class VoiceChatSessionControllerFactory { } } -class VoiceChatSession { +interface ActiveVoiceChatSession { + readonly controller: IVoiceChatSessionController; + readonly disposables: DisposableStore; +} - private static instance: VoiceChatSession | undefined = undefined; - static getInstance(instantiationService: IInstantiationService): VoiceChatSession { - if (!VoiceChatSession.instance) { - VoiceChatSession.instance = instantiationService.createInstance(VoiceChatSession); +class VoiceChatSessions { + + private static instance: VoiceChatSessions | undefined = undefined; + static getInstance(instantiationService: IInstantiationService): VoiceChatSessions { + if (!VoiceChatSessions.instance) { + VoiceChatSessions.instance = instantiationService.createInstance(VoiceChatSessions); } - return VoiceChatSession.instance; + return VoiceChatSessions.instance; } private voiceChatInProgressKey = CONTEXT_VOICE_CHAT_IN_PROGRESS.bindTo(this.contextKeyService); private voiceChatGettingReadyKey = CONTEXT_VOICE_CHAT_GETTING_READY.bindTo(this.contextKeyService); - private currentVoiceChatSession: DisposableStore | undefined = undefined; + private currentVoiceChatSession: ActiveVoiceChatSession | undefined = undefined; private voiceChatSessionIds = 0; constructor( @@ -186,14 +191,18 @@ class VoiceChatSession { this.stop(); const voiceChatSessionId = ++this.voiceChatSessionIds; - this.currentVoiceChatSession = new DisposableStore(); + this.currentVoiceChatSession = { + controller, + disposables: new DisposableStore() + }; const cts = new CancellationTokenSource(); - this.currentVoiceChatSession.add(toDisposable(() => cts.dispose(true))); + this.currentVoiceChatSession.disposables.add(toDisposable(() => cts.dispose(true))); - this.currentVoiceChatSession.add(controller.onDidAcceptInput(() => this.stop(voiceChatSessionId))); - this.currentVoiceChatSession.add(controller.onDidCancelInput(() => this.stop(voiceChatSessionId))); + this.currentVoiceChatSession.disposables.add(controller.onDidAcceptInput(() => this.stop(voiceChatSessionId))); + this.currentVoiceChatSession.disposables.add(controller.onDidCancelInput(() => this.stop(voiceChatSessionId))); + controller.updateInput(''); controller.focusInput(); this.voiceChatGettingReadyKey.set(true); @@ -209,14 +218,14 @@ class VoiceChatSession { this.voiceChatGettingReadyKey.set(false); this.voiceChatInProgressKey.set(true); - this.registerTranscriptionListener(controller, onDidTranscribe, this.currentVoiceChatSession); + this.registerTranscriptionListener(this.currentVoiceChatSession, onDidTranscribe); } - private registerTranscriptionListener(controller: IVoiceChatSessionController, onDidTranscribe: Event, disposables: DisposableStore) { + private registerTranscriptionListener(session: ActiveVoiceChatSession, onDidTranscribe: Event) { let lastText: string | undefined = undefined; let lastTextSimilarCount = 0; - disposables.add(onDidTranscribe(text => { + session.disposables.add(onDidTranscribe(text => { if (!text && lastText) { text = lastText; } @@ -230,9 +239,9 @@ class VoiceChatSession { } if (lastTextSimilarCount >= 2) { - controller.acceptInput(); + session.controller.acceptInput(); } else { - controller.updateInput(text); + session.controller.updateInput(text); } } @@ -261,12 +270,23 @@ class VoiceChatSession { return; } - this.currentVoiceChatSession.dispose(); + this.currentVoiceChatSession.disposables.dispose(); this.currentVoiceChatSession = undefined; this.voiceChatGettingReadyKey.set(false); this.voiceChatInProgressKey.set(false); } + + accept(voiceChatSessionId = this.voiceChatSessionIds): void { + if ( + !this.currentVoiceChatSession || + this.voiceChatSessionIds !== voiceChatSessionId + ) { + return; + } + + this.currentVoiceChatSession.controller.acceptInput(); + } } class VoiceChatInChatViewAction extends Action2 { @@ -291,7 +311,7 @@ class VoiceChatInChatViewAction extends Action2 { const controller = await VoiceChatSessionControllerFactory.create(accessor, 'view'); if (controller) { - VoiceChatSession.getInstance(instantiationService).start(controller); + VoiceChatSessions.getInstance(instantiationService).start(controller); } } } @@ -318,7 +338,7 @@ class InlineVoiceChatAction extends Action2 { const controller = await VoiceChatSessionControllerFactory.create(accessor, 'inline'); if (controller) { - VoiceChatSession.getInstance(instantiationService).start(controller); + VoiceChatSessions.getInstance(instantiationService).start(controller); } } } @@ -345,7 +365,7 @@ class QuickVoiceChatAction extends Action2 { const controller = await VoiceChatSessionControllerFactory.create(accessor, 'quick'); if (controller) { - VoiceChatSession.getInstance(instantiationService).start(controller); + VoiceChatSessions.getInstance(instantiationService).start(controller); } } } @@ -391,7 +411,7 @@ class StartVoiceChatAction extends Action2 { const controller = await VoiceChatSessionControllerFactory.create(accessor, 'focussed'); if (controller) { - VoiceChatSession.getInstance(instantiationService).start(controller); + VoiceChatSessions.getInstance(instantiationService).start(controller); } else { // fallback to Quick Voice Chat command commandService.executeCommand(QuickVoiceChatAction.ID); @@ -434,7 +454,29 @@ class StopVoiceChatAction extends Action2 { } run(accessor: ServicesAccessor): void { - VoiceChatSession.getInstance(accessor.get(IInstantiationService)).stop(); + VoiceChatSessions.getInstance(accessor.get(IInstantiationService)).stop(); + } +} + +class StopVoiceChatAndSubmitAction extends Action2 { + + static readonly ID = 'workbench.action.chat.stopVoiceChatAndSubmit'; + + constructor() { + super({ + id: StopVoiceChatAndSubmitAction.ID, + title: { + value: localize('workbench.action.chat.stopAndAcceptVoiceChat.label', "Stop Voice Chat and Submit"), + original: 'Stop Voice Chat and Submit' + }, + category: CHAT_CATEGORY, + f1: true, + precondition: CONTEXT_VOICE_CHAT_IN_PROGRESS + }); + } + + run(accessor: ServicesAccessor): void { + VoiceChatSessions.getInstance(accessor.get(IInstantiationService)).accept(); } } @@ -446,5 +488,6 @@ export function registerVoiceChatActions() { registerAction2(StartVoiceChatAction); registerAction2(StopVoiceChatAction); + registerAction2(StopVoiceChatAndSubmitAction); } } From 49581af0aa7abbad69699899dadb972488998c32 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 30 Aug 2023 09:17:45 -0700 Subject: [PATCH 060/117] Disable renderer unit test on Windows --- .../terminal/test/browser/xterm/xtermTerminal.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts b/src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts index ab689e76e87..578d5b7fbf5 100644 --- a/src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts +++ b/src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts @@ -33,6 +33,7 @@ import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKe import { Color, RGBA } from 'vs/base/common/color'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { ITerminalLogService } from 'vs/platform/terminal/common/terminal'; +import { isWindows } from 'vs/base/common/platform'; class TestWebglAddon implements WebglAddon { static shouldThrow = false; @@ -256,7 +257,9 @@ suite('XtermTerminal', () => { }); suite('renderers', () => { - test('should re-evaluate gpu acceleration auto when the setting is changed', async () => { + // This is skipped on Windows because the result depends on the webgl + // renderer in the browsing context + (isWindows ? test.skip : test)('should re-evaluate gpu acceleration auto when the setting is changed', async () => { // Check initial state strictEqual(TestWebglAddon.isEnabled, false); From e2d858ecb03625377d4ddfaf9b7d65061745a0c9 Mon Sep 17 00:00:00 2001 From: Aaron Munger Date: Wed, 30 Aug 2023 09:32:45 -0700 Subject: [PATCH 061/117] changed command title and name --- extensions/ipynb/package.json | 6 +++--- extensions/ipynb/package.nls.json | 2 +- .../notebook/browser/controller/cellOutputActions.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/extensions/ipynb/package.json b/extensions/ipynb/package.json index f5e25ac3695..25d08040183 100644 --- a/extensions/ipynb/package.json +++ b/extensions/ipynb/package.json @@ -58,8 +58,8 @@ "title": "%cleanInvalidImageAttachment.title%" }, { - "command": "notebook.cellOutput.copyToClipboard", - "title": "%copyOutputToClipboard.title%" + "command": "notebook.cellOutput.copy", + "title": "%copyCellOutput.title%" } ], "notebooks": [ @@ -106,7 +106,7 @@ ], "webview/context": [ { - "command": "notebook.cellOutput.copyToClipboard", + "command": "notebook.cellOutput.copy", "when": "webviewId == 'notebook.output' && webviewSection == 'image'" } ] diff --git a/extensions/ipynb/package.nls.json b/extensions/ipynb/package.nls.json index 45aa2aa03e8..1f281c32dd3 100644 --- a/extensions/ipynb/package.nls.json +++ b/extensions/ipynb/package.nls.json @@ -6,7 +6,7 @@ "newUntitledIpynb.shortTitle": "Jupyter Notebook", "openIpynbInNotebookEditor.title": "Open IPYNB File In Notebook Editor", "cleanInvalidImageAttachment.title": "Clean Invalid Image Attachment Reference", - "copyOutputToClipboard.title": "Copy Output to Clipboard", + "copyCellOutput.title": "Copy Output", "markdownAttachmentRenderer.displayName": { "message": "Markdown-It ipynb Cell Attachment renderer", "comment": [ diff --git a/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.ts b/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.ts index 956222d7a36..529fb143978 100644 --- a/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.ts +++ b/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.ts @@ -17,13 +17,13 @@ import { ICellOutputViewModel, ICellViewModel, INotebookEditor, getNotebookEdito import { CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel'; -export const COPY_OUTPUT_COMMAND_ID = 'notebook.cellOutput.copyToClipboard'; +export const COPY_OUTPUT_COMMAND_ID = 'notebook.cellOutput.copy'; registerAction2(class CopyCellOutputAction extends Action2 { constructor() { super({ id: COPY_OUTPUT_COMMAND_ID, - title: localize('notebookActions.copyOutput', "Copy Output to Clipboard"), + title: localize('notebookActions.copyOutput', "Copy Output"), menu: { id: MenuId.NotebookOutputToolbar, when: NOTEBOOK_CELL_HAS_OUTPUTS From de94adc47511b51dd239381e4c34e16dfa870d9e Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 30 Aug 2023 09:33:14 -0700 Subject: [PATCH 062/117] Update distro Fixes #191605 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0af191524ed..1a58592be0a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.82.0", - "distro": "c7d53f94cfb25168c3c3ae9a6f4902d32643a0ee", + "distro": "021e674d5265eb9125cfc0282c3a9a6091f4982d", "author": { "name": "Microsoft Corporation" }, From 29137c69f1243d31302e57e26c2ea169b1c6254e Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 30 Aug 2023 18:46:39 +0200 Subject: [PATCH 063/117] make sure codeEditor is set when bulk editing via diff editor (#191810) re https://github.com/microsoft/vscode/issues/188385 --- src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.ts b/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.ts index 1258f618970..888c67f46a9 100644 --- a/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.ts +++ b/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.ts @@ -8,7 +8,7 @@ import { IDisposable, toDisposable } from 'vs/base/common/lifecycle'; import { LinkedList } from 'vs/base/common/linkedList'; import { ResourceMap, ResourceSet } from 'vs/base/common/map'; import { URI } from 'vs/base/common/uri'; -import { ICodeEditor, isCodeEditor } from 'vs/editor/browser/editorBrowser'; +import { ICodeEditor, isCodeEditor, isDiffEditor } from 'vs/editor/browser/editorBrowser'; import { IBulkEditOptions, IBulkEditPreviewHandler, IBulkEditResult, IBulkEditService, ResourceEdit, ResourceFileEdit, ResourceTextEdit } from 'vs/editor/browser/services/bulkEditService'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; import { WorkspaceEdit } from 'vs/editor/common/languages'; @@ -197,6 +197,8 @@ export class BulkEditService implements IBulkEditService { const candidate = this._editorService.activeTextEditorControl; if (isCodeEditor(candidate)) { codeEditor = candidate; + } else if (isDiffEditor(candidate)) { + codeEditor = candidate.getModifiedEditor(); } } From cc5e466c96635ef3e0d18896b6054eb51fe5969a Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 30 Aug 2023 09:47:27 -0700 Subject: [PATCH 064/117] Remove windows check --- .../workbench/contrib/terminal/browser/xterm/xtermTerminal.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts b/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts index 7d968e8818f..12aaa0b0bb6 100644 --- a/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts +++ b/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts @@ -43,7 +43,6 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService import { debounce } from 'vs/base/common/decorators'; import { MouseWheelClassifier } from 'vs/base/browser/ui/scrollbar/scrollableElement'; import { IMouseWheelEvent, StandardWheelEvent } from 'vs/base/browser/mouseEvent'; -import { isWindows } from 'vs/base/common/platform'; const enum RenderConstants { /** @@ -684,7 +683,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal, ID // - https://github.com/microsoft/vscode/issues/190195 // - https://github.com/xtermjs/xterm.js/issues/4665 // - https://bugs.chromium.org/p/chromium/issues/detail?id=1476475 - if (!XtermTerminal._checkedWebglCompatible && isWindows) { + if (!XtermTerminal._checkedWebglCompatible) { XtermTerminal._checkedWebglCompatible = true; const checkCanvas = document.createElement('canvas'); const checkGl = checkCanvas.getContext('webgl2'); From ed06154e36dba10a6625f33c4c2c6626df54d57a Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 30 Aug 2023 09:49:19 -0700 Subject: [PATCH 065/117] Disable test --- .../terminal/test/browser/xterm/xtermTerminal.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts b/src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts index 578d5b7fbf5..f4c0afd0259 100644 --- a/src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts +++ b/src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts @@ -257,9 +257,9 @@ suite('XtermTerminal', () => { }); suite('renderers', () => { - // This is skipped on Windows because the result depends on the webgl - // renderer in the browsing context - (isWindows ? test.skip : test)('should re-evaluate gpu acceleration auto when the setting is changed', async () => { + // This is skipped until the webgl renderer bug is fixed in Chromium + // https://bugs.chromium.org/p/chromium/issues/detail?id=1476475 + test.skip('should re-evaluate gpu acceleration auto when the setting is changed', async () => { // Check initial state strictEqual(TestWebglAddon.isEnabled, false); From cd7388f4dad4c7102713db8ebb16488f070433ea Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 30 Aug 2023 09:50:50 -0700 Subject: [PATCH 066/117] forwarding: fix formatting issues in the log (#191814) Fixes #191759 --- extensions/tunnel-forwarding/src/split.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/tunnel-forwarding/src/split.ts b/extensions/tunnel-forwarding/src/split.ts index 6e9d7474604..33ad055ac67 100644 --- a/extensions/tunnel-forwarding/src/split.ts +++ b/extensions/tunnel-forwarding/src/split.ts @@ -9,6 +9,8 @@ export const splitNewLines = () => new StreamSplitter('\n'.charCodeAt(0)); /** * Copied and simplified from src\vs\base\node\nodeStreams.ts + * + * Exception: does not include the split character in the output. */ export class StreamSplitter extends Transform { private buffer: Buffer | undefined; @@ -31,7 +33,7 @@ export class StreamSplitter extends Transform { break; } - this.push(this.buffer.subarray(offset, index + 1)); + this.push(this.buffer.subarray(offset, index)); offset = index + 1; } From d3c20779626942e64713fefeb1f84b363946dd94 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 30 Aug 2023 09:51:35 -0700 Subject: [PATCH 067/117] Fix import --- .../contrib/terminal/test/browser/xterm/xtermTerminal.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts b/src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts index f4c0afd0259..204505dd1e6 100644 --- a/src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts +++ b/src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts @@ -33,7 +33,6 @@ import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKe import { Color, RGBA } from 'vs/base/common/color'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { ITerminalLogService } from 'vs/platform/terminal/common/terminal'; -import { isWindows } from 'vs/base/common/platform'; class TestWebglAddon implements WebglAddon { static shouldThrow = false; From 4dc543d246c6cb2987904444863ea0a51102a95a Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 30 Aug 2023 09:55:19 -0700 Subject: [PATCH 068/117] fix #188329 --- .../workbench/contrib/terminal/browser/terminalInstance.ts | 5 +++++ .../accessibility/browser/terminalAccessibleWidget.ts | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index 449e9fce543..64bd477b0e8 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -976,6 +976,11 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { return false; } + if (event.key === 'Tab' && event.shiftKey) { + event.preventDefault(); + return true; + } + // Always have alt+F4 skip the terminal on Windows and allow it to be handled by the // system if (isWindows && event.altKey && event.key === 'F4' && !event.ctrlKey) { diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibleWidget.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibleWidget.ts index 6b43d58d553..5190803c2d0 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibleWidget.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibleWidget.ts @@ -118,11 +118,6 @@ export abstract class TerminalAccessibleWidget extends DisposableStore { // On escape, hide the accessible buffer and force focus onto the terminal this.hide(true); break; - case KeyCode.Tab: - // On tab or shift+tab, hide the accessible buffer and perform the default tab - // behavior - this.hide(); - break; } })); this.add(this._editorWidget.onDidFocusEditorText(async () => { From c394fb8959fcaf1f6e9831a0b2b19da7cd4e1286 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 30 Aug 2023 10:02:48 -0700 Subject: [PATCH 069/117] cli: polish serve-web help (#191817) Fixes #191601 --- cli/src/commands/args.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/src/commands/args.rs b/cli/src/commands/args.rs index bfa1c6f2da4..cbc33fcb071 100644 --- a/cli/src/commands/args.rs +++ b/cli/src/commands/args.rs @@ -52,6 +52,7 @@ const VERSION: &str = concatcp!(NUMBER_IN_VERSION, " (commit ", COMMIT_IN_VERSIO #[clap( help_template = INTEGRATED_TEMPLATE, long_about = None, + name = constants::APPLICATION_NAME, version = VERSION, )] pub struct IntegratedCli { @@ -84,6 +85,7 @@ pub struct CliCore { help_template = STANDALONE_TEMPLATE, long_about = None, version = VERSION, + name = constants::APPLICATION_NAME, )] pub struct StandaloneCli { #[clap(flatten)] @@ -173,6 +175,7 @@ pub enum Commands { Version(VersionArgs), /// Runs a local web version of VS Code. + #[clap(about = concatcp!("Runs a local web version of ", constants::PRODUCT_NAME_LONG))] ServeWeb(ServeWebArgs), /// Runs the control server on process stdin/stdout From c69c9082378f6b18bb237f8cc04da64f62e5370f Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 30 Aug 2023 10:04:34 -0700 Subject: [PATCH 070/117] Fix error in zsh si script Fixes #188875 --- .../contrib/terminal/browser/media/shellIntegration-rc.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh b/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh index 09718cfbab2..cc2cb83e0d2 100644 --- a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh +++ b/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh @@ -51,7 +51,7 @@ if [ -n "${VSCODE_ENV_PREPEND:-}" ]; then IFS=':' read -rA ADDR <<< "$VSCODE_ENV_PREPEND" for ITEM in "${ADDR[@]}"; do VARNAME="$(echo ${ITEM%%=*})" - export $VARNAME="$(echo -e {ITEM#*=})${(P)VARNAME}" + export $VARNAME="$(echo -e ${ITEM#*=})${(P)VARNAME}" done unset VSCODE_ENV_PREPEND fi @@ -59,7 +59,7 @@ if [ -n "${VSCODE_ENV_APPEND:-}" ]; then IFS=':' read -rA ADDR <<< "$VSCODE_ENV_APPEND" for ITEM in "${ADDR[@]}"; do VARNAME="$(echo ${ITEM%%=*})" - export $VARNAME="${(P)VARNAME}$(echo -e {ITEM#*=})" + export $VARNAME="${(P)VARNAME}$(echo -e ${ITEM#*=})" done unset VSCODE_ENV_APPEND fi From 146a7d807040153ed6ecdc937185db651393b229 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Wed, 30 Aug 2023 10:14:14 -0700 Subject: [PATCH 071/117] Update src/vs/workbench/contrib/terminal/browser/terminalInstance.ts Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com> --- src/vs/workbench/contrib/terminal/browser/terminalInstance.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index 64bd477b0e8..645bcb88540 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -976,6 +976,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { return false; } + // Prevent default when shift+tab is being sent to the terminal to avoid it bubbling up + // and changing focus https://github.com/microsoft/vscode/issues/188329 if (event.key === 'Tab' && event.shiftKey) { event.preventDefault(); return true; From 3ff7e76b48dcc4a2ec5421239175432d1d47f2d3 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 30 Aug 2023 10:19:08 -0700 Subject: [PATCH 072/117] on blur, hide --- .../accessibility/browser/terminalAccessibleWidget.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibleWidget.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibleWidget.ts index 5190803c2d0..448cd3da0e4 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibleWidget.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibleWidget.ts @@ -124,6 +124,7 @@ export abstract class TerminalAccessibleWidget extends DisposableStore { this._terminalService.setActiveInstance(this._instance as ITerminalInstance); this._xtermElement.classList.add(ClassName.Hide); })); + this.add(this._editorWidget.onDidBlurEditorText(async () => this.hide())); } registerListeners(): void { From 8a69a8f266d812d093be0e9c2fd8d41c397e6f75 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 30 Aug 2023 10:41:17 -0700 Subject: [PATCH 073/117] debug: bump js-debug to 1.82 (#191827) --- product.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/product.json b/product.json index 2ae3ee8f0f8..acb24971c39 100644 --- a/product.json +++ b/product.json @@ -52,8 +52,8 @@ }, { "name": "ms-vscode.js-debug", - "version": "1.81.0", - "sha256": "6d1c7ee89881afd65e8fee47445b6a1c5fb345bf30e2bdf70cd2fdd8d1ff6dec", + "version": "1.82.0", + "sha256": "4fba41b4b764c3f5a6591d6d9a5bdc59b417f2d799071c889c2b54163f256282", "repo": "https://github.com/microsoft/vscode-js-debug", "metadata": { "id": "25629058-ddac-4e17-abba-74678e126c5d", From 6e058e590332c2f85a2097a642a1efc10d2a2fec Mon Sep 17 00:00:00 2001 From: Aaron Munger Date: Wed, 30 Aug 2023 10:46:39 -0700 Subject: [PATCH 074/117] allow more output mime types to be copied --- .../notebook/browser/contrib/clipboard/cellOutputClipboard.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/cellOutputClipboard.ts b/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/cellOutputClipboard.ts index 576ded3d1f6..a544461cc28 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/cellOutputClipboard.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/cellOutputClipboard.ts @@ -61,5 +61,7 @@ export const TEXT_BASED_MIMETYPES = [ 'application/x.notebook.stream', 'application/vnd.code.notebook.stderr', 'application/x.notebook.stderr', - 'text/plain' + 'text/plain', + 'text/markdown', + 'application/json' ]; From faa42cbdd2276d3815ae3485e64067ba28b791da Mon Sep 17 00:00:00 2001 From: Joyce Er Date: Wed, 30 Aug 2023 10:52:35 -0700 Subject: [PATCH 075/117] Fix file tree not being transferred to panel chat (#191826) --- src/vs/workbench/contrib/chat/common/chatModel.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vs/workbench/contrib/chat/common/chatModel.ts b/src/vs/workbench/contrib/chat/common/chatModel.ts index 23fec163a79..5f51abedb9a 100644 --- a/src/vs/workbench/contrib/chat/common/chatModel.ts +++ b/src/vs/workbench/contrib/chat/common/chatModel.ts @@ -160,6 +160,7 @@ export class Response implements IResponse { }); } else if (isCompleteInteractiveProgressTreeData(responsePart)) { this._responseParts.push(responsePart); + this._updateRepr(quiet); } } From da5492061c96005ca7592623f523c3323983fb09 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Wed, 30 Aug 2023 11:13:13 -0700 Subject: [PATCH 076/117] Fix rendering when chat is hidden (#191830) Fixes https://github.com/microsoft/vscode/issues/191704 --- .../contrib/chat/browser/chatQuick.ts | 11 +++++++++++ .../contrib/chat/browser/chatWidget.ts | 19 +++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/chatQuick.ts b/src/vs/workbench/contrib/chat/browser/chatQuick.ts index 5545e1a5d03..cc32d7adbd3 100644 --- a/src/vs/workbench/contrib/chat/browser/chatQuick.ts +++ b/src/vs/workbench/contrib/chat/browser/chatQuick.ts @@ -92,10 +92,13 @@ export class QuickChatService extends Disposable implements IQuickChatService { // show needs to come after the quickpick is shown this._currentChat.render(this._container); + } else { + this._currentChat.show(); } disposableStore.add(this._input.onDidHide(() => { disposableStore.dispose(); + this._currentChat!.hide(); this._input = undefined; this._onDidClose.fire(); })); @@ -163,6 +166,14 @@ class QuickChat extends Disposable { } } + hide(): void { + this.widget.setVisible(false); + } + + show(): void { + this.widget.setVisible(true); + } + render(parent: HTMLElement): void { if (this.widget) { throw new Error('Cannot render quick chat twice'); diff --git a/src/vs/workbench/contrib/chat/browser/chatWidget.ts b/src/vs/workbench/contrib/chat/browser/chatWidget.ts index 7e65ed72d20..b37163a9990 100644 --- a/src/vs/workbench/contrib/chat/browser/chatWidget.ts +++ b/src/vs/workbench/contrib/chat/browser/chatWidget.ts @@ -213,7 +213,7 @@ export class ChatWidget extends Disposable implements IChatWidget { this._onDidClear.fire(); } - private onDidChangeItems() { + private onDidChangeItems(skipDynamicLayout?: boolean) { if (this.tree && this.visible) { const treeItems = (this.viewModel?.getItems() ?? []) .map(item => { @@ -239,7 +239,7 @@ export class ChatWidget extends Disposable implements IChatWidget { } }); - if (this._dynamicMessageLayoutData) { + if (!skipDynamicLayout && this._dynamicMessageLayoutData) { this.layoutDynamicChatTreeItemMode(); } @@ -270,7 +270,7 @@ export class ChatWidget extends Disposable implements IChatWidget { // Progressive rendering paused while hidden, so start it up again. // Do it after a timeout because the container is not visible yet (it should be but offsetHeight returns 0 here) if (this.visible) { - this.onDidChangeItems(); + this.onDidChangeItems(true); } }, 0)); } @@ -540,6 +540,11 @@ export class ChatWidget extends Disposable implements IChatWidget { const mutableDisposable = this._register(new MutableDisposable()); this._register(this.tree.onDidScroll((e) => { + // TODO@TylerLeonhardt this should probably just be disposed when this is disabled + // and then set up again when it is enabled again + if (!this._dynamicMessageLayoutData?.enabled) { + return; + } mutableDisposable.value = dom.scheduleAtNextAnimationFrame(() => { if (!e.scrollTopChanged || e.heightChanged || e.scrollHeightChanged) { return; @@ -593,7 +598,9 @@ export class ChatWidget extends Disposable implements IChatWidget { if (!this.viewModel || !this._dynamicMessageLayoutData?.enabled) { return; } - const inputHeight = this.inputPart.layout(this._dynamicMessageLayoutData!.maxHeight, this.container.offsetWidth); + + const width = this.bodyDimension?.width ?? this.container.offsetWidth; + const inputHeight = this.inputPart.layout(this._dynamicMessageLayoutData!.maxHeight, width); const totalMessages = this.viewModel.getItems(); // grab the last N messages @@ -610,10 +617,10 @@ export class ChatWidget extends Disposable implements IChatWidget { inputHeight + listHeight + (totalMessages.length > 2 ? 18 : 0), this._dynamicMessageLayoutData!.maxHeight ), - this.container.offsetWidth + width ); - if (needsRerender) { + if (needsRerender || !listHeight) { // TODO: figure out a better place to reveal the last element revealLastElement(this.tree); } From 8470c9b0e32bc4da53d74c89ad3909da18ff1991 Mon Sep 17 00:00:00 2001 From: Andrea Mah <31675041+andreamah@users.noreply.github.com> Date: Wed, 30 Aug 2023 11:17:10 -0700 Subject: [PATCH 077/117] adjust endgame query (#191806) --- .vscode/notebooks/my-endgame.github-issues | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/notebooks/my-endgame.github-issues b/.vscode/notebooks/my-endgame.github-issues index 96c780e5a6f..6978af0b6f0 100644 --- a/.vscode/notebooks/my-endgame.github-issues +++ b/.vscode/notebooks/my-endgame.github-issues @@ -177,7 +177,7 @@ { "kind": 2, "language": "github-issues", - "value": "$REPOS $MILESTONE -$MINE is:issue label:bug label:verification-steps-needed" + "value": "$REPOS $MILESTONE -$MINE is:issue label:bug label:verification-steps-needed -label:verified" }, { "kind": 1, From 272fdf6abf6d3ddedc4197b21585fa615ef313c0 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Wed, 30 Aug 2023 16:19:30 +0200 Subject: [PATCH 078/117] Diff Editor: Disables optimistic diff updates. Fixes #190748, Fixes #190232 --- .../diffEditorWidget2/diffEditorViewModel.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/vs/editor/browser/widget/diffEditorWidget2/diffEditorViewModel.ts b/src/vs/editor/browser/widget/diffEditorWidget2/diffEditorViewModel.ts index aff79983e40..91839a8d461 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget2/diffEditorViewModel.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget2/diffEditorViewModel.ts @@ -4,22 +4,21 @@ *--------------------------------------------------------------------------------------------*/ import { RunOnceScheduler } from 'vs/base/common/async'; +import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { Disposable, toDisposable } from 'vs/base/common/lifecycle'; import { IObservable, IReader, ISettableObservable, ITransaction, autorunWithStore, derived, observableSignal, observableSignalFromEvent, observableValue, transaction, waitForState } from 'vs/base/common/observable'; -import { isDefined } from 'vs/base/common/types'; +import { readHotReloadableExport } from 'vs/editor/browser/widget/diffEditorWidget2/utils'; import { ISerializedLineRange, LineRange } from 'vs/editor/common/core/lineRange'; import { Range } from 'vs/editor/common/core/range'; -import { IDocumentDiff, IDocumentDiffProvider } from 'vs/editor/common/diff/documentDiffProvider'; -import { LineRangeMapping, MovedText, RangeMapping, SimpleLineRangeMapping } from 'vs/editor/common/diff/linesDiffComputer'; import { AdvancedLinesDiffComputer, lineRangeMappingFromRangeMappings } from 'vs/editor/common/diff/advancedLinesDiffComputer'; +import { IDocumentDiff, IDocumentDiffProvider } from 'vs/editor/common/diff/documentDiffProvider'; +import { LineRangeMapping, MovedText, RangeMapping } from 'vs/editor/common/diff/linesDiffComputer'; import { IDiffEditorModel, IDiffEditorViewModel } from 'vs/editor/common/editorCommon'; import { ITextModel } from 'vs/editor/common/model'; import { TextEditInfo } from 'vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/beforeEditPositionMapper'; import { combineTextEditInfos } from 'vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/combineTextEditInfos'; import { lengthAdd, lengthDiffNonNegative, lengthGetLineCount, lengthOfRange, lengthToPosition, lengthZero, positionToLength } from 'vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/length'; import { DiffEditorOptions } from './diffEditorOptions'; -import { readHotReloadableExport } from 'vs/editor/browser/widget/diffEditorWidget2/utils'; -import { CancellationTokenSource } from 'vs/base/common/cancellation'; export class DiffEditorViewModel extends Disposable implements IDiffEditorViewModel { private readonly _isDiffUpToDate = observableValue('isDiffUpToDate', false); @@ -469,6 +468,9 @@ export class UnchangedRegion { } function applyOriginalEdits(diff: IDocumentDiff, textEdits: TextEditInfo[], originalTextModel: ITextModel, modifiedTextModel: ITextModel): IDocumentDiff | undefined { + return undefined; + /* + TODO@hediet if (textEdits.length === 0) { return diff; } @@ -478,7 +480,7 @@ function applyOriginalEdits(diff: IDocumentDiff, textEdits: TextEditInfo[], orig if (!diff3) { return undefined; } - return flip(diff3); + return flip(diff3);*/ } function flip(diff: IDocumentDiff): IDocumentDiff { @@ -491,6 +493,9 @@ function flip(diff: IDocumentDiff): IDocumentDiff { } function applyModifiedEdits(diff: IDocumentDiff, textEdits: TextEditInfo[], originalTextModel: ITextModel, modifiedTextModel: ITextModel): IDocumentDiff | undefined { + return undefined; + /* + TODO@hediet if (textEdits.length === 0) { return diff; } @@ -514,7 +519,7 @@ function applyModifiedEdits(diff: IDocumentDiff, textEdits: TextEditInfo[], orig quitEarly: false, changes, moves, - }; + };*/ } function applyEditToLineRange(range: LineRange, textEdits: TextEditInfo[]): LineRange | undefined { From 425413a5092365a790cdd0c7006a687513e4572f Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Wed, 30 Aug 2023 16:45:22 +0200 Subject: [PATCH 079/117] Uncomment unused symbols. --- .../widget/diffEditorWidget2/diffEditorViewModel.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/vs/editor/browser/widget/diffEditorWidget2/diffEditorViewModel.ts b/src/vs/editor/browser/widget/diffEditorWidget2/diffEditorViewModel.ts index 91839a8d461..729b3d61260 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget2/diffEditorViewModel.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget2/diffEditorViewModel.ts @@ -482,7 +482,7 @@ function applyOriginalEdits(diff: IDocumentDiff, textEdits: TextEditInfo[], orig } return flip(diff3);*/ } - +/* function flip(diff: IDocumentDiff): IDocumentDiff { return { changes: diff.changes.map(c => c.flip()), @@ -491,7 +491,7 @@ function flip(diff: IDocumentDiff): IDocumentDiff { quitEarly: diff.quitEarly, }; } - +*/ function applyModifiedEdits(diff: IDocumentDiff, textEdits: TextEditInfo[], originalTextModel: ITextModel, modifiedTextModel: ITextModel): IDocumentDiff | undefined { return undefined; /* @@ -521,7 +521,7 @@ function applyModifiedEdits(diff: IDocumentDiff, textEdits: TextEditInfo[], orig moves, };*/ } - +/* function applyEditToLineRange(range: LineRange, textEdits: TextEditInfo[]): LineRange | undefined { let rangeStartLineNumber = range.startLineNumber; let rangeEndLineNumberEx = range.endLineNumberExclusive; @@ -588,3 +588,4 @@ function applyModifiedEditsToLineRangeMappings(changes: readonly LineRangeMappin ); return newChanges; } +*/ From 8e242d5bd40435dee74cfb003af4e931767f55bd Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Wed, 30 Aug 2023 20:03:24 +0200 Subject: [PATCH 080/117] Fixes CI --- .../browser/widget/diffEditorWidget2/diffEditorViewModel.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/vs/editor/browser/widget/diffEditorWidget2/diffEditorViewModel.ts b/src/vs/editor/browser/widget/diffEditorWidget2/diffEditorViewModel.ts index 729b3d61260..860afa96659 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget2/diffEditorViewModel.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget2/diffEditorViewModel.ts @@ -9,15 +9,13 @@ import { Disposable, toDisposable } from 'vs/base/common/lifecycle'; import { IObservable, IReader, ISettableObservable, ITransaction, autorunWithStore, derived, observableSignal, observableSignalFromEvent, observableValue, transaction, waitForState } from 'vs/base/common/observable'; import { readHotReloadableExport } from 'vs/editor/browser/widget/diffEditorWidget2/utils'; import { ISerializedLineRange, LineRange } from 'vs/editor/common/core/lineRange'; -import { Range } from 'vs/editor/common/core/range'; -import { AdvancedLinesDiffComputer, lineRangeMappingFromRangeMappings } from 'vs/editor/common/diff/advancedLinesDiffComputer'; +import { AdvancedLinesDiffComputer } from 'vs/editor/common/diff/advancedLinesDiffComputer'; import { IDocumentDiff, IDocumentDiffProvider } from 'vs/editor/common/diff/documentDiffProvider'; -import { LineRangeMapping, MovedText, RangeMapping } from 'vs/editor/common/diff/linesDiffComputer'; +import { LineRangeMapping, MovedText } from 'vs/editor/common/diff/linesDiffComputer'; import { IDiffEditorModel, IDiffEditorViewModel } from 'vs/editor/common/editorCommon'; import { ITextModel } from 'vs/editor/common/model'; import { TextEditInfo } from 'vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/beforeEditPositionMapper'; import { combineTextEditInfos } from 'vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/combineTextEditInfos'; -import { lengthAdd, lengthDiffNonNegative, lengthGetLineCount, lengthOfRange, lengthToPosition, lengthZero, positionToLength } from 'vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/length'; import { DiffEditorOptions } from './diffEditorOptions'; export class DiffEditorViewModel extends Disposable implements IDiffEditorViewModel { From 078a686c8254dd37ff652ea87df7e0ed53e95615 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Wed, 30 Aug 2023 20:47:31 +0200 Subject: [PATCH 081/117] Fix screen reader for comment editor (#191828) * Try forwarding the accessibility support setting to the comment editor * Add isAccessible to comment view Fixes #146994 --- .../contrib/comments/browser/commentThreadZoneWidget.ts | 2 +- .../workbench/contrib/comments/browser/simpleCommentEditor.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts b/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts index 1f00b285fa2..74590df5c4c 100644 --- a/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts +++ b/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts @@ -129,7 +129,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget @IContextKeyService contextKeyService: IContextKeyService, @IConfigurationService private readonly configurationService: IConfigurationService ) { - super(editor, { keepEditorSelection: true }); + super(editor, { keepEditorSelection: true, isAccessible: true }); this._contextKeyService = contextKeyService.createScoped(this.domNode); this._scopedInstantiationService = instantiationService.createChild(new ServiceCollection( diff --git a/src/vs/workbench/contrib/comments/browser/simpleCommentEditor.ts b/src/vs/workbench/contrib/comments/browser/simpleCommentEditor.ts index c8ec74a476f..f087642f26b 100644 --- a/src/vs/workbench/contrib/comments/browser/simpleCommentEditor.ts +++ b/src/vs/workbench/contrib/comments/browser/simpleCommentEditor.ts @@ -104,7 +104,8 @@ export class SimpleCommentEditor extends CodeEditorWidget { enabled: false }, autoClosingBrackets: configurationService.getValue('editor.autoClosingBrackets'), - quickSuggestions: false + quickSuggestions: false, + accessibilitySupport: configurationService.getValue<'auto' | 'off' | 'on'>('editor.accessibilitySupport'), }; } } From 0d71f3559452de1026dc6475b5a94ceb0f42d300 Mon Sep 17 00:00:00 2001 From: David Dossett Date: Wed, 30 Aug 2023 11:59:17 -0700 Subject: [PATCH 082/117] Update codicons (#191835) --- .../browser/ui/codicons/codicon/codicon.ttf | Bin 73436 -> 73624 bytes src/vs/base/common/codicons.ts | 1 + 2 files changed, 1 insertion(+) diff --git a/src/vs/base/browser/ui/codicons/codicon/codicon.ttf b/src/vs/base/browser/ui/codicons/codicon/codicon.ttf index b5623b0a55c7200b6be0079458f48accd5e9eb17..91105610d11595b1232b6618c80bedaf568e09f5 100644 GIT binary patch delta 3559 zcmXBW2~bt%6$kM1hbN2d`z8p2sKjX9h{~pbfGkf`1O#Lec&ra`i)aWB1#yj0u6vXi zqnK#YF_MmrC2CS@G-Df^rm5r5)=sU>@TkqSX{yF*&&e76-T(dW`|f?`<9^?Lcj#l& z;VY)S(Y9nF>?WehYHL+%Oi7Iok;`GC;E}rKjTU#0Z99o#hKT-BUte2QQ+(*eQto?? z#mfPQQird3e~`u0Ti3PyJMsAse7zAOr}vsyRado4I=zx8s+-8M*jm-r>TnC2`SW1z zAK6l6tu?+6{V1E@l+FhqwXRyb&bc)17{MixD5!MbV6?|M0{3Nye|_`RzL9A-XGGuw z_zv8Lr<2iV@;COdXXrKdyZFtz^J8yv{E{4h+?&ifn#gpAOpg709dG{UNHn~Cc=zyU z!#C}&cJqj@G2}9*dIo+%XAy-B@WvAQ0Y#LJ6Ue|Km}v*iL@0I8ReDG%SWjyy5Pf7& zCtidr2*7r_M1AyAY{5$E!djG~5%nlT6V|{A3!O(5Rt>bdy218@p3?v589j$1OmKz^ z+~5vh1R@B*2tgReARG}Gi%5(|EGA$gCLso!Eul zcn$ktU_TDvFpl6Tj^Q}o!b!Z1Q#g%xahC4W-{|l34V6$SHPUQqqH?UJ2C`BeEu&bP zK>ww!w39BPm+wOmRnVU?8i`nk3V(VZ3y}p+lpp}nRDd@ql^#(KU7&x$2{AMYe(<1K z6i*p=83(Z!d+<8-BLPVmMHckq9h^ZsUPT9N=)`8cLOx`M7ahQx#yz+2ImvX4Dk*>l z=tKC>Sc;^7kRJ}gf&N5a&~5rX{f@q(KhPbzOGETW`jUQ&HoAgwM!frYuXM^nCYI7C z^q6O!ld;gCQ8i2VI!%g4_dn>?bcX7FUHRy=`dxJJ=g&RT^iPK&|@&N>Be z&U(dDj)of)@d6rdR46i@c?69=!7Zyo24{=HBFohk`4oP06Yn?o{B$@MeYWhOgIDk1gElQCMl1y@G6Oxy6qHfl|(03Q{RQJ_KYm zuPc;s?p0{w+^4XHvsXdJWGG%FG`wHYdCmh0Rh$R;aUvUDL&IK~PP~T59;J9Sk$s%v zbw&1Q#Vd^LF^ZmZj#uF2Z;w?laZXTh=A5YD!Z}I7jWbSxXMp_$BAaaB%Zt@ z76{^;qU1SepQ;eT$x}oijB}d87|!Vm;ha3B1R^+RDvafvr4UIrvd43SK}PkGf{bdm zf{bd8f{bdef{ZFbK}N;TSpgo9JxM_Z#XkxHGLRGn8OS`rQwUQ1d@J z!7d;LFHn$zGZduYOa&=8OF;@=s2~MoD@Xyh9NsWU0l5lNK%RmWU{;VX%~z0%ELM!<=mjM>u6f3`aR-L=49`Ur{*D*{<*w=c@`QIXe{I=9Gal zoZ{?MI8792-^>k$cR9BxoHZ_oc44)V8rH>cBiF+cY@_*;J_TN6_BRz|Y$p`_Ii&1O{0XQUZe~Czl{l!r8A7zvk!WO&2q9g{iDiCgCt z|JsuM14WZKFDUqN4k&mSqr<1l-`xIlg@c?QDeUFEq_Btc7m9ze$v&t^iu_n1f%CFL z66Y1gzwBhcs>s6miGrN_DUn4s-~rixsUV}hrXV--R|;}7uPeyS{7gY^<_(2T&YMc! zN9~_0ykbN|M2C2B>oOjYEd5f*Q9i!5x#?hvN-vh1Ts0j6~B1Uh>zk|5E}7S^mt%h)PG=mkl>w=o6wzb zE#XmOTw-xzZ{qpH?~=wOolF`^E=)d=(w#Dx@^D_kytaAQ=TDs9IsbZUXlifjgS6Rc z=CqEqYiUo@{nHcE%hCtazg@6t!JUk`8O<4k8Q)}@GdnU*Wj@Uc&Wg>tw=iR2g`Y=27jK+N|2j+6xww<)mfEGGcjJ=Uz9auDx!s?rD8S{qFjw z4Y3XD8lE&BY`oqS+?3ta(=^l^(cIX)v-!T&WKFfUSZ`P#w47ZPx@xd>W@}sPhXc1_ z;?~>fJAUnVrx1R@CBJb_;qVWf9-oAnu|b{~7t1@z2n!2cti{7jB6p*|j-zMdXFp)QUlKexcJh_FC}L~}_i Zql3eH7oUtqn!Cx-+E9HlDG0}%{}0c4tqK4D delta 3355 zcmXZe3s4p36$kM12SijrPy|I03}}#;2tJ4k0)hhamY2K*fySR)<)5)aHG;N)GsqHweV=&d8ljAVI{qNpgzWvVb_w8=? zHHYti_Qr@D2de8zODZocV_D~~t~4JW3&Ef< z7Z>0@au=?S#z6-+=3zWTm(lGsefhm#jwbuNWdFMYrD0> z`jz#TZIUfz%-y)}w6b&w7Ska7ume-EfyR+d2{?syNI^2~qh**yyXZPSq)0T7g;6%?s*h`;LFAZTgN~i@5$io&?ARm?3ifWY8Fp5z-vUAcDSbn0X^fUdBp1}_G zaKuDR#uT_?20Y<~nefJJ%z+Q)!WRLUj|F%cfmnzjyn9AQM^Gh#VB45JlL8%_z-78B8#v3N@%h6W+ugw4fF5q7CiX zhy6H!4s@am29Dr3y74|fzzOu>L!8DL^kV=Y(U0^u`UgFrJj$m^T0vD*gnFZR$_&e4 zzV2SMiT;8~2*Wl^r;ibjIJh7e9(ai|(L>SngxcsL{R(&a|9DDHhvt6o>F0 z4$?WSLO2}AgtIu0b9fs&@eX#uf@Zu$?vw&oI*MK@qc7+i`aRvDWJ;pM1>`|r(pfrB z8MGOz=>!$i3>u+N;YPmXNB^YhI0hKr&a)@HLDw+PSmiw5C5GY=i*))ek2J?KTb(hD z$BHu}4<}jj&x1y@i@(bf9y_H9i;ZCyFN+^B#7$a+y zq6E%rg;Sh03hOv)6;e3s6pu=>))N`Au0EJ$l(~kX(dcva$4O(<)jwnr@7<+%gp$>w z=s9Pzl4)h#t+3aaId!o`w%QbrW3uj5)WX@W(7?H0A&>Kbg4D;8SU|49A%%R-P6es^ zu)`Nay1fr1R?)q%#Q$(iux4FBqgZNea>#o*M$v8J;r&(t$JuX>fyrG?=a+?PVxP zdzlKUoLLIeMz*p*4&JCB2j?ir!MO^upC^id?B@v~P{8>D3VHnn6!H2C*u?8EU^B1t z91tkwERp-qvlL~#Av+mNoU)U_%qjaAsyNFPYB=RM27a2@DioSH<$oC7k3* zP>}w9sUUTXD#&g6or2t^8wzrpzEY6ebW=fY(=7$LO}7<)E|BeO#UBo2yTjKcbgug> zS6=@{k<|4EgsKGYWjeT#oS`tKx5me&6%6WXS!bNGcmw{5?_T_t&K{ zL}T2#AijfRQx#%4-4uUq&=~hd$alv`>%9NMa&^^{u;8%zu>P=n;SS*u;RWG+;Wt;O ztZt96i%5zLjxyV& z>3Y%wOR{rvaB^C5WAfdU$tejb^(p-+KcohxwxwQ9y_YsEt#^adhCLf@r$?nXrC-c& z&PdPrJhL_PbmsM}p{)B^kF)1wo3h)oFK7R}v18-V#s@ipIY~K9IXyXdb4|HDxi|8h z^G5R?=GW#A7I+kd7wjk)D-0~GE*vVf76ljWEc&jf{K=;1O@A(4vUy4AgEEh@6=nTp zH_QH0?p$6}K5R-cwVS$41E$NSn-zf-=8A!eN9Gmg0rR(8{I;B{jIL~`9Ibp@wWO-O z>UOnfb!c^G^>FpW8t Date: Wed, 30 Aug 2023 20:54:49 +0200 Subject: [PATCH 083/117] Fixes #191617 --- .../diffEditorWidget2/movedBlocksLines.ts | 55 +++++++++++++++---- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/src/vs/editor/browser/widget/diffEditorWidget2/movedBlocksLines.ts b/src/vs/editor/browser/widget/diffEditorWidget2/movedBlocksLines.ts index 8a3ac863ddc..8a618685996 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget2/movedBlocksLines.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget2/movedBlocksLines.ts @@ -9,7 +9,7 @@ import { Action } from 'vs/base/common/actions'; import { booleanComparator, compareBy, findMaxIdxBy, numberComparator, tieBreakComparators } from 'vs/base/common/arrays'; import { Codicon } from 'vs/base/common/codicons'; import { Disposable, toDisposable } from 'vs/base/common/lifecycle'; -import { IObservable, autorun, autorunWithStore, constObservable, derived, derivedWithStore, keepAlive, observableFromEvent, observableSignalFromEvent, observableValue } from 'vs/base/common/observable'; +import { IObservable, autorun, autorunHandleChanges, autorunWithStore, constObservable, derived, derivedWithStore, keepAlive, observableFromEvent, observableSignalFromEvent, observableValue } from 'vs/base/common/observable'; import { ThemeIcon } from 'vs/base/common/themables'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { DiffEditorEditors } from 'vs/editor/browser/widget/diffEditorWidget2/diffEditorEditors'; @@ -82,19 +82,50 @@ export class MovedBlocksLinesPart extends Disposable { } })); - this._register(this._editors.original.onDidChangeCursorPosition(e => { - const m = this._diffModel.get(); - if (!m) { return; } - const movedText = m.diff.get()!.movedTexts.find(m => m.lineRangeMapping.original.contains(e.position.lineNumber)); - if (movedText !== m.movedTextToCompare.get()) { - m.movedTextToCompare.set(undefined, undefined); + const originalCursorPosition = observableFromEvent(this._editors.original.onDidChangeCursorPosition, () => this._editors.original.getPosition()); + const modifiedCursorPosition = observableFromEvent(this._editors.modified.onDidChangeCursorPosition, () => this._editors.modified.getPosition()); + const originalHasFocus = observableSignalFromEvent( + 'original.onDidFocusEditorWidget', + e => this._editors.original.onDidFocusEditorWidget(() => setTimeout(() => e(undefined), 0)) + ); + const modifiedHasFocus = observableSignalFromEvent( + 'modified.onDidFocusEditorWidget', + e => this._editors.modified.onDidFocusEditorWidget(() => setTimeout(() => e(undefined), 0)) + ); + + let lastChangedEditor: 'original' | 'modified' = 'modified'; + + this._register(autorunHandleChanges({ + createEmptyChangeSummary: () => undefined, + handleChange: (ctx, summary) => { + if (ctx.didChange(originalHasFocus)) { lastChangedEditor = 'original'; } + if (ctx.didChange(modifiedHasFocus)) { lastChangedEditor = 'modified'; } + return true; } - m.setActiveMovedText(movedText); - })); - this._register(this._editors.modified.onDidChangeCursorPosition(e => { - const m = this._diffModel.get(); + }, reader => { + originalHasFocus.read(reader); + modifiedHasFocus.read(reader); + + const m = this._diffModel.read(reader); if (!m) { return; } - const movedText = m.diff.get()!.movedTexts.find(m => m.lineRangeMapping.modified.contains(e.position.lineNumber)); + const diff = m.diff.read(reader); + + let movedText: MovedText | undefined = undefined; + + if (diff && lastChangedEditor === 'original') { + const originalPos = originalCursorPosition.read(reader); + if (originalPos) { + movedText = diff.movedTexts.find(m => m.lineRangeMapping.original.contains(originalPos.lineNumber)); + } + } + + if (diff && lastChangedEditor === 'modified') { + const modifiedPos = modifiedCursorPosition.read(reader); + if (modifiedPos) { + movedText = diff.movedTexts.find(m => m.lineRangeMapping.modified.contains(modifiedPos.lineNumber)); + } + } + if (movedText !== m.movedTextToCompare.get()) { m.movedTextToCompare.set(undefined, undefined); } From 08631fab3a63e8439bec69dce08aa5cf95360d48 Mon Sep 17 00:00:00 2001 From: songlinn <17741492+songlinn@users.noreply.github.com> Date: Thu, 31 Aug 2023 03:57:58 +0800 Subject: [PATCH 084/117] fix: prevent history show prev/next in composing event (#184014) --- src/vs/platform/history/browser/contextScopedHistoryWidget.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vs/platform/history/browser/contextScopedHistoryWidget.ts b/src/vs/platform/history/browser/contextScopedHistoryWidget.ts index 0278e0c0112..53b9397651d 100644 --- a/src/vs/platform/history/browser/contextScopedHistoryWidget.ts +++ b/src/vs/platform/history/browser/contextScopedHistoryWidget.ts @@ -113,6 +113,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ when: ContextKeyExpr.and( ContextKeyExpr.has(HistoryNavigationWidgetFocusContext), ContextKeyExpr.equals(HistoryNavigationBackwardsEnablementContext, true), + ContextKeyExpr.not('isComposing'), historyNavigationVisible.isEqualTo(false), ), primary: KeyCode.UpArrow, @@ -128,6 +129,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ when: ContextKeyExpr.and( ContextKeyExpr.has(HistoryNavigationWidgetFocusContext), ContextKeyExpr.equals(HistoryNavigationForwardsEnablementContext, true), + ContextKeyExpr.not('isComposing'), historyNavigationVisible.isEqualTo(false), ), primary: KeyCode.DownArrow, From e5851bc5f53b2229d34402fb6c816e82124b00a7 Mon Sep 17 00:00:00 2001 From: Aaron Munger Date: Wed, 30 Aug 2023 14:34:42 -0700 Subject: [PATCH 085/117] look for re-used output id containing the image --- .../browser/controller/cellOutputActions.ts | 2 +- .../contrib/notebook/browser/notebookBrowser.ts | 1 + .../notebook/browser/notebookEditorWidget.ts | 2 +- .../browser/view/renderers/backLayerWebView.ts | 6 ++++-- .../browser/view/renderers/webviewMessages.ts | 2 ++ .../browser/view/renderers/webviewPreloads.ts | 15 ++++++++------- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.ts b/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.ts index 956222d7a36..fa43716b286 100644 --- a/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.ts +++ b/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.ts @@ -55,7 +55,7 @@ registerAction2(class CopyCellOutputAction extends Action2 { const mimeType = outputViewModel.pickedMimeType?.mimeType; if (mimeType?.startsWith('image/')) { - const focusOptions = { skipReveal: true, outputId: outputViewModel.model.outputId }; + const focusOptions = { skipReveal: true, outputId: outputViewModel.model.outputId, altOutputId: outputViewModel.model.alternativeOutputId }; await notebookEditor.focusNotebookCell(outputViewModel.cellViewModel as ICellViewModel, 'output', focusOptions); notebookEditor.copyOutputImage(outputViewModel); } else { diff --git a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts index 4f1d98b86bb..158b98692fe 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts @@ -152,6 +152,7 @@ export interface IFocusNotebookCellOptions { readonly focusEditorLine?: number; readonly minimalScrolling?: boolean; readonly outputId?: string; + readonly altOutputId?: string; } //#endregion diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts index ba8ae7da1db..3830664287b 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts @@ -2350,7 +2350,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD } const focusElementId = options?.outputId ?? cell.id; - this._webview.focusOutput(focusElementId, this._webviewFocused); + this._webview.focusOutput(focusElementId, options?.altOutputId, this._webviewFocused); cell.updateEditState(CellEditState.Preview, 'focusNotebookCell'); cell.focusMode = CellFocusMode.Output; 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 b2359655e6d..aaed4af8425 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts @@ -1548,7 +1548,8 @@ export class BackLayerWebView extends Themable { async copyImage(output: ICellOutputViewModel): Promise { this._sendMessageToWebview({ type: 'copyImage', - outputId: output.model.outputId + outputId: output.model.outputId, + altOutputId: output.model.alternativeOutputId }); } @@ -1608,7 +1609,7 @@ export class BackLayerWebView extends Themable { this.webview?.focus(); } - focusOutput(cellOrOutputId: string, viewFocused: boolean) { + focusOutput(cellOrOutputId: string, backupId: string | undefined, viewFocused: boolean) { if (this._disposed) { return; } @@ -1620,6 +1621,7 @@ export class BackLayerWebView extends Themable { this._sendMessageToWebview({ type: 'focus-output', cellOrOutputId: cellOrOutputId, + backupId: backupId }); } diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewMessages.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewMessages.ts index e74e173ae33..f16d781611a 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewMessages.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewMessages.ts @@ -269,11 +269,13 @@ export interface IShowOutputMessage { export interface ICopyImageMessage { readonly type: 'copyImage'; readonly outputId: string; + readonly altOutputId: string; } export interface IFocusOutputMessage { readonly type: 'focus-output'; readonly cellOrOutputId: string; + readonly backupId?: string; } export interface IAckOutputHeight { diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts index 4715e64aa08..cadaa48312f 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts @@ -474,8 +474,9 @@ async function webviewPreloads(ctx: PreloadContext) { }); }; - function focusFirstFocusableOrContainerInOutput(cellOrOutputId: string) { - const cellOutputContainer = document.getElementById(cellOrOutputId); + function focusFirstFocusableOrContainerInOutput(cellOrOutputId: string, backupId?: string) { + const cellOutputContainer = document.getElementById(cellOrOutputId) ?? + backupId ? document.getElementById(backupId!) : undefined; if (cellOutputContainer) { if (cellOutputContainer.contains(document.activeElement)) { return; @@ -1362,17 +1363,17 @@ async function webviewPreloads(ctx: PreloadContext) { }); }; - const copyOutputImage = async (outputId: string, retries = 5) => { + const copyOutputImage = async (outputId: string, altOutputId: string, retries = 5) => { if (!document.hasFocus() && retries > 0) { // copyImage can be called from outside of the webview, which means this function may be running whilst the webview is gaining focus. // Since navigator.clipboard.write requires the document to be focused, we need to wait for focus. // We cannot use a listener, as there is a high chance the focus is gained during the setup of the listener resulting in us missing it. - setTimeout(() => { copyOutputImage(outputId, retries - 1); }, 20); + setTimeout(() => { copyOutputImage(outputId, altOutputId, retries - 1); }, 20); return; } try { - const image = document.getElementById(outputId)?.querySelector('img'); + const image = document.getElementById(outputId)?.querySelector('img') || document.getElementById(altOutputId)?.querySelector('img'); if (image) { await navigator.clipboard.write([new ClipboardItem({ 'image/png': new Promise((resolve) => { @@ -1501,7 +1502,7 @@ async function webviewPreloads(ctx: PreloadContext) { } case 'copyImage': { - await copyOutputImage(event.data.outputId); + await copyOutputImage(event.data.outputId, event.data.altOutputId); break; } @@ -1524,7 +1525,7 @@ async function webviewPreloads(ctx: PreloadContext) { break; } case 'focus-output': - focusFirstFocusableOrContainerInOutput(event.data.cellOrOutputId); + focusFirstFocusableOrContainerInOutput(event.data.cellOrOutputId, event.data.backupId); break; case 'decorations': { let outputContainer = document.getElementById(event.data.cellId); From 2e4187c15f7fe9b32445f64ccdb800af3bb8f531 Mon Sep 17 00:00:00 2001 From: Aaron Munger Date: Wed, 30 Aug 2023 14:39:22 -0700 Subject: [PATCH 086/117] normalize option name --- .../notebook/browser/view/renderers/backLayerWebView.ts | 4 ++-- .../notebook/browser/view/renderers/webviewMessages.ts | 2 +- .../notebook/browser/view/renderers/webviewPreloads.ts | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) 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 aaed4af8425..b89185074f7 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts @@ -1609,7 +1609,7 @@ export class BackLayerWebView extends Themable { this.webview?.focus(); } - focusOutput(cellOrOutputId: string, backupId: string | undefined, viewFocused: boolean) { + focusOutput(cellOrOutputId: string, alternateId: string | undefined, viewFocused: boolean) { if (this._disposed) { return; } @@ -1621,7 +1621,7 @@ export class BackLayerWebView extends Themable { this._sendMessageToWebview({ type: 'focus-output', cellOrOutputId: cellOrOutputId, - backupId: backupId + alternateId: alternateId }); } diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewMessages.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewMessages.ts index f16d781611a..b46964be307 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewMessages.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewMessages.ts @@ -275,7 +275,7 @@ export interface ICopyImageMessage { export interface IFocusOutputMessage { readonly type: 'focus-output'; readonly cellOrOutputId: string; - readonly backupId?: string; + readonly alternateId?: string; } export interface IAckOutputHeight { diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts index cadaa48312f..ef41ec0d8b4 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts @@ -474,9 +474,9 @@ async function webviewPreloads(ctx: PreloadContext) { }); }; - function focusFirstFocusableOrContainerInOutput(cellOrOutputId: string, backupId?: string) { + function focusFirstFocusableOrContainerInOutput(cellOrOutputId: string, alternateId?: string) { const cellOutputContainer = document.getElementById(cellOrOutputId) ?? - backupId ? document.getElementById(backupId!) : undefined; + alternateId ? document.getElementById(alternateId!) : undefined; if (cellOutputContainer) { if (cellOutputContainer.contains(document.activeElement)) { return; @@ -1525,7 +1525,7 @@ async function webviewPreloads(ctx: PreloadContext) { break; } case 'focus-output': - focusFirstFocusableOrContainerInOutput(event.data.cellOrOutputId, event.data.backupId); + focusFirstFocusableOrContainerInOutput(event.data.cellOrOutputId, event.data.alternateId); break; case 'decorations': { let outputContainer = document.getElementById(event.data.cellId); From 9fbe99c616a42350af45dbb72b6c6bcaadad8a21 Mon Sep 17 00:00:00 2001 From: Aaron Munger Date: Wed, 30 Aug 2023 14:41:03 -0700 Subject: [PATCH 087/117] cleanup --- .../notebook/browser/view/renderers/webviewPreloads.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts index ef41ec0d8b4..5197ae5372d 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts @@ -1373,7 +1373,8 @@ async function webviewPreloads(ctx: PreloadContext) { } try { - const image = document.getElementById(outputId)?.querySelector('img') || document.getElementById(altOutputId)?.querySelector('img'); + const image = document.getElementById(outputId)?.querySelector('img') + ?? document.getElementById(altOutputId)?.querySelector('img'); if (image) { await navigator.clipboard.write([new ClipboardItem({ 'image/png': new Promise((resolve) => { @@ -1501,9 +1502,7 @@ async function webviewPreloads(ctx: PreloadContext) { break; } case 'copyImage': { - await copyOutputImage(event.data.outputId, event.data.altOutputId); - break; } case 'ack-dimension': { From 3217686db153a4bf9ff11a74beb5288c102c41e4 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Wed, 30 Aug 2023 15:12:33 -0700 Subject: [PATCH 088/117] get `x` off the edge (#191849) Fixes https://github.com/microsoft/vscode/issues/191701 --- src/vs/workbench/contrib/chat/browser/media/chat.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/chat/browser/media/chat.css b/src/vs/workbench/contrib/chat/browser/media/chat.css index 5c36c297345..eb1c33b9fa6 100644 --- a/src/vs/workbench/contrib/chat/browser/media/chat.css +++ b/src/vs/workbench/contrib/chat/browser/media/chat.css @@ -238,7 +238,7 @@ .interactive-session .interactive-input-and-side-toolbar { display: flex; - gap: 6px; + gap: 4px; align-items: center; } @@ -427,6 +427,7 @@ .quick-input-widget .interactive-session .interactive-input-and-execute-toolbar { margin: 0; border-radius: 2px; + padding: 0 4px 0 6px; } .quick-input-widget .interactive-list { From d89cac9ac10d1aa4310e827c458f2bea597685ed Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 30 Aug 2023 15:20:02 -0700 Subject: [PATCH 089/117] Partially revert a change that broke dimming in active group Reopens #191608 --- .../browser/unfocusedViewDimmingContribution.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts b/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts index d4c7a06284c..0d9c1bec943 100644 --- a/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts +++ b/src/vs/workbench/contrib/accessibility/browser/unfocusedViewDimmingContribution.ts @@ -45,19 +45,19 @@ export class UnfocusedViewDimmingContribution extends Disposable implements IWor // Terminals rules.add(`.monaco-workbench .pane-body.integrated-terminal .terminal-wrapper:not(:focus-within) { ${filterRule} }`); // Text editors - rules.add(`.monaco-workbench .editor-group-container:not(.active) .monaco-editor { ${filterRule} }`); + rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .monaco-editor { ${filterRule} }`); // Breadcrumbs - rules.add(`.monaco-workbench .editor-group-container:not(.active) .tabs-breadcrumbs { ${filterRule} }`); + rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .tabs-breadcrumbs { ${filterRule} }`); // Terminal editors - rules.add(`.monaco-workbench .editor-group-container:not(.active) .terminal-wrapper { ${filterRule} }`); + rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .terminal-wrapper { ${filterRule} }`); // Settings editor - rules.add(`.monaco-workbench .editor-group-container:not(.active) .settings-editor { ${filterRule} }`); + rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .settings-editor { ${filterRule} }`); // Keybindings editor - rules.add(`.monaco-workbench .editor-group-container:not(.active) .keybindings-editor { ${filterRule} }`); + rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .keybindings-editor { ${filterRule} }`); // Editor placeholder (error case) - rules.add(`.monaco-workbench .editor-group-container:not(.active) .monaco-editor-pane-placeholder { ${filterRule} }`); + rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .monaco-editor-pane-placeholder { ${filterRule} }`); // Welcome editor - rules.add(`.monaco-workbench .editor-group-container:not(.active) .gettingStartedContainer { ${filterRule} }`); + rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .gettingStartedContainer { ${filterRule} }`); cssTextContent = [...rules].join('\n'); } From 8f1af4b86865b421a585e398c53a53726cdd41a6 Mon Sep 17 00:00:00 2001 From: David Dossett Date: Wed, 30 Aug 2023 15:24:03 -0700 Subject: [PATCH 090/117] Show focus state on editor tabs in hc themes (#191850) --- src/vs/workbench/browser/parts/editor/tabsTitleControl.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts index 3272b3e4839..5d5d132b05d 100644 --- a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts +++ b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts @@ -2077,6 +2077,10 @@ registerThemingParticipant((theme, collector) => { outline-offset: -5px; } + .monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active:focus { + outline-style: dashed; + } + .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active { outline: 1px dotted; outline-offset: -5px; From 700bf1a4db0c2b9b557c4ffe19b8b57c2a485f05 Mon Sep 17 00:00:00 2001 From: Joyce Er Date: Wed, 30 Aug 2023 15:29:07 -0700 Subject: [PATCH 091/117] Fix progressive rendering of updated markdown content (#191851) Fix progressive rendering updated markdown content --- src/vs/workbench/contrib/chat/browser/chatListRenderer.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts b/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts index 06f2c24dfb6..8ba6d711809 100644 --- a/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts +++ b/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts @@ -452,9 +452,10 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer Date: Thu, 31 Aug 2023 00:35:53 +0200 Subject: [PATCH 092/117] view descriptor created with containerTitle that is not a string (#191842) --- src/vs/workbench/api/browser/viewsExtensionPoint.ts | 8 ++++---- src/vs/workbench/common/views.ts | 10 ++-------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/api/browser/viewsExtensionPoint.ts b/src/vs/workbench/api/browser/viewsExtensionPoint.ts index 5fc7d5dc63d..f97885e8e02 100644 --- a/src/vs/workbench/api/browser/viewsExtensionPoint.ts +++ b/src/vs/workbench/api/browser/viewsExtensionPoint.ts @@ -18,7 +18,7 @@ import { Extensions as ViewletExtensions, PaneCompositeRegistry } from 'vs/workb import { CustomTreeView, RawCustomTreeViewContextKey, TreeViewPane } from 'vs/workbench/browser/parts/views/treeView'; import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { Extensions as WorkbenchExtensions, IWorkbenchContribution, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions'; -import { Extensions as ViewContainerExtensions, ICustomTreeViewDescriptor, ICustomViewDescriptor, IViewContainersRegistry, IViewDescriptor, IViewsRegistry, ResolvableTreeItem, ViewContainer, ViewContainerLocation } from 'vs/workbench/common/views'; +import { Extensions as ViewContainerExtensions, ICustomViewDescriptor, IViewContainersRegistry, IViewDescriptor, IViewsRegistry, ResolvableTreeItem, ViewContainer, ViewContainerLocation } from 'vs/workbench/common/views'; import { VIEWLET_ID as DEBUG } from 'vs/workbench/contrib/debug/common/debug'; import { VIEWLET_ID as EXPLORER } from 'vs/workbench/contrib/files/common/files'; import { VIEWLET_ID as REMOTE } from 'vs/workbench/contrib/remote/browser/remoteExplorer'; @@ -530,14 +530,14 @@ class ViewsExtensionHandler implements IWorkbenchContribution { } } - const viewDescriptor = { + const viewDescriptor: ICustomViewDescriptor = { type: type, ctorDescriptor: type === ViewType.Tree ? new SyncDescriptor(TreeViewPane) : new SyncDescriptor(WebviewViewPane), id: item.id, name: item.name, when: ContextKeyExpr.deserialize(item.when), containerIcon: icon || viewContainer?.icon, - containerTitle: item.contextualTitle || viewContainer?.title, + containerTitle: item.contextualTitle || (viewContainer && (typeof viewContainer.title === 'string' ? viewContainer.title : viewContainer.title.value)), canToggleVisibility: true, canMoveView: viewContainer?.id !== REMOTE, treeView: type === ViewType.Tree ? this.instantiationService.createInstance(CustomTreeView, item.id, item.name, extension.description.identifier.value) : undefined, @@ -587,7 +587,7 @@ class ViewsExtensionHandler implements IWorkbenchContribution { if (removedViews.length) { this.viewsRegistry.deregisterViews(removedViews, viewContainer); for (const view of removedViews) { - const anyView = view as ICustomTreeViewDescriptor; + const anyView = view as ICustomViewDescriptor; if (anyView.treeView) { anyView.treeView.dispose(); } diff --git a/src/vs/workbench/common/views.ts b/src/vs/workbench/common/views.ts index 95f89542805..07578cb75b6 100644 --- a/src/vs/workbench/common/views.ts +++ b/src/vs/workbench/common/views.ts @@ -300,18 +300,12 @@ export interface IViewDescriptor { readonly openCommandActionDescriptor?: OpenCommandActionDescriptor; } -export interface ICustomTreeViewDescriptor extends ITreeViewDescriptor { +export interface ICustomViewDescriptor extends IViewDescriptor { readonly extensionId: ExtensionIdentifier; readonly originalContainerId: string; + readonly treeView?: ITreeView; } -export interface ICustomWebviewViewDescriptor extends IViewDescriptor { - readonly extensionId: ExtensionIdentifier; - readonly originalContainerId: string; -} - -export type ICustomViewDescriptor = ICustomTreeViewDescriptor | ICustomWebviewViewDescriptor; - export interface IViewDescriptorRef { viewDescriptor: IViewDescriptor; index: number; From e7756c8870ee1df7360e6624e220534174039b02 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Wed, 30 Aug 2023 17:19:18 -0700 Subject: [PATCH 093/117] reinstate `github-auth` parameter that was accidentally removed (#191862) Fixes https://github.com/microsoft/vscode/issues/191861 --- src/vs/code/browser/workbench/workbench.ts | 42 ++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts index 029cf8b10e7..962e2f4c314 100644 --- a/src/vs/code/browser/workbench/workbench.ts +++ b/src/vs/code/browser/workbench/workbench.ts @@ -17,6 +17,7 @@ import product from 'vs/platform/product/common/product'; import { ISecretStorageProvider } from 'vs/platform/secrets/common/secrets'; import { isFolderToOpen, isWorkspaceToOpen } from 'vs/platform/window/common/window'; import type { IWorkbenchConstructionOptions } from 'vs/workbench/browser/web.api'; +import { AuthenticationSessionInfo } from 'vs/workbench/services/authentication/browser/authenticationService'; import type { IWorkspace, IWorkspaceProvider } from 'vs/workbench/services/host/browser/browserHostService'; import type { IURLCallbackProvider } from 'vs/workbench/services/url/browser/urlService'; import { create } from 'vs/workbench/workbench.web.main'; @@ -176,11 +177,13 @@ export class LocalStorageSecretStorageProvider implements ISecretStorageProvider ) { } private async load(): Promise> { + const record = this.loadAuthSessionFromElement(); // Get the secrets from localStorage const encrypted = window.localStorage.getItem(this._storageKey); if (encrypted) { try { - return JSON.parse(await this.crypto.unseal(encrypted)); + const decrypted = JSON.parse(await this.crypto.unseal(encrypted)); + return { ...record, ...decrypted }; } catch (err) { // TODO: send telemetry console.error('Failed to decrypt secrets from localStorage', err); @@ -188,7 +191,42 @@ export class LocalStorageSecretStorageProvider implements ISecretStorageProvider } } - return {}; + return record; + } + + private loadAuthSessionFromElement(): Record { + let authSessionInfo: (AuthenticationSessionInfo & { scopes: string[][] }) | undefined; + const authSessionElement = document.getElementById('vscode-workbench-auth-session'); + const authSessionElementAttribute = authSessionElement ? authSessionElement.getAttribute('data-settings') : undefined; + if (authSessionElementAttribute) { + try { + authSessionInfo = JSON.parse(authSessionElementAttribute); + } catch (error) { /* Invalid session is passed. Ignore. */ } + } + + if (!authSessionInfo) { + return {}; + } + + const record: Record = {}; + + // Settings Sync Entry + record[`${product.urlProtocol}.loginAccount`] = JSON.stringify(authSessionInfo); + + // Auth extension Entry + if (authSessionInfo.providerId !== 'github') { + console.error(`Unexpected auth provider: ${authSessionInfo.providerId}. Expected 'github'.`); + return record; + } + + const authAccount = JSON.stringify({ extensionId: 'vscode.github-authentication', key: 'github.auth' }); + record[authAccount] = JSON.stringify(authSessionInfo.scopes.map(scopes => ({ + id: authSessionInfo!.id, + scopes, + accessToken: authSessionInfo!.accessToken + }))); + + return record; } async get(key: string): Promise { From 9e927a6111882ef550806e06efb82be9b1b55571 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Wed, 30 Aug 2023 22:24:20 -0700 Subject: [PATCH 094/117] After 30s re-layout the quick chat (#191853) fixes https://github.com/microsoft/vscode/issues/191627 --- .../workbench/contrib/chat/browser/chatQuick.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/chat/browser/chatQuick.ts b/src/vs/workbench/contrib/chat/browser/chatQuick.ts index cc32d7adbd3..32592d223ab 100644 --- a/src/vs/workbench/contrib/chat/browser/chatQuick.ts +++ b/src/vs/workbench/contrib/chat/browser/chatQuick.ts @@ -5,9 +5,10 @@ import * as dom from 'vs/base/browser/dom'; import { Orientation, Sash } from 'vs/base/browser/ui/sash/sash'; +import { disposableTimeout } from 'vs/base/common/async'; import { CancellationToken } from 'vs/base/common/cancellation'; import { Emitter } from 'vs/base/common/event'; -import { Disposable, DisposableStore } from 'vs/base/common/lifecycle'; +import { Disposable, DisposableStore, IDisposable, MutableDisposable } from 'vs/base/common/lifecycle'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; @@ -132,6 +133,7 @@ class QuickChat extends Disposable { private sash!: Sash; private model: ChatModel | undefined; private _currentQuery: string | undefined; + private maintainScrollTimer: MutableDisposable = this._register(new MutableDisposable()); constructor( private readonly _options: IChatViewOptions, @@ -168,10 +170,22 @@ class QuickChat extends Disposable { hide(): void { this.widget.setVisible(false); + // Maintain scroll position for a short time so that if the user re-shows the chat + // the same scroll position will be used. + this.maintainScrollTimer.value = disposableTimeout(() => { + // At this point, clear this mutable disposable which will be our signal that + // the timer has expired and we should stop maintaining scroll position + this.maintainScrollTimer.clear(); + }, 30 * 1000); // 30 seconds } show(): void { this.widget.setVisible(true); + // If the mutable disposable is set, then we are keeping the existing scroll position + // so we should not update the layout. + if (!this.maintainScrollTimer.value) { + this.widget.layoutDynamicChatTreeItemMode(); + } } render(parent: HTMLElement): void { From 9293e05e89108972c3c70a9326bd454b2a2ea8d3 Mon Sep 17 00:00:00 2001 From: Karel Frederix Date: Thu, 31 Aug 2023 09:38:24 +0200 Subject: [PATCH 095/117] wrap handler for resize observer in requestAnimationFrame() (#183325) * wrap handler for resize observer in requestAnimationFrame() (fixes #183324) * React immediately on first notification during an animation frame and only delay the second notification during the same animation frame --------- Co-authored-by: Karel Frederix Co-authored-by: Alexandru Dima --- .../browser/config/elementSizeObserver.ts | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/vs/editor/browser/config/elementSizeObserver.ts b/src/vs/editor/browser/config/elementSizeObserver.ts index 3529822e209..f6b344f1872 100644 --- a/src/vs/editor/browser/config/elementSizeObserver.ts +++ b/src/vs/editor/browser/config/elementSizeObserver.ts @@ -41,12 +41,42 @@ export class ElementSizeObserver extends Disposable { public startObserving(): void { if (!this._resizeObserver && this._referenceDomElement) { - this._resizeObserver = new ResizeObserver((entries) => { - if (entries && entries[0] && entries[0].contentRect) { - this.observe({ width: entries[0].contentRect.width, height: entries[0].contentRect.height }); + // We want to react to the resize observer only once per animation frame + // The first time the resize observer fires, we will react to it immediately. + // Otherwise we will postpone to the next animation frame. + // We'll use `observeContentRect` to store the content rect we received. + + let observeContentRect: DOMRectReadOnly | null = null; + const observeNow = () => { + if (observeContentRect) { + this.observe({ width: observeContentRect.width, height: observeContentRect.height }); } else { this.observe(); } + }; + + let shouldObserve = false; + let alreadyObservedThisAnimationFrame = false; + + const update = () => { + if (shouldObserve && !alreadyObservedThisAnimationFrame) { + try { + shouldObserve = false; + alreadyObservedThisAnimationFrame = true; + observeNow(); + } finally { + requestAnimationFrame(() => { + alreadyObservedThisAnimationFrame = false; + update(); + }); + } + } + }; + + this._resizeObserver = new ResizeObserver((entries) => { + observeContentRect = (entries && entries[0] && entries[0].contentRect ? entries[0].contentRect : null); + shouldObserve = true; + update(); }); this._resizeObserver.observe(this._referenceDomElement); } From 6d62f83a762fc9b82e663a2adde684977daade97 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 31 Aug 2023 10:01:25 +0200 Subject: [PATCH 096/117] voice - start to better understand different chat input contexts (#191884) * voice - start to have context and actions per chat kind * voice - add context to `stop` * voice - add todo for focus issue when starting --- .../actions/voiceChatActions.ts | 310 ++++++++++++++---- 1 file changed, 247 insertions(+), 63 deletions(-) diff --git a/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts b/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts index 05e454d36a2..b244992f104 100644 --- a/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts +++ b/src/vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions.ts @@ -17,7 +17,7 @@ import { ContextKeyExpr, IContextKeyService, RawContextKey } from 'vs/platform/c import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { spinningLoading } from 'vs/platform/theme/common/iconRegistry'; import { CHAT_CATEGORY } from 'vs/workbench/contrib/chat/browser/actions/chatActions'; -import { IChatWidgetService, IQuickChatService } from 'vs/workbench/contrib/chat/browser/chat'; +import { IChatWidget, IChatWidgetService, IQuickChatService } from 'vs/workbench/contrib/chat/browser/chat'; import { IChatService } from 'vs/workbench/contrib/chat/common/chatService'; import { IWorkbenchVoiceRecognitionService } from 'vs/workbench/services/voiceRecognition/electron-sandbox/workbenchVoiceRecognitionService'; import { MENU_INLINE_CHAT_WIDGET } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; @@ -34,15 +34,25 @@ import { IChatContributionService } from 'vs/workbench/contrib/chat/common/chatC import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeyCode } from 'vs/base/common/keyCodes'; import { isExecuteActionContext } from 'vs/workbench/contrib/chat/browser/actions/chatExecuteActions'; +import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService'; -const CONTEXT_VOICE_CHAT_GETTING_READY = new RawContextKey('voiceChatGettingReady', false, { type: 'boolean', description: localize('voiceChatGettingReady', "True when getting ready for receiving voice input from the microphone.") }); -const CONTEXT_VOICE_CHAT_IN_PROGRESS = new RawContextKey('voiceChatInProgress', false, { type: 'boolean', description: localize('voiceChatInProgress', "True when voice recording from microphone is in progress.") }); +const CONTEXT_VOICE_CHAT_GETTING_READY = new RawContextKey('voiceChatGettingReady', false, { type: 'boolean', description: localize('voiceChatGettingReady', "True when getting ready for receiving voice input from the microphone for voice chat.") }); +const CONTEXT_VOICE_CHAT_IN_PROGRESS = new RawContextKey('voiceChatInProgress', false, { type: 'boolean', description: localize('voiceChatInProgress', "True when voice recording from microphone is in progress for voice chat.") }); + +const CONTEXT_QUICK_VOICE_CHAT_IN_PROGRESS = new RawContextKey('quickVoiceChatInProgress', false, { type: 'boolean', description: localize('quickVoiceChatInProgress', "True when voice recording from microphone is in progress for quick chat.") }); +const CONTEXT_INLINE_VOICE_CHAT_IN_PROGRESS = new RawContextKey('inlineVoiceChatInProgress', false, { type: 'boolean', description: localize('inlineVoiceChatInProgress', "True when voice recording from microphone is in progress for inline chat.") }); +const CONTEXT_VOICE_CHAT_IN_VIEW_IN_PROGRESS = new RawContextKey('voiceChatInViewInProgress', false, { type: 'boolean', description: localize('voiceChatInViewInProgress', "True when voice recording from microphone is in progress in the chat view.") }); +const CONTEXT_VOICE_CHAT_IN_EDITOR_IN_PROGRESS = new RawContextKey('voiceChatInEditorInProgress', false, { type: 'boolean', description: localize('voiceChatInEditorInProgress', "True when voice recording from microphone is in progress in the chat editor.") }); + +type VoiceChatSessionContext = 'inline' | 'quick' | 'view' | 'editor'; interface IVoiceChatSessionController { readonly onDidAcceptInput: Event; readonly onDidCancelInput: Event; + readonly context: VoiceChatSessionContext; + focusInput(): void; acceptInput(): void; updateInput(text: string): void; @@ -61,6 +71,7 @@ class VoiceChatSessionControllerFactory { const chatContributionService = accessor.get(IChatContributionService); const editorService = accessor.get(IEditorService); const quickChatService = accessor.get(IQuickChatService); + const layoutService = accessor.get(IWorkbenchLayoutService); // Currently Focussed Context if (context === 'focussed') { @@ -70,19 +81,21 @@ class VoiceChatSessionControllerFactory { // https://github.com/microsoft/vscode/issues/191191 const chatInput = chatWidgetService.lastFocusedWidget; if (chatInput?.hasInputFocus()) { - return { - onDidAcceptInput: chatInput.onDidAcceptInput, - onDidCancelInput: Event.any( - // Since we do not know if the view or the quick chat - // is container of the chat input, we need to listen - // to both events here... - Event.filter(viewsService.onDidChangeViewVisibility, e => e.id === chatContributionService.getViewIdForProvider(chatInput.providerId)), - quickChatService.onDidClose - ), - focusInput: () => chatInput.focusInput(), - acceptInput: () => chatInput.acceptInput(), - updateInput: text => chatInput.updateInput(text) - }; + // Unfortunately there does not seem to be a better way + // to figure out if the chat widget is in a part or picker + if ( + layoutService.hasFocus(Parts.SIDEBAR_PART) || + layoutService.hasFocus(Parts.PANEL_PART) || + layoutService.hasFocus(Parts.AUXILIARYBAR_PART) + ) { + return VoiceChatSessionControllerFactory.doCreateForChatView(chatInput, viewsService, chatContributionService); + } + + if (layoutService.hasFocus(Parts.EDITOR_PART)) { + return VoiceChatSessionControllerFactory.doCreateForChatEditor(chatInput, viewsService, chatContributionService); + } + + return VoiceChatSessionControllerFactory.doCreateForQuickChat(chatInput, quickChatService); } // Try with the inline chat @@ -90,13 +103,7 @@ class VoiceChatSessionControllerFactory { if (activeCodeEditor) { const inlineChat = InlineChatController.get(activeCodeEditor); if (inlineChat?.hasFocus()) { - return { - onDidAcceptInput: inlineChat.onDidAcceptInput, - onDidCancelInput: inlineChat.onDidCancelInput, - focusInput: () => inlineChat.focus(), - acceptInput: () => inlineChat.acceptInput(), - updateInput: text => inlineChat.updateInput(text) - }; + return VoiceChatSessionControllerFactory.doCreateForInlineChat(inlineChat); } } } @@ -107,13 +114,7 @@ class VoiceChatSessionControllerFactory { if (provider) { const chatView = await chatWidgetService.revealViewForProvider(provider.id); if (chatView) { - return { - onDidAcceptInput: chatView.onDidAcceptInput, - onDidCancelInput: Event.filter(viewsService.onDidChangeViewVisibility, e => e.id === chatContributionService.getViewIdForProvider(provider.id)), - focusInput: () => chatView.focusInput(), - acceptInput: () => chatView.acceptInput(), - updateInput: text => chatView.updateInput(text) - }; + return VoiceChatSessionControllerFactory.doCreateForChatView(chatView, viewsService, chatContributionService); } } } @@ -124,18 +125,7 @@ class VoiceChatSessionControllerFactory { if (activeCodeEditor) { const inlineChat = InlineChatController.get(activeCodeEditor); if (inlineChat) { - const inlineChatSession = inlineChat.run(); - - return { - onDidAcceptInput: inlineChat.onDidAcceptInput, - onDidCancelInput: Event.any( - inlineChat.onDidCancelInput, - Event.fromPromise(inlineChatSession) - ), - focusInput: () => inlineChat.focus(), - acceptInput: () => inlineChat.acceptInput(), - updateInput: text => inlineChat.updateInput(text) - }; + return VoiceChatSessionControllerFactory.doCreateForInlineChat(inlineChat); } } } @@ -146,18 +136,59 @@ class VoiceChatSessionControllerFactory { const quickChat = chatWidgetService.lastFocusedWidget; if (quickChat) { - return { - onDidAcceptInput: quickChat.onDidAcceptInput, - onDidCancelInput: quickChatService.onDidClose, - focusInput: () => quickChat.focusInput(), - acceptInput: () => quickChat.acceptInput(), - updateInput: text => quickChat.updateInput(text) - }; + return VoiceChatSessionControllerFactory.doCreateForQuickChat(quickChat, quickChatService); } } return undefined; } + + private static doCreateForChatView(chatView: IChatWidget, viewsService: IViewsService, chatContributionService: IChatContributionService): IVoiceChatSessionController { + return VoiceChatSessionControllerFactory.doCreateForChatViewOrEditor('view', chatView, viewsService, chatContributionService); + } + + private static doCreateForChatEditor(chatView: IChatWidget, viewsService: IViewsService, chatContributionService: IChatContributionService): IVoiceChatSessionController { + return VoiceChatSessionControllerFactory.doCreateForChatViewOrEditor('editor', chatView, viewsService, chatContributionService); + } + + private static doCreateForChatViewOrEditor(context: 'view' | 'editor', chatView: IChatWidget, viewsService: IViewsService, chatContributionService: IChatContributionService): IVoiceChatSessionController { + return { + context, + onDidAcceptInput: chatView.onDidAcceptInput, + // TODO@bpasero cancellation needs to work better for chat editors that are not view bound + onDidCancelInput: Event.filter(viewsService.onDidChangeViewVisibility, e => e.id === chatContributionService.getViewIdForProvider(chatView.providerId)), + focusInput: () => chatView.focusInput(), + acceptInput: () => chatView.acceptInput(), + updateInput: text => chatView.updateInput(text) + }; + } + + private static doCreateForQuickChat(quickChat: IChatWidget, quickChatService: IQuickChatService): IVoiceChatSessionController { + return { + context: 'quick', + onDidAcceptInput: quickChat.onDidAcceptInput, + onDidCancelInput: quickChatService.onDidClose, + focusInput: () => quickChat.focusInput(), + acceptInput: () => quickChat.acceptInput(), + updateInput: text => quickChat.updateInput(text) + }; + } + + private static doCreateForInlineChat(inlineChat: InlineChatController,): IVoiceChatSessionController { + const inlineChatSession = inlineChat.run(); + + return { + context: 'inline', + onDidAcceptInput: inlineChat.onDidAcceptInput, + onDidCancelInput: Event.any( + inlineChat.onDidCancelInput, + Event.fromPromise(inlineChatSession) + ), + focusInput: () => inlineChat.focus(), + acceptInput: () => inlineChat.acceptInput(), + updateInput: text => inlineChat.updateInput(text) + }; + } } interface ActiveVoiceChatSession { @@ -179,6 +210,11 @@ class VoiceChatSessions { private voiceChatInProgressKey = CONTEXT_VOICE_CHAT_IN_PROGRESS.bindTo(this.contextKeyService); private voiceChatGettingReadyKey = CONTEXT_VOICE_CHAT_GETTING_READY.bindTo(this.contextKeyService); + private quickVoiceChatInProgressKey = CONTEXT_QUICK_VOICE_CHAT_IN_PROGRESS.bindTo(this.contextKeyService); + private inlineVoiceChatInProgressKey = CONTEXT_INLINE_VOICE_CHAT_IN_PROGRESS.bindTo(this.contextKeyService); + private voiceChatInViewInProgressKey = CONTEXT_VOICE_CHAT_IN_VIEW_IN_PROGRESS.bindTo(this.contextKeyService); + private voiceChatInEditorInProgressKey = CONTEXT_VOICE_CHAT_IN_EDITOR_IN_PROGRESS.bindTo(this.contextKeyService); + private currentVoiceChatSession: ActiveVoiceChatSession | undefined = undefined; private voiceChatSessionIds = 0; @@ -199,8 +235,8 @@ class VoiceChatSessions { const cts = new CancellationTokenSource(); this.currentVoiceChatSession.disposables.add(toDisposable(() => cts.dispose(true))); - this.currentVoiceChatSession.disposables.add(controller.onDidAcceptInput(() => this.stop(voiceChatSessionId))); - this.currentVoiceChatSession.disposables.add(controller.onDidCancelInput(() => this.stop(voiceChatSessionId))); + this.currentVoiceChatSession.disposables.add(controller.onDidAcceptInput(() => this.stop(voiceChatSessionId, controller.context))); + this.currentVoiceChatSession.disposables.add(controller.onDidCancelInput(() => this.stop(voiceChatSessionId, controller.context))); controller.updateInput(''); controller.focusInput(); @@ -208,7 +244,7 @@ class VoiceChatSessions { this.voiceChatGettingReadyKey.set(true); const onDidTranscribe = await this.voiceRecognitionService.transcribe(cts.token, { - onDidCancel: () => this.stop(voiceChatSessionId) + onDidCancel: () => this.stop(voiceChatSessionId, controller.context) }); if (cts.token.isCancellationRequested) { @@ -218,6 +254,21 @@ class VoiceChatSessions { this.voiceChatGettingReadyKey.set(false); this.voiceChatInProgressKey.set(true); + switch (controller.context) { + case 'inline': + this.inlineVoiceChatInProgressKey.set(true); + break; + case 'quick': + this.quickVoiceChatInProgressKey.set(true); + break; + case 'view': + this.voiceChatInViewInProgressKey.set(true); + break; + case 'editor': + this.voiceChatInEditorInProgressKey.set(true); + break; + } + this.registerTranscriptionListener(this.currentVoiceChatSession, onDidTranscribe); } @@ -243,7 +294,6 @@ class VoiceChatSessions { } else { session.controller.updateInput(text); } - } })); } @@ -262,10 +312,11 @@ class VoiceChatSessions { ); } - stop(voiceChatSessionId = this.voiceChatSessionIds): void { + stop(voiceChatSessionId = this.voiceChatSessionIds, context?: VoiceChatSessionContext): void { if ( !this.currentVoiceChatSession || - this.voiceChatSessionIds !== voiceChatSessionId + this.voiceChatSessionIds !== voiceChatSessionId || + (context && this.currentVoiceChatSession.controller.context !== context) ) { return; } @@ -275,6 +326,11 @@ class VoiceChatSessions { this.voiceChatGettingReadyKey.set(false); this.voiceChatInProgressKey.set(false); + + this.quickVoiceChatInProgressKey.set(false); + this.inlineVoiceChatInProgressKey.set(false); + this.voiceChatInViewInProgressKey.set(false); + this.voiceChatInEditorInProgressKey.set(false); } accept(voiceChatSessionId = this.voiceChatSessionIds): void { @@ -381,16 +437,16 @@ class StartVoiceChatAction extends Action2 { value: localize('workbench.action.chat.startVoiceChat', "Start Voice Chat"), original: 'Start Voice Chat' }, - icon: Codicon.record, + icon: Codicon.mic, precondition: CONTEXT_VOICE_CHAT_GETTING_READY.negate(), menu: [{ id: MenuId.ChatExecute, - when: CONTEXT_VOICE_CHAT_IN_PROGRESS.negate(), + when: ContextKeyExpr.and(CONTEXT_VOICE_CHAT_IN_VIEW_IN_PROGRESS.negate(), CONTEXT_QUICK_VOICE_CHAT_IN_PROGRESS.negate(), CONTEXT_VOICE_CHAT_IN_EDITOR_IN_PROGRESS.negate()), group: 'navigation', order: -1 }, { id: MENU_INLINE_CHAT_WIDGET, - when: CONTEXT_VOICE_CHAT_IN_PROGRESS.negate(), + when: CONTEXT_INLINE_VOICE_CHAT_IN_PROGRESS.negate(), group: 'main', order: -1 }] @@ -406,6 +462,9 @@ class StartVoiceChatAction extends Action2 { // from a toolbar within the chat widget, then make sure // to move focus into the input field so that the controller // is properly retrieved + // TODO@bpasero this will actually not work if the button + // is clicked from the inline editor while focus is in a + // chat input field in a view or picker context.widget.focusInput(); } @@ -437,16 +496,136 @@ class StopVoiceChatAction extends Action2 { when: CONTEXT_VOICE_CHAT_IN_PROGRESS, primary: KeyCode.Escape }, - precondition: CONTEXT_VOICE_CHAT_IN_PROGRESS, + precondition: CONTEXT_VOICE_CHAT_IN_PROGRESS + }); + } + + run(accessor: ServicesAccessor): void { + VoiceChatSessions.getInstance(accessor.get(IInstantiationService)).stop(); + } +} + +class StopVoiceChatInChatViewAction extends Action2 { + + static readonly ID = 'workbench.action.chat.stopVoiceChatInChatView'; + + constructor() { + super({ + id: StopVoiceChatInChatViewAction.ID, + title: { + value: localize('workbench.action.chat.stopVoiceChatInChatView.label', "Stop Voice Chat (Chat View)"), + original: 'Stop Voice Chat (Chat View)' + }, + category: CHAT_CATEGORY, + keybinding: { + weight: KeybindingWeight.WorkbenchContrib + 100, + when: CONTEXT_VOICE_CHAT_IN_VIEW_IN_PROGRESS, + primary: KeyCode.Escape + }, + precondition: CONTEXT_VOICE_CHAT_IN_VIEW_IN_PROGRESS, icon: spinningLoading, menu: [{ id: MenuId.ChatExecute, - when: CONTEXT_VOICE_CHAT_IN_PROGRESS, + when: CONTEXT_VOICE_CHAT_IN_VIEW_IN_PROGRESS, group: 'navigation', order: -1 - }, { + }] + }); + } + + run(accessor: ServicesAccessor): void { + VoiceChatSessions.getInstance(accessor.get(IInstantiationService)).stop(undefined, 'view'); + } +} + +class StopVoiceChatInChatEditorAction extends Action2 { + + static readonly ID = 'workbench.action.chat.stopVoiceChatInChatEditor'; + + constructor() { + super({ + id: StopVoiceChatInChatEditorAction.ID, + title: { + value: localize('workbench.action.chat.stopVoiceChatInChatEditor.label', "Stop Voice Chat (Chat Editor)"), + original: 'Stop Voice Chat (Chat Editor)' + }, + category: CHAT_CATEGORY, + keybinding: { + weight: KeybindingWeight.WorkbenchContrib + 100, + when: CONTEXT_VOICE_CHAT_IN_EDITOR_IN_PROGRESS, + primary: KeyCode.Escape + }, + precondition: CONTEXT_VOICE_CHAT_IN_EDITOR_IN_PROGRESS, + icon: spinningLoading, + menu: [{ + id: MenuId.ChatExecute, + when: CONTEXT_VOICE_CHAT_IN_EDITOR_IN_PROGRESS, + group: 'navigation', + order: -1 + }] + }); + } + + run(accessor: ServicesAccessor): void { + VoiceChatSessions.getInstance(accessor.get(IInstantiationService)).stop(undefined, 'editor'); + } +} + +class StopQuickVoiceChatAction extends Action2 { + + static readonly ID = 'workbench.action.chat.stopQuickVoiceChat'; + + constructor() { + super({ + id: StopQuickVoiceChatAction.ID, + title: { + value: localize('workbench.action.chat.stopQuickVoiceChat.label', "Stop Voice Chat (Quick Chat)"), + original: 'Stop Voice Chat (Quick Chat)' + }, + category: CHAT_CATEGORY, + keybinding: { + weight: KeybindingWeight.WorkbenchContrib + 100, + when: CONTEXT_QUICK_VOICE_CHAT_IN_PROGRESS, + primary: KeyCode.Escape + }, + precondition: CONTEXT_QUICK_VOICE_CHAT_IN_PROGRESS, + icon: spinningLoading, + menu: [{ + id: MenuId.ChatExecute, + when: CONTEXT_QUICK_VOICE_CHAT_IN_PROGRESS, + group: 'navigation', + order: -1 + }] + }); + } + + run(accessor: ServicesAccessor): void { + VoiceChatSessions.getInstance(accessor.get(IInstantiationService)).stop(undefined, 'quick'); + } +} + +class StopInlineVoiceChatAction extends Action2 { + + static readonly ID = 'workbench.action.chat.stopInlineVoiceChat'; + + constructor() { + super({ + id: StopInlineVoiceChatAction.ID, + title: { + value: localize('workbench.action.chat.stopInlineVoiceChat.label', "Stop Voice Chat (Inline Editor)"), + original: 'Stop Voice Chat (Inline Editor)' + }, + category: CHAT_CATEGORY, + keybinding: { + weight: KeybindingWeight.WorkbenchContrib + 100, + when: CONTEXT_INLINE_VOICE_CHAT_IN_PROGRESS, + primary: KeyCode.Escape + }, + precondition: CONTEXT_INLINE_VOICE_CHAT_IN_PROGRESS, + icon: spinningLoading, + menu: [{ id: MENU_INLINE_CHAT_WIDGET, - when: CONTEXT_VOICE_CHAT_IN_PROGRESS, + when: CONTEXT_INLINE_VOICE_CHAT_IN_PROGRESS, group: 'main', order: -1 }] @@ -454,7 +633,7 @@ class StopVoiceChatAction extends Action2 { } run(accessor: ServicesAccessor): void { - VoiceChatSessions.getInstance(accessor.get(IInstantiationService)).stop(); + VoiceChatSessions.getInstance(accessor.get(IInstantiationService)).stop(undefined, 'inline'); } } @@ -489,5 +668,10 @@ export function registerVoiceChatActions() { registerAction2(StartVoiceChatAction); registerAction2(StopVoiceChatAction); registerAction2(StopVoiceChatAndSubmitAction); + + registerAction2(StopVoiceChatInChatViewAction); + registerAction2(StopVoiceChatInChatEditorAction); + registerAction2(StopQuickVoiceChatAction); + registerAction2(StopInlineVoiceChatAction); } } From 204d0b30381bfaf3300061c42466bb5f3c0ed1a0 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 31 Aug 2023 10:05:57 +0200 Subject: [PATCH 097/117] window.title setting feedback (fix #191579) (#191885) --- src/vs/workbench/browser/workbench.contribution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/browser/workbench.contribution.ts b/src/vs/workbench/browser/workbench.contribution.ts index e41769f836d..a0aa8d51b7b 100644 --- a/src/vs/workbench/browser/workbench.contribution.ts +++ b/src/vs/workbench/browser/workbench.contribution.ts @@ -533,7 +533,7 @@ const registry = Registry.as(ConfigurationExtensions.Con // Window - let windowTitleDescription = localize('windowTitle', "Controls the window title based on the active editor. Variables are substituted based on the context:"); + let windowTitleDescription = localize('windowTitle', "Controls the window title based on the current context such as the opened workspace or active editor. Variables are substituted based on the context:"); windowTitleDescription += '\n- ' + [ localize('activeEditorShort', "`${activeEditorShort}`: the file name (e.g. myFile.txt)."), localize('activeEditorMedium', "`${activeEditorMedium}`: the path of the file relative to the workspace folder (e.g. myFolder/myFileFolder/myFile.txt)."), From 8800b431813386df04a1cae1b7e592e9462b17d7 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 31 Aug 2023 10:41:37 +0200 Subject: [PATCH 098/117] some Some grid operations cause the `activeElement` to get lost (fix #189256) (#191886) --- src/vs/workbench/browser/parts/editor/editorActions.ts | 3 ++- src/vs/workbench/browser/parts/editor/editorPart.ts | 9 --------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/editorActions.ts b/src/vs/workbench/browser/parts/editor/editorActions.ts index e3e5c11bfa6..149b76d8df9 100644 --- a/src/vs/workbench/browser/parts/editor/editorActions.ts +++ b/src/vs/workbench/browser/parts/editor/editorActions.ts @@ -2264,7 +2264,8 @@ abstract class AbstractCreateEditorGroupAction extends Action2 { override async run(accessor: ServicesAccessor): Promise { const editorGroupService = accessor.get(IEditorGroupsService); - editorGroupService.addGroup(editorGroupService.activeGroup, this.direction, { activate: true }); + const group = editorGroupService.addGroup(editorGroupService.activeGroup, this.direction, { activate: true }); + group.focus(); } } diff --git a/src/vs/workbench/browser/parts/editor/editorPart.ts b/src/vs/workbench/browser/parts/editor/editorPart.ts index 8b733caa867..c424f439a4f 100644 --- a/src/vs/workbench/browser/parts/editor/editorPart.ts +++ b/src/vs/workbench/browser/parts/editor/editorPart.ts @@ -515,21 +515,12 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro addGroup(location: IEditorGroupView | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): IEditorGroupView { const locationView = this.assertGroupView(location); - const restoreFocus = this.shouldRestoreFocus(locationView.element); - const group = this.doAddGroup(locationView, direction); if (options?.activate) { this.doSetGroupActive(group); } - // Restore focus if we had it previously after completing the grid - // operation. That operation might cause reparenting of grid views - // which moves focus to the element otherwise. - if (restoreFocus) { - locationView.focus(); - } - return group; } From 1ebb673280bc69f979e56f1c4be49e79bad73530 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 31 Aug 2023 11:02:57 +0200 Subject: [PATCH 099/117] Linux: Notifications Accessible View only opens when focusing with mouse (fix #191705) (#191888) --- .../parts/notifications/notificationsCommands.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts b/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts index 1f3ec683798..52910366b5f 100644 --- a/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts +++ b/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts @@ -68,9 +68,19 @@ export function getNotificationFromContext(listService: IListService, context?: const list = listService.lastFocusedList; if (list instanceof WorkbenchList) { - const focusedElement = list.getFocusedElements()[0]; - if (isNotificationViewItem(focusedElement)) { - return focusedElement; + let element = list.getFocusedElements()[0]; + if (!isNotificationViewItem(element)) { + if (list.isDOMFocused()) { + // the notification list might have received focus + // via keyboard and might not have a focussed element. + // in that case just return the first element + // https://github.com/microsoft/vscode/issues/191705 + element = list.element(0); + } + } + + if (isNotificationViewItem(element)) { + return element; } } From 07aacd25bbd0463b29e7274b46d2f1510d3ad735 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Thu, 31 Aug 2023 12:22:11 +0200 Subject: [PATCH 100/117] Initialize all services as soon as the first service is needed (#191890) Fixes microsoft/monaco-editor#4120: initialize all services as soon as the first service is needed --- src/vs/editor/standalone/browser/standaloneServices.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vs/editor/standalone/browser/standaloneServices.ts b/src/vs/editor/standalone/browser/standaloneServices.ts index e7297361013..01f2c6987ac 100644 --- a/src/vs/editor/standalone/browser/standaloneServices.ts +++ b/src/vs/editor/standalone/browser/standaloneServices.ts @@ -1114,6 +1114,9 @@ export module StandaloneServices { serviceCollection.set(IInstantiationService, instantiationService); export function get(serviceId: ServiceIdentifier): T { + if (!initialized) { + initialize({}); + } const r = serviceCollection.get(serviceId); if (!r) { throw new Error('Missing service ' + serviceId); From 6b49d155ca9f2547e9e8ddfdb324db47da97411b Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Thu, 31 Aug 2023 12:21:07 +0200 Subject: [PATCH 101/117] Fixes #191892 --- src/vs/editor/common/config/diffEditor.ts | 4 ++-- .../config/editorConfigurationSchema.ts | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/vs/editor/common/config/diffEditor.ts b/src/vs/editor/common/config/diffEditor.ts index 2f2bc06f2d2..2a62c479848 100644 --- a/src/vs/editor/common/config/diffEditor.ts +++ b/src/vs/editor/common/config/diffEditor.ts @@ -5,7 +5,7 @@ import { ValidDiffEditorBaseOptions } from 'vs/editor/common/config/editorOptions'; -export const diffEditorDefaultOptions: ValidDiffEditorBaseOptions = { +export const diffEditorDefaultOptions = { enableSplitViewResizing: true, splitViewDefaultRatio: 0.5, renderSideBySide: true, @@ -34,4 +34,4 @@ export const diffEditorDefaultOptions: ValidDiffEditorBaseOptions = { onlyShowAccessibleDiffViewer: false, renderSideBySideInlineBreakpoint: 900, useInlineViewWhenSpaceIsLimited: true, -}; +} satisfies ValidDiffEditorBaseOptions; diff --git a/src/vs/editor/common/config/editorConfigurationSchema.ts b/src/vs/editor/common/config/editorConfigurationSchema.ts index 845adcd40ac..684ec85c33b 100644 --- a/src/vs/editor/common/config/editorConfigurationSchema.ts +++ b/src/vs/editor/common/config/editorConfigurationSchema.ts @@ -151,53 +151,53 @@ const editorConfiguration: IConfigurationNode = { }, 'diffEditor.maxComputationTime': { type: 'number', - default: 5000, + default: diffEditorDefaultOptions.maxComputationTime, description: nls.localize('maxComputationTime', "Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.") }, 'diffEditor.maxFileSize': { type: 'number', - default: 50, + default: diffEditorDefaultOptions.maxFileSize, description: nls.localize('maxFileSize', "Maximum file size in MB for which to compute diffs. Use 0 for no limit.") }, 'diffEditor.renderSideBySide': { type: 'boolean', - default: true, + default: diffEditorDefaultOptions.renderSideBySide, description: nls.localize('sideBySide', "Controls whether the diff editor shows the diff side by side or inline.") }, 'diffEditor.renderSideBySideInlineBreakpoint': { type: 'number', - default: true, + default: diffEditorDefaultOptions.renderSideBySideInlineBreakpoint, description: nls.localize('renderSideBySideInlineBreakpoint', "If the diff editor width is smaller than this value, the inline view is used.") }, 'diffEditor.useInlineViewWhenSpaceIsLimited': { type: 'boolean', - default: true, + default: diffEditorDefaultOptions.useInlineViewWhenSpaceIsLimited, description: nls.localize('useInlineViewWhenSpaceIsLimited', "If enabled and the editor width is too small, the inline view is used.") }, 'diffEditor.renderMarginRevertIcon': { type: 'boolean', - default: true, + default: diffEditorDefaultOptions.renderMarginRevertIcon, description: nls.localize('renderMarginRevertIcon', "When enabled, the diff editor shows arrows in its glyph margin to revert changes.") }, 'diffEditor.ignoreTrimWhitespace': { type: 'boolean', - default: true, + default: diffEditorDefaultOptions.ignoreTrimWhitespace, description: nls.localize('ignoreTrimWhitespace', "When enabled, the diff editor ignores changes in leading or trailing whitespace.") }, 'diffEditor.renderIndicators': { type: 'boolean', - default: true, + default: diffEditorDefaultOptions.renderIndicators, description: nls.localize('renderIndicators', "Controls whether the diff editor shows +/- indicators for added/removed changes.") }, 'diffEditor.codeLens': { type: 'boolean', - default: false, + default: diffEditorDefaultOptions.diffCodeLens, description: nls.localize('codeLens', "Controls whether the editor shows CodeLens.") }, 'diffEditor.wordWrap': { type: 'string', enum: ['off', 'on', 'inherit'], - default: 'inherit', + default: diffEditorDefaultOptions.diffWordWrap, markdownEnumDescriptions: [ nls.localize('wordWrap.off', "Lines will never wrap."), nls.localize('wordWrap.on', "Lines will wrap at the viewport width."), @@ -239,7 +239,7 @@ const editorConfiguration: IConfigurationNode = { }, 'diffEditor.experimental.showMoves': { type: 'boolean', - default: false, + default: diffEditorDefaultOptions.experimental.showMoves, markdownDescription: nls.localize('showMoves', "Controls whether the diff editor should show detected code moves. Only works when {0} is set.", '`#diffEditor.experimental.useVersion2#`') }, 'diffEditor.experimental.useVersion2': { @@ -250,7 +250,7 @@ const editorConfiguration: IConfigurationNode = { }, 'diffEditor.experimental.showEmptyDecorations': { type: 'boolean', - default: true, + default: diffEditorDefaultOptions.experimental.showEmptyDecorations, description: nls.localize('showEmptyDecorations', "Controls whether the diff editor shows empty decorations to see where characters got inserted or deleted."), } } From a5fabc665be6c92ab5e4537c91347a661f8a4918 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Thu, 31 Aug 2023 07:47:49 -0700 Subject: [PATCH 102/117] fix #186904 --- .../accessibility/browser/textAreaSyncAddon.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts index 9916a6f60d0..c779eef46dc 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts @@ -100,9 +100,9 @@ export class TextAreaSyncAddon extends Disposable implements ITerminalAddon { this._logService.debug(`TextAreaSyncAddon#updateCommandAndCursor: no line`); return; } - if (!!currentCommand.commandStartX) { - this._currentCommand = commandLine.substring(currentCommand.commandStartX); - this._cursorX = buffer.cursorX - currentCommand.commandStartX; + if (!!currentCommand) { + this._currentCommand = commandLine.substring(currentCommand.commandStartX ?? 0); + this._cursorX = buffer.cursorX - (currentCommand.commandStartX ?? 0); } else { this._currentCommand = undefined; this._cursorX = undefined; From 9637c47fdc5498a5206470ea36e28977bf271f56 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Thu, 31 Aug 2023 08:03:54 -0700 Subject: [PATCH 103/117] check if mac --- .../accessibility/browser/textAreaSyncAddon.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts index c779eef46dc..5c6d8579ac3 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts @@ -10,6 +10,7 @@ import { ITerminalLogService } from 'vs/platform/terminal/common/terminal'; import type { Terminal, ITerminalAddon } from 'xterm'; import { debounce } from 'vs/base/common/decorators'; import { addDisposableListener } from 'vs/base/browser/dom'; +import { isMacintosh } from 'vs/base/common/platform'; export interface ITextAreaData { content: string; @@ -100,9 +101,10 @@ export class TextAreaSyncAddon extends Disposable implements ITerminalAddon { this._logService.debug(`TextAreaSyncAddon#updateCommandAndCursor: no line`); return; } - if (!!currentCommand) { - this._currentCommand = commandLine.substring(currentCommand.commandStartX ?? 0); - this._cursorX = buffer.cursorX - (currentCommand.commandStartX ?? 0); + const startX = isMacintosh ? currentCommand.commandStartX : 0; + if (!!currentCommand && !!startX) { + this._currentCommand = commandLine.substring(startX); + this._cursorX = buffer.cursorX - startX; } else { this._currentCommand = undefined; this._cursorX = undefined; From 414606b665b564d5ea4cce008531c7b23555bdd0 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Thu, 31 Aug 2023 17:30:16 +0200 Subject: [PATCH 104/117] Don't throw if view doesn't exist when visibility false (#191781) --- src/vs/workbench/api/common/extHostTreeViews.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vs/workbench/api/common/extHostTreeViews.ts b/src/vs/workbench/api/common/extHostTreeViews.ts index 3f33b7d7b62..844b0b63eae 100644 --- a/src/vs/workbench/api/common/extHostTreeViews.ts +++ b/src/vs/workbench/api/common/extHostTreeViews.ts @@ -246,6 +246,9 @@ export class ExtHostTreeViews implements ExtHostTreeViewsShape { $setVisible(treeViewId: string, isVisible: boolean): void { const treeView = this.treeViews.get(treeViewId); if (!treeView) { + if (!isVisible) { + return; + } throw new NoTreeViewError(treeViewId); } treeView.setVisible(isVisible); From 68a8e14d305982c6468019082454681a1bd76c76 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Thu, 31 Aug 2023 08:43:49 -0700 Subject: [PATCH 105/117] fix issue --- .../accessibility/browser/textAreaSyncAddon.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts index 5c6d8579ac3..8e6e18b28e5 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts @@ -101,8 +101,8 @@ export class TextAreaSyncAddon extends Disposable implements ITerminalAddon { this._logService.debug(`TextAreaSyncAddon#updateCommandAndCursor: no line`); return; } - const startX = isMacintosh ? currentCommand.commandStartX : 0; - if (!!currentCommand && !!startX) { + const startX = isMacintosh || currentCommand.commandStartX !== undefined ? currentCommand.commandStartX : 0; + if (!!currentCommand && startX !== undefined) { this._currentCommand = commandLine.substring(startX); this._cursorX = buffer.cursorX - startX; } else { From 6ca26d992b6de880cae1e5eb975ce88582260caa Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Thu, 31 Aug 2023 09:08:40 -0700 Subject: [PATCH 106/117] different udf check --- .../accessibility/browser/textAreaSyncAddon.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts index 8e6e18b28e5..b5e800a788d 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts @@ -10,7 +10,6 @@ import { ITerminalLogService } from 'vs/platform/terminal/common/terminal'; import type { Terminal, ITerminalAddon } from 'xterm'; import { debounce } from 'vs/base/common/decorators'; import { addDisposableListener } from 'vs/base/browser/dom'; -import { isMacintosh } from 'vs/base/common/platform'; export interface ITextAreaData { content: string; @@ -101,10 +100,9 @@ export class TextAreaSyncAddon extends Disposable implements ITerminalAddon { this._logService.debug(`TextAreaSyncAddon#updateCommandAndCursor: no line`); return; } - const startX = isMacintosh || currentCommand.commandStartX !== undefined ? currentCommand.commandStartX : 0; - if (!!currentCommand && startX !== undefined) { - this._currentCommand = commandLine.substring(startX); - this._cursorX = buffer.cursorX - startX; + if (currentCommand?.commandStartX !== undefined) { + this._currentCommand = commandLine.substring(currentCommand.commandStartX); + this._cursorX = buffer.cursorX - currentCommand.commandStartX; } else { this._currentCommand = undefined; this._cursorX = undefined; From a3d842ed4d190fbcf30d2c76460379cd8bab8b50 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Thu, 31 Aug 2023 09:29:53 -0700 Subject: [PATCH 107/117] Update src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com> --- .../terminalContrib/accessibility/browser/textAreaSyncAddon.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts index b5e800a788d..33d4b52e956 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts @@ -100,7 +100,7 @@ export class TextAreaSyncAddon extends Disposable implements ITerminalAddon { this._logService.debug(`TextAreaSyncAddon#updateCommandAndCursor: no line`); return; } - if (currentCommand?.commandStartX !== undefined) { + if (currentCommand.commandStartX !== undefined) { this._currentCommand = commandLine.substring(currentCommand.commandStartX); this._cursorX = buffer.cursorX - currentCommand.commandStartX; } else { From eec2fc723c952f18c7ca0005c2bcf8840c819d38 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Thu, 31 Aug 2023 13:10:26 -0700 Subject: [PATCH 108/117] Disable Local Server flow for REH (#191930) Because spinning up ports on the remote won't always work. Instead, we have the trusty device code flow. Fixes https://github.com/microsoft/vscode/issues/191866 Fixes https://github.com/microsoft/vscode/issues/191867 --- extensions/github-authentication/src/flows.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/github-authentication/src/flows.ts b/extensions/github-authentication/src/flows.ts index 5bc9d095385..1e988d92d30 100644 --- a/extensions/github-authentication/src/flows.ts +++ b/extensions/github-authentication/src/flows.ts @@ -200,7 +200,9 @@ const allFlows: IFlow[] = [ // other flows that work well. supportsGitHubEnterpriseServer: false, supportsHostedGitHubEnterprise: true, - supportsRemoteExtensionHost: true, + // Opening a port on the remote side can't be open in the browser on + // the client side so this flow won't work in remote extension hosts + supportsRemoteExtensionHost: false, // Web worker can't open a port to listen for the redirect supportsWebWorkerExtensionHost: false, // exchanging a code for a token requires a client secret From 065d4c1e23b278e2a277e80b23c07627b0efa4eb Mon Sep 17 00:00:00 2001 From: Bhavya U Date: Thu, 31 Aug 2023 14:28:15 -0700 Subject: [PATCH 109/117] Do not show parent checkbox contents for ai generated workspaces (#191933) --- .../contrib/workspace/browser/workspace.contribution.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/contrib/workspace/browser/workspace.contribution.ts b/src/vs/workbench/contrib/workspace/browser/workspace.contribution.ts index 077b248bc0f..864a19e1ce4 100644 --- a/src/vs/workbench/contrib/workspace/browser/workspace.contribution.ts +++ b/src/vs/workbench/contrib/workspace/browser/workspace.contribution.ts @@ -311,13 +311,12 @@ export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchCon this._register(this.workspaceTrustRequestService.onDidInitiateWorkspaceTrustRequestOnStartup(async () => { let titleString: string | undefined; - let checkboxString: string | undefined; let learnMoreString: string | undefined; let trustOption: string | undefined; let dontTrustOption: string | undefined; - if (await this.isAiGeneratedWorkspace() && this.productService.aiGeneratedWorkspaceTrust) { + const isAiGeneratedWorkspace = await this.isAiGeneratedWorkspace(); + if (isAiGeneratedWorkspace && this.productService.aiGeneratedWorkspaceTrust) { titleString = this.productService.aiGeneratedWorkspaceTrust.title; - checkboxString = this.productService.aiGeneratedWorkspaceTrust.checkboxText; learnMoreString = this.productService.aiGeneratedWorkspaceTrust.startupTrustRequestLearnMore; trustOption = this.productService.aiGeneratedWorkspaceTrust.trustOption; dontTrustOption = this.productService.aiGeneratedWorkspaceTrust.dontTrustOption; @@ -333,9 +332,9 @@ export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchCon const workspaceIdentifier = toWorkspaceIdentifier(this.workspaceContextService.getWorkspace()); const isSingleFolderWorkspace = isSingleFolderWorkspaceIdentifier(workspaceIdentifier); const isEmptyWindow = isEmptyWorkspaceIdentifier(workspaceIdentifier); - if (this.workspaceTrustManagementService.canSetParentFolderTrust()) { + if (!isAiGeneratedWorkspace && this.workspaceTrustManagementService.canSetParentFolderTrust()) { const name = basename(uriDirname((workspaceIdentifier as ISingleFolderWorkspaceIdentifier).uri)); - checkboxText = checkboxString ?? localize('checkboxString', "Trust the authors of all files in the parent folder '{0}'", name); + checkboxText = localize('checkboxString', "Trust the authors of all files in the parent folder '{0}'", name); } // Show Workspace Trust Start Dialog From 79277e0b8f045483a49f8a6834d476410c0d3cba Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Thu, 31 Aug 2023 14:34:22 -0700 Subject: [PATCH 110/117] Skip flakey smoke test (#191936) * Skip flakey smoke test ref https://github.com/microsoft/vscode/issues/191860 * skip at describe since there's only 1 test --- test/smoke/src/areas/extensions/extensions.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/smoke/src/areas/extensions/extensions.test.ts b/test/smoke/src/areas/extensions/extensions.test.ts index 7a4875bcd7f..a8120cb12bf 100644 --- a/test/smoke/src/areas/extensions/extensions.test.ts +++ b/test/smoke/src/areas/extensions/extensions.test.ts @@ -7,7 +7,7 @@ import { Application, Logger } from '../../../../automation'; import { installAllHandlers } from '../../utils'; export function setup(logger: Logger) { - describe('Extensions', () => { + describe.skip('Extensions', () => { // Shared before/after handling installAllHandlers(logger); From 4c6dbcf90f338caae79babdf8d48e6524a86fbe7 Mon Sep 17 00:00:00 2001 From: Bhavya U Date: Thu, 31 Aug 2023 15:28:39 -0700 Subject: [PATCH 111/117] Add check to see if resource has file extension before setting FILE | FOLDER (#191923) * Set resource as FILE only if children are undefined * Add check to see if resource has extension before setting FileKind --- src/vs/workbench/contrib/chat/browser/chatListRenderer.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts b/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts index 8ba6d711809..4bfefbd3af3 100644 --- a/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts +++ b/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts @@ -1200,7 +1200,8 @@ class ChatListTreeRenderer implements ICompressibleTreeRenderer, index: number, templateData: IChatListTreeRendererTemplate, height: number | undefined): void { templateData.label.element.style.display = 'flex'; - if (!element.children.length) { + const hasExtension = /\.[^/.]+$/.test(element.element.label); + if (!element.children.length && hasExtension) { templateData.label.setFile(element.element.uri, { fileKind: FileKind.FILE, hidePath: true, From 8f33e459f6af6c408655a1875c3475e71f45993f Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Thu, 31 Aug 2023 15:51:04 -0700 Subject: [PATCH 112/117] Only update layout when chat is visible (#191943) Fixes https://github.com/microsoft/vscode/issues/191942 --- src/vs/workbench/contrib/chat/browser/chatQuick.ts | 14 +++++++++++++- .../workbench/contrib/chat/browser/chatWidget.ts | 11 +++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/chatQuick.ts b/src/vs/workbench/contrib/chat/browser/chatQuick.ts index 32592d223ab..5c41a1a6f7e 100644 --- a/src/vs/workbench/contrib/chat/browser/chatQuick.ts +++ b/src/vs/workbench/contrib/chat/browser/chatQuick.ts @@ -134,6 +134,7 @@ class QuickChat extends Disposable { private model: ChatModel | undefined; private _currentQuery: string | undefined; private maintainScrollTimer: MutableDisposable = this._register(new MutableDisposable()); + private _deferUpdatingDynamicLayout: boolean = false; constructor( private readonly _options: IChatViewOptions, @@ -183,6 +184,10 @@ class QuickChat extends Disposable { this.widget.setVisible(true); // If the mutable disposable is set, then we are keeping the existing scroll position // so we should not update the layout. + if (this._deferUpdatingDynamicLayout) { + this._deferUpdatingDynamicLayout = false; + this.widget.updateDynamicChatTreeItemLayout(2, this.maxHeight); + } if (!this.maintainScrollTimer.value) { this.widget.layoutDynamicChatTreeItemMode(); } @@ -222,7 +227,14 @@ class QuickChat extends Disposable { private registerListeners(parent: HTMLElement): void { this._register(this.layoutService.onDidLayout(() => { - this.widget.updateDynamicChatTreeItemLayout(2, this.maxHeight); + if (this.widget.visible) { + this.widget.updateDynamicChatTreeItemLayout(2, this.maxHeight); + } else { + // If the chat is not visible, then we should defer updating the layout + // because it relies on offsetHeight which only works correctly + // when the chat is visible. + this._deferUpdatingDynamicLayout = true; + } })); this._register(this.widget.inputEditor.onDidChangeModelContent((e) => { this._currentQuery = this.widget.inputEditor.getValue(); diff --git a/src/vs/workbench/contrib/chat/browser/chatWidget.ts b/src/vs/workbench/contrib/chat/browser/chatWidget.ts index b37163a9990..91c15635f2e 100644 --- a/src/vs/workbench/contrib/chat/browser/chatWidget.ts +++ b/src/vs/workbench/contrib/chat/browser/chatWidget.ts @@ -77,9 +77,12 @@ export class ChatWidget extends Disposable implements IChatWidget { private container!: HTMLElement; private bodyDimension: dom.Dimension | undefined; - private visible = false; private visibleChangeCount = 0; private requestInProgress: IContextKey; + private _visible = false; + public get visible() { + return this._visible; + } private previousTreeScrollHeight: number = 0; @@ -214,7 +217,7 @@ export class ChatWidget extends Disposable implements IChatWidget { } private onDidChangeItems(skipDynamicLayout?: boolean) { - if (this.tree && this.visible) { + if (this.tree && this._visible) { const treeItems = (this.viewModel?.getItems() ?? []) .map(item => { return >{ @@ -261,7 +264,7 @@ export class ChatWidget extends Disposable implements IChatWidget { } setVisible(visible: boolean): void { - this.visible = visible; + this._visible = visible; this.visibleChangeCount++; this.renderer.setVisible(visible); @@ -269,7 +272,7 @@ export class ChatWidget extends Disposable implements IChatWidget { this._register(disposableTimeout(() => { // Progressive rendering paused while hidden, so start it up again. // Do it after a timeout because the container is not visible yet (it should be but offsetHeight returns 0 here) - if (this.visible) { + if (this._visible) { this.onDidChangeItems(true); } }, 0)); From ee08fd53cc990f4e8abaabf6e8014b3208128771 Mon Sep 17 00:00:00 2001 From: Joyce Er Date: Thu, 31 Aug 2023 15:52:13 -0700 Subject: [PATCH 113/117] Don't show chat widget context menu for filetree (#191940) --- src/vs/workbench/contrib/chat/browser/chatListRenderer.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts b/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts index 4bfefbd3af3..ebb17cc541f 100644 --- a/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts +++ b/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts @@ -539,6 +539,10 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer { this._onDidChangeItemHeight.fire({ element, height: templateData.rowContainer.offsetHeight }); })); + treeDisposables.add(tree.onContextMenu((e) => { + e.browserEvent.preventDefault(); + e.browserEvent.stopPropagation(); + })); tree.setInput(data).then(() => { if (!ref.isStale()) { From dd112ec0243c4b42bb3106e64df1688e242a6559 Mon Sep 17 00:00:00 2001 From: Bhavya U Date: Thu, 31 Aug 2023 16:37:56 -0700 Subject: [PATCH 114/117] Open walkthrough if a gettingStarted page is found (#191947) --- .../browser/gettingStarted.contribution.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts index a6da647dbcc..1e57d47d68a 100644 --- a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts +++ b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts @@ -66,10 +66,8 @@ registerAction2(class extends Action2 { // Try first to select the walkthrough on an active welcome page with no selected walkthrough for (const group of editorGroupsService.groups) { if (group.activeEditor instanceof GettingStartedInput) { - if (!group.activeEditor.selectedCategory) { - (group.activeEditorPane as GettingStartedPage).makeCategoryVisibleWhenAvailable(selectedCategory, selectedStep); - return; - } + (group.activeEditorPane as GettingStartedPage).makeCategoryVisibleWhenAvailable(selectedCategory, selectedStep); + return; } } @@ -106,7 +104,10 @@ registerAction2(class extends Action2 { editorService.openEditor({ resource: GettingStartedInput.RESOURCE, options: { selectedCategory: selectedCategory, selectedStep: selectedStep, preserveFocus: toSide ?? false } + }).then((editor) => { + (editor as GettingStartedPage)?.makeCategoryVisibleWhenAvailable(selectedCategory, selectedStep); }); + } } else { editorService.openEditor({ resource: GettingStartedInput.RESOURCE }); From 5f7b620db8ec603453798554a6596a7ad608fb3e Mon Sep 17 00:00:00 2001 From: Robo Date: Fri, 1 Sep 2023 15:32:05 +0900 Subject: [PATCH 115/117] chore: bump electron@25.8.0 (#191905) * chore: bump electron@25.8.0 * chore: update internal build id * chore: bump distro --- .yarnrc | 4 +-- build/checksums/electron.txt | 54 ++++++++++++++++++------------------ cgmanifest.json | 4 +-- package.json | 4 +-- yarn.lock | 8 +++--- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/.yarnrc b/.yarnrc index 7b3fff4b526..fff0be195f2 100644 --- a/.yarnrc +++ b/.yarnrc @@ -1,5 +1,5 @@ disturl "https://electronjs.org/headers" -target "25.7.0" -ms_build_id "23434598" +target "25.8.0" +ms_build_id "23503258" runtime "electron" build_from_source "true" diff --git a/build/checksums/electron.txt b/build/checksums/electron.txt index a19497f08e8..9c46b2ad8ef 100644 --- a/build/checksums/electron.txt +++ b/build/checksums/electron.txt @@ -1,27 +1,27 @@ -efbcf77eb1a0783766f9579ffb9f9b68f04fea8cb091eab7ab8484ba0cd13fbf *electron-v25.7.0-darwin-arm64-symbols.zip -76a415165d212a345a5689de83078adc715fc10562bfaa35d7323094780ba683 *electron-v25.7.0-darwin-arm64.zip -07b9049848e877019d1dce71e06713125b605dda8ac5d0b8ab3aa899cf40551d *electron-v25.7.0-darwin-x64-symbols.zip -dea726ae9adc1c36206ce8d20ce32f630bcd684b869e0cb302f97c8bd26616d6 *electron-v25.7.0-darwin-x64.zip -b6c8ba123353984b2d3ffd6ccd52aec2d3238f71611c4c94bab75aa92804eebf *electron-v25.7.0-linux-arm64-symbols.zip -19e1e2c7ea1ab024f069e3dad6a26605e14b2c605e134484196343118fccf925 *electron-v25.7.0-linux-arm64.zip -ba0bbe84ea626c8064809c66487a3b77ad39bcf8b1daa0d9421428f78ad4d665 *electron-v25.7.0-linux-armv7l-symbols.zip -832a68cddb20eb847aca982b89f89e145f50dd483c71c8a705bbb9248fb7c665 *electron-v25.7.0-linux-armv7l.zip -2e616b446112533d3aa69ed1074ab1e0be5400996129aa636273d01462dc9506 *electron-v25.7.0-linux-x64-symbols.zip -002641e8103b77060e23b9c77c51ffb942372d01306210cdc3d32fc6ae5d112b *electron-v25.7.0-linux-x64.zip -162e0f7ca9fc1c17b8d84e9b9eccc65bb0f527a67f6339a19292d798085848e4 *electron-v25.7.0-win32-arm64-pdb.zip -7d98734ffcf10e1d002c30a212dd1f203b1418a295da67410490f83e9ced388c *electron-v25.7.0-win32-arm64-symbols.zip -9777d47f74d129f7c68ebffad640a6a527b83895c173c7d344f80fc9588bad85 *electron-v25.7.0-win32-arm64.zip -c805c6356378dccb21b5725004934534e187bdaf8149a6a457fdd60d243b41e4 *electron-v25.7.0-win32-ia32-pdb.zip -5f1a3b09153cf934f24f3b1853ad1788e7c27c6ddceb80e52fe07e2e69b6bb2b *electron-v25.7.0-win32-ia32-symbols.zip -fdf8e100c3d3cdb75b54ced1ecae96d6206eca08ebb07c5d8f08740e5e703509 *electron-v25.7.0-win32-ia32.zip -aa56314a675351e9457355f2cb0660c62a3be62cc340dad76fd216741064824d *electron-v25.7.0-win32-x64-pdb.zip -25d664dfe0823e1a12269feb6eb3886dba44b2d130b8787c4d58d3d0cbcf1c22 *electron-v25.7.0-win32-x64-symbols.zip -7ddb0b38207fd837cdf4e2b2778c365751315e321b09d346c8bb8476300d0ec0 *electron-v25.7.0-win32-x64.zip -02619733aadb13b6bf21df966e04775506d0d7595a0795003fed45631c4a0af6 *ffmpeg-v25.7.0-darwin-arm64.zip -69a8e2021e48f504021913c15633cbef2b4a7b28656c51cd238acdbf7c94e358 *ffmpeg-v25.7.0-darwin-x64.zip -bd52d57ff97fb56ac01a3482af905d04f0d4e9c13c53858c6d9f99957eca82da *ffmpeg-v25.7.0-linux-arm64.zip -9b3d09177fa1e63e2a6beecfa70aeec30aeb5c1873ff21128a68051c4e23f95d *ffmpeg-v25.7.0-linux-armv7l.zip -edc7b1c9f1a0733f109a2c0375a4e40c5bfe0bf28b7f06dcc76e1ada0aa2f125 *ffmpeg-v25.7.0-linux-x64.zip -7076d4593f2e2e2abf0dc9ad8f6490d72b2fa89710def822f39da4363e49e504 *ffmpeg-v25.7.0-win32-arm64.zip -bd07183c1b6a93586d73c4106ceef0faae77f46763d15d6901d5954c2c5bba1b *ffmpeg-v25.7.0-win32-ia32.zip -b056e71a7c59441c551d5bbc1a8d99f2464a5809a3ba17d41540dc7174cab7b7 *ffmpeg-v25.7.0-win32-x64.zip +88cafda8394985e59d3d84cb4a6692ad04d8e32db9ecd6429e748e41526ddad7 *electron-v25.8.0-darwin-arm64-symbols.zip +6e33d3b8041561722ed41777e055a8c15d3f4e61b67367b2618918bcf0cfea76 *electron-v25.8.0-darwin-arm64.zip +438ac9915e062a239fb6d2595323c4783d2c820efc9cbcf3d2c1253d0e057e83 *electron-v25.8.0-darwin-x64-symbols.zip +798907d2a66bc79202c8213c61e7fd147ae2a8c31c485d814950b11d43bbbba8 *electron-v25.8.0-darwin-x64.zip +3243f3764319cff6c942d9f90a86323c36ec05ec51ef01e782c4e9a7194187e1 *electron-v25.8.0-linux-arm64-symbols.zip +f24f858b76bf8a2e18419f62e0f891712b2fa541089123e9caa8d5cd67fc3276 *electron-v25.8.0-linux-arm64.zip +dc3ff0489a0ebeda56d06b31eeae75dd7321a52bb601069c4475c56462b4814a *electron-v25.8.0-linux-armv7l-symbols.zip +3b7a0c3899f828a5cf30043b73992e90231400b90c1afa700a44f892a55e326b *electron-v25.8.0-linux-armv7l.zip +44803b2487406eca8fff9cec405e9e50bd92a911808dfaaa523b9ef52a0e72d8 *electron-v25.8.0-linux-x64-symbols.zip +d54fb2df0ad7318240220aa26327171ed1e891fb296f3c27c58b8b487c4df8eb *electron-v25.8.0-linux-x64.zip +bf7be6c0c8d0df06f0ce22e16c97aea823415d7f5cbf0ffdadf65d75feaf3cd8 *electron-v25.8.0-win32-arm64-pdb.zip +5d91757660b44bf30907f9c2b52225ade4d127d0fe48dc83dec134cc06c949f0 *electron-v25.8.0-win32-arm64-symbols.zip +d1e6f30a8d8c7aed28d08ddf915d79de6b16b3a0a7c84c45fd3cc0d47f2b7f53 *electron-v25.8.0-win32-arm64.zip +e389fef61c14ea0eefad91a9725aa0afd4dbdc982f7b30aba97bd9c2871c2061 *electron-v25.8.0-win32-ia32-pdb.zip +374d6c8897f97fab04e990ecf928e05f643ae33801546bf7d39bf4045b9d8b52 *electron-v25.8.0-win32-ia32-symbols.zip +73fc3382202b70dcaf7928f09a791662de82c701b8f403ed72cc5aa9b1401593 *electron-v25.8.0-win32-ia32.zip +010d248bd2e77585e1fa977e58b016659566de5a91c1e6845c85a7e6e1851bb9 *electron-v25.8.0-win32-x64-pdb.zip +72adb74fd92edff35c177c3c5d96765f230bc7adb8af11b30d5122b9e54c26e1 *electron-v25.8.0-win32-x64-symbols.zip +0051d0f241aedc6cdab4751c60f48758936122796f06c9e3033c7710a531686c *electron-v25.8.0-win32-x64.zip +2956915642c45eb0099228368d0af50e891e4c10014fa4d3d3bcfb135fbb89a7 *ffmpeg-v25.8.0-darwin-arm64.zip +099ee69d44f8ac3802cdd612895f279f7adb043a5b9c9d123479b0f96514a44c *ffmpeg-v25.8.0-darwin-x64.zip +bd52d57ff97fb56ac01a3482af905d04f0d4e9c13c53858c6d9f99957eca82da *ffmpeg-v25.8.0-linux-arm64.zip +9b3d09177fa1e63e2a6beecfa70aeec30aeb5c1873ff21128a68051c4e23f95d *ffmpeg-v25.8.0-linux-armv7l.zip +edc7b1c9f1a0733f109a2c0375a4e40c5bfe0bf28b7f06dcc76e1ada0aa2f125 *ffmpeg-v25.8.0-linux-x64.zip +a58e9480dab981ff973749e9d1e08936b2dd63a4b7f9523c030b1833387a4eb5 *ffmpeg-v25.8.0-win32-arm64.zip +6866b23a4d561c0322aeb7690aae646718c54398739946e352bf80d0dd721bfd *ffmpeg-v25.8.0-win32-ia32.zip +7b906df4ad6252881cf1e58619285b624f74d593379fbc6728e238b852d6abad *ffmpeg-v25.8.0-win32-x64.zip diff --git a/cgmanifest.json b/cgmanifest.json index df2f75f3209..6b2d2bfff44 100644 --- a/cgmanifest.json +++ b/cgmanifest.json @@ -528,12 +528,12 @@ "git": { "name": "electron", "repositoryUrl": "https://github.com/electron/electron", - "commitHash": "f818ec3295c9688585e3cfea532ccc5b705746bb" + "commitHash": "84d7f7f071ae11637d4a41b95536410293672750" } }, "isOnlyProductionDependency": true, "license": "MIT", - "version": "25.7.0" + "version": "25.8.0" }, { "component": { diff --git a/package.json b/package.json index 1a58592be0a..997a4931166 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.82.0", - "distro": "021e674d5265eb9125cfc0282c3a9a6091f4982d", + "distro": "0a5805caff2d59440704a3bf75eebaa509be862f", "author": { "name": "Microsoft Corporation" }, @@ -150,7 +150,7 @@ "cssnano": "^4.1.11", "debounce": "^1.0.0", "deemon": "^1.8.0", - "electron": "25.7.0", + "electron": "25.8.0", "eslint": "8.36.0", "eslint-plugin-header": "3.1.1", "eslint-plugin-jsdoc": "^39.3.2", diff --git a/yarn.lock b/yarn.lock index e171d0e0f55..aac325ba08f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3587,10 +3587,10 @@ electron-to-chromium@^1.4.202: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.207.tgz#9c3310ebace2952903d05dcaba8abe3a4ed44c01" integrity sha512-piH7MJDJp4rJCduWbVvmUd59AUne1AFBJ8JaRQvk0KzNTSUnZrVXHCZc+eg+CGE4OujkcLJznhGKD6tuAshj5Q== -electron@25.7.0: - version "25.7.0" - resolved "https://registry.yarnpkg.com/electron/-/electron-25.7.0.tgz#0076c2e6acfe363f666a7b77d826a6f8a3028bcd" - integrity sha512-P82EzYZ8k9J21x5syhXV7EkezDmEXwycReXnagfzS0kwepnrlWzq1aDIUWdNvzTdHobky4m/nYcL98qd73mEVA== +electron@25.8.0: + version "25.8.0" + resolved "https://registry.yarnpkg.com/electron/-/electron-25.8.0.tgz#60c84f1f256924ac5a0aff13276b901b0c43767a" + integrity sha512-T3kC1a/3ntSaYMCVVfUUc9v7myPzi6J2GP0Ad/CyfWKDPp054dGyKxb2EEjKnxQQ7wfjsT1JTEdBG04x6ekVBw== dependencies: "@electron/get" "^2.0.0" "@types/node" "^18.11.18" From a5f4583b51a2d181a7495b7344d9ef90ee3fc2f8 Mon Sep 17 00:00:00 2001 From: Christof Marti Date: Fri, 1 Sep 2023 09:41:12 +0200 Subject: [PATCH 116/117] 1.83.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 997a4931166..dfd24be8535 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "code-oss-dev", - "version": "1.82.0", + "version": "1.83.0", "distro": "0a5805caff2d59440704a3bf75eebaa509be862f", "author": { "name": "Microsoft Corporation" From 2ed3ef258820640f4bffbdd26c3393edc14910ac Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 1 Sep 2023 10:32:59 +0200 Subject: [PATCH 117/117] editors - do not focus empty editor group when created (#191966) --- src/vs/workbench/browser/parts/editor/editorActions.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/editorActions.ts b/src/vs/workbench/browser/parts/editor/editorActions.ts index 149b76d8df9..e13b41e522f 100644 --- a/src/vs/workbench/browser/parts/editor/editorActions.ts +++ b/src/vs/workbench/browser/parts/editor/editorActions.ts @@ -2264,8 +2264,12 @@ abstract class AbstractCreateEditorGroupAction extends Action2 { override async run(accessor: ServicesAccessor): Promise { const editorGroupService = accessor.get(IEditorGroupsService); - const group = editorGroupService.addGroup(editorGroupService.activeGroup, this.direction, { activate: true }); - group.focus(); + // We intentionally do not want the new group to be focussed so that + // a user can have keyboard focus e.g. in a tree/list, open a new + // editor group that is active and then arrow-up/down in the tree/list + // to pick an editor to open in that group + + editorGroupService.addGroup(editorGroupService.activeGroup, this.direction, { activate: true }); } }