@vue/language-server 2.1.2 → 2.1.4
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/lib/hybridModeProject.js +1 -0
- package/lib/initialize.js +23 -14
- package/package.json +5 -5
package/lib/hybridModeProject.js
CHANGED
|
@@ -36,6 +36,7 @@ function createHybridModeProject(create) {
|
|
|
36
36
|
async getLanguageService(uri) {
|
|
37
37
|
const fileName = asFileName(uri);
|
|
38
38
|
const namedPipeServer = (await (0, utils_1.searchNamedPipeServerForFile)(fileName));
|
|
39
|
+
namedPipeServer?.socket.end();
|
|
39
40
|
if (namedPipeServer?.projectInfo?.kind === 1) {
|
|
40
41
|
const tsconfig = namedPipeServer.projectInfo.name;
|
|
41
42
|
const tsconfigUri = vscode_uri_1.URI.file(tsconfig);
|
package/lib/initialize.js
CHANGED
|
@@ -30,32 +30,41 @@ function initialize(server, params, ts, tsLocalized) {
|
|
|
30
30
|
updateFileWatcher(vueCompilerOptions);
|
|
31
31
|
return {
|
|
32
32
|
languagePlugins: [
|
|
33
|
-
(0, language_core_1.createVueLanguagePlugin)(ts, compilerOptions,
|
|
33
|
+
(0, language_core_1.createVueLanguagePlugin)(ts, compilerOptions, {
|
|
34
|
+
...vueCompilerOptions,
|
|
35
|
+
__setupedGlobalTypes: () => true,
|
|
36
|
+
}, s => uriConverter.asFileName(s)),
|
|
34
37
|
],
|
|
35
38
|
setup({ project }) {
|
|
36
39
|
project.vue = { compilerOptions: vueCompilerOptions };
|
|
37
40
|
if (project.typescript) {
|
|
38
|
-
const
|
|
41
|
+
const directoryExists = project.typescript.languageServiceHost.directoryExists?.bind(project.typescript.languageServiceHost);
|
|
39
42
|
const fileExists = project.typescript.languageServiceHost.fileExists.bind(project.typescript.languageServiceHost);
|
|
40
43
|
const getScriptSnapshot = project.typescript.languageServiceHost.getScriptSnapshot.bind(project.typescript.languageServiceHost);
|
|
41
|
-
const
|
|
44
|
+
const globalTypesName = `${vueCompilerOptions.lib}_${vueCompilerOptions.target}_${vueCompilerOptions.strictTemplates}.d.ts`;
|
|
45
|
+
const globalTypesContents = (0, language_core_1.generateGlobalTypes)('global', vueCompilerOptions.lib, vueCompilerOptions.target, vueCompilerOptions.strictTemplates);
|
|
46
|
+
const globalTypesSnapshot = {
|
|
47
|
+
getText: (start, end) => globalTypesContents.substring(start, end),
|
|
48
|
+
getLength: () => globalTypesContents.length,
|
|
49
|
+
getChangeRange: () => undefined,
|
|
50
|
+
};
|
|
51
|
+
if (directoryExists) {
|
|
52
|
+
project.typescript.languageServiceHost.directoryExists = path => {
|
|
53
|
+
if (path.endsWith('.vue-global-types')) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
return directoryExists(path);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
42
59
|
project.typescript.languageServiceHost.fileExists = path => {
|
|
43
|
-
if (path.endsWith(globalTypesName)) {
|
|
60
|
+
if (path.endsWith(`.vue-global-types/${globalTypesName}`) || path.endsWith(`.vue-global-types\\${globalTypesName}`)) {
|
|
44
61
|
return true;
|
|
45
62
|
}
|
|
46
63
|
return fileExists(path);
|
|
47
64
|
};
|
|
48
65
|
project.typescript.languageServiceHost.getScriptSnapshot = path => {
|
|
49
|
-
if (path.endsWith(globalTypesName)) {
|
|
50
|
-
|
|
51
|
-
const contents = (0, language_core_1.generateGlobalTypes)(vueCompilerOptions.lib, vueCompilerOptions.target, vueCompilerOptions.strictTemplates);
|
|
52
|
-
snapshots.set(path, {
|
|
53
|
-
getText: (start, end) => contents.substring(start, end),
|
|
54
|
-
getLength: () => contents.length,
|
|
55
|
-
getChangeRange: () => undefined,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
return snapshots.get(path);
|
|
66
|
+
if (path.endsWith(`.vue-global-types/${globalTypesName}`) || path.endsWith(`.vue-global-types\\${globalTypesName}`)) {
|
|
67
|
+
return globalTypesSnapshot;
|
|
59
68
|
}
|
|
60
69
|
return getScriptSnapshot(path);
|
|
61
70
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-server",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"@volar/language-core": "~2.4.1",
|
|
19
19
|
"@volar/language-server": "~2.4.1",
|
|
20
20
|
"@volar/test-utils": "~2.4.1",
|
|
21
|
-
"@vue/language-core": "2.1.
|
|
22
|
-
"@vue/language-service": "2.1.
|
|
23
|
-
"@vue/typescript-plugin": "2.1.
|
|
21
|
+
"@vue/language-core": "2.1.4",
|
|
22
|
+
"@vue/language-service": "2.1.4",
|
|
23
|
+
"@vue/typescript-plugin": "2.1.4",
|
|
24
24
|
"vscode-languageserver-protocol": "^3.17.5",
|
|
25
25
|
"vscode-uri": "^3.0.8"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "5e197d08eaef57209ff2927c943ba1db3bf4eff6"
|
|
28
28
|
}
|