@opensumi/ide-terminal-next 3.4.6-next-1730692409.0 → 3.4.6-next-1733744589.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/component/terminal.view.d.ts +1 -1
- package/lib/browser/component/terminal.view.d.ts.map +1 -1
- package/lib/browser/component/terminal.view.js +1 -1
- package/lib/browser/component/terminal.view.js.map +1 -1
- package/lib/browser/links/base.d.ts +1 -1
- package/lib/browser/links/base.d.ts.map +1 -1
- package/lib/browser/links/external-link-provider-adapter.d.ts +1 -1
- package/lib/browser/links/external-link-provider-adapter.d.ts.map +1 -1
- package/lib/browser/links/helpers.d.ts +1 -1
- package/lib/browser/links/helpers.d.ts.map +1 -1
- package/lib/browser/links/link-manager.d.ts +1 -1
- package/lib/browser/links/link-manager.d.ts.map +1 -1
- package/lib/browser/links/link-manager.js +1 -1
- package/lib/browser/links/link-manager.js.map +1 -1
- package/lib/browser/links/link.d.ts +1 -1
- package/lib/browser/links/link.d.ts.map +1 -1
- package/lib/browser/links/protocol-link-provider.d.ts +1 -1
- package/lib/browser/links/protocol-link-provider.d.ts.map +1 -1
- package/lib/browser/links/validated-local-link-provider.d.ts +1 -1
- package/lib/browser/links/validated-local-link-provider.d.ts.map +1 -1
- package/lib/browser/terminal.addon.d.ts +1 -1
- package/lib/browser/terminal.addon.d.ts.map +1 -1
- package/lib/browser/terminal.client.d.ts +2 -2
- package/lib/browser/terminal.client.d.ts.map +1 -1
- package/lib/browser/terminal.controller.js +1 -1
- package/lib/browser/terminal.controller.js.map +1 -1
- package/lib/browser/terminal.internal.service.d.ts +2 -2
- package/lib/browser/terminal.preference.d.ts +1 -1
- package/lib/browser/terminal.preference.d.ts.map +1 -1
- package/lib/browser/terminal.preference.js.map +1 -1
- package/lib/browser/terminal.theme.d.ts +1 -1
- package/lib/browser/terminal.theme.d.ts.map +1 -1
- package/lib/browser/terminal.typeAhead.addon.d.ts +2 -2
- package/lib/browser/terminal.typeAhead.addon.d.ts.map +1 -1
- package/lib/browser/xterm.d.ts +1 -1
- package/lib/browser/xterm.d.ts.map +1 -1
- package/lib/browser/xterm.js +7 -7
- package/lib/browser/xterm.js.map +1 -1
- package/lib/common/client.d.ts +1 -1
- package/lib/common/client.d.ts.map +1 -1
- package/lib/common/pty.d.ts +1 -1
- package/lib/common/pty.d.ts.map +1 -1
- package/lib/common/service.d.ts +1 -1
- package/lib/common/service.d.ts.map +1 -1
- package/lib/common/theme.d.ts +1 -1
- package/lib/common/theme.d.ts.map +1 -1
- package/lib/common/xterm.d.ts +1 -1
- package/lib/common/xterm.d.ts.map +1 -1
- package/lib/node/pty.d.ts.map +1 -1
- package/lib/node/pty.js +3 -12
- package/lib/node/pty.js.map +1 -1
- package/lib/node/shell-integration.service.d.ts +0 -3
- package/lib/node/shell-integration.service.d.ts.map +1 -1
- package/lib/node/shell-integration.service.js +0 -117
- package/lib/node/shell-integration.service.js.map +1 -1
- package/package.json +23 -23
- package/src/browser/component/terminal.view.tsx +1 -1
- package/src/browser/links/base.ts +1 -1
- package/src/browser/links/external-link-provider-adapter.ts +1 -1
- package/src/browser/links/helpers.ts +1 -1
- package/src/browser/links/link-manager.ts +1 -1
- package/src/browser/links/link.ts +1 -1
- package/src/browser/links/protocol-link-provider.ts +1 -1
- package/src/browser/links/validated-local-link-provider.ts +1 -1
- package/src/browser/terminal.addon.ts +1 -1
- package/src/browser/terminal.controller.ts +1 -1
- package/src/browser/terminal.preference.ts +1 -1
- package/src/browser/terminal.theme.ts +1 -1
- package/src/browser/terminal.typeAhead.addon.ts +1 -1
- package/src/browser/xterm-private.d.ts +1 -1
- package/src/browser/xterm.ts +7 -7
- package/src/common/client.ts +1 -1
- package/src/common/pty.ts +1 -1
- package/src/common/service.ts +1 -1
- package/src/common/theme.ts +1 -1
- package/src/common/xterm-private.d.ts +1 -1
- package/src/common/xterm.ts +1 -1
- package/src/node/pty.ts +2 -14
- package/src/node/shell-integration.service.ts +0 -128
package/src/browser/xterm.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { ITerminalOptions, ITheme, Terminal } from 'xterm';
|
|
3
|
+
import { FitAddon } from 'xterm-addon-fit';
|
|
4
|
+
import { ISearchOptions, SearchAddon } from 'xterm-addon-search';
|
|
5
5
|
|
|
6
6
|
import { Autowired, INJECTOR_TOKEN, Injectable, Injector } from '@opensumi/di';
|
|
7
7
|
import { IClipboardService } from '@opensumi/ide-core-browser';
|
|
@@ -26,8 +26,8 @@ import {
|
|
|
26
26
|
TERMINAL_OVERVIEW_RULER_FIND_MATCH_FOREGROUND_COLOR,
|
|
27
27
|
} from './terminal.color';
|
|
28
28
|
|
|
29
|
-
import type { CanvasAddon as CanvasAddonType } from '
|
|
30
|
-
import type { WebglAddon as WebglAddonType } from '
|
|
29
|
+
import type { CanvasAddon as CanvasAddonType } from 'xterm-addon-canvas';
|
|
30
|
+
import type { WebglAddon as WebglAddonType } from 'xterm-addon-webgl';
|
|
31
31
|
|
|
32
32
|
export interface XTermOptions {
|
|
33
33
|
cwd?: string;
|
|
@@ -85,7 +85,7 @@ export class XTerm extends Disposable implements IXTerm {
|
|
|
85
85
|
try {
|
|
86
86
|
if (!this._canvasAddon) {
|
|
87
87
|
// @ts-ignore
|
|
88
|
-
this._canvasAddon = new (await import('
|
|
88
|
+
this._canvasAddon = new (await import('xterm-addon-canvas')).CanvasAddon();
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
this.addDispose(this._canvasAddon);
|
|
@@ -104,7 +104,7 @@ export class XTerm extends Disposable implements IXTerm {
|
|
|
104
104
|
try {
|
|
105
105
|
if (!this._webglAddon) {
|
|
106
106
|
// @ts-ignore
|
|
107
|
-
this._webglAddon = new (await import('
|
|
107
|
+
this._webglAddon = new (await import('xterm-addon-webgl')).WebglAddon();
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
this.addDispose(this._webglAddon);
|
package/src/common/client.ts
CHANGED
package/src/common/pty.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Terminal as XTerm } from '@xterm/xterm';
|
|
2
1
|
import { IPty as INodePty } from 'node-pty';
|
|
3
2
|
import * as pty from 'node-pty';
|
|
3
|
+
import { Terminal as XTerm } from 'xterm';
|
|
4
4
|
|
|
5
5
|
import { IThemeColor, MaybePromise, OperatingSystem, Uri } from '@opensumi/ide-core-common';
|
|
6
6
|
|
package/src/common/service.ts
CHANGED
package/src/common/theme.ts
CHANGED
package/src/common/xterm.ts
CHANGED
package/src/node/pty.ts
CHANGED
|
@@ -186,8 +186,8 @@ export class PtyService extends Disposable implements IPtyService {
|
|
|
186
186
|
) as { [key: string]: string };
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
// HACK: 这里的处理逻辑有些黑,后续需要整体去整理下 Shell
|
|
190
|
-
// 如果是启动 bash,则使用 init file 植入
|
|
189
|
+
// HACK: 这里的处理逻辑有些黑,后续需要整体去整理下 Shell Intergration,然后整体优化一下
|
|
190
|
+
// 如果是启动 bash,则使用 init file 植入 Intergration 能力
|
|
191
191
|
if (options.executable?.includes('bash')) {
|
|
192
192
|
const bashIntegrationPath = await this.shellIntegrationService.initBashInitFile();
|
|
193
193
|
if (!options.args) {
|
|
@@ -202,18 +202,6 @@ export class PtyService extends Disposable implements IPtyService {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
// ZSH 相关的能力注入
|
|
206
|
-
if (options.executable?.includes('zsh')) {
|
|
207
|
-
const zshDotFilesPath = await this.shellIntegrationService.initZshDotFiles();
|
|
208
|
-
|
|
209
|
-
if (!ptyEnv) {
|
|
210
|
-
ptyEnv = {};
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
ptyEnv['USER_ZDOTDIR'] = ptyEnv['ZDOTDIR'] || os.homedir() || '~';
|
|
214
|
-
ptyEnv['ZDOTDIR'] = zshDotFilesPath;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
205
|
this._ptyOptions['env'] = ptyEnv;
|
|
218
206
|
|
|
219
207
|
const results = await Promise.all([this._validateCwd(), this._validateExecutable()]);
|
|
@@ -11,9 +11,6 @@ export interface IShellIntegrationService {
|
|
|
11
11
|
|
|
12
12
|
// 获取 Bash 注入文件的 Content 内容
|
|
13
13
|
getBashIntegrationContent(): Promise<string>;
|
|
14
|
-
|
|
15
|
-
// 初始化 zsh 注入的配置,并且返回配置的路径
|
|
16
|
-
initZshDotFiles(): Promise<string>;
|
|
17
14
|
}
|
|
18
15
|
|
|
19
16
|
// 未来适配 OpenSumi 的时候需要调整
|
|
@@ -77,129 +74,4 @@ export class ShellIntegrationService implements IShellIntegrationService {
|
|
|
77
74
|
await fs.writeFile(bashIntegrationPath, await this.getBashIntegrationContent());
|
|
78
75
|
return bashIntegrationPath;
|
|
79
76
|
}
|
|
80
|
-
|
|
81
|
-
// ZSH 的智能化基于 ZDOTDIR 能力运行
|
|
82
|
-
async initZshDotFiles(): Promise<string> {
|
|
83
|
-
const zDotDir = path.join(os.tmpdir(), 'sumi-integration-zsh');
|
|
84
|
-
await this.writeZshConfigShellScripts(zDotDir);
|
|
85
|
-
return zDotDir;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
private async writeZshConfigShellScripts(outputDir: string) {
|
|
89
|
-
// 定义文件内容
|
|
90
|
-
const shellIntegrationEnv = String.raw`
|
|
91
|
-
if [[ -f $USER_ZDOTDIR/.zshenv ]]; then
|
|
92
|
-
SUMI_ZDOTDIR=$ZDOTDIR
|
|
93
|
-
ZDOTDIR=$USER_ZDOTDIR
|
|
94
|
-
|
|
95
|
-
# prevent recursion
|
|
96
|
-
if [[ $USER_ZDOTDIR != $SUMI_ZDOTDIR ]]; then
|
|
97
|
-
. $USER_ZDOTDIR/.zshenv
|
|
98
|
-
fi
|
|
99
|
-
|
|
100
|
-
USER_ZDOTDIR=$ZDOTDIR
|
|
101
|
-
ZDOTDIR=$SUMI_ZDOTDIR
|
|
102
|
-
fi
|
|
103
|
-
`;
|
|
104
|
-
|
|
105
|
-
const shellIntegrationLogin = String.raw`
|
|
106
|
-
if [[ -f $USER_ZDOTDIR/.zlogin ]]; then
|
|
107
|
-
ZDOTDIR=$USER_ZDOTDIR
|
|
108
|
-
. $ZDOTDIR/.zlogin
|
|
109
|
-
fi
|
|
110
|
-
`;
|
|
111
|
-
|
|
112
|
-
// 处理 zProfile 的情况,需要临时切回用户的 zshrc 目录配置执行 zProfile,然后记得要切回来,否则 zshrc hack 不生效
|
|
113
|
-
const shellIntegrationProfile = String.raw`
|
|
114
|
-
if [[ -f $USER_ZDOTDIR/.zprofile ]]; then
|
|
115
|
-
SUMI_ZDOTDIR=$ZDOTDIR
|
|
116
|
-
ZDOTDIR=$USER_ZDOTDIR
|
|
117
|
-
. $USER_ZDOTDIR/.zprofile
|
|
118
|
-
ZDOTDIR=$SUMI_ZDOTDIR
|
|
119
|
-
fi
|
|
120
|
-
`;
|
|
121
|
-
|
|
122
|
-
const shellIntegrationRc = `
|
|
123
|
-
builtin autoload -U add-zsh-hook
|
|
124
|
-
|
|
125
|
-
if [[ -f $USER_ZDOTDIR/.zshrc ]]; then
|
|
126
|
-
ZDOTDIR=$USER_ZDOTDIR
|
|
127
|
-
. $USER_ZDOTDIR/.zshrc
|
|
128
|
-
fi
|
|
129
|
-
|
|
130
|
-
__is_prompt_start() {
|
|
131
|
-
builtin printf '\\e]6973;PS\\a'
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
__is_prompt_end() {
|
|
135
|
-
builtin printf '\\e]6973;PE\\a'
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
__is_escape_value() {
|
|
139
|
-
builtin emulate -L zsh
|
|
140
|
-
|
|
141
|
-
# Process text byte by byte, not by codepoint.
|
|
142
|
-
builtin local LC_ALL=C str="$1" i byte token out=''
|
|
143
|
-
|
|
144
|
-
for (( i = 0; i < \${#str}; ++i )); do
|
|
145
|
-
byte="\${str:$i:1}"
|
|
146
|
-
|
|
147
|
-
# Escape backslashes and semi-colons
|
|
148
|
-
if [ "$byte" = "\\\\" ]; then
|
|
149
|
-
token="\\\\\\\\"
|
|
150
|
-
elif [ "$byte" = ";" ]; then
|
|
151
|
-
token="\\\\x3b"
|
|
152
|
-
elif [ "$byte" = $'\\n' ]; then
|
|
153
|
-
token="\\\\x0a"
|
|
154
|
-
elif [ "$byte" = $'\\e' ]; then
|
|
155
|
-
token="\\\\x1b"
|
|
156
|
-
elif [ "$byte" = $'\\a' ]; then
|
|
157
|
-
token="\\\\x07"
|
|
158
|
-
else
|
|
159
|
-
token="$byte"
|
|
160
|
-
fi
|
|
161
|
-
|
|
162
|
-
out+="$token"
|
|
163
|
-
done
|
|
164
|
-
|
|
165
|
-
builtin print -r "$out"
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
__is_update_cwd() {
|
|
169
|
-
builtin printf '\\e]6973;CWD;%s\\a' "$(__is_escape_value "\${PWD}")"
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
__is_update_prompt() {
|
|
173
|
-
__is_prior_prompt="$PS1"
|
|
174
|
-
if [[ $ISTERM_TESTING == "1" ]]; then
|
|
175
|
-
__is_prior_prompt="> "
|
|
176
|
-
fi
|
|
177
|
-
PS1="%{\$(__is_prompt_start)%}\$__is_prior_prompt%{\$(__is_prompt_end)%}"
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
__is_precmd() {
|
|
181
|
-
if [[ $PS1 != *"\$(__is_prompt_start)"* ]]; then
|
|
182
|
-
__is_update_prompt
|
|
183
|
-
fi
|
|
184
|
-
__is_update_cwd
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
__is_update_prompt
|
|
188
|
-
add-zsh-hook precmd __is_precmd
|
|
189
|
-
`;
|
|
190
|
-
|
|
191
|
-
const files = [
|
|
192
|
-
{ name: '.zshenv', content: shellIntegrationEnv },
|
|
193
|
-
{ name: '.zlogin', content: shellIntegrationLogin },
|
|
194
|
-
{ name: '.zprofile', content: shellIntegrationProfile },
|
|
195
|
-
{ name: '.zshrc', content: shellIntegrationRc },
|
|
196
|
-
];
|
|
197
|
-
|
|
198
|
-
await fs.mkdir(outputDir, { recursive: true });
|
|
199
|
-
|
|
200
|
-
for (const file of files) {
|
|
201
|
-
const filePath = path.join(outputDir, file.name);
|
|
202
|
-
await fs.writeFile(filePath, file.content, 'utf-8');
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
77
|
}
|