@theia/plugin-ext 1.31.0-next.2 → 1.31.0-next.29
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 +61 -0
- package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc-model.js +6 -1
- package/lib/common/plugin-api-rpc-model.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +29 -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/languages-main.d.ts +8 -1
- package/lib/main/browser/languages-main.d.ts.map +1 -1
- package/lib/main/browser/languages-main.js +89 -1
- 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/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.d.ts +8 -2
- package/lib/plugin/languages.d.ts.map +1 -1
- package/lib/plugin/languages.js +40 -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 +18 -3
- 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 +7 -1
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +51 -4
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +60 -2
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +140 -5
- 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 +24 -24
- package/src/common/cache.ts +51 -0
- package/src/common/plugin-api-rpc-model.ts +68 -0
- package/src/common/plugin-api-rpc.ts +36 -2
- package/src/hosted/browser/hosted-plugin.ts +9 -9
- package/src/main/browser/languages-main.ts +120 -4
- 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/languages/inlay-hints.ts +149 -0
- package/src/plugin/languages/inline-values.ts +50 -0
- package/src/plugin/languages.ts +57 -1
- package/src/plugin/plugin-context.ts +28 -5
- package/src/plugin/terminal-ext.ts +54 -2
- package/src/plugin/tree/tree-views.ts +40 -2
- package/src/plugin/type-converters.ts +47 -5
- package/src/plugin/types-impl.spec.ts +16 -0
- package/src/plugin/types-impl.ts +152 -4
- package/src/plugin/workspace.ts +1 -1
package/src/plugin/languages.ts
CHANGED
|
@@ -25,6 +25,8 @@ import {
|
|
|
25
25
|
WorkspaceEditDto,
|
|
26
26
|
PluginInfo,
|
|
27
27
|
Plugin,
|
|
28
|
+
InlayHintsDto,
|
|
29
|
+
InlayHintDto,
|
|
28
30
|
} from '../common/plugin-api-rpc';
|
|
29
31
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
30
32
|
import * as theia from '@theia/plugin';
|
|
@@ -62,13 +64,16 @@ import {
|
|
|
62
64
|
CallHierarchyIncomingCall,
|
|
63
65
|
CallHierarchyOutgoingCall,
|
|
64
66
|
LinkedEditingRanges,
|
|
65
|
-
EvaluatableExpression
|
|
67
|
+
EvaluatableExpression,
|
|
68
|
+
InlineValue,
|
|
69
|
+
InlineValueContext
|
|
66
70
|
} from '../common/plugin-api-rpc-model';
|
|
67
71
|
import { CompletionAdapter } from './languages/completion';
|
|
68
72
|
import { Diagnostics } from './languages/diagnostics';
|
|
69
73
|
import { SignatureHelpAdapter } from './languages/signature';
|
|
70
74
|
import { HoverAdapter } from './languages/hover';
|
|
71
75
|
import { EvaluatableExpressionAdapter } from './languages/evaluatable-expression';
|
|
76
|
+
import { InlineValuesAdapter } from './languages/inline-values';
|
|
72
77
|
import { DocumentHighlightAdapter } from './languages/document-highlight';
|
|
73
78
|
import { DocumentFormattingAdapter } from './languages/document-formatting';
|
|
74
79
|
import { RangeFormattingAdapter } from './languages/range-formatting';
|
|
@@ -98,11 +103,13 @@ import { DisposableCollection, disposableTimeout, Disposable as TheiaDisposable
|
|
|
98
103
|
import { Severity } from '@theia/core/lib/common/severity';
|
|
99
104
|
import { LinkedEditingRangeAdapter } from './languages/linked-editing-range';
|
|
100
105
|
import { serializeEnterRules, serializeIndentation, serializeRegExp } from './languages-utils';
|
|
106
|
+
import { InlayHintsAdapter } from './languages/inlay-hints';
|
|
101
107
|
|
|
102
108
|
type Adapter = CompletionAdapter |
|
|
103
109
|
SignatureHelpAdapter |
|
|
104
110
|
HoverAdapter |
|
|
105
111
|
EvaluatableExpressionAdapter |
|
|
112
|
+
InlineValuesAdapter |
|
|
106
113
|
DocumentHighlightAdapter |
|
|
107
114
|
DocumentFormattingAdapter |
|
|
108
115
|
RangeFormattingAdapter |
|
|
@@ -120,6 +127,7 @@ type Adapter = CompletionAdapter |
|
|
|
120
127
|
FoldingProviderAdapter |
|
|
121
128
|
SelectionRangeProviderAdapter |
|
|
122
129
|
ColorProviderAdapter |
|
|
130
|
+
InlayHintsAdapter |
|
|
123
131
|
RenameAdapter |
|
|
124
132
|
CallHierarchyAdapter |
|
|
125
133
|
DocumentRangeSemanticTokensAdapter |
|
|
@@ -365,6 +373,25 @@ export class LanguagesExtImpl implements LanguagesExt {
|
|
|
365
373
|
}
|
|
366
374
|
// ### EvaluatableExpression Provider end
|
|
367
375
|
|
|
376
|
+
// ### InlineValues Provider begin
|
|
377
|
+
registerInlineValuesProvider(selector: theia.DocumentSelector, provider: theia.InlineValuesProvider, pluginInfo: PluginInfo): theia.Disposable {
|
|
378
|
+
const eventHandle = typeof provider.onDidChangeInlineValues === 'function' ? this.nextCallId() : undefined;
|
|
379
|
+
const callId = this.addNewAdapter(new InlineValuesAdapter(provider, this.documents));
|
|
380
|
+
this.proxy.$registerInlineValuesProvider(callId, pluginInfo, this.transformDocumentSelector(selector));
|
|
381
|
+
let result = this.createDisposable(callId);
|
|
382
|
+
|
|
383
|
+
if (eventHandle !== undefined) {
|
|
384
|
+
const subscription = provider.onDidChangeInlineValues!(_ => this.proxy.$emitInlineValuesEvent(eventHandle));
|
|
385
|
+
result = Disposable.from(result, subscription);
|
|
386
|
+
}
|
|
387
|
+
return result;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
$provideInlineValues(handle: number, resource: UriComponents, range: Range, context: InlineValueContext, token: theia.CancellationToken): Promise<InlineValue[] | undefined> {
|
|
391
|
+
return this.withAdapter(handle, InlineValuesAdapter, adapter => adapter.provideInlineValues(URI.revive(resource), range, context, token), undefined);
|
|
392
|
+
}
|
|
393
|
+
// ### InlineValue Provider end
|
|
394
|
+
|
|
368
395
|
// ### Document Highlight Provider begin
|
|
369
396
|
registerDocumentHighlightProvider(selector: theia.DocumentSelector, provider: theia.DocumentHighlightProvider, pluginInfo: PluginInfo): theia.Disposable {
|
|
370
397
|
const callId = this.addNewAdapter(new DocumentHighlightAdapter(provider, this.documents));
|
|
@@ -579,6 +606,35 @@ export class LanguagesExtImpl implements LanguagesExt {
|
|
|
579
606
|
}
|
|
580
607
|
// ### Color Provider end
|
|
581
608
|
|
|
609
|
+
// ### InlayHints Provider begin
|
|
610
|
+
registerInlayHintsProvider(selector: theia.DocumentSelector, provider: theia.InlayHintsProvider, pluginInfo: PluginInfo): theia.Disposable {
|
|
611
|
+
const eventHandle = typeof provider.onDidChangeInlayHints === 'function' ? this.nextCallId() : undefined;
|
|
612
|
+
const callId = this.addNewAdapter(new InlayHintsAdapter(provider, this.documents, this.commands));
|
|
613
|
+
this.proxy.$registerInlayHintsProvider(callId, pluginInfo, this.transformDocumentSelector(selector));
|
|
614
|
+
|
|
615
|
+
let result = this.createDisposable(callId);
|
|
616
|
+
|
|
617
|
+
if (eventHandle !== undefined) {
|
|
618
|
+
const subscription = provider.onDidChangeInlayHints!(() => this.proxy.$emitInlayHintsEvent(eventHandle));
|
|
619
|
+
result = Disposable.from(result, subscription);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
return result;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
$provideInlayHints(handle: number, resource: UriComponents, range: Range, token: theia.CancellationToken): Promise<InlayHintsDto | undefined> {
|
|
626
|
+
return this.withAdapter(handle, InlayHintsAdapter, adapter => adapter.provideInlayHints(URI.revive(resource), range, token), undefined);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
$resolveInlayHint(handle: number, id: ChainedCacheId, token: theia.CancellationToken): Promise<InlayHintDto | undefined> {
|
|
630
|
+
return this.withAdapter(handle, InlayHintsAdapter, adapter => adapter.resolveInlayHint(id, token), undefined);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
$releaseInlayHints(handle: number, id: number): void {
|
|
634
|
+
this.withAdapter(handle, InlayHintsAdapter, async adapter => adapter.releaseHints(id), undefined);
|
|
635
|
+
}
|
|
636
|
+
// ### InlayHints Provider end
|
|
637
|
+
|
|
582
638
|
// ### Folding Range Provider begin
|
|
583
639
|
registerFoldingRangeProvider(selector: theia.DocumentSelector, provider: theia.FoldingRangeProvider, pluginInfo: PluginInfo): theia.Disposable {
|
|
584
640
|
const callId = this.addNewAdapter(new FoldingProviderAdapter(provider, this.documents));
|
|
@@ -79,6 +79,10 @@ import {
|
|
|
79
79
|
SignatureHelpTriggerKind,
|
|
80
80
|
Hover,
|
|
81
81
|
EvaluatableExpression,
|
|
82
|
+
InlineValueEvaluatableExpression,
|
|
83
|
+
InlineValueText,
|
|
84
|
+
InlineValueVariableLookup,
|
|
85
|
+
InlineValueContext,
|
|
82
86
|
DocumentHighlightKind,
|
|
83
87
|
DocumentHighlight,
|
|
84
88
|
DocumentLink,
|
|
@@ -145,7 +149,11 @@ import {
|
|
|
145
149
|
LinkedEditingRanges,
|
|
146
150
|
LanguageStatusSeverity,
|
|
147
151
|
TextDocumentChangeReason,
|
|
148
|
-
InputBoxValidationSeverity
|
|
152
|
+
InputBoxValidationSeverity,
|
|
153
|
+
TerminalLink,
|
|
154
|
+
InlayHint,
|
|
155
|
+
InlayHintKind,
|
|
156
|
+
InlayHintLabelPart
|
|
149
157
|
} from './types-impl';
|
|
150
158
|
import { AuthenticationExtImpl } from './authentication-ext';
|
|
151
159
|
import { SymbolKind } from '../common/plugin-api-rpc-model';
|
|
@@ -289,7 +297,7 @@ export function createAPIFactory(
|
|
|
289
297
|
}
|
|
290
298
|
};
|
|
291
299
|
|
|
292
|
-
const { onDidChangeActiveTerminal, onDidCloseTerminal, onDidOpenTerminal } = terminalExt;
|
|
300
|
+
const { onDidChangeActiveTerminal, onDidChangeTerminalState, onDidCloseTerminal, onDidOpenTerminal } = terminalExt;
|
|
293
301
|
const showInformationMessage = messageRegistryExt.showMessage.bind(messageRegistryExt, MainMessageType.Info);
|
|
294
302
|
const showWarningMessage = messageRegistryExt.showMessage.bind(messageRegistryExt, MainMessageType.Warning);
|
|
295
303
|
const showErrorMessage = messageRegistryExt.showMessage.bind(messageRegistryExt, MainMessageType.Error);
|
|
@@ -439,6 +447,7 @@ export function createAPIFactory(
|
|
|
439
447
|
shellArgs?: string[]): theia.Terminal {
|
|
440
448
|
return terminalExt.createTerminal(nameOrOptions, shellPath, shellArgs);
|
|
441
449
|
},
|
|
450
|
+
onDidChangeTerminalState,
|
|
442
451
|
onDidCloseTerminal,
|
|
443
452
|
onDidOpenTerminal,
|
|
444
453
|
createTextEditorDecorationType(options: theia.DecorationRenderOptions): theia.TextEditorDecorationType {
|
|
@@ -466,8 +475,8 @@ export function createAPIFactory(
|
|
|
466
475
|
createInputBox(): theia.InputBox {
|
|
467
476
|
return quickOpenExt.createInputBox(plugin);
|
|
468
477
|
},
|
|
469
|
-
registerTerminalLinkProvider(provider: theia.TerminalLinkProvider):
|
|
470
|
-
|
|
478
|
+
registerTerminalLinkProvider(provider: theia.TerminalLinkProvider): theia.Disposable {
|
|
479
|
+
return terminalExt.registerTerminalLinkProvider(provider);
|
|
471
480
|
},
|
|
472
481
|
get activeColorTheme(): theia.ColorTheme {
|
|
473
482
|
return themingExt.activeColorTheme;
|
|
@@ -700,6 +709,9 @@ export function createAPIFactory(
|
|
|
700
709
|
registerEvaluatableExpressionProvider(selector: theia.DocumentSelector, provider: theia.EvaluatableExpressionProvider): theia.Disposable {
|
|
701
710
|
return languagesExt.registerEvaluatableExpressionProvider(selector, provider, pluginToPluginInfo(plugin));
|
|
702
711
|
},
|
|
712
|
+
registerInlineValuesProvider(selector: theia.DocumentSelector, provider: theia.InlineValuesProvider): theia.Disposable {
|
|
713
|
+
return languagesExt.registerInlineValuesProvider(selector, provider, pluginToPluginInfo(plugin));
|
|
714
|
+
},
|
|
703
715
|
registerDocumentHighlightProvider(selector: theia.DocumentSelector, provider: theia.DocumentHighlightProvider): theia.Disposable {
|
|
704
716
|
return languagesExt.registerDocumentHighlightProvider(selector, provider, pluginToPluginInfo(plugin));
|
|
705
717
|
},
|
|
@@ -739,6 +751,9 @@ export function createAPIFactory(
|
|
|
739
751
|
registerColorProvider(selector: theia.DocumentSelector, provider: theia.DocumentColorProvider): theia.Disposable {
|
|
740
752
|
return languagesExt.registerColorProvider(selector, provider, pluginToPluginInfo(plugin));
|
|
741
753
|
},
|
|
754
|
+
registerInlayHintsProvider(selector: theia.DocumentSelector, provider: theia.InlayHintsProvider): theia.Disposable {
|
|
755
|
+
return languagesExt.registerInlayHintsProvider(selector, provider, pluginToPluginInfo(plugin));
|
|
756
|
+
},
|
|
742
757
|
registerFoldingRangeProvider(selector: theia.DocumentSelector, provider: theia.FoldingRangeProvider): theia.Disposable {
|
|
743
758
|
return languagesExt.registerFoldingRangeProvider(selector, provider, pluginToPluginInfo(plugin));
|
|
744
759
|
},
|
|
@@ -961,6 +976,10 @@ export function createAPIFactory(
|
|
|
961
976
|
SignatureHelpTriggerKind,
|
|
962
977
|
Hover,
|
|
963
978
|
EvaluatableExpression,
|
|
979
|
+
InlineValueEvaluatableExpression,
|
|
980
|
+
InlineValueText,
|
|
981
|
+
InlineValueVariableLookup,
|
|
982
|
+
InlineValueContext,
|
|
964
983
|
DocumentHighlightKind,
|
|
965
984
|
DocumentHighlight,
|
|
966
985
|
DocumentLink,
|
|
@@ -1024,10 +1043,14 @@ export function createAPIFactory(
|
|
|
1024
1043
|
ColorThemeKind,
|
|
1025
1044
|
SourceControlInputBoxValidationType,
|
|
1026
1045
|
FileDecoration,
|
|
1046
|
+
TerminalLink,
|
|
1027
1047
|
CancellationError,
|
|
1028
1048
|
ExtensionMode,
|
|
1029
1049
|
LinkedEditingRanges,
|
|
1030
|
-
InputBoxValidationSeverity
|
|
1050
|
+
InputBoxValidationSeverity,
|
|
1051
|
+
InlayHint,
|
|
1052
|
+
InlayHintKind,
|
|
1053
|
+
InlayHintLabelPart
|
|
1031
1054
|
};
|
|
1032
1055
|
};
|
|
1033
1056
|
}
|
|
@@ -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;
|
|
@@ -1237,3 +1270,12 @@ export function pluginToPluginInfo(plugin: Plugin): rpc.PluginInfo {
|
|
|
1237
1270
|
displayName: plugin.model.displayName
|
|
1238
1271
|
};
|
|
1239
1272
|
}
|
|
1273
|
+
|
|
1274
|
+
export namespace InlayHintKind {
|
|
1275
|
+
export function from(kind: theia.InlayHintKind): model.InlayHintKind {
|
|
1276
|
+
return kind;
|
|
1277
|
+
}
|
|
1278
|
+
export function to(kind: model.InlayHintKind): theia.InlayHintKind {
|
|
1279
|
+
return kind;
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
@@ -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
|
});
|