monaco-languageclient 1.0.0 → 2.0.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/amd/console-window.d.ts +5 -4
- package/dist/amd/console-window.d.ts.map +1 -1
- package/dist/amd/console-window.js +17 -7
- package/dist/amd/console-window.js.map +1 -1
- package/dist/amd/disposable.d.ts +1 -1
- package/dist/amd/disposable.d.ts.map +1 -1
- package/dist/amd/disposable.js +6 -2
- package/dist/amd/disposable.js.map +1 -1
- package/dist/amd/index.d.ts +2 -5
- package/dist/amd/index.d.ts.map +1 -1
- package/dist/amd/index.js +7 -6
- package/dist/amd/index.js.map +1 -1
- package/dist/amd/monaco-language-client.d.ts +9 -3
- package/dist/amd/monaco-language-client.d.ts.map +1 -1
- package/dist/amd/monaco-language-client.js +60 -41
- package/dist/amd/monaco-language-client.js.map +1 -1
- package/dist/amd/monaco-services.d.ts +6 -10
- package/dist/amd/monaco-services.d.ts.map +1 -1
- package/dist/amd/monaco-services.js +6 -13
- package/dist/amd/monaco-services.js.map +1 -1
- package/dist/amd/monaco-workspace.d.ts +6 -28
- package/dist/amd/monaco-workspace.d.ts.map +1 -1
- package/dist/amd/monaco-workspace.js +4 -121
- package/dist/amd/monaco-workspace.js.map +1 -1
- package/lib/console-window.d.ts +5 -4
- package/lib/console-window.d.ts.map +1 -1
- package/lib/console-window.js +17 -7
- package/lib/console-window.js.map +1 -1
- package/lib/disposable.d.ts +1 -1
- package/lib/disposable.d.ts.map +1 -1
- package/lib/disposable.js +4 -4
- package/lib/disposable.js.map +1 -1
- package/lib/index.d.ts +2 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -5
- package/lib/index.js.map +1 -1
- package/lib/monaco-language-client.d.ts +9 -3
- package/lib/monaco-language-client.d.ts.map +1 -1
- package/lib/monaco-language-client.js +86 -40
- package/lib/monaco-language-client.js.map +1 -1
- package/lib/monaco-services.d.ts +6 -10
- package/lib/monaco-services.d.ts.map +1 -1
- package/lib/monaco-services.js +10 -17
- package/lib/monaco-services.js.map +1 -1
- package/lib/monaco-workspace.d.ts +6 -28
- package/lib/monaco-workspace.d.ts.map +1 -1
- package/lib/monaco-workspace.js +3 -123
- package/lib/monaco-workspace.js.map +1 -1
- package/package.json +13 -12
- package/src/console-window.ts +21 -10
- package/src/disposable.ts +2 -1
- package/src/index.ts +5 -5
- package/src/monaco-language-client.ts +99 -46
- package/src/monaco-services.ts +9 -23
- package/src/monaco-workspace.ts +6 -154
- package/dist/amd/connection.d.ts +0 -53
- package/dist/amd/connection.d.ts.map +0 -1
- package/dist/amd/connection.js +0 -41
- package/dist/amd/connection.js.map +0 -1
- package/dist/amd/monaco-commands.d.ts +0 -8
- package/dist/amd/monaco-commands.d.ts.map +0 -1
- package/dist/amd/monaco-commands.js +0 -15
- package/dist/amd/monaco-commands.js.map +0 -1
- package/dist/amd/monaco-converter.d.ts +0 -225
- package/dist/amd/monaco-converter.d.ts.map +0 -1
- package/dist/amd/monaco-converter.js +0 -1173
- package/dist/amd/monaco-converter.js.map +0 -1
- package/dist/amd/monaco-diagnostic-collection.d.ts +0 -32
- package/dist/amd/monaco-diagnostic-collection.d.ts.map +0 -1
- package/dist/amd/monaco-diagnostic-collection.js +0 -76
- package/dist/amd/monaco-diagnostic-collection.js.map +0 -1
- package/dist/amd/monaco-languages.d.ts +0 -70
- package/dist/amd/monaco-languages.d.ts.map +0 -1
- package/dist/amd/monaco-languages.js +0 -503
- package/dist/amd/monaco-languages.js.map +0 -1
- package/dist/amd/register-vscode.d.ts +0 -2
- package/dist/amd/register-vscode.d.ts.map +0 -1
- package/dist/amd/register-vscode.js +0 -16
- package/dist/amd/register-vscode.js.map +0 -1
- package/dist/amd/services.d.ts +0 -234
- package/dist/amd/services.d.ts.map +0 -1
- package/dist/amd/services.js +0 -69
- package/dist/amd/services.js.map +0 -1
- package/dist/amd/vscode-api.d.ts +0 -4
- package/dist/amd/vscode-api.d.ts.map +0 -1
- package/dist/amd/vscode-api.js +0 -1018
- package/dist/amd/vscode-api.js.map +0 -1
- package/dist/amd/vscode-compatibility.d.ts +0 -4
- package/dist/amd/vscode-compatibility.d.ts.map +0 -1
- package/dist/amd/vscode-compatibility.js +0 -5
- package/dist/amd/vscode-compatibility.js.map +0 -1
- package/lib/connection.d.ts +0 -53
- package/lib/connection.d.ts.map +0 -1
- package/lib/connection.js +0 -41
- package/lib/connection.js.map +0 -1
- package/lib/monaco-commands.d.ts +0 -8
- package/lib/monaco-commands.d.ts.map +0 -1
- package/lib/monaco-commands.js +0 -13
- package/lib/monaco-commands.js.map +0 -1
- package/lib/monaco-converter.d.ts +0 -225
- package/lib/monaco-converter.d.ts.map +0 -1
- package/lib/monaco-converter.js +0 -1173
- package/lib/monaco-converter.js.map +0 -1
- package/lib/monaco-diagnostic-collection.d.ts +0 -32
- package/lib/monaco-diagnostic-collection.d.ts.map +0 -1
- package/lib/monaco-diagnostic-collection.js +0 -75
- package/lib/monaco-diagnostic-collection.js.map +0 -1
- package/lib/monaco-languages.d.ts +0 -70
- package/lib/monaco-languages.d.ts.map +0 -1
- package/lib/monaco-languages.js +0 -504
- package/lib/monaco-languages.js.map +0 -1
- package/lib/register-vscode.d.ts +0 -2
- package/lib/register-vscode.d.ts.map +0 -1
- package/lib/register-vscode.js +0 -15
- package/lib/register-vscode.js.map +0 -1
- package/lib/services.d.ts +0 -234
- package/lib/services.d.ts.map +0 -1
- package/lib/services.js +0 -70
- package/lib/services.js.map +0 -1
- package/lib/vscode-api.d.ts +0 -4
- package/lib/vscode-api.d.ts.map +0 -1
- package/lib/vscode-api.js +0 -1021
- package/lib/vscode-api.js.map +0 -1
- package/lib/vscode-compatibility.d.ts +0 -4
- package/lib/vscode-compatibility.d.ts.map +0 -1
- package/lib/vscode-compatibility.js +0 -9
- package/lib/vscode-compatibility.js.map +0 -1
- package/src/connection.ts +0 -134
- package/src/monaco-commands.ts +0 -15
- package/src/monaco-converter.ts +0 -1317
- package/src/monaco-diagnostic-collection.ts +0 -94
- package/src/monaco-languages.ts +0 -571
- package/src/register-vscode.ts +0 -13
- package/src/services.ts +0 -326
- package/src/typings/monaco/index.d.ts +0 -21
- package/src/vscode-api.ts +0 -1047
- package/src/vscode-compatibility.ts +0 -8
package/src/vscode-api.ts
DELETED
|
@@ -1,1047 +0,0 @@
|
|
|
1
|
-
/* --------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
* ------------------------------------------------------------------------------------------ */
|
|
5
|
-
|
|
6
|
-
import type * as vscode from "vscode";
|
|
7
|
-
import { URI } from "vscode-uri"
|
|
8
|
-
import { Disposable } from "./disposable";
|
|
9
|
-
import {
|
|
10
|
-
Services, Event, DiagnosticCollection, WorkspaceEdit,
|
|
11
|
-
MessageType, OutputChannel, CompletionTriggerKind, DocumentIdentifier,
|
|
12
|
-
SignatureHelpTriggerKind,
|
|
13
|
-
MessageActionItem
|
|
14
|
-
} from "./services";
|
|
15
|
-
import * as ServicesModule from "./services";
|
|
16
|
-
import { CancellationTokenSource, DiagnosticSeverity, DocumentSelector, Diagnostic as ProtocolDiagnostics } from "vscode-languageserver-protocol";
|
|
17
|
-
|
|
18
|
-
export function createVSCodeApi(servicesProvider: Services.Provider): typeof vscode {
|
|
19
|
-
const unsupported = () => { throw new Error('unsupported') };
|
|
20
|
-
const Uri: typeof vscode.Uri = class VSCodeUri extends URI {
|
|
21
|
-
static joinPath(uri: URI, ...pathFragment: string[]): URI {
|
|
22
|
-
return unsupported();
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
class CompletionItem implements vscode.CompletionItem {
|
|
26
|
-
constructor(public label: string, public kind?: vscode.CompletionItemKind) { }
|
|
27
|
-
}
|
|
28
|
-
class CodeLens implements vscode.CodeLens {
|
|
29
|
-
constructor(
|
|
30
|
-
public range: vscode.Range,
|
|
31
|
-
public command?: vscode.Command
|
|
32
|
-
) { }
|
|
33
|
-
|
|
34
|
-
get isResolved(): boolean {
|
|
35
|
-
return !!this.command;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
class DocumentLink implements vscode.DocumentLink {
|
|
39
|
-
constructor(public range: vscode.Range, public target?: vscode.Uri) { }
|
|
40
|
-
}
|
|
41
|
-
class CodeActionKind implements vscode.CodeActionKind {
|
|
42
|
-
private static readonly sep = '.';
|
|
43
|
-
|
|
44
|
-
static Empty = new CodeActionKind('');
|
|
45
|
-
static QuickFix = new CodeActionKind('quickfix');
|
|
46
|
-
static Refactor = new CodeActionKind('refactor');
|
|
47
|
-
static RefactorExtract = CodeActionKind.Refactor.append('extract');
|
|
48
|
-
static RefactorInline = CodeActionKind.Refactor.append('inline');
|
|
49
|
-
static RefactorRewrite = CodeActionKind.Refactor.append('rewrite');
|
|
50
|
-
static Source = new CodeActionKind('source');
|
|
51
|
-
static SourceOrganizeImports = CodeActionKind.Source.append('organizeImports');
|
|
52
|
-
static SourceFixAll = CodeActionKind.Source.append('fixAll');
|
|
53
|
-
private constructor(readonly value: string) { }
|
|
54
|
-
public append(parts: string): CodeActionKind {
|
|
55
|
-
return new CodeActionKind(this.value ? this.value + CodeActionKind.sep + parts : parts);
|
|
56
|
-
}
|
|
57
|
-
contains = unsupported
|
|
58
|
-
intersects = unsupported
|
|
59
|
-
}
|
|
60
|
-
class Diagnostic implements vscode.Diagnostic {
|
|
61
|
-
source?: string;
|
|
62
|
-
code?: string | number;
|
|
63
|
-
relatedInformation?: vscode.DiagnosticRelatedInformation[]
|
|
64
|
-
tags?: vscode.DiagnosticTag[]
|
|
65
|
-
constructor(readonly range: vscode.Range, readonly message: string, readonly severity: DiagnosticSeverity = DiagnosticSeverity.Error) { }
|
|
66
|
-
}
|
|
67
|
-
class CallHierarchyItem implements vscode.CallHierarchyItem {
|
|
68
|
-
_sessionId?: string;
|
|
69
|
-
_itemId?: string;
|
|
70
|
-
constructor(readonly kind: vscode.SymbolKind, readonly name: string, readonly detail: string, readonly uri: vscode.Uri, readonly range: vscode.Range, readonly selectionRange: vscode.Range) { }
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
class TypeHierarchyItem implements vscode.TypeHierarchyItem {
|
|
74
|
-
_sessionId?: string;
|
|
75
|
-
_itemId?: string;
|
|
76
|
-
constructor(readonly kind: vscode.SymbolKind, readonly name: string, readonly detail: string, readonly uri: URI, readonly range: vscode.Range, readonly selectionRange: vscode.Range) { }
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
class SymbolInformation implements vscode.SymbolInformation {
|
|
80
|
-
location: vscode.Location;
|
|
81
|
-
tags?: vscode.SymbolTag[];
|
|
82
|
-
readonly containerName: string
|
|
83
|
-
constructor(readonly name: string, readonly kind: vscode.SymbolKind, rangeOrContainer: string | undefined | vscode.Range, locationOrUri?: vscode.Location | vscode.Uri, containerName?: string) {
|
|
84
|
-
this.containerName = containerName!
|
|
85
|
-
if (typeof rangeOrContainer === 'string') {
|
|
86
|
-
this.containerName = rangeOrContainer;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
class InlayHint implements vscode.InlayHint {
|
|
92
|
-
constructor(readonly position: vscode.Position, readonly label: string | vscode.InlayHintLabelPart[], readonly kind?: vscode.InlayHintKind) { }
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
class CancellationError extends Error {
|
|
96
|
-
constructor() {
|
|
97
|
-
super('Canceled');
|
|
98
|
-
this.name = this.message;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
class CodeAction implements vscode.CodeAction {
|
|
103
|
-
edit?: vscode.WorkspaceEdit;
|
|
104
|
-
diagnostics?: Diagnostic[];
|
|
105
|
-
command?: vscode.Command;
|
|
106
|
-
isPreferred?: boolean;
|
|
107
|
-
disabled?: {
|
|
108
|
-
readonly reason: string;
|
|
109
|
-
};
|
|
110
|
-
constructor(readonly title: string, readonly kind?: CodeActionKind) { }
|
|
111
|
-
}
|
|
112
|
-
class SemanticTokens implements vscode.SemanticTokens {
|
|
113
|
-
constructor(public data: Uint32Array, public resultId: string) { }
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
class EmptyFileSystem implements vscode.FileSystem {
|
|
117
|
-
isWritableFileSystem(scheme: string): boolean | undefined {
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
stat(uri: vscode.Uri): Thenable<vscode.FileStat> {
|
|
121
|
-
throw new Error("Method not implemented.");
|
|
122
|
-
}
|
|
123
|
-
readDirectory(uri: vscode.Uri): Thenable<[string, vscode.FileType][]> {
|
|
124
|
-
return Promise.resolve([]);
|
|
125
|
-
}
|
|
126
|
-
createDirectory(uri: vscode.Uri): Thenable<void> {
|
|
127
|
-
return Promise.resolve();
|
|
128
|
-
}
|
|
129
|
-
readFile(uri: vscode.Uri): Thenable<Uint8Array> {
|
|
130
|
-
return Promise.resolve(new Uint8Array(0));
|
|
131
|
-
}
|
|
132
|
-
writeFile(uri: vscode.Uri, content: Uint8Array): Thenable<void> {
|
|
133
|
-
return Promise.resolve();
|
|
134
|
-
}
|
|
135
|
-
delete(uri: vscode.Uri,
|
|
136
|
-
options?: { recursive?: boolean | undefined; useTrash?: boolean | undefined; } | undefined): Thenable<void> {
|
|
137
|
-
return Promise.resolve();
|
|
138
|
-
}
|
|
139
|
-
rename(source: vscode.Uri,
|
|
140
|
-
target: vscode.Uri,
|
|
141
|
-
options?: { overwrite?: boolean | undefined; } | undefined): Thenable<void> {
|
|
142
|
-
return Promise.resolve();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
copy(source: vscode.Uri,
|
|
146
|
-
target: vscode.Uri,
|
|
147
|
-
options?: { overwrite?: boolean | undefined; } | undefined): Thenable<void> {
|
|
148
|
-
return Promise.resolve();
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
enum TextDocumentChangeReason {
|
|
153
|
-
/** The text change is caused by an undo operation. */
|
|
154
|
-
Undo = 1,
|
|
155
|
-
|
|
156
|
-
/** The text change is caused by an redo operation. */
|
|
157
|
-
Redo = 2,
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const workspace: typeof vscode.workspace = {
|
|
161
|
-
fs: new EmptyFileSystem(),
|
|
162
|
-
workspaceFile: undefined,
|
|
163
|
-
createFileSystemWatcher(globPattern, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents): vscode.FileSystemWatcher {
|
|
164
|
-
const services = servicesProvider();
|
|
165
|
-
if (typeof globPattern !== 'string') {
|
|
166
|
-
throw new Error('unsupported');
|
|
167
|
-
}
|
|
168
|
-
if (services.workspace.createFileSystemWatcher) {
|
|
169
|
-
const watcher = services.workspace.createFileSystemWatcher(globPattern, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents);
|
|
170
|
-
return Object.assign(watcher, {
|
|
171
|
-
ignoreCreateEvents: !!ignoreCreateEvents,
|
|
172
|
-
ignoreChangeEvents: !!ignoreChangeEvents,
|
|
173
|
-
ignoreDeleteEvents: !!ignoreDeleteEvents,
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
return {
|
|
177
|
-
ignoreCreateEvents: !!ignoreCreateEvents,
|
|
178
|
-
ignoreChangeEvents: !!ignoreChangeEvents,
|
|
179
|
-
ignoreDeleteEvents: !!ignoreDeleteEvents,
|
|
180
|
-
onDidCreate: Event.None,
|
|
181
|
-
onDidChange: Event.None,
|
|
182
|
-
onDidDelete: Event.None,
|
|
183
|
-
dispose: () => { }
|
|
184
|
-
};
|
|
185
|
-
},
|
|
186
|
-
applyEdit: async (edit) => {
|
|
187
|
-
const services = servicesProvider();
|
|
188
|
-
if (WorkspaceEdit.is(edit)) {
|
|
189
|
-
return services.workspace.applyEdit(edit);
|
|
190
|
-
}
|
|
191
|
-
throw new Error('unsupported');
|
|
192
|
-
},
|
|
193
|
-
getConfiguration(section, resource): vscode.WorkspaceConfiguration {
|
|
194
|
-
const { workspace } = servicesProvider();
|
|
195
|
-
const configuration = workspace.configurations ?
|
|
196
|
-
workspace.configurations.getConfiguration(section, resource ? resource.toString() : undefined) :
|
|
197
|
-
undefined;
|
|
198
|
-
const result: vscode.WorkspaceConfiguration = {
|
|
199
|
-
get: (section: string, defaultValue?: any) => {
|
|
200
|
-
return configuration ? configuration.get(section, defaultValue) : defaultValue;
|
|
201
|
-
},
|
|
202
|
-
has: (section: string) => {
|
|
203
|
-
return configuration ? configuration.has(section) : false;
|
|
204
|
-
},
|
|
205
|
-
inspect: unsupported,
|
|
206
|
-
update: unsupported
|
|
207
|
-
};
|
|
208
|
-
return Object.assign(result, {
|
|
209
|
-
toJSON: () => configuration ? configuration.toJSON() : undefined
|
|
210
|
-
});
|
|
211
|
-
},
|
|
212
|
-
get onDidChangeConfiguration(): typeof vscode.workspace.onDidChangeConfiguration {
|
|
213
|
-
const services = servicesProvider();
|
|
214
|
-
if (services.workspace.configurations) {
|
|
215
|
-
return services.workspace.configurations.onDidChangeConfiguration;
|
|
216
|
-
}
|
|
217
|
-
return Event.None;
|
|
218
|
-
},
|
|
219
|
-
get workspaceFolders(): typeof vscode.workspace.workspaceFolders {
|
|
220
|
-
const services = servicesProvider();
|
|
221
|
-
if ('workspaceFolders' in services.workspace) {
|
|
222
|
-
return services.workspace.workspaceFolders;
|
|
223
|
-
}
|
|
224
|
-
const rootUri = services.workspace.rootUri;
|
|
225
|
-
if (!rootUri) {
|
|
226
|
-
return undefined;
|
|
227
|
-
}
|
|
228
|
-
const uri = Uri.parse(rootUri);
|
|
229
|
-
return [{
|
|
230
|
-
uri,
|
|
231
|
-
index: 0,
|
|
232
|
-
name: uri.toString()
|
|
233
|
-
}];
|
|
234
|
-
},
|
|
235
|
-
get onDidChangeWorkspaceFolders(): typeof vscode.workspace.onDidChangeWorkspaceFolders {
|
|
236
|
-
const services = servicesProvider();
|
|
237
|
-
return services.workspace.onDidChangeWorkspaceFolders || Event.None;
|
|
238
|
-
},
|
|
239
|
-
get textDocuments(): typeof vscode.workspace.textDocuments {
|
|
240
|
-
const services = servicesProvider();
|
|
241
|
-
return services.workspace.textDocuments as any;
|
|
242
|
-
},
|
|
243
|
-
get onDidOpenTextDocument(): typeof vscode.workspace.onDidOpenTextDocument {
|
|
244
|
-
const services = servicesProvider();
|
|
245
|
-
return services.workspace.onDidOpenTextDocument as any;
|
|
246
|
-
},
|
|
247
|
-
get onDidCloseTextDocument(): typeof vscode.workspace.onDidCloseTextDocument {
|
|
248
|
-
const services = servicesProvider();
|
|
249
|
-
return services.workspace.onDidCloseTextDocument as any;
|
|
250
|
-
},
|
|
251
|
-
get onDidChangeTextDocument(): typeof vscode.workspace.onDidChangeTextDocument {
|
|
252
|
-
const services = servicesProvider();
|
|
253
|
-
return (listener: (e: vscode.TextDocumentChangeEvent) => any, thisArgs?: any, disposables?: Disposable[]): Disposable => {
|
|
254
|
-
return services.workspace.onDidChangeTextDocument(({ textDocument, contentChanges, isRedoing, isUndoing }) => {
|
|
255
|
-
const l: (e: vscode.TextDocumentChangeEvent) => any = listener.bind(thisArgs);
|
|
256
|
-
l({
|
|
257
|
-
document: <any>textDocument,
|
|
258
|
-
contentChanges: <any>contentChanges,
|
|
259
|
-
reason: isUndoing ? TextDocumentChangeReason.Undo : isRedoing ? TextDocumentChangeReason.Redo : undefined
|
|
260
|
-
});
|
|
261
|
-
}, undefined, disposables);
|
|
262
|
-
};
|
|
263
|
-
},
|
|
264
|
-
get onWillSaveTextDocument(): typeof vscode.workspace.onWillSaveTextDocument {
|
|
265
|
-
const services = servicesProvider();
|
|
266
|
-
const onWillSaveTextDocument = services.workspace.onWillSaveTextDocument;
|
|
267
|
-
if (!onWillSaveTextDocument) {
|
|
268
|
-
return Event.None;
|
|
269
|
-
}
|
|
270
|
-
return (listener: (e: vscode.TextDocumentWillSaveEvent) => any, thisArgs?: any, disposables?: Disposable[]): Disposable => {
|
|
271
|
-
return onWillSaveTextDocument(({ textDocument, reason, waitUntil }) => {
|
|
272
|
-
const l: (e: vscode.TextDocumentWillSaveEvent) => any = listener.bind(thisArgs);
|
|
273
|
-
l({
|
|
274
|
-
document: <any>textDocument,
|
|
275
|
-
reason: reason,
|
|
276
|
-
waitUntil: (edits: PromiseLike<vscode.TextEdit[]>) => {
|
|
277
|
-
if (waitUntil) {
|
|
278
|
-
waitUntil(edits);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
}, undefined, disposables);
|
|
283
|
-
};
|
|
284
|
-
},
|
|
285
|
-
get onDidSaveTextDocument(): typeof vscode.workspace.onDidSaveTextDocument {
|
|
286
|
-
const services = servicesProvider();
|
|
287
|
-
return (services.workspace.onDidSaveTextDocument as any) || Event.None;
|
|
288
|
-
},
|
|
289
|
-
|
|
290
|
-
get onWillCreateFiles(): vscode.Event<vscode.FileWillCreateEvent> {
|
|
291
|
-
return Event.None;
|
|
292
|
-
},
|
|
293
|
-
|
|
294
|
-
get onDidCreateFiles(): vscode.Event<vscode.FileCreateEvent> {
|
|
295
|
-
return Event.None;
|
|
296
|
-
},
|
|
297
|
-
|
|
298
|
-
get onWillDeleteFiles(): vscode.Event<vscode.FileWillDeleteEvent> {
|
|
299
|
-
return Event.None;
|
|
300
|
-
},
|
|
301
|
-
|
|
302
|
-
get onDidDeleteFiles(): vscode.Event<vscode.FileDeleteEvent> {
|
|
303
|
-
return Event.None;
|
|
304
|
-
},
|
|
305
|
-
|
|
306
|
-
get onWillRenameFiles(): vscode.Event<vscode.FileWillRenameEvent> {
|
|
307
|
-
return Event.None;
|
|
308
|
-
},
|
|
309
|
-
|
|
310
|
-
get onDidRenameFiles(): vscode.Event<vscode.FileRenameEvent> {
|
|
311
|
-
return Event.None;
|
|
312
|
-
},
|
|
313
|
-
|
|
314
|
-
get onDidGrantWorkspaceTrust(): vscode.Event<void> {
|
|
315
|
-
return Event.None;
|
|
316
|
-
},
|
|
317
|
-
|
|
318
|
-
getWorkspaceFolder: unsupported,
|
|
319
|
-
asRelativePath: unsupported,
|
|
320
|
-
updateWorkspaceFolders: unsupported,
|
|
321
|
-
findFiles: unsupported,
|
|
322
|
-
saveAll: unsupported,
|
|
323
|
-
openTextDocument: unsupported,
|
|
324
|
-
registerTextDocumentContentProvider: unsupported,
|
|
325
|
-
registerTaskProvider: unsupported,
|
|
326
|
-
registerFileSystemProvider: unsupported,
|
|
327
|
-
openNotebookDocument: unsupported,
|
|
328
|
-
registerNotebookSerializer: unsupported,
|
|
329
|
-
notebookDocuments: [],
|
|
330
|
-
onDidOpenNotebookDocument: unsupported,
|
|
331
|
-
onDidCloseNotebookDocument: unsupported,
|
|
332
|
-
isTrusted: true,
|
|
333
|
-
rootPath: undefined,
|
|
334
|
-
name: undefined,
|
|
335
|
-
onDidChangeNotebookDocument: unsupported,
|
|
336
|
-
onDidSaveNotebookDocument: unsupported
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
function isVsCodeUri(v: vscode.Uri | ReadonlyArray<[vscode.Uri, ReadonlyArray<vscode.Diagnostic> | undefined]>): v is vscode.Uri {
|
|
340
|
-
return (v instanceof URI) !== undefined;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
class ApiDiagnosticCollection implements vscode.DiagnosticCollection {
|
|
344
|
-
readonly name: string;
|
|
345
|
-
private readonly services: Services;
|
|
346
|
-
private readonly collection: DiagnosticCollection | undefined;
|
|
347
|
-
|
|
348
|
-
constructor(name?: string) {
|
|
349
|
-
this.name = name || 'default',
|
|
350
|
-
this.services = servicesProvider();
|
|
351
|
-
this.collection = this.services.languages.createDiagnosticCollection
|
|
352
|
-
? this.services.languages.createDiagnosticCollection(name)
|
|
353
|
-
: undefined;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
entries() {
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
set(entries: ReadonlyArray<[vscode.Uri, ReadonlyArray<vscode.Diagnostic> | undefined]>): void;
|
|
360
|
-
set(uri: vscode.Uri, arg1: ReadonlyArray<vscode.Diagnostic> | undefined): void;
|
|
361
|
-
set(arg0: vscode.Uri | ReadonlyArray<[vscode.Uri, ReadonlyArray<vscode.Diagnostic> | undefined]>,
|
|
362
|
-
arg1?: ReadonlyArray<vscode.Diagnostic>): void {
|
|
363
|
-
|
|
364
|
-
if (isVsCodeUri(arg0)) {
|
|
365
|
-
if (this.collection) {
|
|
366
|
-
this.collection.set(arg0.toString(), arg1 as unknown as ProtocolDiagnostics[] ?? []);
|
|
367
|
-
}
|
|
368
|
-
} else {
|
|
369
|
-
arg0.forEach(element => {
|
|
370
|
-
this.set(element[0], element[1]);
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
dispose(): void {
|
|
376
|
-
if (this.collection) {
|
|
377
|
-
this.collection.dispose();
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
delete(uri: vscode.Uri) { }
|
|
382
|
-
clear() { }
|
|
383
|
-
forEach(callback: any, thisArg?: any) { }
|
|
384
|
-
get(uri: vscode.Uri) { return undefined; }
|
|
385
|
-
has(uri: vscode.Uri) { return false; }
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
const languages: typeof vscode.languages = {
|
|
389
|
-
match(selector, document): number {
|
|
390
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
391
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
392
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
393
|
-
}
|
|
394
|
-
if (!DocumentIdentifier.is(document)) {
|
|
395
|
-
throw new Error('unexpected document: ' + JSON.stringify(document));
|
|
396
|
-
}
|
|
397
|
-
const services = servicesProvider();
|
|
398
|
-
const result = services.languages.match(documentSelector, document);
|
|
399
|
-
return result ? 1 : 0;
|
|
400
|
-
},
|
|
401
|
-
registerCallHierarchyProvider(
|
|
402
|
-
selector: vscode.DocumentSelector,
|
|
403
|
-
provider: vscode.CallHierarchyProvider): vscode.Disposable {
|
|
404
|
-
|
|
405
|
-
/* empty stub for now */
|
|
406
|
-
return {
|
|
407
|
-
dispose(): void {
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
},
|
|
411
|
-
createDiagnosticCollection(name?: string): vscode.DiagnosticCollection {
|
|
412
|
-
return new ApiDiagnosticCollection(name);
|
|
413
|
-
},
|
|
414
|
-
registerCompletionItemProvider(selector, provider, ...triggerCharacters) {
|
|
415
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
416
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
417
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
418
|
-
}
|
|
419
|
-
const { languages } = servicesProvider();
|
|
420
|
-
if (!languages.registerCompletionItemProvider) {
|
|
421
|
-
return Disposable.create(() => { });
|
|
422
|
-
}
|
|
423
|
-
const resolveCompletionItem = provider.resolveCompletionItem;
|
|
424
|
-
return languages.registerCompletionItemProvider(documentSelector, {
|
|
425
|
-
provideCompletionItems({ textDocument, position, context }, token) {
|
|
426
|
-
return provider.provideCompletionItems(<any>textDocument, <any>position, token, {
|
|
427
|
-
triggerKind: context?.triggerKind ?? CompletionTriggerKind.Invoked,
|
|
428
|
-
triggerCharacter: context?.triggerCharacter
|
|
429
|
-
}) as any;
|
|
430
|
-
},
|
|
431
|
-
resolveCompletionItem: resolveCompletionItem ? (item, token) => {
|
|
432
|
-
return resolveCompletionItem(item as any, token) as any;
|
|
433
|
-
} : undefined
|
|
434
|
-
}, ...triggerCharacters);
|
|
435
|
-
},
|
|
436
|
-
registerCodeActionsProvider(selector, provider) {
|
|
437
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
438
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
439
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
440
|
-
}
|
|
441
|
-
const { languages } = servicesProvider();
|
|
442
|
-
if (!languages.registerCodeActionsProvider) {
|
|
443
|
-
return Disposable.create(() => { });
|
|
444
|
-
}
|
|
445
|
-
return languages.registerCodeActionsProvider(documentSelector, {
|
|
446
|
-
provideCodeActions({ textDocument, range, context }, token) {
|
|
447
|
-
return provider.provideCodeActions(<any>textDocument, <any>range, <any>context, token) as any;
|
|
448
|
-
},
|
|
449
|
-
resolveCodeAction: provider.resolveCodeAction ? (codeAction, token) => {
|
|
450
|
-
return provider.resolveCodeAction!(<any>codeAction, <any>token) as any
|
|
451
|
-
} : undefined
|
|
452
|
-
});
|
|
453
|
-
},
|
|
454
|
-
registerCodeLensProvider(selector, provider) {
|
|
455
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
456
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
457
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
458
|
-
}
|
|
459
|
-
const { languages } = servicesProvider();
|
|
460
|
-
if (!languages.registerCodeLensProvider) {
|
|
461
|
-
return Disposable.create(() => { });
|
|
462
|
-
}
|
|
463
|
-
const resolveCodeLens = provider.resolveCodeLens;
|
|
464
|
-
return languages.registerCodeLensProvider(documentSelector, {
|
|
465
|
-
provideCodeLenses({ textDocument }, token) {
|
|
466
|
-
return provider.provideCodeLenses(<any>textDocument, token) as any;
|
|
467
|
-
},
|
|
468
|
-
resolveCodeLens: resolveCodeLens ? (codeLens, token) => {
|
|
469
|
-
return resolveCodeLens(<any>codeLens, token) as any;
|
|
470
|
-
} : undefined
|
|
471
|
-
});
|
|
472
|
-
},
|
|
473
|
-
registerDefinitionProvider(selector, provider) {
|
|
474
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
475
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
476
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
477
|
-
}
|
|
478
|
-
const { languages } = servicesProvider();
|
|
479
|
-
if (!languages.registerDefinitionProvider) {
|
|
480
|
-
return Disposable.create(() => { });
|
|
481
|
-
}
|
|
482
|
-
return languages.registerDefinitionProvider(documentSelector, {
|
|
483
|
-
provideDefinition({ textDocument, position }, token) {
|
|
484
|
-
return provider.provideDefinition(<any>textDocument, <any>position, token) as any;
|
|
485
|
-
}
|
|
486
|
-
});
|
|
487
|
-
},
|
|
488
|
-
registerImplementationProvider(selector, provider) {
|
|
489
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
490
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
491
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
492
|
-
}
|
|
493
|
-
const { languages } = servicesProvider();
|
|
494
|
-
if (!languages.registerImplementationProvider) {
|
|
495
|
-
return Disposable.create(() => { });
|
|
496
|
-
}
|
|
497
|
-
return languages.registerImplementationProvider(documentSelector, {
|
|
498
|
-
provideImplementation({ textDocument, position }, token) {
|
|
499
|
-
return provider.provideImplementation(<any>textDocument, <any>position, token) as any;
|
|
500
|
-
}
|
|
501
|
-
});
|
|
502
|
-
},
|
|
503
|
-
registerTypeDefinitionProvider(selector, provider) {
|
|
504
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
505
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
506
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
507
|
-
}
|
|
508
|
-
const { languages } = servicesProvider();
|
|
509
|
-
if (!languages.registerTypeDefinitionProvider) {
|
|
510
|
-
return Disposable.create(() => { });
|
|
511
|
-
}
|
|
512
|
-
return languages.registerTypeDefinitionProvider(documentSelector, {
|
|
513
|
-
provideTypeDefinition({ textDocument, position }, token) {
|
|
514
|
-
return provider.provideTypeDefinition(<any>textDocument, <any>position, token) as any;
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
},
|
|
518
|
-
registerDeclarationProvider(selector, provider) {
|
|
519
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
520
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
521
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
522
|
-
}
|
|
523
|
-
const { languages } = servicesProvider();
|
|
524
|
-
if (!languages.registerDeclarationProvider) {
|
|
525
|
-
return Disposable.create(() => { });
|
|
526
|
-
}
|
|
527
|
-
return languages.registerDeclarationProvider(documentSelector, {
|
|
528
|
-
provideDeclaration({ textDocument, position }, token) {
|
|
529
|
-
return provider.provideDeclaration(<any>textDocument, <any>position, token) as any;
|
|
530
|
-
}
|
|
531
|
-
})
|
|
532
|
-
},
|
|
533
|
-
registerHoverProvider(selector, provider) {
|
|
534
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
535
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
536
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
537
|
-
}
|
|
538
|
-
const { languages } = servicesProvider();
|
|
539
|
-
if (languages.registerHoverProvider) {
|
|
540
|
-
return languages.registerHoverProvider(documentSelector, {
|
|
541
|
-
provideHover({ textDocument, position }, token) {
|
|
542
|
-
return provider.provideHover(<any>textDocument, <any>position, token) as any;
|
|
543
|
-
}
|
|
544
|
-
});
|
|
545
|
-
}
|
|
546
|
-
return Disposable.create(() => { });
|
|
547
|
-
},
|
|
548
|
-
registerDocumentHighlightProvider(selector, provider) {
|
|
549
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
550
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
551
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
552
|
-
}
|
|
553
|
-
const { languages } = servicesProvider();
|
|
554
|
-
if (!languages.registerDocumentHighlightProvider) {
|
|
555
|
-
return Disposable.create(() => { });
|
|
556
|
-
}
|
|
557
|
-
return languages.registerDocumentHighlightProvider(documentSelector, {
|
|
558
|
-
provideDocumentHighlights({ textDocument, position }, token) {
|
|
559
|
-
return provider.provideDocumentHighlights(<any>textDocument, <any>position, token) as any;
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
|
-
},
|
|
563
|
-
registerDocumentSymbolProvider(selector, provider) {
|
|
564
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
565
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
566
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
567
|
-
}
|
|
568
|
-
const { languages } = servicesProvider();
|
|
569
|
-
if (!languages.registerDocumentSymbolProvider) {
|
|
570
|
-
return Disposable.create(() => { });
|
|
571
|
-
}
|
|
572
|
-
return languages.registerDocumentSymbolProvider(documentSelector, {
|
|
573
|
-
provideDocumentSymbols({ textDocument }, token) {
|
|
574
|
-
return provider.provideDocumentSymbols(<any>textDocument, token) as any;
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
},
|
|
578
|
-
registerWorkspaceSymbolProvider(provider) {
|
|
579
|
-
const { languages } = servicesProvider();
|
|
580
|
-
if (!languages.registerWorkspaceSymbolProvider) {
|
|
581
|
-
return Disposable.create(() => { });
|
|
582
|
-
}
|
|
583
|
-
return languages.registerWorkspaceSymbolProvider({
|
|
584
|
-
provideWorkspaceSymbols({ query }, token) {
|
|
585
|
-
return provider.provideWorkspaceSymbols(query, token) as any;
|
|
586
|
-
}
|
|
587
|
-
});
|
|
588
|
-
},
|
|
589
|
-
registerReferenceProvider(selector, provider) {
|
|
590
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
591
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
592
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
593
|
-
}
|
|
594
|
-
const { languages } = servicesProvider();
|
|
595
|
-
if (!languages.registerReferenceProvider) {
|
|
596
|
-
return Disposable.create(() => { });
|
|
597
|
-
}
|
|
598
|
-
return languages.registerReferenceProvider(documentSelector, {
|
|
599
|
-
provideReferences({ textDocument, position, context }, token) {
|
|
600
|
-
return provider.provideReferences(<any>textDocument, <any>position, context, token) as any
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
},
|
|
604
|
-
registerRenameProvider(selector, provider) {
|
|
605
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
606
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
607
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
608
|
-
}
|
|
609
|
-
const { languages } = servicesProvider();
|
|
610
|
-
if (!languages.registerRenameProvider) {
|
|
611
|
-
return Disposable.create(() => { });
|
|
612
|
-
}
|
|
613
|
-
return languages.registerRenameProvider(documentSelector, {
|
|
614
|
-
provideRenameEdits({ textDocument, position, newName }, token) {
|
|
615
|
-
return provider.provideRenameEdits(<any>textDocument, <any>position, newName, token) as any
|
|
616
|
-
}
|
|
617
|
-
});
|
|
618
|
-
},
|
|
619
|
-
registerDocumentFormattingEditProvider(selector, provider) {
|
|
620
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
621
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
622
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
623
|
-
}
|
|
624
|
-
const { languages } = servicesProvider();
|
|
625
|
-
if (!languages.registerDocumentFormattingEditProvider) {
|
|
626
|
-
return Disposable.create(() => { });
|
|
627
|
-
}
|
|
628
|
-
return languages.registerDocumentFormattingEditProvider(documentSelector, {
|
|
629
|
-
provideDocumentFormattingEdits({ textDocument, options }, token) {
|
|
630
|
-
return provider.provideDocumentFormattingEdits(<any>textDocument, <any>options, token) as any
|
|
631
|
-
}
|
|
632
|
-
});
|
|
633
|
-
},
|
|
634
|
-
registerDocumentRangeFormattingEditProvider(selector, provider) {
|
|
635
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
636
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
637
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
638
|
-
}
|
|
639
|
-
const { languages } = servicesProvider();
|
|
640
|
-
if (!languages.registerDocumentRangeFormattingEditProvider) {
|
|
641
|
-
return Disposable.create(() => { });
|
|
642
|
-
}
|
|
643
|
-
return languages.registerDocumentRangeFormattingEditProvider(documentSelector, {
|
|
644
|
-
provideDocumentRangeFormattingEdits({ textDocument, range, options }, token) {
|
|
645
|
-
return provider.provideDocumentRangeFormattingEdits(<any>textDocument, <any>range, <any>options, token) as any
|
|
646
|
-
}
|
|
647
|
-
});
|
|
648
|
-
},
|
|
649
|
-
registerOnTypeFormattingEditProvider(selector, provider, firstTriggerCharacter, ...moreTriggerCharacter) {
|
|
650
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
651
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
652
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
653
|
-
}
|
|
654
|
-
const { languages } = servicesProvider();
|
|
655
|
-
if (!languages.registerOnTypeFormattingEditProvider) {
|
|
656
|
-
return Disposable.create(() => { });
|
|
657
|
-
}
|
|
658
|
-
return languages.registerOnTypeFormattingEditProvider(documentSelector, {
|
|
659
|
-
provideOnTypeFormattingEdits({ textDocument, position, ch, options }, token) {
|
|
660
|
-
return provider.provideOnTypeFormattingEdits(<any>textDocument, <any>position, ch, <any>options, token) as any
|
|
661
|
-
}
|
|
662
|
-
}, firstTriggerCharacter, ...moreTriggerCharacter);
|
|
663
|
-
},
|
|
664
|
-
registerSignatureHelpProvider(selector: vscode.DocumentSelector, provider: vscode.SignatureHelpProvider, firstItem?: string | vscode.SignatureHelpProviderMetadata, ...remaining: string[]) {
|
|
665
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
666
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
667
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
668
|
-
}
|
|
669
|
-
const { languages } = servicesProvider();
|
|
670
|
-
if (!languages.registerSignatureHelpProvider) {
|
|
671
|
-
return Disposable.create(() => { });
|
|
672
|
-
}
|
|
673
|
-
let triggerCharacters;
|
|
674
|
-
let retriggerCharacters;
|
|
675
|
-
if (typeof firstItem === 'string') {
|
|
676
|
-
triggerCharacters = [firstItem, ...remaining];
|
|
677
|
-
} else if (firstItem) {
|
|
678
|
-
triggerCharacters = firstItem.triggerCharacters;
|
|
679
|
-
retriggerCharacters = firstItem.retriggerCharacters;
|
|
680
|
-
}
|
|
681
|
-
return languages.registerSignatureHelpProvider(documentSelector, {
|
|
682
|
-
triggerCharacters,
|
|
683
|
-
retriggerCharacters,
|
|
684
|
-
provideSignatureHelp({ textDocument, position }, token, context) {
|
|
685
|
-
return provider.provideSignatureHelp(<any>textDocument, <any>position, token, <any>context) as any
|
|
686
|
-
}
|
|
687
|
-
});
|
|
688
|
-
},
|
|
689
|
-
registerDocumentLinkProvider(selector, provider) {
|
|
690
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
691
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
692
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
693
|
-
}
|
|
694
|
-
const { languages } = servicesProvider();
|
|
695
|
-
if (!languages.registerDocumentLinkProvider) {
|
|
696
|
-
return Disposable.create(() => { });
|
|
697
|
-
}
|
|
698
|
-
const resolveDocumentLink = provider.resolveDocumentLink;
|
|
699
|
-
return languages.registerDocumentLinkProvider(documentSelector, {
|
|
700
|
-
provideDocumentLinks({ textDocument }, token) {
|
|
701
|
-
return provider.provideDocumentLinks(<any>textDocument, token) as any
|
|
702
|
-
},
|
|
703
|
-
resolveDocumentLink: resolveDocumentLink ? (link, token) => {
|
|
704
|
-
return resolveDocumentLink(<any>link, token) as any
|
|
705
|
-
} : undefined
|
|
706
|
-
});
|
|
707
|
-
},
|
|
708
|
-
registerColorProvider(selector, provider) {
|
|
709
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
710
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
711
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
712
|
-
}
|
|
713
|
-
const { languages } = servicesProvider();
|
|
714
|
-
if (!languages.registerColorProvider) {
|
|
715
|
-
return Disposable.create(() => { });
|
|
716
|
-
}
|
|
717
|
-
return languages.registerColorProvider(documentSelector, {
|
|
718
|
-
provideDocumentColors({ textDocument }, token) {
|
|
719
|
-
return provider.provideDocumentColors(<any>textDocument, token) as any
|
|
720
|
-
},
|
|
721
|
-
provideColorPresentations({ textDocument, color, range }, token) {
|
|
722
|
-
return provider.provideColorPresentations(color, {
|
|
723
|
-
document: <any>textDocument,
|
|
724
|
-
range: <any>range
|
|
725
|
-
}, token) as any
|
|
726
|
-
}
|
|
727
|
-
});
|
|
728
|
-
},
|
|
729
|
-
registerFoldingRangeProvider(selector, provider) {
|
|
730
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
731
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
732
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
733
|
-
}
|
|
734
|
-
const { languages } = servicesProvider();
|
|
735
|
-
if (!languages.registerFoldingRangeProvider) {
|
|
736
|
-
return Disposable.create(() => { });
|
|
737
|
-
}
|
|
738
|
-
return languages.registerFoldingRangeProvider(documentSelector, {
|
|
739
|
-
provideFoldingRanges({ textDocument }, token) {
|
|
740
|
-
return provider.provideFoldingRanges(<any>textDocument, {}, token) as any;
|
|
741
|
-
}
|
|
742
|
-
});
|
|
743
|
-
},
|
|
744
|
-
registerSelectionRangeProvider(selector, provider) {
|
|
745
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
746
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
747
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
748
|
-
}
|
|
749
|
-
const { languages } = servicesProvider();
|
|
750
|
-
if (!languages.registerSelectionRangeProvider) {
|
|
751
|
-
return Disposable.create(() => { });
|
|
752
|
-
}
|
|
753
|
-
return languages.registerSelectionRangeProvider(documentSelector, {
|
|
754
|
-
provideSelectionRanges({ textDocument, positions }, token) {
|
|
755
|
-
return provider.provideSelectionRanges(<any>textDocument, <any>positions, token) as any;
|
|
756
|
-
}
|
|
757
|
-
});
|
|
758
|
-
},
|
|
759
|
-
registerEvaluatableExpressionProvider: unsupported,
|
|
760
|
-
registerDocumentSemanticTokensProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentSemanticTokensProvider, legend: vscode.SemanticTokensLegend) {
|
|
761
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
762
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
763
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
764
|
-
}
|
|
765
|
-
const { languages } = servicesProvider();
|
|
766
|
-
if (!languages.registerDocumentSemanticTokensProvider) {
|
|
767
|
-
return Disposable.create(() => { });
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
return languages.registerDocumentSemanticTokensProvider(documentSelector, {
|
|
771
|
-
onDidChange: provider.onDidChangeSemanticTokens,
|
|
772
|
-
provideDocumentSemanticTokens({ textDocument }, token) {
|
|
773
|
-
return provider.provideDocumentSemanticTokens(<any>textDocument, token) as any;
|
|
774
|
-
},
|
|
775
|
-
provideDocumentSemanticTokensEdits: provider.provideDocumentSemanticTokensEdits && (({ textDocument, previousResultId }, token) => {
|
|
776
|
-
return provider.provideDocumentSemanticTokensEdits!(<any>textDocument, <any>previousResultId, token) as any;
|
|
777
|
-
})
|
|
778
|
-
}, legend)
|
|
779
|
-
},
|
|
780
|
-
registerDocumentRangeSemanticTokensProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentRangeSemanticTokensProvider, legend: vscode.SemanticTokensLegend) {
|
|
781
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
782
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
783
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
784
|
-
}
|
|
785
|
-
const { languages } = servicesProvider();
|
|
786
|
-
if (!languages.registerDocumentRangeSemanticTokensProvider) {
|
|
787
|
-
return Disposable.create(() => { });
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
return languages.registerDocumentRangeSemanticTokensProvider(documentSelector, {
|
|
791
|
-
provideDocumentRangeSemanticTokens({ textDocument, range }, token) {
|
|
792
|
-
return provider.provideDocumentRangeSemanticTokens(<any>textDocument, <any>range, token) as any;
|
|
793
|
-
}
|
|
794
|
-
}, legend)
|
|
795
|
-
},
|
|
796
|
-
registerInlayHintsProvider(selector: vscode.DocumentSelector, provider: vscode.InlayHintsProvider) {
|
|
797
|
-
const documentSelector = Array.isArray(selector) ? selector : [selector]
|
|
798
|
-
if (!DocumentSelector.is(documentSelector)) {
|
|
799
|
-
throw new Error('unexpected selector: ' + JSON.stringify(selector));
|
|
800
|
-
}
|
|
801
|
-
const { languages } = servicesProvider();
|
|
802
|
-
if (!languages.registerInlayHintsProvider) {
|
|
803
|
-
return Disposable.create(() => { });
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
const resolveInlayHint = provider.resolveInlayHint;
|
|
807
|
-
return languages.registerInlayHintsProvider(documentSelector, {
|
|
808
|
-
onDidChangeInlayHints: provider.onDidChangeInlayHints,
|
|
809
|
-
provideInlayHints({ textDocument, range }, token) {
|
|
810
|
-
return provider.provideInlayHints(<any>textDocument, <any>range, token) as any
|
|
811
|
-
},
|
|
812
|
-
resolveInlayHint: resolveInlayHint ? (link, token) => {
|
|
813
|
-
return resolveInlayHint(<any>link, token) as any
|
|
814
|
-
} : undefined
|
|
815
|
-
})
|
|
816
|
-
},
|
|
817
|
-
// FIXME: Should be implemented with monaco 0.34
|
|
818
|
-
registerInlineValuesProvider: unsupported,
|
|
819
|
-
getLanguages: unsupported,
|
|
820
|
-
setTextDocumentLanguage: unsupported,
|
|
821
|
-
getDiagnostics: unsupported,
|
|
822
|
-
setLanguageConfiguration: unsupported,
|
|
823
|
-
onDidChangeDiagnostics: unsupported,
|
|
824
|
-
registerLinkedEditingRangeProvider: unsupported,
|
|
825
|
-
createLanguageStatusItem: unsupported,
|
|
826
|
-
registerTypeHierarchyProvider: unsupported
|
|
827
|
-
};
|
|
828
|
-
function showMessage(type: MessageType, arg0: any, ...arg1: any[]): Thenable<any> {
|
|
829
|
-
if (typeof arg0 !== "string") {
|
|
830
|
-
throw new Error('unexpected message: ' + JSON.stringify(arg0));
|
|
831
|
-
}
|
|
832
|
-
const message: string = arg0;
|
|
833
|
-
if (arg1 !== undefined && !Array.isArray(arg1)) {
|
|
834
|
-
throw new Error('unexpected actions: ' + JSON.stringify(arg1));
|
|
835
|
-
}
|
|
836
|
-
const actions: MessageActionItem[] = arg1 || [];
|
|
837
|
-
const { window } = servicesProvider();
|
|
838
|
-
if (!window) {
|
|
839
|
-
return Promise.resolve(undefined);
|
|
840
|
-
}
|
|
841
|
-
return window.showMessage(type, message, ...actions);
|
|
842
|
-
}
|
|
843
|
-
const window: typeof vscode.window = {
|
|
844
|
-
showInformationMessage: showMessage.bind(undefined, MessageType.Info),
|
|
845
|
-
showWarningMessage: showMessage.bind(undefined, MessageType.Warning),
|
|
846
|
-
showErrorMessage: showMessage.bind(undefined, MessageType.Error),
|
|
847
|
-
createOutputChannel(name: string): vscode.OutputChannel {
|
|
848
|
-
const { window } = servicesProvider();
|
|
849
|
-
const createOutputChannel = window ? window.createOutputChannel : undefined;
|
|
850
|
-
const channel: OutputChannel | undefined = createOutputChannel ? createOutputChannel.bind(window)(name) : undefined;
|
|
851
|
-
return {
|
|
852
|
-
name,
|
|
853
|
-
append: channel ? channel.append.bind(channel) : () => { },
|
|
854
|
-
appendLine: channel ? channel.appendLine.bind(channel) : () => { },
|
|
855
|
-
clear: unsupported,
|
|
856
|
-
show: (arg: any) => {
|
|
857
|
-
if (arg !== undefined && typeof arg !== 'boolean') {
|
|
858
|
-
throw new Error('unexpected preserveFocus argument: ' + JSON.stringify(arg, undefined, 4));
|
|
859
|
-
}
|
|
860
|
-
return channel ? channel.show(arg) : () => { };
|
|
861
|
-
},
|
|
862
|
-
hide: unsupported,
|
|
863
|
-
replace: unsupported,
|
|
864
|
-
dispose: channel ? channel.dispose.bind(channel) : () => { }
|
|
865
|
-
};
|
|
866
|
-
},
|
|
867
|
-
withProgress: (options, task) => {
|
|
868
|
-
const { window } = servicesProvider();
|
|
869
|
-
if (window && window.withProgress) {
|
|
870
|
-
return window.withProgress(options, task);
|
|
871
|
-
}
|
|
872
|
-
return task({ report: () => { } }, new CancellationTokenSource().token);
|
|
873
|
-
},
|
|
874
|
-
showTextDocument: async (textDocumentOrUri: vscode.TextDocument | vscode.Uri, columnOrOptions: vscode.ViewColumn | vscode.TextDocumentShowOptions | undefined, preserveFocus?: boolean) => {
|
|
875
|
-
const { window } = servicesProvider();
|
|
876
|
-
let options: vscode.TextDocumentShowOptions | undefined;
|
|
877
|
-
if (typeof columnOrOptions === 'number') {
|
|
878
|
-
options = {
|
|
879
|
-
viewColumn: columnOrOptions,
|
|
880
|
-
preserveFocus
|
|
881
|
-
};
|
|
882
|
-
} else {
|
|
883
|
-
options = columnOrOptions
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
if (window && window.showTextDocument) {
|
|
887
|
-
await window.showTextDocument((textDocumentOrUri as vscode.TextDocument).uri ?? textDocumentOrUri, options)
|
|
888
|
-
}
|
|
889
|
-
// The language client doesn't use the return value of this method
|
|
890
|
-
return undefined as unknown as vscode.TextEditor
|
|
891
|
-
},
|
|
892
|
-
createTextEditorDecorationType: unsupported,
|
|
893
|
-
showQuickPick: unsupported,
|
|
894
|
-
showWorkspaceFolderPick: unsupported,
|
|
895
|
-
showOpenDialog: unsupported,
|
|
896
|
-
showSaveDialog: unsupported,
|
|
897
|
-
showInputBox: unsupported,
|
|
898
|
-
createWebviewPanel: unsupported,
|
|
899
|
-
setStatusBarMessage: unsupported,
|
|
900
|
-
withScmProgress: unsupported,
|
|
901
|
-
createStatusBarItem: unsupported,
|
|
902
|
-
createTerminal: unsupported,
|
|
903
|
-
registerTreeDataProvider: unsupported,
|
|
904
|
-
createTreeView: unsupported,
|
|
905
|
-
registerWebviewPanelSerializer: unsupported,
|
|
906
|
-
get activeTextEditor() {
|
|
907
|
-
return unsupported();
|
|
908
|
-
},
|
|
909
|
-
get visibleTextEditors() {
|
|
910
|
-
return unsupported();
|
|
911
|
-
},
|
|
912
|
-
onDidChangeActiveTextEditor: unsupported,
|
|
913
|
-
onDidChangeVisibleTextEditors: unsupported,
|
|
914
|
-
onDidChangeTextEditorSelection: unsupported,
|
|
915
|
-
onDidChangeTextEditorVisibleRanges: unsupported,
|
|
916
|
-
onDidChangeTextEditorOptions: unsupported,
|
|
917
|
-
onDidChangeTextEditorViewColumn: unsupported,
|
|
918
|
-
get terminals() {
|
|
919
|
-
return unsupported();
|
|
920
|
-
},
|
|
921
|
-
get activeTerminal() {
|
|
922
|
-
return unsupported();
|
|
923
|
-
},
|
|
924
|
-
onDidChangeActiveTerminal: unsupported,
|
|
925
|
-
onDidOpenTerminal: unsupported,
|
|
926
|
-
onDidCloseTerminal: unsupported,
|
|
927
|
-
get state() {
|
|
928
|
-
return unsupported();
|
|
929
|
-
},
|
|
930
|
-
onDidChangeWindowState: unsupported,
|
|
931
|
-
createQuickPick: unsupported,
|
|
932
|
-
createInputBox: unsupported,
|
|
933
|
-
registerUriHandler: unsupported,
|
|
934
|
-
registerWebviewViewProvider: unsupported,
|
|
935
|
-
registerCustomEditorProvider: unsupported,
|
|
936
|
-
registerTerminalLinkProvider: unsupported,
|
|
937
|
-
get activeColorTheme() {
|
|
938
|
-
return unsupported();
|
|
939
|
-
},
|
|
940
|
-
onDidChangeActiveColorTheme: unsupported,
|
|
941
|
-
registerFileDecorationProvider: unsupported,
|
|
942
|
-
registerTerminalProfileProvider: unsupported,
|
|
943
|
-
onDidChangeTerminalState: unsupported,
|
|
944
|
-
get tabGroups() {
|
|
945
|
-
return unsupported();
|
|
946
|
-
}
|
|
947
|
-
};
|
|
948
|
-
const commands: typeof vscode.commands = {
|
|
949
|
-
registerCommand(command, callback, thisArg): Disposable {
|
|
950
|
-
const { commands } = servicesProvider();
|
|
951
|
-
if (!commands) {
|
|
952
|
-
return Disposable.create(() => { });
|
|
953
|
-
}
|
|
954
|
-
return commands.registerCommand(command, callback, thisArg);
|
|
955
|
-
},
|
|
956
|
-
registerTextEditorCommand: unsupported,
|
|
957
|
-
executeCommand: unsupported,
|
|
958
|
-
getCommands: unsupported
|
|
959
|
-
};
|
|
960
|
-
class CodeDisposable implements vscode.Disposable {
|
|
961
|
-
constructor(public callOnDispose: Function) { }
|
|
962
|
-
|
|
963
|
-
static from(...inDisposables: { dispose(): any; }[]): Disposable {
|
|
964
|
-
let disposables: ReadonlyArray<{ dispose(): any; }> | undefined = inDisposables;
|
|
965
|
-
return new CodeDisposable(function () {
|
|
966
|
-
if (disposables) {
|
|
967
|
-
for (const disposable of disposables) {
|
|
968
|
-
if (disposable && typeof disposable.dispose === 'function') {
|
|
969
|
-
disposable.dispose();
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
disposables = undefined;
|
|
973
|
-
}
|
|
974
|
-
});
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
dispose() {
|
|
978
|
-
this.callOnDispose();
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
const env: typeof vscode.env = {
|
|
983
|
-
appName: 'Monaco',
|
|
984
|
-
appRoot: '',
|
|
985
|
-
language: navigator.language || 'en-US',
|
|
986
|
-
get uriScheme() {
|
|
987
|
-
return unsupported();
|
|
988
|
-
},
|
|
989
|
-
get clipboard() {
|
|
990
|
-
return unsupported();
|
|
991
|
-
},
|
|
992
|
-
get machineId() {
|
|
993
|
-
return unsupported();
|
|
994
|
-
},
|
|
995
|
-
get sessionId() {
|
|
996
|
-
return unsupported();
|
|
997
|
-
},
|
|
998
|
-
remoteName: undefined,
|
|
999
|
-
shell: '',
|
|
1000
|
-
uiKind: 2, // vscode.UIKind.Web,
|
|
1001
|
-
asExternalUri: unsupported,
|
|
1002
|
-
openExternal: async (uri: vscode.Uri) => {
|
|
1003
|
-
const { env } = servicesProvider();
|
|
1004
|
-
|
|
1005
|
-
if (env && env.openExternal) {
|
|
1006
|
-
return env.openExternal(uri)
|
|
1007
|
-
}
|
|
1008
|
-
return false
|
|
1009
|
-
},
|
|
1010
|
-
get appHost() {
|
|
1011
|
-
return unsupported();
|
|
1012
|
-
},
|
|
1013
|
-
isNewAppInstall: false,
|
|
1014
|
-
isTelemetryEnabled: false,
|
|
1015
|
-
onDidChangeTelemetryEnabled: unsupported
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
const partialApi: Partial<typeof vscode> = {
|
|
1019
|
-
workspace,
|
|
1020
|
-
languages,
|
|
1021
|
-
window,
|
|
1022
|
-
commands,
|
|
1023
|
-
env,
|
|
1024
|
-
Uri,
|
|
1025
|
-
CompletionItem,
|
|
1026
|
-
CodeLens,
|
|
1027
|
-
DocumentLink,
|
|
1028
|
-
CodeActionKind,
|
|
1029
|
-
CodeAction,
|
|
1030
|
-
Diagnostic,
|
|
1031
|
-
CallHierarchyItem,
|
|
1032
|
-
TypeHierarchyItem,
|
|
1033
|
-
SemanticTokens,
|
|
1034
|
-
Disposable: CodeDisposable,
|
|
1035
|
-
SignatureHelpTriggerKind,
|
|
1036
|
-
DiagnosticSeverity: ServicesModule.DiagnosticSeverity,
|
|
1037
|
-
EventEmitter: ServicesModule.Emitter,
|
|
1038
|
-
CancellationTokenSource,
|
|
1039
|
-
ProgressLocation: ServicesModule.ProgressLocation,
|
|
1040
|
-
TextDocumentChangeReason,
|
|
1041
|
-
SymbolInformation,
|
|
1042
|
-
InlayHint,
|
|
1043
|
-
CancellationError
|
|
1044
|
-
};
|
|
1045
|
-
|
|
1046
|
-
return partialApi as any;
|
|
1047
|
-
}
|