@vue/language-server 2.0.7 → 2.0.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/node.js +17 -16
- package/package.json +7 -7
package/node.js
CHANGED
|
@@ -17,8 +17,8 @@ exports.connection.listen();
|
|
|
17
17
|
exports.connection.onInitialize(async (params) => {
|
|
18
18
|
const options = params.initializationOptions;
|
|
19
19
|
const hybridMode = options.vue?.hybridMode ?? true;
|
|
20
|
-
tsdk = (0, node_1.loadTsdkByPath)(options.typescript.tsdk, params.locale);
|
|
21
20
|
const vueFileExtensions = ['vue'];
|
|
21
|
+
tsdk = (0, node_1.loadTsdkByPath)(options.typescript.tsdk, params.locale);
|
|
22
22
|
if (options.vue?.additionalExtensions) {
|
|
23
23
|
for (const additionalExtension of options.vue.additionalExtensions) {
|
|
24
24
|
vueFileExtensions.push(additionalExtension);
|
|
@@ -34,6 +34,20 @@ exports.connection.onInitialize(async (params) => {
|
|
|
34
34
|
? (0, node_1.createSimpleProjectProviderFactory)()
|
|
35
35
|
: (0, node_1.createTypeScriptProjectProviderFactory)(tsdk.typescript, tsdk.diagnosticMessages), {
|
|
36
36
|
watchFileExtensions: ['js', 'cjs', 'mjs', 'ts', 'cts', 'mts', 'jsx', 'tsx', 'json', ...vueFileExtensions],
|
|
37
|
+
getLanguageId(uri) {
|
|
38
|
+
if (vueFileExtensions.some(ext => uri.endsWith(`.${ext}`))) {
|
|
39
|
+
if (uri.endsWith('.html')) {
|
|
40
|
+
return 'html';
|
|
41
|
+
}
|
|
42
|
+
else if (uri.endsWith('.md')) {
|
|
43
|
+
return 'markdown';
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return 'vue';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return (0, language_core_1.resolveCommonLanguageId)(uri);
|
|
50
|
+
},
|
|
37
51
|
getServicePlugins() {
|
|
38
52
|
return (0, language_service_1.createVueServicePlugins)(tsdk.typescript, env => envToVueOptions.get(env), getTsPluginClient, hybridMode);
|
|
39
53
|
},
|
|
@@ -41,24 +55,11 @@ exports.connection.onInitialize(async (params) => {
|
|
|
41
55
|
const commandLine = await parseCommandLine();
|
|
42
56
|
const vueOptions = commandLine?.vueOptions ?? (0, language_core_1.resolveVueCompilerOptions)({});
|
|
43
57
|
for (const ext of vueFileExtensions) {
|
|
44
|
-
if (vueOptions.extensions.includes(`.${ext}`)) {
|
|
58
|
+
if (!vueOptions.extensions.includes(`.${ext}`)) {
|
|
45
59
|
vueOptions.extensions.push(`.${ext}`);
|
|
46
60
|
}
|
|
47
61
|
}
|
|
48
|
-
const vueLanguagePlugin = (0, language_core_1.createVueLanguagePlugin)(tsdk.typescript, serviceEnv.typescript.uriToFileName,
|
|
49
|
-
if (projectContext.typescript?.sys.useCaseSensitiveFileNames ?? false) {
|
|
50
|
-
return projectContext.typescript?.host.getScriptFileNames().includes(fileName) ?? false;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
const lowerFileName = fileName.toLowerCase();
|
|
54
|
-
for (const rootFile of projectContext.typescript?.host.getScriptFileNames() ?? []) {
|
|
55
|
-
if (rootFile.toLowerCase() === lowerFileName) {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
}, commandLine?.options ?? {}, vueOptions, options.codegenStack);
|
|
62
|
+
const vueLanguagePlugin = (0, language_core_1.createVueLanguagePlugin)(tsdk.typescript, serviceEnv.typescript.uriToFileName, projectContext.typescript?.sys.useCaseSensitiveFileNames ?? false, () => projectContext.typescript?.host.getProjectVersion?.() ?? '', () => projectContext.typescript?.host.getScriptFileNames() ?? [], commandLine?.options ?? {}, vueOptions, options.codegenStack);
|
|
62
63
|
envToVueOptions.set(serviceEnv, vueOptions);
|
|
63
64
|
return [vueLanguagePlugin];
|
|
64
65
|
async function parseCommandLine() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"directory": "packages/language-server"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@volar/language-core": "~2.
|
|
19
|
-
"@volar/language-server": "~2.
|
|
20
|
-
"@vue/language-core": "2.0.
|
|
21
|
-
"@vue/language-service": "2.0.
|
|
22
|
-
"@vue/typescript-plugin": "2.0.
|
|
18
|
+
"@volar/language-core": "~2.2.0-alpha.5",
|
|
19
|
+
"@volar/language-server": "~2.2.0-alpha.5",
|
|
20
|
+
"@vue/language-core": "2.0.10",
|
|
21
|
+
"@vue/language-service": "2.0.10",
|
|
22
|
+
"@vue/typescript-plugin": "2.0.10",
|
|
23
23
|
"vscode-languageserver-protocol": "^3.17.5"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "a20a2ee950b63a949660b7e8faf0faed0e5bad33"
|
|
26
26
|
}
|