@codingame/monaco-vscode-api 1.83.15-next.0 → 1.83.16
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/README.md +430 -0
- package/contributions.js +3 -0
- package/localExtensionHost.js +3 -2
- package/missing-services.js +57 -1
- package/monaco-editor-treemending.patch +3375 -3375
- package/package.json +6 -6
- package/vscode/src/vs/base/common/prefixTree.js +130 -0
- package/vscode/src/vs/platform/actions/browser/floatingMenu.js +26 -2
- package/vscode/src/vs/platform/terminal/common/capabilities/bufferMarkCapability.js +41 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +566 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/cwdDetectionCapability.js +29 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.js +48 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/terminalCapabilityStore.js +94 -0
- package/vscode/src/vs/platform/terminal/common/terminalEnvironment.js +37 -0
- package/vscode/src/vs/platform/terminal/common/terminalStrings.js +16 -0
- package/vscode/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.js +319 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.js +91 -1
- package/vscode/src/vs/workbench/contrib/format/browser/formatActionsMultiple.js +423 -0
- package/vscode/src/vs/workbench/contrib/format/browser/formatActionsNone.js +82 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.js +564 -11
- package/vscode/src/vs/workbench/contrib/scm/common/scm.js +9 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/detachedTerminal.js +67 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalExtensions.js +25 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIcons.js +64 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/widgets/widgetManager.js +36 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +538 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationStyles.js +104 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +416 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/suggestAddon.js +390 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +799 -0
- package/vscode/src/vs/workbench/contrib/testing/common/getComputedState.js +101 -0
- package/vscode/src/vs/workbench/contrib/testing/common/observableValue.js +30 -0
- package/vscode/src/vs/workbench/contrib/testing/common/storedValue.js +36 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testExplorerFilterState.js +116 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testProfileService.js +172 -1
- package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +384 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testResultService.js +156 -1
- package/vscode/src/vs/workbench/contrib/testing/common/testResultStorage.js +156 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testService.js +75 -1
- package/vscode/src/vs/workbench/contrib/testing/common/testTypes.js +9 -1
- package/vscode/src/vs/workbench/contrib/testing/common/testingContextKeys.js +179 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testingContinuousRunService.js +102 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testingDecorations.js +29 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testingPeekOpener.js +3 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testingStates.js +47 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +594 -2
- package/vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js +307 -1
- package/vscode/src/vs/workbench/services/suggest/browser/media/suggest.css.js +4 -0
- package/vscode/src/vs/workbench/services/suggest/browser/simpleCompletionItem.js +10 -0
- package/vscode/src/vs/workbench/services/suggest/browser/simpleCompletionModel.js +98 -0
- package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidget.js +428 -0
- package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidgetRenderer.js +83 -0
- package/vscode/src/vs/workbench/services/textfile/common/textfiles.js +6 -2
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
2
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
+
class TerminalCapabilityStore extends Disposable {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this._map = ( new Map());
|
|
7
|
+
this._onDidRemoveCapabilityType = this._register(( new Emitter()));
|
|
8
|
+
this.onDidRemoveCapabilityType = this._onDidRemoveCapabilityType.event;
|
|
9
|
+
this._onDidAddCapabilityType = this._register(( new Emitter()));
|
|
10
|
+
this.onDidAddCapabilityType = this._onDidAddCapabilityType.event;
|
|
11
|
+
this._onDidRemoveCapability = this._register(( new Emitter()));
|
|
12
|
+
this.onDidRemoveCapability = this._onDidRemoveCapability.event;
|
|
13
|
+
this._onDidAddCapability = this._register(( new Emitter()));
|
|
14
|
+
this.onDidAddCapability = this._onDidAddCapability.event;
|
|
15
|
+
}
|
|
16
|
+
get items() {
|
|
17
|
+
return ( this._map.keys());
|
|
18
|
+
}
|
|
19
|
+
add(capability, impl) {
|
|
20
|
+
this._map.set(capability, impl);
|
|
21
|
+
this._onDidAddCapabilityType.fire(capability);
|
|
22
|
+
this._onDidAddCapability.fire({ id: capability, capability: impl });
|
|
23
|
+
}
|
|
24
|
+
get(capability) {
|
|
25
|
+
return this._map.get(capability);
|
|
26
|
+
}
|
|
27
|
+
remove(capability) {
|
|
28
|
+
const impl = this._map.get(capability);
|
|
29
|
+
if (!impl) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
this._map.delete(capability);
|
|
33
|
+
this._onDidRemoveCapabilityType.fire(capability);
|
|
34
|
+
this._onDidAddCapability.fire({ id: capability, capability: impl });
|
|
35
|
+
}
|
|
36
|
+
has(capability) {
|
|
37
|
+
return ( this._map.has(capability));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
class TerminalCapabilityStoreMultiplexer extends Disposable {
|
|
41
|
+
constructor() {
|
|
42
|
+
super(...arguments);
|
|
43
|
+
this._stores = [];
|
|
44
|
+
this._onDidRemoveCapabilityType = this._register(( new Emitter()));
|
|
45
|
+
this.onDidRemoveCapabilityType = this._onDidRemoveCapabilityType.event;
|
|
46
|
+
this._onDidAddCapabilityType = this._register(( new Emitter()));
|
|
47
|
+
this.onDidAddCapabilityType = this._onDidAddCapabilityType.event;
|
|
48
|
+
this._onDidRemoveCapability = this._register(( new Emitter()));
|
|
49
|
+
this.onDidRemoveCapability = this._onDidRemoveCapability.event;
|
|
50
|
+
this._onDidAddCapability = this._register(( new Emitter()));
|
|
51
|
+
this.onDidAddCapability = this._onDidAddCapability.event;
|
|
52
|
+
}
|
|
53
|
+
get items() {
|
|
54
|
+
return this._items();
|
|
55
|
+
}
|
|
56
|
+
*_items() {
|
|
57
|
+
for (const store of this._stores) {
|
|
58
|
+
for (const c of store.items) {
|
|
59
|
+
yield c;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
has(capability) {
|
|
64
|
+
for (const store of this._stores) {
|
|
65
|
+
for (const c of store.items) {
|
|
66
|
+
if (c === capability) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
get(capability) {
|
|
74
|
+
for (const store of this._stores) {
|
|
75
|
+
const c = store.get(capability);
|
|
76
|
+
if (c) {
|
|
77
|
+
return c;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
add(store) {
|
|
83
|
+
this._stores.push(store);
|
|
84
|
+
for (const capability of store.items) {
|
|
85
|
+
this._onDidAddCapabilityType.fire(capability);
|
|
86
|
+
this._onDidAddCapability.fire({ id: capability, capability: store.get(capability) });
|
|
87
|
+
}
|
|
88
|
+
this._register(store.onDidAddCapabilityType(e => this._onDidAddCapabilityType.fire(e)));
|
|
89
|
+
this._register(store.onDidAddCapability(e => this._onDidAddCapability.fire(e)));
|
|
90
|
+
this._register(store.onDidRemoveCapabilityType(e => this._onDidRemoveCapabilityType.fire(e)));
|
|
91
|
+
this._register(store.onDidRemoveCapability(e => this._onDidRemoveCapability.fire(e)));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export { TerminalCapabilityStore, TerminalCapabilityStoreMultiplexer };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { OS } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
2
|
+
function escapeNonWindowsPath(path) {
|
|
3
|
+
let newPath = path;
|
|
4
|
+
if (newPath.includes('\\')) {
|
|
5
|
+
newPath = newPath.replace(/\\/g, '\\\\');
|
|
6
|
+
}
|
|
7
|
+
const bannedChars = /[\`\$\|\&\>\~\#\!\^\*\;\<\"\']/g;
|
|
8
|
+
newPath = newPath.replace(bannedChars, '');
|
|
9
|
+
return `'${newPath}'`;
|
|
10
|
+
}
|
|
11
|
+
function collapseTildePath(path, userHome, separator) {
|
|
12
|
+
if (!path) {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
if (!userHome) {
|
|
16
|
+
return path;
|
|
17
|
+
}
|
|
18
|
+
if (userHome.match(/[\/\\]$/)) {
|
|
19
|
+
userHome = userHome.slice(0, userHome.length - 1);
|
|
20
|
+
}
|
|
21
|
+
const normalizedPath = path.replace(/\\/g, '/').toLowerCase();
|
|
22
|
+
const normalizedUserHome = userHome.replace(/\\/g, '/').toLowerCase();
|
|
23
|
+
if (!normalizedPath.includes(normalizedUserHome)) {
|
|
24
|
+
return path;
|
|
25
|
+
}
|
|
26
|
+
return `~${separator}${path.slice(userHome.length + 1)}`;
|
|
27
|
+
}
|
|
28
|
+
function sanitizeCwd(cwd) {
|
|
29
|
+
if (cwd.match(/^['"].*['"]$/)) {
|
|
30
|
+
cwd = cwd.substring(1, cwd.length - 1);
|
|
31
|
+
}
|
|
32
|
+
if (OS === 1 && cwd && cwd[1] === ':') {
|
|
33
|
+
return cwd[0].toUpperCase() + cwd.substring(1);
|
|
34
|
+
}
|
|
35
|
+
return cwd;
|
|
36
|
+
}
|
|
37
|
+
export { collapseTildePath, escapeNonWindowsPath, sanitizeCwd };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function formatMessageForTerminal(message, options = {}) {
|
|
2
|
+
let result = '';
|
|
3
|
+
if (!options.excludeLeadingNewLine) {
|
|
4
|
+
result += '\r\n';
|
|
5
|
+
}
|
|
6
|
+
result += '\x1b[0m\x1b[7m * ';
|
|
7
|
+
if (options.loudFormatting) {
|
|
8
|
+
result += '\x1b[0;104m';
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
result += '\x1b[0m';
|
|
12
|
+
}
|
|
13
|
+
result += ` ${message} \x1b[0m\n\r`;
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
export { formatMessageForTerminal };
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { Disposable, toDisposable, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
2
|
+
import { TerminalCapabilityStore } from '../capabilities/terminalCapabilityStore.js';
|
|
3
|
+
import { CommandDetectionCapability } from '../capabilities/commandDetectionCapability.js';
|
|
4
|
+
import { CwdDetectionCapability } from '../capabilities/cwdDetectionCapability.js';
|
|
5
|
+
import { PartialCommandDetectionCapability } from '../capabilities/partialCommandDetectionCapability.js';
|
|
6
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
7
|
+
import { BufferMarkCapability } from '../capabilities/bufferMarkCapability.js';
|
|
8
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
9
|
+
import { sanitizeCwd } from '../terminalEnvironment.js';
|
|
10
|
+
class ShellIntegrationAddon extends Disposable {
|
|
11
|
+
get status() { return this._status; }
|
|
12
|
+
constructor(_nonce, _disableTelemetry, _telemetryService, _logService) {
|
|
13
|
+
super();
|
|
14
|
+
this._nonce = _nonce;
|
|
15
|
+
this._disableTelemetry = _disableTelemetry;
|
|
16
|
+
this._telemetryService = _telemetryService;
|
|
17
|
+
this._logService = _logService;
|
|
18
|
+
this.capabilities = this._register(( new TerminalCapabilityStore()));
|
|
19
|
+
this._hasUpdatedTelemetry = false;
|
|
20
|
+
this._commonProtocolDisposables = [];
|
|
21
|
+
this._status = 0 ;
|
|
22
|
+
this._onDidChangeStatus = ( new Emitter());
|
|
23
|
+
this.onDidChangeStatus = this._onDidChangeStatus.event;
|
|
24
|
+
this._register(toDisposable(() => {
|
|
25
|
+
this._clearActivationTimeout();
|
|
26
|
+
this._disposeCommonProtocol();
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
_disposeCommonProtocol() {
|
|
30
|
+
dispose(this._commonProtocolDisposables);
|
|
31
|
+
this._commonProtocolDisposables.length = 0;
|
|
32
|
+
}
|
|
33
|
+
activate(xterm) {
|
|
34
|
+
this._terminal = xterm;
|
|
35
|
+
this.capabilities.add(3 , this._register(( new PartialCommandDetectionCapability(this._terminal))));
|
|
36
|
+
this._register(xterm.parser.registerOscHandler(633 , data => this._handleVSCodeSequence(data)));
|
|
37
|
+
this._register(xterm.parser.registerOscHandler(1337 , data => this._doHandleITermSequence(data)));
|
|
38
|
+
this._commonProtocolDisposables.push(xterm.parser.registerOscHandler(133 , data => this._handleFinalTermSequence(data)));
|
|
39
|
+
this._register(xterm.parser.registerOscHandler(7 , data => this._doHandleSetCwd(data)));
|
|
40
|
+
this._register(xterm.parser.registerOscHandler(9 , data => this._doHandleSetWindowsFriendlyCwd(data)));
|
|
41
|
+
this._ensureCapabilitiesOrAddFailureTelemetry();
|
|
42
|
+
}
|
|
43
|
+
getMarkerId(terminal, vscodeMarkerId) {
|
|
44
|
+
this._createOrGetBufferMarkDetection(terminal).getMark(vscodeMarkerId);
|
|
45
|
+
}
|
|
46
|
+
_handleFinalTermSequence(data) {
|
|
47
|
+
const didHandle = this._doHandleFinalTermSequence(data);
|
|
48
|
+
if (this._status === 0 ) {
|
|
49
|
+
this._status = 1 ;
|
|
50
|
+
this._onDidChangeStatus.fire(this._status);
|
|
51
|
+
}
|
|
52
|
+
return didHandle;
|
|
53
|
+
}
|
|
54
|
+
_doHandleFinalTermSequence(data) {
|
|
55
|
+
if (!this._terminal) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
const [command, ...args] = data.split(';');
|
|
59
|
+
switch (command) {
|
|
60
|
+
case 'A':
|
|
61
|
+
this._createOrGetCommandDetection(this._terminal).handlePromptStart();
|
|
62
|
+
return true;
|
|
63
|
+
case 'B':
|
|
64
|
+
this._createOrGetCommandDetection(this._terminal).handleCommandStart({ ignoreCommandLine: true });
|
|
65
|
+
return true;
|
|
66
|
+
case 'C':
|
|
67
|
+
this._createOrGetCommandDetection(this._terminal).handleCommandExecuted();
|
|
68
|
+
return true;
|
|
69
|
+
case 'D': {
|
|
70
|
+
const exitCode = args.length === 1 ? parseInt(args[0]) : undefined;
|
|
71
|
+
this._createOrGetCommandDetection(this._terminal).handleCommandFinished(exitCode);
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
_handleVSCodeSequence(data) {
|
|
78
|
+
const didHandle = this._doHandleVSCodeSequence(data);
|
|
79
|
+
if (!this._hasUpdatedTelemetry && didHandle) {
|
|
80
|
+
this._telemetryService?.publicLog2('terminal/shellIntegrationActivationSucceeded');
|
|
81
|
+
this._hasUpdatedTelemetry = true;
|
|
82
|
+
this._clearActivationTimeout();
|
|
83
|
+
}
|
|
84
|
+
if (this._status !== 2 ) {
|
|
85
|
+
this._status = 2 ;
|
|
86
|
+
this._onDidChangeStatus.fire(this._status);
|
|
87
|
+
}
|
|
88
|
+
return didHandle;
|
|
89
|
+
}
|
|
90
|
+
async _ensureCapabilitiesOrAddFailureTelemetry() {
|
|
91
|
+
if (!this._telemetryService || this._disableTelemetry) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this._activationTimeout = setTimeout(() => {
|
|
95
|
+
if (!this.capabilities.get(2 ) && !this.capabilities.get(0 )) {
|
|
96
|
+
this._telemetryService?.publicLog2('terminal/shellIntegrationActivationTimeout');
|
|
97
|
+
this._logService.warn('Shell integration failed to add capabilities within 10 seconds');
|
|
98
|
+
}
|
|
99
|
+
this._hasUpdatedTelemetry = true;
|
|
100
|
+
}, 10000);
|
|
101
|
+
}
|
|
102
|
+
_clearActivationTimeout() {
|
|
103
|
+
if (this._activationTimeout !== undefined) {
|
|
104
|
+
clearTimeout(this._activationTimeout);
|
|
105
|
+
this._activationTimeout = undefined;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
_doHandleVSCodeSequence(data) {
|
|
109
|
+
if (!this._terminal) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
const argsIndex = data.indexOf(';');
|
|
113
|
+
const sequenceCommand = argsIndex === -1 ? data : data.substring(0, argsIndex);
|
|
114
|
+
const args = argsIndex === -1 ? [] : data.substring(argsIndex + 1).split(';');
|
|
115
|
+
switch (sequenceCommand) {
|
|
116
|
+
case "A" :
|
|
117
|
+
this._createOrGetCommandDetection(this._terminal).handlePromptStart();
|
|
118
|
+
return true;
|
|
119
|
+
case "B" :
|
|
120
|
+
this._createOrGetCommandDetection(this._terminal).handleCommandStart();
|
|
121
|
+
return true;
|
|
122
|
+
case "C" :
|
|
123
|
+
this._createOrGetCommandDetection(this._terminal).handleCommandExecuted();
|
|
124
|
+
return true;
|
|
125
|
+
case "D" : {
|
|
126
|
+
const arg0 = args[0];
|
|
127
|
+
const exitCode = arg0 !== undefined ? parseInt(arg0) : undefined;
|
|
128
|
+
this._createOrGetCommandDetection(this._terminal).handleCommandFinished(exitCode);
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
case "E" : {
|
|
132
|
+
const arg0 = args[0];
|
|
133
|
+
const arg1 = args[1];
|
|
134
|
+
let commandLine;
|
|
135
|
+
if (arg0 !== undefined) {
|
|
136
|
+
commandLine = deserializeMessage(arg0);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
commandLine = '';
|
|
140
|
+
}
|
|
141
|
+
this._createOrGetCommandDetection(this._terminal).setCommandLine(commandLine, arg1 === this._nonce);
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
case "F" : {
|
|
145
|
+
this._createOrGetCommandDetection(this._terminal).handleContinuationStart();
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
case "G" : {
|
|
149
|
+
this._createOrGetCommandDetection(this._terminal).handleContinuationEnd();
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
case "H" : {
|
|
153
|
+
this._createOrGetCommandDetection(this._terminal).handleRightPromptStart();
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
case "I" : {
|
|
157
|
+
this._createOrGetCommandDetection(this._terminal).handleRightPromptEnd();
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
case "P" : {
|
|
161
|
+
const arg0 = args[0];
|
|
162
|
+
const deserialized = arg0 !== undefined ? deserializeMessage(arg0) : '';
|
|
163
|
+
const { key, value } = parseKeyValueAssignment(deserialized);
|
|
164
|
+
if (value === undefined) {
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
switch (key) {
|
|
168
|
+
case 'Cwd': {
|
|
169
|
+
this._updateCwd(value);
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
case 'IsWindows': {
|
|
173
|
+
this._createOrGetCommandDetection(this._terminal).setIsWindowsPty(value === 'True' ? true : false);
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
case 'Task': {
|
|
177
|
+
this._createOrGetBufferMarkDetection(this._terminal);
|
|
178
|
+
this.capabilities.get(2 )?.setIsCommandStorageDisabled();
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
case "SetMark" : {
|
|
184
|
+
this._createOrGetBufferMarkDetection(this._terminal).addMark(parseMarkSequence(args));
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
_updateCwd(value) {
|
|
191
|
+
value = sanitizeCwd(value);
|
|
192
|
+
this._createOrGetCwdDetection().updateCwd(value);
|
|
193
|
+
const commandDetection = this.capabilities.get(2 );
|
|
194
|
+
commandDetection?.setCwd(value);
|
|
195
|
+
}
|
|
196
|
+
_doHandleITermSequence(data) {
|
|
197
|
+
if (!this._terminal) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
const [command] = data.split(';');
|
|
201
|
+
switch (command) {
|
|
202
|
+
case "SetMark" : {
|
|
203
|
+
this._createOrGetBufferMarkDetection(this._terminal).addMark();
|
|
204
|
+
}
|
|
205
|
+
default: {
|
|
206
|
+
const { key, value } = parseKeyValueAssignment(command);
|
|
207
|
+
if (value === undefined) {
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
switch (key) {
|
|
211
|
+
case "CurrentDir" :
|
|
212
|
+
this._updateCwd(value);
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
_doHandleSetWindowsFriendlyCwd(data) {
|
|
220
|
+
if (!this._terminal) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
const [command, ...args] = data.split(';');
|
|
224
|
+
switch (command) {
|
|
225
|
+
case '9':
|
|
226
|
+
if (args.length) {
|
|
227
|
+
this._updateCwd(args[0]);
|
|
228
|
+
}
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
_doHandleSetCwd(data) {
|
|
234
|
+
if (!this._terminal) {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
const [command] = data.split(';');
|
|
238
|
+
if (command.match(/^file:\/\/.*\//)) {
|
|
239
|
+
const uri = ( URI.parse(command));
|
|
240
|
+
if (uri.path && uri.path.length > 0) {
|
|
241
|
+
this._updateCwd(uri.path);
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
serialize() {
|
|
248
|
+
if (!this._terminal || !( this.capabilities.has(2 ))) {
|
|
249
|
+
return {
|
|
250
|
+
isWindowsPty: false,
|
|
251
|
+
commands: []
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
const result = this._createOrGetCommandDetection(this._terminal).serialize();
|
|
255
|
+
return result;
|
|
256
|
+
}
|
|
257
|
+
deserialize(serialized) {
|
|
258
|
+
if (!this._terminal) {
|
|
259
|
+
throw new Error('Cannot restore commands before addon is activated');
|
|
260
|
+
}
|
|
261
|
+
this._createOrGetCommandDetection(this._terminal).deserialize(serialized);
|
|
262
|
+
}
|
|
263
|
+
_createOrGetCwdDetection() {
|
|
264
|
+
let cwdDetection = this.capabilities.get(0 );
|
|
265
|
+
if (!cwdDetection) {
|
|
266
|
+
cwdDetection = this._register(( new CwdDetectionCapability()));
|
|
267
|
+
this.capabilities.add(0 , cwdDetection);
|
|
268
|
+
}
|
|
269
|
+
return cwdDetection;
|
|
270
|
+
}
|
|
271
|
+
_createOrGetCommandDetection(terminal) {
|
|
272
|
+
let commandDetection = this.capabilities.get(2 );
|
|
273
|
+
if (!commandDetection) {
|
|
274
|
+
commandDetection = this._register(( new CommandDetectionCapability(terminal, this._logService)));
|
|
275
|
+
this.capabilities.add(2 , commandDetection);
|
|
276
|
+
}
|
|
277
|
+
return commandDetection;
|
|
278
|
+
}
|
|
279
|
+
_createOrGetBufferMarkDetection(terminal) {
|
|
280
|
+
let bufferMarkDetection = this.capabilities.get(4 );
|
|
281
|
+
if (!bufferMarkDetection) {
|
|
282
|
+
bufferMarkDetection = this._register(( new BufferMarkCapability(terminal)));
|
|
283
|
+
this.capabilities.add(4 , bufferMarkDetection);
|
|
284
|
+
}
|
|
285
|
+
return bufferMarkDetection;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function deserializeMessage(message) {
|
|
289
|
+
return message.replaceAll(
|
|
290
|
+
/\\(\\|x([0-9a-f]{2}))/gi,
|
|
291
|
+
(_match, op, hex) => hex ? String.fromCharCode(parseInt(hex, 16)) : op);
|
|
292
|
+
}
|
|
293
|
+
function parseKeyValueAssignment(message) {
|
|
294
|
+
const separatorIndex = message.indexOf('=');
|
|
295
|
+
if (separatorIndex === -1) {
|
|
296
|
+
return { key: message, value: undefined };
|
|
297
|
+
}
|
|
298
|
+
return {
|
|
299
|
+
key: message.substring(0, separatorIndex),
|
|
300
|
+
value: message.substring(1 + separatorIndex)
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
function parseMarkSequence(sequence) {
|
|
304
|
+
let id = undefined;
|
|
305
|
+
let hidden = false;
|
|
306
|
+
for (const property of sequence) {
|
|
307
|
+
if (property === undefined) {
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
if (property === 'Hidden') {
|
|
311
|
+
hidden = true;
|
|
312
|
+
}
|
|
313
|
+
if (property.startsWith('Id=')) {
|
|
314
|
+
id = property.substring(3);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return { id, hidden };
|
|
318
|
+
}
|
|
319
|
+
export { ShellIntegrationAddon, deserializeMessage, parseKeyValueAssignment, parseMarkSequence };
|
|
@@ -23,6 +23,8 @@ import { getSimpleEditorOptions } from '../simpleEditorOptions.js';
|
|
|
23
23
|
import { SelectionClipboardContributionID } from '../selectionClipboard.js';
|
|
24
24
|
import { EditorExtensionsRegistry } from 'monaco-editor/esm/vs/editor/browser/editorExtensions.js';
|
|
25
25
|
import { DEFAULT_FONT_FAMILY } from '../../../../browser/style.js';
|
|
26
|
+
import { HistoryNavigator } from 'monaco-editor/esm/vs/base/common/history.js';
|
|
27
|
+
import { registerAndCreateHistoryNavigationContext } from 'monaco-editor/esm/vs/platform/history/browser/contextScopedHistoryWidget.js';
|
|
26
28
|
import { ServiceCollection } from 'monaco-editor/esm/vs/platform/instantiation/common/serviceCollection.js';
|
|
27
29
|
import { ILanguageFeaturesService } from 'monaco-editor/esm/vs/editor/common/services/languageFeatures.js';
|
|
28
30
|
import { ensureValidWordDefinition, getWordAtText } from 'monaco-editor/esm/vs/editor/common/core/wordHelper.js';
|
|
@@ -206,6 +208,94 @@ SuggestEnabledInput = ( (__decorate([
|
|
|
206
208
|
( (__param(9, ILanguageFeaturesService))),
|
|
207
209
|
( (__param(10, IConfigurationService)))
|
|
208
210
|
], SuggestEnabledInput)));
|
|
211
|
+
let SuggestEnabledInputWithHistory = class SuggestEnabledInputWithHistory extends SuggestEnabledInput {
|
|
212
|
+
constructor({ id, parent, ariaLabel, suggestionProvider, resourceHandle, suggestOptions, history }, instantiationService, modelService, contextKeyService, languageFeaturesService, configurationService) {
|
|
213
|
+
super(id, parent, suggestionProvider, ariaLabel, resourceHandle, suggestOptions, instantiationService, modelService, contextKeyService, languageFeaturesService, configurationService);
|
|
214
|
+
this.history = ( (new HistoryNavigator(history, 100)));
|
|
215
|
+
}
|
|
216
|
+
addToHistory() {
|
|
217
|
+
const value = this.getValue();
|
|
218
|
+
if (value && value !== this.getCurrentValue()) {
|
|
219
|
+
this.history.add(value);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
getHistory() {
|
|
223
|
+
return this.history.getHistory();
|
|
224
|
+
}
|
|
225
|
+
showNextValue() {
|
|
226
|
+
if (!( (this.history.has(this.getValue())))) {
|
|
227
|
+
this.addToHistory();
|
|
228
|
+
}
|
|
229
|
+
let next = this.getNextValue();
|
|
230
|
+
if (next) {
|
|
231
|
+
next = next === this.getValue() ? this.getNextValue() : next;
|
|
232
|
+
}
|
|
233
|
+
this.setValue(next ?? '');
|
|
234
|
+
}
|
|
235
|
+
showPreviousValue() {
|
|
236
|
+
if (!( (this.history.has(this.getValue())))) {
|
|
237
|
+
this.addToHistory();
|
|
238
|
+
}
|
|
239
|
+
let previous = this.getPreviousValue();
|
|
240
|
+
if (previous) {
|
|
241
|
+
previous = previous === this.getValue() ? this.getPreviousValue() : previous;
|
|
242
|
+
}
|
|
243
|
+
if (previous) {
|
|
244
|
+
this.setValue(previous);
|
|
245
|
+
this.inputWidget.setPosition({ lineNumber: 0, column: 0 });
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
clearHistory() {
|
|
249
|
+
this.history.clear();
|
|
250
|
+
}
|
|
251
|
+
getCurrentValue() {
|
|
252
|
+
let currentValue = this.history.current();
|
|
253
|
+
if (!currentValue) {
|
|
254
|
+
currentValue = this.history.last();
|
|
255
|
+
this.history.next();
|
|
256
|
+
}
|
|
257
|
+
return currentValue;
|
|
258
|
+
}
|
|
259
|
+
getPreviousValue() {
|
|
260
|
+
return this.history.previous() || this.history.first();
|
|
261
|
+
}
|
|
262
|
+
getNextValue() {
|
|
263
|
+
return this.history.next();
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
SuggestEnabledInputWithHistory = ( (__decorate([
|
|
267
|
+
( (__param(1, IInstantiationService))),
|
|
268
|
+
( (__param(2, IModelService))),
|
|
269
|
+
( (__param(3, IContextKeyService))),
|
|
270
|
+
( (__param(4, ILanguageFeaturesService))),
|
|
271
|
+
( (__param(5, IConfigurationService)))
|
|
272
|
+
], SuggestEnabledInputWithHistory)));
|
|
273
|
+
let ContextScopedSuggestEnabledInputWithHistory = class ContextScopedSuggestEnabledInputWithHistory extends SuggestEnabledInputWithHistory {
|
|
274
|
+
constructor(options, instantiationService, modelService, contextKeyService, languageFeaturesService, configurationService) {
|
|
275
|
+
super(options, instantiationService, modelService, contextKeyService, languageFeaturesService, configurationService);
|
|
276
|
+
const { historyNavigationBackwardsEnablement, historyNavigationForwardsEnablement } = this.historyContext;
|
|
277
|
+
this._register(this.inputWidget.onDidChangeCursorPosition(({ position }) => {
|
|
278
|
+
const viewModel = this.inputWidget._getViewModel();
|
|
279
|
+
const lastLineNumber = viewModel.getLineCount();
|
|
280
|
+
const lastLineCol = viewModel.getLineLength(lastLineNumber) + 1;
|
|
281
|
+
const viewPosition = viewModel.coordinatesConverter.convertModelPositionToViewPosition(position);
|
|
282
|
+
historyNavigationBackwardsEnablement.set(viewPosition.lineNumber === 1 && viewPosition.column === 1);
|
|
283
|
+
historyNavigationForwardsEnablement.set(viewPosition.lineNumber === lastLineNumber && viewPosition.column === lastLineCol);
|
|
284
|
+
}));
|
|
285
|
+
}
|
|
286
|
+
getScopedContextKeyService(contextKeyService) {
|
|
287
|
+
const scopedContextKeyService = this._register(contextKeyService.createScoped(this.element));
|
|
288
|
+
this.historyContext = this._register(registerAndCreateHistoryNavigationContext(scopedContextKeyService, this));
|
|
289
|
+
return scopedContextKeyService;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
ContextScopedSuggestEnabledInputWithHistory = ( (__decorate([
|
|
293
|
+
( (__param(1, IInstantiationService))),
|
|
294
|
+
( (__param(2, IModelService))),
|
|
295
|
+
( (__param(3, IContextKeyService))),
|
|
296
|
+
( (__param(4, ILanguageFeaturesService))),
|
|
297
|
+
( (__param(5, IConfigurationService)))
|
|
298
|
+
], ContextScopedSuggestEnabledInputWithHistory)));
|
|
209
299
|
registerThemingParticipant((theme, collector) => {
|
|
210
300
|
const selectionBackgroundColor = theme.getColor(selectionBackground);
|
|
211
301
|
if (selectionBackgroundColor) {
|
|
@@ -245,4 +335,4 @@ function getSuggestEnabledInputOptions(ariaLabel) {
|
|
|
245
335
|
autoClosingBrackets: 'never'
|
|
246
336
|
};
|
|
247
337
|
}
|
|
248
|
-
export { SuggestEnabledInput };
|
|
338
|
+
export { ContextScopedSuggestEnabledInputWithHistory, SuggestEnabledInput, SuggestEnabledInputWithHistory };
|