@volar/language-server 1.0.22 → 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/fileSystems.js +8 -8
- package/out/browser/index.js +8 -3
- package/out/common/documents.d.ts +1 -0
- package/out/common/documents.js +3 -0
- package/out/common/features/customFeatures.js +12 -13
- package/out/common/features/languageFeatures.d.ts +2 -1
- package/out/common/features/languageFeatures.js +97 -82
- package/out/common/project.js +50 -29
- package/out/common/server.js +28 -22
- package/out/common/utils/isFileInDir.d.ts +2 -0
- package/out/common/utils/isFileInDir.js +9 -0
- package/out/common/utils/registerFeatures.js +24 -55
- package/out/common/utils/uriMap.js +1 -1
- package/out/common/workspace.js +14 -13
- package/out/common/workspaces.d.ts +0 -1
- package/out/common/workspaces.js +8 -4
- package/out/index.d.ts +1 -0
- package/out/index.js +1 -0
- package/out/node/fileSystem.js +1 -1
- package/out/node/index.js +8 -2
- package/out/protocol.js +12 -12
- package/out/types.d.ts +14 -2
- package/package.json +7 -6
|
@@ -37,7 +37,7 @@ function createWebFileSystemHost() {
|
|
|
37
37
|
connection = _connection;
|
|
38
38
|
connection.onDidChangeWatchedFiles(params => {
|
|
39
39
|
for (const change of params.changes) {
|
|
40
|
-
const fsPath = shared.
|
|
40
|
+
const fsPath = shared.uriToFileName(change.uri);
|
|
41
41
|
const dir = getDir(path.dirname(fsPath));
|
|
42
42
|
const name = path.basename(fsPath);
|
|
43
43
|
if (change.type === vscode.FileChangeType.Created) {
|
|
@@ -78,11 +78,11 @@ function createWebFileSystemHost() {
|
|
|
78
78
|
},
|
|
79
79
|
};
|
|
80
80
|
function createWorkspaceFileSystem(rootUri) {
|
|
81
|
-
const rootPath = shared.
|
|
81
|
+
const rootPath = shared.uriToFileName(rootUri.toString());
|
|
82
82
|
return {
|
|
83
83
|
newLine: '\n',
|
|
84
84
|
useCaseSensitiveFileNames: false,
|
|
85
|
-
getCurrentDirectory: () => shared.
|
|
85
|
+
getCurrentDirectory: () => shared.uriToFileName(rootUri.toString()),
|
|
86
86
|
fileExists,
|
|
87
87
|
readFile,
|
|
88
88
|
readDirectory,
|
|
@@ -169,7 +169,7 @@ function createWebFileSystemHost() {
|
|
|
169
169
|
}
|
|
170
170
|
function statAsync(connection, fsPath, dir) {
|
|
171
171
|
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
-
const uri = shared.
|
|
172
|
+
const uri = shared.fileNameToUri(fsPath);
|
|
173
173
|
if (uri.startsWith('https://cdn.jsdelivr.net/npm/')) { // stat request always response file type for jsdelivr
|
|
174
174
|
const text = yield readJsdelivrFile(connection, uri);
|
|
175
175
|
if (text !== undefined) {
|
|
@@ -197,7 +197,7 @@ function createWebFileSystemHost() {
|
|
|
197
197
|
}
|
|
198
198
|
function readFileAsync(connection, fsPath, dir) {
|
|
199
199
|
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
-
const uri = shared.
|
|
200
|
+
const uri = shared.fileNameToUri(fsPath);
|
|
201
201
|
if (uri.startsWith('https://cdn.jsdelivr.net/npm/')) {
|
|
202
202
|
const text = yield readJsdelivrFile(connection, uri);
|
|
203
203
|
if (text !== undefined) {
|
|
@@ -238,12 +238,12 @@ function createWebFileSystemHost() {
|
|
|
238
238
|
}
|
|
239
239
|
function readDirectoryAsync(connection, fsPath, dir) {
|
|
240
240
|
return __awaiter(this, void 0, void 0, function* () {
|
|
241
|
-
const uri = shared.
|
|
241
|
+
const uri = shared.fileNameToUri(fsPath);
|
|
242
242
|
const result = yield connection.sendRequest(protocol_1.FsReadDirectoryRequest.type, uri);
|
|
243
243
|
for (const [name, fileType] of result) {
|
|
244
244
|
if (dir.fileTypes.get(name) !== fileType && (fileType === vscode_html_languageservice_1.FileType.File || fileType === vscode_html_languageservice_1.FileType.SymbolicLink)) {
|
|
245
245
|
changes.push({
|
|
246
|
-
uri: shared.
|
|
246
|
+
uri: shared.fileNameToUri(path.join(fsPath, name)),
|
|
247
247
|
type: vscode.FileChangeType.Created,
|
|
248
248
|
});
|
|
249
249
|
}
|
|
@@ -262,7 +262,7 @@ function createWebFileSystemHost() {
|
|
|
262
262
|
let i = 0;
|
|
263
263
|
while (pendings.length) {
|
|
264
264
|
const current = pendings.shift();
|
|
265
|
-
progress === null || progress === void 0 ? void 0 : progress.report(i / pendings.length, vscode_uri_1.URI.parse(shared.
|
|
265
|
+
progress === null || progress === void 0 ? void 0 : progress.report(i / pendings.length, vscode_uri_1.URI.parse(shared.fileNameToUri(current[1])).fsPath);
|
|
266
266
|
yield current;
|
|
267
267
|
i++;
|
|
268
268
|
}
|
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,13 +42,19 @@ 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* () {
|
|
51
56
|
try {
|
|
52
|
-
const uri = shared.
|
|
57
|
+
const uri = shared.fileNameToUri(`${tsdk}/${locale}/diagnosticMessages.generated.json`);
|
|
53
58
|
const json = yield (0, http_1.default)(uri);
|
|
54
59
|
return JSON.parse(json);
|
|
55
60
|
}
|
|
@@ -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 = [
|
|
@@ -67,7 +67,7 @@ function register(connection, projects) {
|
|
|
67
67
|
connection.onRequest(protocol_1.GetMatchTsConfigRequest.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
68
68
|
const project = (yield projects.getProject(params.uri));
|
|
69
69
|
if (project === null || project === void 0 ? void 0 : project.tsconfig) {
|
|
70
|
-
return { uri: shared.
|
|
70
|
+
return { uri: shared.fileNameToUri(project.tsconfig) };
|
|
71
71
|
}
|
|
72
72
|
}));
|
|
73
73
|
connection.onRequest(protocol_1.GetVirtualFileNamesRequest.type, (document) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -75,10 +75,10 @@ function register(connection, projects) {
|
|
|
75
75
|
const project = yield projects.getProject(document.uri);
|
|
76
76
|
const fileNames = [];
|
|
77
77
|
if (project) {
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
80
|
-
(0, language_core_1.forEachEmbeddedFile)(
|
|
81
|
-
if (e.snapshot.getLength() && e.kind ===
|
|
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
|
+
if (rootVirtualFile) {
|
|
80
|
+
(0, language_core_1.forEachEmbeddedFile)(rootVirtualFile, e => {
|
|
81
|
+
if (e.snapshot.getLength() && e.kind === language_core_1.FileKind.TypeScriptHostFile) {
|
|
82
82
|
fileNames.push(e.fileName);
|
|
83
83
|
}
|
|
84
84
|
});
|
|
@@ -87,16 +87,15 @@ function register(connection, projects) {
|
|
|
87
87
|
return fileNames;
|
|
88
88
|
}));
|
|
89
89
|
connection.onRequest(protocol_1.GetVirtualFileRequest.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
var _r, _s, _t;
|
|
90
|
+
var _r, _s, _t, _u;
|
|
91
91
|
const project = yield projects.getProject(params.sourceFileUri);
|
|
92
92
|
if (project) {
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
95
|
-
const virtualFile = sourceAndVirtual[2];
|
|
93
|
+
const [virtualFile, source] = (_s = (_r = project.project) === null || _r === void 0 ? void 0 : _r.getLanguageService().context.core.virtualFiles.getVirtualFile(params.virtualFileName)) !== null && _s !== void 0 ? _s : [];
|
|
94
|
+
if (virtualFile && source) {
|
|
96
95
|
const mappings = {};
|
|
97
96
|
for (const mapping of virtualFile.mappings) {
|
|
98
|
-
const sourceUri = shared.
|
|
99
|
-
(
|
|
97
|
+
const sourceUri = shared.fileNameToUri((_t = mapping.source) !== null && _t !== void 0 ? _t : source.fileName);
|
|
98
|
+
(_u = mappings[sourceUri]) !== null && _u !== void 0 ? _u : (mappings[sourceUri] = []);
|
|
100
99
|
mappings[sourceUri].push(mapping);
|
|
101
100
|
}
|
|
102
101
|
return {
|
|
@@ -110,11 +109,11 @@ function register(connection, projects) {
|
|
|
110
109
|
projects.reloadProject();
|
|
111
110
|
});
|
|
112
111
|
connection.onNotification(protocol_1.WriteVirtualFilesNotification.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
113
|
-
var
|
|
112
|
+
var _v;
|
|
114
113
|
const fs = yield Promise.resolve().then(() => require('fs'));
|
|
115
114
|
const project = yield projects.getProject(params.uri);
|
|
116
115
|
if (project) {
|
|
117
|
-
const ls = (
|
|
116
|
+
const ls = (_v = (yield project.project)) === null || _v === void 0 ? void 0 : _v.getLanguageServiceDontCreate();
|
|
118
117
|
if (ls) {
|
|
119
118
|
const sourceFiles = new Set(ls.context.host.getScriptFileNames());
|
|
120
119
|
for (const virtualFile of ls.context.core.typescript.languageServiceHost.getScriptFileNames()) {
|
|
@@ -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,43 +256,62 @@ 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* () {
|
|
270
|
-
var _o;
|
|
265
|
+
connection.workspace.onWillRenameFiles((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
271
266
|
const config = yield connection.workspace.getConfiguration('volar.updateImportsOnFileMove.enabled');
|
|
272
267
|
if (!config) {
|
|
273
268
|
return null;
|
|
274
269
|
}
|
|
275
|
-
|
|
276
|
-
|
|
270
|
+
const _edits = yield Promise.all(params.files.map((file) => __awaiter(this, void 0, void 0, function* () {
|
|
271
|
+
var _o;
|
|
272
|
+
return (_o = yield worker(file.oldUri, token, vueLs => {
|
|
273
|
+
var _a;
|
|
274
|
+
return (_a = vueLs.getEditsForFileRename(file.oldUri, file.newUri)) !== null && _a !== void 0 ? _a : null;
|
|
275
|
+
})) !== null && _o !== void 0 ? _o : null;
|
|
276
|
+
})));
|
|
277
|
+
const edits = _edits.filter(shared.notEmpty);
|
|
278
|
+
if (edits.length) {
|
|
279
|
+
embedded.mergeWorkspaceEdits(edits[0], ...edits.slice(1));
|
|
280
|
+
return edits[0];
|
|
277
281
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
})) !== null && _o !== void 0 ? _o : null;
|
|
283
|
-
}));
|
|
284
|
-
connection.onRequest(protocol_1.AutoInsertRequest.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
285
|
-
return worker(params.textDocument.uri, vueLs => {
|
|
282
|
+
return null;
|
|
283
|
+
}));
|
|
284
|
+
connection.onRequest(protocol_1.AutoInsertRequest.type, (params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
285
|
+
return worker(params.textDocument.uri, token, vueLs => {
|
|
286
286
|
return vueLs.doAutoInsert(params.textDocument.uri, params.position, params.options);
|
|
287
287
|
});
|
|
288
288
|
}));
|
|
289
|
-
function worker(uri, cb) {
|
|
290
|
-
return
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
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;
|
|
295
295
|
}
|
|
296
|
-
|
|
297
|
-
|
|
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
|
+
}
|
|
298
310
|
}
|
|
299
|
-
|
|
311
|
+
else {
|
|
312
|
+
resolve(undefined);
|
|
313
|
+
}
|
|
314
|
+
}));
|
|
300
315
|
});
|
|
301
316
|
}
|
|
302
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) {
|
|
@@ -35,7 +36,7 @@ function createProject(context) {
|
|
|
35
36
|
let projectVersion = 0;
|
|
36
37
|
let projectVersionUpdateTime = context.workspace.workspaces.cancelTokenHost.getMtime();
|
|
37
38
|
let languageService;
|
|
38
|
-
let parsedCommandLine = createParsedCommandLine(context.workspace.workspaces.ts, sys, shared.
|
|
39
|
+
let parsedCommandLine = createParsedCommandLine(context.workspace.workspaces.ts, sys, shared.uriToFileName(context.rootUri.toString()), context.tsConfig, context.workspace.workspaces.plugins);
|
|
39
40
|
const scripts = (0, uriMap_1.createUriMap)();
|
|
40
41
|
const languageServiceHost = createLanguageServiceHost();
|
|
41
42
|
const disposeWatchEvent = (_a = context.workspace.workspaces.fileSystemHost) === null || _a === void 0 ? void 0 : _a.onDidChangeWatchedFiles(params => {
|
|
@@ -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];
|
|
@@ -121,7 +120,7 @@ function createProject(context) {
|
|
|
121
120
|
const creates = changes.filter(change => change.type === vscode.FileChangeType.Created);
|
|
122
121
|
const deletes = changes.filter(change => change.type === vscode.FileChangeType.Deleted);
|
|
123
122
|
if (creates.length || deletes.length) {
|
|
124
|
-
parsedCommandLine = createParsedCommandLine(context.workspace.workspaces.ts, sys, shared.
|
|
123
|
+
parsedCommandLine = createParsedCommandLine(context.workspace.workspaces.ts, sys, shared.uriToFileName(context.rootUri.toString()), context.tsConfig, context.workspace.workspaces.plugins);
|
|
125
124
|
projectVersion++;
|
|
126
125
|
typeRootVersion++;
|
|
127
126
|
}
|
|
@@ -148,7 +147,7 @@ function createProject(context) {
|
|
|
148
147
|
readDirectory: sys.readDirectory,
|
|
149
148
|
realpath: sys.realpath,
|
|
150
149
|
fileExists: sys.fileExists,
|
|
151
|
-
getCurrentDirectory: () => shared.
|
|
150
|
+
getCurrentDirectory: () => shared.uriToFileName(context.rootUri.toString()),
|
|
152
151
|
getProjectReferences: () => parsedCommandLine.projectReferences,
|
|
153
152
|
getCancellationToken: () => token,
|
|
154
153
|
// custom
|
|
@@ -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,35 +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
|
-
dirs.add(path.dirname(failed));
|
|
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}`);
|
|
286
288
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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
|
+
}
|
|
292
303
|
}
|
|
293
|
-
|
|
294
|
-
|
|
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
|
+
}
|
|
295
308
|
}
|
|
296
309
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
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);
|
|
300
319
|
}
|
|
301
320
|
}
|
|
302
|
-
|
|
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);
|
|
303
324
|
},
|
|
304
325
|
};
|
|
305
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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.isFileInDir = void 0;
|
|
3
|
+
const path = require("typesafe-path");
|
|
4
|
+
function isFileInDir(fileName, dir) {
|
|
5
|
+
const relative = path.relative(dir, fileName);
|
|
6
|
+
return !!relative && !relative.startsWith('..') && !path.isAbsolute(relative);
|
|
7
|
+
}
|
|
8
|
+
exports.isFileInDir = isFileInDir;
|
|
9
|
+
//# sourceMappingURL=isFileInDir.js.map
|
|
@@ -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;
|
|
@@ -25,7 +25,7 @@ function createUriMap(map = new Map()) {
|
|
|
25
25
|
}
|
|
26
26
|
function getUriByPath(path) {
|
|
27
27
|
if (!pathToUri.has(path)) {
|
|
28
|
-
pathToUri.set(path, shared.
|
|
28
|
+
pathToUri.set(path, shared.fileNameToUri(path).toLowerCase());
|
|
29
29
|
}
|
|
30
30
|
return pathToUri.get(path);
|
|
31
31
|
}
|
package/out/common/workspace.js
CHANGED
|
@@ -17,27 +17,28 @@ const project_1 = require("./project");
|
|
|
17
17
|
const inferredCompilerOptions_1 = require("./utils/inferredCompilerOptions");
|
|
18
18
|
const serverConfig_1 = require("./utils/serverConfig");
|
|
19
19
|
const uriMap_1 = require("./utils/uriMap");
|
|
20
|
+
const isFileInDir_1 = require("./utils/isFileInDir");
|
|
20
21
|
exports.rootTsConfigNames = ['tsconfig.json', 'jsconfig.json'];
|
|
21
22
|
function createWorkspace(context) {
|
|
22
23
|
var _a, _b, _c;
|
|
23
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
25
|
let inferredProject;
|
|
25
|
-
const serverConfig = (0, serverConfig_1.loadServerConfig)(shared.
|
|
26
|
+
const serverConfig = (0, serverConfig_1.loadServerConfig)(shared.uriToFileName(context.rootUri.toString()), context.workspaces.initOptions.configFilePath);
|
|
26
27
|
const sys = (_a = context.workspaces.fileSystemHost) === null || _a === void 0 ? void 0 : _a.getWorkspaceFileSystem(context.rootUri);
|
|
27
|
-
const documentRegistry = sys ? (_b = context.workspaces.ts) === null || _b === void 0 ? void 0 : _b.createDocumentRegistry(sys.useCaseSensitiveFileNames, shared.
|
|
28
|
+
const documentRegistry = sys ? (_b = context.workspaces.ts) === null || _b === void 0 ? void 0 : _b.createDocumentRegistry(sys.useCaseSensitiveFileNames, shared.uriToFileName(context.rootUri.toString())) : undefined;
|
|
28
29
|
const projects = (0, uriMap_1.createUriMap)();
|
|
29
|
-
const rootTsConfigs = new Set(sys === null || sys === void 0 ? void 0 : sys.readDirectory(shared.
|
|
30
|
+
const rootTsConfigs = new Set(sys === null || sys === void 0 ? void 0 : sys.readDirectory(shared.uriToFileName(context.rootUri.toString()), exports.rootTsConfigNames, undefined, ['**/*']).map(fileName => shared.normalizeFileName(fileName)));
|
|
30
31
|
const disposeTsConfigWatch = (_c = context.workspaces.fileSystemHost) === null || _c === void 0 ? void 0 : _c.onDidChangeWatchedFiles(({ changes }) => {
|
|
31
32
|
for (const change of changes) {
|
|
32
33
|
if (exports.rootTsConfigNames.includes(change.uri.substring(change.uri.lastIndexOf('/') + 1))) {
|
|
33
34
|
if (change.type === vscode.FileChangeType.Created) {
|
|
34
|
-
if (
|
|
35
|
-
rootTsConfigs.add(shared.
|
|
35
|
+
if ((0, isFileInDir_1.isFileInDir)(shared.uriToFileName(change.uri), shared.uriToFileName(context.rootUri.toString()))) {
|
|
36
|
+
rootTsConfigs.add(shared.uriToFileName(change.uri));
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
else if ((change.type === vscode.FileChangeType.Changed || change.type === vscode.FileChangeType.Deleted) && projects.uriHas(change.uri)) {
|
|
39
40
|
if (change.type === vscode.FileChangeType.Deleted) {
|
|
40
|
-
rootTsConfigs.delete(shared.
|
|
41
|
+
rootTsConfigs.delete(shared.uriToFileName(change.uri));
|
|
41
42
|
}
|
|
42
43
|
const project = projects.uriGet(change.uri);
|
|
43
44
|
projects.uriDelete(change.uri);
|
|
@@ -106,11 +107,11 @@ function createWorkspace(context) {
|
|
|
106
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
108
|
let matches = [];
|
|
108
109
|
for (const rootTsConfig of rootTsConfigs) {
|
|
109
|
-
if (
|
|
110
|
+
if ((0, isFileInDir_1.isFileInDir)(shared.uriToFileName(uri.toString()), path.dirname(rootTsConfig))) {
|
|
110
111
|
matches.push(rootTsConfig);
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
|
-
matches = matches.sort((a, b) => sortTsConfigs(shared.
|
|
114
|
+
matches = matches.sort((a, b) => sortTsConfigs(shared.uriToFileName(uri.toString()), a, b));
|
|
114
115
|
if (matches.length) {
|
|
115
116
|
yield getParsedCommandLine(matches[0]);
|
|
116
117
|
}
|
|
@@ -132,14 +133,14 @@ function createWorkspace(context) {
|
|
|
132
133
|
var _a, _b;
|
|
133
134
|
const project = yield projects.pathGet(tsconfig);
|
|
134
135
|
const ls = project === null || project === void 0 ? void 0 : project.getLanguageServiceDontCreate();
|
|
135
|
-
const validDoc = (_b = (_a = ls === null || ls === void 0 ? void 0 : ls.context.typescript) === null || _a === void 0 ? void 0 : _a.languageService.getProgram()) === null || _b === void 0 ? void 0 : _b.getSourceFile(shared.
|
|
136
|
+
const validDoc = (_b = (_a = ls === null || ls === void 0 ? void 0 : ls.context.typescript) === null || _a === void 0 ? void 0 : _a.languageService.getProgram()) === null || _b === void 0 ? void 0 : _b.getSourceFile(shared.uriToFileName(uri.toString()));
|
|
136
137
|
return !!validDoc;
|
|
137
138
|
}));
|
|
138
139
|
}
|
|
139
140
|
function findTsconfig(match) {
|
|
140
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
142
|
const checked = new Set();
|
|
142
|
-
for (const rootTsConfig of [...rootTsConfigs].sort((a, b) => sortTsConfigs(shared.
|
|
143
|
+
for (const rootTsConfig of [...rootTsConfigs].sort((a, b) => sortTsConfigs(shared.uriToFileName(uri.toString()), a, b))) {
|
|
143
144
|
const project = yield projects.pathGet(rootTsConfig);
|
|
144
145
|
if (project) {
|
|
145
146
|
let chains = yield getReferencesChains(project.getParsedCommandLine(), rootTsConfig, []);
|
|
@@ -214,7 +215,7 @@ function createWorkspace(context) {
|
|
|
214
215
|
project = (0, project_1.createProject)({
|
|
215
216
|
workspace: context,
|
|
216
217
|
serverConfig,
|
|
217
|
-
rootUri: vscode_uri_1.URI.parse(shared.
|
|
218
|
+
rootUri: vscode_uri_1.URI.parse(shared.fileNameToUri(path.dirname(tsConfig))),
|
|
218
219
|
tsConfig,
|
|
219
220
|
documentRegistry,
|
|
220
221
|
});
|
|
@@ -226,8 +227,8 @@ function createWorkspace(context) {
|
|
|
226
227
|
}
|
|
227
228
|
exports.createWorkspace = createWorkspace;
|
|
228
229
|
function sortTsConfigs(file, a, b) {
|
|
229
|
-
const inA =
|
|
230
|
-
const inB =
|
|
230
|
+
const inA = (0, isFileInDir_1.isFileInDir)(file, path.dirname(a));
|
|
231
|
+
const inB = (0, isFileInDir_1.isFileInDir)(file, path.dirname(b));
|
|
231
232
|
if (inA !== inB) {
|
|
232
233
|
const aWeight = inA ? 1 : 0;
|
|
233
234
|
const bWeight = inB ? 1 : 0;
|
package/out/common/workspaces.js
CHANGED
|
@@ -13,6 +13,7 @@ const shared = require("@volar/shared");
|
|
|
13
13
|
const vscode = require("vscode-languageserver");
|
|
14
14
|
const types_1 = require("../types");
|
|
15
15
|
const workspace_1 = require("./workspace");
|
|
16
|
+
const isFileInDir_1 = require("./utils/isFileInDir");
|
|
16
17
|
function createWorkspaces(context) {
|
|
17
18
|
var _a, _b, _c;
|
|
18
19
|
const workspaces = new Map();
|
|
@@ -146,9 +147,9 @@ function createWorkspaces(context) {
|
|
|
146
147
|
function getProjectAndTsConfig(uri) {
|
|
147
148
|
var _a;
|
|
148
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
-
|
|
150
|
-
.filter(rootUri =>
|
|
151
|
-
.sort((a, b) => (0, workspace_1.sortTsConfigs)(shared.
|
|
150
|
+
let rootUris = [...workspaces.keys()]
|
|
151
|
+
.filter(rootUri => (0, isFileInDir_1.isFileInDir)(shared.uriToFileName(uri), shared.uriToFileName(rootUri)))
|
|
152
|
+
.sort((a, b) => (0, workspace_1.sortTsConfigs)(shared.uriToFileName(uri), shared.uriToFileName(a), shared.uriToFileName(b)));
|
|
152
153
|
if (context.initOptions.serverMode !== types_1.ServerMode.Syntactic) {
|
|
153
154
|
for (const rootUri of rootUris) {
|
|
154
155
|
const workspace = yield workspaces.get(rootUri);
|
|
@@ -158,9 +159,12 @@ function createWorkspaces(context) {
|
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
161
|
}
|
|
162
|
+
if (!rootUris.length) {
|
|
163
|
+
rootUris = [...workspaces.keys()];
|
|
164
|
+
}
|
|
161
165
|
if (rootUris.length) {
|
|
162
166
|
const project = yield ((_a = (yield workspaces.get(rootUris[0]))) === null || _a === void 0 ? void 0 : _a.getInferredProject());
|
|
163
|
-
project === null || project === void 0 ? void 0 : project.tryAddFile(shared.
|
|
167
|
+
project === null || project === void 0 ? void 0 : project.tryAddFile(shared.uriToFileName(uri));
|
|
164
168
|
return {
|
|
165
169
|
tsconfig: undefined,
|
|
166
170
|
project,
|
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/fileSystem.js
CHANGED
|
@@ -51,7 +51,7 @@ function createNodeFileSystemHost(ts, capabilities) {
|
|
|
51
51
|
};
|
|
52
52
|
function createWorkspaceFileSystem(ts, capabilities, rootUri) {
|
|
53
53
|
var _a;
|
|
54
|
-
const rootPath = shared.
|
|
54
|
+
const rootPath = shared.uriToFileName(rootUri.toString());
|
|
55
55
|
const workspaceSys = new Proxy(ts.sys, {
|
|
56
56
|
get(target, prop) {
|
|
57
57
|
const fn = target[prop];
|
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 {
|
|
@@ -72,7 +78,7 @@ function startLanguageServer(connection, ...plugins) {
|
|
|
72
78
|
fileSystemProvide: {
|
|
73
79
|
stat: (uri) => {
|
|
74
80
|
return new Promise((resolve, reject) => {
|
|
75
|
-
fs.stat(shared.
|
|
81
|
+
fs.stat(shared.uriToFileName(uri), (err, stats) => {
|
|
76
82
|
if (stats) {
|
|
77
83
|
resolve({
|
|
78
84
|
type: stats.isFile() ? html.FileType.File
|
|
@@ -92,7 +98,7 @@ function startLanguageServer(connection, ...plugins) {
|
|
|
92
98
|
},
|
|
93
99
|
readDirectory: (uri) => {
|
|
94
100
|
return new Promise((resolve, reject) => {
|
|
95
|
-
fs.readdir(shared.
|
|
101
|
+
fs.readdir(shared.uriToFileName(uri), (err, files) => {
|
|
96
102
|
if (files) {
|
|
97
103
|
resolve(files.map(file => [file, html.FileType.File]));
|
|
98
104
|
}
|
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
|
}
|