@volar/language-server 1.0.1 → 1.0.2
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.
|
@@ -16,21 +16,19 @@ const protocol_1 = require("../protocol");
|
|
|
16
16
|
const language_core_1 = require("@volar/language-core");
|
|
17
17
|
function register(connection, projects) {
|
|
18
18
|
connection.onRequest(protocol_1.GetMatchTsConfigRequest.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
var _a;
|
|
20
19
|
const project = (yield projects.getProject(params.uri));
|
|
21
20
|
if (project) {
|
|
22
21
|
return {
|
|
23
22
|
fileName: project.tsconfig,
|
|
24
|
-
raw: (_a = project.project) === null || _a === void 0 ? void 0 : _a.getParsedCommandLine().raw,
|
|
25
23
|
};
|
|
26
24
|
}
|
|
27
25
|
}));
|
|
28
26
|
connection.onRequest(protocol_1.GetVirtualFileNamesRequest.type, (document) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
var
|
|
27
|
+
var _a, _b;
|
|
30
28
|
const project = yield projects.getProject(document.uri);
|
|
31
29
|
const fileNames = [];
|
|
32
30
|
if (project) {
|
|
33
|
-
const sourceFile = (
|
|
31
|
+
const sourceFile = (_b = (_a = project.project) === null || _a === void 0 ? void 0 : _a.getLanguageService().context.core.mapper.get(shared.getPathOfUri(document.uri))) === null || _b === void 0 ? void 0 : _b[0];
|
|
34
32
|
if (sourceFile) {
|
|
35
33
|
(0, language_core_1.forEachEmbeddeds)(sourceFile.embeddeds, e => {
|
|
36
34
|
if (e.text && e.kind === 1) {
|
|
@@ -42,10 +40,10 @@ function register(connection, projects) {
|
|
|
42
40
|
return fileNames;
|
|
43
41
|
}));
|
|
44
42
|
connection.onRequest(protocol_1.GetVirtualFileRequest.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
var
|
|
43
|
+
var _c, _d;
|
|
46
44
|
const project = yield projects.getProject(params.sourceFileUri);
|
|
47
45
|
if (project) {
|
|
48
|
-
const embeddedFile = (
|
|
46
|
+
const embeddedFile = (_d = (_c = project.project) === null || _c === void 0 ? void 0 : _c.getLanguageService().context.core.mapper.fromEmbeddedFileName(params.virtualFileName)) === null || _d === void 0 ? void 0 : _d.embedded;
|
|
49
47
|
if (embeddedFile) {
|
|
50
48
|
return {
|
|
51
49
|
content: embeddedFile.text,
|
|
@@ -58,11 +56,11 @@ function register(connection, projects) {
|
|
|
58
56
|
projects.reloadProject();
|
|
59
57
|
}));
|
|
60
58
|
connection.onNotification(protocol_1.WriteVirtualFilesNotification.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
var
|
|
59
|
+
var _e;
|
|
62
60
|
const fs = yield Promise.resolve().then(() => require('fs'));
|
|
63
61
|
const project = yield projects.getProject(params.uri);
|
|
64
62
|
if (project) {
|
|
65
|
-
const ls = (
|
|
63
|
+
const ls = (_e = (yield project.project)) === null || _e === void 0 ? void 0 : _e.getLanguageServiceDontCreate();
|
|
66
64
|
if (ls) {
|
|
67
65
|
const sourceFiles = new Set(ls.context.host.getScriptFileNames());
|
|
68
66
|
for (const virtualFile of ls.context.core.typescriptLanguageServiceHost.getScriptFileNames()) {
|
|
@@ -77,14 +75,14 @@ function register(connection, projects) {
|
|
|
77
75
|
}
|
|
78
76
|
}));
|
|
79
77
|
connection.onNotification(protocol_1.VerifyAllScriptsNotification.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
var
|
|
78
|
+
var _f;
|
|
81
79
|
let errors = 0;
|
|
82
80
|
let warnings = 0;
|
|
83
81
|
const progress = yield connection.window.createWorkDoneProgress();
|
|
84
82
|
progress.begin('Verify', 0, '', true);
|
|
85
83
|
const project = yield projects.getProject(params.uri);
|
|
86
84
|
if (project) {
|
|
87
|
-
const ls = (
|
|
85
|
+
const ls = (_f = (yield project.project)) === null || _f === void 0 ? void 0 : _f.getLanguageServiceDontCreate();
|
|
88
86
|
if (ls) {
|
|
89
87
|
const allVueDocuments = ls.context.documents.getAll();
|
|
90
88
|
let i = 0;
|
package/out/protocol.d.ts
CHANGED
|
@@ -24,7 +24,6 @@ export declare namespace GetMatchTsConfigRequest {
|
|
|
24
24
|
type ParamsType = vscode.TextDocumentIdentifier;
|
|
25
25
|
type ResponseType = {
|
|
26
26
|
fileName: string;
|
|
27
|
-
raw: any;
|
|
28
27
|
} | null | undefined;
|
|
29
28
|
type ErrorType = never;
|
|
30
29
|
const type: vscode.RequestType<vscode.TextDocumentIdentifier, ResponseType, never>;
|
package/out/utils/workspaces.js
CHANGED
|
@@ -81,12 +81,12 @@ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, ts
|
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
function updateDiagnostics(docUri) {
|
|
84
|
-
var _a;
|
|
84
|
+
var _a, _b;
|
|
85
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
86
|
if (((_a = options.diagnosticModel) !== null && _a !== void 0 ? _a : types_1.DiagnosticModel.Push) !== types_1.DiagnosticModel.Push)
|
|
87
87
|
return;
|
|
88
88
|
const req = ++documentUpdatedReq;
|
|
89
|
-
const delay = yield (configurationHost === null || configurationHost === void 0 ? void 0 : configurationHost.getConfiguration('volar.diagnostics.delay'));
|
|
89
|
+
const delay = (_b = yield (configurationHost === null || configurationHost === void 0 ? void 0 : configurationHost.getConfiguration('volar.diagnostics.delay'))) !== null && _b !== void 0 ? _b : 200;
|
|
90
90
|
const cancel = cancelTokenHost.createCancellactionToken({
|
|
91
91
|
get isCancellationRequested() {
|
|
92
92
|
return req !== documentUpdatedReq;
|
|
@@ -96,11 +96,11 @@ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, ts
|
|
|
96
96
|
const changeDoc = docUri ? documents.data.uriGet(docUri) : undefined;
|
|
97
97
|
const otherDocs = [...documents.data.values()].filter(doc => doc !== changeDoc);
|
|
98
98
|
if (changeDoc) {
|
|
99
|
-
yield shared.sleep(delay
|
|
99
|
+
yield shared.sleep(delay);
|
|
100
100
|
yield sendDocumentDiagnostics(changeDoc.uri, changeDoc.version, cancel);
|
|
101
101
|
}
|
|
102
102
|
for (const doc of otherDocs) {
|
|
103
|
-
yield shared.sleep(delay
|
|
103
|
+
yield shared.sleep(delay);
|
|
104
104
|
yield sendDocumentDiagnostics(doc.uri, doc.version, cancel);
|
|
105
105
|
if (cancel.isCancellationRequested) {
|
|
106
106
|
break;
|
|
@@ -134,6 +134,7 @@ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, ts
|
|
|
134
134
|
var _a;
|
|
135
135
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
136
|
const rootUris = [...workspaces.keys()]
|
|
137
|
+
.filter(rootUri => vscode_uri_1.URI.parse(rootUri).scheme === vscode_uri_1.URI.parse(uri).scheme) // fix https://github.com/johnsoncodehk/volar/issues/1946#issuecomment-1272430742
|
|
137
138
|
.filter(rootUri => shared.isFileInDir(vscode_uri_1.URI.parse(uri).fsPath, vscode_uri_1.URI.parse(rootUri).fsPath))
|
|
138
139
|
.sort((a, b) => (0, workspaceProjects_1.sortTsConfigs)(vscode_uri_1.URI.parse(uri).fsPath, vscode_uri_1.URI.parse(a).fsPath, vscode_uri_1.URI.parse(b).fsPath));
|
|
139
140
|
for (const rootUri of rootUris) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -17,9 +17,9 @@
|
|
|
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.0.2",
|
|
21
|
+
"@volar/language-service": "1.0.2",
|
|
22
|
+
"@volar/shared": "1.0.2",
|
|
23
23
|
"request-light": "^0.5.8",
|
|
24
24
|
"typesafe-path": "^0.2.1",
|
|
25
25
|
"vscode-html-languageservice": "^5.0.1",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"vscode-languageserver-textdocument": "^1.0.7",
|
|
29
29
|
"vscode-uri": "^3.0.3"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "4e750f808450c0f70b0a439cb6954cf29345e8f2"
|
|
32
32
|
}
|