@volar/language-server 1.0.24 → 1.1.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/out/browser/index.js +7 -2
- package/out/common/documents.d.ts +1 -0
- package/out/common/documents.js +3 -0
- package/out/common/features/customFeatures.js +1 -1
- package/out/common/features/languageFeatures.d.ts +2 -1
- package/out/common/features/languageFeatures.js +85 -74
- package/out/common/project.js +47 -29
- package/out/common/server.js +28 -22
- package/out/common/utils/registerFeatures.js +24 -55
- package/out/common/workspaces.d.ts +0 -1
- package/out/common/workspaces.js +4 -1
- package/out/index.d.ts +1 -0
- package/out/index.js +1 -0
- package/out/node/index.js +6 -0
- package/out/protocol.js +12 -12
- package/out/types.d.ts +14 -2
- package/package.json +7 -6
package/out/browser/index.js
CHANGED
|
@@ -24,7 +24,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.startLanguageServer = exports.createConnection = void 0;
|
|
26
26
|
const request_light_1 = require("request-light");
|
|
27
|
-
const ts = require("typescript/lib/tsserverlibrary"); // bundle typescript lib in web
|
|
28
27
|
const vscode = require("vscode-languageserver/browser");
|
|
29
28
|
const server_1 = require("../common/server");
|
|
30
29
|
const http_1 = require("../common/schemaRequestHandlers/http");
|
|
@@ -43,8 +42,14 @@ function startLanguageServer(connection, ...plugins) {
|
|
|
43
42
|
plugins,
|
|
44
43
|
connection,
|
|
45
44
|
runtimeEnv: {
|
|
45
|
+
timer: {
|
|
46
|
+
setImmediate(callback, ...args) {
|
|
47
|
+
const handle = setTimeout(callback, 0, ...args);
|
|
48
|
+
return { dispose: () => clearTimeout(handle) };
|
|
49
|
+
},
|
|
50
|
+
},
|
|
46
51
|
loadTypescript() {
|
|
47
|
-
return
|
|
52
|
+
return require('typescript'); // force bundle because not support load by user config in web
|
|
48
53
|
},
|
|
49
54
|
loadTypescriptLocalized(tsdk, locale) {
|
|
50
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -17,6 +17,7 @@ declare class IncrementalScriptSnapshot {
|
|
|
17
17
|
changes: IncrementalScriptSnapshotChange[];
|
|
18
18
|
constructor(uri: string, languageId: string, version: number, text: string);
|
|
19
19
|
get version(): number;
|
|
20
|
+
get languageId(): string;
|
|
20
21
|
update(params: vscode.DidChangeTextDocumentParams): void;
|
|
21
22
|
getSnapshot(): ts.IScriptSnapshot;
|
|
22
23
|
getDocument(): TextDocument;
|
package/out/common/documents.js
CHANGED
|
@@ -20,6 +20,9 @@ class IncrementalScriptSnapshot {
|
|
|
20
20
|
get version() {
|
|
21
21
|
return this.changes[this.changes.length - 1].version;
|
|
22
22
|
}
|
|
23
|
+
get languageId() {
|
|
24
|
+
return this.document.languageId;
|
|
25
|
+
}
|
|
23
26
|
update(params) {
|
|
24
27
|
vscode_languageserver_textdocument_1.TextDocument.update(this.document, params.contentChanges, params.textDocument.version);
|
|
25
28
|
this.changes = [
|
|
@@ -78,7 +78,7 @@ function register(connection, projects) {
|
|
|
78
78
|
const rootVirtualFile = (_q = (_p = project.project) === null || _p === void 0 ? void 0 : _p.getLanguageService().context.core.virtualFiles.getSource(shared.uriToFileName(document.uri))) === null || _q === void 0 ? void 0 : _q.root;
|
|
79
79
|
if (rootVirtualFile) {
|
|
80
80
|
(0, language_core_1.forEachEmbeddedFile)(rootVirtualFile, e => {
|
|
81
|
-
if (e.snapshot.getLength() && e.kind ===
|
|
81
|
+
if (e.snapshot.getLength() && e.kind === language_core_1.FileKind.TypeScriptHostFile) {
|
|
82
82
|
fileNames.push(e.fileName);
|
|
83
83
|
}
|
|
84
84
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver';
|
|
2
2
|
import { CancellationTokenHost } from '../cancellationPipe';
|
|
3
3
|
import type { Workspaces } from '../workspaces';
|
|
4
|
-
|
|
4
|
+
import { RuntimeEnvironment } from '../../types';
|
|
5
|
+
export declare function register(connection: vscode.Connection, projects: Workspaces, initParams: vscode.InitializeParams, cancelHost: CancellationTokenHost, semanticTokensLegend: vscode.SemanticTokensLegend, runtime: RuntimeEnvironment): void;
|
|
@@ -13,59 +13,59 @@ const embedded = require("@volar/language-service");
|
|
|
13
13
|
const vscode = require("vscode-languageserver");
|
|
14
14
|
const protocol_1 = require("../../protocol");
|
|
15
15
|
const shared = require("@volar/shared");
|
|
16
|
-
function register(connection, projects, initParams, cancelHost, semanticTokensLegend) {
|
|
16
|
+
function register(connection, projects, initParams, cancelHost, semanticTokensLegend, runtime) {
|
|
17
17
|
let lastCompleteUri;
|
|
18
18
|
let lastCompleteLs;
|
|
19
19
|
let lastCodeLensLs;
|
|
20
20
|
let lastCodeActionLs;
|
|
21
21
|
let lastCallHierarchyLs;
|
|
22
|
-
connection.onDocumentFormatting((params) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
22
|
+
connection.onDocumentFormatting((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
24
24
|
return vueLs.format(params.textDocument.uri, params.options);
|
|
25
25
|
});
|
|
26
26
|
}));
|
|
27
|
-
connection.onDocumentRangeFormatting((params) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
27
|
+
connection.onDocumentRangeFormatting((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
29
29
|
return vueLs.format(params.textDocument.uri, params.options, params.range);
|
|
30
30
|
});
|
|
31
31
|
}));
|
|
32
|
-
connection.onDocumentOnTypeFormatting((params) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
32
|
+
connection.onDocumentOnTypeFormatting((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
34
34
|
return vueLs.format(params.textDocument.uri, params.options, undefined, params);
|
|
35
35
|
});
|
|
36
36
|
}));
|
|
37
|
-
connection.onSelectionRanges((params) => __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
37
|
+
connection.onSelectionRanges((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
39
39
|
return vueLs.getSelectionRanges(params.textDocument.uri, params.positions);
|
|
40
40
|
});
|
|
41
41
|
}));
|
|
42
|
-
connection.onFoldingRanges((params) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
42
|
+
connection.onFoldingRanges((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
44
44
|
return vueLs.getFoldingRanges(params.textDocument.uri);
|
|
45
45
|
});
|
|
46
46
|
}));
|
|
47
|
-
connection.languages.onLinkedEditingRange((params) => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
47
|
+
connection.languages.onLinkedEditingRange((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
49
49
|
return vueLs.findLinkedEditingRanges(params.textDocument.uri, params.position);
|
|
50
50
|
});
|
|
51
51
|
}));
|
|
52
|
-
connection.onDocumentSymbol((params) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
52
|
+
connection.onDocumentSymbol((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
54
54
|
return vueLs.findDocumentSymbols(params.textDocument.uri);
|
|
55
55
|
});
|
|
56
56
|
}));
|
|
57
|
-
connection.onDocumentColor((params) => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
57
|
+
connection.onDocumentColor((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
59
59
|
return vueLs.findDocumentColors(params.textDocument.uri);
|
|
60
60
|
});
|
|
61
61
|
}));
|
|
62
|
-
connection.onColorPresentation((params) => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
62
|
+
connection.onColorPresentation((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
64
64
|
return vueLs.getColorPresentations(params.textDocument.uri, params.color, params.range);
|
|
65
65
|
});
|
|
66
66
|
}));
|
|
67
|
-
connection.onCompletion((params) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
return worker(params.textDocument.uri, (vueLs) => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
connection.onCompletion((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
return worker(params.textDocument.uri, token, (vueLs) => __awaiter(this, void 0, void 0, function* () {
|
|
69
69
|
lastCompleteUri = params.textDocument.uri;
|
|
70
70
|
lastCompleteLs = vueLs;
|
|
71
71
|
const list = yield vueLs.doComplete(params.textDocument.uri, params.position, params.context);
|
|
@@ -84,28 +84,28 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
84
84
|
}
|
|
85
85
|
return item;
|
|
86
86
|
}));
|
|
87
|
-
connection.onHover((params) => __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
87
|
+
connection.onHover((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
89
89
|
return vueLs.doHover(params.textDocument.uri, params.position);
|
|
90
90
|
});
|
|
91
91
|
}));
|
|
92
|
-
connection.onSignatureHelp((params) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
92
|
+
connection.onSignatureHelp((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
94
94
|
return vueLs.getSignatureHelp(params.textDocument.uri, params.position, params.context);
|
|
95
95
|
});
|
|
96
96
|
}));
|
|
97
|
-
connection.onPrepareRename((params) => __awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
97
|
+
connection.onPrepareRename((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
99
99
|
return vueLs.prepareRename(params.textDocument.uri, params.position);
|
|
100
100
|
});
|
|
101
101
|
}));
|
|
102
|
-
connection.onRenameRequest((params) => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
102
|
+
connection.onRenameRequest((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
104
104
|
return vueLs.doRename(params.textDocument.uri, params.position, params.newName);
|
|
105
105
|
});
|
|
106
106
|
}));
|
|
107
|
-
connection.onCodeLens((params) => __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
return worker(params.textDocument.uri, (vueLs) => __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
connection.onCodeLens((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
return worker(params.textDocument.uri, token, (vueLs) => __awaiter(this, void 0, void 0, function* () {
|
|
109
109
|
lastCodeLensLs = vueLs;
|
|
110
110
|
return vueLs.doCodeLens(params.textDocument.uri);
|
|
111
111
|
}));
|
|
@@ -120,7 +120,7 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
120
120
|
if (!args) {
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
return worker(args[0], vueLs => {
|
|
123
|
+
return worker(args[0], token, vueLs => {
|
|
124
124
|
return vueLs.doExecuteCommand(params.command, args, {
|
|
125
125
|
token,
|
|
126
126
|
workDoneProgress,
|
|
@@ -130,8 +130,8 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
}));
|
|
133
|
-
connection.onCodeAction((params) => __awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
return worker(params.textDocument.uri, (vueLs) => __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
connection.onCodeAction((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
return worker(params.textDocument.uri, token, (vueLs) => __awaiter(this, void 0, void 0, function* () {
|
|
135
135
|
var _b, _c, _d;
|
|
136
136
|
lastCodeActionLs = vueLs;
|
|
137
137
|
let codeActions = (_b = yield vueLs.doCodeActions(params.textDocument.uri, params.range, params.context)) !== null && _b !== void 0 ? _b : [];
|
|
@@ -153,38 +153,38 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
153
153
|
var _e;
|
|
154
154
|
return (_e = yield lastCodeActionLs.doCodeActionResolve(codeAction)) !== null && _e !== void 0 ? _e : codeAction;
|
|
155
155
|
}));
|
|
156
|
-
connection.onReferences((params) => __awaiter(this, void 0, void 0, function* () {
|
|
157
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
156
|
+
connection.onReferences((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
158
158
|
return vueLs.findReferences(params.textDocument.uri, params.position);
|
|
159
159
|
});
|
|
160
160
|
}));
|
|
161
|
-
connection.onRequest(protocol_1.FindFileReferenceRequest.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
162
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
161
|
+
connection.onRequest(protocol_1.FindFileReferenceRequest.type, (params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
163
163
|
return vueLs.findFileReferences(params.textDocument.uri);
|
|
164
164
|
});
|
|
165
165
|
}));
|
|
166
|
-
connection.onImplementation((params) => __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
166
|
+
connection.onImplementation((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
168
168
|
return vueLs.findImplementations(params.textDocument.uri, params.position);
|
|
169
169
|
});
|
|
170
170
|
}));
|
|
171
|
-
connection.onDefinition((params) => __awaiter(this, void 0, void 0, function* () {
|
|
172
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
171
|
+
connection.onDefinition((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
173
173
|
return vueLs.findDefinition(params.textDocument.uri, params.position);
|
|
174
174
|
});
|
|
175
175
|
}));
|
|
176
|
-
connection.onTypeDefinition((params) => __awaiter(this, void 0, void 0, function* () {
|
|
177
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
176
|
+
connection.onTypeDefinition((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
177
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
178
178
|
return vueLs.findTypeDefinition(params.textDocument.uri, params.position);
|
|
179
179
|
});
|
|
180
180
|
}));
|
|
181
|
-
connection.onDocumentHighlight((params) => __awaiter(this, void 0, void 0, function* () {
|
|
182
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
181
|
+
connection.onDocumentHighlight((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
183
183
|
return vueLs.findDocumentHighlights(params.textDocument.uri, params.position);
|
|
184
184
|
});
|
|
185
185
|
}));
|
|
186
|
-
connection.onDocumentLinks((params) => __awaiter(this, void 0, void 0, function* () {
|
|
187
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
186
|
+
connection.onDocumentLinks((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
188
188
|
return vueLs.findDocumentLinks(params.textDocument.uri);
|
|
189
189
|
});
|
|
190
190
|
}));
|
|
@@ -203,9 +203,9 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
203
203
|
}
|
|
204
204
|
return results;
|
|
205
205
|
}));
|
|
206
|
-
connection.languages.callHierarchy.onPrepare((params) => __awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
connection.languages.callHierarchy.onPrepare((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
207
207
|
var _f;
|
|
208
|
-
return (_f = yield worker(params.textDocument.uri, (vueLs) => __awaiter(this, void 0, void 0, function* () {
|
|
208
|
+
return (_f = yield worker(params.textDocument.uri, token, (vueLs) => __awaiter(this, void 0, void 0, function* () {
|
|
209
209
|
lastCallHierarchyLs = vueLs;
|
|
210
210
|
return vueLs.callHierarchy.doPrepare(params.textDocument.uri, params.position);
|
|
211
211
|
}))) !== null && _f !== void 0 ? _f : [];
|
|
@@ -221,9 +221,7 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
221
221
|
connection.languages.semanticTokens.on((params, token, _, resultProgress) => __awaiter(this, void 0, void 0, function* () {
|
|
222
222
|
var _j;
|
|
223
223
|
yield shared.sleep(200);
|
|
224
|
-
|
|
225
|
-
return buildTokens([]);
|
|
226
|
-
return (_j = yield worker(params.textDocument.uri, (vueLs) => __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
return (_j = yield worker(params.textDocument.uri, token, (vueLs) => __awaiter(this, void 0, void 0, function* () {
|
|
227
225
|
var _k;
|
|
228
226
|
const result = (_k = yield (vueLs === null || vueLs === void 0 ? void 0 : vueLs.getSemanticTokens(params.textDocument.uri, undefined, semanticTokensLegend, token, tokens => resultProgress === null || resultProgress === void 0 ? void 0 : resultProgress.report(buildTokens(tokens))))) !== null && _k !== void 0 ? _k : [];
|
|
229
227
|
return buildTokens(result);
|
|
@@ -232,18 +230,16 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
232
230
|
connection.languages.semanticTokens.onRange((params, token, _, resultProgress) => __awaiter(this, void 0, void 0, function* () {
|
|
233
231
|
var _l;
|
|
234
232
|
yield shared.sleep(200);
|
|
235
|
-
|
|
236
|
-
return buildTokens([]);
|
|
237
|
-
return (_l = yield worker(params.textDocument.uri, (vueLs) => __awaiter(this, void 0, void 0, function* () {
|
|
233
|
+
return (_l = yield worker(params.textDocument.uri, token, (vueLs) => __awaiter(this, void 0, void 0, function* () {
|
|
238
234
|
var _m;
|
|
239
235
|
const result = (_m = yield (vueLs === null || vueLs === void 0 ? void 0 : vueLs.getSemanticTokens(params.textDocument.uri, params.range, semanticTokensLegend, token, tokens => resultProgress === null || resultProgress === void 0 ? void 0 : resultProgress.report(buildTokens(tokens))))) !== null && _m !== void 0 ? _m : [];
|
|
240
236
|
return buildTokens(result);
|
|
241
237
|
}))) !== null && _l !== void 0 ? _l : buildTokens([]);
|
|
242
238
|
}));
|
|
243
239
|
connection.languages.diagnostics.on((params, token, _workDoneProgressReporter, resultProgressReporter) => __awaiter(this, void 0, void 0, function* () {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
return vueLs.doValidation(params.textDocument.uri,
|
|
240
|
+
const result = yield worker(params.textDocument.uri, token, vueLs => {
|
|
241
|
+
const tsToken = cancelHost.createCancellationToken(token);
|
|
242
|
+
return vueLs.doValidation(params.textDocument.uri, tsToken, errors => {
|
|
247
243
|
// resultProgressReporter is undefined in vscode
|
|
248
244
|
resultProgressReporter === null || resultProgressReporter === void 0 ? void 0 : resultProgressReporter.report({
|
|
249
245
|
relatedDocuments: {
|
|
@@ -260,20 +256,20 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
260
256
|
items: result !== null && result !== void 0 ? result : [],
|
|
261
257
|
};
|
|
262
258
|
}));
|
|
263
|
-
connection.languages.inlayHint.on((params) => __awaiter(this, void 0, void 0, function* () {
|
|
264
|
-
return worker(params.textDocument.uri, (vueLs) => __awaiter(this, void 0, void 0, function* () {
|
|
259
|
+
connection.languages.inlayHint.on((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
260
|
+
return worker(params.textDocument.uri, token, (vueLs) => __awaiter(this, void 0, void 0, function* () {
|
|
265
261
|
return vueLs.getInlayHints(params.textDocument.uri, params.range);
|
|
266
262
|
}));
|
|
267
263
|
}));
|
|
268
264
|
// TODO: connection.languages.inlayHint.resolve
|
|
269
|
-
connection.workspace.onWillRenameFiles((params) => __awaiter(this, void 0, void 0, function* () {
|
|
265
|
+
connection.workspace.onWillRenameFiles((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
270
266
|
const config = yield connection.workspace.getConfiguration('volar.updateImportsOnFileMove.enabled');
|
|
271
267
|
if (!config) {
|
|
272
268
|
return null;
|
|
273
269
|
}
|
|
274
270
|
const _edits = yield Promise.all(params.files.map((file) => __awaiter(this, void 0, void 0, function* () {
|
|
275
271
|
var _o;
|
|
276
|
-
return (_o = yield worker(file.oldUri, vueLs => {
|
|
272
|
+
return (_o = yield worker(file.oldUri, token, vueLs => {
|
|
277
273
|
var _a;
|
|
278
274
|
return (_a = vueLs.getEditsForFileRename(file.oldUri, file.newUri)) !== null && _a !== void 0 ? _a : null;
|
|
279
275
|
})) !== null && _o !== void 0 ? _o : null;
|
|
@@ -285,22 +281,37 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
285
281
|
}
|
|
286
282
|
return null;
|
|
287
283
|
}));
|
|
288
|
-
connection.onRequest(protocol_1.AutoInsertRequest.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
289
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
284
|
+
connection.onRequest(protocol_1.AutoInsertRequest.type, (params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
285
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
290
286
|
return vueLs.doAutoInsert(params.textDocument.uri, params.position, params.options);
|
|
291
287
|
});
|
|
292
288
|
}));
|
|
293
|
-
function worker(uri, cb) {
|
|
294
|
-
return
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
return
|
|
289
|
+
function worker(uri, token, cb) {
|
|
290
|
+
return new Promise(resolve => {
|
|
291
|
+
runtime.timer.setImmediate(() => __awaiter(this, void 0, void 0, function* () {
|
|
292
|
+
if (token.isCancellationRequested) {
|
|
293
|
+
resolve(undefined);
|
|
294
|
+
return;
|
|
299
295
|
}
|
|
300
|
-
|
|
301
|
-
|
|
296
|
+
const vueLs = yield getLanguageService(uri);
|
|
297
|
+
if (vueLs) {
|
|
298
|
+
try { // handle TS cancel throw
|
|
299
|
+
const result = yield cb(vueLs);
|
|
300
|
+
if (token.isCancellationRequested) {
|
|
301
|
+
resolve(undefined);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
resolve(result);
|
|
305
|
+
}
|
|
306
|
+
catch (_a) {
|
|
307
|
+
resolve(undefined);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
302
310
|
}
|
|
303
|
-
|
|
311
|
+
else {
|
|
312
|
+
resolve(undefined);
|
|
313
|
+
}
|
|
314
|
+
}));
|
|
304
315
|
});
|
|
305
316
|
}
|
|
306
317
|
function buildTokens(tokens) {
|
package/out/common/project.js
CHANGED
|
@@ -14,6 +14,7 @@ const embeddedLS = require("@volar/language-service");
|
|
|
14
14
|
const shared = require("@volar/shared");
|
|
15
15
|
const path = require("typesafe-path");
|
|
16
16
|
const vscode = require("vscode-languageserver");
|
|
17
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
17
18
|
const types_1 = require("../types");
|
|
18
19
|
const uriMap_1 = require("./utils/uriMap");
|
|
19
20
|
function createProject(context) {
|
|
@@ -79,9 +80,7 @@ function createProject(context) {
|
|
|
79
80
|
rootUri: context.rootUri,
|
|
80
81
|
configurationHost: context.workspace.workspaces.configurationHost,
|
|
81
82
|
fileSystemProvider: context.workspace.workspaces.server.runtimeEnv.fileSystemProvide,
|
|
82
|
-
documentContext: context.workspace.workspaces.ts
|
|
83
|
-
? getHTMLDocumentContext(context.workspace.workspaces.ts, languageServiceHost)
|
|
84
|
-
: undefined,
|
|
83
|
+
documentContext: getDocumentContext(context.workspace.workspaces.ts, languageServiceHost, context.rootUri.toString()),
|
|
85
84
|
schemaRequestService: (uri) => __awaiter(this, void 0, void 0, function* () {
|
|
86
85
|
const protocol = uri.substring(0, uri.indexOf(':'));
|
|
87
86
|
const builtInHandler = context.workspace.workspaces.server.runtimeEnv.schemaRequestHandlers[protocol];
|
|
@@ -170,8 +169,12 @@ function createProject(context) {
|
|
|
170
169
|
getCompilationSettings: () => parsedCommandLine.options,
|
|
171
170
|
getScriptVersion,
|
|
172
171
|
getScriptSnapshot,
|
|
173
|
-
getTypeScriptModule: () => {
|
|
172
|
+
getTypeScriptModule: context.workspace.workspaces.ts ? () => {
|
|
174
173
|
return context.workspace.workspaces.ts;
|
|
174
|
+
} : undefined,
|
|
175
|
+
getScriptLanguageId: (fileName) => {
|
|
176
|
+
var _a;
|
|
177
|
+
return (_a = context.workspace.workspaces.documents.data.pathGet(fileName)) === null || _a === void 0 ? void 0 : _a.languageId;
|
|
175
178
|
},
|
|
176
179
|
};
|
|
177
180
|
if (context.workspace.workspaces.initOptions.noProjectReferences) {
|
|
@@ -243,7 +246,7 @@ function createProject(context) {
|
|
|
243
246
|
}
|
|
244
247
|
exports.createProject = createProject;
|
|
245
248
|
function createParsedCommandLine(ts, sys, rootPath, tsConfig, plugins) {
|
|
246
|
-
const extraFileExtensions = plugins.map(plugin => { var _a; return (_a = plugin.
|
|
249
|
+
const extraFileExtensions = plugins.map(plugin => { var _a; return (_a = plugin.tsconfigExtraFileExtensions) !== null && _a !== void 0 ? _a : []; }).flat();
|
|
247
250
|
if (ts) {
|
|
248
251
|
try {
|
|
249
252
|
let content;
|
|
@@ -271,38 +274,53 @@ function createParsedCommandLine(ts, sys, rootPath, tsConfig, plugins) {
|
|
|
271
274
|
options: {},
|
|
272
275
|
};
|
|
273
276
|
}
|
|
274
|
-
function
|
|
277
|
+
function getDocumentContext(ts, host, rootUri) {
|
|
275
278
|
const documentContext = {
|
|
276
|
-
resolveReference(ref, base) {
|
|
279
|
+
resolveReference: (ref, base) => {
|
|
277
280
|
var _a, _b;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
for (let failed of failedLookupLocations !== null && failedLookupLocations !== void 0 ? failedLookupLocations : []) {
|
|
286
|
-
const fileName = path.basename(failed);
|
|
287
|
-
if (fileName === 'index.d.ts' || fileName === '*.d.ts') {
|
|
288
|
-
dirs.add(path.dirname(failed));
|
|
289
|
-
}
|
|
290
|
-
if (failed.endsWith('.d.ts')) {
|
|
291
|
-
failed = failed.substring(0, failed.length - '.d.ts'.length);
|
|
281
|
+
if (ts && host) { // support tsconfig.json paths
|
|
282
|
+
const isUri = base.indexOf('://') >= 0;
|
|
283
|
+
const resolveResult = ts.resolveModuleName(ref, isUri ? shared.uriToFileName(base) : base, host.getCompilationSettings(), host);
|
|
284
|
+
const failedLookupLocations = typeof resolveResult === 'object' ? resolveResult.failedLookupLocations : [];
|
|
285
|
+
const dirs = new Set();
|
|
286
|
+
if (!failedLookupLocations) {
|
|
287
|
+
console.warn(`[volar] failedLookupLocations not exists, ts: ${ts.version}`);
|
|
292
288
|
}
|
|
293
|
-
|
|
294
|
-
|
|
289
|
+
for (let failed of failedLookupLocations !== null && failedLookupLocations !== void 0 ? failedLookupLocations : []) {
|
|
290
|
+
const fileName = path.basename(failed);
|
|
291
|
+
if (fileName === 'index.d.ts' || fileName === '*.d.ts') {
|
|
292
|
+
dirs.add(path.dirname(failed));
|
|
293
|
+
}
|
|
294
|
+
if (failed.endsWith('.d.ts')) {
|
|
295
|
+
failed = failed.substring(0, failed.length - '.d.ts'.length);
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
if (host.fileExists(failed)) {
|
|
301
|
+
return isUri ? shared.fileNameToUri(failed) : failed;
|
|
302
|
+
}
|
|
295
303
|
}
|
|
296
|
-
|
|
297
|
-
|
|
304
|
+
for (const dir of dirs) {
|
|
305
|
+
if ((_b = (_a = host.directoryExists) === null || _a === void 0 ? void 0 : _a.call(host, dir)) !== null && _b !== void 0 ? _b : true) {
|
|
306
|
+
return isUri ? shared.fileNameToUri(dir) : dir;
|
|
307
|
+
}
|
|
298
308
|
}
|
|
299
309
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
310
|
+
// original html resolveReference
|
|
311
|
+
if (ref.match(/^\w[\w\d+.-]*:/)) {
|
|
312
|
+
// starts with a schema
|
|
313
|
+
return ref;
|
|
314
|
+
}
|
|
315
|
+
if (ref[0] === '/') { // resolve absolute path against the current workspace folder
|
|
316
|
+
const folderUri = rootUri;
|
|
317
|
+
if (folderUri) {
|
|
318
|
+
return folderUri + ref.substr(1);
|
|
303
319
|
}
|
|
304
320
|
}
|
|
305
|
-
|
|
321
|
+
const baseUri = vscode_uri_1.URI.parse(base);
|
|
322
|
+
const baseUriDir = baseUri.path.endsWith('/') ? baseUri : vscode_uri_1.Utils.dirname(baseUri);
|
|
323
|
+
return vscode_uri_1.Utils.resolvePath(baseUriDir, ref).toString(true);
|
|
306
324
|
},
|
|
307
325
|
};
|
|
308
326
|
return documentContext;
|
package/out/common/server.js
CHANGED
|
@@ -17,6 +17,7 @@ const configurationHost_1 = require("./configurationHost");
|
|
|
17
17
|
const documents_1 = require("./documents");
|
|
18
18
|
const registerFeatures_1 = require("./utils/registerFeatures");
|
|
19
19
|
const workspaces_1 = require("./workspaces");
|
|
20
|
+
const l10n = require("@vscode/l10n");
|
|
20
21
|
function startCommonLanguageServer(context) {
|
|
21
22
|
let initParams;
|
|
22
23
|
let options;
|
|
@@ -27,10 +28,13 @@ function startCommonLanguageServer(context) {
|
|
|
27
28
|
let plugins;
|
|
28
29
|
const documents = (0, documents_1.createDocuments)(context.connection);
|
|
29
30
|
context.connection.onInitialize((_params) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
var _a, _b, _c;
|
|
31
|
+
var _a, _b, _c, _d;
|
|
31
32
|
initParams = _params;
|
|
32
33
|
options = initParams.initializationOptions;
|
|
33
34
|
plugins = context.plugins.map(plugin => plugin(options));
|
|
35
|
+
if (options.l10n) {
|
|
36
|
+
yield l10n.config({ uri: options.l10n.location });
|
|
37
|
+
}
|
|
34
38
|
if (((_a = initParams.capabilities.workspace) === null || _a === void 0 ? void 0 : _a.workspaceFolders) && initParams.workspaceFolders) {
|
|
35
39
|
roots = initParams.workspaceFolders.map(folder => vscode_uri_1.URI.parse(folder.uri));
|
|
36
40
|
}
|
|
@@ -56,7 +60,10 @@ function startCommonLanguageServer(context) {
|
|
|
56
60
|
version: packageJson.version,
|
|
57
61
|
};
|
|
58
62
|
}
|
|
59
|
-
catch (
|
|
63
|
+
catch (_e) { }
|
|
64
|
+
for (const plugin of plugins) {
|
|
65
|
+
(_d = plugin.onInitialize) === null || _d === void 0 ? void 0 : _d.call(plugin, result);
|
|
66
|
+
}
|
|
60
67
|
return result;
|
|
61
68
|
}));
|
|
62
69
|
context.connection.onInitialized(() => {
|
|
@@ -76,26 +83,25 @@ function startCommonLanguageServer(context) {
|
|
|
76
83
|
if (options.serverMode !== types_1.ServerMode.Syntactic
|
|
77
84
|
&& !options.disableFileWatcher
|
|
78
85
|
&& ((_c = (_b = initParams.capabilities.workspace) === null || _b === void 0 ? void 0 : _b.didChangeWatchedFiles) === null || _c === void 0 ? void 0 : _c.dynamicRegistration)) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
'
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
'jsx',
|
|
90
|
-
'tsx',
|
|
91
|
-
'json',
|
|
92
|
-
...plugins.map(plugin => { var _a, _b; return (_b = (_a = plugin.extraFileExtensions) === null || _a === void 0 ? void 0 : _a.map(ext => ext.extension)) !== null && _b !== void 0 ? _b : []; }).flat(),
|
|
93
|
-
].join(',')}}`
|
|
94
|
-
},
|
|
95
|
-
]
|
|
96
|
-
});
|
|
86
|
+
const exts = plugins.map(plugin => { var _a; return (_a = plugin.extensions.fileWatcher) !== null && _a !== void 0 ? _a : []; }).flat();
|
|
87
|
+
if (exts.length) {
|
|
88
|
+
context.connection.client.register(vscode.DidChangeWatchedFilesNotification.type, {
|
|
89
|
+
watchers: [
|
|
90
|
+
{
|
|
91
|
+
globPattern: `**/*.{${exts.join(',')}}`
|
|
92
|
+
},
|
|
93
|
+
]
|
|
94
|
+
});
|
|
95
|
+
}
|
|
97
96
|
}
|
|
98
97
|
});
|
|
98
|
+
context.connection.onShutdown(() => __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
if (projects) {
|
|
100
|
+
for (const workspace of projects.workspaces) {
|
|
101
|
+
(yield workspace[1]).dispose();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
99
105
|
context.connection.listen();
|
|
100
106
|
function createLanguageServiceHost() {
|
|
101
107
|
var _a;
|
|
@@ -121,9 +127,9 @@ function startCommonLanguageServer(context) {
|
|
|
121
127
|
projects.add(root);
|
|
122
128
|
}
|
|
123
129
|
(yield Promise.resolve().then(() => require('./features/customFeatures'))).register(context.connection, projects);
|
|
124
|
-
(yield Promise.resolve().then(() => require('./features/languageFeatures'))).register(context.connection, projects, initParams, cancelTokenHost, getSemanticTokensLegend());
|
|
130
|
+
(yield Promise.resolve().then(() => require('./features/languageFeatures'))).register(context.connection, projects, initParams, cancelTokenHost, getSemanticTokensLegend(), context.runtimeEnv);
|
|
125
131
|
for (const plugin of plugins) {
|
|
126
|
-
(_a = plugin.
|
|
132
|
+
(_a = plugin.onInitialized) === null || _a === void 0 ? void 0 : _a.call(plugin, getLanguageService);
|
|
127
133
|
}
|
|
128
134
|
function getLanguageService(uri) {
|
|
129
135
|
var _a;
|
|
@@ -66,18 +66,7 @@ function setupCapabilities(params, server, initOptions, plugins, semanticTokensL
|
|
|
66
66
|
}
|
|
67
67
|
if (!initOptions.respectClientCapabilities || ((_s = params.textDocument) === null || _s === void 0 ? void 0 : _s.completion)) {
|
|
68
68
|
server.completionProvider = {
|
|
69
|
-
|
|
70
|
-
// hardcode to fix https://github.com/sublimelsp/LSP-volar/issues/114
|
|
71
|
-
triggerCharacters: [...new Set([
|
|
72
|
-
'/', '-', ':',
|
|
73
|
-
...'>+^*()#.[]$@-{}'.split(''),
|
|
74
|
-
'.', ':', '<', '"', '=', '/',
|
|
75
|
-
'@',
|
|
76
|
-
'"', ':',
|
|
77
|
-
'.', '"', '\'', '`', '/', '<', '@', '#', ' ',
|
|
78
|
-
'*',
|
|
79
|
-
'@', // typescript-comment
|
|
80
|
-
])],
|
|
69
|
+
triggerCharacters: '!@#$%^&*()_+-=`~{}|[]\:";\'<>?,./ '.split(''),
|
|
81
70
|
resolveProvider: true,
|
|
82
71
|
};
|
|
83
72
|
if (initOptions.ignoreTriggerCharacters) {
|
|
@@ -126,53 +115,33 @@ function setupCapabilities(params, server, initOptions, plugins, semanticTokensL
|
|
|
126
115
|
server.inlayHintProvider = true;
|
|
127
116
|
}
|
|
128
117
|
if ((!initOptions.respectClientCapabilities || ((_2 = params.textDocument) === null || _2 === void 0 ? void 0 : _2.diagnostic)) && ((_3 = initOptions.diagnosticModel) !== null && _3 !== void 0 ? _3 : types_1.DiagnosticModel.Push) === types_1.DiagnosticModel.Pull) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
'cts',
|
|
138
|
-
'mts',
|
|
139
|
-
'jsx',
|
|
140
|
-
'tsx',
|
|
141
|
-
// 'json',
|
|
142
|
-
...plugins.map(plugin => { var _a, _b; return (_b = (_a = plugin.extraFileExtensions) === null || _a === void 0 ? void 0 : _a.map(ext => ext.extension)) !== null && _b !== void 0 ? _b : []; }).flat(),
|
|
143
|
-
].join(',')}}`
|
|
144
|
-
}
|
|
145
|
-
],
|
|
146
|
-
interFileDependencies: true,
|
|
147
|
-
workspaceDiagnostics: false,
|
|
148
|
-
};
|
|
118
|
+
const selector = plugins.map(plugin => { var _a; return (_a = plugin.diagnosticDocumentSelector) !== null && _a !== void 0 ? _a : []; }).flat();
|
|
119
|
+
if (selector) {
|
|
120
|
+
server.diagnosticProvider = {
|
|
121
|
+
documentSelector: selector,
|
|
122
|
+
interFileDependencies: true,
|
|
123
|
+
workspaceDiagnostics: false,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
149
126
|
}
|
|
150
127
|
// cross file features
|
|
151
128
|
if (!initOptions.respectClientCapabilities || ((_4 = params.workspace) === null || _4 === void 0 ? void 0 : _4.fileOperations)) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
'
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
'jsx',
|
|
166
|
-
'tsx',
|
|
167
|
-
'json',
|
|
168
|
-
...plugins.map(plugin => { var _a, _b; return (_b = (_a = plugin.extraFileExtensions) === null || _a === void 0 ? void 0 : _a.map(ext => ext.extension)) !== null && _b !== void 0 ? _b : []; }).flat(),
|
|
169
|
-
].join(',')}}`
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
]
|
|
129
|
+
const exts = plugins.map(plugin => plugin.extensions.fileRenameOperationFilter).flat();
|
|
130
|
+
if (exts.length) {
|
|
131
|
+
server.workspace = {
|
|
132
|
+
fileOperations: {
|
|
133
|
+
willRename: {
|
|
134
|
+
filters: [
|
|
135
|
+
{
|
|
136
|
+
pattern: {
|
|
137
|
+
glob: `**/*.{${exts.join(',')}}`
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
]
|
|
141
|
+
}
|
|
173
142
|
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
176
145
|
}
|
|
177
146
|
if (!initOptions.respectClientCapabilities || ((_5 = params.workspace) === null || _5 === void 0 ? void 0 : _5.symbol)) {
|
|
178
147
|
server.workspaceSymbolProvider = true;
|
package/out/common/workspaces.js
CHANGED
|
@@ -147,7 +147,7 @@ function createWorkspaces(context) {
|
|
|
147
147
|
function getProjectAndTsConfig(uri) {
|
|
148
148
|
var _a;
|
|
149
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
-
|
|
150
|
+
let rootUris = [...workspaces.keys()]
|
|
151
151
|
.filter(rootUri => (0, isFileInDir_1.isFileInDir)(shared.uriToFileName(uri), shared.uriToFileName(rootUri)))
|
|
152
152
|
.sort((a, b) => (0, workspace_1.sortTsConfigs)(shared.uriToFileName(uri), shared.uriToFileName(a), shared.uriToFileName(b)));
|
|
153
153
|
if (context.initOptions.serverMode !== types_1.ServerMode.Syntactic) {
|
|
@@ -159,6 +159,9 @@ function createWorkspaces(context) {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
+
if (!rootUris.length) {
|
|
163
|
+
rootUris = [...workspaces.keys()];
|
|
164
|
+
}
|
|
162
165
|
if (rootUris.length) {
|
|
163
166
|
const project = yield ((_a = (yield workspaces.get(rootUris[0]))) === null || _a === void 0 ? void 0 : _a.getInferredProject());
|
|
164
167
|
project === null || project === void 0 ? void 0 : project.tryAddFile(shared.uriToFileName(uri));
|
package/out/index.d.ts
CHANGED
package/out/index.js
CHANGED
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
__exportStar(require("./protocol"), exports);
|
|
17
17
|
__exportStar(require("./types"), exports);
|
|
18
18
|
// only export types of depend packages
|
|
19
|
+
__exportStar(require("vscode-languageserver"), exports);
|
|
19
20
|
__exportStar(require("@volar/language-core/out/types"), exports);
|
|
20
21
|
__exportStar(require("@volar/language-service/out/types"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/out/node/index.js
CHANGED
|
@@ -42,6 +42,12 @@ function startLanguageServer(connection, ...plugins) {
|
|
|
42
42
|
plugins,
|
|
43
43
|
connection,
|
|
44
44
|
runtimeEnv: {
|
|
45
|
+
timer: {
|
|
46
|
+
setImmediate(callback, ...args) {
|
|
47
|
+
const handle = setImmediate(callback, ...args);
|
|
48
|
+
return { dispose: () => clearImmediate(handle) };
|
|
49
|
+
},
|
|
50
|
+
},
|
|
45
51
|
loadTypescript(tsdk) {
|
|
46
52
|
for (const name of ['./typescript.js', './tsserverlibrary.js', './tsserver.js']) {
|
|
47
53
|
try {
|
package/out/protocol.js
CHANGED
|
@@ -6,53 +6,53 @@ const vscode = require("vscode-languageserver-protocol");
|
|
|
6
6
|
*/
|
|
7
7
|
var ShowReferencesNotification;
|
|
8
8
|
(function (ShowReferencesNotification) {
|
|
9
|
-
ShowReferencesNotification.type = new vscode.NotificationType('
|
|
9
|
+
ShowReferencesNotification.type = new vscode.NotificationType('volar/server/showReferences');
|
|
10
10
|
})(ShowReferencesNotification = exports.ShowReferencesNotification || (exports.ShowReferencesNotification = {}));
|
|
11
11
|
var FsStatRequest;
|
|
12
12
|
(function (FsStatRequest) {
|
|
13
|
-
FsStatRequest.type = new vscode.RequestType('fs/stat');
|
|
13
|
+
FsStatRequest.type = new vscode.RequestType('volar/server/fs/stat');
|
|
14
14
|
})(FsStatRequest = exports.FsStatRequest || (exports.FsStatRequest = {}));
|
|
15
15
|
var FsReadFileRequest;
|
|
16
16
|
(function (FsReadFileRequest) {
|
|
17
|
-
FsReadFileRequest.type = new vscode.RequestType('fs/readFile');
|
|
17
|
+
FsReadFileRequest.type = new vscode.RequestType('volar/server/fs/readFile');
|
|
18
18
|
})(FsReadFileRequest = exports.FsReadFileRequest || (exports.FsReadFileRequest = {}));
|
|
19
19
|
var FsReadDirectoryRequest;
|
|
20
20
|
(function (FsReadDirectoryRequest) {
|
|
21
|
-
FsReadDirectoryRequest.type = new vscode.RequestType('fs/readDirectory');
|
|
21
|
+
FsReadDirectoryRequest.type = new vscode.RequestType('volar/server/fs/readDirectory');
|
|
22
22
|
})(FsReadDirectoryRequest = exports.FsReadDirectoryRequest || (exports.FsReadDirectoryRequest = {}));
|
|
23
23
|
/**
|
|
24
24
|
* Client request server
|
|
25
25
|
*/
|
|
26
26
|
var FindFileReferenceRequest;
|
|
27
27
|
(function (FindFileReferenceRequest) {
|
|
28
|
-
FindFileReferenceRequest.type = new vscode.RequestType('
|
|
28
|
+
FindFileReferenceRequest.type = new vscode.RequestType('volar/client/findFileReference');
|
|
29
29
|
})(FindFileReferenceRequest = exports.FindFileReferenceRequest || (exports.FindFileReferenceRequest = {}));
|
|
30
30
|
var GetMatchTsConfigRequest;
|
|
31
31
|
(function (GetMatchTsConfigRequest) {
|
|
32
|
-
GetMatchTsConfigRequest.type = new vscode.RequestType('volar/tsconfig');
|
|
32
|
+
GetMatchTsConfigRequest.type = new vscode.RequestType('volar/client/tsconfig');
|
|
33
33
|
})(GetMatchTsConfigRequest = exports.GetMatchTsConfigRequest || (exports.GetMatchTsConfigRequest = {}));
|
|
34
34
|
var AutoInsertRequest;
|
|
35
35
|
(function (AutoInsertRequest) {
|
|
36
|
-
AutoInsertRequest.type = new vscode.RequestType('
|
|
36
|
+
AutoInsertRequest.type = new vscode.RequestType('volar/client/autoInsert');
|
|
37
37
|
})(AutoInsertRequest = exports.AutoInsertRequest || (exports.AutoInsertRequest = {}));
|
|
38
38
|
var WriteVirtualFilesNotification;
|
|
39
39
|
(function (WriteVirtualFilesNotification) {
|
|
40
|
-
WriteVirtualFilesNotification.type = new vscode.NotificationType('volar
|
|
40
|
+
WriteVirtualFilesNotification.type = new vscode.NotificationType('volar/client/writeVirtualFiles');
|
|
41
41
|
})(WriteVirtualFilesNotification = exports.WriteVirtualFilesNotification || (exports.WriteVirtualFilesNotification = {}));
|
|
42
42
|
var ReloadProjectNotification;
|
|
43
43
|
(function (ReloadProjectNotification) {
|
|
44
|
-
ReloadProjectNotification.type = new vscode.NotificationType('volar
|
|
44
|
+
ReloadProjectNotification.type = new vscode.NotificationType('volar/client/reloadProject');
|
|
45
45
|
})(ReloadProjectNotification = exports.ReloadProjectNotification || (exports.ReloadProjectNotification = {}));
|
|
46
46
|
var GetVirtualFileNamesRequest;
|
|
47
47
|
(function (GetVirtualFileNamesRequest) {
|
|
48
|
-
GetVirtualFileNamesRequest.type = new vscode.RequestType('
|
|
48
|
+
GetVirtualFileNamesRequest.type = new vscode.RequestType('volar/client/virtualFileNames');
|
|
49
49
|
})(GetVirtualFileNamesRequest = exports.GetVirtualFileNamesRequest || (exports.GetVirtualFileNamesRequest = {}));
|
|
50
50
|
var GetVirtualFileRequest;
|
|
51
51
|
(function (GetVirtualFileRequest) {
|
|
52
|
-
GetVirtualFileRequest.type = new vscode.RequestType('
|
|
52
|
+
GetVirtualFileRequest.type = new vscode.RequestType('volar/client/virtualFile');
|
|
53
53
|
})(GetVirtualFileRequest = exports.GetVirtualFileRequest || (exports.GetVirtualFileRequest = {}));
|
|
54
54
|
var ReportStats;
|
|
55
55
|
(function (ReportStats) {
|
|
56
|
-
ReportStats.type = new vscode.NotificationType0('
|
|
56
|
+
ReportStats.type = new vscode.NotificationType0('volar/client/stats');
|
|
57
57
|
})(ReportStats = exports.ReportStats || (exports.ReportStats = {}));
|
|
58
58
|
//# sourceMappingURL=protocol.js.map
|
package/out/types.d.ts
CHANGED
|
@@ -22,13 +22,22 @@ export interface RuntimeEnvironment {
|
|
|
22
22
|
onDidChangeConfiguration?: (settings: any) => void;
|
|
23
23
|
fileSystemProvide: FileSystemProvider | undefined;
|
|
24
24
|
createFileSystemHost: (ts: typeof import('typescript/lib/tsserverlibrary'), capabilities: vscode.ClientCapabilities) => FileSystemHost;
|
|
25
|
+
readonly timer: {
|
|
26
|
+
setImmediate(callback: (...args: any[]) => void, ...args: any[]): vscode.Disposable;
|
|
27
|
+
};
|
|
25
28
|
}
|
|
26
29
|
export type LanguageServerPlugin<A extends LanguageServerInitializationOptions = LanguageServerInitializationOptions, B extends embedded.LanguageServiceHost = embedded.LanguageServiceHost, C = embeddedLS.LanguageService> = (initOptions: A) => {
|
|
27
|
-
|
|
30
|
+
tsconfigExtraFileExtensions: ts.FileExtensionInfo[];
|
|
31
|
+
diagnosticDocumentSelector: vscode.DocumentSelector;
|
|
32
|
+
extensions: {
|
|
33
|
+
fileRenameOperationFilter: string[];
|
|
34
|
+
fileWatcher: string[];
|
|
35
|
+
};
|
|
28
36
|
resolveLanguageServiceHost?(ts: typeof import('typescript/lib/tsserverlibrary'), sys: FileSystem, tsConfig: string | ts.CompilerOptions, host: embedded.LanguageServiceHost): B;
|
|
29
37
|
getLanguageModules?(host: B): embedded.LanguageModule[];
|
|
30
38
|
getLanguageServicePlugins?(host: B, context: LanguageServiceRuntimeContext): embeddedLS.LanguageServicePlugin[];
|
|
31
|
-
onInitialize?(
|
|
39
|
+
onInitialize?(_: vscode.InitializeResult): void;
|
|
40
|
+
onInitialized?(getLanguageService: (uri: string) => Promise<C>): void;
|
|
32
41
|
};
|
|
33
42
|
export declare enum ServerMode {
|
|
34
43
|
Semantic = 0,
|
|
@@ -43,6 +52,9 @@ export interface LanguageServerInitializationOptions {
|
|
|
43
52
|
typescript?: {
|
|
44
53
|
tsdk: string;
|
|
45
54
|
};
|
|
55
|
+
l10n?: {
|
|
56
|
+
location: string;
|
|
57
|
+
};
|
|
46
58
|
serverMode?: ServerMode;
|
|
47
59
|
diagnosticModel?: DiagnosticModel;
|
|
48
60
|
textDocumentSync?: vscode.TextDocumentSyncKind | number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.1.0-alpha.0",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|
],
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/
|
|
16
|
+
"url": "https://github.com/volarjs/framework.git",
|
|
17
17
|
"directory": "packages/language-server"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@volar/language-core": "1.0.
|
|
21
|
-
"@volar/language-service": "1.0.
|
|
22
|
-
"@volar/shared": "1.0.
|
|
20
|
+
"@volar/language-core": "1.1.0-alpha.0",
|
|
21
|
+
"@volar/language-service": "1.1.0-alpha.0",
|
|
22
|
+
"@volar/shared": "1.1.0-alpha.0",
|
|
23
|
+
"@vscode/l10n": "^0.0.10",
|
|
23
24
|
"request-light": "^0.6.0",
|
|
24
25
|
"typesafe-path": "^0.2.2",
|
|
25
26
|
"vscode-html-languageservice": "^5.0.3",
|
|
@@ -28,5 +29,5 @@
|
|
|
28
29
|
"vscode-languageserver-textdocument": "^1.0.8",
|
|
29
30
|
"vscode-uri": "^3.0.7"
|
|
30
31
|
},
|
|
31
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "1cb85f17f5b90e40633e26710be7ecd4fd2994fb"
|
|
32
33
|
}
|