@theia/plugin-ext 1.31.0-next.3 → 1.31.0-next.33
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/cache.d.ts +12 -0
- package/lib/common/cache.d.ts.map +1 -0
- package/lib/common/cache.js +48 -0
- package/lib/common/cache.js.map +1 -0
- package/lib/common/plugin-api-rpc-model.d.ts +67 -2
- package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc-model.js +12 -1
- package/lib/common/plugin-api-rpc-model.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +34 -2
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/hosted/browser/hosted-plugin.d.ts +15 -12
- package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/main/browser/{callhierarchy/callhierarchy-type-converters.d.ts → hierarchy/hierarchy-types-converters.d.ts} +14 -14
- package/lib/main/browser/hierarchy/hierarchy-types-converters.d.ts.map +1 -0
- package/lib/main/browser/hierarchy/hierarchy-types-converters.js +175 -0
- package/lib/main/browser/hierarchy/hierarchy-types-converters.js.map +1 -0
- package/lib/main/browser/languages-main.d.ts +12 -1
- package/lib/main/browser/languages-main.d.ts.map +1 -1
- package/lib/main/browser/languages-main.js +144 -9
- package/lib/main/browser/languages-main.js.map +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.js +16 -18
- package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
- package/lib/main/browser/menus/plugin-menu-command-adapter.js +1 -1
- 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 +16 -16
- package/lib/main/browser/menus/vscode-theia-menu-mappings.js.map +1 -1
- package/lib/main/browser/terminal-main.d.ts +7 -1
- package/lib/main/browser/terminal-main.d.ts.map +1 -1
- package/lib/main/browser/terminal-main.js +23 -1
- package/lib/main/browser/terminal-main.js.map +1 -1
- package/lib/main/browser/view/tree-view-widget.d.ts +43 -3
- package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/tree-view-widget.js +184 -31
- package/lib/main/browser/view/tree-view-widget.js.map +1 -1
- package/lib/plugin/custom-editors.d.ts.map +1 -1
- package/lib/plugin/custom-editors.js +2 -29
- package/lib/plugin/custom-editors.js.map +1 -1
- package/lib/plugin/known-commands.d.ts.map +1 -1
- package/lib/plugin/known-commands.js +9 -0
- package/lib/plugin/known-commands.js.map +1 -1
- package/lib/plugin/languages/call-hierarchy.js +1 -1
- package/lib/plugin/languages/call-hierarchy.js.map +1 -1
- package/lib/plugin/languages/inlay-hints.d.ts +20 -0
- package/lib/plugin/languages/inlay-hints.d.ts.map +1 -0
- package/lib/plugin/languages/inlay-hints.js +128 -0
- package/lib/plugin/languages/inlay-hints.js.map +1 -0
- package/lib/plugin/languages/inline-values.d.ts +11 -0
- package/lib/plugin/languages/inline-values.d.ts.map +1 -0
- package/lib/plugin/languages/inline-values.js +45 -0
- package/lib/plugin/languages/inline-values.js.map +1 -0
- package/lib/plugin/languages/type-hierarchy.d.ts +19 -0
- package/lib/plugin/languages/type-hierarchy.d.ts.map +1 -0
- package/lib/plugin/languages/type-hierarchy.js +96 -0
- package/lib/plugin/languages/type-hierarchy.js.map +1 -0
- package/lib/plugin/languages.d.ts +13 -2
- package/lib/plugin/languages.d.ts.map +1 -1
- package/lib/plugin/languages.js +60 -0
- package/lib/plugin/languages.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +36 -8
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/terminal-ext.d.ts +11 -1
- package/lib/plugin/terminal-ext.d.ts.map +1 -1
- package/lib/plugin/terminal-ext.js +44 -0
- package/lib/plugin/terminal-ext.js.map +1 -1
- package/lib/plugin/tree/tree-views.d.ts +5 -1
- package/lib/plugin/tree/tree-views.d.ts.map +1 -1
- package/lib/plugin/tree/tree-views.js +28 -1
- package/lib/plugin/tree/tree-views.js.map +1 -1
- package/lib/plugin/type-converters.d.ts +11 -1
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +77 -5
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +73 -2
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +169 -6
- package/lib/plugin/types-impl.js.map +1 -1
- package/lib/plugin/types-impl.spec.js +14 -0
- package/lib/plugin/types-impl.spec.js.map +1 -1
- package/lib/plugin/workspace.js +1 -1
- package/lib/plugin/workspace.js.map +1 -1
- package/package.json +26 -25
- package/src/common/cache.ts +51 -0
- package/src/common/plugin-api-rpc-model.ts +75 -2
- package/src/common/plugin-api-rpc.ts +42 -2
- package/src/hosted/browser/hosted-plugin.ts +9 -9
- package/src/main/browser/hierarchy/hierarchy-types-converters.ts +189 -0
- package/src/main/browser/languages-main.ts +201 -25
- package/src/main/browser/menus/menus-contribution-handler.ts +19 -21
- package/src/main/browser/menus/plugin-menu-command-adapter.ts +1 -1
- package/src/main/browser/menus/vscode-theia-menu-mappings.ts +17 -17
- package/src/main/browser/terminal-main.ts +29 -2
- package/src/main/browser/view/tree-view-widget.tsx +220 -30
- package/src/plugin/custom-editors.ts +1 -33
- package/src/plugin/known-commands.ts +12 -1
- package/src/plugin/languages/call-hierarchy.ts +2 -2
- package/src/plugin/languages/inlay-hints.ts +149 -0
- package/src/plugin/languages/inline-values.ts +50 -0
- package/src/plugin/languages/type-hierarchy.ts +117 -0
- package/src/plugin/languages.ts +108 -2
- package/src/plugin/plugin-context.ts +44 -10
- package/src/plugin/terminal-ext.ts +54 -2
- package/src/plugin/tree/tree-views.ts +40 -2
- package/src/plugin/type-converters.ts +82 -7
- package/src/plugin/types-impl.spec.ts +16 -0
- package/src/plugin/types-impl.ts +189 -4
- package/src/plugin/workspace.ts +1 -1
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.d.ts.map +0 -1
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js +0 -178
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js.map +0 -1
- package/src/main/browser/callhierarchy/callhierarchy-type-converters.ts +0 -193
|
@@ -14,14 +14,15 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
import { UUID } from '@theia/core/shared/@phosphor/coreutils';
|
|
17
|
-
import { Terminal, TerminalOptions, PseudoTerminalOptions, ExtensionTerminalOptions } from '@theia/plugin';
|
|
17
|
+
import { Terminal, TerminalOptions, PseudoTerminalOptions, ExtensionTerminalOptions, TerminalState } from '@theia/plugin';
|
|
18
18
|
import { TerminalServiceExt, TerminalServiceMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc';
|
|
19
19
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
20
20
|
import { Event, Emitter } from '@theia/core/lib/common/event';
|
|
21
21
|
import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
22
22
|
import * as theia from '@theia/plugin';
|
|
23
|
-
import { EnvironmentVariableMutatorType } from './types-impl';
|
|
23
|
+
import { Disposable, EnvironmentVariableMutatorType } from './types-impl';
|
|
24
24
|
import { SerializableEnvironmentVariableCollection } from '@theia/terminal/lib/common/base-terminal-protocol';
|
|
25
|
+
import { ProvidedTerminalLink } from '../common/plugin-api-rpc-model';
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Provides high level terminal plugin api to use in the Theia plugins.
|
|
@@ -35,6 +36,9 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {
|
|
|
35
36
|
|
|
36
37
|
private readonly _pseudoTerminals = new Map<string, PseudoTerminal>();
|
|
37
38
|
|
|
39
|
+
private static nextTerminalLinkProviderId = 0;
|
|
40
|
+
private readonly terminalLinkProviders = new Map<string, theia.TerminalLinkProvider>();
|
|
41
|
+
|
|
38
42
|
private readonly onDidCloseTerminalEmitter = new Emitter<Terminal>();
|
|
39
43
|
readonly onDidCloseTerminal: theia.Event<Terminal> = this.onDidCloseTerminalEmitter.event;
|
|
40
44
|
|
|
@@ -44,6 +48,9 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {
|
|
|
44
48
|
private readonly onDidChangeActiveTerminalEmitter = new Emitter<Terminal | undefined>();
|
|
45
49
|
readonly onDidChangeActiveTerminal: theia.Event<Terminal | undefined> = this.onDidChangeActiveTerminalEmitter.event;
|
|
46
50
|
|
|
51
|
+
private readonly onDidChangeTerminalStateEmitter = new Emitter<Terminal>();
|
|
52
|
+
readonly onDidChangeTerminalState: theia.Event<Terminal> = this.onDidChangeTerminalStateEmitter.event;
|
|
53
|
+
|
|
47
54
|
protected environmentVariableCollections: Map<string, EnvironmentVariableCollection> = new Map();
|
|
48
55
|
|
|
49
56
|
constructor(rpc: RPCProtocol) {
|
|
@@ -107,6 +114,17 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {
|
|
|
107
114
|
terminal.emitOnInput(data);
|
|
108
115
|
}
|
|
109
116
|
|
|
117
|
+
$terminalStateChanged(id: string): void {
|
|
118
|
+
const terminal = this._terminals.get(id);
|
|
119
|
+
if (!terminal) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (!terminal.state.isInteractedWith) {
|
|
123
|
+
terminal.state = { isInteractedWith: true };
|
|
124
|
+
this.onDidChangeTerminalStateEmitter.fire(terminal);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
110
128
|
$terminalSizeChanged(id: string, clos: number, rows: number): void {
|
|
111
129
|
const terminal = this._pseudoTerminals.get(id);
|
|
112
130
|
if (!terminal) {
|
|
@@ -167,6 +185,38 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {
|
|
|
167
185
|
this.onDidChangeActiveTerminalEmitter.fire(this.activeTerminal);
|
|
168
186
|
}
|
|
169
187
|
|
|
188
|
+
registerTerminalLinkProvider(provider: theia.TerminalLinkProvider): theia.Disposable {
|
|
189
|
+
const providerId = (TerminalServiceExtImpl.nextTerminalLinkProviderId++).toString();
|
|
190
|
+
this.terminalLinkProviders.set(providerId, provider);
|
|
191
|
+
this.proxy.$registerTerminalLinkProvider(providerId);
|
|
192
|
+
return Disposable.create(() => {
|
|
193
|
+
this.proxy.$unregisterTerminalLinkProvider(providerId);
|
|
194
|
+
this.terminalLinkProviders.delete(providerId);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
async $provideTerminalLinks(line: string, terminalId: string, token: theia.CancellationToken): Promise<ProvidedTerminalLink[]> {
|
|
199
|
+
const links: ProvidedTerminalLink[] = [];
|
|
200
|
+
const terminal = this._terminals.get(terminalId);
|
|
201
|
+
if (terminal) {
|
|
202
|
+
for (const [providerId, provider] of this.terminalLinkProviders) {
|
|
203
|
+
const providedLinks = await provider.provideTerminalLinks({ line, terminal }, token);
|
|
204
|
+
if (providedLinks) {
|
|
205
|
+
links.push(...providedLinks.map(link => ({ ...link, providerId })));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return links;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
async $handleTerminalLink(link: ProvidedTerminalLink): Promise<void> {
|
|
213
|
+
const provider = this.terminalLinkProviders.get(link.providerId);
|
|
214
|
+
if (!provider) {
|
|
215
|
+
throw Error('Terminal link provider not found');
|
|
216
|
+
}
|
|
217
|
+
await provider.handleTerminalLink(link);
|
|
218
|
+
}
|
|
219
|
+
|
|
170
220
|
/*---------------------------------------------------------------------------------------------
|
|
171
221
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
172
222
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
@@ -287,6 +337,8 @@ export class TerminalExtImpl implements Terminal {
|
|
|
287
337
|
|
|
288
338
|
readonly creationOptions: Readonly<TerminalOptions | ExtensionTerminalOptions>;
|
|
289
339
|
|
|
340
|
+
state: TerminalState = { isInteractedWith: false };
|
|
341
|
+
|
|
290
342
|
constructor(private readonly proxy: TerminalServiceMain, private readonly options: theia.TerminalOptions | theia.ExtensionTerminalOptions) {
|
|
291
343
|
this.creationOptions = this.options;
|
|
292
344
|
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import {
|
|
20
20
|
TreeDataProvider, TreeView, TreeViewExpansionEvent, TreeItem, TreeItemLabel,
|
|
21
|
-
TreeViewSelectionChangeEvent, TreeViewVisibilityChangeEvent
|
|
21
|
+
TreeViewSelectionChangeEvent, TreeViewVisibilityChangeEvent, CancellationToken
|
|
22
22
|
} from '@theia/plugin';
|
|
23
23
|
// TODO: extract `@theia/util` for event, disposable, cancellation and common types
|
|
24
24
|
// don't use @theia/core directly from plugin host
|
|
@@ -122,6 +122,14 @@ export class TreeViewsExtImpl implements TreeViewsExt {
|
|
|
122
122
|
return treeView.getChildren(treeItemId);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
async $resolveTreeItem(treeViewId: string, treeItemId: string, token: CancellationToken): Promise<TreeViewItem | undefined> {
|
|
126
|
+
return this.getTreeView(treeViewId).resolveTreeItem(treeItemId, token);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async $hasResolveTreeItem(treeViewId: string): Promise<boolean> {
|
|
130
|
+
return this.getTreeView(treeViewId).hasResolveTreeItem();
|
|
131
|
+
}
|
|
132
|
+
|
|
125
133
|
async $setExpanded(treeViewId: string, treeItemId: string, expanded: boolean): Promise<any> {
|
|
126
134
|
const treeView = this.getTreeView(treeViewId);
|
|
127
135
|
|
|
@@ -152,6 +160,12 @@ export class TreeViewsExtImpl implements TreeViewsExt {
|
|
|
152
160
|
|
|
153
161
|
interface TreeExtNode<T> extends Disposable {
|
|
154
162
|
id: string
|
|
163
|
+
/** Collection of disposables. Must be disposed by an instance's `dispose` implementation. */
|
|
164
|
+
disposables: DisposableCollection;
|
|
165
|
+
/** The original `TreeItem` provided by the plugin's tree data provider. */
|
|
166
|
+
pluginTreeItem?: TreeItem;
|
|
167
|
+
/** The `TreeViewItem` used on the main side to render the tree node. */
|
|
168
|
+
treeViewItem?: TreeViewItem;
|
|
155
169
|
value?: T
|
|
156
170
|
children?: TreeExtNode<T>[]
|
|
157
171
|
}
|
|
@@ -333,7 +347,8 @@ class TreeViewExtImpl<T> implements Disposable {
|
|
|
333
347
|
|
|
334
348
|
// place root in the cache
|
|
335
349
|
if (parentId === '') {
|
|
336
|
-
|
|
350
|
+
const rootNodeDisposables = new DisposableCollection();
|
|
351
|
+
this.nodes.set(parentId, { id: '', disposables: rootNodeDisposables, dispose: () => { rootNodeDisposables.dispose(); } });
|
|
337
352
|
}
|
|
338
353
|
// ask data provider for children for cached element
|
|
339
354
|
const result = await this.treeDataProvider.getChildren(parent);
|
|
@@ -356,7 +371,9 @@ class TreeViewExtImpl<T> implements Disposable {
|
|
|
356
371
|
const toDisposeElement = new DisposableCollection();
|
|
357
372
|
const node: TreeExtNode<T> = {
|
|
358
373
|
id,
|
|
374
|
+
pluginTreeItem: treeItem,
|
|
359
375
|
value,
|
|
376
|
+
disposables: toDisposeElement,
|
|
360
377
|
dispose: () => toDisposeElement.dispose()
|
|
361
378
|
};
|
|
362
379
|
if (parentNode) {
|
|
@@ -393,6 +410,7 @@ class TreeViewExtImpl<T> implements Disposable {
|
|
|
393
410
|
command: this.commandsConverter.toSafeCommand(treeItem.command, toDisposeElement),
|
|
394
411
|
accessibilityInformation: treeItem.accessibilityInformation
|
|
395
412
|
} as TreeViewItem;
|
|
413
|
+
node.treeViewItem = treeViewItem;
|
|
396
414
|
|
|
397
415
|
return treeViewItem;
|
|
398
416
|
});
|
|
@@ -455,6 +473,26 @@ class TreeViewExtImpl<T> implements Disposable {
|
|
|
455
473
|
}
|
|
456
474
|
}
|
|
457
475
|
|
|
476
|
+
async resolveTreeItem(treeItemId: string, token: CancellationToken): Promise<TreeViewItem | undefined> {
|
|
477
|
+
if (!this.treeDataProvider.resolveTreeItem) {
|
|
478
|
+
return undefined;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
const node = this.nodes.get(treeItemId);
|
|
482
|
+
if (node && node.treeViewItem && node.pluginTreeItem && node.value) {
|
|
483
|
+
const resolved = await this.treeDataProvider.resolveTreeItem(node.pluginTreeItem, node.value, token) ?? node.pluginTreeItem;
|
|
484
|
+
node.treeViewItem.command = this.commandsConverter.toSafeCommand(resolved.command, node.disposables);
|
|
485
|
+
node.treeViewItem.tooltip = resolved.tooltip;
|
|
486
|
+
return node.treeViewItem;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return undefined;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
hasResolveTreeItem(): boolean {
|
|
493
|
+
return !!this.treeDataProvider.resolveTreeItem;
|
|
494
|
+
}
|
|
495
|
+
|
|
458
496
|
private selectedItemIds = new Set<string>();
|
|
459
497
|
get selectedElements(): T[] {
|
|
460
498
|
const items: T[] = [];
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import * as theia from '@theia/plugin';
|
|
18
18
|
import * as lstypes from '@theia/core/shared/vscode-languageserver-protocol';
|
|
19
|
-
import { QuickPickItemKind, URI } from './types-impl';
|
|
19
|
+
import { InlineValueEvaluatableExpression, InlineValueText, InlineValueVariableLookup, QuickPickItemKind, URI } from './types-impl';
|
|
20
20
|
import * as rpc from '../common/plugin-api-rpc';
|
|
21
21
|
import {
|
|
22
22
|
DecorationOptions, EditorPosition, Plugin, Position, WorkspaceTextEditDto, WorkspaceFileEditDto, Selection, TaskDto, WorkspaceEditDto
|
|
@@ -129,7 +129,7 @@ export function fromRange(range: theia.Range | undefined): model.Range | undefin
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
export function fromPosition(position: types.Position): Position {
|
|
132
|
+
export function fromPosition(position: types.Position | theia.Position): Position {
|
|
133
133
|
return { lineNumber: position.line + 1, column: position.character + 1 };
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -233,7 +233,7 @@ export function fromGlobPattern(pattern: theia.GlobPattern): string | RelativePa
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
if (isRelativePattern(pattern)) {
|
|
236
|
-
return new types.RelativePattern(pattern.
|
|
236
|
+
return new types.RelativePattern(pattern.baseUri, pattern.pattern);
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
return pattern;
|
|
@@ -241,7 +241,7 @@ export function fromGlobPattern(pattern: theia.GlobPattern): string | RelativePa
|
|
|
241
241
|
|
|
242
242
|
function isRelativePattern(obj: {}): obj is theia.RelativePattern {
|
|
243
243
|
const rp = obj as theia.RelativePattern;
|
|
244
|
-
return rp && typeof rp.
|
|
244
|
+
return rp && typeof rp.baseUri === 'string' && typeof rp.pattern === 'string';
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
export function fromCompletionItemKind(kind?: types.CompletionItemKind): model.CompletionItemKind {
|
|
@@ -401,6 +401,39 @@ export function fromEvaluatableExpression(evaluatableExpression: theia.Evaluatab
|
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
403
|
|
|
404
|
+
export function fromInlineValue(inlineValue: theia.InlineValue): model.InlineValue {
|
|
405
|
+
if (inlineValue instanceof InlineValueText) {
|
|
406
|
+
return <model.InlineValueText>{
|
|
407
|
+
type: 'text',
|
|
408
|
+
range: fromRange(inlineValue.range),
|
|
409
|
+
text: inlineValue.text
|
|
410
|
+
};
|
|
411
|
+
} else if (inlineValue instanceof InlineValueVariableLookup) {
|
|
412
|
+
return <model.InlineValueVariableLookup>{
|
|
413
|
+
type: 'variable',
|
|
414
|
+
range: fromRange(inlineValue.range),
|
|
415
|
+
variableName: inlineValue.variableName,
|
|
416
|
+
caseSensitiveLookup: inlineValue.caseSensitiveLookup
|
|
417
|
+
};
|
|
418
|
+
} else if (inlineValue instanceof InlineValueEvaluatableExpression) {
|
|
419
|
+
return <model.InlineValueEvaluatableExpression>{
|
|
420
|
+
type: 'expression',
|
|
421
|
+
range: fromRange(inlineValue.range),
|
|
422
|
+
expression: inlineValue.expression
|
|
423
|
+
};
|
|
424
|
+
} else {
|
|
425
|
+
throw new Error('Unknown InlineValue type');
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
export function toInlineValueContext(inlineValueContext: model.InlineValueContext): theia.InlineValueContext {
|
|
430
|
+
const ivLocation = inlineValueContext.stoppedLocation;
|
|
431
|
+
return <theia.InlineValueContext>{
|
|
432
|
+
frameId: inlineValueContext.frameId,
|
|
433
|
+
stoppedLocation: new types.Range(ivLocation.startLineNumber, ivLocation.startColumn, ivLocation.endLineNumber, ivLocation.endColumn)
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
|
|
404
437
|
export function fromLocation(location: theia.Location): model.Location {
|
|
405
438
|
return <model.Location>{
|
|
406
439
|
uri: location.uri,
|
|
@@ -584,7 +617,7 @@ export namespace SymbolKind {
|
|
|
584
617
|
}
|
|
585
618
|
}
|
|
586
619
|
|
|
587
|
-
export function toCodeActionTriggerKind(triggerKind: model.CodeActionTriggerKind): types.CodeActionTriggerKind
|
|
620
|
+
export function toCodeActionTriggerKind(triggerKind: model.CodeActionTriggerKind): types.CodeActionTriggerKind {
|
|
588
621
|
switch (triggerKind) {
|
|
589
622
|
case model.CodeActionTriggerKind.Invoke:
|
|
590
623
|
return types.CodeActionTriggerKind.Invoke;
|
|
@@ -691,8 +724,8 @@ export function toLocation(value: model.Location): types.Location {
|
|
|
691
724
|
return new types.Location(URI.revive(value.uri), toRange(value.range));
|
|
692
725
|
}
|
|
693
726
|
|
|
694
|
-
export function
|
|
695
|
-
return
|
|
727
|
+
export function fromHierarchyItem(item: types.CallHierarchyItem | types.TypeHierarchyItem): model.HierarchyItem {
|
|
728
|
+
return {
|
|
696
729
|
kind: SymbolKind.fromSymbolKind(item.kind),
|
|
697
730
|
name: item.name,
|
|
698
731
|
detail: item.detail,
|
|
@@ -705,6 +738,10 @@ export function fromCallHierarchyItem(item: types.CallHierarchyItem): model.Call
|
|
|
705
738
|
};
|
|
706
739
|
}
|
|
707
740
|
|
|
741
|
+
export function fromCallHierarchyItem(item: types.CallHierarchyItem): model.CallHierarchyItem {
|
|
742
|
+
return <model.CallHierarchyItem>fromHierarchyItem(item);
|
|
743
|
+
}
|
|
744
|
+
|
|
708
745
|
export function toCallHierarchyItem(value: model.CallHierarchyItem): types.CallHierarchyItem {
|
|
709
746
|
const item = new types.CallHierarchyItem(
|
|
710
747
|
SymbolKind.toSymbolKind(value.kind),
|
|
@@ -733,6 +770,35 @@ export function toCallHierarchyOutgoingCall(value: model.CallHierarchyOutgoingCa
|
|
|
733
770
|
value.fromRanges && value.fromRanges.map(toRange));
|
|
734
771
|
}
|
|
735
772
|
|
|
773
|
+
export function isModelTypeHierarchyItem(arg: unknown): arg is model.TypeHierarchyItem {
|
|
774
|
+
const item = arg as model.TypeHierarchyItem;
|
|
775
|
+
return !!item && typeof item === 'object'
|
|
776
|
+
&& isModelRange(item.range)
|
|
777
|
+
&& isModelRange(item.selectionRange)
|
|
778
|
+
&& isUriComponents(item.uri)
|
|
779
|
+
&& !!item.name;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
export function fromTypeHierarchyItem(item: types.TypeHierarchyItem): model.TypeHierarchyItem {
|
|
783
|
+
return <model.TypeHierarchyItem>fromHierarchyItem(item);
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
export function toTypeHierarchyItem(value: model.TypeHierarchyItem): types.TypeHierarchyItem {
|
|
787
|
+
const item = new types.TypeHierarchyItem(
|
|
788
|
+
SymbolKind.toSymbolKind(value.kind),
|
|
789
|
+
value.name,
|
|
790
|
+
value.detail ? value.detail : '',
|
|
791
|
+
URI.revive(value.uri),
|
|
792
|
+
toRange(value.selectionRange),
|
|
793
|
+
toRange(value.range),
|
|
794
|
+
);
|
|
795
|
+
item.tags = value.tags;
|
|
796
|
+
item._itemId = value._itemId;
|
|
797
|
+
item._sessionId = value._sessionId;
|
|
798
|
+
|
|
799
|
+
return item;
|
|
800
|
+
}
|
|
801
|
+
|
|
736
802
|
export function toWorkspaceFolder(folder: model.WorkspaceFolder): theia.WorkspaceFolder {
|
|
737
803
|
return {
|
|
738
804
|
uri: URI.revive(folder.uri),
|
|
@@ -1237,3 +1303,12 @@ export function pluginToPluginInfo(plugin: Plugin): rpc.PluginInfo {
|
|
|
1237
1303
|
displayName: plugin.model.displayName
|
|
1238
1304
|
};
|
|
1239
1305
|
}
|
|
1306
|
+
|
|
1307
|
+
export namespace InlayHintKind {
|
|
1308
|
+
export function from(kind: theia.InlayHintKind): model.InlayHintKind {
|
|
1309
|
+
return kind;
|
|
1310
|
+
}
|
|
1311
|
+
export function to(kind: model.InlayHintKind): theia.InlayHintKind {
|
|
1312
|
+
return kind;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
@@ -66,4 +66,20 @@ describe('API Type Implementations:', () => {
|
|
|
66
66
|
'myScheme://authority/path/file.js?query#fragment');
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
|
+
|
|
70
|
+
describe('RelativePattern:', () => {
|
|
71
|
+
it('should update .base when setting .baseUri', () => {
|
|
72
|
+
const testUri = types.URI.file('/expected/file/path');
|
|
73
|
+
const rPattern = new types.RelativePattern('/initial/unrelated/path', 'not relevant');
|
|
74
|
+
rPattern.baseUri = testUri;
|
|
75
|
+
assert.strictEqual(rPattern.base, testUri.fsPath);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should update .baseUri when setting .base', () => {
|
|
79
|
+
const testUri = types.URI.file('/expected/file/path');
|
|
80
|
+
const rPattern = new types.RelativePattern('/initial/unrelated/path', 'not relevant');
|
|
81
|
+
rPattern.base = testUri.fsPath;
|
|
82
|
+
assert.strictEqual(rPattern.baseUri.toString(), testUri.toString());
|
|
83
|
+
});
|
|
84
|
+
});
|
|
69
85
|
});
|
package/src/plugin/types-impl.ts
CHANGED
|
@@ -790,11 +790,27 @@ export enum ConfigurationTarget {
|
|
|
790
790
|
@es5ClassCompat
|
|
791
791
|
export class RelativePattern {
|
|
792
792
|
|
|
793
|
-
|
|
793
|
+
private _base!: string;
|
|
794
|
+
get base(): string {
|
|
795
|
+
return this._base;
|
|
796
|
+
}
|
|
797
|
+
set base(base: string) {
|
|
798
|
+
this._base = base;
|
|
799
|
+
this._baseUri = URI.file(base);
|
|
800
|
+
}
|
|
794
801
|
|
|
795
|
-
|
|
802
|
+
private _baseUri!: URI;
|
|
803
|
+
get baseUri(): URI {
|
|
804
|
+
return this._baseUri;
|
|
805
|
+
}
|
|
806
|
+
set baseUri(baseUri: URI) {
|
|
807
|
+
this._baseUri = baseUri;
|
|
808
|
+
this.base = baseUri.fsPath;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
constructor(base: theia.WorkspaceFolder | URI | string, public pattern: string) {
|
|
796
812
|
if (typeof base !== 'string') {
|
|
797
|
-
if (!base || !URI.isUri(base.uri)) {
|
|
813
|
+
if (!base || !URI.isUri(base) && !URI.isUri(base.uri)) {
|
|
798
814
|
throw illegalArgument('base');
|
|
799
815
|
}
|
|
800
816
|
}
|
|
@@ -803,7 +819,13 @@ export class RelativePattern {
|
|
|
803
819
|
throw illegalArgument('pattern');
|
|
804
820
|
}
|
|
805
821
|
|
|
806
|
-
|
|
822
|
+
if (typeof base === 'string') {
|
|
823
|
+
this.baseUri = URI.file(base);
|
|
824
|
+
} else if (URI.isUri(base)) {
|
|
825
|
+
this.baseUri = base;
|
|
826
|
+
} else {
|
|
827
|
+
this.baseUri = base.uri;
|
|
828
|
+
}
|
|
807
829
|
}
|
|
808
830
|
|
|
809
831
|
pathToRelative(from: string, to: string): string {
|
|
@@ -1134,6 +1156,75 @@ export class EvaluatableExpression {
|
|
|
1134
1156
|
}
|
|
1135
1157
|
}
|
|
1136
1158
|
|
|
1159
|
+
@es5ClassCompat
|
|
1160
|
+
export class InlineValueContext implements theia.InlineValueContext {
|
|
1161
|
+
public frameId: number;
|
|
1162
|
+
public stoppedLocation: Range;
|
|
1163
|
+
|
|
1164
|
+
constructor(frameId: number, stoppedLocation: Range) {
|
|
1165
|
+
if (!frameId) {
|
|
1166
|
+
illegalArgument('frameId must be defined');
|
|
1167
|
+
}
|
|
1168
|
+
if (!stoppedLocation) {
|
|
1169
|
+
illegalArgument('stoppedLocation must be defined');
|
|
1170
|
+
}
|
|
1171
|
+
this.frameId = frameId;
|
|
1172
|
+
this.stoppedLocation = stoppedLocation;
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
@es5ClassCompat
|
|
1177
|
+
export class InlineValueText implements theia.InlineValueText {
|
|
1178
|
+
public type = 'text';
|
|
1179
|
+
public range: Range;
|
|
1180
|
+
public text: string;
|
|
1181
|
+
|
|
1182
|
+
constructor(range: Range, text: string) {
|
|
1183
|
+
if (!range) {
|
|
1184
|
+
illegalArgument('range must be defined');
|
|
1185
|
+
}
|
|
1186
|
+
if (!text) {
|
|
1187
|
+
illegalArgument('text must be defined');
|
|
1188
|
+
}
|
|
1189
|
+
this.range = range;
|
|
1190
|
+
this.text = text;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
@es5ClassCompat
|
|
1195
|
+
export class InlineValueVariableLookup implements theia.InlineValueVariableLookup {
|
|
1196
|
+
public type = 'variable';
|
|
1197
|
+
public range: Range;
|
|
1198
|
+
public variableName?: string;
|
|
1199
|
+
public caseSensitiveLookup: boolean;
|
|
1200
|
+
|
|
1201
|
+
constructor(range: Range, variableName?: string, caseSensitiveLookup?: boolean) {
|
|
1202
|
+
if (!range) {
|
|
1203
|
+
illegalArgument('range must be defined');
|
|
1204
|
+
}
|
|
1205
|
+
this.range = range;
|
|
1206
|
+
this.caseSensitiveLookup = caseSensitiveLookup || true;
|
|
1207
|
+
this.variableName = variableName;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
@es5ClassCompat
|
|
1212
|
+
export class InlineValueEvaluatableExpression implements theia.InlineValueEvaluatableExpression {
|
|
1213
|
+
public type = 'expression';
|
|
1214
|
+
public range: Range;
|
|
1215
|
+
public expression?: string;
|
|
1216
|
+
|
|
1217
|
+
constructor(range: Range, expression?: string) {
|
|
1218
|
+
if (!range) {
|
|
1219
|
+
illegalArgument('range must be defined');
|
|
1220
|
+
}
|
|
1221
|
+
this.range = range;
|
|
1222
|
+
this.expression = expression;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
export type InlineValue = InlineValueText | InlineValueVariableLookup | InlineValueEvaluatableExpression;
|
|
1227
|
+
|
|
1137
1228
|
export enum DocumentHighlightKind {
|
|
1138
1229
|
Text = 0,
|
|
1139
1230
|
Read = 1,
|
|
@@ -1558,6 +1649,29 @@ export class QuickInputButtons {
|
|
|
1558
1649
|
};
|
|
1559
1650
|
}
|
|
1560
1651
|
|
|
1652
|
+
@es5ClassCompat
|
|
1653
|
+
export class TerminalLink {
|
|
1654
|
+
|
|
1655
|
+
static validate(candidate: TerminalLink): void {
|
|
1656
|
+
if (typeof candidate.startIndex !== 'number') {
|
|
1657
|
+
throw new Error('Should provide a startIndex inside candidate field');
|
|
1658
|
+
}
|
|
1659
|
+
if (typeof candidate.length !== 'number') {
|
|
1660
|
+
throw new Error('Should provide a length inside candidate field');
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
startIndex: number;
|
|
1665
|
+
length: number;
|
|
1666
|
+
tooltip?: string;
|
|
1667
|
+
|
|
1668
|
+
constructor(startIndex: number, length: number, tooltip?: string) {
|
|
1669
|
+
this.startIndex = startIndex;
|
|
1670
|
+
this.length = length;
|
|
1671
|
+
this.tooltip = tooltip;
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1561
1675
|
@es5ClassCompat
|
|
1562
1676
|
export class FileDecoration {
|
|
1563
1677
|
|
|
@@ -2374,6 +2488,40 @@ export enum ColorFormat {
|
|
|
2374
2488
|
HSL = 2
|
|
2375
2489
|
}
|
|
2376
2490
|
|
|
2491
|
+
@es5ClassCompat
|
|
2492
|
+
export class InlayHintLabelPart implements theia.InlayHintLabelPart {
|
|
2493
|
+
value: string;
|
|
2494
|
+
tooltip?: string | theia.MarkdownString | undefined;
|
|
2495
|
+
location?: Location | undefined;
|
|
2496
|
+
command?: theia.Command | undefined;
|
|
2497
|
+
|
|
2498
|
+
constructor(value: string) {
|
|
2499
|
+
this.value = value;
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
@es5ClassCompat
|
|
2504
|
+
export class InlayHint implements theia.InlayHint {
|
|
2505
|
+
position: theia.Position;
|
|
2506
|
+
label: string | InlayHintLabelPart[];
|
|
2507
|
+
tooltip?: string | theia.MarkdownString | undefined;
|
|
2508
|
+
kind?: InlayHintKind;
|
|
2509
|
+
textEdits?: TextEdit[];
|
|
2510
|
+
paddingLeft?: boolean;
|
|
2511
|
+
paddingRight?: boolean;
|
|
2512
|
+
|
|
2513
|
+
constructor(position: theia.Position, label: string | InlayHintLabelPart[], kind?: InlayHintKind) {
|
|
2514
|
+
this.position = position;
|
|
2515
|
+
this.label = label;
|
|
2516
|
+
this.kind = kind;
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
export enum InlayHintKind {
|
|
2521
|
+
Type = 1,
|
|
2522
|
+
Parameter = 2,
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2377
2525
|
@es5ClassCompat
|
|
2378
2526
|
export class FoldingRange {
|
|
2379
2527
|
start: number;
|
|
@@ -2503,6 +2651,43 @@ export class CallHierarchyOutgoingCall {
|
|
|
2503
2651
|
}
|
|
2504
2652
|
}
|
|
2505
2653
|
|
|
2654
|
+
@es5ClassCompat
|
|
2655
|
+
export class TypeHierarchyItem {
|
|
2656
|
+
_sessionId?: string;
|
|
2657
|
+
_itemId?: string;
|
|
2658
|
+
|
|
2659
|
+
kind: SymbolKind;
|
|
2660
|
+
tags?: readonly SymbolTag[];
|
|
2661
|
+
name: string;
|
|
2662
|
+
detail?: string;
|
|
2663
|
+
uri: URI;
|
|
2664
|
+
range: Range;
|
|
2665
|
+
selectionRange: Range;
|
|
2666
|
+
|
|
2667
|
+
constructor(kind: SymbolKind, name: string, detail: string, uri: URI, range: Range, selectionRange: Range) {
|
|
2668
|
+
this.kind = kind;
|
|
2669
|
+
this.name = name;
|
|
2670
|
+
this.detail = detail;
|
|
2671
|
+
this.uri = uri;
|
|
2672
|
+
this.range = range;
|
|
2673
|
+
this.selectionRange = selectionRange;
|
|
2674
|
+
}
|
|
2675
|
+
|
|
2676
|
+
static isTypeHierarchyItem(thing: {}): thing is TypeHierarchyItem {
|
|
2677
|
+
if (thing instanceof TypeHierarchyItem) {
|
|
2678
|
+
return true;
|
|
2679
|
+
}
|
|
2680
|
+
if (!thing) {
|
|
2681
|
+
return false;
|
|
2682
|
+
}
|
|
2683
|
+
return typeof (<TypeHierarchyItem>thing).kind === 'number' &&
|
|
2684
|
+
typeof (<TypeHierarchyItem>thing).name === 'string' &&
|
|
2685
|
+
URI.isUri((<TypeHierarchyItem>thing).uri) &&
|
|
2686
|
+
Range.isRange((<TypeHierarchyItem>thing).range) &&
|
|
2687
|
+
Range.isRange((<TypeHierarchyItem>thing).selectionRange);
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2506
2691
|
export enum LanguageStatusSeverity {
|
|
2507
2692
|
Information = 0,
|
|
2508
2693
|
Warning = 1,
|
package/src/plugin/workspace.ts
CHANGED
|
@@ -180,7 +180,7 @@ export class WorkspaceExtImpl implements WorkspaceExt {
|
|
|
180
180
|
includePattern = include;
|
|
181
181
|
} else {
|
|
182
182
|
includePattern = include.pattern;
|
|
183
|
-
includeFolderUri =
|
|
183
|
+
includeFolderUri = include.baseUri.toString();
|
|
184
184
|
}
|
|
185
185
|
} else {
|
|
186
186
|
includePattern = '';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"callhierarchy-type-converters.d.ts","sourceRoot":"","sources":["../../../../src/main/browser/callhierarchy/callhierarchy-type-converters.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC3H,OAAO,KAAK,KAAK,MAAM,sCAAsC,CAAC;AAC9D,OAAO,KAAK,GAAG,MAAM,gCAAgC,CAAC;AACtD,OAAO,KAAK,aAAa,MAAM,mDAAmD,CAAC;AAEnF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAE1D;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAE5D;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAK7E;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,aAAa,CAAC,QAAQ,CAKzF;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAK3E;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAQjE;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,CAO/D;AAED,yBAAiB,mBAAmB,CAAC;IACjC,SAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CA8B/E;IACD,SAAgB,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,UAAU,GAAG,aAAa,CAAC,UAAU,CA8B7E;CACJ;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AACrF,wBAAgB,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,iBAAiB,GAAG,SAAS,GAAG,iBAAiB,GAAG,SAAS,CAAC;AAa7G,wBAAgB,cAAc,CAAC,UAAU,EAAE,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAOrF;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,yBAAyB,GAAG,yBAAyB,CAK3F;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,yBAAyB,GAAG,KAAK,CAAC,yBAAyB,CAK7F;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,yBAAyB,GAAG,yBAAyB,CAK3F;AAED,wBAAgB,uDAAuD,CAAC,MAAM,EAAE,yBAAyB,GAAG,KAAK,CAAC,yBAAyB,CAK1I;AAED,wBAAgB,uDAAuD,CAAC,MAAM,EAAE,yBAAyB,GAAG,KAAK,CAAC,yBAAyB,CAK1I"}
|