@theia/terminal 1.70.0-next.71 → 1.70.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 +40 -1
- package/lib/browser/base/terminal-widget.d.ts.map +1 -1
- package/lib/browser/base/terminal-widget.js.map +1 -1
- package/lib/browser/terminal-command-history.d.ts +27 -0
- package/lib/browser/terminal-command-history.d.ts.map +1 -0
- package/lib/browser/terminal-command-history.js +76 -0
- package/lib/browser/terminal-command-history.js.map +1 -0
- package/lib/browser/terminal-frontend-contribution.d.ts +1 -0
- package/lib/browser/terminal-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/terminal-frontend-contribution.js +20 -0
- 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 +3 -0
- package/lib/browser/terminal-frontend-module.js.map +1 -1
- package/lib/browser/terminal-widget-impl.d.ts +31 -2
- package/lib/browser/terminal-widget-impl.d.ts.map +1 -1
- package/lib/browser/terminal-widget-impl.js +147 -2
- package/lib/browser/terminal-widget-impl.js.map +1 -1
- package/lib/common/shell-terminal-protocol.d.ts +6 -0
- package/lib/common/shell-terminal-protocol.d.ts.map +1 -1
- package/lib/common/shell-terminal-protocol.js.map +1 -1
- package/lib/common/terminal-preferences.d.ts +2 -0
- package/lib/common/terminal-preferences.d.ts.map +1 -1
- package/lib/common/terminal-preferences.js +12 -0
- package/lib/common/terminal-preferences.js.map +1 -1
- package/lib/node/shell-integration-injector.d.ts +15 -0
- package/lib/node/shell-integration-injector.d.ts.map +1 -0
- package/lib/node/shell-integration-injector.js +97 -0
- package/lib/node/shell-integration-injector.js.map +1 -0
- package/lib/node/shell-process.d.ts +6 -0
- package/lib/node/shell-process.d.ts.map +1 -1
- package/lib/node/shell-process.js.map +1 -1
- package/lib/node/terminal-backend-module.d.ts.map +1 -1
- package/lib/node/terminal-backend-module.js +7 -1
- package/lib/node/terminal-backend-module.js.map +1 -1
- package/package.json +10 -10
- package/src/browser/base/terminal-widget.ts +52 -1
- package/src/browser/style/terminal.css +7 -0
- package/src/browser/terminal-command-history.ts +83 -0
- package/src/browser/terminal-frontend-contribution.ts +20 -0
- package/src/browser/terminal-frontend-module.ts +6 -0
- package/src/browser/terminal-widget-impl.ts +171 -4
- package/src/common/shell-terminal-protocol.ts +6 -0
- package/src/common/terminal-preferences.ts +14 -0
- package/src/node/shell-integration-injector.ts +94 -0
- package/src/node/shell-integrations/bash/bash-integration.bash +86 -0
- package/src/node/shell-integrations/bash/command-block-support.bash +195 -0
- package/src/node/shell-integrations/zsh/command-block-support.zsh +103 -0
- package/src/node/shell-integrations/zsh/zdotdir/.zlogin +45 -0
- package/src/node/shell-integrations/zsh/zdotdir/.zprofile +27 -0
- package/src/node/shell-integrations/zsh/zdotdir/.zshenv +56 -0
- package/src/node/shell-integrations/zsh/zdotdir/.zshrc +46 -0
- package/src/node/shell-integrations/zsh/zdotdir/source-original.zsh +61 -0
- package/src/node/shell-integrations/zsh/zsh-integration.zsh +28 -0
- package/src/node/shell-process.ts +6 -0
- package/src/node/terminal-backend-module.ts +9 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2025 EclipseSource GmbH 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-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ShellIntegrationInjector = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const path = require("path");
|
|
21
|
+
const fs = require("fs");
|
|
22
|
+
const shell_type_1 = require("../common/shell-type");
|
|
23
|
+
const shell_process_1 = require("./shell-process");
|
|
24
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
25
|
+
let ShellIntegrationInjector = class ShellIntegrationInjector {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.INTEGRATION_ROOT_DIR = 'shell-integrations';
|
|
28
|
+
this.BASH_RCFILE_FLAG = '--rcfile';
|
|
29
|
+
this.BASH_INTEGRATION_SCRIPT_PATH = 'bash/bash-integration.bash';
|
|
30
|
+
this.ZSH_INTEGRATION_ENV_VAR = 'THEIA_ZSH_DIR';
|
|
31
|
+
this.ZSH_INTEGRATION_DIR = 'zsh';
|
|
32
|
+
this.ZDOTDIR_ENV_VAR = 'ZDOTDIR';
|
|
33
|
+
this.ZDOTDIR_RELATIVE_DIR = '/zsh/zdotdir/';
|
|
34
|
+
this.ZDOTDIR_ORIGINAL_ENV_VAR = 'THEIA_ORIGINAL_ZDOTDIR';
|
|
35
|
+
}
|
|
36
|
+
injectShellIntegration(options) {
|
|
37
|
+
const shellExecutable = options.shell ?? shell_process_1.ShellProcess.getShellExecutablePath();
|
|
38
|
+
const shellType = (0, shell_type_1.guessShellTypeFromExecutable)(shellExecutable);
|
|
39
|
+
if (shellType === "bash" /* GeneralShellType.Bash */) {
|
|
40
|
+
const scriptPath = this.getShellIntegrationPath(this.BASH_INTEGRATION_SCRIPT_PATH);
|
|
41
|
+
if (!scriptPath) {
|
|
42
|
+
return options;
|
|
43
|
+
}
|
|
44
|
+
// strips the login flag if present to avoid conflicts with --rcfile
|
|
45
|
+
const filteredArgs = this.stripLoginFlag(options.args);
|
|
46
|
+
return {
|
|
47
|
+
...options,
|
|
48
|
+
args: [
|
|
49
|
+
this.BASH_RCFILE_FLAG, scriptPath,
|
|
50
|
+
...(filteredArgs ?? []),
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
else if (shellType === "zsh" /* GeneralShellType.Zsh */) {
|
|
55
|
+
const zdotdirPath = this.getShellIntegrationPath(this.ZDOTDIR_RELATIVE_DIR);
|
|
56
|
+
const zshDirPath = this.getShellIntegrationPath(this.ZSH_INTEGRATION_DIR);
|
|
57
|
+
if (!zdotdirPath || !zshDirPath) {
|
|
58
|
+
return options;
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
...options,
|
|
62
|
+
env: {
|
|
63
|
+
...options.env,
|
|
64
|
+
[this.ZDOTDIR_ENV_VAR]: zdotdirPath,
|
|
65
|
+
[this.ZSH_INTEGRATION_ENV_VAR]: zshDirPath,
|
|
66
|
+
[this.ZDOTDIR_ORIGINAL_ENV_VAR]: options.env?.ZDOTDIR ?? process.env.ZDOTDIR ?? ''
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return options;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
getShellIntegrationPath(relativePath) {
|
|
75
|
+
const fullPath = path.join(__dirname, this.INTEGRATION_ROOT_DIR, relativePath);
|
|
76
|
+
if (!fs.existsSync(fullPath)) {
|
|
77
|
+
console.warn(`Shell integration file not found (application may not be bundled correctly): ${fullPath}`);
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
return fullPath;
|
|
81
|
+
}
|
|
82
|
+
stripLoginFlag(args) {
|
|
83
|
+
if (args === undefined) {
|
|
84
|
+
return args;
|
|
85
|
+
}
|
|
86
|
+
if (typeof args === 'string') {
|
|
87
|
+
// split string on any amount of whitespace into an array
|
|
88
|
+
return args.trim().split(/\s+/).filter(arg => arg !== '-l' && arg !== '--login');
|
|
89
|
+
}
|
|
90
|
+
return args.filter(arg => arg !== '-l' && arg !== '--login');
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
exports.ShellIntegrationInjector = ShellIntegrationInjector;
|
|
94
|
+
exports.ShellIntegrationInjector = ShellIntegrationInjector = tslib_1.__decorate([
|
|
95
|
+
(0, inversify_1.injectable)()
|
|
96
|
+
], ShellIntegrationInjector);
|
|
97
|
+
//# sourceMappingURL=shell-integration-injector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-integration-injector.js","sourceRoot":"","sources":["../../src/node/shell-integration-injector.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,gFAAgF;AAChF,gFAAgF;;;;AAEhF,6BAA8B;AAC9B,yBAAyB;AACzB,qDAAsF;AACtF,mDAAoE;AACpE,4DAA0D;AAGnD,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAA9B;QAEgB,yBAAoB,GAAG,oBAAoB,CAAC;QAE5C,qBAAgB,GAAG,UAAU,CAAC;QAC9B,iCAA4B,GAAG,4BAA4B,CAAC;QAE5D,4BAAuB,GAAG,eAAe,CAAC;QAC1C,wBAAmB,GAAG,KAAK,CAAC;QAC5B,oBAAe,GAAG,SAAS,CAAC;QAC5B,yBAAoB,GAAG,eAAe,CAAC;QACvC,6BAAwB,GAAG,wBAAwB,CAAC;IA2D3E,CAAC;IAzDG,sBAAsB,CAAC,OAA4B;QAC/C,MAAM,eAAe,GAAG,OAAO,CAAC,KAAK,IAAI,4BAAY,CAAC,sBAAsB,EAAE,CAAC;QAC/E,MAAM,SAAS,GAAG,IAAA,yCAA4B,EAAC,eAAe,CAAC,CAAC;QAChE,IAAI,SAAS,uCAA0B,EAAE,CA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AC;QAC/E,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3B,OAAO,CAAC,IAAI,CAAC,gFAAgF,QAAQ,EAAE,CAAC,CAAC;YACzG,OAAO,SAAS,CAAC;QACrB,CAAC;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;IAES,cAAc,CAAC,IAAmC;QACxD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,yDAAyD;YACzD,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,CAAC,CAAC;QACrF,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,CAAC,CAAC;IACjE,CAAC;CAEJ,CAAA;AAtEY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,sBAAU,GAAE;GACA,wBAAwB,CAsEpC"}
|
|
@@ -15,6 +15,12 @@ export interface ShellProcessOptions {
|
|
|
15
15
|
};
|
|
16
16
|
strictEnv?: boolean;
|
|
17
17
|
isPseudo?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to inject shell integration scripts for command tracking.
|
|
20
|
+
* When enabled, shell integration scripts are injected to emit OSC 133 sequences.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
enableShellIntegration?: boolean;
|
|
18
24
|
}
|
|
19
25
|
export declare function getRootPath(rootURI?: string): string;
|
|
20
26
|
export declare class ShellProcess extends TerminalProcess {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-process.d.ts","sourceRoot":"","sources":["../../src/node/shell-process.ts"],"names":[],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I,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAOpD;AAED,qBACa,YAAa,SAAQ,eAAe;IAE7C,SAAS,CAAC,MAAM,CAAC,WAAW,SAAM;IAClC,SAAS,CAAC,MAAM,CAAC,WAAW,SAAM;gBAErB,qDAAqD;IACjC,OAAO,EAAE,mBAAmB,EACjC,cAAc,EAAE,cAAc,EAC7B,UAAU,EAAE,eAAe,EAChB,MAAM,EAAE,OAAO,EACzB,gBAAgB,EAAE,gBAAgB;WAiBlD,sBAAsB,IAAI,MAAM;WAYhC,sBAAsB,IAAI,MAAM,EAAE;CAWnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-process.js","sourceRoot":"","sources":["../../src/node/shell-process.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;;;;
|
|
1
|
+
{"version":3,"file":"shell-process.js","sourceRoot":"","sources":["../../src/node/shell-process.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;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BAAc,CAAC,CAAA;IACtB,mBAAA,IAAA,kBAAM,EAAC,sBAAe,CAAC,CAAA;IACvB,mBAAA,IAAA,kBAAM,EAAC,gBAAO,CAAC,CAAA;IAAE,mBAAA,IAAA,iBAAK,EAAC,UAAU,CAAC,CAAA;IAClC,mBAAA,IAAA,kBAAM,EAAC,oCAAgB,CAAC,CAAA;qDAHe,qBAAc;QACjB,sBAAe,UAER,oCAAgB;GAVvD,YAAY,CAkDxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/terminal-backend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAa,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAKtF,OAAO,EAAsD,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"terminal-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/terminal-backend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAa,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAKtF,OAAO,EAAsD,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAS3H,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE;IACzF,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,UAAU,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IAC9D,WAAW,EAAE;QAET,KAAI,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,mBAAmB,CAAC;KAC5C,CAAA;CACJ,GAAG,IAAI,CAiBP;;AAED,wBAgCG"}
|
|
@@ -28,6 +28,7 @@ const shell_terminal_server_1 = require("../node/shell-terminal-server");
|
|
|
28
28
|
const terminal_watcher_1 = require("../common/terminal-watcher");
|
|
29
29
|
const messaging_service_1 = require("@theia/core/lib/node/messaging/messaging-service");
|
|
30
30
|
const terminal_preferences_1 = require("../common/terminal-preferences");
|
|
31
|
+
const shell_integration_injector_1 = require("./shell-integration-injector");
|
|
31
32
|
function bindTerminalServer(bind, { path, identifier, constructor }) {
|
|
32
33
|
const dispatchingClient = new base_terminal_protocol_1.DispatchingBaseTerminalClient();
|
|
33
34
|
bind(identifier).to(constructor).inSingletonScope().onActivation((context, terminalServer) => {
|
|
@@ -47,10 +48,15 @@ function bindTerminalServer(bind, { path, identifier, constructor }) {
|
|
|
47
48
|
exports.default = new inversify_1.ContainerModule(bind => {
|
|
48
49
|
bind(messaging_service_1.MessagingService.Contribution).to(terminal_backend_contribution_1.TerminalBackendContribution).inSingletonScope();
|
|
49
50
|
bind(shell_process_1.ShellProcess).toSelf().inTransientScope();
|
|
51
|
+
bind(shell_integration_injector_1.ShellIntegrationInjector).toSelf().inSingletonScope();
|
|
50
52
|
bind(shell_process_1.ShellProcessFactory).toFactory(ctx => (options) => {
|
|
51
53
|
const child = new inversify_1.Container({ defaultScope: 'Singleton' });
|
|
52
54
|
child.parent = ctx.container;
|
|
53
|
-
|
|
55
|
+
// inject shell integration scripts and env vars only if the terminal command history is enabled
|
|
56
|
+
const injectedOptions = (options.enableShellIntegration ?? false)
|
|
57
|
+
? ctx.container.get(shell_integration_injector_1.ShellIntegrationInjector).injectShellIntegration(options)
|
|
58
|
+
: options;
|
|
59
|
+
child.bind(shell_process_1.ShellProcessOptions).toConstantValue(injectedOptions);
|
|
54
60
|
return child.get(shell_process_1.ShellProcess);
|
|
55
61
|
});
|
|
56
62
|
bind(terminal_watcher_1.TerminalWatcher).toSelf().inSingletonScope();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-backend-module.js","sourceRoot":"","sources":["../../src/node/terminal-backend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,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;;
|
|
1
|
+
{"version":3,"file":"terminal-backend-module.js","sourceRoot":"","sources":["../../src/node/terminal-backend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,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;;AAgBhF,gDAwBC;AAtCD,4DAAsF;AACtF,mFAA8E;AAC9E,gEAA2F;AAC3F,mDAAyF;AACzF,mEAA4E;AAC5E,6EAA2H;AAC3H,uDAAmD;AACnD,+EAA4F;AAC5F,yEAAoE;AACpE,iEAA6D;AAC7D,wFAAoF;AACpF,yEAAyE;AACzE,6EAAwE;AAExE,SAAgB,kBAAkB,CAAC,IAAqB,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAOxF;IACG,MAAM,iBAAiB,GAAG,IAAI,sDAA6B,EAAE,CAAC;IAC9D,IAAI,CAAsB,UAAU,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,gBAAgB,EAAE,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE;QAC9G,cAAc,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QAC5C,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,kCAAe,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC;QACnF,cAAc,CAAC,SAAS,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC3C,CAAC,CAAC;QACF,OAAO,cAAc,CAAC;IAC1B,CAAC,CAAC,CAAC;IACH,IAAI,CAAC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AC,CAAC;QACjE,OAAO,KAAK,CAAC,GAAG,CAAC,4BAAY,CAAC,CAAC;IACnC,CAAC,CACJ,CAAC;IAEF,IAAI,CAAC,kCAAe,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAClD,kBAAkB,CAAC,IAAI,EAAE;QACrB,IAAI,EAAE,gCAAY;QAClB,UAAU,EAAE,mCAAe;QAC3B,WAAW,EAAE,gCAAc;KAC9B,CAAC,CAAC;IACH,kBAAkB,CAAC,IAAI,EAAE;QACrB,IAAI,EAAE,2CAAiB;QACvB,UAAU,EAAE,8CAAoB;QAChC,WAAW,EAAE,2CAAmB;KACnC,CAAC,CAAC;IACH,IAAA,8CAAuB,EAAC,IAAI,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/terminal",
|
|
3
|
-
"version": "1.70.0
|
|
3
|
+
"version": "1.70.0",
|
|
4
4
|
"description": "Theia - Terminal Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.70.0
|
|
7
|
-
"@theia/editor": "1.70.0
|
|
8
|
-
"@theia/file-search": "1.70.0
|
|
9
|
-
"@theia/filesystem": "1.70.0
|
|
10
|
-
"@theia/process": "1.70.0
|
|
11
|
-
"@theia/variable-resolver": "1.70.0
|
|
12
|
-
"@theia/workspace": "1.70.0
|
|
6
|
+
"@theia/core": "1.70.0",
|
|
7
|
+
"@theia/editor": "1.70.0",
|
|
8
|
+
"@theia/file-search": "1.70.0",
|
|
9
|
+
"@theia/filesystem": "1.70.0",
|
|
10
|
+
"@theia/process": "1.70.0",
|
|
11
|
+
"@theia/variable-resolver": "1.70.0",
|
|
12
|
+
"@theia/workspace": "1.70.0",
|
|
13
13
|
"tslib": "^2.6.2",
|
|
14
14
|
"xterm": "^5.3.0",
|
|
15
15
|
"xterm-addon-fit": "^0.8.0",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"watch": "theiaext watch"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@theia/ext-scripts": "1.
|
|
54
|
+
"@theia/ext-scripts": "1.70.0"
|
|
55
55
|
},
|
|
56
56
|
"nyc": {
|
|
57
57
|
"extends": "../../configs/nyc.json"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "d2e3d1ecaa9b1df7992eeaa1ad4584f436a83e67"
|
|
60
60
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { Event, ViewColumn } from '@theia/core';
|
|
17
|
+
import { Disposable, Event, ViewColumn } from '@theia/core';
|
|
18
18
|
import { BaseWidget } from '@theia/core/lib/browser';
|
|
19
19
|
import { MarkdownString } from '@theia/core/lib/common/markdown-rendering/markdown-string';
|
|
20
20
|
import { ThemeIcon } from '@theia/core/lib/common/theme';
|
|
@@ -59,6 +59,11 @@ export interface TerminalBuffer {
|
|
|
59
59
|
getLines(start: number, length: number, trimRight?: boolean): string[];
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
export interface TerminalBlock {
|
|
63
|
+
readonly command: string;
|
|
64
|
+
readonly output: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
62
67
|
/**
|
|
63
68
|
* Terminal UI widget.
|
|
64
69
|
*/
|
|
@@ -184,6 +189,52 @@ export abstract class TerminalWidget extends BaseWidget {
|
|
|
184
189
|
abstract setTitle(title: string): void;
|
|
185
190
|
|
|
186
191
|
abstract waitOnExit(waitOnExit?: boolean | string): void;
|
|
192
|
+
|
|
193
|
+
abstract get commandHistoryState(): TerminalCommandHistoryState | undefined;
|
|
194
|
+
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* State of command history in terminal.
|
|
199
|
+
*/
|
|
200
|
+
export interface TerminalCommandHistoryState extends Disposable {
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Array of executed commands and their output in the terminal.
|
|
204
|
+
*/
|
|
205
|
+
readonly commandHistory: TerminalBlock[];
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* The hex-decoded command currently being executed, or empty string if idle.
|
|
209
|
+
*/
|
|
210
|
+
readonly currentCommand: string;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Marks the start of a new command execution.
|
|
214
|
+
* @param command the hexencoded command string
|
|
215
|
+
*/
|
|
216
|
+
startCommand(command: string): void;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Records the finished command and its output as a new history block.
|
|
220
|
+
*/
|
|
221
|
+
finishCommand(block: TerminalBlock): void;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Clears the current in-progress command state.
|
|
225
|
+
*/
|
|
226
|
+
clearCommandCollectionState(): void;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Event which fires when terminal command starts executing.
|
|
230
|
+
*/
|
|
231
|
+
onTerminalCommandStart: Event<void>;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Event which fires when terminal prompt is shown.
|
|
235
|
+
*/
|
|
236
|
+
onTerminalPromptShown: Event<void>;
|
|
237
|
+
|
|
187
238
|
}
|
|
188
239
|
|
|
189
240
|
/**
|
|
@@ -30,3 +30,10 @@
|
|
|
30
30
|
/* fix secondary cursor-like issue. See https://github.com/eclipse-theia/theia/issues/8158 */
|
|
31
31
|
opacity: 0 !important;
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
.terminal-command-separator {
|
|
35
|
+
border-top: var(--theia-border-width) solid var(--theia-sideBarSectionHeader-border);
|
|
36
|
+
left: 0 !important;
|
|
37
|
+
right: 0 !important;
|
|
38
|
+
width: 100% !important;
|
|
39
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 EclipseSource GmbH and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { DisposableCollection, Event, Emitter } from '@theia/core';
|
|
18
|
+
import { TerminalBlock, TerminalCommandHistoryState } from './base/terminal-widget';
|
|
19
|
+
import { injectable } from '@theia/core/shared/inversify';
|
|
20
|
+
|
|
21
|
+
export const TerminalCommandHistoryStateFactory = Symbol('TerminalCommandHistoryStateFactory');
|
|
22
|
+
export type TerminalCommandHistoryStateFactory = () => TerminalCommandHistoryState;
|
|
23
|
+
|
|
24
|
+
@injectable()
|
|
25
|
+
export class TerminalCommandHistoryStateImpl implements TerminalCommandHistoryState {
|
|
26
|
+
static readonly MAX_CAPACITY = 200;
|
|
27
|
+
|
|
28
|
+
private _commandHistory: TerminalBlock[] = [];
|
|
29
|
+
get commandHistory(): TerminalBlock[] { return this._commandHistory; }
|
|
30
|
+
|
|
31
|
+
private _currentCommand: string = '';
|
|
32
|
+
get currentCommand(): string { return this._currentCommand; }
|
|
33
|
+
|
|
34
|
+
private readonly toDispose = new DisposableCollection();
|
|
35
|
+
private readonly onCommandStartEmitter = new Emitter<void>();
|
|
36
|
+
private readonly onPromptShownEmitter = new Emitter<void>();
|
|
37
|
+
protected readonly _maxCapacity: number;
|
|
38
|
+
readonly onTerminalCommandStart: Event<void> = this.onCommandStartEmitter.event;
|
|
39
|
+
readonly onTerminalPromptShown: Event<void> = this.onPromptShownEmitter.event;
|
|
40
|
+
|
|
41
|
+
constructor() {
|
|
42
|
+
this.toDispose.push(this.onCommandStartEmitter);
|
|
43
|
+
this.toDispose.push(this.onPromptShownEmitter);
|
|
44
|
+
this._maxCapacity = TerminalCommandHistoryStateImpl.MAX_CAPACITY;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
startCommand(command: string): void {
|
|
48
|
+
this._currentCommand = this.decodeHexString(command);
|
|
49
|
+
this.onCommandStartEmitter.fire();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
finishCommand(block: TerminalBlock): void {
|
|
53
|
+
this._commandHistory.push(block);
|
|
54
|
+
if (this._commandHistory.length > this._maxCapacity) {
|
|
55
|
+
this._commandHistory.shift();
|
|
56
|
+
}
|
|
57
|
+
this._currentCommand = '';
|
|
58
|
+
this.onPromptShownEmitter.fire();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
clearCommandCollectionState(): void {
|
|
62
|
+
this._currentCommand = '';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
dispose(): void {
|
|
66
|
+
this._commandHistory = [];
|
|
67
|
+
this.toDispose.dispose();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Decodes a hex-encoded string to UTF-8 using browser-compatible APIs.
|
|
72
|
+
*/
|
|
73
|
+
protected decodeHexString(hexString: string): string {
|
|
74
|
+
if (!hexString) {
|
|
75
|
+
return '';
|
|
76
|
+
}
|
|
77
|
+
const hexBytes = new Uint8Array(
|
|
78
|
+
(hexString.match(/.{1,2}/g) || []).map(byte => parseInt(byte, 16))
|
|
79
|
+
);
|
|
80
|
+
return new TextDecoder('utf-8').decode(hexBytes);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
}
|
|
@@ -302,6 +302,26 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu
|
|
|
302
302
|
});
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
+
async initializeLayout(): Promise<void> {
|
|
306
|
+
await this.preferenceService.ready;
|
|
307
|
+
// `terminal.grouping.mode` is defined in @theia/terminal-manager, which this package
|
|
308
|
+
// cannot depend on. Reading via generic PreferenceService; undefined safely
|
|
309
|
+
// falls through to standard terminal behavior.
|
|
310
|
+
const groupingMode = this.preferenceService.get('terminal.grouping.mode');
|
|
311
|
+
if (groupingMode === 'tree') {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
try {
|
|
315
|
+
const termWidget = await this.newTerminal({});
|
|
316
|
+
await termWidget.start();
|
|
317
|
+
// Use shell.addWidget directly (not this.open()) to add the terminal
|
|
318
|
+
// to the bottom panel without expanding it on startup.
|
|
319
|
+
this.shell.addWidget(termWidget, { area: 'bottom' });
|
|
320
|
+
} catch (error) {
|
|
321
|
+
console.error('Failed to initialize terminal in default layout', error);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
305
325
|
async contributeDefaultProfiles(): Promise<void> {
|
|
306
326
|
if (OS.backend.isWindows) {
|
|
307
327
|
this.contributedProfileStore.registerTerminalProfile('cmd', new ShellTerminalProfile(this, {
|
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
ContributedTerminalProfileStore, DefaultProfileStore, DefaultTerminalProfileService,
|
|
46
46
|
TerminalProfileService, TerminalProfileStore, UserTerminalProfileStore
|
|
47
47
|
} from './terminal-profile-service';
|
|
48
|
+
import { TerminalCommandHistoryStateFactory, TerminalCommandHistoryStateImpl } from './terminal-command-history';
|
|
48
49
|
|
|
49
50
|
export default new ContainerModule(bind => {
|
|
50
51
|
bindTerminalPreferences(bind);
|
|
@@ -132,4 +133,9 @@ export default new ContainerModule(bind => {
|
|
|
132
133
|
}).inSingletonScope();
|
|
133
134
|
|
|
134
135
|
bind(FrontendApplicationContribution).toService(TerminalFrontendContribution);
|
|
136
|
+
|
|
137
|
+
bind(TerminalCommandHistoryStateImpl).toSelf().inTransientScope();
|
|
138
|
+
bind(TerminalCommandHistoryStateFactory).toFactory(ctx =>
|
|
139
|
+
() => ctx.container.get(TerminalCommandHistoryStateImpl)
|
|
140
|
+
);
|
|
135
141
|
});
|