@theia/terminal 1.34.0-next.7 → 1.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/base/terminal-widget.d.ts +24 -1
- package/lib/browser/base/terminal-widget.d.ts.map +1 -1
- package/lib/browser/base/terminal-widget.js +6 -1
- package/lib/browser/base/terminal-widget.js.map +1 -1
- package/lib/browser/shell-terminal-profile.d.ts +18 -0
- package/lib/browser/shell-terminal-profile.d.ts.map +1 -0
- package/lib/browser/shell-terminal-profile.js +40 -0
- package/lib/browser/shell-terminal-profile.js.map +1 -0
- package/lib/browser/terminal-frontend-contribution.d.ts +18 -1
- package/lib/browser/terminal-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/terminal-frontend-contribution.js +266 -11
- package/lib/browser/terminal-frontend-contribution.js.map +1 -1
- package/lib/browser/terminal-frontend-module.d.ts.map +1 -1
- package/lib/browser/terminal-frontend-module.js +8 -0
- package/lib/browser/terminal-frontend-module.js.map +1 -1
- package/lib/browser/terminal-preferences.d.ts +20 -0
- package/lib/browser/terminal-preferences.d.ts.map +1 -1
- package/lib/browser/terminal-preferences.js +165 -13
- package/lib/browser/terminal-preferences.js.map +1 -1
- package/lib/browser/terminal-profile-service.d.ts +56 -0
- package/lib/browser/terminal-profile-service.d.ts.map +1 -0
- package/lib/browser/terminal-profile-service.js +150 -0
- package/lib/browser/terminal-profile-service.js.map +1 -0
- package/lib/browser/terminal-quick-open-service.js +1 -1
- package/lib/browser/terminal-quick-open-service.js.map +1 -1
- package/lib/browser/terminal-widget-impl.d.ts +5 -3
- package/lib/browser/terminal-widget-impl.d.ts.map +1 -1
- package/lib/browser/terminal-widget-impl.js +21 -16
- package/lib/browser/terminal-widget-impl.js.map +1 -1
- package/lib/common/shell-terminal-protocol.d.ts +0 -1
- package/lib/common/shell-terminal-protocol.d.ts.map +1 -1
- package/lib/common/shell-terminal-protocol.js.map +1 -1
- package/lib/node/buffering-stream.d.ts +15 -6
- package/lib/node/buffering-stream.d.ts.map +1 -1
- package/lib/node/buffering-stream.js +23 -8
- package/lib/node/buffering-stream.js.map +1 -1
- package/lib/node/buffering-stream.spec.js +2 -2
- package/lib/node/buffering-stream.spec.js.map +1 -1
- package/lib/node/shell-process.d.ts +2 -4
- package/lib/node/shell-process.d.ts.map +1 -1
- package/lib/node/shell-process.js +6 -12
- package/lib/node/shell-process.js.map +1 -1
- package/lib/node/terminal-backend-contribution.d.ts +1 -0
- package/lib/node/terminal-backend-contribution.d.ts.map +1 -1
- package/lib/node/terminal-backend-contribution.js +13 -13
- package/lib/node/terminal-backend-contribution.js.map +1 -1
- package/package.json +9 -8
- package/src/browser/base/terminal-widget.ts +32 -2
- package/src/browser/shell-terminal-profile.ts +40 -0
- package/src/browser/terminal-frontend-contribution.ts +287 -19
- package/src/browser/terminal-frontend-module.ts +12 -0
- package/src/browser/terminal-preferences.ts +227 -14
- package/src/browser/terminal-profile-service.ts +170 -0
- package/src/browser/terminal-quick-open-service.ts +1 -1
- package/src/browser/terminal-widget-impl.ts +28 -21
- package/src/common/shell-terminal-protocol.ts +0 -1
- package/src/node/buffering-stream.spec.ts +4 -4
- package/src/node/buffering-stream.ts +30 -13
- package/src/node/shell-process.ts +7 -13
- package/src/node/terminal-backend-contribution.ts +13 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Event } from '@theia/core';
|
|
1
|
+
import { Event, ViewColumn } from '@theia/core';
|
|
2
2
|
import { BaseWidget } from '@theia/core/lib/browser';
|
|
3
3
|
import { CommandLineOptions } from '@theia/process/lib/common/shell-command-builder';
|
|
4
4
|
import { TerminalSearchWidget } from '../search/terminal-search-widget';
|
|
@@ -11,6 +11,18 @@ export interface TerminalDimensions {
|
|
|
11
11
|
export interface TerminalExitStatus {
|
|
12
12
|
readonly code: number | undefined;
|
|
13
13
|
}
|
|
14
|
+
export declare type TerminalLocationOptions = TerminalLocation | TerminalEditorLocation | TerminalSplitLocation;
|
|
15
|
+
export declare enum TerminalLocation {
|
|
16
|
+
Panel = 1,
|
|
17
|
+
Editor = 2
|
|
18
|
+
}
|
|
19
|
+
export interface TerminalEditorLocation {
|
|
20
|
+
readonly viewColumn: ViewColumn;
|
|
21
|
+
readonly preserveFocus?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface TerminalSplitLocation {
|
|
24
|
+
readonly parentTerminal: string;
|
|
25
|
+
}
|
|
14
26
|
/**
|
|
15
27
|
* Terminal UI widget.
|
|
16
28
|
*/
|
|
@@ -27,6 +39,8 @@ export declare abstract class TerminalWidget extends BaseWidget {
|
|
|
27
39
|
abstract readonly exitStatus: TerminalExitStatus | undefined;
|
|
28
40
|
/** Terminal widget can be hidden from users until explicitly shown once. */
|
|
29
41
|
abstract readonly hiddenFromUser: boolean;
|
|
42
|
+
/** The position of the terminal widget. */
|
|
43
|
+
abstract readonly location: TerminalLocationOptions;
|
|
30
44
|
/** The last CWD assigned to the terminal, useful when attempting getCwdURI on a task terminal fails */
|
|
31
45
|
lastCwd: URI;
|
|
32
46
|
/**
|
|
@@ -103,6 +117,10 @@ export interface TerminalWidgetOptions {
|
|
|
103
117
|
* Human readable terminal representation on the UI.
|
|
104
118
|
*/
|
|
105
119
|
readonly title?: string;
|
|
120
|
+
/**
|
|
121
|
+
* icon class
|
|
122
|
+
*/
|
|
123
|
+
readonly iconClass?: string;
|
|
106
124
|
/**
|
|
107
125
|
* Path to the executable shell. For example: `/bin/bash`, `bash`, `sh`.
|
|
108
126
|
*/
|
|
@@ -158,5 +176,10 @@ export interface TerminalWidgetOptions {
|
|
|
158
176
|
* When enabled the terminal will run the process as normal but not be surfaced to the user until `Terminal.show` is called.
|
|
159
177
|
*/
|
|
160
178
|
readonly hideFromUser?: boolean;
|
|
179
|
+
readonly location?: TerminalLocationOptions;
|
|
180
|
+
/**
|
|
181
|
+
* When enabled, the terminal will not be persisted across window reloads.
|
|
182
|
+
*/
|
|
183
|
+
readonly isTransient?: boolean;
|
|
161
184
|
}
|
|
162
185
|
//# sourceMappingURL=terminal-widget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-widget.d.ts","sourceRoot":"","sources":["../../../src/browser/base/terminal-widget.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"terminal-widget.d.ts","sourceRoot":"","sources":["../../../src/browser/base/terminal-widget.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,GAAG,MAAM,4BAA4B,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,oBAAY,uBAAuB,GAAG,gBAAgB,GAAG,sBAAsB,GAAG,qBAAqB,CAAC;AAExG,oBAAY,gBAAgB;IACxB,KAAK,IAAI;IACT,MAAM,IAAI;CACb;AAED,MAAM,WAAW,sBAAsB;IACnC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,WAAW,qBAAqB;IAClC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACnC;AAED;;GAEG;AACH,8BAAsB,cAAe,SAAQ,UAAU;IAEnD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC;;OAEG;IACH,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B;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAEvC;;OAEG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAEhD;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAEtC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAEvD;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAEhC,QAAQ,CAAC,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IAE5C;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAClC"}
|
|
@@ -15,8 +15,13 @@
|
|
|
15
15
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
16
|
// *****************************************************************************
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.TerminalWidgetOptions = exports.TerminalWidget = void 0;
|
|
18
|
+
exports.TerminalWidgetOptions = exports.TerminalWidget = exports.TerminalLocation = void 0;
|
|
19
19
|
const browser_1 = require("@theia/core/lib/browser");
|
|
20
|
+
var TerminalLocation;
|
|
21
|
+
(function (TerminalLocation) {
|
|
22
|
+
TerminalLocation[TerminalLocation["Panel"] = 1] = "Panel";
|
|
23
|
+
TerminalLocation[TerminalLocation["Editor"] = 2] = "Editor";
|
|
24
|
+
})(TerminalLocation = exports.TerminalLocation || (exports.TerminalLocation = {}));
|
|
20
25
|
/**
|
|
21
26
|
* Terminal UI widget.
|
|
22
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-widget.js","sourceRoot":"","sources":["../../../src/browser/base/terminal-widget.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;;;AAGhF,qDAAqD;
|
|
1
|
+
{"version":3,"file":"terminal-widget.js","sourceRoot":"","sources":["../../../src/browser/base/terminal-widget.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;;;AAGhF,qDAAqD;AAiBrD,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,yDAAS,CAAA;IACT,2DAAU,CAAA;AACd,CAAC,EAHW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAG3B;AAWD;;GAEG;AACH,MAAsB,cAAe,SAAQ,oBAAU;CAyGtD;AAzGD,wCAyGC;AAED;;GAEG;AACU,QAAA,qBAAqB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IShellTerminalServerOptions } from '../common/shell-terminal-protocol';
|
|
2
|
+
import { TerminalService } from './base/terminal-service';
|
|
3
|
+
import { TerminalWidget, TerminalWidgetOptions } from './base/terminal-widget';
|
|
4
|
+
import { TerminalProfile } from './terminal-profile-service';
|
|
5
|
+
export declare class ShellTerminalProfile implements TerminalProfile {
|
|
6
|
+
protected readonly terminalService: TerminalService;
|
|
7
|
+
protected readonly options: TerminalWidgetOptions;
|
|
8
|
+
constructor(terminalService: TerminalService, options: TerminalWidgetOptions);
|
|
9
|
+
start(): Promise<TerminalWidget>;
|
|
10
|
+
/**
|
|
11
|
+
* Makes a copy of this profile modified with the options given
|
|
12
|
+
* as an argument.
|
|
13
|
+
* @param options the options to override
|
|
14
|
+
* @returns a modified copy of this profile
|
|
15
|
+
*/
|
|
16
|
+
modify(options: IShellTerminalServerOptions): TerminalProfile;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=shell-terminal-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-terminal-profile.d.ts","sourceRoot":"","sources":["../../src/browser/shell-terminal-profile.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,qBAAa,oBAAqB,YAAW,eAAe;IAC5C,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,eAAe;IAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,qBAAqB;gBAAnF,eAAe,EAAE,eAAe,EAAqB,OAAO,EAAE,qBAAqB;IAE5G,KAAK,IAAI,OAAO,CAAC,cAAc,CAAC;IAMtC;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,2BAA2B,GAAG,eAAe;CAGhE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2022 STMicroelectronics and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ShellTerminalProfile = void 0;
|
|
19
|
+
class ShellTerminalProfile {
|
|
20
|
+
constructor(terminalService, options) {
|
|
21
|
+
this.terminalService = terminalService;
|
|
22
|
+
this.options = options;
|
|
23
|
+
}
|
|
24
|
+
async start() {
|
|
25
|
+
const widget = await this.terminalService.newTerminal(this.options);
|
|
26
|
+
widget.start();
|
|
27
|
+
return widget;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Makes a copy of this profile modified with the options given
|
|
31
|
+
* as an argument.
|
|
32
|
+
* @param options the options to override
|
|
33
|
+
* @returns a modified copy of this profile
|
|
34
|
+
*/
|
|
35
|
+
modify(options) {
|
|
36
|
+
return new ShellTerminalProfile(this.terminalService, Object.assign(Object.assign({}, this.options), options));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.ShellTerminalProfile = ShellTerminalProfile;
|
|
40
|
+
//# sourceMappingURL=shell-terminal-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-terminal-profile.js","sourceRoot":"","sources":["../../src/browser/shell-terminal-profile.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;;;AAOhF,MAAa,oBAAoB;IAC7B,YAA+B,eAAgC,EAAqB,OAA8B;QAAnF,oBAAe,GAAf,eAAe,CAAiB;QAAqB,YAAO,GAAP,OAAO,CAAuB;IAAI,CAAC;IAEvH,KAAK,CAAC,KAAK;QACP,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpE,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,OAAoC;QACvC,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,eAAe,kCAAO,IAAI,CAAC,OAAO,GAAK,OAAO,EAAG,CAAC;IAC3F,CAAC;CACJ;AAlBD,oDAkBC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CommandContribution, Command, CommandRegistry, DisposableCollection, MenuContribution, MenuModelRegistry, SelectionService, Emitter, Event } from '@theia/core/lib/common';
|
|
2
|
-
import { ApplicationShell, KeybindingContribution, WidgetManager, KeybindingRegistry, Widget, LabelProvider, WidgetOpenerOptions, StorageService, QuickInputService, FrontendApplicationContribution, OnWillStopAction } from '@theia/core/lib/browser';
|
|
2
|
+
import { ApplicationShell, KeybindingContribution, WidgetManager, PreferenceService, KeybindingRegistry, Widget, LabelProvider, WidgetOpenerOptions, StorageService, QuickInputService, FrontendApplicationContribution, OnWillStopAction, FrontendApplication } from '@theia/core/lib/browser';
|
|
3
3
|
import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
|
|
4
4
|
import { TerminalService } from './base/terminal-service';
|
|
5
5
|
import { TerminalWidgetOptions, TerminalWidget } from './base/terminal-widget';
|
|
6
|
+
import { TerminalProfile, TerminalProfileService, TerminalProfileStore } from './terminal-profile-service';
|
|
6
7
|
import { ShellTerminalServerProxy } from '../common/shell-terminal-protocol';
|
|
7
8
|
import URI from '@theia/core/lib/common/uri';
|
|
8
9
|
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
@@ -12,6 +13,7 @@ import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
|
|
|
12
13
|
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
13
14
|
import { TerminalWatcher } from '../common/terminal-watcher';
|
|
14
15
|
import { TerminalPreferences } from './terminal-preferences';
|
|
16
|
+
import { VariableResolverService } from '@theia/variable-resolver/lib/browser';
|
|
15
17
|
export declare namespace TerminalMenus {
|
|
16
18
|
const TERMINAL: string[];
|
|
17
19
|
const TERMINAL_NEW: string[];
|
|
@@ -23,6 +25,8 @@ export declare namespace TerminalMenus {
|
|
|
23
25
|
}
|
|
24
26
|
export declare namespace TerminalCommands {
|
|
25
27
|
const NEW: Command;
|
|
28
|
+
const PROFILE_NEW: Command;
|
|
29
|
+
const PROFILE_DEFAULT: Command;
|
|
26
30
|
const NEW_ACTIVE_WORKSPACE: Command;
|
|
27
31
|
const TERMINAL_CLEAR: Command;
|
|
28
32
|
const TERMINAL_CONTEXT: Command;
|
|
@@ -49,15 +53,25 @@ export declare class TerminalFrontendContribution implements FrontendApplication
|
|
|
49
53
|
protected readonly labelProvider: LabelProvider;
|
|
50
54
|
protected readonly quickInputService: QuickInputService;
|
|
51
55
|
protected readonly workspaceService: WorkspaceService;
|
|
56
|
+
protected readonly profileService: TerminalProfileService;
|
|
57
|
+
protected readonly userProfileStore: TerminalProfileStore;
|
|
58
|
+
protected readonly contributedProfileStore: TerminalProfileStore;
|
|
52
59
|
protected readonly terminalWatcher: TerminalWatcher;
|
|
60
|
+
protected readonly variableResolver: VariableResolverService;
|
|
53
61
|
protected readonly storageService: StorageService;
|
|
62
|
+
protected readonly preferenceService: PreferenceService;
|
|
54
63
|
protected terminalPreferences: TerminalPreferences;
|
|
64
|
+
protected mergePreferencesPromise: Promise<void>;
|
|
55
65
|
protected readonly onDidCreateTerminalEmitter: Emitter<TerminalWidget>;
|
|
56
66
|
readonly onDidCreateTerminal: Event<TerminalWidget>;
|
|
57
67
|
protected readonly onDidChangeCurrentTerminalEmitter: Emitter<TerminalWidget | undefined>;
|
|
58
68
|
readonly onDidChangeCurrentTerminal: Event<TerminalWidget | undefined>;
|
|
59
69
|
protected readonly contextKeyService: ContextKeyService;
|
|
60
70
|
protected init(): void;
|
|
71
|
+
onStart(app: FrontendApplication): Promise<void>;
|
|
72
|
+
contributeDefaultProfiles(): Promise<void>;
|
|
73
|
+
protected mergePreferences(): Promise<void>;
|
|
74
|
+
protected resolveShellPath(path: string | string[] | undefined): Promise<string | undefined>;
|
|
61
75
|
onWillStop(): OnWillStopAction<number> | undefined;
|
|
62
76
|
protected confirmExitWithActiveTerminals(activeTerminalCount: number): Promise<boolean>;
|
|
63
77
|
protected _currentTerminal: TerminalWidget | undefined;
|
|
@@ -84,9 +98,12 @@ export declare class TerminalFrontendContribution implements FrontendApplication
|
|
|
84
98
|
newTerminal(options: TerminalWidgetOptions): Promise<TerminalWidget>;
|
|
85
99
|
open(widget: TerminalWidget, options?: WidgetOpenerOptions): void;
|
|
86
100
|
protected selectTerminalCwd(): Promise<string | undefined>;
|
|
101
|
+
protected selectTerminalProfile(placeholder: string): Promise<[string, TerminalProfile] | undefined>;
|
|
87
102
|
protected splitTerminal(widget?: Widget): Promise<void>;
|
|
88
103
|
protected getTerminalRef(widget?: Widget): TerminalWidget | undefined;
|
|
89
104
|
protected openTerminal(options?: ApplicationShell.WidgetOptions): Promise<void>;
|
|
105
|
+
protected openTerminalFromProfile(options?: ApplicationShell.WidgetOptions): Promise<void>;
|
|
106
|
+
protected chooseDefaultProfile(): Promise<void>;
|
|
90
107
|
protected openActiveWorkspaceTerminal(options?: ApplicationShell.WidgetOptions): Promise<void>;
|
|
91
108
|
/**
|
|
92
109
|
* It should be aligned with https://code.visualstudio.com/api/references/theme-color#integrated-terminal-colors
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-frontend-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/terminal-frontend-contribution.ts"],"names":[],"mappings":"AAiBA,OAAO,EACH,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EAEjB,gBAAgB,EAChB,OAAO,EACP,KAAK,
|
|
1
|
+
{"version":3,"file":"terminal-frontend-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/terminal-frontend-contribution.ts"],"names":[],"mappings":"AAiBA,OAAO,EACH,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EAEjB,gBAAgB,EAChB,OAAO,EACP,KAAK,EAGR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACH,gBAAgB,EAAE,sBAAsB,EAAgB,aAAa,EAAE,iBAAiB,EACxF,kBAAkB,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAC9E,iBAAiB,EAA2B,+BAA+B,EAAE,gBAAgB,EAAyB,mBAAmB,EAC5I,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAGjH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAoB,MAAM,wBAAwB,CAAC;AACjG,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GAAG,OAAO,CAAC,IAAI,CAAC;cAchF,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;cASrC,2BAA2B,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAMpG;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;CA4D9C"}
|
|
@@ -31,8 +31,10 @@ const browser_1 = require("@theia/core/lib/browser");
|
|
|
31
31
|
const terminal_widget_impl_1 = require("./terminal-widget-impl");
|
|
32
32
|
const terminal_keybinding_contexts_1 = require("./terminal-keybinding-contexts");
|
|
33
33
|
const terminal_widget_1 = require("./base/terminal-widget");
|
|
34
|
+
const terminal_profile_service_1 = require("./terminal-profile-service");
|
|
34
35
|
const uri_command_handler_1 = require("@theia/core/lib/common/uri-command-handler");
|
|
35
36
|
const shell_terminal_protocol_1 = require("../common/shell-terminal-protocol");
|
|
37
|
+
const uri_1 = require("@theia/core/lib/common/uri");
|
|
36
38
|
const core_1 = require("@theia/core");
|
|
37
39
|
const browser_2 = require("@theia/workspace/lib/browser");
|
|
38
40
|
const context_key_service_1 = require("@theia/core/lib/browser/context-key-service");
|
|
@@ -42,6 +44,8 @@ const terminal_watcher_1 = require("../common/terminal-watcher");
|
|
|
42
44
|
const base_terminal_protocol_1 = require("../common/base-terminal-protocol");
|
|
43
45
|
const nls_1 = require("@theia/core/lib/common/nls");
|
|
44
46
|
const terminal_preferences_1 = require("./terminal-preferences");
|
|
47
|
+
const shell_terminal_profile_1 = require("./shell-terminal-profile");
|
|
48
|
+
const browser_3 = require("@theia/variable-resolver/lib/browser");
|
|
45
49
|
var TerminalMenus;
|
|
46
50
|
(function (TerminalMenus) {
|
|
47
51
|
TerminalMenus.TERMINAL = [...core_1.MAIN_MENU_BAR, '7_terminal'];
|
|
@@ -58,12 +62,22 @@ var TerminalCommands;
|
|
|
58
62
|
TerminalCommands.NEW = common_1.Command.toDefaultLocalizedCommand({
|
|
59
63
|
id: 'terminal:new',
|
|
60
64
|
category: TERMINAL_CATEGORY,
|
|
61
|
-
label: 'Create New
|
|
65
|
+
label: 'Create New Terminal'
|
|
66
|
+
});
|
|
67
|
+
TerminalCommands.PROFILE_NEW = common_1.Command.toLocalizedCommand({
|
|
68
|
+
id: 'terminal:new:profile',
|
|
69
|
+
category: TERMINAL_CATEGORY,
|
|
70
|
+
label: 'Create New Integrated Terminal from a Profile'
|
|
71
|
+
});
|
|
72
|
+
TerminalCommands.PROFILE_DEFAULT = common_1.Command.toLocalizedCommand({
|
|
73
|
+
id: 'terminal:profile:default',
|
|
74
|
+
category: TERMINAL_CATEGORY,
|
|
75
|
+
label: 'Choose the default Terminal Profile'
|
|
62
76
|
});
|
|
63
77
|
TerminalCommands.NEW_ACTIVE_WORKSPACE = common_1.Command.toDefaultLocalizedCommand({
|
|
64
78
|
id: 'terminal:new:active:workspace',
|
|
65
79
|
category: TERMINAL_CATEGORY,
|
|
66
|
-
label: 'Create New
|
|
80
|
+
label: 'Create New Terminal (In Active Workspace)'
|
|
67
81
|
});
|
|
68
82
|
TerminalCommands.TERMINAL_CLEAR = common_1.Command.toDefaultLocalizedCommand({
|
|
69
83
|
id: 'terminal:clear',
|
|
@@ -131,6 +145,7 @@ var TerminalCommands;
|
|
|
131
145
|
})(TerminalCommands = exports.TerminalCommands || (exports.TerminalCommands = {}));
|
|
132
146
|
let TerminalFrontendContribution = class TerminalFrontendContribution {
|
|
133
147
|
constructor() {
|
|
148
|
+
this.mergePreferencesPromise = Promise.resolve();
|
|
134
149
|
this.onDidCreateTerminalEmitter = new common_1.Emitter();
|
|
135
150
|
this.onDidCreateTerminal = this.onDidCreateTerminalEmitter.event;
|
|
136
151
|
this.onDidChangeCurrentTerminalEmitter = new common_1.Emitter();
|
|
@@ -163,6 +178,136 @@ let TerminalFrontendContribution = class TerminalFrontendContribution {
|
|
|
163
178
|
});
|
|
164
179
|
});
|
|
165
180
|
}
|
|
181
|
+
async onStart(app) {
|
|
182
|
+
await this.contributeDefaultProfiles();
|
|
183
|
+
this.terminalPreferences.onPreferenceChanged(e => {
|
|
184
|
+
if (e.preferenceName.startsWith('terminal.integrated.')) {
|
|
185
|
+
this.mergePreferencesPromise = this.mergePreferencesPromise.finally(() => this.mergePreferences());
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
this.mergePreferencesPromise = this.mergePreferencesPromise.finally(() => this.mergePreferences());
|
|
189
|
+
this.profileService.onAdded(id => {
|
|
190
|
+
// extension contributions get read after this point: need to set the default profile if necessary
|
|
191
|
+
let defaultProfileId;
|
|
192
|
+
switch (common_1.OS.backend.type()) {
|
|
193
|
+
case common_1.OS.Type.Windows: {
|
|
194
|
+
defaultProfileId = this.terminalPreferences['terminal.integrated.defaultProfile.windows'];
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
case common_1.OS.Type.Linux: {
|
|
198
|
+
defaultProfileId = this.terminalPreferences['terminal.integrated.defaultProfile.linux'];
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
case common_1.OS.Type.OSX: {
|
|
202
|
+
defaultProfileId = this.terminalPreferences['terminal.integrated.defaultProfile.osx'];
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
this.profileService.setDefaultProfile(defaultProfileId);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
async contributeDefaultProfiles() {
|
|
210
|
+
if (common_1.OS.backend.isWindows) {
|
|
211
|
+
this.contributedProfileStore.registerTerminalProfile('cmd', new shell_terminal_profile_1.ShellTerminalProfile(this, {
|
|
212
|
+
shellPath: await this.resolveShellPath([
|
|
213
|
+
'${env:windir}\\Sysnative\\cmd.exe',
|
|
214
|
+
'${env:windir}\\System32\\cmd.exe'
|
|
215
|
+
])
|
|
216
|
+
}));
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
this.contributedProfileStore.registerTerminalProfile('SHELL', new shell_terminal_profile_1.ShellTerminalProfile(this, {
|
|
220
|
+
shellPath: await this.resolveShellPath('${SHELL}'),
|
|
221
|
+
shellArgs: ['-l']
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
// contribute default profiles based on legacy preferences
|
|
225
|
+
}
|
|
226
|
+
async mergePreferences() {
|
|
227
|
+
var _a, _b, _c;
|
|
228
|
+
let profiles;
|
|
229
|
+
let defaultProfile;
|
|
230
|
+
let legacyShellPath;
|
|
231
|
+
let legacyShellArgs;
|
|
232
|
+
const removed = new Set(this.userProfileStore.all.map(([id, profile]) => id));
|
|
233
|
+
switch (common_1.OS.backend.type()) {
|
|
234
|
+
case common_1.OS.Type.Windows: {
|
|
235
|
+
profiles = this.terminalPreferences['terminal.integrated.profiles.windows'];
|
|
236
|
+
defaultProfile = this.terminalPreferences['terminal.integrated.defaultProfile.windows'];
|
|
237
|
+
legacyShellPath = (_a = this.terminalPreferences['terminal.integrated.shell.windows']) !== null && _a !== void 0 ? _a : undefined;
|
|
238
|
+
legacyShellArgs = this.terminalPreferences['terminal.integrated.shellArgs.windows'];
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
case common_1.OS.Type.Linux: {
|
|
242
|
+
profiles = this.terminalPreferences['terminal.integrated.profiles.linux'];
|
|
243
|
+
defaultProfile = this.terminalPreferences['terminal.integrated.defaultProfile.linux'];
|
|
244
|
+
legacyShellPath = (_b = this.terminalPreferences['terminal.integrated.shell.linux']) !== null && _b !== void 0 ? _b : undefined;
|
|
245
|
+
legacyShellArgs = this.terminalPreferences['terminal.integrated.shellArgs.linux'];
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
case common_1.OS.Type.OSX: {
|
|
249
|
+
profiles = this.terminalPreferences['terminal.integrated.profiles.osx'];
|
|
250
|
+
defaultProfile = this.terminalPreferences['terminal.integrated.defaultProfile.osx'];
|
|
251
|
+
legacyShellPath = (_c = this.terminalPreferences['terminal.integrated.shell.osx']) !== null && _c !== void 0 ? _c : undefined;
|
|
252
|
+
legacyShellArgs = this.terminalPreferences['terminal.integrated.shellArgs.osx'];
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (profiles) {
|
|
257
|
+
for (const id of Object.getOwnPropertyNames(profiles)) {
|
|
258
|
+
const profile = profiles[id];
|
|
259
|
+
removed.delete(id);
|
|
260
|
+
if (profile) {
|
|
261
|
+
const shellPath = await this.resolveShellPath(profile.path);
|
|
262
|
+
if (shellPath) {
|
|
263
|
+
const options = {
|
|
264
|
+
shellPath: shellPath,
|
|
265
|
+
shellArgs: profile.args ? await this.variableResolver.resolve(profile.args) : undefined,
|
|
266
|
+
useServerTitle: profile.overrideName ? false : undefined,
|
|
267
|
+
env: profile.env ? await this.variableResolver.resolve(profile.env) : undefined,
|
|
268
|
+
title: profile.overrideName ? id : undefined
|
|
269
|
+
};
|
|
270
|
+
this.userProfileStore.registerTerminalProfile(id, new shell_terminal_profile_1.ShellTerminalProfile(this, options));
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
this.userProfileStore.registerTerminalProfile(id, terminal_profile_service_1.NULL_PROFILE);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (legacyShellPath) {
|
|
279
|
+
this.userProfileStore.registerTerminalProfile('Legacy Shell Preferences', new shell_terminal_profile_1.ShellTerminalProfile(this, {
|
|
280
|
+
shellPath: legacyShellPath,
|
|
281
|
+
shellArgs: legacyShellArgs
|
|
282
|
+
}));
|
|
283
|
+
// if no other default is set, use the legacy preferences as default if they exist
|
|
284
|
+
this.profileService.setDefaultProfile('Legacy Shell Preferences');
|
|
285
|
+
}
|
|
286
|
+
if (defaultProfile && this.profileService.getProfile(defaultProfile)) {
|
|
287
|
+
this.profileService.setDefaultProfile(defaultProfile);
|
|
288
|
+
}
|
|
289
|
+
for (const id of removed) {
|
|
290
|
+
this.userProfileStore.unregisterTerminalProfile(id);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
async resolveShellPath(path) {
|
|
294
|
+
if (!path) {
|
|
295
|
+
return undefined;
|
|
296
|
+
}
|
|
297
|
+
if (typeof path === 'string') {
|
|
298
|
+
path = [path];
|
|
299
|
+
}
|
|
300
|
+
for (const p of path) {
|
|
301
|
+
const resolved = await this.variableResolver.resolve(p);
|
|
302
|
+
if (resolved) {
|
|
303
|
+
const resolvedURI = uri_1.default.fromFilePath(resolved);
|
|
304
|
+
if (await this.fileService.exists(resolvedURI)) {
|
|
305
|
+
return resolved;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return undefined;
|
|
310
|
+
}
|
|
166
311
|
onWillStop() {
|
|
167
312
|
const preferenceValue = this.terminalPreferences['terminal.integrated.confirmOnExit'];
|
|
168
313
|
if (preferenceValue !== 'never') {
|
|
@@ -187,12 +332,12 @@ let TerminalFrontendContribution = class TerminalFrontendContribution {
|
|
|
187
332
|
}
|
|
188
333
|
async confirmExitWithActiveTerminals(activeTerminalCount) {
|
|
189
334
|
const msg = activeTerminalCount === 1
|
|
190
|
-
? nls_1.nls.
|
|
191
|
-
: nls_1.nls.
|
|
335
|
+
? nls_1.nls.localizeByDefault('Do you want to terminate the active terminal session?')
|
|
336
|
+
: nls_1.nls.localizeByDefault('Do you want to terminate the {0} active terminal sessions?', activeTerminalCount);
|
|
192
337
|
const safeToExit = await new browser_1.ConfirmDialog({
|
|
193
338
|
title: '',
|
|
194
339
|
msg,
|
|
195
|
-
ok: nls_1.nls.
|
|
340
|
+
ok: nls_1.nls.localizeByDefault('Terminate'),
|
|
196
341
|
cancel: browser_1.Dialog.CANCEL,
|
|
197
342
|
}).open();
|
|
198
343
|
return safeToExit === true;
|
|
@@ -274,6 +419,12 @@ let TerminalFrontendContribution = class TerminalFrontendContribution {
|
|
|
274
419
|
commands.registerCommand(TerminalCommands.NEW, {
|
|
275
420
|
execute: () => this.openTerminal()
|
|
276
421
|
});
|
|
422
|
+
commands.registerCommand(TerminalCommands.PROFILE_NEW, {
|
|
423
|
+
execute: () => this.openTerminalFromProfile()
|
|
424
|
+
});
|
|
425
|
+
commands.registerCommand(TerminalCommands.PROFILE_DEFAULT, {
|
|
426
|
+
execute: () => this.chooseDefaultProfile()
|
|
427
|
+
});
|
|
277
428
|
commands.registerCommand(TerminalCommands.NEW_ACTIVE_WORKSPACE, {
|
|
278
429
|
execute: () => this.openActiveWorkspaceTerminal()
|
|
279
430
|
});
|
|
@@ -404,9 +555,19 @@ let TerminalFrontendContribution = class TerminalFrontendContribution {
|
|
|
404
555
|
order: '0'
|
|
405
556
|
});
|
|
406
557
|
menus.registerMenuAction(TerminalMenus.TERMINAL_NEW, {
|
|
407
|
-
commandId: TerminalCommands.
|
|
558
|
+
commandId: TerminalCommands.PROFILE_NEW.id,
|
|
559
|
+
label: nls_1.nls.localize('theia/terminal/profileNew', 'New Terminal (With Profile)...'),
|
|
408
560
|
order: '1'
|
|
409
561
|
});
|
|
562
|
+
menus.registerMenuAction(TerminalMenus.TERMINAL_NEW, {
|
|
563
|
+
commandId: TerminalCommands.PROFILE_DEFAULT.id,
|
|
564
|
+
label: nls_1.nls.localize('theia/terminal/profileDefault', 'Choose Default Profile...'),
|
|
565
|
+
order: '3'
|
|
566
|
+
});
|
|
567
|
+
menus.registerMenuAction(TerminalMenus.TERMINAL_NEW, {
|
|
568
|
+
commandId: TerminalCommands.SPLIT.id,
|
|
569
|
+
order: '3'
|
|
570
|
+
});
|
|
410
571
|
menus.registerMenuAction(TerminalMenus.TERMINAL_NAVIGATOR_CONTEXT_MENU, {
|
|
411
572
|
commandId: TerminalCommands.TERMINAL_CONTEXT.id,
|
|
412
573
|
order: 'z'
|
|
@@ -553,14 +714,43 @@ let TerminalFrontendContribution = class TerminalFrontendContribution {
|
|
|
553
714
|
}
|
|
554
715
|
// TODO: reuse WidgetOpenHandler.open
|
|
555
716
|
open(widget, options) {
|
|
556
|
-
|
|
717
|
+
var _a;
|
|
718
|
+
const area = widget.location === terminal_widget_1.TerminalLocation.Editor ? 'main' : 'bottom';
|
|
719
|
+
const widgetOptions = Object.assign({ area: area }, options === null || options === void 0 ? void 0 : options.widgetOptions);
|
|
720
|
+
let preserveFocus = false;
|
|
721
|
+
if (typeof widget.location === 'object') {
|
|
722
|
+
if ('parentTerminal' in widget.location) {
|
|
723
|
+
widgetOptions.ref = this.getById(widget.location.parentTerminal);
|
|
724
|
+
widgetOptions.mode = 'split-right';
|
|
725
|
+
}
|
|
726
|
+
else if ('viewColumn' in widget.location) {
|
|
727
|
+
preserveFocus = (_a = widget.location.preserveFocus) !== null && _a !== void 0 ? _a : false;
|
|
728
|
+
switch (widget.location.viewColumn) {
|
|
729
|
+
case common_1.ViewColumn.Active:
|
|
730
|
+
widgetOptions.ref = this.shell.currentWidget;
|
|
731
|
+
widgetOptions.mode = 'tab-after';
|
|
732
|
+
break;
|
|
733
|
+
case common_1.ViewColumn.Beside:
|
|
734
|
+
widgetOptions.ref = this.shell.currentWidget;
|
|
735
|
+
widgetOptions.mode = 'split-right';
|
|
736
|
+
break;
|
|
737
|
+
default:
|
|
738
|
+
widgetOptions.area = 'main';
|
|
739
|
+
const mainAreaTerminals = this.shell.getWidgets('main').filter(w => w instanceof terminal_widget_1.TerminalWidget && w.isVisible);
|
|
740
|
+
const column = Math.min(widget.location.viewColumn, mainAreaTerminals.length);
|
|
741
|
+
widgetOptions.mode = widget.location.viewColumn <= mainAreaTerminals.length ? 'split-left' : 'split-right';
|
|
742
|
+
widgetOptions.ref = mainAreaTerminals[column - 1];
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
const op = Object.assign(Object.assign({ mode: 'activate' }, options), { widgetOptions: widgetOptions });
|
|
557
747
|
if (!widget.isAttached) {
|
|
558
748
|
this.shell.addWidget(widget, op.widgetOptions);
|
|
559
749
|
}
|
|
560
|
-
if (op.mode === 'activate') {
|
|
750
|
+
if (op.mode === 'activate' && !preserveFocus) {
|
|
561
751
|
this.shell.activateWidget(widget.id);
|
|
562
752
|
}
|
|
563
|
-
else if (op.mode === 'reveal') {
|
|
753
|
+
else if (op.mode === 'reveal' || preserveFocus) {
|
|
564
754
|
this.shell.revealWidget(widget.id);
|
|
565
755
|
}
|
|
566
756
|
}
|
|
@@ -587,6 +777,25 @@ let TerminalFrontendContribution = class TerminalFrontendContribution {
|
|
|
587
777
|
}
|
|
588
778
|
});
|
|
589
779
|
}
|
|
780
|
+
async selectTerminalProfile(placeholder) {
|
|
781
|
+
return new Promise(async (resolve) => {
|
|
782
|
+
var _a;
|
|
783
|
+
const profiles = this.profileService.all;
|
|
784
|
+
if (profiles.length === 0) {
|
|
785
|
+
resolve(undefined);
|
|
786
|
+
}
|
|
787
|
+
else {
|
|
788
|
+
const items = profiles.map(([id, profile]) => ({
|
|
789
|
+
label: id,
|
|
790
|
+
profile
|
|
791
|
+
}));
|
|
792
|
+
const selectedItem = await ((_a = this.quickInputService) === null || _a === void 0 ? void 0 : _a.showQuickPick(items, {
|
|
793
|
+
placeholder
|
|
794
|
+
}));
|
|
795
|
+
resolve(selectedItem ? [selectedItem.label, selectedItem.profile] : undefined);
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
}
|
|
590
799
|
async splitTerminal(widget) {
|
|
591
800
|
const ref = this.getTerminalRef(widget);
|
|
592
801
|
if (ref) {
|
|
@@ -599,10 +808,36 @@ let TerminalFrontendContribution = class TerminalFrontendContribution {
|
|
|
599
808
|
}
|
|
600
809
|
async openTerminal(options) {
|
|
601
810
|
const cwd = await this.selectTerminalCwd();
|
|
602
|
-
|
|
603
|
-
|
|
811
|
+
let profile = this.profileService.defaultProfile;
|
|
812
|
+
if (!profile) {
|
|
813
|
+
throw new Error('There are not profiles registered');
|
|
814
|
+
}
|
|
815
|
+
if (profile instanceof shell_terminal_profile_1.ShellTerminalProfile) {
|
|
816
|
+
profile = profile.modify({ rootURI: cwd });
|
|
817
|
+
}
|
|
818
|
+
const termWidget = await (profile === null || profile === void 0 ? void 0 : profile.start());
|
|
819
|
+
this.open(termWidget, { widgetOptions: options });
|
|
820
|
+
}
|
|
821
|
+
async openTerminalFromProfile(options) {
|
|
822
|
+
const result = await this.selectTerminalProfile(nls_1.nls.localize('theia/terminal/selectProfile', 'Select a profile for the new terminal'));
|
|
823
|
+
if (!result) {
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
let profile = result[1];
|
|
827
|
+
if (profile instanceof shell_terminal_profile_1.ShellTerminalProfile) {
|
|
828
|
+
const cwd = await this.selectTerminalCwd();
|
|
829
|
+
profile = profile.modify({ rootURI: cwd });
|
|
830
|
+
}
|
|
831
|
+
const termWidget = await profile.start();
|
|
604
832
|
this.open(termWidget, { widgetOptions: options });
|
|
605
833
|
}
|
|
834
|
+
async chooseDefaultProfile() {
|
|
835
|
+
const result = await this.selectTerminalProfile(nls_1.nls.localizeByDefault('Select your default terminal profile'));
|
|
836
|
+
if (!result) {
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
this.preferenceService.set(`terminal.integrated.defaultProfile.${common_1.OS.backend.type().toLowerCase()}`, result[0], browser_1.PreferenceScope.User);
|
|
840
|
+
}
|
|
606
841
|
async openActiveWorkspaceTerminal(options) {
|
|
607
842
|
const termWidget = await this.newTerminal({});
|
|
608
843
|
termWidget.start();
|
|
@@ -705,14 +940,34 @@ __decorate([
|
|
|
705
940
|
(0, inversify_1.inject)(browser_2.WorkspaceService),
|
|
706
941
|
__metadata("design:type", browser_2.WorkspaceService)
|
|
707
942
|
], TerminalFrontendContribution.prototype, "workspaceService", void 0);
|
|
943
|
+
__decorate([
|
|
944
|
+
(0, inversify_1.inject)(terminal_profile_service_1.TerminalProfileService),
|
|
945
|
+
__metadata("design:type", Object)
|
|
946
|
+
], TerminalFrontendContribution.prototype, "profileService", void 0);
|
|
947
|
+
__decorate([
|
|
948
|
+
(0, inversify_1.inject)(terminal_profile_service_1.UserTerminalProfileStore),
|
|
949
|
+
__metadata("design:type", Object)
|
|
950
|
+
], TerminalFrontendContribution.prototype, "userProfileStore", void 0);
|
|
951
|
+
__decorate([
|
|
952
|
+
(0, inversify_1.inject)(terminal_profile_service_1.ContributedTerminalProfileStore),
|
|
953
|
+
__metadata("design:type", Object)
|
|
954
|
+
], TerminalFrontendContribution.prototype, "contributedProfileStore", void 0);
|
|
708
955
|
__decorate([
|
|
709
956
|
(0, inversify_1.inject)(terminal_watcher_1.TerminalWatcher),
|
|
710
957
|
__metadata("design:type", terminal_watcher_1.TerminalWatcher)
|
|
711
958
|
], TerminalFrontendContribution.prototype, "terminalWatcher", void 0);
|
|
959
|
+
__decorate([
|
|
960
|
+
(0, inversify_1.inject)(browser_3.VariableResolverService),
|
|
961
|
+
__metadata("design:type", browser_3.VariableResolverService)
|
|
962
|
+
], TerminalFrontendContribution.prototype, "variableResolver", void 0);
|
|
712
963
|
__decorate([
|
|
713
964
|
(0, inversify_1.inject)(browser_1.StorageService),
|
|
714
965
|
__metadata("design:type", Object)
|
|
715
966
|
], TerminalFrontendContribution.prototype, "storageService", void 0);
|
|
967
|
+
__decorate([
|
|
968
|
+
(0, inversify_1.inject)(browser_1.PreferenceService),
|
|
969
|
+
__metadata("design:type", Object)
|
|
970
|
+
], TerminalFrontendContribution.prototype, "preferenceService", void 0);
|
|
716
971
|
__decorate([
|
|
717
972
|
(0, inversify_1.inject)(terminal_preferences_1.TerminalPreferences),
|
|
718
973
|
__metadata("design:type", Object)
|