@theia/plugin-ext 1.33.0-next.2 → 1.33.0-next.20
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/index.js +2 -0
- package/lib/common/index.js.map +1 -1
- package/lib/common/plugin-api-rpc-model.d.ts +78 -0
- package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc-model.js +17 -1
- package/lib/common/plugin-api-rpc-model.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +20 -7
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js +0 -2
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-protocol.d.ts +4 -4
- package/lib/common/plugin-protocol.d.ts.map +1 -1
- package/lib/common/proxy-handler.d.ts +66 -0
- package/lib/common/proxy-handler.d.ts.map +1 -0
- package/lib/common/proxy-handler.js +98 -0
- package/lib/common/proxy-handler.js.map +1 -0
- package/lib/common/reference-map.d.ts +8 -0
- package/lib/common/reference-map.d.ts.map +1 -0
- package/lib/common/reference-map.js +40 -0
- package/lib/common/reference-map.js.map +1 -0
- package/lib/common/rpc-protocol.d.ts +25 -51
- package/lib/common/rpc-protocol.d.ts.map +1 -1
- package/lib/common/rpc-protocol.js +126 -323
- package/lib/common/rpc-protocol.js.map +1 -1
- package/lib/hosted/browser/hosted-plugin-watcher.d.ts +1 -1
- package/lib/hosted/browser/hosted-plugin-watcher.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin-watcher.js.map +1 -1
- package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js +13 -8
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/browser/plugin-worker.d.ts.map +1 -1
- package/lib/hosted/browser/plugin-worker.js +14 -9
- package/lib/hosted/browser/plugin-worker.js.map +1 -1
- package/lib/hosted/browser/worker/worker-main.d.ts +1 -1
- package/lib/hosted/browser/worker/worker-main.d.ts.map +1 -1
- package/lib/hosted/browser/worker/worker-main.js +23 -22
- package/lib/hosted/browser/worker/worker-main.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-process.d.ts +5 -4
- package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-process.js +20 -13
- package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-protocol.d.ts +22 -0
- package/lib/hosted/node/hosted-plugin-protocol.d.ts.map +1 -0
- package/lib/hosted/node/hosted-plugin-protocol.js +37 -0
- package/lib/hosted/node/hosted-plugin-protocol.js.map +1 -0
- package/lib/hosted/node/hosted-plugin.d.ts +1 -1
- package/lib/hosted/node/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin.js.map +1 -1
- package/lib/hosted/node/plugin-host.d.ts +1 -1
- package/lib/hosted/node/plugin-host.d.ts.map +1 -1
- package/lib/hosted/node/plugin-host.js +10 -21
- package/lib/hosted/node/plugin-host.js.map +1 -1
- package/lib/hosted/node/plugin-service.d.ts +1 -1
- package/lib/hosted/node/plugin-service.d.ts.map +1 -1
- package/lib/hosted/node/plugin-service.js.map +1 -1
- package/lib/main/browser/file-system-main-impl.d.ts +1 -0
- package/lib/main/browser/file-system-main-impl.d.ts.map +1 -1
- package/lib/main/browser/file-system-main-impl.js +9 -2
- package/lib/main/browser/file-system-main-impl.js.map +1 -1
- package/lib/main/browser/languages-main.d.ts +1 -0
- package/lib/main/browser/languages-main.d.ts.map +1 -1
- package/lib/main/browser/languages-main.js +10 -0
- package/lib/main/browser/languages-main.js.map +1 -1
- package/lib/main/browser/main-context.d.ts.map +1 -1
- package/lib/main/browser/main-context.js +0 -3
- package/lib/main/browser/main-context.js.map +1 -1
- package/lib/main/browser/tasks-main.d.ts.map +1 -1
- package/lib/main/browser/tasks-main.js +13 -9
- package/lib/main/browser/tasks-main.js.map +1 -1
- package/lib/plugin/debug/debug-ext.d.ts +2 -1
- package/lib/plugin/debug/debug-ext.d.ts.map +1 -1
- package/lib/plugin/debug/debug-ext.js +10 -1
- package/lib/plugin/debug/debug-ext.js.map +1 -1
- package/lib/plugin/debug/plugin-debug-adapter-session.d.ts +6 -5
- package/lib/plugin/debug/plugin-debug-adapter-session.d.ts.map +1 -1
- package/lib/plugin/debug/plugin-debug-adapter-session.js +18 -4
- package/lib/plugin/debug/plugin-debug-adapter-session.js.map +1 -1
- package/lib/plugin/file-system-ext-impl.d.ts +2 -0
- package/lib/plugin/file-system-ext-impl.d.ts.map +1 -1
- package/lib/plugin/file-system-ext-impl.js +22 -5
- package/lib/plugin/file-system-ext-impl.js.map +1 -1
- package/lib/plugin/languages/inline-completion.d.ts +21 -0
- package/lib/plugin/languages/inline-completion.d.ts.map +1 -0
- package/lib/plugin/languages/inline-completion.js +94 -0
- package/lib/plugin/languages/inline-completion.js.map +1 -0
- package/lib/plugin/languages.d.ts +5 -2
- package/lib/plugin/languages.d.ts.map +1 -1
- package/lib/plugin/languages.js +16 -1
- package/lib/plugin/languages.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +107 -3
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/theming.d.ts.map +1 -1
- package/lib/plugin/theming.js +3 -0
- package/lib/plugin/theming.js.map +1 -1
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +6 -14
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/type-converters.spec.js +5 -4
- package/lib/plugin/type-converters.spec.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +149 -9
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +205 -32
- package/lib/plugin/types-impl.js.map +1 -1
- package/package.json +25 -25
- package/src/common/index.ts +4 -0
- package/src/common/plugin-api-rpc-model.ts +96 -0
- package/src/common/plugin-api-rpc.ts +25 -7
- package/src/common/plugin-protocol.ts +4 -4
- package/src/common/proxy-handler.ts +126 -0
- package/src/common/reference-map.ts +38 -0
- package/src/common/rpc-protocol.ts +128 -401
- package/src/hosted/browser/hosted-plugin-watcher.ts +4 -3
- package/src/hosted/browser/hosted-plugin.ts +17 -8
- package/src/hosted/browser/plugin-worker.ts +16 -10
- package/src/hosted/browser/worker/worker-main.ts +25 -26
- package/src/hosted/node/hosted-plugin-process.ts +25 -16
- package/src/hosted/node/hosted-plugin-protocol.ts +49 -0
- package/src/hosted/node/hosted-plugin.ts +1 -1
- package/src/hosted/node/plugin-host.ts +11 -22
- package/src/hosted/node/plugin-service.ts +1 -1
- package/src/main/browser/file-system-main-impl.ts +12 -3
- package/src/main/browser/languages-main.ts +18 -1
- package/src/main/browser/main-context.ts +0 -4
- package/src/main/browser/tasks-main.ts +13 -9
- package/src/plugin/debug/debug-ext.ts +11 -2
- package/src/plugin/debug/plugin-debug-adapter-session.ts +17 -9
- package/src/plugin/file-system-ext-impl.ts +21 -5
- package/src/plugin/languages/inline-completion.ts +126 -0
- package/src/plugin/languages.ts +30 -3
- package/src/plugin/plugin-context.ts +142 -4
- package/src/plugin/theming.ts +3 -0
- package/src/plugin/type-converters.spec.ts +5 -4
- package/src/plugin/type-converters.ts +10 -12
- package/src/plugin/types-impl.ts +253 -27
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2022 Ericsson 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
|
+
// copied from https://github.com/microsoft/vscode/blob/6261075646f055b99068d3688932416f2346dd3b/src/vs/workbench/api/common/extHostLanguageFeatures.ts#L1069-L1185.
|
|
18
|
+
|
|
19
|
+
import * as theia from '@theia/plugin';
|
|
20
|
+
import * as Converter from '../type-converters';
|
|
21
|
+
import { DocumentsExtImpl } from '../documents';
|
|
22
|
+
import { URI } from '@theia/core/shared/vscode-uri';
|
|
23
|
+
import { CommandRegistryImpl } from '../command-registry';
|
|
24
|
+
import { ReferenceMap } from '../../common/reference-map';
|
|
25
|
+
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
26
|
+
import { InlineCompletionTriggerKind as TriggerKind } from '../../plugin/types-impl';
|
|
27
|
+
import { Command, InlineCompletionContext, InlineCompletionTriggerKind } from '../../common/plugin-api-rpc-model';
|
|
28
|
+
import { IdentifiableInlineCompletion, IdentifiableInlineCompletions, Position } from '../../common/plugin-api-rpc';
|
|
29
|
+
|
|
30
|
+
export class InlineCompletionAdapterBase {
|
|
31
|
+
|
|
32
|
+
async provideInlineCompletions(
|
|
33
|
+
_resource: URI,
|
|
34
|
+
_position: Position,
|
|
35
|
+
_context: InlineCompletionContext,
|
|
36
|
+
_token: theia.CancellationToken
|
|
37
|
+
): Promise<IdentifiableInlineCompletions | undefined> {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
disposeCompletions(pid: number): void { return; };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export class InlineCompletionAdapter extends InlineCompletionAdapterBase {
|
|
45
|
+
|
|
46
|
+
private readonly references = new ReferenceMap<{
|
|
47
|
+
dispose(): void;
|
|
48
|
+
items: readonly theia.InlineCompletionItem[];
|
|
49
|
+
}>();
|
|
50
|
+
|
|
51
|
+
constructor(
|
|
52
|
+
private readonly documents: DocumentsExtImpl,
|
|
53
|
+
private readonly provider: theia.InlineCompletionItemProvider,
|
|
54
|
+
private readonly commands: CommandRegistryImpl,
|
|
55
|
+
) {
|
|
56
|
+
super();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private readonly languageTriggerKindToVSCodeTriggerKind: Record<InlineCompletionTriggerKind, TriggerKind> = {
|
|
60
|
+
[InlineCompletionTriggerKind.Automatic]: TriggerKind.Automatic,
|
|
61
|
+
[InlineCompletionTriggerKind.Explicit]: TriggerKind.Invoke,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
override async provideInlineCompletions(
|
|
65
|
+
resource: URI,
|
|
66
|
+
position: Position,
|
|
67
|
+
context: InlineCompletionContext,
|
|
68
|
+
token: theia.CancellationToken
|
|
69
|
+
): Promise<IdentifiableInlineCompletions | undefined> {
|
|
70
|
+
const doc = this.documents.getDocument(resource);
|
|
71
|
+
const pos = Converter.toPosition(position);
|
|
72
|
+
|
|
73
|
+
const result = await this.provider.provideInlineCompletionItems(doc, pos, {
|
|
74
|
+
selectedCompletionInfo:
|
|
75
|
+
context.selectedSuggestionInfo
|
|
76
|
+
? {
|
|
77
|
+
range: Converter.toRange(context.selectedSuggestionInfo.range),
|
|
78
|
+
text: context.selectedSuggestionInfo.text
|
|
79
|
+
}
|
|
80
|
+
: undefined,
|
|
81
|
+
triggerKind: this.languageTriggerKindToVSCodeTriggerKind[context.triggerKind]
|
|
82
|
+
}, token);
|
|
83
|
+
|
|
84
|
+
if (!result || token.isCancellationRequested) {
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const normalizedResult = Array.isArray(result) ? result : result.items;
|
|
89
|
+
|
|
90
|
+
let disposableCollection: DisposableCollection | undefined = undefined;
|
|
91
|
+
const pid = this.references.createReferenceId({
|
|
92
|
+
dispose(): void {
|
|
93
|
+
disposableCollection?.dispose();
|
|
94
|
+
},
|
|
95
|
+
items: normalizedResult
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
pid,
|
|
100
|
+
items: normalizedResult.map<IdentifiableInlineCompletion>((item, idx) => {
|
|
101
|
+
let command: Command | undefined = undefined;
|
|
102
|
+
if (item.command) {
|
|
103
|
+
if (!disposableCollection) {
|
|
104
|
+
disposableCollection = new DisposableCollection();
|
|
105
|
+
}
|
|
106
|
+
command = this.commands.converter.toSafeCommand(item.command, disposableCollection);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const insertText = item.insertText;
|
|
110
|
+
return ({
|
|
111
|
+
insertText: typeof insertText === 'string' ? insertText : { snippet: insertText.value },
|
|
112
|
+
filterText: item.filterText,
|
|
113
|
+
range: item.range ? Converter.fromRange(item.range) : undefined,
|
|
114
|
+
command,
|
|
115
|
+
idx: idx
|
|
116
|
+
});
|
|
117
|
+
})
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
override disposeCompletions(pid: number): void {
|
|
122
|
+
const data = this.references.disposeReferenceId(pid);
|
|
123
|
+
data?.dispose();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
}
|
package/src/plugin/languages.ts
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
Plugin,
|
|
28
28
|
InlayHintsDto,
|
|
29
29
|
InlayHintDto,
|
|
30
|
+
IdentifiableInlineCompletions,
|
|
30
31
|
} from '../common/plugin-api-rpc';
|
|
31
32
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
32
33
|
import * as theia from '@theia/plugin';
|
|
@@ -67,7 +68,8 @@ import {
|
|
|
67
68
|
EvaluatableExpression,
|
|
68
69
|
InlineValue,
|
|
69
70
|
InlineValueContext,
|
|
70
|
-
TypeHierarchyItem
|
|
71
|
+
TypeHierarchyItem,
|
|
72
|
+
InlineCompletionContext
|
|
71
73
|
} from '../common/plugin-api-rpc-model';
|
|
72
74
|
import { CompletionAdapter } from './languages/completion';
|
|
73
75
|
import { Diagnostics } from './languages/diagnostics';
|
|
@@ -106,6 +108,7 @@ import { Severity } from '@theia/core/lib/common/severity';
|
|
|
106
108
|
import { LinkedEditingRangeAdapter } from './languages/linked-editing-range';
|
|
107
109
|
import { serializeEnterRules, serializeIndentation, serializeRegExp } from './languages-utils';
|
|
108
110
|
import { InlayHintsAdapter } from './languages/inlay-hints';
|
|
111
|
+
import { InlineCompletionAdapter, InlineCompletionAdapterBase } from './languages/inline-completion';
|
|
109
112
|
|
|
110
113
|
type Adapter = CompletionAdapter |
|
|
111
114
|
SignatureHelpAdapter |
|
|
@@ -135,7 +138,8 @@ type Adapter = CompletionAdapter |
|
|
|
135
138
|
DocumentRangeSemanticTokensAdapter |
|
|
136
139
|
DocumentSemanticTokensAdapter |
|
|
137
140
|
LinkedEditingRangeAdapter |
|
|
138
|
-
TypeHierarchyAdapter
|
|
141
|
+
TypeHierarchyAdapter |
|
|
142
|
+
InlineCompletionAdapter;
|
|
139
143
|
|
|
140
144
|
export class LanguagesExtImpl implements LanguagesExt {
|
|
141
145
|
|
|
@@ -246,7 +250,8 @@ export class LanguagesExtImpl implements LanguagesExt {
|
|
|
246
250
|
$serialized: true,
|
|
247
251
|
language: selector.language,
|
|
248
252
|
scheme: selector.scheme,
|
|
249
|
-
pattern: selector.pattern
|
|
253
|
+
pattern: selector.pattern,
|
|
254
|
+
notebookType: selector.notebookType
|
|
250
255
|
};
|
|
251
256
|
}
|
|
252
257
|
|
|
@@ -275,6 +280,28 @@ export class LanguagesExtImpl implements LanguagesExt {
|
|
|
275
280
|
}
|
|
276
281
|
// ### Completion end
|
|
277
282
|
|
|
283
|
+
// ### Inline completion provider begin
|
|
284
|
+
registerInlineCompletionsProvider(selector: theia.DocumentSelector, provider: theia.InlineCompletionItemProvider): theia.Disposable {
|
|
285
|
+
const callId = this.addNewAdapter(new InlineCompletionAdapter(this.documents, provider, this.commands));
|
|
286
|
+
this.proxy.$registerInlineCompletionsSupport(callId, this.transformDocumentSelector(selector));
|
|
287
|
+
return this.createDisposable(callId);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
$provideInlineCompletions(
|
|
291
|
+
handle: number,
|
|
292
|
+
resource: UriComponents,
|
|
293
|
+
position: Position,
|
|
294
|
+
context: InlineCompletionContext,
|
|
295
|
+
token: theia.CancellationToken
|
|
296
|
+
): Promise<IdentifiableInlineCompletions | undefined> {
|
|
297
|
+
return this.withAdapter(handle, InlineCompletionAdapterBase, adapter => adapter.provideInlineCompletions(URI.revive(resource), position, context, token), undefined);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
$freeInlineCompletionsList(handle: number, pid: number): void {
|
|
301
|
+
this.withAdapter(handle, InlineCompletionAdapterBase, async adapter => { adapter.disposeCompletions(pid); }, undefined);
|
|
302
|
+
}
|
|
303
|
+
// ### Inline completion provider end
|
|
304
|
+
|
|
278
305
|
// ### Definition provider begin
|
|
279
306
|
$provideDefinition(handle: number, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise<Definition | undefined> {
|
|
280
307
|
return this.withAdapter(handle, DefinitionAdapter, adapter => adapter.provideDefinition(URI.revive(resource), position, token), undefined);
|
|
@@ -155,11 +155,27 @@ import {
|
|
|
155
155
|
InlayHint,
|
|
156
156
|
InlayHintKind,
|
|
157
157
|
InlayHintLabelPart,
|
|
158
|
+
NotebookCell,
|
|
159
|
+
NotebookCellKind,
|
|
160
|
+
NotebookCellStatusBarAlignment,
|
|
161
|
+
NotebookEditorRevealType,
|
|
162
|
+
NotebookControllerAffinity,
|
|
163
|
+
NotebookCellData,
|
|
164
|
+
NotebookCellOutput,
|
|
165
|
+
NotebookCellOutputItem,
|
|
166
|
+
NotebookData,
|
|
167
|
+
NotebookDocument,
|
|
168
|
+
NotebookRange,
|
|
169
|
+
NotebookCellStatusBarItem,
|
|
170
|
+
NotebookEdit,
|
|
158
171
|
TestRunProfileKind,
|
|
159
172
|
TestTag,
|
|
160
173
|
TestRunRequest,
|
|
161
174
|
TestMessage,
|
|
162
|
-
ExtensionKind
|
|
175
|
+
ExtensionKind,
|
|
176
|
+
InlineCompletionItem,
|
|
177
|
+
InlineCompletionList,
|
|
178
|
+
InlineCompletionTriggerKind
|
|
163
179
|
} from './types-impl';
|
|
164
180
|
import { AuthenticationExtImpl } from './authentication-ext';
|
|
165
181
|
import { SymbolKind } from '../common/plugin-api-rpc-model';
|
|
@@ -201,6 +217,7 @@ import { CustomEditorsExtImpl } from './custom-editors';
|
|
|
201
217
|
import { WebviewViewsExtImpl } from './webview-views';
|
|
202
218
|
import { PluginPackage } from '../common';
|
|
203
219
|
import { Endpoint } from '@theia/core/lib/browser/endpoint';
|
|
220
|
+
import { FilePermission } from '@theia/filesystem/lib/common/files';
|
|
204
221
|
|
|
205
222
|
export function createAPIFactory(
|
|
206
223
|
rpc: RPCProtocol,
|
|
@@ -381,6 +398,26 @@ export function createAPIFactory(
|
|
|
381
398
|
throw new Error(`Failed to show text document ${documentArg.toString()}`);
|
|
382
399
|
}
|
|
383
400
|
},
|
|
401
|
+
get visibleNotebookEditors(): theia.NotebookEditor[] {
|
|
402
|
+
return [] as theia.NotebookEditor[];
|
|
403
|
+
},
|
|
404
|
+
onDidChangeVisibleNotebookEditors(listener, thisArg?, disposables?) {
|
|
405
|
+
return Disposable.NULL;
|
|
406
|
+
},
|
|
407
|
+
get activeNotebookEditor(): theia.NotebookEditor | undefined {
|
|
408
|
+
return undefined;
|
|
409
|
+
}, onDidChangeActiveNotebookEditor(listener, thisArg?, disposables?) {
|
|
410
|
+
return Disposable.NULL;
|
|
411
|
+
},
|
|
412
|
+
onDidChangeNotebookEditorSelection(listener, thisArg?, disposables?) {
|
|
413
|
+
return Disposable.NULL;
|
|
414
|
+
},
|
|
415
|
+
onDidChangeNotebookEditorVisibleRanges(listener, thisArg?, disposables?) {
|
|
416
|
+
return Disposable.NULL;
|
|
417
|
+
},
|
|
418
|
+
showNotebookDocument(document: NotebookDocument, options?: theia.NotebookDocumentShowOptions) {
|
|
419
|
+
return Promise.resolve({} as theia.NotebookEditor);
|
|
420
|
+
},
|
|
384
421
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
385
422
|
showQuickPick(items: any, options?: theia.QuickPickOptions, token?: theia.CancellationToken): any {
|
|
386
423
|
return quickOpenExt.showQuickPick(items, options, token);
|
|
@@ -528,6 +565,9 @@ export function createAPIFactory(
|
|
|
528
565
|
onDidChangeWorkspaceFolders(listener, thisArg?, disposables?): theia.Disposable {
|
|
529
566
|
return workspaceExt.onDidChangeWorkspaceFolders(listener, thisArg, disposables);
|
|
530
567
|
},
|
|
568
|
+
get notebookDocuments(): theia.NotebookDocument[] {
|
|
569
|
+
return [] as theia.NotebookDocument[];
|
|
570
|
+
},
|
|
531
571
|
get textDocuments(): theia.TextDocument[] {
|
|
532
572
|
return documents.getAllDocumentData().map(data => data.document);
|
|
533
573
|
},
|
|
@@ -537,6 +577,18 @@ export function createAPIFactory(
|
|
|
537
577
|
onDidCloseTextDocument(listener, thisArg?, disposables?) {
|
|
538
578
|
return documents.onDidRemoveDocument(listener, thisArg, disposables);
|
|
539
579
|
},
|
|
580
|
+
onDidOpenNotebookDocument(listener, thisArg?, disposables?) {
|
|
581
|
+
return Disposable.NULL;
|
|
582
|
+
},
|
|
583
|
+
onDidCloseNotebookDocument(listener, thisArg?, disposables?) {
|
|
584
|
+
return Disposable.NULL;
|
|
585
|
+
},
|
|
586
|
+
onDidChangeNotebookDocument(listener, thisArg?, disposables?) {
|
|
587
|
+
return Disposable.NULL;
|
|
588
|
+
},
|
|
589
|
+
onDidSaveNotebookDocument(listener, thisArg?, disposables?) {
|
|
590
|
+
return Disposable.NULL;
|
|
591
|
+
},
|
|
540
592
|
onDidOpenTextDocument(listener, thisArg?, disposables?) {
|
|
541
593
|
return documents.onDidAddDocument(listener, thisArg, disposables);
|
|
542
594
|
},
|
|
@@ -581,6 +633,9 @@ export function createAPIFactory(
|
|
|
581
633
|
const data = await documents.openDocument(uri);
|
|
582
634
|
return data && data.document;
|
|
583
635
|
},
|
|
636
|
+
openNotebookDocument(uriOrString: theia.Uri | string, content?: NotebookData): Promise<theia.NotebookDocument | undefined> {
|
|
637
|
+
return Promise.reject(new Error('Notebook API is stubbed'));
|
|
638
|
+
},
|
|
584
639
|
createFileSystemWatcher: (pattern, ignoreCreate, ignoreChange, ignoreDelete): theia.FileSystemWatcher =>
|
|
585
640
|
extHostFileSystemEvent.createFileSystemWatcher(fromGlobPattern(pattern), ignoreCreate, ignoreChange, ignoreDelete),
|
|
586
641
|
findFiles(include: theia.GlobPattern, exclude?: theia.GlobPattern | null, maxResults?: number, token?: CancellationToken): PromiseLike<URI[]> {
|
|
@@ -599,8 +654,8 @@ export function createAPIFactory(
|
|
|
599
654
|
registerTextDocumentContentProvider(scheme: string, provider: theia.TextDocumentContentProvider): theia.Disposable {
|
|
600
655
|
return workspaceExt.registerTextDocumentContentProvider(scheme, provider);
|
|
601
656
|
},
|
|
602
|
-
registerFileSystemProvider(scheme: string, provider: theia.FileSystemProvider): theia.Disposable {
|
|
603
|
-
return fileSystemExt.registerFileSystemProvider(scheme, provider);
|
|
657
|
+
registerFileSystemProvider(scheme: string, provider: theia.FileSystemProvider, options?: { isCaseSensitive?: boolean, isReadonly?: boolean }): theia.Disposable {
|
|
658
|
+
return fileSystemExt.registerFileSystemProvider(scheme, provider, options);
|
|
604
659
|
},
|
|
605
660
|
getWorkspaceFolder(uri: theia.Uri): theia.WorkspaceFolder | undefined {
|
|
606
661
|
return workspaceExt.getWorkspaceFolder(uri);
|
|
@@ -620,6 +675,9 @@ export function createAPIFactory(
|
|
|
620
675
|
registerTimelineProvider(scheme: string | string[], provider: theia.TimelineProvider): theia.Disposable {
|
|
621
676
|
return timelineExt.registerTimelineProvider(plugin, scheme, provider);
|
|
622
677
|
},
|
|
678
|
+
registerNotebookSerializer(notebookType: string, serializer: theia.NotebookSerializer, options?: theia.NotebookDocumentContentOptions): theia.Disposable {
|
|
679
|
+
return Disposable.NULL;
|
|
680
|
+
},
|
|
623
681
|
get isTrusted(): boolean {
|
|
624
682
|
return workspaceExt.trusted;
|
|
625
683
|
},
|
|
@@ -715,6 +773,9 @@ export function createAPIFactory(
|
|
|
715
773
|
registerCompletionItemProvider(selector: theia.DocumentSelector, provider: theia.CompletionItemProvider, ...triggerCharacters: string[]): theia.Disposable {
|
|
716
774
|
return languagesExt.registerCompletionItemProvider(selector, provider, triggerCharacters, pluginToPluginInfo(plugin));
|
|
717
775
|
},
|
|
776
|
+
registerInlineCompletionItemProvider(selector: theia.DocumentSelector, provider: theia.InlineCompletionItemProvider): theia.Disposable {
|
|
777
|
+
return languagesExt.registerInlineCompletionsProvider(selector, provider);
|
|
778
|
+
},
|
|
718
779
|
registerDefinitionProvider(selector: theia.DocumentSelector, provider: theia.DefinitionProvider): theia.Disposable {
|
|
719
780
|
return languagesExt.registerDefinitionProvider(selector, provider, pluginToPluginInfo(plugin));
|
|
720
781
|
},
|
|
@@ -981,6 +1042,66 @@ export function createAPIFactory(
|
|
|
981
1042
|
}
|
|
982
1043
|
};
|
|
983
1044
|
|
|
1045
|
+
// notebooks API (@stubbed)
|
|
1046
|
+
// The following implementation is temporarily `@stubbed` and marked as such under `theia.d.ts`
|
|
1047
|
+
const notebooks: typeof theia.notebooks = {
|
|
1048
|
+
createNotebookController(
|
|
1049
|
+
id,
|
|
1050
|
+
notebookType,
|
|
1051
|
+
label,
|
|
1052
|
+
handler?: (cells: theia.NotebookCell[],
|
|
1053
|
+
notebook: theia.NotebookDocument,
|
|
1054
|
+
controller: theia.NotebookController) => void | Thenable<void>
|
|
1055
|
+
) {
|
|
1056
|
+
return {
|
|
1057
|
+
id,
|
|
1058
|
+
notebookType,
|
|
1059
|
+
label,
|
|
1060
|
+
handler,
|
|
1061
|
+
createNotebookCellExecution: (cell: NotebookCell) => ({
|
|
1062
|
+
cell,
|
|
1063
|
+
token: CancellationToken.None,
|
|
1064
|
+
executionOrder: undefined,
|
|
1065
|
+
start: () => undefined,
|
|
1066
|
+
end: () => undefined,
|
|
1067
|
+
clearOutput: () => ({} as Thenable<void>),
|
|
1068
|
+
replaceOutput: () => ({} as Thenable<void>),
|
|
1069
|
+
appendOutput: () => ({} as Thenable<void>),
|
|
1070
|
+
replaceOutputItems: () => ({} as Thenable<void>),
|
|
1071
|
+
appendOutputItems: () => ({} as Thenable<void>)
|
|
1072
|
+
}),
|
|
1073
|
+
executeHandler(
|
|
1074
|
+
cells: theia.NotebookCell[],
|
|
1075
|
+
notebook: theia.NotebookDocument,
|
|
1076
|
+
controller: theia.NotebookController
|
|
1077
|
+
): (void | Thenable<void>) { },
|
|
1078
|
+
onDidChangeSelectedNotebooks: ({} as theia.Event<{ readonly notebook: theia.NotebookDocument; readonly selected: boolean }>),
|
|
1079
|
+
updateNotebookAffinity: (notebook: theia.NotebookDocument, affinity: theia.NotebookControllerAffinity) => undefined,
|
|
1080
|
+
dispose: () => undefined,
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
},
|
|
1084
|
+
createRendererMessaging(
|
|
1085
|
+
rendererId
|
|
1086
|
+
) {
|
|
1087
|
+
return {
|
|
1088
|
+
rendererId,
|
|
1089
|
+
onDidReceiveMessage: ({} as theia.Event<{ readonly editor: theia.NotebookEditor; readonly message: any }>),
|
|
1090
|
+
postMessage: (message: any, editor?: theia.NotebookEditor) => ({} as Thenable<boolean>),
|
|
1091
|
+
};
|
|
1092
|
+
},
|
|
1093
|
+
registerNotebookCellStatusBarItemProvider(
|
|
1094
|
+
notebookType,
|
|
1095
|
+
provider
|
|
1096
|
+
) {
|
|
1097
|
+
return {
|
|
1098
|
+
notebookType,
|
|
1099
|
+
provider,
|
|
1100
|
+
dispose: () => undefined,
|
|
1101
|
+
};
|
|
1102
|
+
}
|
|
1103
|
+
};
|
|
1104
|
+
|
|
984
1105
|
return <typeof theia>{
|
|
985
1106
|
version: require('../../package.json').version,
|
|
986
1107
|
authentication,
|
|
@@ -995,6 +1116,7 @@ export function createAPIFactory(
|
|
|
995
1116
|
debug,
|
|
996
1117
|
tasks,
|
|
997
1118
|
scm,
|
|
1119
|
+
notebooks,
|
|
998
1120
|
tests,
|
|
999
1121
|
// Types
|
|
1000
1122
|
StatusBarAlignment: StatusBarAlignment,
|
|
@@ -1065,6 +1187,7 @@ export function createAPIFactory(
|
|
|
1065
1187
|
WorkspaceEdit,
|
|
1066
1188
|
SymbolInformation,
|
|
1067
1189
|
FileType,
|
|
1190
|
+
FilePermission,
|
|
1068
1191
|
FileChangeType,
|
|
1069
1192
|
ShellQuoting,
|
|
1070
1193
|
ShellExecution,
|
|
@@ -1120,11 +1243,26 @@ export function createAPIFactory(
|
|
|
1120
1243
|
InlayHint,
|
|
1121
1244
|
InlayHintKind,
|
|
1122
1245
|
InlayHintLabelPart,
|
|
1246
|
+
NotebookCellData,
|
|
1247
|
+
NotebookCellKind,
|
|
1248
|
+
NotebookCellOutput,
|
|
1249
|
+
NotebookCellOutputItem,
|
|
1250
|
+
NotebookCellStatusBarAlignment,
|
|
1251
|
+
NotebookCellStatusBarItem,
|
|
1252
|
+
NotebookControllerAffinity,
|
|
1253
|
+
NotebookData,
|
|
1254
|
+
NotebookEditorRevealType,
|
|
1255
|
+
NotebookDocument,
|
|
1256
|
+
NotebookRange,
|
|
1257
|
+
NotebookEdit,
|
|
1123
1258
|
TestRunProfileKind,
|
|
1124
1259
|
TestTag,
|
|
1125
1260
|
TestRunRequest,
|
|
1126
1261
|
TestMessage,
|
|
1127
|
-
ExtensionKind
|
|
1262
|
+
ExtensionKind,
|
|
1263
|
+
InlineCompletionItem,
|
|
1264
|
+
InlineCompletionList,
|
|
1265
|
+
InlineCompletionTriggerKind
|
|
1128
1266
|
};
|
|
1129
1267
|
};
|
|
1130
1268
|
}
|
package/src/plugin/theming.ts
CHANGED
|
@@ -22,7 +22,6 @@ import * as model from '../common/plugin-api-rpc-model';
|
|
|
22
22
|
import { MarkdownString } from './markdown-string';
|
|
23
23
|
import { MarkdownString as MarkdownStringInterface } from '@theia/core/lib/common/markdown-rendering';
|
|
24
24
|
import { TaskDto } from '../common/plugin-api-rpc';
|
|
25
|
-
import { TaskGroup } from './types-impl';
|
|
26
25
|
|
|
27
26
|
describe('Type converters:', () => {
|
|
28
27
|
|
|
@@ -185,8 +184,7 @@ describe('Type converters:', () => {
|
|
|
185
184
|
const args = ['run', 'build'];
|
|
186
185
|
const cwd = '/projects/theia';
|
|
187
186
|
const additionalProperty = 'some property';
|
|
188
|
-
const
|
|
189
|
-
const group = TaskGroup.Build;
|
|
187
|
+
const group = new types.TaskGroup('build', 'Build');
|
|
190
188
|
|
|
191
189
|
const shellTaskDto: TaskDto = {
|
|
192
190
|
type: shellType,
|
|
@@ -202,7 +200,10 @@ describe('Type converters:', () => {
|
|
|
202
200
|
reveal: 3,
|
|
203
201
|
focus: true
|
|
204
202
|
},
|
|
205
|
-
group:
|
|
203
|
+
group: {
|
|
204
|
+
kind: 'build',
|
|
205
|
+
isDefault: false
|
|
206
|
+
},
|
|
206
207
|
runOptions: {
|
|
207
208
|
reevaluateOnRerun: false
|
|
208
209
|
}
|
|
@@ -31,8 +31,6 @@ import { MarkdownString as MarkdownStringDTO } from '@theia/core/lib/common/mark
|
|
|
31
31
|
|
|
32
32
|
const SIDE_GROUP = -2;
|
|
33
33
|
const ACTIVE_GROUP = -1;
|
|
34
|
-
const BUILD_GROUP = 'build';
|
|
35
|
-
const TEST_GROUP = 'test';
|
|
36
34
|
|
|
37
35
|
export function toViewColumn(ep?: EditorPosition): theia.ViewColumn | undefined {
|
|
38
36
|
if (typeof ep !== 'number') {
|
|
@@ -846,11 +844,11 @@ export function fromTask(task: theia.Task): TaskDto | undefined {
|
|
|
846
844
|
taskDto.presentation = task.presentationOptions;
|
|
847
845
|
}
|
|
848
846
|
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
847
|
+
if (task.group) {
|
|
848
|
+
taskDto.group = {
|
|
849
|
+
kind: <rpc.TaskGroupKind>task.group.id,
|
|
850
|
+
isDefault: !!task.group.isDefault
|
|
851
|
+
};
|
|
854
852
|
}
|
|
855
853
|
|
|
856
854
|
const taskDefinition = task.definition;
|
|
@@ -936,11 +934,11 @@ export function toTask(taskDto: TaskDto): theia.Task {
|
|
|
936
934
|
}
|
|
937
935
|
|
|
938
936
|
if (group) {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
937
|
+
result.group = new types.TaskGroup(
|
|
938
|
+
group.kind,
|
|
939
|
+
group.kind,
|
|
940
|
+
group.isDefault
|
|
941
|
+
);
|
|
944
942
|
}
|
|
945
943
|
|
|
946
944
|
if (presentation) {
|