@theia/plugin-ext 1.18.0-next.d3501165 → 1.19.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/LICENSE +642 -0
- package/README.md +5 -0
- package/lib/common/arrays.d.ts +4 -0
- package/lib/common/arrays.d.ts.map +1 -1
- package/lib/common/arrays.js +9 -1
- package/lib/common/arrays.js.map +1 -1
- package/lib/common/connection.d.ts +1 -2
- package/lib/common/connection.d.ts.map +1 -1
- package/lib/common/connection.js.map +1 -1
- package/lib/common/plugin-api-rpc-model.d.ts +4 -0
- package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc-model.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +29 -11
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js +21 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-protocol.d.ts +1 -0
- package/lib/common/plugin-protocol.d.ts.map +1 -1
- package/lib/common/plugin-protocol.js.map +1 -1
- package/lib/hosted/browser/hosted-plugin.d.ts +5 -6
- package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js +19 -13
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.js +1 -0
- package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.js +14 -38
- package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-localization-service.d.ts +37 -0
- package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -0
- package/lib/hosted/node/hosted-plugin-localization-service.js +197 -0
- package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -0
- package/lib/hosted/node/hosted-plugin-process.d.ts +2 -2
- package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-process.js +5 -7
- package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
- package/lib/hosted/node/plugin-ext-hosted-backend-module.d.ts.map +1 -1
- package/lib/hosted/node/plugin-ext-hosted-backend-module.js +2 -0
- package/lib/hosted/node/plugin-ext-hosted-backend-module.js.map +1 -1
- package/lib/hosted/node/plugin-manifest-loader.d.ts +1 -1
- package/lib/hosted/node/plugin-manifest-loader.d.ts.map +1 -1
- package/lib/hosted/node/plugin-manifest-loader.js +4 -52
- package/lib/hosted/node/plugin-manifest-loader.js.map +1 -1
- package/lib/hosted/node/plugin-service.d.ts +3 -6
- package/lib/hosted/node/plugin-service.d.ts.map +1 -1
- package/lib/hosted/node/plugin-service.js +7 -40
- package/lib/hosted/node/plugin-service.js.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js +3 -2
- package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.d.ts.map +1 -1
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js +6 -2
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.d.ts +2 -2
- package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.js +6 -2
- package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.js +1 -2
- package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
- package/lib/main/browser/debug/debug-main.js +1 -1
- package/lib/main/browser/debug/debug-main.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.js +2 -2
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.d.ts +8 -0
- package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.js +15 -0
- package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +2 -2
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
- package/lib/main/browser/dialogs/modal-notification.d.ts +4 -4
- package/lib/main/browser/dialogs/modal-notification.d.ts.map +1 -1
- package/lib/main/browser/dialogs/modal-notification.js +21 -10
- package/lib/main/browser/dialogs/modal-notification.js.map +1 -1
- package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
- package/lib/main/browser/editors-and-documents-main.js +3 -4
- package/lib/main/browser/editors-and-documents-main.js.map +1 -1
- package/lib/main/browser/languages-main.js +1 -1
- package/lib/main/browser/languages-main.js.map +1 -1
- package/lib/main/browser/message-registry-main.js +1 -1
- package/lib/main/browser/message-registry-main.js.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.js +5 -3
- package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
- package/lib/main/browser/plugin-ext-widget.d.ts.map +1 -1
- package/lib/main/browser/plugin-ext-widget.js +3 -2
- package/lib/main/browser/plugin-ext-widget.js.map +1 -1
- package/lib/main/browser/plugin-shared-style.js +1 -1
- package/lib/main/browser/plugin-shared-style.js.map +1 -1
- package/lib/main/browser/quick-open-main.d.ts +3 -6
- package/lib/main/browser/quick-open-main.d.ts.map +1 -1
- package/lib/main/browser/quick-open-main.js +48 -100
- package/lib/main/browser/quick-open-main.js.map +1 -1
- package/lib/main/browser/timeline-main.d.ts.map +1 -1
- package/lib/main/browser/timeline-main.js +1 -1
- package/lib/main/browser/timeline-main.js.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.d.ts +3 -2
- package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.js +64 -24
- package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
- package/lib/main/browser/view/plugin-view-widget.d.ts +2 -0
- package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-widget.js +3 -1
- package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
- package/lib/main/browser/view/tree-view-widget.d.ts +3 -4
- package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/tree-view-widget.js +25 -28
- package/lib/main/browser/view/tree-view-widget.js.map +1 -1
- package/lib/main/browser/webview/webview-frontend-security-warnings.d.ts.map +1 -1
- package/lib/main/browser/webview/webview-frontend-security-warnings.js +8 -5
- package/lib/main/browser/webview/webview-frontend-security-warnings.js.map +1 -1
- package/lib/main/browser/webview/webview-preferences.d.ts.map +1 -1
- package/lib/main/browser/webview/webview-preferences.js +3 -2
- package/lib/main/browser/webview/webview-preferences.js.map +1 -1
- package/lib/main/browser/webview/webview.d.ts +1 -1
- package/lib/main/browser/webview/webview.d.ts.map +1 -1
- package/lib/main/browser/webview/webview.js +2 -2
- package/lib/main/browser/webview/webview.js.map +1 -1
- package/lib/plugin/comments.d.ts.map +1 -1
- package/lib/plugin/comments.js +2 -3
- package/lib/plugin/comments.js.map +1 -1
- package/lib/plugin/custom-editors.d.ts +1 -2
- package/lib/plugin/custom-editors.d.ts.map +1 -1
- package/lib/plugin/custom-editors.js +2 -3
- package/lib/plugin/custom-editors.js.map +1 -1
- package/lib/plugin/decorations.d.ts.map +1 -1
- package/lib/plugin/decorations.js +2 -3
- package/lib/plugin/decorations.js.map +1 -1
- package/lib/plugin/document-data.d.ts.map +1 -1
- package/lib/plugin/document-data.js +1 -1
- package/lib/plugin/document-data.js.map +1 -1
- package/lib/plugin/documents.d.ts.map +1 -1
- package/lib/plugin/documents.js +1 -2
- package/lib/plugin/documents.js.map +1 -1
- package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
- package/lib/plugin/file-system-event-service-ext-impl.js +2 -3
- package/lib/plugin/file-system-event-service-ext-impl.js.map +1 -1
- package/lib/plugin/file-system-ext-impl.d.ts.map +1 -1
- package/lib/plugin/file-system-ext-impl.js +12 -13
- package/lib/plugin/file-system-ext-impl.js.map +1 -1
- package/lib/plugin/known-commands.spec.js +1 -2
- package/lib/plugin/known-commands.spec.js.map +1 -1
- package/lib/plugin/languages/call-hierarchy.d.ts +1 -1
- package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
- package/lib/plugin/languages/call-hierarchy.js +8 -3
- package/lib/plugin/languages/call-hierarchy.js.map +1 -1
- package/lib/plugin/languages/rename.d.ts +1 -2
- package/lib/plugin/languages/rename.d.ts.map +1 -1
- package/lib/plugin/languages/rename.js.map +1 -1
- package/lib/plugin/languages.d.ts +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/message-registry.d.ts.map +1 -1
- package/lib/plugin/message-registry.js +8 -5
- package/lib/plugin/message-registry.js.map +1 -1
- package/lib/plugin/node/debug/debug.d.ts +4 -3
- package/lib/plugin/node/debug/debug.d.ts.map +1 -1
- package/lib/plugin/node/debug/debug.js +34 -15
- package/lib/plugin/node/debug/debug.js.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +3 -3
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +6 -4
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +23 -13
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +8 -3
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-manager.d.ts +2 -0
- package/lib/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugin/plugin-manager.js +24 -3
- package/lib/plugin/plugin-manager.js.map +1 -1
- package/lib/plugin/plugin-storage.d.ts +4 -0
- package/lib/plugin/plugin-storage.d.ts.map +1 -1
- package/lib/plugin/plugin-storage.js +6 -1
- package/lib/plugin/plugin-storage.js.map +1 -1
- package/lib/plugin/preference-registry.spec.js.map +1 -1
- package/lib/plugin/quick-open.d.ts +1 -3
- package/lib/plugin/quick-open.d.ts.map +1 -1
- package/lib/plugin/quick-open.js +10 -25
- package/lib/plugin/quick-open.js.map +1 -1
- package/lib/plugin/tasks/tasks.d.ts +1 -1
- package/lib/plugin/tasks/tasks.d.ts.map +1 -1
- package/lib/plugin/tasks/tasks.js +3 -2
- package/lib/plugin/tasks/tasks.js.map +1 -1
- package/lib/plugin/timeline.d.ts.map +1 -1
- package/lib/plugin/timeline.js +1 -2
- package/lib/plugin/timeline.js.map +1 -1
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +18 -11
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +55 -1
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +81 -1
- package/lib/plugin/types-impl.js.map +1 -1
- package/lib/plugin/webviews.d.ts +1 -2
- package/lib/plugin/webviews.d.ts.map +1 -1
- package/lib/plugin/webviews.js.map +1 -1
- package/package.json +31 -27
- package/src/common/arrays.ts +8 -0
- package/src/common/connection.ts +1 -2
- package/src/common/plugin-api-rpc-model.ts +4 -0
- package/src/common/plugin-api-rpc.ts +31 -10
- package/src/common/plugin-protocol.ts +2 -0
- package/src/hosted/browser/hosted-plugin.ts +19 -12
- package/src/hosted/browser/worker/debug-stub.ts +1 -0
- package/src/hosted/node/hosted-plugin-deployer-handler.ts +13 -40
- package/src/hosted/node/hosted-plugin-localization-service.ts +201 -0
- package/src/hosted/node/hosted-plugin-process.ts +4 -6
- package/src/hosted/node/plugin-ext-hosted-backend-module.ts +2 -0
- package/src/hosted/node/plugin-manifest-loader.ts +4 -56
- package/src/hosted/node/plugin-service.ts +7 -40
- package/src/hosted/node/scanners/scanner-theia.ts +4 -2
- package/src/main/browser/callhierarchy/callhierarchy-type-converters.ts +6 -2
- package/src/main/browser/custom-editors/custom-editor-opener.tsx +8 -4
- package/src/main/browser/custom-editors/custom-editors-main.ts +1 -2
- package/src/main/browser/debug/debug-main.ts +1 -1
- package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +3 -3
- package/src/main/browser/debug/plugin-debug-service.ts +23 -0
- package/src/main/browser/debug/plugin-debug-session-factory.ts +3 -3
- package/src/main/browser/dialogs/modal-notification.ts +24 -13
- package/src/main/browser/dialogs/style/modal-notification.css +17 -2
- package/src/main/browser/editors-and-documents-main.ts +1 -2
- package/src/main/browser/languages-main.ts +1 -1
- package/src/main/browser/message-registry-main.ts +1 -1
- package/src/main/browser/plugin-ext-frontend-module.ts +6 -4
- package/src/main/browser/plugin-ext-widget.tsx +3 -2
- package/src/main/browser/plugin-shared-style.ts +1 -1
- package/src/main/browser/quick-open-main.ts +54 -109
- package/src/main/browser/style/index.css +1 -5
- package/src/main/browser/style/plugin-sidebar.css +1 -1
- package/src/main/browser/timeline-main.ts +1 -2
- package/src/main/browser/view/plugin-view-registry.ts +68 -26
- package/src/main/browser/view/plugin-view-widget.ts +7 -2
- package/src/main/browser/view/tree-view-widget.tsx +41 -46
- package/src/main/browser/webview/pre/host.js +20 -12
- package/src/main/browser/webview/pre/main.js +1 -2
- package/src/main/browser/webview/pre/service-worker.js +1 -1
- package/src/main/browser/webview/webview-frontend-security-warnings.ts +8 -7
- package/src/main/browser/webview/webview-preferences.ts +3 -2
- package/src/main/browser/webview/webview.ts +2 -2
- package/src/plugin/comments.ts +1 -2
- package/src/plugin/custom-editors.ts +2 -4
- package/src/plugin/decorations.ts +1 -2
- package/src/plugin/document-data.ts +1 -2
- package/src/plugin/documents.ts +1 -2
- package/src/plugin/file-system-event-service-ext-impl.ts +1 -2
- package/src/plugin/file-system-ext-impl.ts +1 -2
- package/src/plugin/known-commands.spec.ts +1 -2
- package/src/plugin/languages/call-hierarchy.ts +14 -5
- package/src/plugin/languages/rename.ts +1 -2
- package/src/plugin/languages.ts +5 -2
- package/src/plugin/message-registry.ts +9 -6
- package/src/plugin/node/debug/debug.ts +40 -19
- package/src/plugin/node/debug/plugin-debug-adapter-session.ts +3 -3
- package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +24 -14
- package/src/plugin/plugin-context.ts +21 -10
- package/src/plugin/plugin-manager.ts +26 -4
- package/src/plugin/plugin-storage.ts +7 -2
- package/src/plugin/preference-registry.spec.ts +1 -2
- package/src/plugin/quick-open.ts +12 -29
- package/src/plugin/tasks/tasks.ts +3 -2
- package/src/plugin/timeline.ts +1 -2
- package/src/plugin/type-converters.ts +20 -13
- package/src/plugin/types-impl.ts +77 -1
- package/src/plugin/webviews.ts +1 -2
|
@@ -193,7 +193,6 @@
|
|
|
193
193
|
initialScrollProgress: undefined
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
-
|
|
197
196
|
/**
|
|
198
197
|
* @param {HTMLDocument?} document
|
|
199
198
|
* @param {HTMLElement?} body
|
|
@@ -477,7 +476,7 @@
|
|
|
477
476
|
const newFrame = document.createElement('iframe');
|
|
478
477
|
newFrame.setAttribute('id', 'pending-frame');
|
|
479
478
|
newFrame.setAttribute('frameborder', '0');
|
|
480
|
-
newFrame.setAttribute('sandbox', options.allowScripts ? 'allow-scripts allow-forms allow-same-origin' : 'allow-same-origin');
|
|
479
|
+
newFrame.setAttribute('sandbox', options.allowScripts ? 'allow-scripts allow-forms allow-same-origin allow-downloads' : 'allow-same-origin');
|
|
481
480
|
if (host.fakeLoad) {
|
|
482
481
|
// We should just be able to use srcdoc, but I wasn't
|
|
483
482
|
// seeing the service worker applying properly.
|
|
@@ -248,7 +248,7 @@ async function processLocalhostRequest(event, requestUrl) {
|
|
|
248
248
|
const origin = requestUrl.origin;
|
|
249
249
|
|
|
250
250
|
const resolveRedirect = redirectOrigin => {
|
|
251
|
-
if (!redirectOrigin) {
|
|
251
|
+
if (!redirectOrigin || requestUrl.origin === redirectOrigin) {
|
|
252
252
|
return fetch(event.request);
|
|
253
253
|
}
|
|
254
254
|
const location = event.request.url.replace(new RegExp(`^${requestUrl.origin}(/|$)`), `${redirectOrigin}$1`);
|
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
17
|
import { MessageService } from '@theia/core';
|
|
18
|
-
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
18
|
+
import { Dialog, FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
19
19
|
import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
|
|
20
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
20
21
|
import { WindowService } from '@theia/core/lib/browser/window/window-service';
|
|
21
22
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
22
23
|
import { WebviewExternalEndpoint } from '../../common/webview-protocol';
|
|
@@ -44,12 +45,12 @@ export class WebviewFrontendSecurityWarnings implements FrontendApplicationContr
|
|
|
44
45
|
}
|
|
45
46
|
const hostPattern = await this.webviewEnvironment.hostPatternPromise;
|
|
46
47
|
if (hostPattern !== WebviewExternalEndpoint.defaultPattern) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
).then(action => {
|
|
52
|
-
if (action ===
|
|
48
|
+
const goToReadme = nls.localize('theia/webview/goToReadme', 'Go To README');
|
|
49
|
+
const message = nls.localize('theia/webview/messageWarning', '\
|
|
50
|
+
The {0} endpoint\'s host pattern has been changed to `{1}`; changing the pattern can lead to security vulnerabilities. \
|
|
51
|
+
See `{2}` for more information.', 'webview', hostPattern, '@theia/plugin-ext/README.md');
|
|
52
|
+
this.messageService.warn(message, Dialog.OK, goToReadme).then(action => {
|
|
53
|
+
if (action === goToReadme) {
|
|
53
54
|
this.windowService.openNewWindow('https://www.npmjs.com/package/@theia/plugin-ext', { external: true });
|
|
54
55
|
}
|
|
55
56
|
});
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
PreferenceContribution,
|
|
24
24
|
PreferenceSchema
|
|
25
25
|
} from '@theia/core/lib/browser/preferences';
|
|
26
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
26
27
|
|
|
27
28
|
const frontendConfig = FrontendApplicationConfigProvider.get();
|
|
28
29
|
|
|
@@ -32,7 +33,7 @@ export const WebviewConfigSchema: PreferenceSchema = {
|
|
|
32
33
|
'webview.trace': {
|
|
33
34
|
type: 'string',
|
|
34
35
|
enum: ['off', 'on', 'verbose'],
|
|
35
|
-
description: 'Controls communication tracing with webviews.',
|
|
36
|
+
description: nls.localize('theia/plugin-ext/webviewTrace', 'Controls communication tracing with webviews.'),
|
|
36
37
|
default: 'off'
|
|
37
38
|
}
|
|
38
39
|
}
|
|
@@ -42,7 +43,7 @@ if (frontendConfig.securityWarnings) {
|
|
|
42
43
|
WebviewConfigSchema.properties['webview.warnIfUnsecure'] = {
|
|
43
44
|
scope: 'application',
|
|
44
45
|
type: 'boolean',
|
|
45
|
-
description: 'Warns users that webviews are currently deployed unsecurely.',
|
|
46
|
+
description: nls.localize('theia/plugin-ext/webviewWarnIfUnsecure', 'Warns users that webviews are currently deployed unsecurely.'),
|
|
46
47
|
default: true,
|
|
47
48
|
};
|
|
48
49
|
}
|
|
@@ -40,7 +40,7 @@ import { Schemes } from '../../../common/uri-components';
|
|
|
40
40
|
import { PluginSharedStyle } from '../plugin-shared-style';
|
|
41
41
|
import { WebviewThemeDataProvider } from './webview-theme-data-provider';
|
|
42
42
|
import { ExternalUriService } from '@theia/core/lib/browser/external-uri-service';
|
|
43
|
-
import { OutputChannelManager } from '@theia/output/lib/
|
|
43
|
+
import { OutputChannelManager } from '@theia/output/lib/browser/output-channel';
|
|
44
44
|
import { WebviewPreferences } from './webview-preferences';
|
|
45
45
|
import { WebviewResourceCache } from './webview-resource-cache';
|
|
46
46
|
import { Endpoint } from '@theia/core/lib/browser/endpoint';
|
|
@@ -249,7 +249,7 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget {
|
|
|
249
249
|
|
|
250
250
|
const element = document.createElement('iframe');
|
|
251
251
|
element.className = 'webview';
|
|
252
|
-
element.sandbox.add('allow-scripts', 'allow-forms', 'allow-same-origin');
|
|
252
|
+
element.sandbox.add('allow-scripts', 'allow-forms', 'allow-same-origin', 'allow-downloads');
|
|
253
253
|
element.setAttribute('src', `${this.externalEndpoint}/index.html?id=${this.identifier.id}`);
|
|
254
254
|
element.style.border = 'none';
|
|
255
255
|
element.style.width = '100%';
|
package/src/plugin/comments.ts
CHANGED
|
@@ -18,7 +18,7 @@ import * as theia from '@theia/plugin';
|
|
|
18
18
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
19
19
|
import { CommandRegistryImpl } from './command-registry';
|
|
20
20
|
import { UriComponents } from '../common/uri-components';
|
|
21
|
-
import { URI } from './types-impl';
|
|
21
|
+
import { CommentThreadCollapsibleState, URI } from './types-impl';
|
|
22
22
|
import {
|
|
23
23
|
Range,
|
|
24
24
|
Comment,
|
|
@@ -29,7 +29,6 @@ import { DocumentsExtImpl } from './documents';
|
|
|
29
29
|
import { Emitter } from '@theia/core/lib/common/event';
|
|
30
30
|
import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
31
31
|
import { fromMarkdown, fromRange, toRange } from './type-converters';
|
|
32
|
-
import { CommentThreadCollapsibleState } from './types-impl';
|
|
33
32
|
import {
|
|
34
33
|
CommentsCommandArg, CommentsContextCommandArg, CommentsEditCommandArg,
|
|
35
34
|
CommentsExt,
|
|
@@ -19,17 +19,15 @@
|
|
|
19
19
|
*--------------------------------------------------------------------------------------------*/
|
|
20
20
|
// copied and modified from https://github.com/microsoft/vscode/blob/53eac52308c4611000a171cc7bf1214293473c78/src/vs/workbench/api/common/extHostCustomEditors.ts
|
|
21
21
|
|
|
22
|
-
import { CustomEditorsExt, CustomEditorsMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc';
|
|
22
|
+
import { CustomEditorsExt, CustomEditorsMain, Plugin, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc';
|
|
23
23
|
import * as theia from '@theia/plugin';
|
|
24
24
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
25
|
-
import {
|
|
26
|
-
import { URI } from './types-impl';
|
|
25
|
+
import { Disposable, URI } from './types-impl';
|
|
27
26
|
import { UriComponents } from '../common/uri-components';
|
|
28
27
|
import { DocumentsExtImpl } from './documents';
|
|
29
28
|
import { WebviewImpl, WebviewsExtImpl } from './webviews';
|
|
30
29
|
import { CancellationToken, CancellationTokenSource } from '@theia/core/lib/common/cancellation';
|
|
31
30
|
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
32
|
-
import { Disposable } from './types-impl';
|
|
33
31
|
import { WorkspaceExtImpl } from './workspace';
|
|
34
32
|
import * as Converters from './type-converters';
|
|
35
33
|
|
|
@@ -24,8 +24,7 @@ import {
|
|
|
24
24
|
PLUGIN_RPC_CONTEXT, PluginInfo
|
|
25
25
|
} from '../common/plugin-api-rpc';
|
|
26
26
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
27
|
-
import { URI } from './types-impl';
|
|
28
|
-
import { Disposable, FileDecoration } from './types-impl';
|
|
27
|
+
import { Disposable, FileDecoration, URI } from './types-impl';
|
|
29
28
|
import { CancellationToken } from '@theia/core/lib/common';
|
|
30
29
|
import { dirname } from 'path';
|
|
31
30
|
|
|
@@ -17,9 +17,8 @@
|
|
|
17
17
|
import * as theia from '@theia/plugin';
|
|
18
18
|
import { ModelChangedEvent, DocumentsMain } from '../common/plugin-api-rpc';
|
|
19
19
|
import { Range as ARange } from '../common/plugin-api-rpc-model';
|
|
20
|
-
import { URI } from './types-impl';
|
|
20
|
+
import { EndOfLine, Position, Range, URI } from './types-impl';
|
|
21
21
|
import { ok } from '../common/assert';
|
|
22
|
-
import { Range, Position, EndOfLine } from './types-impl';
|
|
23
22
|
import { PrefixSumComputer } from './prefix-sum-computer';
|
|
24
23
|
import { getWordAtText, ensureValidWordDefinition } from './word-helper';
|
|
25
24
|
|
package/src/plugin/documents.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* based on https://github.com/Microsoft/vscode/blob/bf9a27ec01f2ef82fc45f69e0c946c7d74a57d3e/src/vs/workbench/api/node/extHostDocumentSaveParticipant.ts
|
|
22
22
|
*/
|
|
23
23
|
import { DocumentsExt, ModelChangedEvent, PLUGIN_RPC_CONTEXT, DocumentsMain, SingleEditOperation } from '../common/plugin-api-rpc';
|
|
24
|
-
import { URI } from './types-impl';
|
|
24
|
+
import { TextEdit, URI } from './types-impl';
|
|
25
25
|
import { UriComponents } from '../common/uri-components';
|
|
26
26
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
27
27
|
import { Emitter, Event } from '@theia/core/lib/common/event';
|
|
@@ -31,7 +31,6 @@ import { EditorsAndDocumentsExtImpl } from './editors-and-documents';
|
|
|
31
31
|
import * as Converter from './type-converters';
|
|
32
32
|
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
33
33
|
import { Range, TextDocumentShowOptions } from '../common/plugin-api-rpc-model';
|
|
34
|
-
import { TextEdit } from './types-impl';
|
|
35
34
|
|
|
36
35
|
export class DocumentsExtImpl implements DocumentsExt {
|
|
37
36
|
private toDispose = new DisposableCollection();
|
|
@@ -31,11 +31,10 @@
|
|
|
31
31
|
import { Emitter, WaitUntilEvent, AsyncEmitter } from '@theia/core/lib/common/event';
|
|
32
32
|
import { IRelativePattern, parse } from '@theia/callhierarchy/lib/common/glob';
|
|
33
33
|
import { UriComponents } from '@theia/core/shared/vscode-uri';
|
|
34
|
-
import { URI } from './types-impl';
|
|
34
|
+
import { Disposable, URI, WorkspaceEdit } from './types-impl';
|
|
35
35
|
import { EditorsAndDocumentsExtImpl as ExtHostDocumentsAndEditors } from './editors-and-documents';
|
|
36
36
|
import type * as vscode from '@theia/plugin';
|
|
37
37
|
import * as typeConverter from './type-converters';
|
|
38
|
-
import { Disposable, WorkspaceEdit } from './types-impl';
|
|
39
38
|
import { FileOperation } from '@theia/filesystem/lib/common/files';
|
|
40
39
|
import { flatten } from '../common/arrays';
|
|
41
40
|
import { CancellationToken } from '@theia/core/lib/common/cancellation';
|
|
@@ -29,12 +29,11 @@
|
|
|
29
29
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
30
30
|
|
|
31
31
|
import { UriComponents } from '@theia/core/shared/vscode-uri';
|
|
32
|
-
import { URI } from './types-impl';
|
|
32
|
+
import { FileChangeType, FileSystemError, URI } from './types-impl';
|
|
33
33
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
34
34
|
import { PLUGIN_RPC_CONTEXT, FileSystemExt, FileSystemMain, IFileChangeDto } from '../common/plugin-api-rpc';
|
|
35
35
|
import * as vscode from '@theia/plugin';
|
|
36
36
|
import * as files from '@theia/filesystem/lib/common/files';
|
|
37
|
-
import { FileChangeType, FileSystemError } from './types-impl';
|
|
38
37
|
import * as typeConverter from './type-converters';
|
|
39
38
|
import { LanguagesExtImpl } from './languages';
|
|
40
39
|
import { Schemes as Schemas } from '../common/uri-components';
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import * as assert from 'assert';
|
|
18
18
|
import { KnownCommands } from './known-commands';
|
|
19
|
-
import { URI } from './types-impl';
|
|
20
|
-
import { Position } from './types-impl';
|
|
19
|
+
import { Position, URI } from './types-impl';
|
|
21
20
|
import { fromPosition } from './type-converters';
|
|
22
21
|
|
|
23
22
|
describe('Known Command Conversions', () => {
|
|
@@ -29,7 +29,9 @@ export class CallHierarchyAdapter {
|
|
|
29
29
|
private readonly documents: DocumentsExtImpl
|
|
30
30
|
) { }
|
|
31
31
|
|
|
32
|
-
async provideRootDefinition(
|
|
32
|
+
async provideRootDefinition(
|
|
33
|
+
resource: URI, position: rpc.Position, token: theia.CancellationToken
|
|
34
|
+
): Promise<model.CallHierarchyDefinition | model.CallHierarchyDefinition[] | undefined> {
|
|
33
35
|
const documentData = this.documents.getDocumentData(resource);
|
|
34
36
|
if (!documentData) {
|
|
35
37
|
return Promise.reject(new Error(`There is no document for ${resource}`));
|
|
@@ -40,12 +42,14 @@ export class CallHierarchyAdapter {
|
|
|
40
42
|
position.lineNumber,
|
|
41
43
|
position.column
|
|
42
44
|
),
|
|
43
|
-
token
|
|
45
|
+
token
|
|
46
|
+
);
|
|
47
|
+
|
|
44
48
|
if (!definition) {
|
|
45
49
|
return undefined;
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
return this.fromCallHierarchyItem(definition);
|
|
52
|
+
return Array.isArray(definition) ? definition.map(item => this.fromCallHierarchyItem(item)) : this.fromCallHierarchyItem(definition);
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
async provideCallers(definition: model.CallHierarchyDefinition, token: theia.CancellationToken): Promise<model.CallHierarchyReference[] | undefined> {
|
|
@@ -72,7 +76,9 @@ export class CallHierarchyAdapter {
|
|
|
72
76
|
range: this.fromRange(item.range),
|
|
73
77
|
selectionRange: this.fromRange(item.selectionRange),
|
|
74
78
|
name: item.name,
|
|
75
|
-
kind: item.kind
|
|
79
|
+
kind: item.kind,
|
|
80
|
+
tags: item.tags,
|
|
81
|
+
data: item.data,
|
|
76
82
|
};
|
|
77
83
|
}
|
|
78
84
|
|
|
@@ -95,7 +101,7 @@ export class CallHierarchyAdapter {
|
|
|
95
101
|
}
|
|
96
102
|
|
|
97
103
|
private toCallHierarchyItem(definition: model.CallHierarchyDefinition): theia.CallHierarchyItem {
|
|
98
|
-
|
|
104
|
+
const item = new types.CallHierarchyItem(
|
|
99
105
|
Converter.SymbolKind.toSymbolKind(definition.kind),
|
|
100
106
|
definition.name,
|
|
101
107
|
definition.detail ? definition.detail : '',
|
|
@@ -103,6 +109,9 @@ export class CallHierarchyAdapter {
|
|
|
103
109
|
this.toRange(definition.range),
|
|
104
110
|
this.toRange(definition.selectionRange),
|
|
105
111
|
);
|
|
112
|
+
item.tags = definition.tags;
|
|
113
|
+
item.data = definition.data;
|
|
114
|
+
return item;
|
|
106
115
|
}
|
|
107
116
|
|
|
108
117
|
private fromCallHierarchyIncomingCall(caller: theia.CallHierarchyIncomingCall): model.CallHierarchyReference {
|
|
@@ -19,8 +19,7 @@ import * as theia from '@theia/plugin';
|
|
|
19
19
|
import * as Converter from '../type-converters';
|
|
20
20
|
import * as model from '../../common/plugin-api-rpc-model';
|
|
21
21
|
import { DocumentsExtImpl } from '../documents';
|
|
22
|
-
import { WorkspaceEditDto } from '../../common/plugin-api-rpc';
|
|
23
|
-
import { Position } from '../../common/plugin-api-rpc';
|
|
22
|
+
import { Position, WorkspaceEditDto } from '../../common/plugin-api-rpc';
|
|
24
23
|
import { Range } from '../types-impl';
|
|
25
24
|
import { isObject } from '../../common/types';
|
|
26
25
|
|
package/src/plugin/languages.ts
CHANGED
|
@@ -90,6 +90,7 @@ import { DeclarationAdapter } from './languages/declaration';
|
|
|
90
90
|
import { CallHierarchyAdapter } from './languages/call-hierarchy';
|
|
91
91
|
import { BinaryBuffer } from '@theia/core/lib/common/buffer';
|
|
92
92
|
import { DocumentSemanticTokensAdapter, DocumentRangeSemanticTokensAdapter } from './languages/semantic-highlighting';
|
|
93
|
+
import { isReadonlyArray } from '../common/arrays';
|
|
93
94
|
|
|
94
95
|
type Adapter = CompletionAdapter |
|
|
95
96
|
SignatureHelpAdapter |
|
|
@@ -204,7 +205,7 @@ export class LanguagesExtImpl implements LanguagesExt {
|
|
|
204
205
|
}
|
|
205
206
|
|
|
206
207
|
private transformDocumentSelector(selector: theia.DocumentSelector): SerializedDocumentFilter[] {
|
|
207
|
-
if (
|
|
208
|
+
if (isReadonlyArray(selector)) {
|
|
208
209
|
return selector.map(sel => this.doTransformDocumentSelector(sel)!);
|
|
209
210
|
}
|
|
210
211
|
|
|
@@ -582,7 +583,9 @@ export class LanguagesExtImpl implements LanguagesExt {
|
|
|
582
583
|
return this.createDisposable(callId);
|
|
583
584
|
}
|
|
584
585
|
|
|
585
|
-
$provideRootDefinition(
|
|
586
|
+
$provideRootDefinition(
|
|
587
|
+
handle: number, resource: UriComponents, location: Position, token: theia.CancellationToken
|
|
588
|
+
): Promise<CallHierarchyDefinition | CallHierarchyDefinition[] | undefined> {
|
|
586
589
|
return this.withAdapter(handle, CallHierarchyAdapter, adapter => adapter.provideRootDefinition(URI.revive(resource), location, token), undefined);
|
|
587
590
|
}
|
|
588
591
|
|
|
@@ -50,14 +50,17 @@ export class MessageRegistryExt {
|
|
|
50
50
|
} else {
|
|
51
51
|
if ('modal' in optionsOrFirstItem) {
|
|
52
52
|
options.modal = optionsOrFirstItem.modal;
|
|
53
|
+
if ('detail' in optionsOrFirstItem) {
|
|
54
|
+
options.detail = optionsOrFirstItem.detail;
|
|
55
|
+
}
|
|
53
56
|
}
|
|
54
57
|
}
|
|
58
|
+
for (const item of rest) {
|
|
59
|
+
pushItem(item);
|
|
60
|
+
}
|
|
61
|
+
const actionHandle = await this.proxy.$showMessage(type, message, options, actions);
|
|
62
|
+
return actionHandle !== undefined ? items[actionHandle] : undefined;
|
|
55
63
|
}
|
|
56
|
-
for (const item of rest) {
|
|
57
|
-
pushItem(item);
|
|
58
|
-
}
|
|
59
|
-
const actionHandle = await this.proxy.$showMessage(type, message, options, actions);
|
|
60
|
-
return actionHandle !== undefined ? items[actionHandle] : undefined;
|
|
61
|
-
}
|
|
62
64
|
|
|
65
|
+
}
|
|
63
66
|
}
|
|
@@ -15,22 +15,25 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { Emitter } from '@theia/core/lib/common/event';
|
|
17
17
|
import { Path } from '@theia/core/lib/common/path';
|
|
18
|
-
import { CommunicationProvider } from '@theia/debug/lib/common/debug-model';
|
|
19
18
|
import * as theia from '@theia/plugin';
|
|
20
19
|
import { URI } from '@theia/core/shared/vscode-uri';
|
|
21
20
|
import { Breakpoint } from '../../../common/plugin-api-rpc-model';
|
|
22
|
-
import { DebugExt, DebugMain, PLUGIN_RPC_CONTEXT as Ext, TerminalOptionsExt } from '../../../common/plugin-api-rpc';
|
|
21
|
+
import { DebugConfigurationProviderTriggerKind, DebugExt, DebugMain, PLUGIN_RPC_CONTEXT as Ext, TerminalOptionsExt } from '../../../common/plugin-api-rpc';
|
|
23
22
|
import { PluginPackageDebuggersContribution } from '../../../common/plugin-protocol';
|
|
24
23
|
import { RPCProtocol } from '../../../common/rpc-protocol';
|
|
25
24
|
import { PluginWebSocketChannel } from '../../../common/connection';
|
|
26
25
|
import { CommandRegistryImpl } from '../../command-registry';
|
|
27
26
|
import { ConnectionExtImpl } from '../../connection-ext';
|
|
28
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
Disposable, Breakpoint as BreakpointExt, SourceBreakpoint, FunctionBreakpoint, Location, Range,
|
|
29
|
+
DebugAdapterServer, DebugAdapterExecutable, DebugAdapterNamedPipeServer, DebugAdapterInlineImplementation
|
|
30
|
+
} from '../../types-impl';
|
|
29
31
|
import { resolveDebugAdapterExecutable } from './plugin-debug-adapter-executable-resolver';
|
|
30
32
|
import { PluginDebugAdapterSession } from './plugin-debug-adapter-session';
|
|
31
|
-
import {
|
|
33
|
+
import { connectInlineDebugAdapter, connectPipeDebugAdapter, connectSocketDebugAdapter, startDebugAdapter } from './plugin-debug-adapter-starter';
|
|
32
34
|
import { PluginDebugAdapterTracker } from './plugin-debug-adapter-tracker';
|
|
33
35
|
import uuid = require('uuid');
|
|
36
|
+
import { CommunicationProvider } from '@theia/debug/lib/node/debug-model';
|
|
34
37
|
|
|
35
38
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
36
39
|
|
|
@@ -43,8 +46,11 @@ export class DebugExtImpl implements DebugExt {
|
|
|
43
46
|
// debug sessions by sessionId
|
|
44
47
|
private sessions = new Map<string, PluginDebugAdapterSession>();
|
|
45
48
|
|
|
46
|
-
// providers by type
|
|
49
|
+
// providers by type (initial)
|
|
47
50
|
private configurationProviders = new Map<string, Set<theia.DebugConfigurationProvider>>();
|
|
51
|
+
// providers by type (dynamic)
|
|
52
|
+
private dynamicConfigurationProviders = new Map<string, Set<theia.DebugConfigurationProvider>>();
|
|
53
|
+
|
|
48
54
|
/**
|
|
49
55
|
* Only use internally, don't send it to the frontend. It's expensive!
|
|
50
56
|
* It's already there as a part of the plugin metadata.
|
|
@@ -182,19 +188,22 @@ export class DebugExtImpl implements DebugExt {
|
|
|
182
188
|
});
|
|
183
189
|
}
|
|
184
190
|
|
|
185
|
-
registerDebugConfigurationProvider(debugType: string, provider: theia.DebugConfigurationProvider): Disposable {
|
|
186
|
-
console.log(`Debug configuration provider has been registered: ${debugType}`);
|
|
187
|
-
const
|
|
188
|
-
|
|
191
|
+
registerDebugConfigurationProvider(debugType: string, provider: theia.DebugConfigurationProvider, trigger: theia.DebugConfigurationProviderTriggerKind): Disposable {
|
|
192
|
+
console.log(`Debug configuration provider has been registered: ${debugType}, trigger: ${trigger}`);
|
|
193
|
+
const providersByTriggerKind = trigger === DebugConfigurationProviderTriggerKind.Initial ? this.configurationProviders : this.dynamicConfigurationProviders;
|
|
194
|
+
let providers = providersByTriggerKind.get(debugType);
|
|
195
|
+
if (!providers) {
|
|
196
|
+
providersByTriggerKind.set(debugType, providers = new Set());
|
|
197
|
+
}
|
|
189
198
|
providers.add(provider);
|
|
190
199
|
|
|
191
200
|
return Disposable.create(() => {
|
|
192
201
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
193
|
-
const providers =
|
|
202
|
+
const providers = providersByTriggerKind.get(debugType);
|
|
194
203
|
if (providers) {
|
|
195
204
|
providers.delete(provider);
|
|
196
205
|
if (providers.size === 0) {
|
|
197
|
-
|
|
206
|
+
providersByTriggerKind.delete(debugType);
|
|
198
207
|
}
|
|
199
208
|
}
|
|
200
209
|
});
|
|
@@ -319,10 +328,10 @@ export class DebugExtImpl implements DebugExt {
|
|
|
319
328
|
return undefined;
|
|
320
329
|
}
|
|
321
330
|
|
|
322
|
-
async $provideDebugConfigurations(debugType: string, workspaceFolderUri: string | undefined): Promise<theia.DebugConfiguration[]> {
|
|
331
|
+
async $provideDebugConfigurations(debugType: string, workspaceFolderUri: string | undefined, dynamic: boolean = false): Promise<theia.DebugConfiguration[]> {
|
|
323
332
|
let result: theia.DebugConfiguration[] = [];
|
|
324
333
|
|
|
325
|
-
const providers = this.configurationProviders.get(debugType);
|
|
334
|
+
const providers = dynamic ? this.dynamicConfigurationProviders.get(debugType) : this.configurationProviders.get(debugType);
|
|
326
335
|
if (providers) {
|
|
327
336
|
for (const provider of providers) {
|
|
328
337
|
if (provider.provideDebugConfigurations) {
|
|
@@ -337,7 +346,11 @@ export class DebugExtImpl implements DebugExt {
|
|
|
337
346
|
async $resolveDebugConfigurations(debugConfiguration: theia.DebugConfiguration, workspaceFolderUri: string | undefined): Promise<theia.DebugConfiguration | undefined> {
|
|
338
347
|
let current = debugConfiguration;
|
|
339
348
|
|
|
340
|
-
for (const providers of [
|
|
349
|
+
for (const providers of [
|
|
350
|
+
this.configurationProviders.get(debugConfiguration.type),
|
|
351
|
+
this.dynamicConfigurationProviders.get(debugConfiguration.type),
|
|
352
|
+
this.configurationProviders.get('*')
|
|
353
|
+
]) {
|
|
341
354
|
if (providers) {
|
|
342
355
|
for (const provider of providers) {
|
|
343
356
|
if (provider.resolveDebugConfiguration) {
|
|
@@ -363,7 +376,11 @@ export class DebugExtImpl implements DebugExt {
|
|
|
363
376
|
Promise<theia.DebugConfiguration | undefined> {
|
|
364
377
|
let current = debugConfiguration;
|
|
365
378
|
|
|
366
|
-
for (const providers of [
|
|
379
|
+
for (const providers of [
|
|
380
|
+
this.configurationProviders.get(debugConfiguration.type),
|
|
381
|
+
this.dynamicConfigurationProviders.get(debugConfiguration.type),
|
|
382
|
+
this.configurationProviders.get('*')
|
|
383
|
+
]) {
|
|
367
384
|
if (providers) {
|
|
368
385
|
for (const provider of providers) {
|
|
369
386
|
if (provider.resolveDebugConfigurationWithSubstitutedVariables) {
|
|
@@ -409,16 +426,20 @@ export class DebugExtImpl implements DebugExt {
|
|
|
409
426
|
// @param executable The debug adapter's executable information as specified in the package.json (or undefined if no such information exists).
|
|
410
427
|
const descriptor = await descriptorFactory.createDebugAdapterDescriptor(session, executable);
|
|
411
428
|
if (descriptor) {
|
|
412
|
-
if (
|
|
413
|
-
return
|
|
414
|
-
} else {
|
|
429
|
+
if (DebugAdapterServer.is(descriptor)) {
|
|
430
|
+
return connectSocketDebugAdapter(descriptor);
|
|
431
|
+
} else if (DebugAdapterExecutable.is(descriptor)) {
|
|
415
432
|
return startDebugAdapter(descriptor);
|
|
433
|
+
} else if (DebugAdapterNamedPipeServer.is(descriptor)) {
|
|
434
|
+
return connectPipeDebugAdapter(descriptor);
|
|
435
|
+
} else if (DebugAdapterInlineImplementation.is(descriptor)) {
|
|
436
|
+
return connectInlineDebugAdapter(descriptor);
|
|
416
437
|
}
|
|
417
438
|
}
|
|
418
439
|
}
|
|
419
440
|
|
|
420
441
|
if ('debugServer' in debugConfiguration) {
|
|
421
|
-
return
|
|
442
|
+
return connectSocketDebugAdapter({ port: debugConfiguration.debugServer });
|
|
422
443
|
} else {
|
|
423
444
|
if (!executable) {
|
|
424
445
|
throw new Error('It is not possible to provide debug adapter executable.');
|
|
@@ -14,23 +14,23 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import { CommunicationProvider } from '@theia/debug/lib/common/debug-model';
|
|
18
17
|
import { DebugAdapterSessionImpl } from '@theia/debug/lib/node/debug-adapter-session';
|
|
19
18
|
import * as theia from '@theia/plugin';
|
|
20
19
|
import { IWebSocket } from '@theia/core/shared/vscode-ws-jsonrpc';
|
|
20
|
+
import { CommunicationProvider, DebugAdapterSession } from '@theia/debug/lib/node/debug-model';
|
|
21
21
|
|
|
22
22
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Server debug adapter session.
|
|
26
26
|
*/
|
|
27
|
-
export class PluginDebugAdapterSession extends DebugAdapterSessionImpl implements theia.DebugSession {
|
|
27
|
+
export class PluginDebugAdapterSession extends DebugAdapterSessionImpl implements theia.DebugSession, DebugAdapterSession {
|
|
28
28
|
readonly type: string;
|
|
29
29
|
readonly name: string;
|
|
30
30
|
readonly configuration: theia.DebugConfiguration;
|
|
31
31
|
|
|
32
32
|
constructor(
|
|
33
|
-
|
|
33
|
+
readonly communicationProvider: CommunicationProvider,
|
|
34
34
|
protected readonly tracker: theia.DebugAdapterTracker,
|
|
35
35
|
protected readonly theiaSession: theia.DebugSession) {
|
|
36
36
|
|
|
@@ -15,15 +15,18 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
17
|
import * as net from 'net';
|
|
18
|
-
import * as theia from '@theia/plugin';
|
|
19
|
-
import { CommunicationProvider } from '@theia/debug/lib/common/debug-model';
|
|
20
18
|
import { ChildProcess, spawn, fork, ForkOptions } from 'child_process';
|
|
19
|
+
import { CommunicationProvider } from '@theia/debug/lib/node/debug-model';
|
|
20
|
+
import { StreamCommunicationProvider } from '@theia/debug/lib/node/stream-communication-provider';
|
|
21
|
+
import { Disposable } from '@theia/core/lib/common/disposable';
|
|
22
|
+
import { DebugAdapterExecutable, DebugAdapterInlineImplementation, DebugAdapterNamedPipeServer, DebugAdapterServer } from '../../types-impl';
|
|
23
|
+
import { InlineCommunicationProvider } from '@theia/debug/lib/node/inline-communication-provider';
|
|
21
24
|
const isElectron = require('is-electron');
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
27
|
* Starts debug adapter process.
|
|
25
28
|
*/
|
|
26
|
-
export function startDebugAdapter(executable:
|
|
29
|
+
export function startDebugAdapter(executable: DebugAdapterExecutable): CommunicationProvider {
|
|
27
30
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
31
|
const options: any = { stdio: ['pipe', 'pipe', 2] };
|
|
29
32
|
|
|
@@ -63,21 +66,28 @@ export function startDebugAdapter(executable: theia.DebugAdapterExecutable): Com
|
|
|
63
66
|
childProcess = spawn(command, args, options);
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
dispose: () => childProcess.kill()
|
|
70
|
-
};
|
|
69
|
+
const provider = new StreamCommunicationProvider(childProcess.stdout!, childProcess.stdin!);
|
|
70
|
+
provider.push(Disposable.create(() => childProcess.kill()));
|
|
71
|
+
return provider;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
/**
|
|
74
75
|
* Connects to a remote debug server.
|
|
75
76
|
*/
|
|
76
|
-
export function
|
|
77
|
+
export function connectSocketDebugAdapter(server: DebugAdapterServer): CommunicationProvider {
|
|
77
78
|
const socket = net.createConnection(server.port, server.host);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
const provider = new StreamCommunicationProvider(socket, socket);
|
|
80
|
+
provider.push(Disposable.create(() => socket.end()));
|
|
81
|
+
return provider;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function connectPipeDebugAdapter(adapter: DebugAdapterNamedPipeServer): CommunicationProvider {
|
|
85
|
+
const socket = net.createConnection(adapter.path);
|
|
86
|
+
const provider = new StreamCommunicationProvider(socket, socket);
|
|
87
|
+
provider.push(Disposable.create(() => socket.end()));
|
|
88
|
+
return provider;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function connectInlineDebugAdapter(adapter: DebugAdapterInlineImplementation): CommunicationProvider {
|
|
92
|
+
return new InlineCommunicationProvider(adapter.implementation);
|
|
83
93
|
}
|