mirror of
https://github.com/microsoft/vscode.git
synced 2026-03-02 23:09:59 +00:00
Merge pull request #286518 from microsoft/tyriar/286065
Remove sendKeybindingsToShell notification
This commit is contained in:
@@ -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<IDisposable> = 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 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
|
||||
if (!this._terminalConfigurationService.config.sendKeybindingsToShell && resolveResult.kind === ResultKind.KbFound && resolveResult.commandId && this._skipTerminalCommands.some(k => k === resolveResult.commandId)) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user