@@ -13,13 +13,7 @@ import { TerminalConfigHelper } from 'vs/workbench/contrib/terminal/browser/term
1313import { DisposableStore } from 'vs/base/common/lifecycle' ;
1414import { IEditorOptions } from 'vs/editor/common/config/editorOptions' ;
1515import { 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' ;
2016import { 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' ;
2317import { isSafari } from 'vs/base/browser/browser' ;
2418import { IXtermTerminal } from 'vs/workbench/contrib/terminal/browser/terminal' ;
2519import { ILogService } from 'vs/platform/log/common/log' ;
@@ -28,6 +22,12 @@ import { TerminalStorageKeys } from 'vs/workbench/contrib/terminal/common/termin
2822import { INotificationService , IPromptChoice , Severity } from 'vs/platform/notification/common/notification' ;
2923import { CommandTrackerAddon } from 'vs/workbench/contrib/terminal/browser/xterm/commandTrackerAddon' ;
3024import { 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;
4545export 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 }
0 commit comments