@theia/plugin-ext 1.43.1 → 1.45.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/common/plugin-api-rpc.d.ts +11 -1
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-protocol.d.ts +9 -2
- package/lib/common/plugin-protocol.d.ts.map +1 -1
- package/lib/common/plugin-protocol.js.map +1 -1
- package/lib/common/proxy-handler.d.ts.map +1 -1
- package/lib/common/proxy-handler.js +3 -1
- package/lib/common/proxy-handler.js.map +1 -1
- package/lib/common/test-types.d.ts +9 -0
- package/lib/common/test-types.d.ts.map +1 -1
- package/lib/common/test-types.js +36 -1
- package/lib/common/test-types.js.map +1 -1
- package/lib/hosted/browser/hosted-plugin.d.ts +2 -0
- package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js +54 -6
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts +1 -0
- package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.js +6 -0
- package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
- package/lib/hosted/node/plugin-activation-events.d.ts.map +1 -1
- package/lib/hosted/node/plugin-activation-events.js +1 -1
- package/lib/hosted/node/plugin-activation-events.js.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts +0 -3
- package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js +11 -94
- package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.d.ts +3 -0
- package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.js +85 -1
- package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
- package/lib/main/browser/languages-main.d.ts.map +1 -1
- package/lib/main/browser/languages-main.js +1 -0
- package/lib/main/browser/languages-main.js.map +1 -1
- package/lib/main/browser/menus/plugin-menu-command-adapter.d.ts +1 -0
- package/lib/main/browser/menus/plugin-menu-command-adapter.d.ts.map +1 -1
- package/lib/main/browser/menus/plugin-menu-command-adapter.js +30 -0
- package/lib/main/browser/menus/plugin-menu-command-adapter.js.map +1 -1
- package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts +2 -2
- package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts.map +1 -1
- package/lib/main/browser/menus/vscode-theia-menu-mappings.js +6 -1
- package/lib/main/browser/menus/vscode-theia-menu-mappings.js.map +1 -1
- package/lib/main/browser/notebooks/notebook-documents-and-editors-main.d.ts +4 -2
- package/lib/main/browser/notebooks/notebook-documents-and-editors-main.d.ts.map +1 -1
- package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js +34 -21
- package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js.map +1 -1
- package/lib/main/browser/notebooks/notebook-documents-main.d.ts.map +1 -1
- package/lib/main/browser/notebooks/notebook-documents-main.js +8 -9
- package/lib/main/browser/notebooks/notebook-documents-main.js.map +1 -1
- package/lib/main/browser/notebooks/notebook-dto.d.ts +3 -0
- package/lib/main/browser/notebooks/notebook-dto.d.ts.map +1 -1
- package/lib/main/browser/notebooks/notebook-dto.js +27 -34
- package/lib/main/browser/notebooks/notebook-dto.js.map +1 -1
- package/lib/main/browser/notebooks/notebook-kernels-main.js +3 -3
- package/lib/main/browser/notebooks/notebook-kernels-main.js.map +1 -1
- package/lib/main/browser/notebooks/notebooks-main.d.ts +12 -1
- package/lib/main/browser/notebooks/notebooks-main.d.ts.map +1 -1
- package/lib/main/browser/notebooks/notebooks-main.js.map +1 -1
- package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts +1 -2
- package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts.map +1 -1
- package/lib/main/browser/notebooks/renderers/cell-output-webview.js +1 -1
- package/lib/main/browser/notebooks/renderers/cell-output-webview.js.map +1 -1
- package/lib/main/browser/plugin-contribution-handler.d.ts +2 -0
- package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
- package/lib/main/browser/plugin-contribution-handler.js +10 -0
- package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
- package/lib/main/browser/plugin-icon-theme-service.d.ts +12 -1
- package/lib/main/browser/plugin-icon-theme-service.d.ts.map +1 -1
- package/lib/main/browser/plugin-icon-theme-service.js +44 -8
- package/lib/main/browser/plugin-icon-theme-service.js.map +1 -1
- package/lib/main/browser/plugin-shared-style.d.ts +5 -1
- package/lib/main/browser/plugin-shared-style.d.ts.map +1 -1
- package/lib/main/browser/plugin-shared-style.js +33 -16
- package/lib/main/browser/plugin-shared-style.js.map +1 -1
- package/lib/main/browser/terminal-main.d.ts +1 -0
- package/lib/main/browser/terminal-main.d.ts.map +1 -1
- package/lib/main/browser/terminal-main.js +5 -0
- package/lib/main/browser/terminal-main.js.map +1 -1
- package/lib/main/browser/text-editor-main.d.ts.map +1 -1
- package/lib/main/browser/text-editor-main.js +10 -0
- package/lib/main/browser/text-editor-main.js.map +1 -1
- package/lib/main/browser/webview/webview.d.ts +20 -1
- package/lib/main/browser/webview/webview.d.ts.map +1 -1
- package/lib/main/browser/webview/webview.js +38 -1
- package/lib/main/browser/webview/webview.js.map +1 -1
- package/lib/main/node/plugin-deployer-contribution.d.ts +1 -1
- package/lib/main/node/plugin-deployer-contribution.d.ts.map +1 -1
- package/lib/main/node/plugin-deployer-contribution.js +2 -1
- package/lib/main/node/plugin-deployer-contribution.js.map +1 -1
- package/lib/main/node/plugin-deployer-impl.d.ts +1 -1
- package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
- package/lib/main/node/plugin-deployer-impl.js +3 -2
- package/lib/main/node/plugin-deployer-impl.js.map +1 -1
- package/lib/main/node/plugin-ext-backend-module.d.ts.map +1 -1
- package/lib/main/node/plugin-ext-backend-module.js +3 -0
- package/lib/main/node/plugin-ext-backend-module.js.map +1 -1
- package/lib/main/node/plugin-mgmt-cli-contribution.d.ts +13 -0
- package/lib/main/node/plugin-mgmt-cli-contribution.d.ts.map +1 -0
- package/lib/main/node/plugin-mgmt-cli-contribution.js +71 -0
- package/lib/main/node/plugin-mgmt-cli-contribution.js.map +1 -0
- package/lib/plugin/command-registry.d.ts.map +1 -1
- package/lib/plugin/command-registry.js +9 -3
- package/lib/plugin/command-registry.js.map +1 -1
- package/lib/plugin/env.d.ts +0 -3
- package/lib/plugin/env.d.ts.map +1 -1
- package/lib/plugin/env.js +0 -6
- package/lib/plugin/env.js.map +1 -1
- package/lib/plugin/languages-utils.d.ts +2 -1
- package/lib/plugin/languages-utils.d.ts.map +1 -1
- package/lib/plugin/languages-utils.js +14 -1
- package/lib/plugin/languages-utils.js.map +1 -1
- package/lib/plugin/languages.d.ts.map +1 -1
- package/lib/plugin/languages.js +2 -1
- package/lib/plugin/languages.js.map +1 -1
- package/lib/plugin/notebook/notebook-document.js +3 -3
- package/lib/plugin/notebook/notebook-document.js.map +1 -1
- package/lib/plugin/notebook/notebooks.d.ts.map +1 -1
- package/lib/plugin/notebook/notebooks.js +7 -4
- package/lib/plugin/notebook/notebooks.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +5 -1
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-manager.d.ts +1 -1
- package/lib/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugin/plugin-manager.js +4 -24
- package/lib/plugin/plugin-manager.js.map +1 -1
- package/lib/plugin/status-bar/status-bar-item.d.ts.map +1 -1
- package/lib/plugin/terminal-ext.d.ts +5 -0
- package/lib/plugin/terminal-ext.d.ts.map +1 -1
- package/lib/plugin/terminal-ext.js +11 -0
- package/lib/plugin/terminal-ext.js.map +1 -1
- package/lib/plugin/tests.d.ts +6 -1
- package/lib/plugin/tests.d.ts.map +1 -1
- package/lib/plugin/tests.js +22 -0
- package/lib/plugin/tests.js.map +1 -1
- package/lib/plugin/text-editor.d.ts +6 -2
- package/lib/plugin/text-editor.d.ts.map +1 -1
- package/lib/plugin/text-editor.js +57 -2
- package/lib/plugin/text-editor.js.map +1 -1
- package/lib/plugin/type-converters.d.ts +1 -12
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +3 -121
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +23 -0
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +36 -4
- package/lib/plugin/types-impl.js.map +1 -1
- package/lib/plugin/window-state.d.ts.map +1 -1
- package/lib/plugin/window-state.js +3 -4
- package/lib/plugin/window-state.js.map +1 -1
- package/package.json +29 -29
- package/src/common/plugin-api-rpc.ts +12 -1
- package/src/common/plugin-protocol.ts +9 -2
- package/src/common/proxy-handler.ts +3 -1
- package/src/common/test-types.ts +20 -0
- package/src/hosted/browser/hosted-plugin.ts +51 -6
- package/src/hosted/node/hosted-plugin-deployer-handler.ts +7 -0
- package/src/hosted/node/plugin-activation-events.ts +10 -9
- package/src/hosted/node/scanners/scanner-theia.ts +10 -101
- package/src/main/browser/debug/plugin-debug-service.ts +91 -2
- package/src/main/browser/languages-main.ts +1 -0
- package/src/main/browser/menus/plugin-menu-command-adapter.ts +30 -0
- package/src/main/browser/menus/vscode-theia-menu-mappings.ts +7 -2
- package/src/main/browser/notebooks/notebook-documents-and-editors-main.ts +36 -22
- package/src/main/browser/notebooks/notebook-documents-main.ts +11 -12
- package/src/main/browser/notebooks/notebook-dto.ts +24 -34
- package/src/main/browser/notebooks/notebook-kernels-main.ts +1 -1
- package/src/main/browser/notebooks/notebooks-main.ts +13 -2
- package/src/main/browser/notebooks/renderers/cell-output-webview.tsx +3 -3
- package/src/main/browser/plugin-contribution-handler.ts +9 -0
- package/src/main/browser/plugin-icon-theme-service.ts +46 -12
- package/src/main/browser/plugin-shared-style.ts +37 -17
- package/src/main/browser/terminal-main.ts +7 -0
- package/src/main/browser/text-editor-main.ts +9 -0
- package/src/main/browser/webview/pre/host.js +1 -1
- package/src/main/browser/webview/pre/main.js +84 -34
- package/src/main/browser/webview/webview.ts +49 -1
- package/src/main/node/plugin-deployer-contribution.ts +3 -2
- package/src/main/node/plugin-deployer-impl.ts +4 -3
- package/src/main/node/plugin-ext-backend-module.ts +4 -0
- package/src/main/node/plugin-mgmt-cli-contribution.ts +64 -0
- package/src/plugin/command-registry.ts +8 -3
- package/src/plugin/env.ts +0 -8
- package/src/plugin/languages-utils.ts +13 -1
- package/src/plugin/languages.ts +3 -2
- package/src/plugin/notebook/notebook-document.ts +8 -8
- package/src/plugin/notebook/notebooks.ts +6 -4
- package/src/plugin/plugin-context.ts +6 -1
- package/src/plugin/plugin-manager.ts +5 -25
- package/src/plugin/status-bar/status-bar-item.ts +1 -1
- package/src/plugin/terminal-ext.ts +15 -0
- package/src/plugin/tests.ts +25 -1
- package/src/plugin/text-editor.ts +64 -4
- package/src/plugin/type-converters.ts +3 -123
- package/src/plugin/types-impl.ts +33 -0
- package/src/plugin/window-state.ts +4 -4
|
@@ -18,6 +18,7 @@ import { interfaces } from '@theia/core/shared/inversify';
|
|
|
18
18
|
import { ApplicationShell, WidgetOpenerOptions } from '@theia/core/lib/browser';
|
|
19
19
|
import { TerminalEditorLocationOptions, TerminalOptions } from '@theia/plugin';
|
|
20
20
|
import { TerminalLocation, TerminalWidget } from '@theia/terminal/lib/browser/base/terminal-widget';
|
|
21
|
+
import { TerminalProfileService } from '@theia/terminal/lib/browser/terminal-profile-service';
|
|
21
22
|
import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
|
|
22
23
|
import { TerminalServiceMain, TerminalServiceExt, MAIN_RPC_CONTEXT } from '../../common/plugin-api-rpc';
|
|
23
24
|
import { RPCProtocol } from '../../common/rpc-protocol';
|
|
@@ -36,6 +37,7 @@ import { HostedPluginSupport } from '../../hosted/browser/hosted-plugin';
|
|
|
36
37
|
export class TerminalServiceMainImpl implements TerminalServiceMain, TerminalLinkProvider, Disposable {
|
|
37
38
|
|
|
38
39
|
private readonly terminals: TerminalService;
|
|
40
|
+
private readonly terminalProfileService: TerminalProfileService;
|
|
39
41
|
private readonly pluginTerminalRegistry: PluginTerminalRegistry;
|
|
40
42
|
private readonly hostedPluginSupport: HostedPluginSupport;
|
|
41
43
|
private readonly shell: ApplicationShell;
|
|
@@ -47,6 +49,7 @@ export class TerminalServiceMainImpl implements TerminalServiceMain, TerminalLin
|
|
|
47
49
|
|
|
48
50
|
constructor(rpc: RPCProtocol, container: interfaces.Container) {
|
|
49
51
|
this.terminals = container.get(TerminalService);
|
|
52
|
+
this.terminalProfileService = container.get(TerminalProfileService);
|
|
50
53
|
this.pluginTerminalRegistry = container.get(PluginTerminalRegistry);
|
|
51
54
|
this.hostedPluginSupport = container.get(HostedPluginSupport);
|
|
52
55
|
this.shell = container.get(ApplicationShell);
|
|
@@ -64,6 +67,10 @@ export class TerminalServiceMainImpl implements TerminalServiceMain, TerminalLin
|
|
|
64
67
|
this.pluginTerminalRegistry.startCallback = id => this.startProfile(id);
|
|
65
68
|
|
|
66
69
|
container.bind(TerminalLinkProvider).toDynamicValue(() => this);
|
|
70
|
+
|
|
71
|
+
this.toDispose.push(this.terminalProfileService.onDidChangeDefaultShell(shell => {
|
|
72
|
+
this.extProxy.$setShell(shell);
|
|
73
|
+
}));
|
|
67
74
|
}
|
|
68
75
|
|
|
69
76
|
async startProfile(id: string): Promise<string> {
|
|
@@ -194,6 +194,13 @@ export class TextEditorMain implements Disposable {
|
|
|
194
194
|
if (typeof newConfiguration.tabSize !== 'undefined') {
|
|
195
195
|
newOpts.tabSize = newConfiguration.tabSize;
|
|
196
196
|
}
|
|
197
|
+
if (typeof newConfiguration.indentSize !== 'undefined') {
|
|
198
|
+
if (newConfiguration.indentSize === 'tabSize') {
|
|
199
|
+
newOpts.indentSize = newConfiguration.tabSize;
|
|
200
|
+
} else if (typeof newConfiguration.indentSize == 'number') {
|
|
201
|
+
newOpts.indentSize = newConfiguration.indentSize;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
197
204
|
this.model.updateOptions(newOpts);
|
|
198
205
|
}
|
|
199
206
|
|
|
@@ -408,6 +415,7 @@ export class TextEditorPropertiesMain {
|
|
|
408
415
|
const modelOptions = model.getOptions();
|
|
409
416
|
return {
|
|
410
417
|
insertSpaces: modelOptions.insertSpaces,
|
|
418
|
+
indentSize: modelOptions.indentSize,
|
|
411
419
|
tabSize: modelOptions.tabSize,
|
|
412
420
|
cursorStyle,
|
|
413
421
|
lineNumbers,
|
|
@@ -443,6 +451,7 @@ export class TextEditorPropertiesMain {
|
|
|
443
451
|
return (
|
|
444
452
|
a.tabSize === b.tabSize
|
|
445
453
|
&& a.insertSpaces === b.insertSpaces
|
|
454
|
+
&& a.indentSize === b.indentSize
|
|
446
455
|
&& a.cursorStyle === b.cursorStyle
|
|
447
456
|
&& a.lineNumbers === b.lineNumbers
|
|
448
457
|
);
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
break;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
if (sourceIsChildFrame && e.data && (e.data.command === 'onmessage' || e.data.command === 'do-update-state')) {
|
|
39
|
+
if (sourceIsChildFrame && e.data && (e.data.command === 'onmessage' || e.data.command === 'do-update-state' || e.data.command === 'onconsole')) {
|
|
40
40
|
this.postMessage(e.data.command, e.data.data);
|
|
41
41
|
} else if (sourceIsChildFrame || sourceIsSelfOrParentFrame) {
|
|
42
42
|
const channel = e.data.channel;
|
|
@@ -144,40 +144,65 @@
|
|
|
144
144
|
* @param {*} [state]
|
|
145
145
|
* @return {string}
|
|
146
146
|
*/
|
|
147
|
-
function
|
|
147
|
+
function getDefaultScript(state) {
|
|
148
148
|
return `
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
const acquireVsCodeApi = (function() {
|
|
150
|
+
const originalPostMessage = window.parent.postMessage.bind(window.parent);
|
|
151
|
+
const originalConsole = {...console};
|
|
152
|
+
const targetOrigin = '*';
|
|
153
|
+
let acquired = false;
|
|
154
|
+
|
|
155
|
+
let state = ${state ? `JSON.parse(${JSON.stringify(state)})` : undefined};
|
|
156
|
+
|
|
157
|
+
const forwardConsoleLog = (level, msg, args) => {
|
|
158
|
+
let message, optionalParams;
|
|
159
|
+
try {
|
|
160
|
+
if (msg) {
|
|
161
|
+
message = JSON.stringify(msg) ?? null;
|
|
162
|
+
}
|
|
163
|
+
if (args) {
|
|
164
|
+
optionalParams = JSON.stringify(args) ?? null;
|
|
165
|
+
}
|
|
166
|
+
} catch (e) {
|
|
167
|
+
// Log non serializable objects inside of view
|
|
168
|
+
originalConsole[level](msg, args);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
originalPostMessage({ command: 'onconsole', data: { level, message, optionalParams } }, targetOrigin);
|
|
172
|
+
};
|
|
153
173
|
|
|
154
|
-
|
|
174
|
+
console.log = (message, args) => forwardConsoleLog('log', message, args);
|
|
175
|
+
console.info = (message, args) => forwardConsoleLog('info', message, args);
|
|
176
|
+
console.warn = (message, args) => forwardConsoleLog('warn', message, args);
|
|
177
|
+
console.error = (message, args) => forwardConsoleLog('error', message, args);
|
|
178
|
+
console.debug = (message, args) => forwardConsoleLog('debug', message, args);
|
|
179
|
+
console.trace = (message, args) => forwardConsoleLog('trace', message, args);
|
|
155
180
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
return () => {
|
|
182
|
+
if (acquired) {
|
|
183
|
+
throw new Error('An instance of the VS Code API has already been acquired');
|
|
184
|
+
}
|
|
185
|
+
acquired = true;
|
|
186
|
+
return Object.freeze({
|
|
187
|
+
postMessage: function (msg) {
|
|
188
|
+
return originalPostMessage({ command: 'onmessage', data: msg }, targetOrigin);
|
|
189
|
+
},
|
|
190
|
+
setState: function (newState) {
|
|
191
|
+
state = newState;
|
|
192
|
+
originalPostMessage({ command: 'do-update-state', data: JSON.stringify(newState) }, targetOrigin);
|
|
193
|
+
return newState;
|
|
194
|
+
},
|
|
195
|
+
getState: function () {
|
|
196
|
+
return state;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
})();
|
|
201
|
+
const acquireTheiaApi = acquireVsCodeApi;
|
|
202
|
+
delete window.parent;
|
|
203
|
+
delete window.top;
|
|
204
|
+
delete window.frameElement;
|
|
205
|
+
`;
|
|
181
206
|
}
|
|
182
207
|
|
|
183
208
|
/**
|
|
@@ -314,10 +339,35 @@
|
|
|
314
339
|
clientY: e.clientY,
|
|
315
340
|
ctrlKey: e.ctrlKey,
|
|
316
341
|
metaKey: e.metaKey,
|
|
317
|
-
shiftKey: e.shiftKey
|
|
342
|
+
shiftKey: e.shiftKey,
|
|
343
|
+
// @ts-ignore the dataset should exist if the target is an element
|
|
318
344
|
});
|
|
319
345
|
};
|
|
320
346
|
|
|
347
|
+
const handleContextMenu = (e) => {
|
|
348
|
+
if (e.defaultPrevented) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
e.preventDefault();
|
|
353
|
+
|
|
354
|
+
host.postMessage('did-context-menu', {
|
|
355
|
+
clientX: e.clientX,
|
|
356
|
+
clientY: e.clientY,
|
|
357
|
+
context: findVscodeContext(e.target)
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
function findVscodeContext(node) {
|
|
362
|
+
if (node) {
|
|
363
|
+
if (node.dataset?.vscodeContext) {
|
|
364
|
+
return JSON.parse(node.dataset.vscodeContext);
|
|
365
|
+
}
|
|
366
|
+
return findVscodeContext(node.parentElement);
|
|
367
|
+
}
|
|
368
|
+
return {};
|
|
369
|
+
}
|
|
370
|
+
|
|
321
371
|
function preventDefaultBrowserHotkeys(e) {
|
|
322
372
|
var isOSX = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
|
323
373
|
|
|
@@ -369,7 +419,7 @@
|
|
|
369
419
|
// apply default script
|
|
370
420
|
if (options.allowScripts) {
|
|
371
421
|
const defaultScript = newDocument.createElement('script');
|
|
372
|
-
defaultScript.textContent =
|
|
422
|
+
defaultScript.textContent = getDefaultScript(data.state);
|
|
373
423
|
newDocument.head.prepend(defaultScript);
|
|
374
424
|
}
|
|
375
425
|
|
|
@@ -577,7 +627,7 @@
|
|
|
577
627
|
newFrame.contentWindow.addEventListener('keydown', handleInnerKeydown);
|
|
578
628
|
newFrame.contentWindow.addEventListener('mousedown', handleInnerMousedown);
|
|
579
629
|
newFrame.contentWindow.addEventListener('mouseup', handleInnerMouseup);
|
|
580
|
-
newFrame.contentWindow.addEventListener('contextmenu',
|
|
630
|
+
newFrame.contentWindow.addEventListener('contextmenu', handleContextMenu);
|
|
581
631
|
|
|
582
632
|
if (host.onIframeLoaded) {
|
|
583
633
|
host.onIframeLoaded(newFrame);
|
|
@@ -51,10 +51,16 @@ import { BinaryBufferReadableStream } from '@theia/core/lib/common/buffer';
|
|
|
51
51
|
import { ViewColumn } from '../../../plugin/types-impl';
|
|
52
52
|
import { ExtractableWidget } from '@theia/core/lib/browser/widgets/extractable-widget';
|
|
53
53
|
import { BadgeWidget } from '@theia/core/lib/browser/view-container';
|
|
54
|
+
import { MenuPath } from '@theia/core';
|
|
55
|
+
import { ContextMenuRenderer } from '@theia/core/lib/browser';
|
|
56
|
+
import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
|
|
57
|
+
import { PluginViewWidget } from '../view/plugin-view-widget';
|
|
54
58
|
|
|
55
59
|
// Style from core
|
|
56
60
|
const TRANSPARENT_OVERLAY_STYLE = 'theia-transparent-overlay';
|
|
57
61
|
|
|
62
|
+
export const WEBVIEW_CONTEXT_MENU: MenuPath = ['webview-context-menu'];
|
|
63
|
+
|
|
58
64
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
59
65
|
|
|
60
66
|
export const enum WebviewMessageChannels {
|
|
@@ -69,7 +75,9 @@ export const enum WebviewMessageChannels {
|
|
|
69
75
|
webviewReady = 'webview-ready',
|
|
70
76
|
didKeydown = 'did-keydown',
|
|
71
77
|
didMouseDown = 'did-mousedown',
|
|
72
|
-
didMouseUp = 'did-mouseup'
|
|
78
|
+
didMouseUp = 'did-mouseup',
|
|
79
|
+
onconsole = 'onconsole',
|
|
80
|
+
didcontextmenu = 'did-context-menu'
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
export interface WebviewContentOptions {
|
|
@@ -80,6 +88,12 @@ export interface WebviewContentOptions {
|
|
|
80
88
|
readonly enableCommandUris?: boolean | readonly string[];
|
|
81
89
|
}
|
|
82
90
|
|
|
91
|
+
export interface WebviewConsoleLog {
|
|
92
|
+
level: Extract<keyof typeof console, 'log' | 'info' | 'warn' | 'error' | 'trace' | 'debug'>;
|
|
93
|
+
message?: string;
|
|
94
|
+
optionalParams?: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
83
97
|
@injectable()
|
|
84
98
|
export class WebviewWidgetIdentifier {
|
|
85
99
|
id: string;
|
|
@@ -145,6 +159,12 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget, Extract
|
|
|
145
159
|
@inject(WebviewResourceCache)
|
|
146
160
|
protected readonly resourceCache: WebviewResourceCache;
|
|
147
161
|
|
|
162
|
+
@inject(ContextMenuRenderer)
|
|
163
|
+
protected readonly contextMenuRenderer: ContextMenuRenderer;
|
|
164
|
+
|
|
165
|
+
@inject(ContextKeyService)
|
|
166
|
+
protected readonly contextKeyService: ContextKeyService;
|
|
167
|
+
|
|
148
168
|
viewState: WebviewPanelViewState = {
|
|
149
169
|
visible: false,
|
|
150
170
|
active: false,
|
|
@@ -318,6 +338,7 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget, Extract
|
|
|
318
338
|
this.toHide.push(subscription);
|
|
319
339
|
|
|
320
340
|
this.toHide.push(this.on(WebviewMessageChannels.onmessage, (data: any) => this.onMessageEmitter.fire(data)));
|
|
341
|
+
this.toHide.push(this.on(WebviewMessageChannels.onconsole, (data: WebviewConsoleLog) => this.forwardConsoleLog(data)));
|
|
321
342
|
this.toHide.push(this.on(WebviewMessageChannels.didClickLink, (uri: string) => this.openLink(new URI(uri))));
|
|
322
343
|
this.toHide.push(this.on(WebviewMessageChannels.doUpdateState, (state: any) => {
|
|
323
344
|
this._state = state;
|
|
@@ -349,6 +370,10 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget, Extract
|
|
|
349
370
|
this.dispatchMouseEvent('mouseup', data);
|
|
350
371
|
}));
|
|
351
372
|
|
|
373
|
+
this.toHide.push(this.on(WebviewMessageChannels.didcontextmenu, (event: { clientX: number, clientY: number, context: any }) => {
|
|
374
|
+
this.handleContextMenu(event);
|
|
375
|
+
}));
|
|
376
|
+
|
|
352
377
|
this.style();
|
|
353
378
|
this.toHide.push(this.themeDataProvider.onDidChangeThemeData(() => this.style()));
|
|
354
379
|
|
|
@@ -372,6 +397,20 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget, Extract
|
|
|
372
397
|
}));
|
|
373
398
|
}
|
|
374
399
|
|
|
400
|
+
handleContextMenu(event: { clientX: number, clientY: number, context: any }): void {
|
|
401
|
+
const domRect = this.node.getBoundingClientRect();
|
|
402
|
+
this.contextKeyService.with(this.parent instanceof PluginViewWidget ?
|
|
403
|
+
{ webviewId: this.parent.options.viewId, ...event.context } : {},
|
|
404
|
+
() => {
|
|
405
|
+
this.contextMenuRenderer.render({
|
|
406
|
+
menuPath: WEBVIEW_CONTEXT_MENU,
|
|
407
|
+
anchor: {
|
|
408
|
+
x: domRect.x + event.clientX, y: domRect.y + event.clientY
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
|
|
375
414
|
protected async getRedirect(url: string): Promise<string | undefined> {
|
|
376
415
|
const uri = new URI(url);
|
|
377
416
|
const localhost = this.externalUriService.parseLocalhost(uri);
|
|
@@ -462,6 +501,15 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget, Extract
|
|
|
462
501
|
this.doUpdateContent();
|
|
463
502
|
}
|
|
464
503
|
|
|
504
|
+
protected forwardConsoleLog(log: WebviewConsoleLog): void {
|
|
505
|
+
const message = `[webview: ${this.identifier.id}] ${log.message ? JSON.parse(log.message) : undefined}`;
|
|
506
|
+
if (log.optionalParams !== undefined) {
|
|
507
|
+
console[log.level](message, JSON.parse(log.optionalParams));
|
|
508
|
+
} else {
|
|
509
|
+
console[log.level](message);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
465
513
|
protected style(): void {
|
|
466
514
|
const { styles, activeThemeType, activeThemeName } = this.themeDataProvider.getThemeData();
|
|
467
515
|
this.doSend('styles', { styles, activeThemeType, activeThemeName });
|
|
@@ -28,7 +28,8 @@ export class PluginDeployerContribution implements BackendApplicationContributio
|
|
|
28
28
|
@inject(PluginDeployer)
|
|
29
29
|
protected pluginDeployer: PluginDeployer;
|
|
30
30
|
|
|
31
|
-
initialize(): void {
|
|
32
|
-
this.pluginDeployer.start();
|
|
31
|
+
initialize(): Promise<void> {
|
|
32
|
+
this.pluginDeployer.start().catch(error => this.logger.error('Initializing plugin deployer failed.', error));
|
|
33
|
+
return Promise.resolve();
|
|
33
34
|
}
|
|
34
35
|
}
|
|
@@ -75,9 +75,9 @@ export class PluginDeployerImpl implements PluginDeployer {
|
|
|
75
75
|
@inject(ContributionProvider) @named(PluginDeployerParticipant)
|
|
76
76
|
protected readonly participants: ContributionProvider<PluginDeployerParticipant>;
|
|
77
77
|
|
|
78
|
-
public start(): void {
|
|
78
|
+
public start(): Promise<void> {
|
|
79
79
|
this.logger.debug('Starting the deployer with the list of resolvers', this.pluginResolvers);
|
|
80
|
-
this.doStart();
|
|
80
|
+
return this.doStart();
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
public async initResolvers(): Promise<Array<void>> {
|
|
@@ -130,8 +130,9 @@ export class PluginDeployerImpl implements PluginDeployer {
|
|
|
130
130
|
id,
|
|
131
131
|
type: PluginType.System
|
|
132
132
|
}));
|
|
133
|
+
const resolvePlugins = this.measure('resolvePlugins');
|
|
133
134
|
const plugins = await this.resolvePlugins([...unresolvedUserEntries, ...unresolvedSystemEntries]);
|
|
134
|
-
|
|
135
|
+
resolvePlugins.log('Resolve plugins list');
|
|
135
136
|
await this.deployPlugins(plugins);
|
|
136
137
|
deployPlugins.log('Deploy plugins list');
|
|
137
138
|
}
|
|
@@ -41,6 +41,7 @@ import { WebviewBackendSecurityWarnings } from './webview-backend-security-warni
|
|
|
41
41
|
import { PluginUninstallationManager } from './plugin-uninstallation-manager';
|
|
42
42
|
import { LocalizationServerImpl } from '@theia/core/lib/node/i18n/localization-server';
|
|
43
43
|
import { PluginLocalizationServer } from './plugin-localization-server';
|
|
44
|
+
import { PluginMgmtCliContribution } from './plugin-mgmt-cli-contribution';
|
|
44
45
|
|
|
45
46
|
export function bindMainBackend(bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind): void {
|
|
46
47
|
bind(PluginApiContribution).toSelf().inSingletonScope();
|
|
@@ -85,6 +86,9 @@ export function bindMainBackend(bind: interfaces.Bind, unbind: interfaces.Unbind
|
|
|
85
86
|
bind(PluginCliContribution).toSelf().inSingletonScope();
|
|
86
87
|
bind(CliContribution).toService(PluginCliContribution);
|
|
87
88
|
|
|
89
|
+
bind(PluginMgmtCliContribution).toSelf().inSingletonScope();
|
|
90
|
+
bind(CliContribution).toService(PluginMgmtCliContribution);
|
|
91
|
+
|
|
88
92
|
bind(WebviewBackendSecurityWarnings).toSelf().inSingletonScope();
|
|
89
93
|
bind(BackendApplicationContribution).toService(WebviewBackendSecurityWarnings);
|
|
90
94
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 STMicroelectronics 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 { inject, injectable } from '@theia/core/shared/inversify';
|
|
18
|
+
import { Argv, Arguments } from '@theia/core/shared/yargs';
|
|
19
|
+
import { CliContribution } from '@theia/core/lib/node/cli';
|
|
20
|
+
import { HostedPluginDeployerHandler } from '../../hosted/node/hosted-plugin-deployer-handler';
|
|
21
|
+
import { PluginType } from '../../common';
|
|
22
|
+
|
|
23
|
+
@injectable()
|
|
24
|
+
export class PluginMgmtCliContribution implements CliContribution {
|
|
25
|
+
|
|
26
|
+
static LIST_PLUGINS = 'list-plugins';
|
|
27
|
+
static SHOW_VERSIONS = '--show-versions';
|
|
28
|
+
static SHOW_BUILTINS = '--show-builtins';
|
|
29
|
+
|
|
30
|
+
@inject(HostedPluginDeployerHandler)
|
|
31
|
+
protected deployerHandler: HostedPluginDeployerHandler;
|
|
32
|
+
|
|
33
|
+
configure(conf: Argv): void {
|
|
34
|
+
conf.command([PluginMgmtCliContribution.LIST_PLUGINS, 'list-extensions'],
|
|
35
|
+
'List the installed plugins',
|
|
36
|
+
yargs => yargs.option(PluginMgmtCliContribution.SHOW_VERSIONS, {
|
|
37
|
+
description: 'List the versions of the installed plugins',
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
default: false,
|
|
40
|
+
}).option(PluginMgmtCliContribution.SHOW_BUILTINS, {
|
|
41
|
+
description: 'List the built-in plugins',
|
|
42
|
+
type: 'boolean',
|
|
43
|
+
default: false,
|
|
44
|
+
}),
|
|
45
|
+
|
|
46
|
+
async yargs => {
|
|
47
|
+
const showVersions = yargs[PluginMgmtCliContribution.SHOW_VERSIONS];
|
|
48
|
+
const deployedIds = await this.deployerHandler.getDeployedBackendPlugins();
|
|
49
|
+
const pluginType = yargs[PluginMgmtCliContribution.SHOW_BUILTINS] ? PluginType.System : PluginType.User;
|
|
50
|
+
process.stdout.write('installed plugins:\n');
|
|
51
|
+
deployedIds.filter(plugin => plugin.type === pluginType).forEach(plugin => {
|
|
52
|
+
if (showVersions) {
|
|
53
|
+
process.stdout.write(`${plugin.metadata.model.id}@${plugin.metadata.model.version}\n`);
|
|
54
|
+
} else {
|
|
55
|
+
process.stdout.write(`${plugin.metadata.model.id}\n`);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
setArguments(args: Arguments): void {
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -204,11 +204,16 @@ export class CommandsConverter {
|
|
|
204
204
|
|
|
205
205
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
206
206
|
private executeSafeCommand<R>(...args: any[]): PromiseLike<R | undefined> {
|
|
207
|
-
const
|
|
207
|
+
const handle = args[0];
|
|
208
|
+
if (typeof handle !== 'number') {
|
|
209
|
+
return Promise.reject(`Invalid handle ${handle}`);
|
|
210
|
+
}
|
|
211
|
+
const command = this.commandsMap.get(handle);
|
|
208
212
|
if (!command || !command.command) {
|
|
209
|
-
return Promise.reject(`command ${
|
|
213
|
+
return Promise.reject(`Safe command with handle ${handle} not found`);
|
|
210
214
|
}
|
|
211
|
-
|
|
215
|
+
const allArgs = (command.arguments ?? []).concat(args.slice(1));
|
|
216
|
+
return this.commands.executeCommand(command.command, ...allArgs);
|
|
212
217
|
}
|
|
213
218
|
|
|
214
219
|
}
|
package/src/plugin/env.ts
CHANGED
|
@@ -25,7 +25,6 @@ export abstract class EnvExtImpl {
|
|
|
25
25
|
private queryParameters: QueryParameters;
|
|
26
26
|
private lang: string;
|
|
27
27
|
private applicationName: string;
|
|
28
|
-
private defaultShell: string;
|
|
29
28
|
private ui: theia.UIKind;
|
|
30
29
|
private envMachineId: string;
|
|
31
30
|
private envSessionId: string;
|
|
@@ -68,10 +67,6 @@ export abstract class EnvExtImpl {
|
|
|
68
67
|
this.lang = lang;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
setShell(shell: string): void {
|
|
72
|
-
this.defaultShell = shell;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
70
|
setUIKind(uiKind: theia.UIKind): void {
|
|
76
71
|
this.ui = uiKind;
|
|
77
72
|
}
|
|
@@ -112,9 +107,6 @@ export abstract class EnvExtImpl {
|
|
|
112
107
|
get uriScheme(): string {
|
|
113
108
|
return 'theia';
|
|
114
109
|
}
|
|
115
|
-
get shell(): string {
|
|
116
|
-
return this.defaultShell;
|
|
117
|
-
}
|
|
118
110
|
get uiKind(): theia.UIKind {
|
|
119
111
|
return this.ui;
|
|
120
112
|
}
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import * as theia from '@theia/plugin';
|
|
18
|
-
import { SerializedIndentationRule, SerializedOnEnterRule, SerializedRegExp } from '../common';
|
|
18
|
+
import { SerializedAutoClosingPair, SerializedIndentationRule, SerializedOnEnterRule, SerializedRegExp } from '../common';
|
|
19
|
+
import { SyntaxTokenType } from './types-impl';
|
|
19
20
|
|
|
20
21
|
export function serializeEnterRules(rules?: theia.OnEnterRule[]): SerializedOnEnterRule[] | undefined {
|
|
21
22
|
if (typeof rules === 'undefined' || rules === null) {
|
|
@@ -54,3 +55,14 @@ export function serializeIndentation(indentationRules?: theia.IndentationRule):
|
|
|
54
55
|
unIndentedLinePattern: serializeRegExp(indentationRules.unIndentedLinePattern)
|
|
55
56
|
};
|
|
56
57
|
}
|
|
58
|
+
|
|
59
|
+
export function serializeAutoClosingPairs(pairs: theia.AutoClosingPair[] | undefined): SerializedAutoClosingPair[] | undefined {
|
|
60
|
+
if (!pairs) {
|
|
61
|
+
return undefined;
|
|
62
|
+
};
|
|
63
|
+
return pairs.map(pair => ({
|
|
64
|
+
open: pair.open,
|
|
65
|
+
close: pair.close,
|
|
66
|
+
notIn: pair.notIn ? pair.notIn.map(tokenType => SyntaxTokenType.toString(tokenType)) : undefined
|
|
67
|
+
}));
|
|
68
|
+
}
|
package/src/plugin/languages.ts
CHANGED
|
@@ -108,7 +108,7 @@ import { isReadonlyArray } from '../common/arrays';
|
|
|
108
108
|
import { DisposableCollection, disposableTimeout, Disposable as TheiaDisposable } from '@theia/core/lib/common/disposable';
|
|
109
109
|
import { Severity } from '@theia/core/lib/common/severity';
|
|
110
110
|
import { LinkedEditingRangeAdapter } from './languages/linked-editing-range';
|
|
111
|
-
import { serializeEnterRules, serializeIndentation, serializeRegExp } from './languages-utils';
|
|
111
|
+
import { serializeAutoClosingPairs, serializeEnterRules, serializeIndentation, serializeRegExp } from './languages-utils';
|
|
112
112
|
import { InlayHintsAdapter } from './languages/inlay-hints';
|
|
113
113
|
import { InlineCompletionAdapter, InlineCompletionAdapterBase } from './languages/inline-completion';
|
|
114
114
|
import { DocumentDropEditAdapter } from './languages/document-drop-edit';
|
|
@@ -208,7 +208,8 @@ export class LanguagesExtImpl implements LanguagesExt {
|
|
|
208
208
|
comments: configuration.comments,
|
|
209
209
|
onEnterRules: serializeEnterRules(configuration.onEnterRules),
|
|
210
210
|
wordPattern: serializeRegExp(configuration.wordPattern),
|
|
211
|
-
indentationRules: serializeIndentation(configuration.indentationRules)
|
|
211
|
+
indentationRules: serializeIndentation(configuration.indentationRules),
|
|
212
|
+
autoClosingPairs: serializeAutoClosingPairs(configuration.autoClosingPairs)
|
|
212
213
|
};
|
|
213
214
|
|
|
214
215
|
this.proxy.$setLanguageConfiguration(callId, language, config);
|
|
@@ -288,17 +288,17 @@ export class NotebookDocument implements Disposable {
|
|
|
288
288
|
this.setCellOutputs(rawEvent.index, rawEvent.outputs);
|
|
289
289
|
relaxedCellChanges.push({ cell: this.cells[rawEvent.index].apiCell, outputs: this.cells[rawEvent.index].apiCell.outputs });
|
|
290
290
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
// } else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.OutputItem) {
|
|
292
|
+
// this._setCellOutputItems(rawEvent.index, rawEvent.outputId, rawEvent.append, rawEvent.outputItems);
|
|
293
|
+
// relaxedCellChanges.push({ cell: this.cells[rawEvent.index].apiCell, outputs: this.cells[rawEvent.index].apiCell.outputs });
|
|
294
294
|
} else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.ChangeCellLanguage) {
|
|
295
295
|
this.changeCellLanguage(rawEvent.index, rawEvent.language);
|
|
296
296
|
relaxedCellChanges.push({ cell: this.cells[rawEvent.index].apiCell, document: this.cells[rawEvent.index].apiCell.document });
|
|
297
297
|
} else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.ChangeCellContent) {
|
|
298
298
|
relaxedCellChanges.push({ cell: this.cells[rawEvent.index].apiCell, document: this.cells[rawEvent.index].apiCell.document });
|
|
299
299
|
|
|
300
|
-
|
|
301
|
-
|
|
300
|
+
// } else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.ChangeCellMime) {
|
|
301
|
+
// this._changeCellMime(rawEvent.index, rawEvent.mime);
|
|
302
302
|
} else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.ChangeCellMetadata) {
|
|
303
303
|
this.changeCellMetadata(rawEvent.index, rawEvent.metadata);
|
|
304
304
|
relaxedCellChanges.push({ cell: this.cells[rawEvent.index].apiCell, metadata: this.cells[rawEvent.index].apiCell.metadata });
|
|
@@ -351,7 +351,7 @@ export class NotebookDocument implements Disposable {
|
|
|
351
351
|
const removedCellDocuments: UriComponents[] = [];
|
|
352
352
|
|
|
353
353
|
splices.reverse().forEach(splice => {
|
|
354
|
-
const cellDtos = splice
|
|
354
|
+
const cellDtos = splice.newItems;
|
|
355
355
|
const newCells = cellDtos.map((cell: NotebookCellDto) => {
|
|
356
356
|
|
|
357
357
|
const extCell = new Cell(this, this.editorsAndDocuments, cell);
|
|
@@ -361,8 +361,8 @@ export class NotebookDocument implements Disposable {
|
|
|
361
361
|
return extCell;
|
|
362
362
|
});
|
|
363
363
|
|
|
364
|
-
const changeEvent = new RawContentChangeEvent(splice
|
|
365
|
-
const deletedItems = this.cells.splice(splice
|
|
364
|
+
const changeEvent = new RawContentChangeEvent(splice.start, splice.deleteCount, [], newCells);
|
|
365
|
+
const deletedItems = this.cells.splice(splice.start, splice.deleteCount, ...newCells);
|
|
366
366
|
for (const cell of deletedItems) {
|
|
367
367
|
removedCellDocuments.push(cell.uri.toComponents());
|
|
368
368
|
changeEvent.deletedItems.push(cell.apiCell);
|
|
@@ -36,6 +36,7 @@ import { NotebookDocument } from './notebook-document';
|
|
|
36
36
|
import { NotebookEditor } from './notebook-editor';
|
|
37
37
|
import { EditorsAndDocumentsExtImpl } from '../editors-and-documents';
|
|
38
38
|
import { DocumentsExtImpl } from '../documents';
|
|
39
|
+
import { NotebookModelResource } from '@theia/notebook/lib/common';
|
|
39
40
|
|
|
40
41
|
export class NotebooksExtImpl implements NotebooksExt {
|
|
41
42
|
|
|
@@ -82,11 +83,12 @@ export class NotebooksExtImpl implements NotebooksExt {
|
|
|
82
83
|
this.notebookEditors = rpc.getProxy(PLUGIN_RPC_CONTEXT.NOTEBOOK_EDITORS_MAIN);
|
|
83
84
|
|
|
84
85
|
commands.registerArgumentProcessor({
|
|
85
|
-
processArgument:
|
|
86
|
-
if (
|
|
87
|
-
return this.documents.get(arg.
|
|
86
|
+
processArgument: arg => {
|
|
87
|
+
if (NotebookModelResource.is(arg)) {
|
|
88
|
+
return this.documents.get(arg.notebookModelUri.toString())?.apiNotebook;
|
|
89
|
+
} else {
|
|
90
|
+
return arg;
|
|
88
91
|
}
|
|
89
|
-
return arg;
|
|
90
92
|
}
|
|
91
93
|
});
|
|
92
94
|
}
|
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
StatusBarAlignment,
|
|
58
58
|
RelativePattern,
|
|
59
59
|
IndentAction,
|
|
60
|
+
SyntaxTokenType,
|
|
60
61
|
CompletionItem,
|
|
61
62
|
CompletionItemKind,
|
|
62
63
|
CompletionList,
|
|
@@ -796,7 +797,10 @@ export function createAPIFactory(
|
|
|
796
797
|
get machineId(): string { return envExt.machineId; },
|
|
797
798
|
get sessionId(): string { return envExt.sessionId; },
|
|
798
799
|
get uriScheme(): string { return envExt.uriScheme; },
|
|
799
|
-
get shell(): string { return
|
|
800
|
+
get shell(): string { return terminalExt.defaultShell; },
|
|
801
|
+
get onDidChangeShell(): theia.Event<string> {
|
|
802
|
+
return terminalExt.onDidChangeShell;
|
|
803
|
+
},
|
|
800
804
|
get uiKind(): theia.UIKind { return envExt.uiKind; },
|
|
801
805
|
clipboard,
|
|
802
806
|
getEnvVariable(envVarName: string): PromiseLike<string | undefined> {
|
|
@@ -1225,6 +1229,7 @@ export function createAPIFactory(
|
|
|
1225
1229
|
ConfigurationTarget,
|
|
1226
1230
|
RelativePattern,
|
|
1227
1231
|
IndentAction,
|
|
1232
|
+
SyntaxTokenType,
|
|
1228
1233
|
CompletionItem,
|
|
1229
1234
|
CompletionItemKind,
|
|
1230
1235
|
CompletionList,
|