Skip to content

Commit 786663b

Browse files
authored
re-enable smoke tests, keep editor fix (microsoft#139012) (microsoft#139019) (microsoft#139115)
1 parent fe719cd commit 786663b

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

src/vs/workbench/contrib/terminal/browser/terminalInstance.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,14 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
179179
private _labelComputer?: TerminalLabelComputer;
180180
private _userHome?: string;
181181
private _hasScrollBar?: boolean;
182+
private _target?: TerminalLocation | undefined;
182183

183-
get target(): TerminalLocation | undefined { return this.xterm?.target; }
184+
get target(): TerminalLocation | undefined { return this._target; }
184185
set target(value: TerminalLocation | undefined) {
185186
if (this.xterm) {
186187
this.xterm.target = value;
187188
}
189+
this._target = value;
188190
}
189191

190192
get instanceId(): number { return this._instanceId; }
@@ -559,7 +561,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
559561
throw new Error('Terminal disposed of during xterm.js creation');
560562
}
561563

562-
const xterm = this._instantiationService.createInstance(XtermTerminal, Terminal, this._configHelper, this._cols, this._rows);
564+
const xterm = this._instantiationService.createInstance(XtermTerminal, Terminal, this._configHelper, this._cols, this._rows, this.target || TerminalLocation.Panel);
563565
this.xterm = xterm;
564566
const lineDataEventAddon = new LineDataEventAddon();
565567
this.xterm.raw.loadAddon(lineDataEventAddon);
@@ -701,7 +703,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
701703
throw new Error('xterm elements not set after open');
702704
}
703705

704-
705706
this._setAriaLabel(xterm.raw, this._instanceId, this._title);
706707

