Change:
Type: <bBug</bPinning a terminal editor does not set some of the context variables that are normally set when pining a text editor. Here are the ones I've noticed: activeEditorIsDirty activeEditorIsFirstInGroup activeEditorIsLastInGroup activeEditorIsNotPreview activeEditorIsPinned In the case of activeEditorIsPinned this makes it impossible to detect if the current terminal editor is pinned. Since there is no command to toggle the pin on an editor this means it's not possible to create a single keybinding that can intelligently pin and unpin the current terminal editor. In the case of activeEditorIsLastInGroup it means it's not possible to create a keybinding to move a terminal editor out of the "pinned section" of editors in the current group. When editors are pinned they are moved to the left side of the current editor group. When moving an editor to the previous position in the current group if it happens to cross into the pinned section it will become pinned. But the inverse is not possible: you cannot move a pinned editor out of the pinned section unless there happens to be something else unpinned to the right of it. So I have a keybinding to unpin the current editor if it's the last editor in the current group. Since terminal editors don't set the required context they break this binding. Steps to Repro: Open a terminal in the editor area Pin the terminal editor Inspect context keys Notice activeEditorIsPinned is not set VS Code version: Code - Insiders 1.76.0-insider (, 2023-02-10T16:22:19.445Z) OS version: WindowsNT x64 10.0. Modes: Sandboxed: Yes <details<summarySystem Info</summary </detailsExtensions: none<details<summaryA/B Experiments</summary</details<!-- generated by issue reporter --
The type of editor should not play any role in this. I somewhat doubt this is a bug in our code, so setting label that we need confirmation. Open for help, investigation, suggested fixes, PR.
This one I cannot confirm or reproduce. See this gif where I open a terminal, pin it and then inspect the context keys: ! What are some exact steps?
Looks like it depends where you click when inspecting context keys. I'm clicking inside the terminal, where my cursor is, because I'm attempting to make keybindings that work when using the terminal. You're clicking the editor tab. So it appears the context is set for the editor, but when you focus the terminal within it that context is removed. Interestingly I still see some of the context so not all of it is removed.
Quite likely that the terminal itself sets its own context keys.
<!-- AUTHORVERIFICATIONREQUEST --This bug has been fixed in the latest release of ! you can help us out by commenting if things are now working as expected. If things still don't seem right, please ensure you're on version of Insiders (today's or later - you can use in the command palette to check), and leave a comment letting us know what isn't working as expected. Happy Coding!
/verified, but while confirming the fix I noticed more issues with these context keys

Discussion:
import { ISimpleSelectedSuggestion } from 'vs/workbench/services/suggest/browser/simpleSuggestWidget'; import type { IMarker, ITheme, Terminal as RawXtermTerminal } from '@xterm/xterm'; import { ScrollPosition } from 'vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon'; <ins> import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; </ins> export const ITerminalService = createDecorator<ITerminalService>('terminalService'); export const ITerminalEditorService = createDecorator<ITerminalEditorService>('terminalEditorService');

* If successful, places commandToRun on the command line */ freePortKillProcess(port: string, commandToRun: string): Promise<void>; <ins> /** * Update the parent context key service to use for this terminal instance. */ setParentContextKeyService(parentContextKeyService: IContextKeyService): void; </ins> } export const enum XtermTerminalConstants {

setGroup(group: IEditorGroup | undefined) { this._group = group; <ins> if (group?.scopedContextKeyService) { this._terminalInstance?.setParentContextKeyService(group.scopedContextKeyService); } </ins> } get group(): IEditorGroup | undefined {

@IInstantiationService private readonly _instantiationService: IInstantiationService, @IConfigurationService private readonly _configurationService: IConfigurationService, @ILifecycleService private readonly _lifecycleService: ILifecycleService, <del> @IContextKeyService _contextKeyService: IContextKeyService, </del> <ins> @IContextKeyService private _contextKeyService: IContextKeyService, </ins> @IDialogService private readonly _dialogService: IDialogService ) { super();

detachInstance() { if (!this._isShuttingDown) { this._terminalInstance?.detachFromElement(); <ins> this._terminalInstance?.setParentContextKeyService(this._contextKeyService); </ins> this._isDetached = true; } }

private _usedShellIntegrationInjection: boolean = false; get usedShellIntegrationInjection(): boolean { return this._usedShellIntegrationInjection; } private _lineDataEventAddon: LineDataEventAddon | undefined; <ins> private readonly _scopedContextKeyService: IContextKeyService; </ins> readonly capabilities = new TerminalCapabilityStoreMultiplexer(); readonly statusList: ITerminalStatusList;

} const scopedContextKeyService = this._register(_contextKeyService.createScoped(this._wrapperElement)); <ins> this._scopedContextKeyService = scopedContextKeyService; </ins> this._scopedInstantiationService = instantiationService.createChild(new ServiceCollection( [IContextKeyService, scopedContextKeyService] ));

resetScrollbarVisibility(): void { this._wrapperElement.classList.remove('force-scrollbar'); } <ins> setParentContextKeyService(parentContextKeyService: IContextKeyService): void { this._scopedContextKeyService.updateParent(parentContextKeyService); } </ins> } class TerminalInstanceDragAndDropController extends Disposable implements dom.IDragAndDropObserverCallbacks {