@volar/monaco 1.3.0-alpha.3-patch.1 → 1.4.0-alpha.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/README.md +1 -1
- package/out/editor.d.ts +1 -1
- package/out/editor.js +13 -1
- package/out/utils/monaco2protocol.d.ts +7 -1
- package/out/utils/monaco2protocol.js +58 -1
- package/out/utils/provider.d.ts +2 -2
- package/out/utils/provider.js +84 -57
- package/out/worker.d.ts +8 -6
- package/out/worker.js +59 -64
- package/package.json +4 -3
package/README.md
CHANGED
package/out/editor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LanguageService } from '@volar/language-service';
|
|
2
2
|
import { editor as _editor, IDisposable, Uri } from 'monaco-editor-core';
|
|
3
3
|
export declare namespace editor {
|
|
4
4
|
function activateMarkers(worker: _editor.MonacoWebWorker<LanguageService>, languages: string[], markersOwn: string, getSyncUris: () => Uri[], editor: typeof import('monaco-editor-core').editor): IDisposable;
|
package/out/editor.js
CHANGED
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.editor = void 0;
|
|
12
|
+
const language_service_1 = require("@volar/language-service");
|
|
12
13
|
const monaco_editor_core_1 = require("monaco-editor-core");
|
|
13
14
|
const markers_1 = require("./utils/markers");
|
|
14
15
|
const protocol2monaco = require("./utils/protocol2monaco");
|
|
@@ -75,8 +76,14 @@ var editor;
|
|
|
75
76
|
if (!model.isAttachedToEditor()) {
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
79
|
+
const version = model.getVersionId();
|
|
78
80
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
79
|
-
const diagnostics = yield languageService.doValidation(model.uri.toString()
|
|
81
|
+
const diagnostics = yield languageService.doValidation(model.uri.toString(), {
|
|
82
|
+
get isCancellationRequested() {
|
|
83
|
+
return model.getVersionId() !== version;
|
|
84
|
+
},
|
|
85
|
+
onCancellationRequested: language_service_1.Event.None,
|
|
86
|
+
}, 'all');
|
|
80
87
|
const result = diagnostics.map(error => {
|
|
81
88
|
const marker = protocol2monaco.asMarkerData(error);
|
|
82
89
|
markers_1.markers.set(marker, error);
|
|
@@ -153,6 +160,11 @@ var editor;
|
|
|
153
160
|
text: lastChange.text,
|
|
154
161
|
rangeOffset: lastChange.rangeOffset,
|
|
155
162
|
},
|
|
163
|
+
}, {
|
|
164
|
+
get isCancellationRequested() {
|
|
165
|
+
return model.getVersionId() !== version;
|
|
166
|
+
},
|
|
167
|
+
onCancellationRequested: language_service_1.Event.None,
|
|
156
168
|
});
|
|
157
169
|
const codeEditor = editor.getEditors().find((e) => e.getModel() === model);
|
|
158
170
|
if (codeEditor && edit && model.getVersionId() === version) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { IRange, languages, Position } from 'monaco-editor-core';
|
|
1
|
+
import { IMarkdownString, IRange, languages, Position } from 'monaco-editor-core';
|
|
2
2
|
import * as protocol from 'vscode-languageserver-protocol';
|
|
3
3
|
export declare function asPosition(position: Position): protocol.Position;
|
|
4
4
|
export declare function asRange(range: IRange): protocol.Range;
|
|
5
5
|
export declare function asCompletionContext(context: languages.CompletionContext): protocol.CompletionContext;
|
|
6
|
+
export declare function asSignatureHelpContext(context: languages.SignatureHelpContext): protocol.SignatureHelpContext;
|
|
7
|
+
export declare function asSignatureHelpTriggerKind(kind: languages.SignatureHelpTriggerKind): protocol.SignatureHelpTriggerKind;
|
|
8
|
+
export declare function asSignatureHelp(signatureHelp: languages.SignatureHelp): protocol.SignatureHelp;
|
|
9
|
+
export declare function asSignatureInformation(signatureInformation: languages.SignatureInformation): protocol.SignatureInformation;
|
|
10
|
+
export declare function asParameterInformation(parameterInformation: languages.ParameterInformation): protocol.ParameterInformation;
|
|
11
|
+
export declare function asMarkdownString(entry: IMarkdownString | string | undefined): protocol.MarkupContent | string | undefined;
|
|
6
12
|
export declare function asTriggerKind(kind: languages.CompletionTriggerKind): protocol.CompletionTriggerKind;
|
|
7
13
|
export declare function asFormattingOptions(options: languages.FormattingOptions): protocol.FormattingOptions;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.asFormattingOptions = exports.asTriggerKind = exports.asCompletionContext = exports.asRange = exports.asPosition = void 0;
|
|
2
|
+
exports.asFormattingOptions = exports.asTriggerKind = exports.asMarkdownString = exports.asParameterInformation = exports.asSignatureInformation = exports.asSignatureHelp = exports.asSignatureHelpTriggerKind = exports.asSignatureHelpContext = exports.asCompletionContext = exports.asRange = exports.asPosition = void 0;
|
|
3
3
|
const monaco_editor_core_1 = require("monaco-editor-core");
|
|
4
4
|
const protocol = require("vscode-languageserver-protocol");
|
|
5
5
|
function asPosition(position) {
|
|
@@ -17,6 +17,63 @@ function asCompletionContext(context) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
exports.asCompletionContext = asCompletionContext;
|
|
20
|
+
function asSignatureHelpContext(context) {
|
|
21
|
+
return {
|
|
22
|
+
triggerKind: asSignatureHelpTriggerKind(context.triggerKind),
|
|
23
|
+
triggerCharacter: context.triggerCharacter,
|
|
24
|
+
isRetrigger: context.isRetrigger,
|
|
25
|
+
activeSignatureHelp: context.activeSignatureHelp ? asSignatureHelp(context.activeSignatureHelp) : undefined,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.asSignatureHelpContext = asSignatureHelpContext;
|
|
29
|
+
function asSignatureHelpTriggerKind(kind) {
|
|
30
|
+
switch (kind) {
|
|
31
|
+
case monaco_editor_core_1.languages.SignatureHelpTriggerKind.Invoke:
|
|
32
|
+
return protocol.SignatureHelpTriggerKind.Invoked;
|
|
33
|
+
case monaco_editor_core_1.languages.SignatureHelpTriggerKind.TriggerCharacter:
|
|
34
|
+
return protocol.SignatureHelpTriggerKind.TriggerCharacter;
|
|
35
|
+
case monaco_editor_core_1.languages.SignatureHelpTriggerKind.ContentChange:
|
|
36
|
+
return protocol.SignatureHelpTriggerKind.ContentChange;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.asSignatureHelpTriggerKind = asSignatureHelpTriggerKind;
|
|
40
|
+
function asSignatureHelp(signatureHelp) {
|
|
41
|
+
return {
|
|
42
|
+
signatures: signatureHelp.signatures.map(asSignatureInformation),
|
|
43
|
+
activeSignature: signatureHelp.activeSignature,
|
|
44
|
+
activeParameter: signatureHelp.activeParameter,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
exports.asSignatureHelp = asSignatureHelp;
|
|
48
|
+
function asSignatureInformation(signatureInformation) {
|
|
49
|
+
return {
|
|
50
|
+
label: signatureInformation.label,
|
|
51
|
+
documentation: asMarkdownString(signatureInformation.documentation),
|
|
52
|
+
parameters: signatureInformation.parameters.map(asParameterInformation),
|
|
53
|
+
activeParameter: signatureInformation.activeParameter,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
exports.asSignatureInformation = asSignatureInformation;
|
|
57
|
+
function asParameterInformation(parameterInformation) {
|
|
58
|
+
return {
|
|
59
|
+
label: parameterInformation.label,
|
|
60
|
+
documentation: asMarkdownString(parameterInformation.documentation),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
exports.asParameterInformation = asParameterInformation;
|
|
64
|
+
function asMarkdownString(entry) {
|
|
65
|
+
if (!entry) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
if (typeof entry === 'string') {
|
|
69
|
+
return entry;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
kind: 'markdown',
|
|
73
|
+
value: entry.value,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
exports.asMarkdownString = asMarkdownString;
|
|
20
77
|
function asTriggerKind(kind) {
|
|
21
78
|
switch (kind) {
|
|
22
79
|
case monaco_editor_core_1.languages.CompletionTriggerKind.Invoke:
|
package/out/utils/provider.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LanguageService } from '@volar/language-service';
|
|
2
2
|
import type { editor, languages, Uri } from 'monaco-editor-core';
|
|
3
|
-
export declare function createLanguageFeaturesProvider(worker: editor.MonacoWebWorker<LanguageService>, getSyncUris: () => Uri[]): Promise<languages.HoverProvider & languages.DocumentSymbolProvider & languages.DocumentHighlightProvider & languages.LinkedEditingRangeProvider & languages.DefinitionProvider & languages.
|
|
3
|
+
export declare function createLanguageFeaturesProvider(worker: editor.MonacoWebWorker<LanguageService>, getSyncUris: () => Uri[]): Promise<languages.HoverProvider & languages.DocumentSymbolProvider & languages.DocumentHighlightProvider & languages.LinkedEditingRangeProvider & languages.DefinitionProvider & languages.TypeDefinitionProvider & languages.ImplementationProvider & languages.CodeLensProvider & languages.CodeActionProvider & languages.DocumentFormattingEditProvider & languages.DocumentRangeFormattingEditProvider & languages.OnTypeFormattingEditProvider & languages.LinkProvider & languages.CompletionItemProvider & languages.DocumentColorProvider & languages.FoldingRangeProvider & languages.DeclarationProvider & languages.SignatureHelpProvider & languages.RenameProvider & languages.ReferenceProvider & languages.SelectionRangeProvider & languages.InlayHintsProvider & languages.DocumentSemanticTokensProvider & languages.DocumentRangeSemanticTokensProvider>;
|
package/out/utils/provider.js
CHANGED
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.createLanguageFeaturesProvider = void 0;
|
|
12
|
+
const language_service_1 = require("@volar/language-service");
|
|
12
13
|
const markers_1 = require("./markers");
|
|
13
14
|
const monaco2protocol = require("./monaco2protocol");
|
|
14
15
|
const protocol2monaco = require("./protocol2monaco");
|
|
@@ -21,31 +22,59 @@ function createLanguageFeaturesProvider(worker, getSyncUris) {
|
|
|
21
22
|
const languageService = yield worker.getProxy();
|
|
22
23
|
return {
|
|
23
24
|
triggerCharacters: yield languageService.triggerCharacters(),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
autoFormatTriggerCharacters: yield languageService.triggerCharacters(),
|
|
26
|
+
signatureHelpTriggerCharacters: yield languageService.triggerCharacters(),
|
|
27
|
+
signatureHelpRetriggerCharacters: yield languageService.triggerCharacters(),
|
|
28
|
+
getLegend() {
|
|
29
|
+
return language_service_1.standardSemanticTokensLegend;
|
|
30
|
+
},
|
|
31
|
+
provideDocumentSemanticTokens(model, _lastResultId, token) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
34
|
+
const codeResult = yield languageService.getSemanticTokens(model.uri.toString(), undefined, language_service_1.standardSemanticTokensLegend, token);
|
|
35
|
+
if (codeResult) {
|
|
36
|
+
return {
|
|
37
|
+
resultId: codeResult.resultId,
|
|
38
|
+
data: Uint32Array.from(codeResult.data),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
provideDocumentRangeSemanticTokens(model, range, token) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
46
|
+
const codeResult = yield languageService.getSemanticTokens(model.uri.toString(), monaco2protocol.asRange(range), language_service_1.standardSemanticTokensLegend, token);
|
|
47
|
+
if (codeResult) {
|
|
48
|
+
return {
|
|
49
|
+
resultId: codeResult.resultId,
|
|
50
|
+
data: Uint32Array.from(codeResult.data),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
releaseDocumentSemanticTokens() { },
|
|
56
|
+
provideDocumentSymbols(model, token) {
|
|
28
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
58
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
30
|
-
const codeResult = yield languageService.findDocumentSymbols(model.uri.toString());
|
|
59
|
+
const codeResult = yield languageService.findDocumentSymbols(model.uri.toString(), token);
|
|
31
60
|
if (codeResult) {
|
|
32
61
|
return codeResult.map(protocol2monaco.asDocumentSymbol);
|
|
33
62
|
}
|
|
34
63
|
});
|
|
35
64
|
},
|
|
36
|
-
provideDocumentHighlights(model, position,
|
|
65
|
+
provideDocumentHighlights(model, position, token) {
|
|
37
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
67
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
39
|
-
const codeResult = yield languageService.findDocumentHighlights(model.uri.toString(), monaco2protocol.asPosition(position));
|
|
68
|
+
const codeResult = yield languageService.findDocumentHighlights(model.uri.toString(), monaco2protocol.asPosition(position), token);
|
|
40
69
|
if (codeResult) {
|
|
41
70
|
return codeResult.map(protocol2monaco.asDocumentHighlight);
|
|
42
71
|
}
|
|
43
72
|
});
|
|
44
73
|
},
|
|
45
|
-
provideLinkedEditingRanges(model, position,
|
|
74
|
+
provideLinkedEditingRanges(model, position, token) {
|
|
46
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
76
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
48
|
-
const codeResult = yield languageService.findLinkedEditingRanges(model.uri.toString(), monaco2protocol.asPosition(position));
|
|
77
|
+
const codeResult = yield languageService.findLinkedEditingRanges(model.uri.toString(), monaco2protocol.asPosition(position), token);
|
|
49
78
|
if (codeResult) {
|
|
50
79
|
return {
|
|
51
80
|
ranges: codeResult.ranges.map(protocol2monaco.asRange),
|
|
@@ -56,38 +85,38 @@ function createLanguageFeaturesProvider(worker, getSyncUris) {
|
|
|
56
85
|
}
|
|
57
86
|
});
|
|
58
87
|
},
|
|
59
|
-
provideDefinition(model, position,
|
|
88
|
+
provideDefinition(model, position, token) {
|
|
60
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
90
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
62
|
-
const codeResult = yield languageService.findDefinition(model.uri.toString(), monaco2protocol.asPosition(position));
|
|
91
|
+
const codeResult = yield languageService.findDefinition(model.uri.toString(), monaco2protocol.asPosition(position), token);
|
|
63
92
|
// TODO: can't show if only one result from libs
|
|
64
93
|
if (codeResult) {
|
|
65
94
|
return codeResult.map(protocol2monaco.asLocation);
|
|
66
95
|
}
|
|
67
96
|
});
|
|
68
97
|
},
|
|
69
|
-
provideImplementation(model, position,
|
|
98
|
+
provideImplementation(model, position, token) {
|
|
70
99
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
100
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
72
|
-
const codeResult = yield languageService.findImplementations(model.uri.toString(), monaco2protocol.asPosition(position));
|
|
101
|
+
const codeResult = yield languageService.findImplementations(model.uri.toString(), monaco2protocol.asPosition(position), token);
|
|
73
102
|
if (codeResult) {
|
|
74
103
|
return codeResult.map(protocol2monaco.asLocation);
|
|
75
104
|
}
|
|
76
105
|
});
|
|
77
106
|
},
|
|
78
|
-
provideTypeDefinition(model, position,
|
|
107
|
+
provideTypeDefinition(model, position, token) {
|
|
79
108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
109
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
81
|
-
const codeResult = yield languageService.findTypeDefinition(model.uri.toString(), monaco2protocol.asPosition(position));
|
|
110
|
+
const codeResult = yield languageService.findTypeDefinition(model.uri.toString(), monaco2protocol.asPosition(position), token);
|
|
82
111
|
if (codeResult) {
|
|
83
112
|
return codeResult.map(protocol2monaco.asLocation);
|
|
84
113
|
}
|
|
85
114
|
});
|
|
86
115
|
},
|
|
87
|
-
provideCodeLenses(model,
|
|
116
|
+
provideCodeLenses(model, token) {
|
|
88
117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
118
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
90
|
-
const codeResult = yield languageService.doCodeLens(model.uri.toString());
|
|
119
|
+
const codeResult = yield languageService.doCodeLens(model.uri.toString(), token);
|
|
91
120
|
if (codeResult) {
|
|
92
121
|
const monacoResult = codeResult.map(protocol2monaco.asCodeLens);
|
|
93
122
|
for (let i = 0; i < monacoResult.length; i++) {
|
|
@@ -100,12 +129,12 @@ function createLanguageFeaturesProvider(worker, getSyncUris) {
|
|
|
100
129
|
}
|
|
101
130
|
});
|
|
102
131
|
},
|
|
103
|
-
resolveCodeLens(_, monacoResult) {
|
|
132
|
+
resolveCodeLens(_, monacoResult, token) {
|
|
104
133
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
134
|
let codeResult = codeLens.get(monacoResult);
|
|
106
135
|
if (codeResult) {
|
|
107
136
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
108
|
-
codeResult = yield languageService.doCodeLensResolve(codeResult);
|
|
137
|
+
codeResult = yield languageService.doCodeLensResolve(codeResult, token);
|
|
109
138
|
if (codeResult) {
|
|
110
139
|
monacoResult = protocol2monaco.asCodeLens(codeResult);
|
|
111
140
|
codeLens.set(monacoResult, codeResult);
|
|
@@ -114,7 +143,7 @@ function createLanguageFeaturesProvider(worker, getSyncUris) {
|
|
|
114
143
|
return monacoResult;
|
|
115
144
|
});
|
|
116
145
|
},
|
|
117
|
-
provideCodeActions(model, range, context,
|
|
146
|
+
provideCodeActions(model, range, context, token) {
|
|
118
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
148
|
const diagnostics = [];
|
|
120
149
|
for (const marker of context.markers) {
|
|
@@ -127,7 +156,7 @@ function createLanguageFeaturesProvider(worker, getSyncUris) {
|
|
|
127
156
|
const codeResult = yield languageService.doCodeActions(model.uri.toString(), monaco2protocol.asRange(range), {
|
|
128
157
|
diagnostics: diagnostics,
|
|
129
158
|
only: context.only ? [context.only] : undefined,
|
|
130
|
-
});
|
|
159
|
+
}, token);
|
|
131
160
|
if (codeResult) {
|
|
132
161
|
const monacoResult = codeResult.map(protocol2monaco.asCodeAction);
|
|
133
162
|
for (let i = 0; i < monacoResult.length; i++) {
|
|
@@ -140,12 +169,12 @@ function createLanguageFeaturesProvider(worker, getSyncUris) {
|
|
|
140
169
|
}
|
|
141
170
|
});
|
|
142
171
|
},
|
|
143
|
-
resolveCodeAction(monacoResult) {
|
|
172
|
+
resolveCodeAction(monacoResult, token) {
|
|
144
173
|
return __awaiter(this, void 0, void 0, function* () {
|
|
145
174
|
let codeResult = codeActions.get(monacoResult);
|
|
146
175
|
if (codeResult) {
|
|
147
176
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
148
|
-
codeResult = yield languageService.doCodeActionResolve(codeResult);
|
|
177
|
+
codeResult = yield languageService.doCodeActionResolve(codeResult, token);
|
|
149
178
|
if (codeResult) {
|
|
150
179
|
monacoResult = protocol2monaco.asCodeAction(codeResult);
|
|
151
180
|
codeActions.set(monacoResult, codeResult);
|
|
@@ -154,40 +183,40 @@ function createLanguageFeaturesProvider(worker, getSyncUris) {
|
|
|
154
183
|
return monacoResult;
|
|
155
184
|
});
|
|
156
185
|
},
|
|
157
|
-
provideDocumentFormattingEdits(model, options,
|
|
186
|
+
provideDocumentFormattingEdits(model, options, token) {
|
|
158
187
|
return __awaiter(this, void 0, void 0, function* () {
|
|
159
188
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
160
|
-
const codeResult = yield languageService.format(model.uri.toString(), monaco2protocol.asFormattingOptions(options));
|
|
189
|
+
const codeResult = yield languageService.format(model.uri.toString(), monaco2protocol.asFormattingOptions(options), undefined, undefined, token);
|
|
161
190
|
if (codeResult) {
|
|
162
191
|
return codeResult.map(protocol2monaco.asTextEdit);
|
|
163
192
|
}
|
|
164
193
|
});
|
|
165
194
|
},
|
|
166
|
-
provideDocumentRangeFormattingEdits(model, range, options,
|
|
195
|
+
provideDocumentRangeFormattingEdits(model, range, options, token) {
|
|
167
196
|
return __awaiter(this, void 0, void 0, function* () {
|
|
168
197
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
169
|
-
const codeResult = yield languageService.format(model.uri.toString(), monaco2protocol.asFormattingOptions(options), monaco2protocol.asRange(range));
|
|
198
|
+
const codeResult = yield languageService.format(model.uri.toString(), monaco2protocol.asFormattingOptions(options), monaco2protocol.asRange(range), undefined, token);
|
|
170
199
|
if (codeResult) {
|
|
171
200
|
return codeResult.map(protocol2monaco.asTextEdit);
|
|
172
201
|
}
|
|
173
202
|
});
|
|
174
203
|
},
|
|
175
|
-
provideOnTypeFormattingEdits(model, position, ch, options,
|
|
204
|
+
provideOnTypeFormattingEdits(model, position, ch, options, token) {
|
|
176
205
|
return __awaiter(this, void 0, void 0, function* () {
|
|
177
206
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
178
207
|
const codeResult = yield languageService.format(model.uri.toString(), monaco2protocol.asFormattingOptions(options), undefined, {
|
|
179
208
|
ch: ch,
|
|
180
209
|
position: monaco2protocol.asPosition(position),
|
|
181
|
-
});
|
|
210
|
+
}, token);
|
|
182
211
|
if (codeResult) {
|
|
183
212
|
return codeResult.map(protocol2monaco.asTextEdit);
|
|
184
213
|
}
|
|
185
214
|
});
|
|
186
215
|
},
|
|
187
|
-
provideLinks(model,
|
|
216
|
+
provideLinks(model, token) {
|
|
188
217
|
return __awaiter(this, void 0, void 0, function* () {
|
|
189
218
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
190
|
-
const codeResult = yield languageService.findDocumentLinks(model.uri.toString());
|
|
219
|
+
const codeResult = yield languageService.findDocumentLinks(model.uri.toString(), token);
|
|
191
220
|
if (codeResult) {
|
|
192
221
|
return {
|
|
193
222
|
links: codeResult.map(protocol2monaco.asLink),
|
|
@@ -195,10 +224,10 @@ function createLanguageFeaturesProvider(worker, getSyncUris) {
|
|
|
195
224
|
}
|
|
196
225
|
});
|
|
197
226
|
},
|
|
198
|
-
provideCompletionItems(model, position, context,
|
|
227
|
+
provideCompletionItems(model, position, context, token) {
|
|
199
228
|
return __awaiter(this, void 0, void 0, function* () {
|
|
200
229
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
201
|
-
const codeResult = yield languageService.doComplete(model.uri.toString(), monaco2protocol.asPosition(position), monaco2protocol.asCompletionContext(context));
|
|
230
|
+
const codeResult = yield languageService.doComplete(model.uri.toString(), monaco2protocol.asPosition(position), monaco2protocol.asCompletionContext(context), token);
|
|
202
231
|
const fallbackRange = {
|
|
203
232
|
start: monaco2protocol.asPosition(position),
|
|
204
233
|
end: monaco2protocol.asPosition(position),
|
|
@@ -210,12 +239,12 @@ function createLanguageFeaturesProvider(worker, getSyncUris) {
|
|
|
210
239
|
return monacoResult;
|
|
211
240
|
});
|
|
212
241
|
},
|
|
213
|
-
resolveCompletionItem(monacoItem,
|
|
242
|
+
resolveCompletionItem(monacoItem, token) {
|
|
214
243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
215
244
|
let codeItem = completionItems.get(monacoItem);
|
|
216
245
|
if (codeItem) {
|
|
217
246
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
218
|
-
codeItem = yield languageService.doCompletionResolve(codeItem);
|
|
247
|
+
codeItem = yield languageService.doCompletionResolve(codeItem, token);
|
|
219
248
|
const fallbackRange = 'replace' in monacoItem.range
|
|
220
249
|
? monaco2protocol.asRange(monacoItem.range.replace)
|
|
221
250
|
: monaco2protocol.asRange(monacoItem.range);
|
|
@@ -225,16 +254,16 @@ function createLanguageFeaturesProvider(worker, getSyncUris) {
|
|
|
225
254
|
return monacoItem;
|
|
226
255
|
});
|
|
227
256
|
},
|
|
228
|
-
provideDocumentColors(model,
|
|
257
|
+
provideDocumentColors(model, token) {
|
|
229
258
|
return __awaiter(this, void 0, void 0, function* () {
|
|
230
259
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
231
|
-
const codeResult = yield languageService.findDocumentColors(model.uri.toString());
|
|
260
|
+
const codeResult = yield languageService.findDocumentColors(model.uri.toString(), token);
|
|
232
261
|
if (codeResult) {
|
|
233
262
|
return codeResult.map(protocol2monaco.asColorInformation);
|
|
234
263
|
}
|
|
235
264
|
});
|
|
236
265
|
},
|
|
237
|
-
provideColorPresentations(model, monacoResult) {
|
|
266
|
+
provideColorPresentations(model, monacoResult, token) {
|
|
238
267
|
return __awaiter(this, void 0, void 0, function* () {
|
|
239
268
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
240
269
|
const codeResult = colorInfos.get(monacoResult);
|
|
@@ -242,44 +271,42 @@ function createLanguageFeaturesProvider(worker, getSyncUris) {
|
|
|
242
271
|
const codeColors = yield languageService.getColorPresentations(model.uri.toString(), codeResult.color, {
|
|
243
272
|
start: monaco2protocol.asPosition(model.getPositionAt(0)),
|
|
244
273
|
end: monaco2protocol.asPosition(model.getPositionAt(model.getValueLength())),
|
|
245
|
-
});
|
|
274
|
+
}, token);
|
|
246
275
|
if (codeColors) {
|
|
247
276
|
return codeColors.map(protocol2monaco.asColorPresentation);
|
|
248
277
|
}
|
|
249
278
|
}
|
|
250
279
|
});
|
|
251
280
|
},
|
|
252
|
-
provideFoldingRanges(model, _context,
|
|
281
|
+
provideFoldingRanges(model, _context, token) {
|
|
253
282
|
return __awaiter(this, void 0, void 0, function* () {
|
|
254
283
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
255
|
-
const codeResult = yield languageService.getFoldingRanges(model.uri.toString());
|
|
284
|
+
const codeResult = yield languageService.getFoldingRanges(model.uri.toString(), token);
|
|
256
285
|
if (codeResult) {
|
|
257
286
|
return codeResult.map(protocol2monaco.asFoldingRange);
|
|
258
287
|
}
|
|
259
288
|
});
|
|
260
289
|
},
|
|
261
|
-
provideDeclaration(model, position,
|
|
290
|
+
provideDeclaration(model, position, token) {
|
|
262
291
|
return __awaiter(this, void 0, void 0, function* () {
|
|
263
292
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
264
|
-
const codeResult = yield languageService.findDefinition(model.uri.toString(), monaco2protocol.asPosition(position));
|
|
293
|
+
const codeResult = yield languageService.findDefinition(model.uri.toString(), monaco2protocol.asPosition(position), token);
|
|
265
294
|
if (codeResult) {
|
|
266
295
|
return codeResult.map(protocol2monaco.asLocation);
|
|
267
296
|
}
|
|
268
297
|
});
|
|
269
298
|
},
|
|
270
|
-
provideSelectionRanges(model, positions,
|
|
299
|
+
provideSelectionRanges(model, positions, token) {
|
|
271
300
|
return __awaiter(this, void 0, void 0, function* () {
|
|
272
301
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
273
|
-
const codeResults = yield Promise.all(positions.map((position) => languageService.getSelectionRanges(model.uri.toString(), [
|
|
274
|
-
monaco2protocol.asPosition(position),
|
|
275
|
-
])));
|
|
302
|
+
const codeResults = yield Promise.all(positions.map((position) => languageService.getSelectionRanges(model.uri.toString(), [monaco2protocol.asPosition(position)], token)));
|
|
276
303
|
return codeResults.map((codeResult) => { var _a; return (_a = codeResult === null || codeResult === void 0 ? void 0 : codeResult.map(protocol2monaco.asSelectionRange)) !== null && _a !== void 0 ? _a : []; });
|
|
277
304
|
});
|
|
278
305
|
},
|
|
279
|
-
provideSignatureHelp(model, position,
|
|
306
|
+
provideSignatureHelp(model, position, token, context) {
|
|
280
307
|
return __awaiter(this, void 0, void 0, function* () {
|
|
281
308
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
282
|
-
const codeResult = yield languageService.getSignatureHelp(model.uri.toString(), monaco2protocol.asPosition(position));
|
|
309
|
+
const codeResult = yield languageService.getSignatureHelp(model.uri.toString(), monaco2protocol.asPosition(position), monaco2protocol.asSignatureHelpContext(context), token);
|
|
283
310
|
if (codeResult) {
|
|
284
311
|
return {
|
|
285
312
|
value: protocol2monaco.asSignatureHelp(codeResult),
|
|
@@ -288,29 +315,29 @@ function createLanguageFeaturesProvider(worker, getSyncUris) {
|
|
|
288
315
|
}
|
|
289
316
|
});
|
|
290
317
|
},
|
|
291
|
-
provideRenameEdits(model, position, newName,
|
|
318
|
+
provideRenameEdits(model, position, newName, token) {
|
|
292
319
|
return __awaiter(this, void 0, void 0, function* () {
|
|
293
320
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
294
|
-
const codeResult = yield languageService.doRename(model.uri.toString(), monaco2protocol.asPosition(position), newName);
|
|
321
|
+
const codeResult = yield languageService.doRename(model.uri.toString(), monaco2protocol.asPosition(position), newName, token);
|
|
295
322
|
if (codeResult) {
|
|
296
323
|
return protocol2monaco.asWorkspaceEdit(codeResult);
|
|
297
324
|
}
|
|
298
325
|
});
|
|
299
326
|
},
|
|
300
|
-
provideReferences(model, position, _context,
|
|
327
|
+
provideReferences(model, position, _context, token) {
|
|
301
328
|
return __awaiter(this, void 0, void 0, function* () {
|
|
302
329
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
303
|
-
const codeResult = yield languageService.findReferences(model.uri.toString(), monaco2protocol.asPosition(position));
|
|
330
|
+
const codeResult = yield languageService.findReferences(model.uri.toString(), monaco2protocol.asPosition(position), token);
|
|
304
331
|
// TODO: can't show if only one result from libs
|
|
305
332
|
if (codeResult) {
|
|
306
333
|
return codeResult.map(protocol2monaco.asLocation);
|
|
307
334
|
}
|
|
308
335
|
});
|
|
309
336
|
},
|
|
310
|
-
provideInlayHints(model, range,
|
|
337
|
+
provideInlayHints(model, range, token) {
|
|
311
338
|
return __awaiter(this, void 0, void 0, function* () {
|
|
312
339
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
313
|
-
const codeResult = yield languageService.getInlayHints(model.uri.toString(), monaco2protocol.asRange(range));
|
|
340
|
+
const codeResult = yield languageService.getInlayHints(model.uri.toString(), monaco2protocol.asRange(range), token);
|
|
314
341
|
if (codeResult) {
|
|
315
342
|
return {
|
|
316
343
|
hints: codeResult.map(protocol2monaco.asInlayHint),
|
|
@@ -319,10 +346,10 @@ function createLanguageFeaturesProvider(worker, getSyncUris) {
|
|
|
319
346
|
}
|
|
320
347
|
});
|
|
321
348
|
},
|
|
322
|
-
provideHover(model, position,
|
|
349
|
+
provideHover(model, position, token) {
|
|
323
350
|
return __awaiter(this, void 0, void 0, function* () {
|
|
324
351
|
const languageService = yield worker.withSyncedResources(getSyncUris());
|
|
325
|
-
const codeResult = yield languageService.doHover(model.uri.toString(), monaco2protocol.asPosition(position));
|
|
352
|
+
const codeResult = yield languageService.doHover(model.uri.toString(), monaco2protocol.asPosition(position), token);
|
|
326
353
|
if (codeResult) {
|
|
327
354
|
return protocol2monaco.asHover(codeResult);
|
|
328
355
|
}
|
package/out/worker.d.ts
CHANGED
|
@@ -10,16 +10,18 @@ export declare function createLanguageService(options: {
|
|
|
10
10
|
compilerOptions: ts.CompilerOptions;
|
|
11
11
|
};
|
|
12
12
|
}): {};
|
|
13
|
-
export declare function createDtsHost(cdn: string, onFetch?: (fileName: string, text: string) => void): CdnDtsHost;
|
|
13
|
+
export declare function createDtsHost(cdn: string, versions?: Record<string, string>, onFetch?: (fileName: string, text: string) => void): CdnDtsHost;
|
|
14
14
|
declare class CdnDtsHost {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
cdn: string;
|
|
16
|
+
versions: Record<string, string>;
|
|
17
|
+
onFetch?: ((fileName: string, text: string) => void) | undefined;
|
|
17
18
|
files: Map<string, string | Promise<string | undefined> | undefined>;
|
|
18
19
|
lastUpdateFilesSize: number;
|
|
19
|
-
constructor(cdn: string, onFetch?: ((fileName: string, text: string) => void) | undefined);
|
|
20
|
+
constructor(cdn: string, versions?: Record<string, string>, onFetch?: ((fileName: string, text: string) => void) | undefined);
|
|
20
21
|
getVersion(): Promise<number>;
|
|
21
|
-
readFile(fileName: string): string | Promise<string | undefined
|
|
22
|
-
fetch(fileName: string
|
|
22
|
+
readFile(fileName: string): string | Promise<string | undefined> | undefined;
|
|
23
|
+
fetch(fileName: string): Promise<string | undefined>;
|
|
24
|
+
resolveRequestFileName(fileName: string): string;
|
|
23
25
|
/**
|
|
24
26
|
* save / load with json
|
|
25
27
|
*/
|
package/out/worker.js
CHANGED
|
@@ -14,7 +14,7 @@ const vscode_uri_1 = require("vscode-uri");
|
|
|
14
14
|
const axios_1 = require("axios");
|
|
15
15
|
function createLanguageService(options) {
|
|
16
16
|
var _a, _b, _c;
|
|
17
|
-
const
|
|
17
|
+
const dtsFiles = new Map();
|
|
18
18
|
const ts = options.typescript ? options.typescript.module : undefined;
|
|
19
19
|
const config = (_a = options.config) !== null && _a !== void 0 ? _a : {};
|
|
20
20
|
const compilerOptions = (_c = (_b = options.typescript) === null || _b === void 0 ? void 0 : _b.compilerOptions) !== null && _c !== void 0 ? _c : {};
|
|
@@ -38,12 +38,12 @@ function createLanguageService(options) {
|
|
|
38
38
|
continue;
|
|
39
39
|
}
|
|
40
40
|
InnocentRabbit.prototype[api] = (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
if (!
|
|
41
|
+
if (!options.dtsHost) {
|
|
42
42
|
return languageService[api](...args);
|
|
43
43
|
}
|
|
44
|
-
let oldVersion = yield
|
|
44
|
+
let oldVersion = yield options.dtsHost.getVersion();
|
|
45
45
|
let result = yield languageService[api](...args);
|
|
46
|
-
let newVersion = yield
|
|
46
|
+
let newVersion = yield options.dtsHost.getVersion();
|
|
47
47
|
while (newVersion !== oldVersion) {
|
|
48
48
|
oldVersion = newVersion;
|
|
49
49
|
if (newVersion !== dtsVersion) {
|
|
@@ -58,7 +58,7 @@ function createLanguageService(options) {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
result = yield languageService[api](...args);
|
|
61
|
-
newVersion = yield
|
|
61
|
+
newVersion = yield options.dtsHost.getVersion();
|
|
62
62
|
}
|
|
63
63
|
return result;
|
|
64
64
|
});
|
|
@@ -67,7 +67,7 @@ function createLanguageService(options) {
|
|
|
67
67
|
function createLanguageServiceHost() {
|
|
68
68
|
let projectVersion = 0;
|
|
69
69
|
const modelSnapshot = new WeakMap();
|
|
70
|
-
const
|
|
70
|
+
const dtsFileSnapshot = new Map();
|
|
71
71
|
const modelVersions = new Map();
|
|
72
72
|
const host = {
|
|
73
73
|
getProjectVersion() {
|
|
@@ -93,11 +93,9 @@ function createLanguageService(options) {
|
|
|
93
93
|
if (model) {
|
|
94
94
|
return model.version.toString();
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return dts.length.toString();
|
|
100
|
-
}
|
|
96
|
+
const dts = readDtsFile(fileName);
|
|
97
|
+
if (dts) {
|
|
98
|
+
return dts.length.toString();
|
|
101
99
|
}
|
|
102
100
|
return '';
|
|
103
101
|
},
|
|
@@ -117,19 +115,17 @@ function createLanguageService(options) {
|
|
|
117
115
|
}]);
|
|
118
116
|
return (_a = modelSnapshot.get(model)) === null || _a === void 0 ? void 0 : _a[1];
|
|
119
117
|
}
|
|
120
|
-
if (
|
|
121
|
-
return
|
|
118
|
+
if (dtsFileSnapshot.has(fileName)) {
|
|
119
|
+
return dtsFileSnapshot.get(fileName);
|
|
122
120
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
return webFileSnapshot.get(fileName);
|
|
132
|
-
}
|
|
121
|
+
const dtsFileText = readDtsFile(fileName);
|
|
122
|
+
if (dtsFileText !== undefined) {
|
|
123
|
+
dtsFileSnapshot.set(fileName, {
|
|
124
|
+
getText: (start, end) => dtsFileText.substring(start, end),
|
|
125
|
+
getLength: () => dtsFileText.length,
|
|
126
|
+
getChangeRange: () => undefined,
|
|
127
|
+
});
|
|
128
|
+
return dtsFileSnapshot.get(fileName);
|
|
133
129
|
}
|
|
134
130
|
},
|
|
135
131
|
getCompilationSettings() {
|
|
@@ -149,33 +145,43 @@ function createLanguageService(options) {
|
|
|
149
145
|
if (model) {
|
|
150
146
|
return model.getValue();
|
|
151
147
|
}
|
|
152
|
-
|
|
153
|
-
return dtsClient.readFile(fileName);
|
|
154
|
-
}
|
|
148
|
+
return readDtsFile(fileName);
|
|
155
149
|
},
|
|
156
150
|
fileExists(fileName) {
|
|
157
151
|
const model = options.workerContext.getMirrorModels().find(model => model.uri.fsPath === fileName);
|
|
158
152
|
if (model) {
|
|
159
153
|
return true;
|
|
160
154
|
}
|
|
161
|
-
|
|
162
|
-
return dtsClient.readFile(fileName) !== undefined;
|
|
163
|
-
}
|
|
164
|
-
return false;
|
|
155
|
+
return readDtsFile(fileName) !== undefined;
|
|
165
156
|
},
|
|
166
157
|
getTypeScriptModule: ts ? (() => ts) : undefined,
|
|
167
158
|
};
|
|
168
159
|
return host;
|
|
169
160
|
}
|
|
161
|
+
function readDtsFile(fileName) {
|
|
162
|
+
if (!dtsFiles.has(fileName) && options.dtsHost) {
|
|
163
|
+
dtsFiles.set(fileName, undefined);
|
|
164
|
+
readDtsFileAsync(fileName);
|
|
165
|
+
}
|
|
166
|
+
return dtsFiles.get(fileName);
|
|
167
|
+
}
|
|
168
|
+
function readDtsFileAsync(fileName) {
|
|
169
|
+
var _a;
|
|
170
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
171
|
+
const text = yield ((_a = options.dtsHost) === null || _a === void 0 ? void 0 : _a.readFile(fileName));
|
|
172
|
+
dtsFiles.set(fileName, text);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
170
175
|
}
|
|
171
176
|
exports.createLanguageService = createLanguageService;
|
|
172
|
-
function createDtsHost(cdn, onFetch) {
|
|
173
|
-
return new CdnDtsHost(cdn, onFetch);
|
|
177
|
+
function createDtsHost(cdn, versions = {}, onFetch) {
|
|
178
|
+
return new CdnDtsHost(cdn, versions, onFetch);
|
|
174
179
|
}
|
|
175
180
|
exports.createDtsHost = createDtsHost;
|
|
176
181
|
class CdnDtsHost {
|
|
177
|
-
constructor(cdn, onFetch) {
|
|
182
|
+
constructor(cdn, versions = {}, onFetch) {
|
|
178
183
|
this.cdn = cdn;
|
|
184
|
+
this.versions = versions;
|
|
179
185
|
this.onFetch = onFetch;
|
|
180
186
|
this.files = new Map();
|
|
181
187
|
this.lastUpdateFilesSize = 0;
|
|
@@ -190,20 +196,22 @@ class CdnDtsHost {
|
|
|
190
196
|
});
|
|
191
197
|
}
|
|
192
198
|
readFile(fileName) {
|
|
193
|
-
if (
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
this.files.set(fileName, this.fetch(fileName, url));
|
|
199
|
+
if (fileName.startsWith('/node_modules/')
|
|
200
|
+
// ignore .js because it's no help for intellisense
|
|
201
|
+
&& (fileName.endsWith('.d.ts') || fileName.endsWith('/package.json'))) {
|
|
202
|
+
if (!this.files.has(fileName)) {
|
|
203
|
+
this.files.set(fileName, undefined);
|
|
204
|
+
this.files.set(fileName, this.fetch(fileName));
|
|
200
205
|
}
|
|
206
|
+
return this.files.get(fileName);
|
|
201
207
|
}
|
|
202
|
-
return
|
|
208
|
+
return undefined;
|
|
203
209
|
}
|
|
204
|
-
fetch(fileName
|
|
210
|
+
fetch(fileName) {
|
|
205
211
|
var _a, _b;
|
|
206
212
|
return __awaiter(this, void 0, void 0, function* () {
|
|
213
|
+
const requestFileName = this.resolveRequestFileName(fileName);
|
|
214
|
+
const url = this.cdn + requestFileName.slice('/node_modules/'.length);
|
|
207
215
|
try {
|
|
208
216
|
const text = (_a = (yield axios_1.default.get(url, {
|
|
209
217
|
transformResponse: (res) => {
|
|
@@ -219,6 +227,15 @@ class CdnDtsHost {
|
|
|
219
227
|
}
|
|
220
228
|
});
|
|
221
229
|
}
|
|
230
|
+
resolveRequestFileName(fileName) {
|
|
231
|
+
for (const [key, version] of Object.entries(this.versions)) {
|
|
232
|
+
if (fileName.startsWith(`/node_modules/${key}/`)) {
|
|
233
|
+
fileName = fileName.replace(`/node_modules/${key}/`, `/node_modules/${key}@${version}/`);
|
|
234
|
+
return fileName;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return fileName;
|
|
238
|
+
}
|
|
222
239
|
/**
|
|
223
240
|
* save / load with json
|
|
224
241
|
*/
|
|
@@ -238,26 +255,4 @@ class CdnDtsHost {
|
|
|
238
255
|
}
|
|
239
256
|
}
|
|
240
257
|
}
|
|
241
|
-
function createDtsClient(server) {
|
|
242
|
-
const fetchTasks = [];
|
|
243
|
-
const files = new Map();
|
|
244
|
-
return {
|
|
245
|
-
readFile,
|
|
246
|
-
getVersion: () => server.getVersion(),
|
|
247
|
-
readFileAsync,
|
|
248
|
-
};
|
|
249
|
-
function readFile(fileName) {
|
|
250
|
-
if (!files.has(fileName)) {
|
|
251
|
-
files.set(fileName, undefined);
|
|
252
|
-
fetchTasks.push([fileName, readFileAsync(fileName)]);
|
|
253
|
-
}
|
|
254
|
-
return files.get(fileName);
|
|
255
|
-
}
|
|
256
|
-
function readFileAsync(fileName) {
|
|
257
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
258
|
-
const text = yield server.readFile(fileName);
|
|
259
|
-
files.set(fileName, text);
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
258
|
//# sourceMappingURL=worker.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/monaco",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0-alpha.0",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
"directory": "packages/monaco"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@volar/language-service": "1.
|
|
18
|
+
"@volar/language-service": "1.4.0-alpha.0",
|
|
19
19
|
"axios": "^1.3.4",
|
|
20
20
|
"monaco-editor-core": "^0.36.0",
|
|
21
21
|
"vscode-languageserver-protocol": "^3.17.3",
|
|
22
22
|
"vscode-uri": "^3.0.7"
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
|
+
"gitHead": "2607410cae341cf802b446062d446ad497be2057"
|
|
24
25
|
}
|