@vue/language-server 1.9.0-alpha.3 → 2.0.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/bin/vue-language-server.js +4 -4
- package/package.json +7 -10
- package/out/index.d.ts +0 -6
- package/out/index.js +0 -24
- package/out/languageServerPlugin.d.ts +0 -3
- package/out/languageServerPlugin.js +0 -109
- package/out/nodeServer.d.ts +0 -2
- package/out/nodeServer.js +0 -8
- package/out/protocol.d.ts +0 -59
- package/out/protocol.js +0 -29
- package/out/types.d.ts +0 -8
- package/out/types.js +0 -3
- package/out/webServer.d.ts +0 -2
- package/out/webServer.js +0 -8
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
console.log(
|
|
2
|
+
// @ts-check
|
|
3
|
+
if (process.argv.includes('--version')) {
|
|
4
|
+
console.log(require('../package.json').version);
|
|
5
5
|
}
|
|
6
6
|
else {
|
|
7
|
-
require(
|
|
7
|
+
require('../node.js');
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-server",
|
|
3
|
-
"version": "
|
|
4
|
-
"main": "out/index.js",
|
|
3
|
+
"version": "2.0.0",
|
|
5
4
|
"license": "MIT",
|
|
6
5
|
"files": [
|
|
7
6
|
"out/**/*.js",
|
|
@@ -16,13 +15,11 @@
|
|
|
16
15
|
"directory": "packages/language-server"
|
|
17
16
|
},
|
|
18
17
|
"dependencies": {
|
|
19
|
-
"@volar/language-core": "~1.
|
|
20
|
-
"@volar/language-server": "~1.
|
|
21
|
-
"@
|
|
22
|
-
"@vue/language-
|
|
23
|
-
"
|
|
24
|
-
"vscode-languageserver-protocol": "^3.17.5",
|
|
25
|
-
"vue-component-meta": "1.9.0-alpha.3"
|
|
18
|
+
"@volar/language-core": "~2.1.0",
|
|
19
|
+
"@volar/language-server": "~2.1.0",
|
|
20
|
+
"@vue/language-core": "2.0.0",
|
|
21
|
+
"@vue/language-service": "2.0.0",
|
|
22
|
+
"vscode-languageserver-protocol": "^3.17.5"
|
|
26
23
|
},
|
|
27
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "aa47e5a7d8a6dae62cc80dbdb5db6a9bfa4f8715"
|
|
28
25
|
}
|
package/out/index.d.ts
DELETED
package/out/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./protocol"), exports);
|
|
18
|
-
__exportStar(require("./types"), exports);
|
|
19
|
-
// export protocol and types of parent package
|
|
20
|
-
__exportStar(require("@volar/language-server/protocol"), exports);
|
|
21
|
-
__exportStar(require("@volar/language-server/lib/types"), exports);
|
|
22
|
-
// only export types of depend packages
|
|
23
|
-
__exportStar(require("@vue/language-service/out/types"), exports);
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createServerPlugin = void 0;
|
|
4
|
-
const vue = require("@vue/language-service");
|
|
5
|
-
const vue2 = require("@vue/language-core");
|
|
6
|
-
const nameCasing = require("@vue/language-service");
|
|
7
|
-
const protocol_1 = require("./protocol");
|
|
8
|
-
const componentMeta = require("vue-component-meta/out/base");
|
|
9
|
-
const typescript_1 = require("@volar/typescript");
|
|
10
|
-
function createServerPlugin(connection) {
|
|
11
|
-
const plugin = (initOptions, modules) => {
|
|
12
|
-
if (!modules.typescript) {
|
|
13
|
-
console.warn('No typescript found, vue-language-server will not work.');
|
|
14
|
-
return {};
|
|
15
|
-
}
|
|
16
|
-
const ts = modules.typescript;
|
|
17
|
-
const vueFileExtensions = ['vue'];
|
|
18
|
-
const hostToVueOptions = new WeakMap();
|
|
19
|
-
if (initOptions.additionalExtensions) {
|
|
20
|
-
for (const additionalExtension of initOptions.additionalExtensions) {
|
|
21
|
-
vueFileExtensions.push(additionalExtension);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return {
|
|
25
|
-
extraFileExtensions: vueFileExtensions.map(ext => ({ extension: ext, isMixedContent: true, scriptKind: ts.ScriptKind.Deferred })),
|
|
26
|
-
watchFileExtensions: ['js', 'cjs', 'mjs', 'ts', 'cts', 'mts', 'jsx', 'tsx', 'json', ...vueFileExtensions],
|
|
27
|
-
async resolveConfig(config, ctx) {
|
|
28
|
-
const vueOptions = await getVueCompilerOptions();
|
|
29
|
-
if (ctx) {
|
|
30
|
-
hostToVueOptions.set(ctx.host, vue.resolveVueCompilerOptions(vueOptions));
|
|
31
|
-
}
|
|
32
|
-
return vue.resolveConfig(ts, config, ctx?.host.getCompilationSettings() ?? {}, vueOptions, initOptions.codegenStack);
|
|
33
|
-
async function getVueCompilerOptions() {
|
|
34
|
-
const ts = modules.typescript;
|
|
35
|
-
let vueOptions = {};
|
|
36
|
-
if (ts && ctx) {
|
|
37
|
-
const sys = (0, typescript_1.createSys)(ts, ctx.env);
|
|
38
|
-
let sysVersion;
|
|
39
|
-
let newSysVersion = await sys.sync();
|
|
40
|
-
while (sysVersion !== newSysVersion) {
|
|
41
|
-
sysVersion = newSysVersion;
|
|
42
|
-
if (typeof ctx?.project.tsConfig === 'string' && ts) {
|
|
43
|
-
vueOptions = vue2.createParsedCommandLine(ts, sys, ctx.project.tsConfig).vueOptions;
|
|
44
|
-
}
|
|
45
|
-
else if (typeof ctx?.project.tsConfig === 'object' && ts) {
|
|
46
|
-
vueOptions = vue2.createParsedCommandLineByJson(ts, sys, ctx.host.rootPath, ctx.project.tsConfig).vueOptions;
|
|
47
|
-
}
|
|
48
|
-
newSysVersion = await sys.sync();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
vueOptions.extensions = [
|
|
52
|
-
...vueOptions.extensions ?? ['.vue'],
|
|
53
|
-
...vueFileExtensions.map(ext => '.' + ext),
|
|
54
|
-
];
|
|
55
|
-
vueOptions.extensions = [...new Set(vueOptions.extensions)];
|
|
56
|
-
return vueOptions;
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
onInitialized(getService, env) {
|
|
60
|
-
connection.onRequest(protocol_1.ParseSFCRequest.type, params => {
|
|
61
|
-
return vue2.parse(params);
|
|
62
|
-
});
|
|
63
|
-
connection.onRequest(protocol_1.DetectNameCasingRequest.type, async (params) => {
|
|
64
|
-
const languageService = await getService(params.textDocument.uri);
|
|
65
|
-
if (languageService) {
|
|
66
|
-
return nameCasing.detect(ts, languageService.context, params.textDocument.uri, hostToVueOptions.get(languageService.context.rawHost));
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
connection.onRequest(protocol_1.GetConvertTagCasingEditsRequest.type, async (params) => {
|
|
70
|
-
const languageService = await getService(params.textDocument.uri);
|
|
71
|
-
if (languageService) {
|
|
72
|
-
return nameCasing.convertTagName(ts, languageService.context, params.textDocument.uri, params.casing, hostToVueOptions.get(languageService.context.rawHost));
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
connection.onRequest(protocol_1.GetDragAndDragImportEditsRequest.type, async (params) => {
|
|
76
|
-
const languageService = await getService(params.uri);
|
|
77
|
-
if (languageService) {
|
|
78
|
-
return nameCasing.getDragImportEdits(ts, languageService.context, params.uri, params.importUri, params.casing);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
connection.onRequest(protocol_1.GetConvertAttrCasingEditsRequest.type, async (params) => {
|
|
82
|
-
const languageService = await getService(params.textDocument.uri);
|
|
83
|
-
if (languageService) {
|
|
84
|
-
const vueOptions = hostToVueOptions.get(languageService.context.host);
|
|
85
|
-
if (vueOptions) {
|
|
86
|
-
return nameCasing.convertAttrName(ts, languageService.context, params.textDocument.uri, params.casing, hostToVueOptions.get(languageService.context.rawHost));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
const checkers = new WeakMap();
|
|
91
|
-
connection.onRequest(protocol_1.GetComponentMeta.type, async (params) => {
|
|
92
|
-
const languageService = await getService(params.uri);
|
|
93
|
-
if (!languageService)
|
|
94
|
-
return;
|
|
95
|
-
const host = languageService.context.rawHost;
|
|
96
|
-
let checker = checkers.get(host);
|
|
97
|
-
if (!checker) {
|
|
98
|
-
checker = componentMeta.baseCreate(ts, host, hostToVueOptions.get(host), {}, host.rootPath + '/tsconfig.json.global.vue');
|
|
99
|
-
checkers.set(host, checker);
|
|
100
|
-
}
|
|
101
|
-
return checker.getComponentMeta(env.uriToFileName(params.uri));
|
|
102
|
-
});
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
return plugin;
|
|
107
|
-
}
|
|
108
|
-
exports.createServerPlugin = createServerPlugin;
|
|
109
|
-
//# sourceMappingURL=languageServerPlugin.js.map
|
package/out/nodeServer.d.ts
DELETED
package/out/nodeServer.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const node_1 = require("@volar/language-server/node");
|
|
4
|
-
const languageServerPlugin_1 = require("./languageServerPlugin");
|
|
5
|
-
const connection = (0, node_1.createConnection)();
|
|
6
|
-
const plugin = (0, languageServerPlugin_1.createServerPlugin)(connection);
|
|
7
|
-
(0, node_1.startLanguageServer)(connection, plugin);
|
|
8
|
-
//# sourceMappingURL=nodeServer.js.map
|
package/out/protocol.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import { TagNameCasing, AttrNameCasing, SFCParseResult } from '@vue/language-service';
|
|
3
|
-
import { ComponentMeta } from 'vue-component-meta';
|
|
4
|
-
export declare namespace GetComponentMeta {
|
|
5
|
-
type ParamsType = vscode.TextDocumentIdentifier;
|
|
6
|
-
type ResponseType = ComponentMeta | null | undefined;
|
|
7
|
-
type ErrorType = never;
|
|
8
|
-
const type: vscode.RequestType<vscode.TextDocumentIdentifier, ResponseType, never>;
|
|
9
|
-
}
|
|
10
|
-
export declare namespace DetectNameCasingRequest {
|
|
11
|
-
type ParamsType = {
|
|
12
|
-
textDocument: vscode.TextDocumentIdentifier;
|
|
13
|
-
};
|
|
14
|
-
type ResponseType = {
|
|
15
|
-
tag: TagNameCasing[];
|
|
16
|
-
attr: AttrNameCasing[];
|
|
17
|
-
} | null | undefined;
|
|
18
|
-
type ErrorType = never;
|
|
19
|
-
const type: vscode.RequestType<ParamsType, ResponseType, never>;
|
|
20
|
-
}
|
|
21
|
-
export declare namespace GetConvertTagCasingEditsRequest {
|
|
22
|
-
type ParamsType = {
|
|
23
|
-
textDocument: vscode.TextDocumentIdentifier;
|
|
24
|
-
casing: TagNameCasing;
|
|
25
|
-
};
|
|
26
|
-
type ResponseType = vscode.TextEdit[] | null | undefined;
|
|
27
|
-
type ErrorType = never;
|
|
28
|
-
const type: vscode.RequestType<ParamsType, ResponseType, never>;
|
|
29
|
-
}
|
|
30
|
-
export declare namespace GetDragAndDragImportEditsRequest {
|
|
31
|
-
type ParamsType = {
|
|
32
|
-
uri: string;
|
|
33
|
-
importUri: string;
|
|
34
|
-
casing: TagNameCasing;
|
|
35
|
-
};
|
|
36
|
-
type ResponseType = {
|
|
37
|
-
insertText: string;
|
|
38
|
-
insertTextFormat: vscode.InsertTextFormat;
|
|
39
|
-
additionalEdits: vscode.TextEdit[];
|
|
40
|
-
} | null | undefined;
|
|
41
|
-
type ErrorType = never;
|
|
42
|
-
const type: vscode.RequestType<ParamsType, ResponseType, never>;
|
|
43
|
-
}
|
|
44
|
-
export declare namespace GetConvertAttrCasingEditsRequest {
|
|
45
|
-
type ParamsType = {
|
|
46
|
-
textDocument: vscode.TextDocumentIdentifier;
|
|
47
|
-
casing: AttrNameCasing;
|
|
48
|
-
};
|
|
49
|
-
type ResponseType = vscode.TextEdit[] | null | undefined;
|
|
50
|
-
type ErrorType = never;
|
|
51
|
-
const type: vscode.RequestType<ParamsType, ResponseType, never>;
|
|
52
|
-
}
|
|
53
|
-
export declare namespace ParseSFCRequest {
|
|
54
|
-
type ParamsType = string;
|
|
55
|
-
type ResponseType = SFCParseResult;
|
|
56
|
-
type ErrorType = never;
|
|
57
|
-
const type: vscode.RequestType<string, SFCParseResult, never>;
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=protocol.d.ts.map
|
package/out/protocol.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParseSFCRequest = exports.GetConvertAttrCasingEditsRequest = exports.GetDragAndDragImportEditsRequest = exports.GetConvertTagCasingEditsRequest = exports.DetectNameCasingRequest = exports.GetComponentMeta = void 0;
|
|
4
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
5
|
-
var GetComponentMeta;
|
|
6
|
-
(function (GetComponentMeta) {
|
|
7
|
-
GetComponentMeta.type = new vscode.RequestType('vue/componentMeta');
|
|
8
|
-
})(GetComponentMeta || (exports.GetComponentMeta = GetComponentMeta = {}));
|
|
9
|
-
var DetectNameCasingRequest;
|
|
10
|
-
(function (DetectNameCasingRequest) {
|
|
11
|
-
DetectNameCasingRequest.type = new vscode.RequestType('vue/detectTagCasing');
|
|
12
|
-
})(DetectNameCasingRequest || (exports.DetectNameCasingRequest = DetectNameCasingRequest = {}));
|
|
13
|
-
var GetConvertTagCasingEditsRequest;
|
|
14
|
-
(function (GetConvertTagCasingEditsRequest) {
|
|
15
|
-
GetConvertTagCasingEditsRequest.type = new vscode.RequestType('vue/convertTagNameCasing');
|
|
16
|
-
})(GetConvertTagCasingEditsRequest || (exports.GetConvertTagCasingEditsRequest = GetConvertTagCasingEditsRequest = {}));
|
|
17
|
-
var GetDragAndDragImportEditsRequest;
|
|
18
|
-
(function (GetDragAndDragImportEditsRequest) {
|
|
19
|
-
GetDragAndDragImportEditsRequest.type = new vscode.RequestType('vue/dragImportEdits');
|
|
20
|
-
})(GetDragAndDragImportEditsRequest || (exports.GetDragAndDragImportEditsRequest = GetDragAndDragImportEditsRequest = {}));
|
|
21
|
-
var GetConvertAttrCasingEditsRequest;
|
|
22
|
-
(function (GetConvertAttrCasingEditsRequest) {
|
|
23
|
-
GetConvertAttrCasingEditsRequest.type = new vscode.RequestType('vue/convertPropNameCasing');
|
|
24
|
-
})(GetConvertAttrCasingEditsRequest || (exports.GetConvertAttrCasingEditsRequest = GetConvertAttrCasingEditsRequest = {}));
|
|
25
|
-
var ParseSFCRequest;
|
|
26
|
-
(function (ParseSFCRequest) {
|
|
27
|
-
ParseSFCRequest.type = new vscode.RequestType('vue/parseSfc');
|
|
28
|
-
})(ParseSFCRequest || (exports.ParseSFCRequest = ParseSFCRequest = {}));
|
|
29
|
-
//# sourceMappingURL=protocol.js.map
|
package/out/types.d.ts
DELETED
package/out/types.js
DELETED
package/out/webServer.d.ts
DELETED
package/out/webServer.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const browser_1 = require("@volar/language-server/browser");
|
|
4
|
-
const languageServerPlugin_1 = require("./languageServerPlugin");
|
|
5
|
-
const connection = (0, browser_1.createConnection)();
|
|
6
|
-
const plugin = (0, languageServerPlugin_1.createServerPlugin)(connection);
|
|
7
|
-
(0, browser_1.startLanguageServer)(connection, plugin);
|
|
8
|
-
//# sourceMappingURL=webServer.js.map
|