@theia/terminal 1.42.0 → 1.43.0
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 +1 -1
- package/lib/browser/base/terminal-widget.d.ts.map +1 -1
- package/lib/browser/terminal-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/terminal-frontend-contribution.js +4 -5
- package/lib/browser/terminal-frontend-contribution.js.map +1 -1
- package/lib/browser/terminal-preferences.js +1 -1
- package/lib/browser/terminal-preferences.js.map +1 -1
- package/lib/browser/terminal-widget-impl.d.ts +1 -1
- package/lib/browser/terminal-widget-impl.d.ts.map +1 -1
- package/lib/browser/terminal-widget-impl.js +12 -10
- package/lib/browser/terminal-widget-impl.js.map +1 -1
- package/lib/common/base-terminal-protocol.d.ts +0 -59
- package/lib/common/base-terminal-protocol.d.ts.map +1 -1
- package/lib/common/base-terminal-protocol.js +1 -13
- package/lib/common/base-terminal-protocol.js.map +1 -1
- package/lib/common/shell-terminal-protocol.d.ts +37 -0
- package/lib/common/shell-terminal-protocol.d.ts.map +1 -1
- package/lib/common/shell-terminal-protocol.js +14 -1
- package/lib/common/shell-terminal-protocol.js.map +1 -1
- package/lib/node/base-terminal-server.d.ts +1 -17
- package/lib/node/base-terminal-server.d.ts.map +1 -1
- package/lib/node/base-terminal-server.js +1 -111
- package/lib/node/base-terminal-server.js.map +1 -1
- package/lib/node/shell-process.d.ts +1 -0
- package/lib/node/shell-process.d.ts.map +1 -1
- package/lib/node/shell-process.js +2 -1
- package/lib/node/shell-process.js.map +1 -1
- package/lib/node/shell-terminal-server.d.ts +18 -2
- package/lib/node/shell-terminal-server.d.ts.map +1 -1
- package/lib/node/shell-terminal-server.js +99 -1
- package/lib/node/shell-terminal-server.js.map +1 -1
- package/package.json +9 -9
- package/src/browser/base/terminal-widget.ts +1 -1
- package/src/browser/terminal-frontend-contribution.ts +2 -6
- package/src/browser/terminal-preferences.ts +1 -1
- package/src/browser/terminal-widget-impl.ts +12 -10
- package/src/common/base-terminal-protocol.ts +0 -74
- package/src/common/shell-terminal-protocol.ts +53 -0
- package/src/node/base-terminal-server.ts +1 -136
- package/src/node/shell-process.ts +1 -1
- package/src/node/shell-terminal-server.ts +132 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-terminal-server.js","sourceRoot":"","sources":["../../src/node/shell-terminal-server.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;;;;;;;;;;;;AAEhF,4DAAyE;AACzE,0DAAwD;AACxD,8EAA0E;
|
|
1
|
+
{"version":3,"file":"shell-terminal-server.js","sourceRoot":"","sources":["../../src/node/shell-terminal-server.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;;;;;;;;;;;;AAEhF,4DAAyE;AACzE,0DAAwD;AACxD,8EAA0E;AAC1E,iEAA4D;AAC5D,mDAAmE;AACnE,kDAA0E;AAC1E,kDAAsD;AACtD,oCAAoC;AACpC,+EAI6C;AAC7C,sCAAkC;AAClC,oEAAiE;AAUjE,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,yCAAkB;IAKvD,YACoD,YAAiC,EACzD,cAA8B,EAClB,MAAe;QACnD,KAAK,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QAHkB,iBAAY,GAAZ,YAAY,CAAqB;QAH5E,gBAAW,GA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CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,oBAAoB;QACtB,MAAM,MAAM,GAA2E,EAAE,CAAC;QAE1F,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,mBAAmB,EAAE,OAAO,CAAC,EAAE,EAAE;YAC/D,MAAM,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,OAAO,EAAE,KAAK,CAAC,UAAU,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACvJ,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AAnL6B;IAAzB,IAAA,kBAAM,EAAC,oCAAgB,CAAC;8BAA6B,oCAAgB;6DAAC;AAD9D,mBAAmB;IAD/B,IAAA,sBAAU,GAAE;IAOJ,WAAA,IAAA,kBAAM,EAAC,mCAAmB,CAAC,CAAA;IAC3B,WAAA,IAAA,kBAAM,EAAC,qBAAc,CAAC,CAAA;IACtB,WAAA,IAAA,kBAAM,EAAC,gBAAO,CAAC,CAAA;IAAE,WAAA,IAAA,iBAAK,EAAC,UAAU,CAAC,CAAA;+CADK,qBAAc;GAPjD,mBAAmB,CAoL/B;AApLY,kDAAmB"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/terminal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.0",
|
|
4
4
|
"description": "Theia - Terminal Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.
|
|
7
|
-
"@theia/editor": "1.
|
|
8
|
-
"@theia/filesystem": "1.
|
|
9
|
-
"@theia/process": "1.
|
|
10
|
-
"@theia/variable-resolver": "1.
|
|
11
|
-
"@theia/workspace": "1.
|
|
6
|
+
"@theia/core": "1.43.0",
|
|
7
|
+
"@theia/editor": "1.43.0",
|
|
8
|
+
"@theia/filesystem": "1.43.0",
|
|
9
|
+
"@theia/process": "1.43.0",
|
|
10
|
+
"@theia/variable-resolver": "1.43.0",
|
|
11
|
+
"@theia/workspace": "1.43.0",
|
|
12
12
|
"xterm": "^4.16.0",
|
|
13
13
|
"xterm-addon-fit": "^0.5.0",
|
|
14
14
|
"xterm-addon-search": "^0.8.2"
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"watch": "theiaext watch"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@theia/ext-scripts": "1.
|
|
51
|
+
"@theia/ext-scripts": "1.43.0"
|
|
52
52
|
},
|
|
53
53
|
"nyc": {
|
|
54
54
|
"extends": "../../configs/nyc.json"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "c94caea7fe1cc7c9f05b1c3f55afb6b5eb69bbb2"
|
|
57
57
|
}
|
|
@@ -60,7 +60,7 @@ export abstract class TerminalWidget extends BaseWidget {
|
|
|
60
60
|
abstract processInfo: Promise<TerminalProcessInfo>;
|
|
61
61
|
|
|
62
62
|
/** The ids of extensions contributing to the environment of this terminal mapped to the provided description for their changes. */
|
|
63
|
-
abstract envVarCollectionDescriptionsByExtension: Promise<Map<string, string | MarkdownString | undefined>>;
|
|
63
|
+
abstract envVarCollectionDescriptionsByExtension: Promise<Map<string, (string | MarkdownString | undefined)[]>>;
|
|
64
64
|
|
|
65
65
|
/** Terminal kind that indicates whether a terminal is created by a user or by some extension for a user */
|
|
66
66
|
abstract readonly kind: 'user' | string;
|
|
@@ -51,10 +51,6 @@ import { terminalAnsiColorMap } from './terminal-theme-service';
|
|
|
51
51
|
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
52
52
|
import { FileStat } from '@theia/filesystem/lib/common/files';
|
|
53
53
|
import { TerminalWatcher } from '../common/terminal-watcher';
|
|
54
|
-
import {
|
|
55
|
-
ENVIRONMENT_VARIABLE_COLLECTIONS_KEY,
|
|
56
|
-
SerializableExtensionEnvironmentVariableCollection
|
|
57
|
-
} from '../common/base-terminal-protocol';
|
|
58
54
|
import { nls } from '@theia/core/lib/common/nls';
|
|
59
55
|
import { Profiles, TerminalPreferences } from './terminal-preferences';
|
|
60
56
|
import { ShellTerminalProfile } from './shell-terminal-profile';
|
|
@@ -172,6 +168,7 @@ export namespace TerminalCommands {
|
|
|
172
168
|
});
|
|
173
169
|
}
|
|
174
170
|
|
|
171
|
+
const ENVIRONMENT_VARIABLE_COLLECTIONS_KEY = 'terminal.integrated.environmentVariableCollections';
|
|
175
172
|
@injectable()
|
|
176
173
|
export class TerminalFrontendContribution implements FrontendApplicationContribution, TerminalService, CommandContribution, MenuContribution,
|
|
177
174
|
KeybindingContribution, TabBarToolbarContribution, ColorContribution {
|
|
@@ -252,8 +249,7 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu
|
|
|
252
249
|
this.terminalWatcher.onUpdateTerminalEnvVariablesRequested(() => {
|
|
253
250
|
this.storageService.getData<string>(ENVIRONMENT_VARIABLE_COLLECTIONS_KEY).then(data => {
|
|
254
251
|
if (data) {
|
|
255
|
-
|
|
256
|
-
collectionsJson.forEach(c => this.shellTerminalServer.setCollection(c.extensionIdentifier, true, c.collection ? c.collection : [], c.description));
|
|
252
|
+
this.shellTerminalServer.restorePersisted(data);
|
|
257
253
|
}
|
|
258
254
|
});
|
|
259
255
|
});
|
|
@@ -147,7 +147,7 @@ export const TerminalConfigSchema: PreferenceSchema = {
|
|
|
147
147
|
default: false
|
|
148
148
|
},
|
|
149
149
|
'terminal.integrated.cursorStyle': {
|
|
150
|
-
description: nls.localizeByDefault('Controls the style of terminal cursor.'),
|
|
150
|
+
description: nls.localizeByDefault('Controls the style of terminal cursor when the terminal is focused.'),
|
|
151
151
|
enum: ['block', 'underline', 'line'],
|
|
152
152
|
default: 'block'
|
|
153
153
|
},
|
|
@@ -437,7 +437,7 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
|
|
|
437
437
|
return this.shellTerminalServer.getProcessInfo(this.terminalId);
|
|
438
438
|
}
|
|
439
439
|
|
|
440
|
-
get envVarCollectionDescriptionsByExtension(): Promise<Map<string, string | MarkdownString | undefined>> {
|
|
440
|
+
get envVarCollectionDescriptionsByExtension(): Promise<Map<string, (string | MarkdownString | undefined)[]>> {
|
|
441
441
|
if (!IBaseTerminalServer.validateId(this.terminalId)) {
|
|
442
442
|
return Promise.reject(new Error('terminal is not started'));
|
|
443
443
|
}
|
|
@@ -898,7 +898,7 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
|
|
|
898
898
|
this.enhancedPreviewNode = document.createElement('div');
|
|
899
899
|
|
|
900
900
|
Promise.all([this.envVarCollectionDescriptionsByExtension, this.processId, this.processInfo])
|
|
901
|
-
.then((values: [Map<string, string | MarkdownString | undefined>, number, TerminalProcessInfo]) => {
|
|
901
|
+
.then((values: [Map<string, (string | MarkdownString | undefined)[]>, number, TerminalProcessInfo]) => {
|
|
902
902
|
const extensions = values[0];
|
|
903
903
|
const processId = values[1];
|
|
904
904
|
const processInfo = values[2];
|
|
@@ -911,14 +911,16 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
|
|
|
911
911
|
processInfo.arguments.join(' ') +
|
|
912
912
|
'\n\n---\n\n');
|
|
913
913
|
markdown.appendMarkdown('The following extensions have contributed to this terminal\'s environment:\n');
|
|
914
|
-
extensions.forEach((
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
914
|
+
extensions.forEach((arr, key) => {
|
|
915
|
+
arr.forEach(value => {
|
|
916
|
+
if (value === undefined) {
|
|
917
|
+
markdown.appendMarkdown('* ' + key + '\n');
|
|
918
|
+
} else if (typeof value === 'string') {
|
|
919
|
+
markdown.appendMarkdown('* ' + key + ': ' + value + '\n');
|
|
920
|
+
} else {
|
|
921
|
+
markdown.appendMarkdown('* ' + key + ': ' + value.value + '\n');
|
|
922
|
+
}
|
|
923
|
+
});
|
|
922
924
|
});
|
|
923
925
|
|
|
924
926
|
const enhancedPreviewNode = this.enhancedPreviewNode;
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
import { RpcServer } from '@theia/core/lib/common/messaging/proxy-factory';
|
|
18
18
|
import { Disposable } from '@theia/core';
|
|
19
|
-
import { MarkdownString } from '@theia/core/lib/common/markdown-rendering/markdown-string';
|
|
20
19
|
|
|
21
20
|
export interface TerminalProcessInfo {
|
|
22
21
|
executable: string
|
|
@@ -29,32 +28,12 @@ export interface IBaseTerminalServer extends RpcServer<IBaseTerminalClient> {
|
|
|
29
28
|
create(IBaseTerminalServerOptions: object): Promise<number>;
|
|
30
29
|
getProcessId(id: number): Promise<number>;
|
|
31
30
|
getProcessInfo(id: number): Promise<TerminalProcessInfo>;
|
|
32
|
-
getEnvVarCollectionDescriptionsByExtension(id: number): Promise<Map<string, string | MarkdownString | undefined>>;
|
|
33
31
|
getCwdURI(id: number): Promise<string>;
|
|
34
32
|
resize(id: number, cols: number, rows: number): Promise<void>;
|
|
35
33
|
attach(id: number): Promise<number>;
|
|
36
34
|
onAttachAttempted(id: number): Promise<void>;
|
|
37
35
|
close(id: number): Promise<void>;
|
|
38
36
|
getDefaultShell(): Promise<string>;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Gets a single collection constructed by merging all environment variable collections into
|
|
42
|
-
* one.
|
|
43
|
-
*/
|
|
44
|
-
readonly collections: ReadonlyMap<string, EnvironmentVariableCollection>;
|
|
45
|
-
/**
|
|
46
|
-
* Gets a single collection constructed by merging all environment variable collections into
|
|
47
|
-
* one.
|
|
48
|
-
*/
|
|
49
|
-
readonly mergedCollection: MergedEnvironmentVariableCollection;
|
|
50
|
-
/**
|
|
51
|
-
* Sets an extension's environment variable collection.
|
|
52
|
-
*/
|
|
53
|
-
setCollection(extensionIdentifier: string, persistent: boolean, collection: SerializableEnvironmentVariableCollection, description: string | MarkdownString | undefined): void;
|
|
54
|
-
/**
|
|
55
|
-
* Deletes an extension's environment variable collection.
|
|
56
|
-
*/
|
|
57
|
-
deleteCollection(extensionIdentifier: string): void;
|
|
58
37
|
}
|
|
59
38
|
export namespace IBaseTerminalServer {
|
|
60
39
|
export function validateId(id?: number): boolean {
|
|
@@ -144,56 +123,3 @@ export class DispatchingBaseTerminalClient {
|
|
|
144
123
|
});
|
|
145
124
|
}
|
|
146
125
|
}
|
|
147
|
-
|
|
148
|
-
/*---------------------------------------------------------------------------------------------
|
|
149
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
150
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
151
|
-
*--------------------------------------------------------------------------------------------*/
|
|
152
|
-
// some code copied and modified from https://github.com/microsoft/vscode/blob/1.49.0/src/vs/workbench/contrib/terminal/common/environmentVariable.ts
|
|
153
|
-
|
|
154
|
-
export const ENVIRONMENT_VARIABLE_COLLECTIONS_KEY = 'terminal.integrated.environmentVariableCollections';
|
|
155
|
-
|
|
156
|
-
export interface EnvironmentVariableCollection {
|
|
157
|
-
readonly map: ReadonlyMap<string, EnvironmentVariableMutator>;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export interface EnvironmentVariableCollectionWithPersistence extends EnvironmentVariableCollection {
|
|
161
|
-
readonly persistent: boolean;
|
|
162
|
-
readonly description: string | MarkdownString | undefined;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export enum EnvironmentVariableMutatorType {
|
|
166
|
-
Replace = 1,
|
|
167
|
-
Append = 2,
|
|
168
|
-
Prepend = 3
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export interface EnvironmentVariableMutator {
|
|
172
|
-
readonly value: string;
|
|
173
|
-
readonly type: EnvironmentVariableMutatorType;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export interface ExtensionOwnedEnvironmentVariableMutator extends EnvironmentVariableMutator {
|
|
177
|
-
readonly extensionIdentifier: string;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Represents an environment variable collection that results from merging several collections
|
|
182
|
-
* together.
|
|
183
|
-
*/
|
|
184
|
-
export interface MergedEnvironmentVariableCollection {
|
|
185
|
-
readonly map: ReadonlyMap<string, ExtensionOwnedEnvironmentVariableMutator[]>;
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Applies this collection to a process environment.
|
|
189
|
-
*/
|
|
190
|
-
applyToProcessEnvironment(env: { [key: string]: string | null }): void;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export interface SerializableExtensionEnvironmentVariableCollection {
|
|
194
|
-
extensionIdentifier: string,
|
|
195
|
-
collection: SerializableEnvironmentVariableCollection | undefined,
|
|
196
|
-
description: string | MarkdownString | undefined
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export type SerializableEnvironmentVariableCollection = [string, EnvironmentVariableMutator][];
|
|
@@ -17,11 +17,25 @@
|
|
|
17
17
|
import { RpcProxy } from '@theia/core';
|
|
18
18
|
import { IBaseTerminalServer, IBaseTerminalServerOptions } from './base-terminal-protocol';
|
|
19
19
|
import { OS } from '@theia/core/lib/common/os';
|
|
20
|
+
import { MarkdownString } from '@theia/core/lib/common/markdown-rendering/markdown-string';
|
|
20
21
|
|
|
21
22
|
export const IShellTerminalServer = Symbol('IShellTerminalServer');
|
|
22
23
|
|
|
23
24
|
export interface IShellTerminalServer extends IBaseTerminalServer {
|
|
24
25
|
hasChildProcesses(processId: number | undefined): Promise<boolean>;
|
|
26
|
+
getEnvVarCollectionDescriptionsByExtension(id: number): Promise<Map<string, (string | MarkdownString | undefined)[]>>;
|
|
27
|
+
getEnvVarCollections(): Promise<[string, string, boolean, SerializableEnvironmentVariableCollection][]>;
|
|
28
|
+
|
|
29
|
+
restorePersisted(jsonValue: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Sets an extension's environment variable collection.
|
|
32
|
+
*/
|
|
33
|
+
setCollection(extensionIdentifier: string, rootUri: string, persistent: boolean,
|
|
34
|
+
collection: SerializableEnvironmentVariableCollection, description: string | MarkdownString | undefined): void;
|
|
35
|
+
/**
|
|
36
|
+
* Deletes an extension's environment variable collection.
|
|
37
|
+
*/
|
|
38
|
+
deleteCollection(extensionIdentifier: string): void;
|
|
25
39
|
}
|
|
26
40
|
|
|
27
41
|
export const shellTerminalPath = '/services/shell-terminal';
|
|
@@ -48,3 +62,42 @@ export interface IShellTerminalServerOptions extends IBaseTerminalServerOptions
|
|
|
48
62
|
|
|
49
63
|
export const ShellTerminalServerProxy = Symbol('ShellTerminalServerProxy');
|
|
50
64
|
export type ShellTerminalServerProxy = RpcProxy<IShellTerminalServer>;
|
|
65
|
+
|
|
66
|
+
/*---------------------------------------------------------------------------------------------
|
|
67
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
68
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
69
|
+
*--------------------------------------------------------------------------------------------*/
|
|
70
|
+
// some code copied and modified from https://github.com/microsoft/vscode/blob/1.49.0/src/vs/workbench/contrib/terminal/common/environmentVariable.ts
|
|
71
|
+
|
|
72
|
+
export const NO_ROOT_URI = '<none>';
|
|
73
|
+
|
|
74
|
+
export interface EnvironmentVariableCollection {
|
|
75
|
+
readonly variableMutators: ReadonlyMap<string, EnvironmentVariableMutator>;
|
|
76
|
+
readonly description: string | MarkdownString | undefined;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface EnvironmentVariableCollectionWithPersistence extends EnvironmentVariableCollection {
|
|
80
|
+
readonly persistent: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export enum EnvironmentVariableMutatorType {
|
|
84
|
+
Replace = 1,
|
|
85
|
+
Append = 2,
|
|
86
|
+
Prepend = 3
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface EnvironmentVariableMutatorOptions {
|
|
90
|
+
applyAtProcessCreation?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface EnvironmentVariableMutator {
|
|
94
|
+
readonly value: string;
|
|
95
|
+
readonly type: EnvironmentVariableMutatorType;
|
|
96
|
+
readonly options: EnvironmentVariableMutatorOptions;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface SerializableEnvironmentVariableCollection {
|
|
100
|
+
readonly description: string | MarkdownString | undefined;
|
|
101
|
+
readonly mutators: [string, EnvironmentVariableMutator][]
|
|
102
|
+
};
|
|
103
|
+
|
|
@@ -15,34 +15,22 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ILogger, DisposableCollection
|
|
18
|
+
import { ILogger, DisposableCollection } from '@theia/core/lib/common';
|
|
19
19
|
import {
|
|
20
20
|
IBaseTerminalServer,
|
|
21
21
|
IBaseTerminalServerOptions,
|
|
22
22
|
IBaseTerminalClient,
|
|
23
23
|
TerminalProcessInfo,
|
|
24
|
-
EnvironmentVariableCollection,
|
|
25
|
-
MergedEnvironmentVariableCollection,
|
|
26
|
-
SerializableEnvironmentVariableCollection,
|
|
27
|
-
EnvironmentVariableMutator,
|
|
28
|
-
ExtensionOwnedEnvironmentVariableMutator,
|
|
29
|
-
EnvironmentVariableMutatorType,
|
|
30
|
-
EnvironmentVariableCollectionWithPersistence,
|
|
31
|
-
SerializableExtensionEnvironmentVariableCollection,
|
|
32
24
|
TerminalExitReason
|
|
33
25
|
} from '../common/base-terminal-protocol';
|
|
34
26
|
import { TerminalProcess, ProcessManager, TaskTerminalProcess } from '@theia/process/lib/node';
|
|
35
27
|
import { ShellProcess } from './shell-process';
|
|
36
|
-
import { MarkdownString } from '@theia/core/lib/common/markdown-rendering/markdown-string';
|
|
37
28
|
|
|
38
29
|
@injectable()
|
|
39
30
|
export abstract class BaseTerminalServer implements IBaseTerminalServer {
|
|
40
31
|
protected client: IBaseTerminalClient | undefined = undefined;
|
|
41
32
|
protected terminalToDispose = new Map<number, DisposableCollection>();
|
|
42
33
|
|
|
43
|
-
readonly collections: Map<string, EnvironmentVariableCollectionWithPersistence> = new Map();
|
|
44
|
-
mergedCollection: MergedEnvironmentVariableCollection;
|
|
45
|
-
|
|
46
34
|
constructor(
|
|
47
35
|
@inject(ProcessManager) protected readonly processManager: ProcessManager,
|
|
48
36
|
@inject(ILogger) @named('terminal') protected readonly logger: ILogger
|
|
@@ -54,7 +42,6 @@ export abstract class BaseTerminalServer implements IBaseTerminalServer {
|
|
|
54
42
|
this.terminalToDispose.delete(id);
|
|
55
43
|
}
|
|
56
44
|
});
|
|
57
|
-
this.mergedCollection = this.resolveMergedCollection();
|
|
58
45
|
}
|
|
59
46
|
|
|
60
47
|
abstract create(options: IBaseTerminalServerOptions): Promise<number>;
|
|
@@ -103,18 +90,6 @@ export abstract class BaseTerminalServer implements IBaseTerminalServer {
|
|
|
103
90
|
};
|
|
104
91
|
}
|
|
105
92
|
|
|
106
|
-
async getEnvVarCollectionDescriptionsByExtension(id: number): Promise<Map<string, string | MarkdownString | undefined>> {
|
|
107
|
-
const terminal = this.processManager.get(id);
|
|
108
|
-
if (!(terminal instanceof TerminalProcess)) {
|
|
109
|
-
throw new Error(`terminal "${id}" does not exist`);
|
|
110
|
-
}
|
|
111
|
-
const result = new Map<string, string | MarkdownString | undefined>();
|
|
112
|
-
this.collections.forEach((value, key) => {
|
|
113
|
-
result.set(key, value.description);
|
|
114
|
-
});
|
|
115
|
-
return result;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
93
|
async getCwdURI(id: number): Promise<string> {
|
|
119
94
|
const terminal = this.processManager.get(id);
|
|
120
95
|
if (!(terminal instanceof TerminalProcess)) {
|
|
@@ -195,114 +170,4 @@ export abstract class BaseTerminalServer implements IBaseTerminalServer {
|
|
|
195
170
|
const toDispose = this.notifyClientOnExit(term);
|
|
196
171
|
this.terminalToDispose.set(term.id, toDispose);
|
|
197
172
|
}
|
|
198
|
-
|
|
199
|
-
/*---------------------------------------------------------------------------------------------
|
|
200
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
201
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
202
|
-
*--------------------------------------------------------------------------------------------*/
|
|
203
|
-
// some code copied and modified from https://github.com/microsoft/vscode/blob/1.49.0/src/vs/workbench/contrib/terminal/common/environmentVariableService.ts
|
|
204
|
-
|
|
205
|
-
setCollection(extensionIdentifier: string, persistent: boolean, collection: SerializableEnvironmentVariableCollection, description: string | MarkdownString | undefined): void {
|
|
206
|
-
const translatedCollection = { persistent, description, map: new Map<string, EnvironmentVariableMutator>(collection) };
|
|
207
|
-
this.collections.set(extensionIdentifier, translatedCollection);
|
|
208
|
-
this.updateCollections();
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
deleteCollection(extensionIdentifier: string): void {
|
|
212
|
-
this.collections.delete(extensionIdentifier);
|
|
213
|
-
this.updateCollections();
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
private updateCollections(): void {
|
|
217
|
-
this.persistCollections();
|
|
218
|
-
this.mergedCollection = this.resolveMergedCollection();
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
protected persistCollections(): void {
|
|
222
|
-
const collectionsJson: SerializableExtensionEnvironmentVariableCollection[] = [];
|
|
223
|
-
this.collections.forEach((collection, extensionIdentifier) => {
|
|
224
|
-
if (collection.persistent) {
|
|
225
|
-
collectionsJson.push({
|
|
226
|
-
extensionIdentifier,
|
|
227
|
-
collection: [...this.collections.get(extensionIdentifier)!.map.entries()],
|
|
228
|
-
description: collection.description
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
if (this.client) {
|
|
233
|
-
const stringifiedJson = JSON.stringify(collectionsJson);
|
|
234
|
-
this.client.storeTerminalEnvVariables(stringifiedJson);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
private resolveMergedCollection(): MergedEnvironmentVariableCollection {
|
|
239
|
-
return new MergedEnvironmentVariableCollectionImpl(this.collections);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/*---------------------------------------------------------------------------------------------
|
|
245
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
246
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
247
|
-
*--------------------------------------------------------------------------------------------*/
|
|
248
|
-
// some code copied and modified from https://github.com/microsoft/vscode/blob/1.49.0/src/vs/workbench/contrib/terminal/common/environmentVariableCollection.ts
|
|
249
|
-
|
|
250
|
-
export class MergedEnvironmentVariableCollectionImpl implements MergedEnvironmentVariableCollection {
|
|
251
|
-
readonly map: Map<string, ExtensionOwnedEnvironmentVariableMutator[]> = new Map();
|
|
252
|
-
|
|
253
|
-
constructor(collections: Map<string, EnvironmentVariableCollection>) {
|
|
254
|
-
collections.forEach((collection, extensionIdentifier) => {
|
|
255
|
-
const it = collection.map.entries();
|
|
256
|
-
let next = it.next();
|
|
257
|
-
while (!next.done) {
|
|
258
|
-
const variable = next.value[0];
|
|
259
|
-
let entry = this.map.get(variable);
|
|
260
|
-
if (!entry) {
|
|
261
|
-
entry = [];
|
|
262
|
-
this.map.set(variable, entry);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// If the first item in the entry is replace ignore any other entries as they would
|
|
266
|
-
// just get replaced by this one.
|
|
267
|
-
if (entry.length > 0 && entry[0].type === EnvironmentVariableMutatorType.Replace) {
|
|
268
|
-
next = it.next();
|
|
269
|
-
continue;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// Mutators get applied in the reverse order than they are created
|
|
273
|
-
const mutator = next.value[1];
|
|
274
|
-
entry.unshift({
|
|
275
|
-
extensionIdentifier,
|
|
276
|
-
value: mutator.value,
|
|
277
|
-
type: mutator.type
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
next = it.next();
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
applyToProcessEnvironment(env: { [key: string]: string | null }): void {
|
|
286
|
-
let lowerToActualVariableNames: { [lowerKey: string]: string | undefined } | undefined;
|
|
287
|
-
if (isWindows) {
|
|
288
|
-
lowerToActualVariableNames = {};
|
|
289
|
-
Object.keys(env).forEach(e => lowerToActualVariableNames![e.toLowerCase()] = e);
|
|
290
|
-
}
|
|
291
|
-
this.map.forEach((mutators, variable) => {
|
|
292
|
-
const actualVariable = isWindows ? lowerToActualVariableNames![variable.toLowerCase()] || variable : variable;
|
|
293
|
-
mutators.forEach(mutator => {
|
|
294
|
-
switch (mutator.type) {
|
|
295
|
-
case EnvironmentVariableMutatorType.Append:
|
|
296
|
-
env[actualVariable] = (env[actualVariable] || '') + mutator.value;
|
|
297
|
-
break;
|
|
298
|
-
case EnvironmentVariableMutatorType.Prepend:
|
|
299
|
-
env[actualVariable] = mutator.value + (env[actualVariable] || '');
|
|
300
|
-
break;
|
|
301
|
-
case EnvironmentVariableMutatorType.Replace:
|
|
302
|
-
env[actualVariable] = mutator.value;
|
|
303
|
-
break;
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
173
|
}
|
|
@@ -39,7 +39,7 @@ export interface ShellProcessOptions {
|
|
|
39
39
|
isPseudo?: boolean,
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
function getRootPath(rootURI?: string): string {
|
|
42
|
+
export function getRootPath(rootURI?: string): string {
|
|
43
43
|
if (rootURI) {
|
|
44
44
|
const uri = new URI(rootURI);
|
|
45
45
|
return FileUri.fsPath(uri);
|