diff --git a/src/vs/platform/terminal/common/terminal.ts b/src/vs/platform/terminal/common/terminal.ts index 15f1c7d1771..e9b50861126 100644 --- a/src/vs/platform/terminal/common/terminal.ts +++ b/src/vs/platform/terminal/common/terminal.ts @@ -123,7 +123,6 @@ export const enum TerminalSettingId { EnableKittyKeyboardProtocol = 'terminal.integrated.enableKittyKeyboardProtocol', EnableWin32InputMode = 'terminal.integrated.enableWin32InputMode', AllowInUntrustedWorkspace = 'terminal.integrated.allowInUntrustedWorkspace', - EditorUseEditorBackground = 'terminal.integrated.editorUseEditorBackground', // Developer/debug settings diff --git a/src/vs/workbench/contrib/terminal/browser/media/terminal.css b/src/vs/workbench/contrib/terminal/browser/media/terminal.css index ce339d20d7f..9370b48b871 100644 --- a/src/vs/workbench/contrib/terminal/browser/media/terminal.css +++ b/src/vs/workbench/contrib/terminal/browser/media/terminal.css @@ -62,8 +62,8 @@ background-image: none !important; } -.monaco-workbench .terminal-editor .terminal-wrapper.use-editor-background { - background-color: var(--vscode-editor-background); +.monaco-workbench .terminal-editor .terminal-wrapper { + background-color: var(--vscode-terminal-background, var(--vscode-editorPane-background)); } .monaco-workbench .terminal-editor .terminal-wrapper, .monaco-workbench .pane-body.integrated-terminal .terminal-wrapper { diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index 169510b62c5..75894ea61eb 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -227,7 +227,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { set target(value: TerminalLocation | undefined) { this._targetRef.object = value; this._onDidChangeTarget.fire(value); - this._updateEditorBackgroundClass(); } get instanceId(): number { return this._instanceId; } @@ -400,7 +399,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { this._wrapperElement = document.createElement('div'); this._wrapperElement.classList.add('terminal-wrapper'); - this._updateEditorBackgroundClass(); this._widgetManager = this._register(instantiationService.createInstance(TerminalWidgetManager)); @@ -583,9 +581,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { this.updateConfig(); this.setVisible(this._isVisible); } - if (e.affectsConfiguration(TerminalSettingId.EditorUseEditorBackground)) { - this._updateEditorBackgroundClass(); - } const layoutSettings: string[] = [ TerminalSettingId.FontSize, TerminalSettingId.FontFamily, @@ -1923,11 +1918,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { this._refreshEnvironmentVariableInfoWidgetState(this._processManager.environmentVariableInfo); } - private _updateEditorBackgroundClass(): void { - const useEditorBg = this.target === TerminalLocation.Editor && this._configurationService.getValue(TerminalSettingId.EditorUseEditorBackground); - this._wrapperElement.classList.toggle('use-editor-background', !!useEditorBg); - } - private async _updateUnicodeVersion(): Promise { this._processManager.setUnicodeVersion(this._terminalConfigurationService.config.unicodeVersion); } @@ -2823,14 +2813,10 @@ export class TerminalInstanceColorProvider implements IXtermColorProvider { constructor( private readonly _target: IReference, @IViewDescriptorService private readonly _viewDescriptorService: IViewDescriptorService, - @IConfigurationService private readonly _configurationService: IConfigurationService, ) { } getBackgroundColor(theme: IColorTheme) { - if (this._target.object === TerminalLocation.Editor && this._configurationService.getValue(TerminalSettingId.EditorUseEditorBackground)) { - return theme.getColor(editorBackground); - } const terminalBackground = theme.getColor(TERMINAL_BACKGROUND_COLOR); if (terminalBackground) { return terminalBackground; diff --git a/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts b/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts index 84c101a6b93..b043728acf3 100644 --- a/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts +++ b/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts @@ -281,7 +281,7 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach if (e.affectsConfiguration(TerminalSettingId.UnicodeVersion)) { this._updateUnicodeVersion(); } - if (e.affectsConfiguration(TerminalSettingId.ShellIntegrationDecorationsEnabled) || e.affectsConfiguration(TerminalSettingId.EditorUseEditorBackground)) { + if (e.affectsConfiguration(TerminalSettingId.ShellIntegrationDecorationsEnabled)) { this._updateTheme(); } })); diff --git a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts index e539589cb1f..a3453dbac8f 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts @@ -124,11 +124,6 @@ const terminalConfiguration: IStringDictionary = { default: 'view', description: localize('terminal.integrated.defaultLocation', "Controls where newly created terminals will appear.") }, - [TerminalSettingId.EditorUseEditorBackground]: { - type: 'boolean', - default: true, - markdownDescription: localize('terminal.integrated.editorUseEditorBackground', "Controls whether terminals in the editor area use the editor background color instead of the terminal background color. When enabled, this takes precedence over {0} for terminals in the editor area.", '`#terminal.integrated.background#`') - }, [TerminalSettingId.TabsFocusMode]: { type: 'string', enum: ['singleClick', 'doubleClick'], diff --git a/src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts b/src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts index 834904a6203..9f6b3e3cfba 100644 --- a/src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts +++ b/src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts @@ -4,9 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { deepStrictEqual, strictEqual } from 'assert'; -import { Color } from '../../../../../base/common/color.js'; import { Event } from '../../../../../base/common/event.js'; -import { Disposable, ImmortalReference } from '../../../../../base/common/lifecycle.js'; +import { Disposable } from '../../../../../base/common/lifecycle.js'; import { Schemas } from '../../../../../base/common/network.js'; import { isWindows, type IProcessEnvironment } from '../../../../../base/common/platform.js'; import { URI } from '../../../../../base/common/uri.js'; @@ -17,19 +16,15 @@ import { TestInstantiationService } from '../../../../../platform/instantiation/ import { ResultKind } from '../../../../../platform/keybinding/common/keybindingResolver.js'; import { TerminalCapability, type ICwdDetectionCapability } from '../../../../../platform/terminal/common/capabilities/capabilities.js'; import { TerminalCapabilityStore } from '../../../../../platform/terminal/common/capabilities/terminalCapabilityStore.js'; -import { GeneralShellType, ITerminalChildProcess, ITerminalProfile, TerminalLocation, TitleEventSource, type IShellLaunchConfig, type ITerminalBackend, type ITerminalProcessOptions } from '../../../../../platform/terminal/common/terminal.js'; +import { GeneralShellType, ITerminalChildProcess, ITerminalProfile, TitleEventSource, type IShellLaunchConfig, type ITerminalBackend, type ITerminalProcessOptions } from '../../../../../platform/terminal/common/terminal.js'; import { IWorkspaceFolder } from '../../../../../platform/workspace/common/workspace.js'; -import { editorBackground } from '../../../../../platform/theme/common/colorRegistry.js'; -import { TestColorTheme } from '../../../../../platform/theme/test/common/testThemeService.js'; -import { PANEL_BACKGROUND, SIDE_BAR_BACKGROUND } from '../../../../common/theme.js'; -import { IViewDescriptorService, ViewContainerLocation } from '../../../../common/views.js'; +import { IViewDescriptorService } from '../../../../common/views.js'; import { ITerminalConfigurationService, ITerminalInstance, ITerminalInstanceService, ITerminalService } from '../../browser/terminal.js'; import { TerminalConfigurationService } from '../../browser/terminalConfigurationService.js'; -import { parseExitResult, TerminalInstance, TerminalInstanceColorProvider, TerminalLabelComputer } from '../../browser/terminalInstance.js'; +import { parseExitResult, TerminalInstance, TerminalLabelComputer } from '../../browser/terminalInstance.js'; import { IEnvironmentVariableService } from '../../common/environmentVariable.js'; import { EnvironmentVariableService } from '../../common/environmentVariableService.js'; import { ITerminalProfileResolverService, ProcessState, DEFAULT_COMMANDS_TO_SKIP_SHELL } from '../../common/terminal.js'; -import { TERMINAL_BACKGROUND_COLOR } from '../../common/terminalColorRegistry.js'; import { TestViewDescriptorService } from './xterm/xtermTerminal.test.js'; import { fixPath } from '../../../../services/search/test/browser/queryBuilder.test.js'; import { TestTerminalProfileResolverService, workbenchInstantiationService } from '../../../../test/browser/workbenchTestServices.js'; @@ -636,104 +631,3 @@ suite('Workbench - TerminalInstance', () => { }); }); }); - -suite('TerminalInstanceColorProvider', () => { - const store = ensureNoDisposablesAreLeakedInTestSuite(); - - let configurationService: TestConfigurationService; - let viewDescriptorService: TestViewDescriptorService; - - function createColorProvider(location: TerminalLocation | undefined): TerminalInstanceColorProvider { - const instantiationService = workbenchInstantiationService({ - configurationService: () => configurationService, - }, store); - viewDescriptorService = new TestViewDescriptorService(); - instantiationService.stub(IViewDescriptorService, viewDescriptorService as Partial); - return instantiationService.createInstance(TerminalInstanceColorProvider, new ImmortalReference(location)); - } - - setup(() => { - configurationService = new TestConfigurationService({ - terminal: { - integrated: { - editorUseEditorBackground: true - } - } - }); - }); - - test('editor terminal with editorUseEditorBackground=true returns editor background', () => { - const provider = createColorProvider(TerminalLocation.Editor); - const theme = new TestColorTheme({ - [editorBackground]: '#1e1e1e', - [TERMINAL_BACKGROUND_COLOR]: '#ff0000', - }); - const result = provider.getBackgroundColor(theme); - deepStrictEqual(result, Color.fromHex('#1e1e1e')); - }); - - test('editor terminal with editorUseEditorBackground=false and TERMINAL_BACKGROUND_COLOR defined returns terminal background', () => { - configurationService = new TestConfigurationService({ - terminal: { - integrated: { - editorUseEditorBackground: false - } - } - }); - const provider = createColorProvider(TerminalLocation.Editor); - const theme = new TestColorTheme({ - [editorBackground]: '#1e1e1e', - [TERMINAL_BACKGROUND_COLOR]: '#ff0000', - }); - const result = provider.getBackgroundColor(theme); - deepStrictEqual(result, Color.fromHex('#ff0000')); - }); - - test('editor terminal with editorUseEditorBackground=false and no TERMINAL_BACKGROUND_COLOR falls back to editor background', () => { - configurationService = new TestConfigurationService({ - terminal: { - integrated: { - editorUseEditorBackground: false - } - } - }); - const provider = createColorProvider(TerminalLocation.Editor); - const theme = new TestColorTheme({ - [editorBackground]: '#1e1e1e', - }); - const result = provider.getBackgroundColor(theme); - deepStrictEqual(result, Color.fromHex('#1e1e1e')); - }); - - test('panel terminal ignores editorUseEditorBackground and uses TERMINAL_BACKGROUND_COLOR', () => { - const provider = createColorProvider(TerminalLocation.Panel); - const theme = new TestColorTheme({ - [editorBackground]: '#1e1e1e', - [TERMINAL_BACKGROUND_COLOR]: '#ff0000', - }); - const result = provider.getBackgroundColor(theme); - deepStrictEqual(result, Color.fromHex('#ff0000')); - }); - - test('panel terminal without TERMINAL_BACKGROUND_COLOR falls back to panel background', () => { - const provider = createColorProvider(TerminalLocation.Panel); - viewDescriptorService.moveTerminalToLocation(ViewContainerLocation.Panel); - const theme = new TestColorTheme({ - [PANEL_BACKGROUND]: '#00ff00', - [SIDE_BAR_BACKGROUND]: '#0000ff', - }); - const result = provider.getBackgroundColor(theme); - deepStrictEqual(result, Color.fromHex('#00ff00')); - }); - - test('sidebar terminal without TERMINAL_BACKGROUND_COLOR falls back to sidebar background', () => { - const provider = createColorProvider(TerminalLocation.Panel); - viewDescriptorService.moveTerminalToLocation(ViewContainerLocation.Sidebar); - const theme = new TestColorTheme({ - [PANEL_BACKGROUND]: '#00ff00', - [SIDE_BAR_BACKGROUND]: '#0000ff', - }); - const result = provider.getBackgroundColor(theme); - deepStrictEqual(result, Color.fromHex('#0000ff')); - }); -});