From 93738a8c874394e1c084b10d564043ed4ed4a388 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Thu, 8 Jan 2026 03:32:10 -0800 Subject: [PATCH 1/2] Remove sendKeybindingsToShell notification Fixes #286065 --- .../terminal/browser/terminalInstance.ts | 52 ++++--------------- 1 file changed, 11 insertions(+), 41 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index 265b63c9ab6..e6151bd64d2 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -36,11 +36,11 @@ import { IInstantiationService } from '../../../../platform/instantiation/common import { ServiceCollection } from '../../../../platform/instantiation/common/serviceCollection.js'; import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js'; import { ResultKind } from '../../../../platform/keybinding/common/keybindingResolver.js'; -import { INotificationService, IPromptChoice, Severity } from '../../../../platform/notification/common/notification.js'; +import { INotificationService, Severity } from '../../../../platform/notification/common/notification.js'; import { IOpenerService } from '../../../../platform/opener/common/opener.js'; import { IProductService } from '../../../../platform/product/common/productService.js'; import { IQuickInputService, IQuickPickItem, QuickPickItem } from '../../../../platform/quickinput/common/quickInput.js'; -import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js'; +import { IStorageService } from '../../../../platform/storage/common/storage.js'; import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js'; import { IMarkProperties, TerminalCapability } from '../../../../platform/terminal/common/capabilities/capabilities.js'; import { TerminalCapabilityStoreMultiplexer } from '../../../../platform/terminal/common/capabilities/terminalCapabilityStore.js'; @@ -69,7 +69,7 @@ import { TerminalWidgetManager } from './widgets/widgetManager.js'; import { LineDataEventAddon } from './xterm/lineDataEventAddon.js'; import { XtermTerminal, getXtermScaledDimensions } from './xterm/xtermTerminal.js'; import { IEnvironmentVariableInfo } from '../common/environmentVariable.js'; -import { DEFAULT_COMMANDS_TO_SKIP_SHELL, ITerminalProcessManager, ITerminalProfileResolverService, ProcessState, TERMINAL_CREATION_COMMANDS, TERMINAL_VIEW_ID, TerminalCommandId } from '../common/terminal.js'; +import { DEFAULT_COMMANDS_TO_SKIP_SHELL, ITerminalProcessManager, ITerminalProfileResolverService, ProcessState, TERMINAL_VIEW_ID, TerminalCommandId } from '../common/terminal.js'; import { TERMINAL_BACKGROUND_COLOR } from '../common/terminalColorRegistry.js'; import { TerminalContextKeys } from '../common/terminalContextKey.js'; import { getUriLabelForShell, getShellIntegrationTimeout, getWorkspaceForTerminal, preparePathForShell } from '../common/terminalEnvironment.js'; @@ -185,7 +185,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { private _widgetManager: TerminalWidgetManager; private readonly _dndObserver: MutableDisposable = this._register(new MutableDisposable()); private _lastLayoutDimensions: dom.Dimension | undefined; - private _hasHadInput: boolean; private _description?: string; private _processName: string = ''; private _sequence?: string; @@ -374,14 +373,14 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { @IFileService private readonly _fileService: IFileService, @IKeybindingService private readonly _keybindingService: IKeybindingService, @INotificationService private readonly _notificationService: INotificationService, - @IPreferencesService private readonly _preferencesService: IPreferencesService, + @IPreferencesService _preferencesService: IPreferencesService, @IViewsService private readonly _viewsService: IViewsService, @IThemeService private readonly _themeService: IThemeService, @IConfigurationService private readonly _configurationService: IConfigurationService, @ITerminalLogService private readonly _logService: ITerminalLogService, - @IStorageService private readonly _storageService: IStorageService, + @IStorageService _storageService: IStorageService, @IAccessibilityService private readonly _accessibilityService: IAccessibilityService, - @IProductService private readonly _productService: IProductService, + @IProductService _productService: IProductService, @IQuickInputService private readonly _quickInputService: IQuickInputService, @IWorkbenchEnvironmentService private readonly _workbenchEnvironmentService: IWorkbenchEnvironmentService, @IWorkspaceContextService private readonly _workspaceContextService: IWorkspaceContextService, @@ -406,7 +405,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { this._hadFocusOnExit = false; this._isVisible = false; this._instanceId = TerminalInstance._instanceIdCounter++; - this._hasHadInput = false; this._fixedRows = _shellLaunchConfig.attachPersistentProcess?.fixedDimensions?.rows; this._fixedCols = _shellLaunchConfig.attachPersistentProcess?.fixedDimensions?.cols; this._shellLaunchConfig.shellIntegrationEnvironmentReporting = this._configurationService.getValue(TerminalSettingId.ShellIntegrationEnvironmentReporting); @@ -1125,39 +1123,11 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { return false; } - const SHOW_TERMINAL_CONFIG_PROMPT_KEY = 'terminal.integrated.showTerminalConfigPrompt'; - const EXCLUDED_KEYS = ['RightArrow', 'LeftArrow', 'UpArrow', 'DownArrow', 'Space', 'Meta', 'Control', 'Shift', 'Alt', '', 'Delete', 'Backspace', 'Tab']; - - // only keep track of input if prompt hasn't already been shown - if (this._storageService.getBoolean(SHOW_TERMINAL_CONFIG_PROMPT_KEY, StorageScope.APPLICATION, true) && - !EXCLUDED_KEYS.includes(event.key) && - !event.ctrlKey && - !event.shiftKey && - !event.altKey) { - this._hasHadInput = true; - } - - // for keyboard events that resolve to commands described - // within commandsToSkipShell, either alert or skip processing by xterm.js - if (resolveResult.kind === ResultKind.KbFound && resolveResult.commandId && this._skipTerminalCommands.some(k => k === resolveResult.commandId) && !this._terminalConfigurationService.config.sendKeybindingsToShell) { - // don't alert when terminal is opened or closed - if (this._storageService.getBoolean(SHOW_TERMINAL_CONFIG_PROMPT_KEY, StorageScope.APPLICATION, true) && - this._hasHadInput && - !TERMINAL_CREATION_COMMANDS.includes(resolveResult.commandId)) { - this._notificationService.prompt( - Severity.Info, - nls.localize('keybindingHandling', "Some keybindings don't go to the terminal by default and are handled by {0} instead.", this._productService.nameLong), - [ - { - label: nls.localize('configureTerminalSettings', "Configure Terminal Settings"), - run: () => { - this._preferencesService.openSettings({ jsonEditor: false, query: `@id:${TerminalSettingId.CommandsToSkipShell},${TerminalSettingId.SendKeybindingsToShell},${TerminalSettingId.AllowChords}` }); - } - } satisfies IPromptChoice - ] - ); - this._storageService.store(SHOW_TERMINAL_CONFIG_PROMPT_KEY, false, StorageScope.APPLICATION, StorageTarget.USER); - } + // Skip processing by xterm.js of keyboard events that resolve to commands definted in + // the commandsToSkipShell setting. Ensure sendKeybindingsToShell is respected here + // which will disable this special handling and always opt to send the keystroke to the + // shell process + if (!this._terminalConfigurationService.config.sendKeybindingsToShell && resolveResult.kind === ResultKind.KbFound && resolveResult.commandId && this._skipTerminalCommands.some(k => k === resolveResult.commandId)) { event.preventDefault(); return false; } From c3d1faced6ac5e44afe4a5600bd3a0f1cb030399 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Thu, 8 Jan 2026 03:48:17 -0800 Subject: [PATCH 2/2] Update src/vs/workbench/contrib/terminal/browser/terminalInstance.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/vs/workbench/contrib/terminal/browser/terminalInstance.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index e6151bd64d2..ce934e637ac 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -1123,7 +1123,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { return false; } - // Skip processing by xterm.js of keyboard events that resolve to commands definted in + // Skip processing by xterm.js of keyboard events that resolve to commands defined in // the commandsToSkipShell setting. Ensure sendKeybindingsToShell is respected here // which will disable this special handling and always opt to send the keystroke to the // shell process