707708
xterm.raw.attachCustomKeyEventHandler((event: KeyboardEvent): boolean => {

src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,7 @@ import { TerminalConfigHelper } from 'vs/workbench/contrib/terminal/browser/term
1313
import { DisposableStore } from 'vs/base/common/lifecycle';
1414
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
1515
import { TerminalLocation, TerminalSettingId } from 'vs/platform/terminal/common/terminal';
16-
import { IColorTheme, IThemeService } from 'vs/platform/theme/common/themeService';
17-
import { IViewDescriptorService, ViewContainerLocation } from 'vs/workbench/common/views';
18-
import { editorBackground } from 'vs/platform/theme/common/colorRegistry';
19-
import { ansiColorIdentifiers, TERMINAL_BACKGROUND_COLOR, TERMINAL_CURSOR_BACKGROUND_COLOR, TERMINAL_CURSOR_FOREGROUND_COLOR, TERMINAL_FOREGROUND_COLOR, TERMINAL_SELECTION_BACKGROUND_COLOR } from 'vs/workbench/contrib/terminal/common/terminalColorRegistry';
2016
import { ICommandTracker, ITerminalFont, TERMINAL_VIEW_ID } from 'vs/workbench/contrib/terminal/common/terminal';
21-
import { PANEL_BACKGROUND, SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
22-
import { Color } from 'vs/base/common/color';
2317
import { isSafari } from 'vs/base/browser/browser';
2418
import { IXtermTerminal } from 'vs/workbench/contrib/terminal/browser/terminal';
2519
import { ILogService } from 'vs/platform/log/common/log';
@@ -28,6 +22,12 @@ import { TerminalStorageKeys } from 'vs/workbench/contrib/terminal/common/termin
2822
import { INotificationService, IPromptChoice, Severity } from 'vs/platform/notification/common/notification';
2923
import { CommandTrackerAddon } from 'vs/workbench/contrib/terminal/browser/xterm/commandTrackerAddon';
3024
import { localize } from 'vs/nls';
25+
import { IColorTheme, IThemeService } from 'vs/platform/theme/common/themeService';
26+
import { IViewDescriptorService, ViewContainerLocation } from 'vs/workbench/common/views';
27+
import { editorBackground } from 'vs/platform/theme/common/colorRegistry';
28+
import { PANEL_BACKGROUND, SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
29+
import { TERMINAL_FOREGROUND_COLOR, TERMINAL_BACKGROUND_COLOR, TERMINAL_CURSOR_FOREGROUND_COLOR, TERMINAL_CURSOR_BACKGROUND_COLOR, TERMINAL_SELECTION_BACKGROUND_COLOR, ansiColorIdentifiers } from 'vs/workbench/contrib/terminal/common/terminalColorRegistry';
30+
import { Color } from 'vs/base/common/color';
3131

3232
// How long in milliseconds should an average frame take to render for a notification to appear
3333
// which suggests the fallback DOM-based renderer
@@ -45,7 +45,6 @@ let WebglAddon: typeof WebglAddonType;
4545
export class XtermTerminal extends DisposableStore implements IXtermTerminal {
4646
/** The raw xterm.js instance */
4747
readonly raw: RawXtermTerminal;
48-
target?: TerminalLocation;
4948

5049
private _core: IXtermCore;
5150
private static _suggestedRendererType: 'canvas' | 'dom' | undefined = undefined;
@@ -63,6 +62,12 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal {
6362

6463
get commandTracker(): ICommandTracker { return this._commandTrackerAddon; }
6564

65+
private _target: TerminalLocation | undefined;
66+
set target(location: TerminalLocation | undefined) {
67+
this._target = location;
68+
}
69+
get target(): TerminalLocation | undefined { return this._target; }
70+
6671
/**
6772
* @param xtermCtor The xterm.js constructor, this is passed in so it can be fetched lazily
6873
* outside of this class such that {@link raw} is not nullable.
@@ -72,6 +77,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal {
7277
private readonly _configHelper: TerminalConfigHelper,
7378
cols: number,
7479
rows: number,
80+
location: TerminalLocation,
7581
@IConfigurationService private readonly _configurationService: IConfigurationService,
7682
@ILogService private readonly _logService: ILogService,
7783
@INotificationService private readonly _notificationService: INotificationService,
@@ -80,7 +86,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal {
8086
@IViewDescriptorService private readonly _viewDescriptorService: IViewDescriptorService
8187
) {
8288
super();
83-
89+
this.target = location;
8490
const font = this._configHelper.getFont(undefined, true);
8591
const config = this._configHelper.config;
8692
const editorOptions = this._configurationService.getValue<IEditorOptions>('editor');
@@ -125,6 +131,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal {
125131
this._updateUnicodeVersion();
126132
}
127133
}));
134+
128135
this.add(this._themeService.onDidColorThemeChange(theme => this._updateTheme(theme)));
129136
this.add(this._viewDescriptorService.onDidChangeLocation(({ views }) => {
130137
if (views.some(v => v.id === TERMINAL_VIEW_ID)) {
@@ -133,7 +140,6 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal {
133140
}));
134141

135142
// Load addons
136-
137143
this._updateUnicodeVersion();
138144

139145
this._commandTrackerAddon = new CommandTrackerAddon();
@@ -148,7 +154,6 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal {
148154
attachToElement(container: HTMLElement) {
149155
// Update the theme when attaching as the terminal location could have changed
150156
this._updateTheme();
151-
152157
if (!this._container) {
153158
this.raw.open(container);
154159
}

src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ suite('XtermTerminal', () => {
109109
instantiationService.stub(IViewDescriptorService, viewDescriptorService);
110110

111111
configHelper = instantiationService.createInstance(TerminalConfigHelper);
112-
xterm = instantiationService.createInstance(TestXtermTerminal, Terminal, configHelper, 80, 30);
112+
xterm = instantiationService.createInstance(TestXtermTerminal, Terminal, configHelper, 80, 30, 1);
113113

114114
TestWebglAddon.shouldThrow = false;
115115
TestWebglAddon.isEnabled = false;
@@ -126,7 +126,7 @@ suite('XtermTerminal', () => {
126126
[PANEL_BACKGROUND]: '#ff0000',
127127
[SIDE_BAR_BACKGROUND]: '#00ff00'
128128
}));
129-
xterm = instantiationService.createInstance(XtermTerminal, Terminal, configHelper, 80, 30);
129+
xterm = instantiationService.createInstance(XtermTerminal, Terminal, configHelper, 80, 30, 1);
130130
strictEqual(xterm.raw.getOption('theme').background, '#ff0000');
131131
viewDescriptorService.moveTerminalToLocation(ViewContainerLocation.Sidebar);
132132
strictEqual(xterm.raw.getOption('theme').background, '#00ff00');
@@ -159,7 +159,7 @@ suite('XtermTerminal', () => {
159159
'terminal.ansiBrightCyan': '#150000',
160160
'terminal.ansiBrightWhite': '#160000',
161161
}));
162-
xterm = instantiationService.createInstance(XtermTerminal, Terminal, configHelper, 80, 30);
162+
xterm = instantiationService.createInstance(XtermTerminal, Terminal, configHelper, 80, 30, 1);
163163
deepStrictEqual(xterm.raw.getOption('theme'), {
164164
background: '#000100',
165165
foreground: '#000200',

test/smoke/src/areas/terminal/terminal-profiles.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function setup(opts: ParsedArgs) {
3636
await terminal.assertTerminalGroups([[{ name: CONTRIBUTED_PROFILE_NAME }, { name: CONTRIBUTED_PROFILE_NAME }]]);
3737
});
3838

39-
it.skip('should set the default profile', async () => {
39+
it('should set the default profile', async () => {
4040
await terminal.runCommandWithValue(TerminalCommandIdWithValue.SelectDefaultProfile, process.platform === 'win32' ? 'PowerShell' : undefined);
4141
await terminal.runCommand(TerminalCommandId.CreateNew);
4242
await terminal.assertSingleTab({ name: ANY_PROFILE_NAME });

0 commit comments

Comments
 (0)