@codingame/monaco-vscode-xterm-common 24.1.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/empty.js +1 -0
- package/package.json +45 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.d.ts +11 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.js +26 -0
- package/vscode/src/vs/platform/terminal/common/environmentVariable.d.ts +86 -0
- package/vscode/src/vs/platform/terminal/common/environmentVariable.js +10 -0
- package/vscode/src/vs/platform/terminal/common/environmentVariableCollection.d.ts +17 -0
- package/vscode/src/vs/platform/terminal/common/environmentVariableCollection.js +214 -0
- package/vscode/src/vs/platform/terminal/common/terminalRecorder.d.ts +14 -0
- package/vscode/src/vs/platform/terminal/common/terminalRecorder.js +75 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +125 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.d.ts +104 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.js +1554 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalContextMenu.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalContextMenu.js +45 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.js +82 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.d.ts +408 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.js +2338 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.d.ts +143 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +684 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.js +68 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalStatusList.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalStatusList.js +135 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.js +754 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.js +112 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.js +59 -0
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.js +319 -0
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalStorageKeys.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalStorageKeys.js +17 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.d.ts +58 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.js +69 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/media/stickyScroll.css +49 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.js +25 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollContribution.d.ts +35 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollContribution.js +117 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +428 -0
package/empty.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codingame/monaco-vscode-xterm-common",
|
|
3
|
+
"version": "24.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "VSCode public API plugged on the monaco editor - common package depending on xterm",
|
|
6
|
+
"keywords": [],
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "CodinGame",
|
|
9
|
+
"url": "http://www.codingame.com"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@codingame/monaco-vscode-api": "24.1.0",
|
|
19
|
+
"@codingame/monaco-vscode-xterm-addons-common": "24.1.0",
|
|
20
|
+
"@xterm/xterm": "5.6.0-beta.137"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"default": "./empty.js"
|
|
25
|
+
},
|
|
26
|
+
"./vscode/*.css": {
|
|
27
|
+
"default": "./vscode/src/*.css"
|
|
28
|
+
},
|
|
29
|
+
"./vscode/*": {
|
|
30
|
+
"types": "./vscode/src/*.d.ts",
|
|
31
|
+
"default": "./vscode/src/*.js"
|
|
32
|
+
},
|
|
33
|
+
"./*": {
|
|
34
|
+
"types": "./*.d.ts",
|
|
35
|
+
"default": "./*.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"typesVersions": {
|
|
39
|
+
"*": {
|
|
40
|
+
"vscode/*": [
|
|
41
|
+
"./vscode/src/*.d.ts"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ITerminalChildProcess } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal";
|
|
2
|
+
import { TerminalCapability, INaiveCwdDetectionCapability } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities";
|
|
3
|
+
export declare class NaiveCwdDetectionCapability implements INaiveCwdDetectionCapability {
|
|
4
|
+
private readonly _process;
|
|
5
|
+
constructor(_process: ITerminalChildProcess);
|
|
6
|
+
readonly type = TerminalCapability.NaiveCwdDetection;
|
|
7
|
+
private _cwd;
|
|
8
|
+
private readonly _onDidChangeCwd;
|
|
9
|
+
readonly onDidChangeCwd: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<string>;
|
|
10
|
+
getCwd(): Promise<string>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
3
|
+
import { TerminalCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities';
|
|
4
|
+
|
|
5
|
+
class NaiveCwdDetectionCapability {
|
|
6
|
+
constructor(_process) {
|
|
7
|
+
this._process = _process;
|
|
8
|
+
this.type = TerminalCapability.NaiveCwdDetection;
|
|
9
|
+
this._cwd = '';
|
|
10
|
+
this._onDidChangeCwd = ( new Emitter());
|
|
11
|
+
this.onDidChangeCwd = this._onDidChangeCwd.event;
|
|
12
|
+
}
|
|
13
|
+
async getCwd() {
|
|
14
|
+
if (!this._process) {
|
|
15
|
+
return Promise.resolve('');
|
|
16
|
+
}
|
|
17
|
+
const newCwd = await this._process.getCwd();
|
|
18
|
+
if (newCwd !== this._cwd) {
|
|
19
|
+
this._onDidChangeCwd.fire(newCwd);
|
|
20
|
+
}
|
|
21
|
+
this._cwd = newCwd;
|
|
22
|
+
return this._cwd;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { NaiveCwdDetectionCapability };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { IProcessEnvironment } from "@codingame/monaco-vscode-api/vscode/vs/base/common/platform";
|
|
2
|
+
import { IWorkspaceFolderData } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace";
|
|
3
|
+
export declare enum EnvironmentVariableMutatorType {
|
|
4
|
+
Replace = 1,
|
|
5
|
+
Append = 2,
|
|
6
|
+
Prepend = 3
|
|
7
|
+
}
|
|
8
|
+
export interface IEnvironmentVariableMutator {
|
|
9
|
+
readonly variable: string;
|
|
10
|
+
readonly value: string;
|
|
11
|
+
readonly type: EnvironmentVariableMutatorType;
|
|
12
|
+
readonly scope?: EnvironmentVariableScope;
|
|
13
|
+
readonly options?: IEnvironmentVariableMutatorOptions;
|
|
14
|
+
}
|
|
15
|
+
export interface IEnvironmentVariableCollectionDescription {
|
|
16
|
+
readonly description: string | undefined;
|
|
17
|
+
readonly scope?: EnvironmentVariableScope;
|
|
18
|
+
}
|
|
19
|
+
export interface IEnvironmentVariableMutatorOptions {
|
|
20
|
+
applyAtProcessCreation?: boolean;
|
|
21
|
+
applyAtShellIntegration?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export type EnvironmentVariableScope = {
|
|
24
|
+
workspaceFolder?: IWorkspaceFolderData;
|
|
25
|
+
};
|
|
26
|
+
export interface IEnvironmentVariableCollection {
|
|
27
|
+
readonly map: ReadonlyMap<string, IEnvironmentVariableMutator>;
|
|
28
|
+
readonly descriptionMap?: ReadonlyMap<string, IEnvironmentVariableCollectionDescription>;
|
|
29
|
+
}
|
|
30
|
+
/** [variable, mutator] */
|
|
31
|
+
export type ISerializableEnvironmentVariableCollection = [
|
|
32
|
+
string,
|
|
33
|
+
IEnvironmentVariableMutator
|
|
34
|
+
][];
|
|
35
|
+
export type ISerializableEnvironmentDescriptionMap = [
|
|
36
|
+
string,
|
|
37
|
+
IEnvironmentVariableCollectionDescription
|
|
38
|
+
][];
|
|
39
|
+
export interface IExtensionOwnedEnvironmentDescriptionMutator extends IEnvironmentVariableCollectionDescription {
|
|
40
|
+
readonly extensionIdentifier: string;
|
|
41
|
+
}
|
|
42
|
+
/** [extension, collection, description] */
|
|
43
|
+
export type ISerializableEnvironmentVariableCollections = [
|
|
44
|
+
string,
|
|
45
|
+
ISerializableEnvironmentVariableCollection,
|
|
46
|
+
ISerializableEnvironmentDescriptionMap
|
|
47
|
+
][];
|
|
48
|
+
export interface IExtensionOwnedEnvironmentVariableMutator extends IEnvironmentVariableMutator {
|
|
49
|
+
readonly extensionIdentifier: string;
|
|
50
|
+
}
|
|
51
|
+
export interface IMergedEnvironmentVariableCollectionDiff {
|
|
52
|
+
added: ReadonlyMap<string, IExtensionOwnedEnvironmentVariableMutator[]>;
|
|
53
|
+
changed: ReadonlyMap<string, IExtensionOwnedEnvironmentVariableMutator[]>;
|
|
54
|
+
removed: ReadonlyMap<string, IExtensionOwnedEnvironmentVariableMutator[]>;
|
|
55
|
+
}
|
|
56
|
+
type VariableResolver = (str: string) => Promise<string>;
|
|
57
|
+
/**
|
|
58
|
+
* Represents an environment variable collection that results from merging several collections
|
|
59
|
+
* together.
|
|
60
|
+
*/
|
|
61
|
+
export interface IMergedEnvironmentVariableCollection {
|
|
62
|
+
readonly collections: ReadonlyMap<string, IEnvironmentVariableCollection>;
|
|
63
|
+
/**
|
|
64
|
+
* Gets the variable map for a given scope.
|
|
65
|
+
* @param scope The scope to get the variable map for. If undefined, the global scope is used.
|
|
66
|
+
*/
|
|
67
|
+
getVariableMap(scope: EnvironmentVariableScope | undefined): Map<string, IExtensionOwnedEnvironmentVariableMutator[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Gets the description map for a given scope.
|
|
70
|
+
* @param scope The scope to get the description map for. If undefined, description map for the
|
|
71
|
+
* global scope is returned.
|
|
72
|
+
*/
|
|
73
|
+
getDescriptionMap(scope: EnvironmentVariableScope | undefined): Map<string, string | undefined>;
|
|
74
|
+
/**
|
|
75
|
+
* Applies this collection to a process environment.
|
|
76
|
+
* @param variableResolver An optional function to use to resolve variables within the
|
|
77
|
+
* environment values.
|
|
78
|
+
*/
|
|
79
|
+
applyToProcessEnvironment(env: IProcessEnvironment, scope: EnvironmentVariableScope | undefined, variableResolver?: VariableResolver): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Generates a diff of this collection against another. Returns undefined if the collections are
|
|
82
|
+
* the same.
|
|
83
|
+
*/
|
|
84
|
+
diff(other: IMergedEnvironmentVariableCollection, scope: EnvironmentVariableScope | undefined): IMergedEnvironmentVariableCollectionDiff | undefined;
|
|
85
|
+
}
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
var EnvironmentVariableMutatorType;
|
|
4
|
+
(function (EnvironmentVariableMutatorType) {
|
|
5
|
+
EnvironmentVariableMutatorType[EnvironmentVariableMutatorType["Replace"] = 1] = "Replace";
|
|
6
|
+
EnvironmentVariableMutatorType[EnvironmentVariableMutatorType["Append"] = 2] = "Append";
|
|
7
|
+
EnvironmentVariableMutatorType[EnvironmentVariableMutatorType["Prepend"] = 3] = "Prepend";
|
|
8
|
+
})(EnvironmentVariableMutatorType || (EnvironmentVariableMutatorType = {}));
|
|
9
|
+
|
|
10
|
+
export { EnvironmentVariableMutatorType };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IProcessEnvironment } from "@codingame/monaco-vscode-api/vscode/vs/base/common/platform";
|
|
2
|
+
import { EnvironmentVariableScope, IEnvironmentVariableCollection, IExtensionOwnedEnvironmentVariableMutator, IMergedEnvironmentVariableCollection, IMergedEnvironmentVariableCollectionDiff } from "./environmentVariable.js";
|
|
3
|
+
type VariableResolver = (str: string) => Promise<string>;
|
|
4
|
+
export declare class MergedEnvironmentVariableCollection implements IMergedEnvironmentVariableCollection {
|
|
5
|
+
readonly collections: ReadonlyMap<string, IEnvironmentVariableCollection>;
|
|
6
|
+
private readonly map;
|
|
7
|
+
private readonly descriptionMap;
|
|
8
|
+
constructor(collections: ReadonlyMap<string, IEnvironmentVariableCollection>);
|
|
9
|
+
applyToProcessEnvironment(env: IProcessEnvironment, scope: EnvironmentVariableScope | undefined, variableResolver?: VariableResolver): Promise<void>;
|
|
10
|
+
private _encodeColons;
|
|
11
|
+
private blockPythonActivationVar;
|
|
12
|
+
diff(other: IMergedEnvironmentVariableCollection, scope: EnvironmentVariableScope | undefined): IMergedEnvironmentVariableCollectionDiff | undefined;
|
|
13
|
+
getVariableMap(scope: EnvironmentVariableScope | undefined): Map<string, IExtensionOwnedEnvironmentVariableMutator[]>;
|
|
14
|
+
getDescriptionMap(scope: EnvironmentVariableScope | undefined): Map<string, string | undefined>;
|
|
15
|
+
private populateDescriptionMap;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
|
|
2
|
+
import { isWindows } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
3
|
+
import { EnvironmentVariableMutatorType } from './environmentVariable.js';
|
|
4
|
+
|
|
5
|
+
const mutatorTypeToLabelMap = ( new Map([
|
|
6
|
+
[EnvironmentVariableMutatorType.Append, 'APPEND'],
|
|
7
|
+
[EnvironmentVariableMutatorType.Prepend, 'PREPEND'],
|
|
8
|
+
[EnvironmentVariableMutatorType.Replace, 'REPLACE']
|
|
9
|
+
]));
|
|
10
|
+
const PYTHON_ACTIVATION_VARS_PATTERN = /^VSCODE_PYTHON_(PWSH|ZSH|BASH|FISH)_ACTIVATE/;
|
|
11
|
+
const PYTHON_ENV_EXTENSION_ID = 'ms-python.vscode-python-envs';
|
|
12
|
+
class MergedEnvironmentVariableCollection {
|
|
13
|
+
constructor(collections) {
|
|
14
|
+
this.collections = collections;
|
|
15
|
+
this.map = ( new Map());
|
|
16
|
+
this.descriptionMap = ( new Map());
|
|
17
|
+
collections.forEach((collection, extensionIdentifier) => {
|
|
18
|
+
this.populateDescriptionMap(collection, extensionIdentifier);
|
|
19
|
+
const it = collection.map.entries();
|
|
20
|
+
let next = it.next();
|
|
21
|
+
while (!next.done) {
|
|
22
|
+
const mutator = next.value[1];
|
|
23
|
+
const key = next.value[0];
|
|
24
|
+
if (this.blockPythonActivationVar(key, extensionIdentifier)) {
|
|
25
|
+
next = it.next();
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
let entry = this.map.get(key);
|
|
29
|
+
if (!entry) {
|
|
30
|
+
entry = [];
|
|
31
|
+
this.map.set(key, entry);
|
|
32
|
+
}
|
|
33
|
+
if (entry.length > 0 && entry[0].type === EnvironmentVariableMutatorType.Replace) {
|
|
34
|
+
next = it.next();
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const extensionMutator = {
|
|
38
|
+
extensionIdentifier,
|
|
39
|
+
value: mutator.value,
|
|
40
|
+
type: mutator.type,
|
|
41
|
+
scope: mutator.scope,
|
|
42
|
+
variable: mutator.variable,
|
|
43
|
+
options: mutator.options
|
|
44
|
+
};
|
|
45
|
+
if (!extensionMutator.scope) {
|
|
46
|
+
delete extensionMutator.scope;
|
|
47
|
+
}
|
|
48
|
+
entry.unshift(extensionMutator);
|
|
49
|
+
next = it.next();
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async applyToProcessEnvironment(env, scope, variableResolver) {
|
|
54
|
+
let lowerToActualVariableNames;
|
|
55
|
+
if (isWindows) {
|
|
56
|
+
lowerToActualVariableNames = {};
|
|
57
|
+
( Object.keys(env)).forEach(e => lowerToActualVariableNames[e.toLowerCase()] = e);
|
|
58
|
+
}
|
|
59
|
+
for (const [variable, mutators] of this.getVariableMap(scope)) {
|
|
60
|
+
const actualVariable = isWindows ? lowerToActualVariableNames[variable.toLowerCase()] || variable : variable;
|
|
61
|
+
for (const mutator of mutators) {
|
|
62
|
+
const value = variableResolver ? await variableResolver(mutator.value) : mutator.value;
|
|
63
|
+
if (this.blockPythonActivationVar(mutator.variable, mutator.extensionIdentifier)) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (mutator.options?.applyAtProcessCreation ?? true) {
|
|
67
|
+
switch (mutator.type) {
|
|
68
|
+
case EnvironmentVariableMutatorType.Append:
|
|
69
|
+
env[actualVariable] = (env[actualVariable] || '') + value;
|
|
70
|
+
break;
|
|
71
|
+
case EnvironmentVariableMutatorType.Prepend:
|
|
72
|
+
env[actualVariable] = value + (env[actualVariable] || '');
|
|
73
|
+
break;
|
|
74
|
+
case EnvironmentVariableMutatorType.Replace:
|
|
75
|
+
env[actualVariable] = value;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (mutator.options?.applyAtShellIntegration ?? false) {
|
|
80
|
+
const key = `VSCODE_ENV_${mutatorTypeToLabelMap.get(mutator.type)}`;
|
|
81
|
+
env[key] = (env[key] ? env[key] + ':' : '') + variable + '=' + this._encodeColons(value);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
_encodeColons(value) {
|
|
87
|
+
return value.replaceAll(':', '\\x3a');
|
|
88
|
+
}
|
|
89
|
+
blockPythonActivationVar(variable, extensionIdentifier) {
|
|
90
|
+
if (PYTHON_ACTIVATION_VARS_PATTERN.test(variable) && PYTHON_ENV_EXTENSION_ID !== extensionIdentifier) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
diff(other, scope) {
|
|
96
|
+
const added = ( new Map());
|
|
97
|
+
const changed = ( new Map());
|
|
98
|
+
const removed = ( new Map());
|
|
99
|
+
other.getVariableMap(scope).forEach((otherMutators, variable) => {
|
|
100
|
+
const currentMutators = this.getVariableMap(scope).get(variable);
|
|
101
|
+
const result = getMissingMutatorsFromArray(otherMutators, currentMutators);
|
|
102
|
+
if (result) {
|
|
103
|
+
added.set(variable, result);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
this.getVariableMap(scope).forEach((currentMutators, variable) => {
|
|
107
|
+
const otherMutators = other.getVariableMap(scope).get(variable);
|
|
108
|
+
const result = getMissingMutatorsFromArray(currentMutators, otherMutators);
|
|
109
|
+
if (result) {
|
|
110
|
+
removed.set(variable, result);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
this.getVariableMap(scope).forEach((currentMutators, variable) => {
|
|
114
|
+
const otherMutators = other.getVariableMap(scope).get(variable);
|
|
115
|
+
const result = getChangedMutatorsFromArray(currentMutators, otherMutators);
|
|
116
|
+
if (result) {
|
|
117
|
+
changed.set(variable, result);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
if (added.size === 0 && changed.size === 0 && removed.size === 0) {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
return { added, changed, removed };
|
|
124
|
+
}
|
|
125
|
+
getVariableMap(scope) {
|
|
126
|
+
const result = ( new Map());
|
|
127
|
+
for (const mutators of ( this.map.values())) {
|
|
128
|
+
const filteredMutators = mutators.filter(m => filterScope(m, scope));
|
|
129
|
+
if (filteredMutators.length > 0) {
|
|
130
|
+
result.set(filteredMutators[0].variable, filteredMutators);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
getDescriptionMap(scope) {
|
|
136
|
+
const result = ( new Map());
|
|
137
|
+
for (const mutators of ( this.descriptionMap.values())) {
|
|
138
|
+
const filteredMutators = mutators.filter(m => filterScope(m, scope, true));
|
|
139
|
+
for (const mutator of filteredMutators) {
|
|
140
|
+
result.set(mutator.extensionIdentifier, mutator.description);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
populateDescriptionMap(collection, extensionIdentifier) {
|
|
146
|
+
if (!collection.descriptionMap) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const it = collection.descriptionMap.entries();
|
|
150
|
+
let next = it.next();
|
|
151
|
+
while (!next.done) {
|
|
152
|
+
const mutator = next.value[1];
|
|
153
|
+
const key = next.value[0];
|
|
154
|
+
let entry = this.descriptionMap.get(key);
|
|
155
|
+
if (!entry) {
|
|
156
|
+
entry = [];
|
|
157
|
+
this.descriptionMap.set(key, entry);
|
|
158
|
+
}
|
|
159
|
+
const extensionMutator = {
|
|
160
|
+
extensionIdentifier,
|
|
161
|
+
scope: mutator.scope,
|
|
162
|
+
description: mutator.description
|
|
163
|
+
};
|
|
164
|
+
if (!extensionMutator.scope) {
|
|
165
|
+
delete extensionMutator.scope;
|
|
166
|
+
}
|
|
167
|
+
entry.push(extensionMutator);
|
|
168
|
+
next = it.next();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function filterScope(mutator, scope, strictFilter = false) {
|
|
173
|
+
if (!mutator.scope) {
|
|
174
|
+
if (strictFilter) {
|
|
175
|
+
return scope === mutator.scope;
|
|
176
|
+
}
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
if (mutator.scope.workspaceFolder && scope?.workspaceFolder && mutator.scope.workspaceFolder.index === scope.workspaceFolder.index) {
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
function getMissingMutatorsFromArray(current, other) {
|
|
185
|
+
if (!other) {
|
|
186
|
+
return current;
|
|
187
|
+
}
|
|
188
|
+
const otherMutatorExtensions = ( new Set());
|
|
189
|
+
other.forEach(m => otherMutatorExtensions.add(m.extensionIdentifier));
|
|
190
|
+
const result = [];
|
|
191
|
+
current.forEach(mutator => {
|
|
192
|
+
if (!( otherMutatorExtensions.has(mutator.extensionIdentifier))) {
|
|
193
|
+
result.push(mutator);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
return result.length === 0 ? undefined : result;
|
|
197
|
+
}
|
|
198
|
+
function getChangedMutatorsFromArray(current, other) {
|
|
199
|
+
if (!other) {
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
202
|
+
const otherMutatorExtensions = ( new Map());
|
|
203
|
+
other.forEach(m => otherMutatorExtensions.set(m.extensionIdentifier, m));
|
|
204
|
+
const result = [];
|
|
205
|
+
current.forEach(mutator => {
|
|
206
|
+
const otherMutator = otherMutatorExtensions.get(mutator.extensionIdentifier);
|
|
207
|
+
if (otherMutator && (mutator.type !== otherMutator.type || mutator.value !== otherMutator.value || mutator.scope?.workspaceFolder?.index !== otherMutator.scope?.workspaceFolder?.index)) {
|
|
208
|
+
result.push(otherMutator);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
return result.length === 0 ? undefined : result;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export { MergedEnvironmentVariableCollection };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IPtyHostProcessReplayEvent } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities";
|
|
2
|
+
import { ReplayEntry } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminalProcess";
|
|
3
|
+
export interface IRemoteTerminalProcessReplayEvent {
|
|
4
|
+
events: ReplayEntry[];
|
|
5
|
+
}
|
|
6
|
+
export declare class TerminalRecorder {
|
|
7
|
+
private _entries;
|
|
8
|
+
private _totalDataLength;
|
|
9
|
+
constructor(cols: number, rows: number);
|
|
10
|
+
handleResize(cols: number, rows: number): void;
|
|
11
|
+
handleData(data: string): void;
|
|
12
|
+
generateReplayEventSync(): IPtyHostProcessReplayEvent;
|
|
13
|
+
generateReplayEvent(): Promise<IPtyHostProcessReplayEvent>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
var Constants;
|
|
4
|
+
(function (Constants) {
|
|
5
|
+
Constants[Constants["MaxRecorderDataSize"] = 10485760] = "MaxRecorderDataSize";
|
|
6
|
+
})(Constants || (Constants = {}));
|
|
7
|
+
class TerminalRecorder {
|
|
8
|
+
constructor(cols, rows) {
|
|
9
|
+
this._totalDataLength = 0;
|
|
10
|
+
this._entries = [{ cols, rows, data: [] }];
|
|
11
|
+
}
|
|
12
|
+
handleResize(cols, rows) {
|
|
13
|
+
if (this._entries.length > 0) {
|
|
14
|
+
const lastEntry = this._entries[this._entries.length - 1];
|
|
15
|
+
if (lastEntry.data.length === 0) {
|
|
16
|
+
this._entries.pop();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (this._entries.length > 0) {
|
|
20
|
+
const lastEntry = this._entries[this._entries.length - 1];
|
|
21
|
+
if (lastEntry.cols === cols && lastEntry.rows === rows) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (lastEntry.cols === 0 && lastEntry.rows === 0) {
|
|
25
|
+
lastEntry.cols = cols;
|
|
26
|
+
lastEntry.rows = rows;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
this._entries.push({ cols, rows, data: [] });
|
|
31
|
+
}
|
|
32
|
+
handleData(data) {
|
|
33
|
+
const lastEntry = this._entries[this._entries.length - 1];
|
|
34
|
+
lastEntry.data.push(data);
|
|
35
|
+
this._totalDataLength += data.length;
|
|
36
|
+
while (this._totalDataLength > Constants.MaxRecorderDataSize) {
|
|
37
|
+
const firstEntry = this._entries[0];
|
|
38
|
+
const remainingToDelete = this._totalDataLength - Constants.MaxRecorderDataSize;
|
|
39
|
+
if (remainingToDelete >= firstEntry.data[0].length) {
|
|
40
|
+
this._totalDataLength -= firstEntry.data[0].length;
|
|
41
|
+
firstEntry.data.shift();
|
|
42
|
+
if (firstEntry.data.length === 0) {
|
|
43
|
+
this._entries.shift();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
firstEntry.data[0] = firstEntry.data[0].substr(remainingToDelete);
|
|
48
|
+
this._totalDataLength -= remainingToDelete;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
generateReplayEventSync() {
|
|
53
|
+
this._entries.forEach((entry) => {
|
|
54
|
+
if (entry.data.length > 0) {
|
|
55
|
+
entry.data = [entry.data.join('')];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
events: ( this._entries.map(
|
|
60
|
+
entry => ({ cols: entry.cols, rows: entry.rows, data: entry.data[0] ?? '' })
|
|
61
|
+
)),
|
|
62
|
+
commands: {
|
|
63
|
+
isWindowsPty: false,
|
|
64
|
+
hasRichCommandDetection: false,
|
|
65
|
+
commands: [],
|
|
66
|
+
promptInputModel: undefined,
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async generateReplayEvent() {
|
|
71
|
+
return this.generateReplayEventSync();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { TerminalRecorder };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IEnvironmentVariableInfo } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/environmentVariable";
|
|
2
|
+
import { ITerminalStatus } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal";
|
|
3
|
+
import { ITerminalService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service";
|
|
4
|
+
import { EnvironmentVariableScope, IMergedEnvironmentVariableCollection, IMergedEnvironmentVariableCollectionDiff } from "../../../../platform/terminal/common/environmentVariable.js";
|
|
5
|
+
import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service";
|
|
6
|
+
import { IExtensionService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service";
|
|
7
|
+
export declare class EnvironmentVariableInfoStale implements IEnvironmentVariableInfo {
|
|
8
|
+
private readonly _diff;
|
|
9
|
+
private readonly _terminalId;
|
|
10
|
+
private readonly _collection;
|
|
11
|
+
private readonly _terminalService;
|
|
12
|
+
private readonly _extensionService;
|
|
13
|
+
readonly requiresAction = true;
|
|
14
|
+
constructor(_diff: IMergedEnvironmentVariableCollectionDiff, _terminalId: number, _collection: IMergedEnvironmentVariableCollection, _terminalService: ITerminalService, _extensionService: IExtensionService);
|
|
15
|
+
private _getInfo;
|
|
16
|
+
private _getActions;
|
|
17
|
+
getStatus(scope: EnvironmentVariableScope | undefined): ITerminalStatus;
|
|
18
|
+
}
|
|
19
|
+
export declare class EnvironmentVariableInfoChangesActive implements IEnvironmentVariableInfo {
|
|
20
|
+
private readonly _collection;
|
|
21
|
+
private readonly _commandService;
|
|
22
|
+
private readonly _extensionService;
|
|
23
|
+
readonly requiresAction = false;
|
|
24
|
+
constructor(_collection: IMergedEnvironmentVariableCollection, _commandService: ICommandService, _extensionService: IExtensionService);
|
|
25
|
+
private _getInfo;
|
|
26
|
+
private _getActions;
|
|
27
|
+
getStatus(scope: EnvironmentVariableScope | undefined): ITerminalStatus;
|
|
28
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { TerminalCommandId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal';
|
|
4
|
+
import { ITerminalService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
|
|
5
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
6
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
7
|
+
import { TerminalStatus } from './terminalStatusList.js';
|
|
8
|
+
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
9
|
+
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
10
|
+
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
11
|
+
|
|
12
|
+
let EnvironmentVariableInfoStale = class EnvironmentVariableInfoStale {
|
|
13
|
+
constructor(_diff, _terminalId, _collection, _terminalService, _extensionService) {
|
|
14
|
+
this._diff = _diff;
|
|
15
|
+
this._terminalId = _terminalId;
|
|
16
|
+
this._collection = _collection;
|
|
17
|
+
this._terminalService = _terminalService;
|
|
18
|
+
this._extensionService = _extensionService;
|
|
19
|
+
this.requiresAction = true;
|
|
20
|
+
}
|
|
21
|
+
_getInfo(scope) {
|
|
22
|
+
const extSet = ( new Set());
|
|
23
|
+
addExtensionIdentifiers(extSet, ( this._diff.added.values()));
|
|
24
|
+
addExtensionIdentifiers(extSet, ( this._diff.removed.values()));
|
|
25
|
+
addExtensionIdentifiers(extSet, ( this._diff.changed.values()));
|
|
26
|
+
let message = ( localize(
|
|
27
|
+
11464,
|
|
28
|
+
"The following extensions want to relaunch the terminal to contribute to its environment:"
|
|
29
|
+
));
|
|
30
|
+
message += getMergedDescription(this._collection, scope, this._extensionService, extSet);
|
|
31
|
+
return message;
|
|
32
|
+
}
|
|
33
|
+
_getActions() {
|
|
34
|
+
return [{
|
|
35
|
+
label: ( localize(11465, "Relaunch Terminal")),
|
|
36
|
+
run: () => this._terminalService.getInstanceFromId(this._terminalId)?.relaunch(),
|
|
37
|
+
commandId: TerminalCommandId.Relaunch
|
|
38
|
+
}];
|
|
39
|
+
}
|
|
40
|
+
getStatus(scope) {
|
|
41
|
+
return {
|
|
42
|
+
id: TerminalStatus.RelaunchNeeded,
|
|
43
|
+
severity: Severity.Warning,
|
|
44
|
+
icon: Codicon.warning,
|
|
45
|
+
tooltip: this._getInfo(scope),
|
|
46
|
+
hoverActions: this._getActions()
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
EnvironmentVariableInfoStale = ( __decorate([
|
|
51
|
+
( __param(3, ITerminalService)),
|
|
52
|
+
( __param(4, IExtensionService))
|
|
53
|
+
], EnvironmentVariableInfoStale));
|
|
54
|
+
let EnvironmentVariableInfoChangesActive = class EnvironmentVariableInfoChangesActive {
|
|
55
|
+
constructor(_collection, _commandService, _extensionService) {
|
|
56
|
+
this._collection = _collection;
|
|
57
|
+
this._commandService = _commandService;
|
|
58
|
+
this._extensionService = _extensionService;
|
|
59
|
+
this.requiresAction = false;
|
|
60
|
+
}
|
|
61
|
+
_getInfo(scope) {
|
|
62
|
+
const extSet = ( new Set());
|
|
63
|
+
addExtensionIdentifiers(extSet, ( this._collection.getVariableMap(scope).values()));
|
|
64
|
+
let message = ( localize(
|
|
65
|
+
11466,
|
|
66
|
+
"The following extensions have contributed to this terminal's environment:"
|
|
67
|
+
));
|
|
68
|
+
message += getMergedDescription(this._collection, scope, this._extensionService, extSet);
|
|
69
|
+
return message;
|
|
70
|
+
}
|
|
71
|
+
_getActions(scope) {
|
|
72
|
+
return [{
|
|
73
|
+
label: ( localize(11467, "Show Environment Contributions")),
|
|
74
|
+
run: () => this._commandService.executeCommand(TerminalCommandId.ShowEnvironmentContributions, scope),
|
|
75
|
+
commandId: TerminalCommandId.ShowEnvironmentContributions
|
|
76
|
+
}];
|
|
77
|
+
}
|
|
78
|
+
getStatus(scope) {
|
|
79
|
+
return {
|
|
80
|
+
id: TerminalStatus.EnvironmentVariableInfoChangesActive,
|
|
81
|
+
severity: Severity.Info,
|
|
82
|
+
tooltip: undefined,
|
|
83
|
+
detailedTooltip: this._getInfo(scope),
|
|
84
|
+
hoverActions: this._getActions(scope)
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
EnvironmentVariableInfoChangesActive = ( __decorate([
|
|
89
|
+
( __param(1, ICommandService)),
|
|
90
|
+
( __param(2, IExtensionService))
|
|
91
|
+
], EnvironmentVariableInfoChangesActive));
|
|
92
|
+
function getMergedDescription(collection, scope, extensionService, extSet) {
|
|
93
|
+
const message = ['\n'];
|
|
94
|
+
const globalDescriptions = collection.getDescriptionMap(undefined);
|
|
95
|
+
const workspaceDescriptions = collection.getDescriptionMap(scope);
|
|
96
|
+
for (const ext of extSet) {
|
|
97
|
+
const globalDescription = globalDescriptions.get(ext);
|
|
98
|
+
if (globalDescription) {
|
|
99
|
+
message.push(`\n- \`${getExtensionName(ext, extensionService)}\``);
|
|
100
|
+
message.push(`: ${globalDescription}`);
|
|
101
|
+
}
|
|
102
|
+
const workspaceDescription = workspaceDescriptions.get(ext);
|
|
103
|
+
if (workspaceDescription) {
|
|
104
|
+
const workspaceSuffix = globalDescription ? ` (${( localize(11468, 'workspace'))})` : '';
|
|
105
|
+
message.push(`\n- \`${getExtensionName(ext, extensionService)}${workspaceSuffix}\``);
|
|
106
|
+
message.push(`: ${workspaceDescription}`);
|
|
107
|
+
}
|
|
108
|
+
if (!globalDescription && !workspaceDescription) {
|
|
109
|
+
message.push(`\n- \`${getExtensionName(ext, extensionService)}\``);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return message.join('');
|
|
113
|
+
}
|
|
114
|
+
function addExtensionIdentifiers(extSet, diff) {
|
|
115
|
+
for (const mutators of diff) {
|
|
116
|
+
for (const mutator of mutators) {
|
|
117
|
+
extSet.add(mutator.extensionIdentifier);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function getExtensionName(id, extensionService) {
|
|
122
|
+
return extensionService.extensions.find(e => e.id === id)?.displayName || id;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export { EnvironmentVariableInfoChangesActive, EnvironmentVariableInfoStale };
|