@volar/language-server 1.7.8 → 1.7.10
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/common/cancellationPipe.d.ts +1 -2
- package/out/common/cancellationPipe.js +10 -7
- package/out/common/project.js +11 -11
- package/out/common/server.js +11 -13
- package/package.json +6 -6
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver';
|
|
2
2
|
export type CancellationTokenHost = ReturnType<typeof createCancellationTokenHost>;
|
|
3
3
|
export declare function createCancellationTokenHost(_cancellationPipeName: string | undefined): {
|
|
4
|
-
createCancellationToken(original
|
|
5
|
-
getMtime(): number;
|
|
4
|
+
createCancellationToken(original?: vscode.CancellationToken): vscode.CancellationToken;
|
|
6
5
|
};
|
|
@@ -6,27 +6,30 @@ function createCancellationTokenHost(_cancellationPipeName) {
|
|
|
6
6
|
if (_cancellationPipeName === undefined) {
|
|
7
7
|
return {
|
|
8
8
|
createCancellationToken(original) {
|
|
9
|
-
return original;
|
|
9
|
+
return original ?? vscode.CancellationToken.None;
|
|
10
10
|
},
|
|
11
|
-
getMtime() {
|
|
12
|
-
return -1;
|
|
13
|
-
}
|
|
14
11
|
};
|
|
15
12
|
}
|
|
16
13
|
const cancellationPipeName = _cancellationPipeName;
|
|
17
14
|
const fs = require('fs');
|
|
18
15
|
return {
|
|
19
16
|
createCancellationToken,
|
|
20
|
-
getMtime,
|
|
21
17
|
};
|
|
22
18
|
function createCancellationToken(original) {
|
|
23
19
|
const mtime = getMtime();
|
|
20
|
+
let currentMtime = mtime;
|
|
21
|
+
let updateAt = Date.now();
|
|
24
22
|
const token = {
|
|
25
23
|
get isCancellationRequested() {
|
|
26
|
-
if (original
|
|
24
|
+
if (original?.isCancellationRequested) {
|
|
27
25
|
return true;
|
|
28
26
|
}
|
|
29
|
-
|
|
27
|
+
// debounce 20ms
|
|
28
|
+
if (currentMtime === mtime && Date.now() - updateAt >= 20) {
|
|
29
|
+
currentMtime = getMtime();
|
|
30
|
+
updateAt = Date.now();
|
|
31
|
+
}
|
|
32
|
+
return currentMtime !== mtime;
|
|
30
33
|
},
|
|
31
34
|
onCancellationRequested: vscode.Event.None,
|
|
32
35
|
};
|
package/out/common/project.js
CHANGED
|
@@ -9,8 +9,14 @@ const uriMap_1 = require("./utils/uriMap");
|
|
|
9
9
|
const typescript_1 = require("@volar/typescript");
|
|
10
10
|
async function createProject(context) {
|
|
11
11
|
let projectVersion = 0;
|
|
12
|
-
let
|
|
12
|
+
let token = context.workspaces.cancelTokenHost.createCancellationToken();
|
|
13
13
|
let languageService;
|
|
14
|
+
const tsToken = {
|
|
15
|
+
isCancellationRequested() {
|
|
16
|
+
return token.isCancellationRequested;
|
|
17
|
+
},
|
|
18
|
+
throwIfCancellationRequested() { },
|
|
19
|
+
};
|
|
14
20
|
const { uriToFileName, fileNameToUri, fs } = context.server.runtimeEnv;
|
|
15
21
|
const env = {
|
|
16
22
|
uriToFileName,
|
|
@@ -25,12 +31,6 @@ async function createProject(context) {
|
|
|
25
31
|
};
|
|
26
32
|
const fsScriptsCache = (0, uriMap_1.createUriMap)(fileNameToUri);
|
|
27
33
|
const askedFiles = (0, uriMap_1.createUriMap)(fileNameToUri);
|
|
28
|
-
const token = {
|
|
29
|
-
isCancellationRequested() {
|
|
30
|
-
return context.workspaces.cancelTokenHost.getMtime() !== projectVersionUpdateTime;
|
|
31
|
-
},
|
|
32
|
-
throwIfCancellationRequested() { },
|
|
33
|
-
};
|
|
34
34
|
const languageHost = {
|
|
35
35
|
getProjectVersion: () => projectVersion,
|
|
36
36
|
getScriptFileNames: () => parsedCommandLine.fileNames,
|
|
@@ -46,7 +46,7 @@ async function createProject(context) {
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
getLanguageId: (fileName) => context.workspaces.documents.data.pathGet(fileName)?.languageId,
|
|
49
|
-
getCancellationToken: () =>
|
|
49
|
+
getCancellationToken: () => tsToken,
|
|
50
50
|
getCompilationSettings: () => parsedCommandLine.options,
|
|
51
51
|
getLocalizedDiagnosticMessages: context.workspaces.tsLocalized ? () => context.workspaces.tsLocalized : undefined,
|
|
52
52
|
getCurrentDirectory: () => uriToFileName(context.project.rootUri.toString()),
|
|
@@ -54,7 +54,7 @@ async function createProject(context) {
|
|
|
54
54
|
};
|
|
55
55
|
const docChangeWatcher = context.workspaces.documents.onDidChangeContent(() => {
|
|
56
56
|
projectVersion++;
|
|
57
|
-
|
|
57
|
+
token = context.workspaces.cancelTokenHost.createCancellationToken();
|
|
58
58
|
});
|
|
59
59
|
const fileWatch = env.onDidChangeWatchedFiles?.(params => {
|
|
60
60
|
onWorkspaceFilesChanged(params.changes);
|
|
@@ -89,7 +89,7 @@ async function createProject(context) {
|
|
|
89
89
|
if (!parsedCommandLine.fileNames.includes(fileName)) {
|
|
90
90
|
parsedCommandLine.fileNames.push(fileName);
|
|
91
91
|
projectVersion++;
|
|
92
|
-
|
|
92
|
+
token = context.workspaces.cancelTokenHost.createCancellationToken();
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
95
|
askedFiles,
|
|
@@ -144,7 +144,7 @@ async function createProject(context) {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
if (oldProjectVersion !== projectVersion) {
|
|
147
|
-
|
|
147
|
+
token = context.workspaces.cancelTokenHost.createCancellationToken();
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
function dispose() {
|
package/out/common/server.js
CHANGED
|
@@ -74,24 +74,22 @@ async function startCommonLanguageServer(connection, _plugins, getRuntimeEnv) {
|
|
|
74
74
|
},
|
|
75
75
|
},
|
|
76
76
|
};
|
|
77
|
-
let
|
|
77
|
+
let config = {};
|
|
78
78
|
for (const root of roots) {
|
|
79
79
|
if (root.scheme === 'file') {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (config.services) {
|
|
87
|
-
services = {
|
|
88
|
-
...services,
|
|
89
|
-
...config.services,
|
|
90
|
-
};
|
|
80
|
+
const workspaceConfig = (0, serverConfig_1.loadConfig)(root.path, options.configFilePath);
|
|
81
|
+
if (workspaceConfig) {
|
|
82
|
+
config = workspaceConfig;
|
|
83
|
+
break;
|
|
91
84
|
}
|
|
92
85
|
}
|
|
93
86
|
}
|
|
94
|
-
|
|
87
|
+
for (const plugin of plugins) {
|
|
88
|
+
if (plugin.resolveConfig) {
|
|
89
|
+
config = await plugin.resolveConfig(config, undefined);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
(0, registerFeatures_1.setupCapabilities)(result.capabilities, options, plugins, getSemanticTokensLegend(), config.services ?? {});
|
|
95
93
|
await createLanguageServiceHost();
|
|
96
94
|
try {
|
|
97
95
|
// show version on LSP logs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-server",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.10",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"directory": "packages/language-server"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@volar/language-core": "1.7.
|
|
19
|
-
"@volar/language-service": "1.7.
|
|
20
|
-
"@volar/typescript": "1.7.
|
|
18
|
+
"@volar/language-core": "1.7.10",
|
|
19
|
+
"@volar/language-service": "1.7.10",
|
|
20
|
+
"@volar/typescript": "1.7.10",
|
|
21
21
|
"@vscode/l10n": "^0.0.11",
|
|
22
22
|
"request-light": "^0.7.0",
|
|
23
23
|
"typesafe-path": "^0.2.2",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"vscode-uri": "^3.0.7"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@volar/source-map": "1.7.
|
|
30
|
+
"@volar/source-map": "1.7.10"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "53c67c3fd1d11be3dba0ef199c282e605c980638"
|
|
33
33
|
}
|