@opensumi/ide-terminal-next 3.7.2-next-1740450374.0 → 3.7.2-next-1741226843.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/resize.view.d.ts.map +1 -1
- package/lib/browser/component/resize.view.js +2 -2
- package/lib/browser/component/resize.view.js.map +1 -1
- package/lib/browser/component/tab.item.d.ts.map +1 -1
- package/lib/browser/component/tab.item.js +1 -23
- package/lib/browser/component/tab.item.js.map +1 -1
- package/lib/browser/component/tab.view.d.ts.map +1 -1
- package/lib/browser/component/tab.view.js +1 -10
- package/lib/browser/component/tab.view.js.map +1 -1
- package/lib/browser/component/terminal.module.less +27 -3
- package/lib/browser/component/terminal.view.d.ts.map +1 -1
- package/lib/browser/component/terminal.view.js +32 -2
- package/lib/browser/component/terminal.view.js.map +1 -1
- package/lib/browser/component/terminal.widget.d.ts.map +1 -1
- package/lib/browser/component/terminal.widget.js +3 -9
- package/lib/browser/component/terminal.widget.js.map +1 -1
- package/lib/browser/contribution/terminal.view.d.ts.map +1 -1
- package/lib/browser/contribution/terminal.view.js +0 -2
- package/lib/browser/contribution/terminal.view.js.map +1 -1
- package/lib/browser/links/link-manager.d.ts.map +1 -1
- package/lib/browser/links/link-manager.js +7 -10
- package/lib/browser/links/link-manager.js.map +1 -1
- package/lib/browser/links/validated-local-link-provider.d.ts +0 -1
- package/lib/browser/links/validated-local-link-provider.d.ts.map +1 -1
- package/lib/browser/links/validated-local-link-provider.js +42 -55
- package/lib/browser/links/validated-local-link-provider.js.map +1 -1
- package/lib/browser/terminal.client.d.ts +1 -7
- package/lib/browser/terminal.client.d.ts.map +1 -1
- package/lib/browser/terminal.client.js +2 -9
- package/lib/browser/terminal.client.js.map +1 -1
- package/lib/browser/terminal.controller.d.ts +2 -1
- package/lib/browser/terminal.controller.d.ts.map +1 -1
- package/lib/browser/terminal.controller.js +6 -6
- package/lib/browser/terminal.controller.js.map +1 -1
- package/lib/browser/terminal.hover.manager.d.ts.map +1 -1
- package/lib/browser/terminal.hover.manager.js +2 -4
- package/lib/browser/terminal.hover.manager.js.map +1 -1
- package/lib/browser/terminal.search.d.ts +1 -9
- package/lib/browser/terminal.search.d.ts.map +1 -1
- package/lib/browser/terminal.search.js +1 -49
- package/lib/browser/terminal.search.js.map +1 -1
- package/lib/browser/terminal.view.d.ts +5 -6
- package/lib/browser/terminal.view.d.ts.map +1 -1
- package/lib/browser/terminal.view.js +0 -13
- package/lib/browser/terminal.view.js.map +1 -1
- package/lib/browser/xterm.d.ts +1 -7
- package/lib/browser/xterm.d.ts.map +1 -1
- package/lib/browser/xterm.js +1 -12
- package/lib/browser/xterm.js.map +1 -1
- package/lib/common/client.d.ts +2 -8
- package/lib/common/client.d.ts.map +1 -1
- package/lib/common/client.js.map +1 -1
- package/lib/common/controller.d.ts +0 -16
- package/lib/common/controller.d.ts.map +1 -1
- package/lib/common/controller.js.map +1 -1
- package/lib/common/pty.d.ts +1 -1
- package/lib/common/pty.d.ts.map +1 -1
- package/lib/common/render.d.ts +0 -3
- package/lib/common/render.d.ts.map +1 -1
- package/lib/common/render.js.map +1 -1
- package/lib/common/xterm.d.ts +2 -8
- package/lib/common/xterm.d.ts.map +1 -1
- package/lib/common/xterm.js.map +1 -1
- package/package.json +18 -18
- package/src/browser/component/resize.view.tsx +1 -2
- package/src/browser/component/tab.item.tsx +0 -38
- package/src/browser/component/tab.view.tsx +0 -12
- package/src/browser/component/terminal.module.less +27 -3
- package/src/browser/component/terminal.view.tsx +56 -3
- package/src/browser/component/terminal.widget.tsx +3 -8
- package/src/browser/contribution/terminal.view.ts +0 -2
- package/src/browser/links/link-manager.ts +8 -11
- package/src/browser/links/validated-local-link-provider.ts +48 -68
- package/src/browser/terminal.client.ts +2 -13
- package/src/browser/terminal.controller.ts +8 -7
- package/src/browser/terminal.hover.manager.ts +4 -4
- package/src/browser/terminal.search.ts +2 -49
- package/src/browser/terminal.view.ts +0 -17
- package/src/browser/xterm.ts +1 -14
- package/src/common/client.ts +2 -7
- package/src/common/controller.ts +0 -20
- package/src/common/pty.ts +1 -1
- package/src/common/render.ts +0 -3
- package/src/common/xterm-private.d.ts +4 -7
- package/src/common/xterm.ts +2 -6
- package/lib/browser/component/search.module.less +0 -61
- package/lib/browser/component/search.view.d.ts +0 -3
- package/lib/browser/component/search.view.d.ts.map +0 -1
- package/lib/browser/component/search.view.js +0 -89
- package/lib/browser/component/search.view.js.map +0 -1
- package/lib/browser/links/word-link-provider.d.ts +0 -29
- package/lib/browser/links/word-link-provider.d.ts.map +0 -1
- package/lib/browser/links/word-link-provider.js +0 -153
- package/lib/browser/links/word-link-provider.js.map +0 -1
- package/src/browser/component/search.module.less +0 -61
- package/src/browser/component/search.view.tsx +0 -142
- package/src/browser/links/word-link-provider.ts +0 -175
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { IBufferLine, Terminal } from '@xterm/xterm';
|
|
2
|
-
|
|
3
|
-
import { Autowired, INJECTOR_TOKEN, Injectable, Injector } from '@opensumi/di';
|
|
4
|
-
import { PrefixQuickOpenService } from '@opensumi/ide-core-browser/lib/quick-open';
|
|
5
|
-
import { AppConfig } from '@opensumi/ide-core-browser/lib/react-providers/config-provider';
|
|
6
|
-
import { IWindowService } from '@opensumi/ide-core-browser/lib/window';
|
|
7
|
-
import { URI } from '@opensumi/ide-core-common';
|
|
8
|
-
import { CommandService } from '@opensumi/ide-core-common/lib/command';
|
|
9
|
-
import { IWorkspaceService } from '@opensumi/ide-workspace/lib/common/workspace.interface';
|
|
10
|
-
|
|
11
|
-
import { escapeRegExpCharacters } from '../terminal.typeAhead.addon';
|
|
12
|
-
|
|
13
|
-
import { TerminalBaseLinkProvider } from './base';
|
|
14
|
-
import { convertLinkRangeToBuffer, getXtermLineContent } from './helpers';
|
|
15
|
-
import { TerminalLink } from './link';
|
|
16
|
-
|
|
17
|
-
export const USUAL_WORD_SEPARATORS = ' ()[]{}\',"`─‘’“”|';
|
|
18
|
-
|
|
19
|
-
interface Word {
|
|
20
|
-
startIndex: number;
|
|
21
|
-
endIndex: number;
|
|
22
|
-
text: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@Injectable({ multiple: true })
|
|
26
|
-
export class TerminalWordLinkProvider extends TerminalBaseLinkProvider {
|
|
27
|
-
private _separatorRegex!: RegExp;
|
|
28
|
-
|
|
29
|
-
@Autowired(AppConfig)
|
|
30
|
-
private readonly appConfig: AppConfig;
|
|
31
|
-
|
|
32
|
-
@Autowired(CommandService)
|
|
33
|
-
private readonly commandService: CommandService;
|
|
34
|
-
|
|
35
|
-
@Autowired(IWindowService)
|
|
36
|
-
protected readonly windowService: IWindowService;
|
|
37
|
-
|
|
38
|
-
@Autowired(INJECTOR_TOKEN)
|
|
39
|
-
private readonly injector: Injector;
|
|
40
|
-
|
|
41
|
-
@Autowired(IWorkspaceService)
|
|
42
|
-
private readonly workspaceService: IWorkspaceService;
|
|
43
|
-
|
|
44
|
-
@Autowired(PrefixQuickOpenService)
|
|
45
|
-
protected readonly quickOpenService: PrefixQuickOpenService;
|
|
46
|
-
|
|
47
|
-
constructor(
|
|
48
|
-
private readonly _xterm: Terminal,
|
|
49
|
-
private readonly _validationCallback: (
|
|
50
|
-
link: string,
|
|
51
|
-
callback: (result: { uri: URI; isDirectory: boolean } | undefined) => void,
|
|
52
|
-
) => void,
|
|
53
|
-
private readonly _activateFileCallback: (event: MouseEvent | undefined, link: string) => void,
|
|
54
|
-
) {
|
|
55
|
-
super();
|
|
56
|
-
this._refreshSeparatorCodes();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
private _refreshSeparatorCodes(): void {
|
|
60
|
-
let powerlineSymbols = '';
|
|
61
|
-
for (let i = 0xe0b0; i <= 0xe0bf; i++) {
|
|
62
|
-
powerlineSymbols += String.fromCharCode(i);
|
|
63
|
-
}
|
|
64
|
-
this._separatorRegex = new RegExp(`[${escapeRegExpCharacters(USUAL_WORD_SEPARATORS)}${powerlineSymbols}]`, 'g');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
protected _provideLinks(bufferLineNumber: number): Promise<TerminalLink[]> | TerminalLink[] {
|
|
68
|
-
const links: TerminalLink[] = [];
|
|
69
|
-
const startLine = bufferLineNumber - 1;
|
|
70
|
-
const endLine = startLine;
|
|
71
|
-
|
|
72
|
-
const lines: IBufferLine[] = [this._xterm.buffer.active.getLine(startLine)!];
|
|
73
|
-
|
|
74
|
-
const text = getXtermLineContent(this._xterm.buffer.active, startLine, endLine, this._xterm.cols);
|
|
75
|
-
if (text === '' || text.length > 1024) {
|
|
76
|
-
return [];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Parse out all words from the wrapped line
|
|
80
|
-
const words: Word[] = this._parseWords(text);
|
|
81
|
-
|
|
82
|
-
// Map the words to ITerminalLink objects
|
|
83
|
-
for (const word of words) {
|
|
84
|
-
if (word.text === '') {
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (word.text.length > 0 && word.text.charAt(word.text.length - 1) === ':') {
|
|
89
|
-
word.text = word.text.slice(0, -1);
|
|
90
|
-
word.endIndex--;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const bufferRange = convertLinkRangeToBuffer(
|
|
94
|
-
lines,
|
|
95
|
-
this._xterm.cols,
|
|
96
|
-
{
|
|
97
|
-
startColumn: word.startIndex + 1,
|
|
98
|
-
startLineNumber: 1,
|
|
99
|
-
endColumn: word.endIndex + 1,
|
|
100
|
-
endLineNumber: 1,
|
|
101
|
-
},
|
|
102
|
-
startLine,
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
// Search links
|
|
106
|
-
const activateHandler = (event: MouseEvent | undefined, text: string) => {
|
|
107
|
-
this._validationCallback(text, async (result) => {
|
|
108
|
-
if (result) {
|
|
109
|
-
if (result.isDirectory) {
|
|
110
|
-
this._handleLocalFolderLink(result.uri);
|
|
111
|
-
} else {
|
|
112
|
-
this._activateFileCallback(event, text);
|
|
113
|
-
}
|
|
114
|
-
} else {
|
|
115
|
-
this.quickOpenService.open(text);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
links.push(
|
|
121
|
-
this.injector.get(TerminalLink, [
|
|
122
|
-
this._xterm,
|
|
123
|
-
bufferRange,
|
|
124
|
-
word.text,
|
|
125
|
-
this._xterm.buffer.active.viewportY,
|
|
126
|
-
activateHandler,
|
|
127
|
-
undefined,
|
|
128
|
-
true,
|
|
129
|
-
word.text,
|
|
130
|
-
]),
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return links;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
private async _handleLocalFolderLink(uri: URI): Promise<void> {
|
|
138
|
-
// If the folder is within one of the window's workspaces, focus it in the explorer
|
|
139
|
-
if (await this._isDirectoryInsideWorkspace(uri)) {
|
|
140
|
-
await this.commandService.executeCommand('revealInExplorer', uri);
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Open a new window for the folder
|
|
145
|
-
if (this.appConfig.isElectronRenderer) {
|
|
146
|
-
this.windowService.openWorkspace(uri, { newWindow: true });
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
private _parseWords(text: string): Word[] {
|
|
151
|
-
const words: Word[] = [];
|
|
152
|
-
const splitWords = text.split(this._separatorRegex);
|
|
153
|
-
let runningIndex = 0;
|
|
154
|
-
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
155
|
-
for (let i = 0; i < splitWords.length; i++) {
|
|
156
|
-
words.push({
|
|
157
|
-
text: splitWords[i],
|
|
158
|
-
startIndex: runningIndex,
|
|
159
|
-
endIndex: runningIndex + splitWords[i].length,
|
|
160
|
-
});
|
|
161
|
-
runningIndex += splitWords[i].length + 1;
|
|
162
|
-
}
|
|
163
|
-
return words;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
private async _isDirectoryInsideWorkspace(uri: URI) {
|
|
167
|
-
const folders = await this.workspaceService.roots;
|
|
168
|
-
for (const folder of folders) {
|
|
169
|
-
if (URI.parse(folder.uri).isEqualOrParent(uri)) {
|
|
170
|
-
return true;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
|
-
}
|