@theia/plugin-ext 1.28.0-next.9 → 1.29.0-next.10
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-model.d.ts +8 -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 +12 -3
- 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 +4 -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.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js +4 -2
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/browser/worker/worker-env-ext.d.ts +1 -0
- package/lib/hosted/browser/worker/worker-env-ext.d.ts.map +1 -1
- package/lib/hosted/browser/worker/worker-env-ext.js +3 -0
- package/lib/hosted/browser/worker/worker-env-ext.js.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts +5 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js +22 -15
- package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
- package/lib/main/browser/comments/comment-thread-widget.js +5 -5
- package/lib/main/browser/comments/comment-thread-widget.js.map +1 -1
- package/lib/main/browser/debug/debug-main.d.ts +1 -0
- package/lib/main/browser/debug/debug-main.d.ts.map +1 -1
- package/lib/main/browser/debug/debug-main.js +10 -0
- package/lib/main/browser/debug/debug-main.js.map +1 -1
- package/lib/main/browser/languages-main.d.ts +6 -1
- package/lib/main/browser/languages-main.d.ts.map +1 -1
- package/lib/main/browser/languages-main.js +15 -1
- package/lib/main/browser/languages-main.js.map +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.d.ts +24 -88
- package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.js +108 -518
- package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
- package/lib/main/browser/menus/plugin-menu-command-adapter.d.ts +44 -0
- package/lib/main/browser/menus/plugin-menu-command-adapter.d.ts.map +1 -0
- package/lib/main/browser/menus/plugin-menu-command-adapter.js +274 -0
- package/lib/main/browser/menus/plugin-menu-command-adapter.js.map +1 -0
- package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts +18 -0
- package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts.map +1 -0
- package/lib/main/browser/menus/vscode-theia-menu-mappings.js +88 -0
- package/lib/main/browser/menus/vscode-theia-menu-mappings.js.map +1 -0
- package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
- package/lib/main/browser/plugin-contribution-handler.js +9 -4
- package/lib/main/browser/plugin-contribution-handler.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 +4 -3
- package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
- package/lib/main/browser/plugin-frontend-contribution.d.ts +0 -2
- package/lib/main/browser/plugin-frontend-contribution.d.ts.map +1 -1
- package/lib/main/browser/plugin-frontend-contribution.js +0 -8
- package/lib/main/browser/plugin-frontend-contribution.js.map +1 -1
- package/lib/main/browser/plugin-shared-style.d.ts.map +1 -1
- package/lib/main/browser/plugin-shared-style.js +0 -1
- package/lib/main/browser/plugin-shared-style.js.map +1 -1
- package/lib/main/browser/preference-registry-main.d.ts +4 -3
- package/lib/main/browser/preference-registry-main.d.ts.map +1 -1
- package/lib/main/browser/preference-registry-main.js +26 -14
- package/lib/main/browser/preference-registry-main.js.map +1 -1
- package/lib/main/browser/scm-main.d.ts +1 -0
- package/lib/main/browser/scm-main.d.ts.map +1 -1
- package/lib/main/browser/scm-main.js +7 -0
- package/lib/main/browser/scm-main.js.map +1 -1
- package/lib/main/browser/view/tree-view-widget.js +2 -2
- package/lib/main/browser/view/tree-view-widget.js.map +1 -1
- package/lib/main/browser/workspace-main.d.ts.map +1 -1
- package/lib/main/browser/workspace-main.js +1 -4
- package/lib/main/browser/workspace-main.js.map +1 -1
- package/lib/main/node/handlers/plugin-theia-file-handler.d.ts +0 -4
- package/lib/main/node/handlers/plugin-theia-file-handler.d.ts.map +1 -1
- package/lib/main/node/handlers/plugin-theia-file-handler.js +0 -26
- package/lib/main/node/handlers/plugin-theia-file-handler.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 +0 -2
- package/lib/main/node/plugin-ext-backend-module.js.map +1 -1
- package/lib/main/node/resolvers/local-plugin-deployer-resolver.d.ts.map +1 -1
- package/lib/main/node/resolvers/local-plugin-deployer-resolver.js.map +1 -1
- package/lib/plugin/debug/debug-ext.d.ts +3 -1
- package/lib/plugin/debug/debug-ext.d.ts.map +1 -1
- package/lib/plugin/debug/debug-ext.js +26 -4
- package/lib/plugin/debug/debug-ext.js.map +1 -1
- package/lib/plugin/debug/plugin-debug-adapter-session.d.ts +1 -0
- package/lib/plugin/debug/plugin-debug-adapter-session.d.ts.map +1 -1
- package/lib/plugin/debug/plugin-debug-adapter-session.js +3 -0
- package/lib/plugin/debug/plugin-debug-adapter-session.js.map +1 -1
- package/lib/plugin/env.d.ts +11 -0
- package/lib/plugin/env.d.ts.map +1 -1
- package/lib/plugin/env.js +20 -0
- package/lib/plugin/env.js.map +1 -1
- package/lib/plugin/languages/evaluatable-expression.d.ts +12 -0
- package/lib/plugin/languages/evaluatable-expression.d.ts.map +1 -0
- package/lib/plugin/languages/evaluatable-expression.js +41 -0
- package/lib/plugin/languages/evaluatable-expression.js.map +1 -0
- package/lib/plugin/languages/signature.d.ts.map +1 -1
- package/lib/plugin/languages/signature.js +5 -1
- package/lib/plugin/languages/signature.js.map +1 -1
- package/lib/plugin/languages.d.ts +3 -1
- package/lib/plugin/languages.d.ts.map +1 -1
- package/lib/plugin/languages.js +11 -0
- package/lib/plugin/languages.js.map +1 -1
- package/lib/plugin/node/debug/debug.spec.d.ts +2 -0
- package/lib/plugin/node/debug/debug.spec.d.ts.map +1 -0
- package/lib/plugin/node/debug/debug.spec.js +68 -0
- package/lib/plugin/node/debug/debug.spec.js.map +1 -0
- package/lib/plugin/node/env-node-ext.d.ts +3 -0
- package/lib/plugin/node/env-node-ext.d.ts.map +1 -1
- package/lib/plugin/node/env-node-ext.js +11 -0
- package/lib/plugin/node/env-node-ext.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +14 -0
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugin/plugin-manager.js +1 -0
- package/lib/plugin/plugin-manager.js.map +1 -1
- package/lib/plugin/plugin-storage.d.ts +1 -0
- package/lib/plugin/plugin-storage.d.ts.map +1 -1
- package/lib/plugin/plugin-storage.js +3 -0
- package/lib/plugin/plugin-storage.js.map +1 -1
- package/lib/plugin/preference-registry.d.ts +15 -2
- package/lib/plugin/preference-registry.d.ts.map +1 -1
- package/lib/plugin/preference-registry.js +105 -62
- package/lib/plugin/preference-registry.js.map +1 -1
- package/lib/plugin/preference-registry.spec.js +207 -35
- package/lib/plugin/preference-registry.spec.js.map +1 -1
- package/lib/plugin/quick-open.d.ts.map +1 -1
- package/lib/plugin/quick-open.js +1 -0
- package/lib/plugin/quick-open.js.map +1 -1
- package/lib/plugin/scm.d.ts +3 -0
- package/lib/plugin/scm.d.ts.map +1 -1
- package/lib/plugin/scm.js +8 -0
- package/lib/plugin/scm.js.map +1 -1
- package/lib/plugin/type-converters.d.ts +1 -0
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +13 -4
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +9 -3
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +26 -11
- package/lib/plugin/types-impl.js.map +1 -1
- package/package.json +27 -27
- package/src/common/plugin-api-rpc-model.ts +11 -0
- package/src/common/plugin-api-rpc.ts +15 -3
- package/src/common/plugin-protocol.ts +4 -0
- package/src/hosted/browser/hosted-plugin.ts +4 -2
- package/src/hosted/browser/worker/worker-env-ext.ts +4 -0
- package/src/hosted/node/scanners/scanner-theia.ts +21 -15
- package/src/main/browser/comments/comment-thread-widget.tsx +5 -5
- package/src/main/browser/debug/debug-main.ts +9 -0
- package/src/main/browser/languages-main.ts +29 -2
- package/src/main/browser/menus/menus-contribution-handler.ts +104 -578
- package/src/main/browser/menus/plugin-menu-command-adapter.ts +259 -0
- package/src/main/browser/menus/vscode-theia-menu-mappings.ts +85 -0
- package/src/main/browser/plugin-contribution-handler.ts +3 -1
- package/src/main/browser/plugin-ext-frontend-module.ts +4 -3
- package/src/main/browser/plugin-frontend-contribution.ts +0 -9
- package/src/main/browser/plugin-shared-style.ts +0 -1
- package/src/main/browser/preference-registry-main.ts +23 -14
- package/src/main/browser/scm-main.ts +10 -0
- package/src/main/browser/view/tree-view-widget.tsx +2 -2
- package/src/main/browser/workspace-main.ts +1 -5
- package/src/main/node/handlers/plugin-theia-file-handler.ts +0 -26
- package/src/main/node/plugin-ext-backend-module.ts +0 -2
- package/src/main/node/resolvers/local-plugin-deployer-resolver.ts +4 -8
- package/src/plugin/debug/debug-ext.ts +30 -5
- package/src/plugin/debug/plugin-debug-adapter-session.ts +4 -0
- package/src/plugin/env.ts +30 -0
- package/src/plugin/languages/evaluatable-expression.ts +47 -0
- package/src/plugin/languages/signature.ts +3 -1
- package/src/plugin/languages.ts +15 -0
- package/src/plugin/node/debug/debug.spec.ts +94 -0
- package/src/plugin/node/env-node-ext.ts +13 -1
- package/src/plugin/plugin-context.ts +16 -1
- package/src/plugin/plugin-manager.ts +1 -0
- package/src/plugin/plugin-storage.ts +4 -0
- package/src/plugin/preference-registry.spec.ts +247 -39
- package/src/plugin/preference-registry.ts +107 -71
- package/src/plugin/quick-open.ts +1 -0
- package/src/plugin/scm.ts +11 -0
- package/src/plugin/type-converters.ts +11 -2
- package/src/plugin/types-impl.ts +25 -5
- package/lib/main/browser/plugin-ext-deploy-command.d.ts +0 -10
- package/lib/main/browser/plugin-ext-deploy-command.d.ts.map +0 -1
- package/lib/main/browser/plugin-ext-deploy-command.js +0 -64
- package/lib/main/browser/plugin-ext-deploy-command.js.map +0 -1
- package/lib/main/node/resolvers/local-file-plugin-deployer-resolver.d.ts +0 -8
- package/lib/main/node/resolvers/local-file-plugin-deployer-resolver.d.ts.map +0 -1
- package/lib/main/node/resolvers/local-file-plugin-deployer-resolver.js +0 -43
- package/lib/main/node/resolvers/local-file-plugin-deployer-resolver.js.map +0 -1
- package/lib/plugin/preferences/configuration.d.ts +0 -35
- package/lib/plugin/preferences/configuration.d.ts.map +0 -1
- package/lib/plugin/preferences/configuration.js +0 -137
- package/lib/plugin/preferences/configuration.js.map +0 -1
- package/lib/plugin/preferences/configuration.spec.d.ts +0 -2
- package/lib/plugin/preferences/configuration.spec.d.ts.map +0 -1
- package/lib/plugin/preferences/configuration.spec.js +0 -178
- package/lib/plugin/preferences/configuration.spec.js.map +0 -1
- package/src/main/browser/plugin-ext-deploy-command.ts +0 -50
- package/src/main/node/resolvers/local-file-plugin-deployer-resolver.ts +0 -34
- package/src/plugin/preferences/configuration.spec.ts +0 -292
- package/src/plugin/preferences/configuration.ts +0 -167
|
@@ -23,13 +23,15 @@ import { PluginPackageDebuggersContribution } from '../../common/plugin-protocol
|
|
|
23
23
|
import { RPCProtocol } from '../../common/rpc-protocol';
|
|
24
24
|
import { CommandRegistryImpl } from '../command-registry';
|
|
25
25
|
import { ConnectionImpl } from '../../common/connection';
|
|
26
|
-
import {
|
|
26
|
+
import { DEBUG_SCHEME, SCHEME_PATTERN } from '@theia/debug/lib/common/debug-uri-utils';
|
|
27
|
+
import { Disposable, Breakpoint as BreakpointExt, SourceBreakpoint, FunctionBreakpoint, Location, Range, URI as URIImpl } from '../types-impl';
|
|
27
28
|
import { PluginDebugAdapterSession } from './plugin-debug-adapter-session';
|
|
28
29
|
import { PluginDebugAdapterTracker } from './plugin-debug-adapter-tracker';
|
|
29
30
|
import uuid = require('uuid');
|
|
30
31
|
import { DebugAdapter } from '@theia/debug/lib/common/debug-model';
|
|
31
32
|
import { PluginDebugAdapterCreator } from './plugin-debug-adapter-creator';
|
|
32
33
|
import { NodeDebugAdapterCreator } from '../node/debug/plugin-node-debug-adapter-creator';
|
|
34
|
+
import { DebugProtocol } from 'vscode-debugprotocol';
|
|
33
35
|
|
|
34
36
|
interface ConfigurationProviderRecord {
|
|
35
37
|
handle: number;
|
|
@@ -176,6 +178,27 @@ export class DebugExtImpl implements DebugExt {
|
|
|
176
178
|
return this.proxy.$stopDebugging(session?.id);
|
|
177
179
|
}
|
|
178
180
|
|
|
181
|
+
asDebugSourceUri(source: theia.DebugProtocolSource, session?: theia.DebugSession): theia.Uri {
|
|
182
|
+
return this.getDebugSourceUri(source, session?.id);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
private getDebugSourceUri(raw: DebugProtocol.Source, sessionId?: string): theia.Uri {
|
|
186
|
+
if (raw.sourceReference && raw.sourceReference > 0) {
|
|
187
|
+
let query = 'ref=' + String(raw.sourceReference);
|
|
188
|
+
if (sessionId) {
|
|
189
|
+
query += `&session=${sessionId}`;
|
|
190
|
+
}
|
|
191
|
+
return URIImpl.from({ scheme: DEBUG_SCHEME, path: raw.path ?? '', query });
|
|
192
|
+
}
|
|
193
|
+
if (!raw.path) {
|
|
194
|
+
throw new Error('Unrecognized source type: ' + JSON.stringify(raw));
|
|
195
|
+
}
|
|
196
|
+
if (raw.path.match(SCHEME_PATTERN)) {
|
|
197
|
+
return URIImpl.parse(raw.path);
|
|
198
|
+
}
|
|
199
|
+
return URIImpl.file(raw.path);
|
|
200
|
+
}
|
|
201
|
+
|
|
179
202
|
registerDebugAdapterDescriptorFactory(debugType: string, factory: theia.DebugAdapterDescriptorFactory): Disposable {
|
|
180
203
|
if (this.descriptorFactories.has(debugType)) {
|
|
181
204
|
throw new Error(`Descriptor factory for ${debugType} has been already registered`);
|
|
@@ -279,13 +302,13 @@ export class DebugExtImpl implements DebugExt {
|
|
|
279
302
|
this.onDidChangeBreakpointsEmitter.fire({ added: a, removed: r, changed: c });
|
|
280
303
|
}
|
|
281
304
|
|
|
282
|
-
protected toBreakpointExt({ functionName, location, enabled, condition, hitCondition, logMessage }: Breakpoint): BreakpointExt | undefined {
|
|
305
|
+
protected toBreakpointExt({ functionName, location, enabled, condition, hitCondition, logMessage, id }: Breakpoint): BreakpointExt | undefined {
|
|
283
306
|
if (location) {
|
|
284
307
|
const range = new Range(location.range.startLineNumber, location.range.startColumn, location.range.endLineNumber, location.range.endColumn);
|
|
285
|
-
return new SourceBreakpoint(new Location(URI.revive(location.uri), range), enabled, condition, hitCondition, logMessage);
|
|
308
|
+
return new SourceBreakpoint(new Location(URI.revive(location.uri), range), enabled, condition, hitCondition, logMessage, id);
|
|
286
309
|
}
|
|
287
310
|
if (functionName) {
|
|
288
|
-
return new FunctionBreakpoint(functionName!, enabled, condition, hitCondition, logMessage);
|
|
311
|
+
return new FunctionBreakpoint(functionName!, enabled, condition, hitCondition, logMessage, id);
|
|
289
312
|
}
|
|
290
313
|
return undefined;
|
|
291
314
|
}
|
|
@@ -305,7 +328,9 @@ export class DebugExtImpl implements DebugExt {
|
|
|
305
328
|
return response.body;
|
|
306
329
|
}
|
|
307
330
|
return Promise.reject(new Error(response.message ?? 'custom request failed'));
|
|
308
|
-
}
|
|
331
|
+
},
|
|
332
|
+
getDebugProtocolBreakpoint: async (breakpoint: Breakpoint) =>
|
|
333
|
+
this.proxy.$getDebugProtocolBreakpoint(sessionId, breakpoint.id)
|
|
309
334
|
};
|
|
310
335
|
|
|
311
336
|
const tracker = await this.createDebugAdapterTracker(theiaSession);
|
|
@@ -61,6 +61,10 @@ export class PluginDebugAdapterSession extends DebugAdapterSessionImpl {
|
|
|
61
61
|
return this.theiaSession.customRequest(command, args);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
async getDebugProtocolBreakpoint(breakpoint: theia.Breakpoint): Promise<theia.DebugProtocolBreakpoint | undefined> {
|
|
65
|
+
return this.theiaSession.getDebugProtocolBreakpoint(breakpoint);
|
|
66
|
+
}
|
|
67
|
+
|
|
64
68
|
protected override onDebugAdapterError(error: Error): void {
|
|
65
69
|
if (this.tracker.onError) {
|
|
66
70
|
this.tracker.onError(error);
|
package/src/plugin/env.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
+
import { Emitter, Event } from '@theia/core/lib/common/event';
|
|
17
18
|
import * as theia from '@theia/plugin';
|
|
18
19
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
19
20
|
import { EnvMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc';
|
|
@@ -29,11 +30,18 @@ export abstract class EnvExtImpl {
|
|
|
29
30
|
private ui: theia.UIKind;
|
|
30
31
|
private envMachineId: string;
|
|
31
32
|
private envSessionId: string;
|
|
33
|
+
private host: string;
|
|
34
|
+
private _isTelemetryEnabled: boolean;
|
|
35
|
+
private _remoteName: string | undefined;
|
|
36
|
+
private onDidChangeTelemetryEnabledEmitter = new Emitter<boolean>();
|
|
32
37
|
|
|
33
38
|
constructor(rpc: RPCProtocol) {
|
|
34
39
|
this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.ENV_MAIN);
|
|
35
40
|
this.envSessionId = v4();
|
|
36
41
|
this.envMachineId = v4();
|
|
42
|
+
// we don't support telemetry at the moment
|
|
43
|
+
this._isTelemetryEnabled = false;
|
|
44
|
+
this._remoteName = undefined;
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
getEnvVariable(envVarName: string): Promise<string | undefined> {
|
|
@@ -73,6 +81,10 @@ export abstract class EnvExtImpl {
|
|
|
73
81
|
this.ui = uiKind;
|
|
74
82
|
}
|
|
75
83
|
|
|
84
|
+
setAppHost(appHost: string): void {
|
|
85
|
+
this.host = appHost;
|
|
86
|
+
}
|
|
87
|
+
|
|
76
88
|
getClientOperatingSystem(): Promise<theia.OperatingSystem> {
|
|
77
89
|
return this.proxy.$getClientOperatingSystem();
|
|
78
90
|
}
|
|
@@ -83,6 +95,24 @@ export abstract class EnvExtImpl {
|
|
|
83
95
|
|
|
84
96
|
abstract get appRoot(): string;
|
|
85
97
|
|
|
98
|
+
abstract get isNewAppInstall(): boolean;
|
|
99
|
+
|
|
100
|
+
get appHost(): string {
|
|
101
|
+
return this.host;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
get isTelemetryEnabled(): boolean {
|
|
105
|
+
return this._isTelemetryEnabled;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
get onDidChangeTelemetryEnabled(): Event<boolean> {
|
|
109
|
+
return this.onDidChangeTelemetryEnabledEmitter.event;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
get remoteName(): string | undefined {
|
|
113
|
+
return this._remoteName;
|
|
114
|
+
}
|
|
115
|
+
|
|
86
116
|
get language(): string {
|
|
87
117
|
return this.lang;
|
|
88
118
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2022 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 WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { URI } from '@theia/core/shared/vscode-uri';
|
|
18
|
+
import * as theia from '@theia/plugin';
|
|
19
|
+
import { Position } from '../../common/plugin-api-rpc';
|
|
20
|
+
import { EvaluatableExpression } from '../../common/plugin-api-rpc-model';
|
|
21
|
+
import { DocumentsExtImpl } from '../documents';
|
|
22
|
+
import * as Converter from '../type-converters';
|
|
23
|
+
|
|
24
|
+
export class EvaluatableExpressionAdapter {
|
|
25
|
+
|
|
26
|
+
constructor(
|
|
27
|
+
private readonly provider: theia.EvaluatableExpressionProvider,
|
|
28
|
+
private readonly documents: DocumentsExtImpl
|
|
29
|
+
) { }
|
|
30
|
+
|
|
31
|
+
async provideEvaluatableExpression(resource: URI, position: Position, token: theia.CancellationToken): Promise<EvaluatableExpression | undefined> {
|
|
32
|
+
const documentData = this.documents.getDocumentData(resource);
|
|
33
|
+
if (!documentData) {
|
|
34
|
+
return Promise.reject(new Error(`There is no document data for ${resource}`));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const document = documentData.document;
|
|
38
|
+
const pos = Converter.toPosition(position);
|
|
39
|
+
|
|
40
|
+
return Promise.resolve(this.provider.provideEvaluatableExpression(document, pos, token)).then(expression => {
|
|
41
|
+
if (!expression) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
return Converter.fromEvaluatableExpression(expression);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -52,6 +52,7 @@ export class SignatureHelpAdapter {
|
|
|
52
52
|
if (!value) {
|
|
53
53
|
return undefined;
|
|
54
54
|
}
|
|
55
|
+
value.activeParameter = value.signatures[value.activeSignature].activeParameter ?? value.activeParameter;
|
|
55
56
|
const id = this.idSequence++;
|
|
56
57
|
this.cache.set(id, value);
|
|
57
58
|
return Converter.SignatureHelp.from(id, value);
|
|
@@ -65,7 +66,8 @@ export class SignatureHelpAdapter {
|
|
|
65
66
|
if (saved) {
|
|
66
67
|
activeSignatureHelp = saved;
|
|
67
68
|
activeSignatureHelp.activeSignature = revivedSignatureHelp.activeSignature;
|
|
68
|
-
|
|
69
|
+
const { activeSignature } = revivedSignatureHelp;
|
|
70
|
+
activeSignatureHelp.activeParameter = revivedSignatureHelp.signatures[activeSignature].activeParameter ?? revivedSignatureHelp.activeParameter;
|
|
69
71
|
} else {
|
|
70
72
|
activeSignatureHelp = revivedSignatureHelp;
|
|
71
73
|
}
|
package/src/plugin/languages.ts
CHANGED
|
@@ -62,11 +62,13 @@ import {
|
|
|
62
62
|
CallHierarchyIncomingCall,
|
|
63
63
|
CallHierarchyOutgoingCall,
|
|
64
64
|
LinkedEditingRanges,
|
|
65
|
+
EvaluatableExpression
|
|
65
66
|
} from '../common/plugin-api-rpc-model';
|
|
66
67
|
import { CompletionAdapter } from './languages/completion';
|
|
67
68
|
import { Diagnostics } from './languages/diagnostics';
|
|
68
69
|
import { SignatureHelpAdapter } from './languages/signature';
|
|
69
70
|
import { HoverAdapter } from './languages/hover';
|
|
71
|
+
import { EvaluatableExpressionAdapter } from './languages/evaluatable-expression';
|
|
70
72
|
import { DocumentHighlightAdapter } from './languages/document-highlight';
|
|
71
73
|
import { DocumentFormattingAdapter } from './languages/document-formatting';
|
|
72
74
|
import { RangeFormattingAdapter } from './languages/range-formatting';
|
|
@@ -100,6 +102,7 @@ import { serializeEnterRules, serializeIndentation, serializeRegExp } from './la
|
|
|
100
102
|
type Adapter = CompletionAdapter |
|
|
101
103
|
SignatureHelpAdapter |
|
|
102
104
|
HoverAdapter |
|
|
105
|
+
EvaluatableExpressionAdapter |
|
|
103
106
|
DocumentHighlightAdapter |
|
|
104
107
|
DocumentFormattingAdapter |
|
|
105
108
|
RangeFormattingAdapter |
|
|
@@ -350,6 +353,18 @@ export class LanguagesExtImpl implements LanguagesExt {
|
|
|
350
353
|
}
|
|
351
354
|
// ### Hover Provider end
|
|
352
355
|
|
|
356
|
+
// ### EvaluatableExpression Provider begin
|
|
357
|
+
registerEvaluatableExpressionProvider(selector: theia.DocumentSelector, provider: theia.EvaluatableExpressionProvider, pluginInfo: PluginInfo): theia.Disposable {
|
|
358
|
+
const callId = this.addNewAdapter(new EvaluatableExpressionAdapter(provider, this.documents));
|
|
359
|
+
this.proxy.$registerEvaluatableExpressionProvider(callId, pluginInfo, this.transformDocumentSelector(selector));
|
|
360
|
+
return this.createDisposable(callId);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
$provideEvaluatableExpression(handle: number, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise<EvaluatableExpression | undefined> {
|
|
364
|
+
return this.withAdapter(handle, EvaluatableExpressionAdapter, adapter => adapter.provideEvaluatableExpression(URI.revive(resource), position, token), undefined);
|
|
365
|
+
}
|
|
366
|
+
// ### EvaluatableExpression Provider end
|
|
367
|
+
|
|
353
368
|
// ### Document Highlight Provider begin
|
|
354
369
|
registerDocumentHighlightProvider(selector: theia.DocumentSelector, provider: theia.DocumentHighlightProvider, pluginInfo: PluginInfo): theia.Disposable {
|
|
355
370
|
const callId = this.addNewAdapter(new DocumentHighlightAdapter(provider, this.documents));
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (C) 2022 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 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { DebugSession } from '@theia/plugin';
|
|
17
|
+
import * as chai from 'chai';
|
|
18
|
+
import { ProxyIdentifier, RPCProtocol } from '../../../common/rpc-protocol';
|
|
19
|
+
|
|
20
|
+
import { DebugExtImpl } from '../../debug/debug-ext';
|
|
21
|
+
|
|
22
|
+
const expect = chai.expect;
|
|
23
|
+
|
|
24
|
+
describe('Debug API', () => {
|
|
25
|
+
|
|
26
|
+
describe('#asDebugSourceURI', () => {
|
|
27
|
+
|
|
28
|
+
const mockRPCProtocol: RPCProtocol = {
|
|
29
|
+
getProxy<T>(_proxyId: ProxyIdentifier<T>): T {
|
|
30
|
+
return {} as T;
|
|
31
|
+
},
|
|
32
|
+
set<T, R extends T>(_id: ProxyIdentifier<T>, instance: R): R {
|
|
33
|
+
return instance;
|
|
34
|
+
},
|
|
35
|
+
dispose(): void {
|
|
36
|
+
// Nothing
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const debug = new DebugExtImpl(mockRPCProtocol);
|
|
41
|
+
|
|
42
|
+
it('should use sourceReference, path and sessionId', () => {
|
|
43
|
+
const source = {
|
|
44
|
+
sourceReference: 3,
|
|
45
|
+
path: 'test/path'
|
|
46
|
+
};
|
|
47
|
+
const session = { id: 'test-session' } as DebugSession;
|
|
48
|
+
const uri = debug.asDebugSourceUri(source, session);
|
|
49
|
+
expect(uri.toString(true)).to.be.equal('debug:test/path?ref=3&session=test-session');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should use sourceReference', () => {
|
|
53
|
+
const source = {
|
|
54
|
+
sourceReference: 5
|
|
55
|
+
};
|
|
56
|
+
const uri = debug.asDebugSourceUri(source);
|
|
57
|
+
expect(uri.toString(true)).to.be.equal('debug:?ref=5');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should use sourceReference and session', () => {
|
|
61
|
+
const source = {
|
|
62
|
+
sourceReference: 5
|
|
63
|
+
};
|
|
64
|
+
const session = { id: 'test-session' } as DebugSession;
|
|
65
|
+
const uri = debug.asDebugSourceUri(source, session);
|
|
66
|
+
expect(uri.toString(true)).to.be.equal('debug:?ref=5&session=test-session');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('should use sourceReference and path', () => {
|
|
70
|
+
const source = {
|
|
71
|
+
sourceReference: 4,
|
|
72
|
+
path: 'test/path'
|
|
73
|
+
};
|
|
74
|
+
const uri = debug.asDebugSourceUri(source);
|
|
75
|
+
expect(uri.toString(true)).to.be.equal('debug:test/path?ref=4');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should use path', () => {
|
|
79
|
+
const source = {
|
|
80
|
+
path: 'scheme:/full/path'
|
|
81
|
+
};
|
|
82
|
+
const uri = debug.asDebugSourceUri(source);
|
|
83
|
+
expect(uri.toString(true)).to.be.equal('scheme:/full/path');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should use file path', () => {
|
|
87
|
+
const source = {
|
|
88
|
+
path: '/full/path'
|
|
89
|
+
};
|
|
90
|
+
const uri = debug.asDebugSourceUri(source);
|
|
91
|
+
expect(uri.toString(true)).to.be.equal('file:///full/path');
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -19,6 +19,7 @@ import { EnvExtImpl } from '../env';
|
|
|
19
19
|
import { RPCProtocol } from '../../common/rpc-protocol';
|
|
20
20
|
import { createHash } from 'crypto';
|
|
21
21
|
import { v4 } from 'uuid';
|
|
22
|
+
import fs = require('fs');
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Provides machineId using mac address. It's only possible on node side
|
|
@@ -27,6 +28,7 @@ import { v4 } from 'uuid';
|
|
|
27
28
|
export class EnvNodeExtImpl extends EnvExtImpl {
|
|
28
29
|
|
|
29
30
|
private macMachineId: string;
|
|
31
|
+
private _isNewAppInstall: boolean;
|
|
30
32
|
|
|
31
33
|
constructor(rpc: RPCProtocol) {
|
|
32
34
|
super(rpc);
|
|
@@ -37,7 +39,7 @@ export class EnvNodeExtImpl extends EnvExtImpl {
|
|
|
37
39
|
this.macMachineId = createHash('sha256').update(macAddress, 'utf8').digest('hex');
|
|
38
40
|
}
|
|
39
41
|
});
|
|
40
|
-
|
|
42
|
+
this._isNewAppInstall = this.computeIsNewAppInstall();
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
/**
|
|
@@ -54,4 +56,14 @@ export class EnvNodeExtImpl extends EnvExtImpl {
|
|
|
54
56
|
return __dirname;
|
|
55
57
|
}
|
|
56
58
|
|
|
59
|
+
get isNewAppInstall(): boolean {
|
|
60
|
+
return this._isNewAppInstall;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private computeIsNewAppInstall(): boolean {
|
|
64
|
+
const creation = fs.statSync(__filename).birthtimeMs;
|
|
65
|
+
const current = Date.now();
|
|
66
|
+
const dayMs = 24 * 3600 * 1000;
|
|
67
|
+
return (current - creation) < dayMs;
|
|
68
|
+
}
|
|
57
69
|
}
|
|
@@ -78,6 +78,7 @@ import {
|
|
|
78
78
|
SignatureHelp,
|
|
79
79
|
SignatureHelpTriggerKind,
|
|
80
80
|
Hover,
|
|
81
|
+
EvaluatableExpression,
|
|
81
82
|
DocumentHighlightKind,
|
|
82
83
|
DocumentHighlight,
|
|
83
84
|
DocumentLink,
|
|
@@ -559,7 +560,7 @@ export function createAPIFactory(
|
|
|
559
560
|
extHostFileSystemEvent.getOnWillDeleteFileEvent(plugin)(listener, thisArg, disposables),
|
|
560
561
|
onWillRenameFiles: (listener: (e: theia.FileWillRenameEvent) => any, thisArg?: any, disposables?: theia.Disposable[]) =>
|
|
561
562
|
extHostFileSystemEvent.getOnWillRenameFileEvent(plugin)(listener, thisArg, disposables),
|
|
562
|
-
getConfiguration(section
|
|
563
|
+
getConfiguration(section, resource): theia.WorkspaceConfiguration {
|
|
563
564
|
return preferenceRegistryExt.getConfiguration(section, resource);
|
|
564
565
|
},
|
|
565
566
|
onDidChangeConfiguration(listener, thisArgs?, disposables?): theia.Disposable {
|
|
@@ -639,7 +640,14 @@ export function createAPIFactory(
|
|
|
639
640
|
const env: typeof theia.env = Object.freeze({
|
|
640
641
|
get appName(): string { return envExt.appName; },
|
|
641
642
|
get appRoot(): string { return envExt.appRoot; },
|
|
643
|
+
get appHost(): string { return envExt.appHost; },
|
|
642
644
|
get language(): string { return envExt.language; },
|
|
645
|
+
get isNewAppInstall(): boolean { return envExt.isNewAppInstall; },
|
|
646
|
+
get isTelemetryEnabled(): boolean { return envExt.isTelemetryEnabled; },
|
|
647
|
+
get onDidChangeTelemetryEnabled(): theia.Event<boolean> {
|
|
648
|
+
return envExt.onDidChangeTelemetryEnabled;
|
|
649
|
+
},
|
|
650
|
+
get remoteName(): string | undefined { return envExt.remoteName; },
|
|
643
651
|
get machineId(): string { return envExt.machineId; },
|
|
644
652
|
get sessionId(): string { return envExt.sessionId; },
|
|
645
653
|
get uriScheme(): string { return envExt.uriScheme; },
|
|
@@ -724,6 +732,9 @@ export function createAPIFactory(
|
|
|
724
732
|
registerHoverProvider(selector: theia.DocumentSelector, provider: theia.HoverProvider): theia.Disposable {
|
|
725
733
|
return languagesExt.registerHoverProvider(selector, provider, pluginToPluginInfo(plugin));
|
|
726
734
|
},
|
|
735
|
+
registerEvaluatableExpressionProvider(selector: theia.DocumentSelector, provider: theia.EvaluatableExpressionProvider): theia.Disposable {
|
|
736
|
+
return languagesExt.registerEvaluatableExpressionProvider(selector, provider, pluginToPluginInfo(plugin));
|
|
737
|
+
},
|
|
727
738
|
registerDocumentHighlightProvider(selector: theia.DocumentSelector, provider: theia.DocumentHighlightProvider): theia.Disposable {
|
|
728
739
|
return languagesExt.registerDocumentHighlightProvider(selector, provider, pluginToPluginInfo(plugin));
|
|
729
740
|
},
|
|
@@ -868,6 +879,9 @@ export function createAPIFactory(
|
|
|
868
879
|
},
|
|
869
880
|
removeBreakpoints(breakpoints: readonly theia.Breakpoint[]): void {
|
|
870
881
|
debugExt.removeBreakpoints(breakpoints);
|
|
882
|
+
},
|
|
883
|
+
asDebugSourceUri(source: theia.DebugProtocolSource, session?: theia.DebugSession): theia.Uri {
|
|
884
|
+
return debugExt.asDebugSourceUri(source, session);
|
|
871
885
|
}
|
|
872
886
|
};
|
|
873
887
|
|
|
@@ -981,6 +995,7 @@ export function createAPIFactory(
|
|
|
981
995
|
SignatureHelp,
|
|
982
996
|
SignatureHelpTriggerKind,
|
|
983
997
|
Hover,
|
|
998
|
+
EvaluatableExpression,
|
|
984
999
|
DocumentHighlightKind,
|
|
985
1000
|
DocumentHighlight,
|
|
986
1001
|
DocumentLink,
|
|
@@ -201,6 +201,7 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
|
|
|
201
201
|
this.envExt.setShell(params.env.shell);
|
|
202
202
|
this.envExt.setUIKind(params.env.uiKind);
|
|
203
203
|
this.envExt.setApplicationName(params.env.appName);
|
|
204
|
+
this.envExt.setAppHost(params.env.appHost);
|
|
204
205
|
|
|
205
206
|
this.preferencesManager.init(params.preferences);
|
|
206
207
|
|
|
@@ -38,6 +38,10 @@ export class Memento implements theia.Memento {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
keys(): string[] {
|
|
42
|
+
return Object.entries(this.cache).filter(([, value]) => value !== undefined).map(([key]) => key);
|
|
43
|
+
}
|
|
44
|
+
|
|
41
45
|
get<T>(key: string): T | undefined;
|
|
42
46
|
get<T>(key: string, defaultValue: T): T;
|
|
43
47
|
get<T>(key: string, defaultValue?: T): T | undefined {
|