@volar/language-server 1.0.0-beta.1 → 1.0.0-beta.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.
- package/out/features/customFeatures.d.ts +1 -2
- package/out/features/customFeatures.js +7 -18
- package/out/features/languageFeatures.d.ts +1 -2
- package/out/features/languageFeatures.js +2 -6
- package/out/node.js +11 -7
- package/out/registerFeatures.d.ts +5 -0
- package/out/registerFeatures.js +174 -0
- package/out/requests.d.ts +0 -11
- package/out/requests.js +1 -9
- package/out/server.js +47 -23
- package/out/types.d.ts +18 -72
- package/out/types.js +13 -0
- package/out/utils/project.d.ts +4 -4
- package/out/utils/project.js +4 -15
- package/out/utils/workspaceProjects.d.ts +4 -4
- package/out/utils/workspaces.d.ts +8 -8
- package/out/utils/workspaces.js +6 -5
- package/package.json +5 -5
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver';
|
|
2
2
|
import type { Workspaces } from '../utils/workspaces';
|
|
3
|
-
|
|
4
|
-
export declare function register(connection: vscode.Connection, projects: Workspaces, plugins: ReturnType<LanguageServerPlugin>[]): void;
|
|
3
|
+
export declare function register(connection: vscode.Connection, projects: Workspaces): void;
|
|
@@ -13,21 +13,20 @@ const shared = require("@volar/shared");
|
|
|
13
13
|
const path = require("upath");
|
|
14
14
|
const vscode = require("vscode-languageserver");
|
|
15
15
|
const requests_1 = require("../requests");
|
|
16
|
-
function register(connection, projects
|
|
17
|
-
var _a, _b;
|
|
16
|
+
function register(connection, projects) {
|
|
18
17
|
connection.onRequest(requests_1.GetMatchTsConfigRequest.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
var
|
|
20
|
-
return (
|
|
18
|
+
var _a;
|
|
19
|
+
return (_a = (yield projects.getProject(params.uri))) === null || _a === void 0 ? void 0 : _a.tsconfig;
|
|
21
20
|
}));
|
|
22
21
|
connection.onNotification(requests_1.ReloadProjectNotification.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
23
22
|
projects.reloadProject();
|
|
24
23
|
}));
|
|
25
24
|
connection.onNotification(requests_1.WriteVirtualFilesNotification.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
var
|
|
25
|
+
var _b;
|
|
27
26
|
const fs = yield Promise.resolve().then(() => require('fs'));
|
|
28
27
|
const project = yield projects.getProject(params.uri);
|
|
29
28
|
if (project) {
|
|
30
|
-
const ls = (
|
|
29
|
+
const ls = (_b = (yield project.project)) === null || _b === void 0 ? void 0 : _b.getLanguageServiceDontCreate();
|
|
31
30
|
if (ls) {
|
|
32
31
|
const sourceFiles = new Set(ls.context.host.getScriptFileNames());
|
|
33
32
|
for (const virtualFile of ls.context.core.typescriptLanguageServiceHost.getScriptFileNames()) {
|
|
@@ -42,14 +41,14 @@ function register(connection, projects, plugins) {
|
|
|
42
41
|
}
|
|
43
42
|
}));
|
|
44
43
|
connection.onNotification(requests_1.VerifyAllScriptsNotification.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
var
|
|
44
|
+
var _c;
|
|
46
45
|
let errors = 0;
|
|
47
46
|
let warnings = 0;
|
|
48
47
|
const progress = yield connection.window.createWorkDoneProgress();
|
|
49
48
|
progress.begin('Verify', 0, '', true);
|
|
50
49
|
const project = yield projects.getProject(params.uri);
|
|
51
50
|
if (project) {
|
|
52
|
-
const ls = (
|
|
51
|
+
const ls = (_c = (yield project.project)) === null || _c === void 0 ? void 0 : _c.getLanguageServiceDontCreate();
|
|
53
52
|
if (ls) {
|
|
54
53
|
const allVueDocuments = ls.context.documents.getAll();
|
|
55
54
|
let i = 0;
|
|
@@ -68,16 +67,6 @@ function register(connection, projects, plugins) {
|
|
|
68
67
|
progress.done();
|
|
69
68
|
connection.window.showInformationMessage(`Verification complete. Found ${errors} errors and ${warnings} warnings.`);
|
|
70
69
|
}));
|
|
71
|
-
for (const plugin of plugins) {
|
|
72
|
-
(_b = (_a = plugin.languageService) === null || _a === void 0 ? void 0 : _a.onInitialize) === null || _b === void 0 ? void 0 : _b.call(_a, connection, getLanguageService);
|
|
73
|
-
}
|
|
74
|
-
function getLanguageService(uri) {
|
|
75
|
-
var _a;
|
|
76
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
const project = (_a = (yield projects.getProject(uri))) === null || _a === void 0 ? void 0 : _a.project;
|
|
78
|
-
return project === null || project === void 0 ? void 0 : project.getLanguageService();
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
70
|
}
|
|
82
71
|
exports.register = register;
|
|
83
72
|
//# sourceMappingURL=customFeatures.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver';
|
|
2
|
-
import { ServerInitializationOptions } from '../types';
|
|
3
2
|
import type { Workspaces } from '../utils/workspaces';
|
|
4
|
-
export declare function register(connection: vscode.Connection, projects: Workspaces,
|
|
3
|
+
export declare function register(connection: vscode.Connection, projects: Workspaces, initParams: vscode.InitializeParams): void;
|
|
@@ -12,7 +12,7 @@ exports.register = void 0;
|
|
|
12
12
|
const embedded = require("@volar/language-service");
|
|
13
13
|
const vscode = require("vscode-languageserver");
|
|
14
14
|
const requests_1 = require("../requests");
|
|
15
|
-
function register(connection, projects,
|
|
15
|
+
function register(connection, projects, initParams) {
|
|
16
16
|
let lastCompleteUri;
|
|
17
17
|
let lastCompleteLs;
|
|
18
18
|
let lastCodeLensLs;
|
|
@@ -33,11 +33,7 @@ function register(connection, projects, features, initParams) {
|
|
|
33
33
|
}));
|
|
34
34
|
connection.onCompletionResolve((item) => __awaiter(this, void 0, void 0, function* () {
|
|
35
35
|
if (lastCompleteUri && lastCompleteLs) {
|
|
36
|
-
|
|
37
|
-
? yield connection.sendRequest(requests_1.GetEditorSelectionRequest.type)
|
|
38
|
-
: undefined;
|
|
39
|
-
const newPosition = (activeSel === null || activeSel === void 0 ? void 0 : activeSel.textDocument.uri.toLowerCase()) === lastCompleteUri.toLowerCase() ? activeSel.position : undefined;
|
|
40
|
-
item = yield lastCompleteLs.doCompletionResolve(item, newPosition);
|
|
36
|
+
item = yield lastCompleteLs.doCompletionResolve(item);
|
|
41
37
|
fixTextEdit(item);
|
|
42
38
|
}
|
|
43
39
|
return item;
|
package/out/node.js
CHANGED
|
@@ -17,7 +17,6 @@ exports.createLanguageServer = void 0;
|
|
|
17
17
|
const shared = require("@volar/shared");
|
|
18
18
|
const fs = require("fs");
|
|
19
19
|
const request_light_1 = require("request-light");
|
|
20
|
-
const path = require("upath");
|
|
21
20
|
const html = require("vscode-html-languageservice");
|
|
22
21
|
const vscode = require("vscode-languageserver/node");
|
|
23
22
|
const server_1 = require("./server");
|
|
@@ -27,17 +26,22 @@ const nodeFileSystemHost_1 = require("./utils/nodeFileSystemHost");
|
|
|
27
26
|
function createLanguageServer(plugins) {
|
|
28
27
|
const connection = vscode.createConnection(vscode.ProposedFeatures.all);
|
|
29
28
|
(0, server_1.createCommonLanguageServer)(connection, {
|
|
30
|
-
loadTypescript(
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
loadTypescriptLocalized(options) {
|
|
34
|
-
if (options.typescript.localizedPath) {
|
|
29
|
+
loadTypescript(tsdk) {
|
|
30
|
+
for (const name of ['./typescript.js', './tsserverlibrary.js', './tsserver.js']) {
|
|
35
31
|
try {
|
|
36
|
-
|
|
32
|
+
const path = require.resolve(name, { paths: [tsdk] });
|
|
33
|
+
return require(path);
|
|
37
34
|
}
|
|
38
35
|
catch (_a) { }
|
|
39
36
|
}
|
|
40
37
|
},
|
|
38
|
+
loadTypescriptLocalized(tsdk, locale) {
|
|
39
|
+
try {
|
|
40
|
+
const path = require.resolve(`./${locale}/diagnosticMessages.generated.json`, { paths: [tsdk] });
|
|
41
|
+
return require(path);
|
|
42
|
+
}
|
|
43
|
+
catch (_a) { }
|
|
44
|
+
},
|
|
41
45
|
schemaRequestHandlers: {
|
|
42
46
|
file: file_1.default,
|
|
43
47
|
http: http_1.default,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { LanguageServerPlugin, InitializationOptions } from './types';
|
|
2
|
+
import * as vscode from 'vscode-languageserver';
|
|
3
|
+
import { ClientCapabilities } from 'vscode-languageserver';
|
|
4
|
+
export declare function setupSyntacticCapabilities(params: ClientCapabilities, server: vscode.ServerCapabilities): void;
|
|
5
|
+
export declare function setupSemanticCapabilities(params: ClientCapabilities, server: vscode.ServerCapabilities, options: InitializationOptions, plugins: ReturnType<LanguageServerPlugin>[]): void;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.setupSemanticCapabilities = exports.setupSyntacticCapabilities = void 0;
|
|
3
|
+
const embedded = require("@volar/language-service");
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
const vscode = require("vscode-languageserver");
|
|
6
|
+
function setupSyntacticCapabilities(params, server) {
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8
|
+
if ((_a = params.textDocument) === null || _a === void 0 ? void 0 : _a.selectionRange) {
|
|
9
|
+
server.selectionRangeProvider = true;
|
|
10
|
+
}
|
|
11
|
+
if ((_b = params.textDocument) === null || _b === void 0 ? void 0 : _b.foldingRange) {
|
|
12
|
+
server.foldingRangeProvider = true;
|
|
13
|
+
}
|
|
14
|
+
if ((_c = params.textDocument) === null || _c === void 0 ? void 0 : _c.linkedEditingRange) {
|
|
15
|
+
server.linkedEditingRangeProvider = true;
|
|
16
|
+
}
|
|
17
|
+
if ((_d = params.textDocument) === null || _d === void 0 ? void 0 : _d.colorProvider) {
|
|
18
|
+
server.colorProvider = true;
|
|
19
|
+
}
|
|
20
|
+
if ((_e = params.textDocument) === null || _e === void 0 ? void 0 : _e.documentSymbol) {
|
|
21
|
+
server.documentSymbolProvider = true;
|
|
22
|
+
}
|
|
23
|
+
if ((_f = params.textDocument) === null || _f === void 0 ? void 0 : _f.formatting) {
|
|
24
|
+
server.documentFormattingProvider = true;
|
|
25
|
+
}
|
|
26
|
+
if ((_g = params.textDocument) === null || _g === void 0 ? void 0 : _g.rangeFormatting) {
|
|
27
|
+
server.documentRangeFormattingProvider = true;
|
|
28
|
+
}
|
|
29
|
+
if ((_h = params.textDocument) === null || _h === void 0 ? void 0 : _h.onTypeFormatting) {
|
|
30
|
+
// https://github.com/microsoft/vscode/blob/ce119308e8fd4cd3f992d42b297588e7abe33a0c/extensions/typescript-language-features/src/languageFeatures/formatting.ts#L99
|
|
31
|
+
server.documentOnTypeFormattingProvider = {
|
|
32
|
+
firstTriggerCharacter: ';',
|
|
33
|
+
moreTriggerCharacter: ['}', '\n'],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.setupSyntacticCapabilities = setupSyntacticCapabilities;
|
|
38
|
+
function setupSemanticCapabilities(params, server, options, plugins) {
|
|
39
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
40
|
+
if ((_a = params.textDocument) === null || _a === void 0 ? void 0 : _a.references) {
|
|
41
|
+
server.referencesProvider = true;
|
|
42
|
+
}
|
|
43
|
+
if ((_b = params.textDocument) === null || _b === void 0 ? void 0 : _b.implementation) {
|
|
44
|
+
server.implementationProvider = true;
|
|
45
|
+
}
|
|
46
|
+
if ((_c = params.textDocument) === null || _c === void 0 ? void 0 : _c.definition) {
|
|
47
|
+
server.definitionProvider = true;
|
|
48
|
+
}
|
|
49
|
+
if ((_d = params.textDocument) === null || _d === void 0 ? void 0 : _d.typeDefinition) {
|
|
50
|
+
server.typeDefinitionProvider = true;
|
|
51
|
+
}
|
|
52
|
+
if ((_e = params.textDocument) === null || _e === void 0 ? void 0 : _e.callHierarchy) {
|
|
53
|
+
server.callHierarchyProvider = true;
|
|
54
|
+
}
|
|
55
|
+
if ((_f = params.textDocument) === null || _f === void 0 ? void 0 : _f.hover) {
|
|
56
|
+
server.hoverProvider = true;
|
|
57
|
+
}
|
|
58
|
+
if ((_g = params.textDocument) === null || _g === void 0 ? void 0 : _g.rename) {
|
|
59
|
+
server.renameProvider = {
|
|
60
|
+
prepareProvider: true,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if ((_h = params.workspace) === null || _h === void 0 ? void 0 : _h.fileOperations) {
|
|
64
|
+
server.workspace = {
|
|
65
|
+
fileOperations: {
|
|
66
|
+
willRename: {
|
|
67
|
+
filters: [
|
|
68
|
+
...plugins.map(plugin => plugin.extensions.map(ext => ({ pattern: { glob: `**/*${ext}` } }))).flat(),
|
|
69
|
+
{ pattern: { glob: '**/*.js' } },
|
|
70
|
+
{ pattern: { glob: '**/*.ts' } },
|
|
71
|
+
{ pattern: { glob: '**/*.jsx' } },
|
|
72
|
+
{ pattern: { glob: '**/*.tsx' } },
|
|
73
|
+
{ pattern: { glob: '**/*.json' } },
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if ((_j = params.textDocument) === null || _j === void 0 ? void 0 : _j.signatureHelp) {
|
|
80
|
+
server.signatureHelpProvider = {
|
|
81
|
+
triggerCharacters: ['(', ',', '<'],
|
|
82
|
+
retriggerCharacters: [')'],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if ((_k = params.textDocument) === null || _k === void 0 ? void 0 : _k.completion) {
|
|
86
|
+
server.completionProvider = {
|
|
87
|
+
// triggerCharacters: '!@#$%^&*()_+-=`~{}|[]\:";\'<>?,./ '.split(''), // all symbols on keyboard
|
|
88
|
+
// hardcode to fix https://github.com/sublimelsp/LSP-volar/issues/114
|
|
89
|
+
triggerCharacters: [...new Set([
|
|
90
|
+
'/', '-', ':',
|
|
91
|
+
...'>+^*()#.[]$@-{}'.split(''),
|
|
92
|
+
'.', ':', '<', '"', '=', '/',
|
|
93
|
+
'@',
|
|
94
|
+
'"', ':',
|
|
95
|
+
'.', '"', '\'', '`', '/', '<', '@', '#', ' ',
|
|
96
|
+
'*',
|
|
97
|
+
'@', // typescript-comment
|
|
98
|
+
])],
|
|
99
|
+
resolveProvider: true,
|
|
100
|
+
};
|
|
101
|
+
if (options.ignoreTriggerCharacters) {
|
|
102
|
+
server.completionProvider.triggerCharacters = (_l = server.completionProvider.triggerCharacters) === null || _l === void 0 ? void 0 : _l.filter(c => !options.ignoreTriggerCharacters.includes(c));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if ((_m = params.textDocument) === null || _m === void 0 ? void 0 : _m.documentHighlight) {
|
|
106
|
+
server.documentHighlightProvider = true;
|
|
107
|
+
}
|
|
108
|
+
if ((_o = params.textDocument) === null || _o === void 0 ? void 0 : _o.documentLink) {
|
|
109
|
+
server.documentLinkProvider = {
|
|
110
|
+
resolveProvider: false, // TODO
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
if ((_p = params.workspace) === null || _p === void 0 ? void 0 : _p.symbol) {
|
|
114
|
+
server.workspaceSymbolProvider = true;
|
|
115
|
+
}
|
|
116
|
+
if ((_q = params.textDocument) === null || _q === void 0 ? void 0 : _q.codeLens) {
|
|
117
|
+
server.codeLensProvider = {
|
|
118
|
+
resolveProvider: true,
|
|
119
|
+
};
|
|
120
|
+
server.executeCommandProvider = {
|
|
121
|
+
commands: [
|
|
122
|
+
...(_s = (_r = server.executeCommandProvider) === null || _r === void 0 ? void 0 : _r.commands) !== null && _s !== void 0 ? _s : [],
|
|
123
|
+
embedded.executePluginCommand,
|
|
124
|
+
]
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if ((_t = params.textDocument) === null || _t === void 0 ? void 0 : _t.semanticTokens) {
|
|
128
|
+
server.semanticTokensProvider = {
|
|
129
|
+
range: true,
|
|
130
|
+
full: false,
|
|
131
|
+
legend: {
|
|
132
|
+
tokenModifiers: [],
|
|
133
|
+
tokenTypes: [],
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
for (const plugin of plugins) {
|
|
137
|
+
if ((_u = plugin.languageService) === null || _u === void 0 ? void 0 : _u.semanticTokenLegend) {
|
|
138
|
+
server.semanticTokensProvider.legend.tokenModifiers = server.semanticTokensProvider.legend.tokenModifiers.concat(plugin.languageService.semanticTokenLegend.tokenModifiers);
|
|
139
|
+
server.semanticTokensProvider.legend.tokenTypes = server.semanticTokensProvider.legend.tokenTypes.concat(plugin.languageService.semanticTokenLegend.tokenTypes);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if ((_v = params.textDocument) === null || _v === void 0 ? void 0 : _v.codeAction) {
|
|
144
|
+
server.codeActionProvider = {
|
|
145
|
+
codeActionKinds: [
|
|
146
|
+
vscode.CodeActionKind.Empty,
|
|
147
|
+
vscode.CodeActionKind.QuickFix,
|
|
148
|
+
vscode.CodeActionKind.Refactor,
|
|
149
|
+
vscode.CodeActionKind.RefactorExtract,
|
|
150
|
+
vscode.CodeActionKind.RefactorInline,
|
|
151
|
+
vscode.CodeActionKind.RefactorRewrite,
|
|
152
|
+
vscode.CodeActionKind.Source,
|
|
153
|
+
vscode.CodeActionKind.SourceFixAll,
|
|
154
|
+
vscode.CodeActionKind.SourceOrganizeImports,
|
|
155
|
+
],
|
|
156
|
+
resolveProvider: true,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
if ((_w = params.textDocument) === null || _w === void 0 ? void 0 : _w.inlayHint) {
|
|
160
|
+
server.inlayHintProvider = true;
|
|
161
|
+
}
|
|
162
|
+
if (((_x = params.textDocument) === null || _x === void 0 ? void 0 : _x.diagnostic) && ((_y = options.diagnosticModel) !== null && _y !== void 0 ? _y : types_1.DiagnosticModel.Push) === types_1.DiagnosticModel.Pull) {
|
|
163
|
+
server.diagnosticProvider = {
|
|
164
|
+
documentSelector: [
|
|
165
|
+
...plugins.map(plugin => plugin.extensions.map(ext => ({ pattern: `**/*${ext}` }))).flat(),
|
|
166
|
+
{ pattern: '**/*.{ts,js,tsx,jsx}' },
|
|
167
|
+
],
|
|
168
|
+
interFileDependencies: true,
|
|
169
|
+
workspaceDiagnostics: false,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.setupSemanticCapabilities = setupSemanticCapabilities;
|
|
174
|
+
//# sourceMappingURL=registerFeatures.js.map
|
package/out/requests.d.ts
CHANGED
|
@@ -3,12 +3,6 @@ import type * as html from 'vscode-html-languageservice';
|
|
|
3
3
|
/**
|
|
4
4
|
* Server request client
|
|
5
5
|
*/
|
|
6
|
-
export declare namespace GetDocumentContentRequest {
|
|
7
|
-
type ParamsType = vscode.TextDocumentIdentifier;
|
|
8
|
-
type ResponseType = string;
|
|
9
|
-
type ErrorType = never;
|
|
10
|
-
const type: vscode.RequestType<vscode.TextDocumentIdentifier, string, never>;
|
|
11
|
-
}
|
|
12
6
|
export declare namespace ShowReferencesNotification {
|
|
13
7
|
type ResponseType = vscode.TextDocumentPositionParams & {
|
|
14
8
|
references: vscode.Location[];
|
|
@@ -21,11 +15,6 @@ export declare namespace GetDocumentPrintWidthRequest {
|
|
|
21
15
|
type ErrorType = never;
|
|
22
16
|
const type: vscode.RequestType<vscode.TextDocumentIdentifier, ResponseType, never>;
|
|
23
17
|
}
|
|
24
|
-
export declare namespace GetEditorSelectionRequest {
|
|
25
|
-
type ResponseType = vscode.TextDocumentPositionParams | undefined;
|
|
26
|
-
type ErrorType = never;
|
|
27
|
-
const type: vscode.RequestType0<ResponseType, never>;
|
|
28
|
-
}
|
|
29
18
|
export declare namespace FindFileReferenceRequest {
|
|
30
19
|
type ParamsType = {
|
|
31
20
|
textDocument: vscode.TextDocumentIdentifier;
|
package/out/requests.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.FsReadDirectoryRequest = exports.FsReadFileRequest = exports.FsStatRequest = exports.ReloadProjectNotification = exports.WriteVirtualFilesNotification = exports.VerifyAllScriptsNotification = exports.AutoInsertRequest = exports.GetMatchTsConfigRequest = exports.FindFileReferenceRequest = exports.
|
|
2
|
+
exports.FsReadDirectoryRequest = exports.FsReadFileRequest = exports.FsStatRequest = exports.ReloadProjectNotification = exports.WriteVirtualFilesNotification = exports.VerifyAllScriptsNotification = exports.AutoInsertRequest = exports.GetMatchTsConfigRequest = exports.FindFileReferenceRequest = exports.GetDocumentPrintWidthRequest = exports.ShowReferencesNotification = void 0;
|
|
3
3
|
const vscode = require("vscode-languageserver-protocol");
|
|
4
4
|
/**
|
|
5
5
|
* Server request client
|
|
6
6
|
*/
|
|
7
|
-
var GetDocumentContentRequest;
|
|
8
|
-
(function (GetDocumentContentRequest) {
|
|
9
|
-
GetDocumentContentRequest.type = new vscode.RequestType('vscode/content');
|
|
10
|
-
})(GetDocumentContentRequest = exports.GetDocumentContentRequest || (exports.GetDocumentContentRequest = {}));
|
|
11
7
|
var ShowReferencesNotification;
|
|
12
8
|
(function (ShowReferencesNotification) {
|
|
13
9
|
ShowReferencesNotification.type = new vscode.NotificationType('vue.findReferences');
|
|
@@ -16,10 +12,6 @@ var GetDocumentPrintWidthRequest;
|
|
|
16
12
|
(function (GetDocumentPrintWidthRequest) {
|
|
17
13
|
GetDocumentPrintWidthRequest.type = new vscode.RequestType('vue/getDocumentWordWrapColumn');
|
|
18
14
|
})(GetDocumentPrintWidthRequest = exports.GetDocumentPrintWidthRequest || (exports.GetDocumentPrintWidthRequest = {}));
|
|
19
|
-
var GetEditorSelectionRequest;
|
|
20
|
-
(function (GetEditorSelectionRequest) {
|
|
21
|
-
GetEditorSelectionRequest.type = new vscode.RequestType0('vue/activeSelection');
|
|
22
|
-
})(GetEditorSelectionRequest = exports.GetEditorSelectionRequest || (exports.GetEditorSelectionRequest = {}));
|
|
23
15
|
var FindFileReferenceRequest;
|
|
24
16
|
(function (FindFileReferenceRequest) {
|
|
25
17
|
FindFileReferenceRequest.type = new vscode.RequestType('vue/findFileReference');
|
package/out/server.js
CHANGED
|
@@ -11,10 +11,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
11
11
|
exports.createCommonLanguageServer = void 0;
|
|
12
12
|
const vscode = require("vscode-languageserver");
|
|
13
13
|
const vscode_uri_1 = require("vscode-uri");
|
|
14
|
+
const types_1 = require("./types");
|
|
14
15
|
const configurationHost_1 = require("./utils/configurationHost");
|
|
15
16
|
const documentServiceHost_1 = require("./utils/documentServiceHost");
|
|
16
17
|
const snapshots_1 = require("./utils/snapshots");
|
|
17
18
|
const workspaces_1 = require("./utils/workspaces");
|
|
19
|
+
const registerFeatures_1 = require("./registerFeatures");
|
|
18
20
|
function createCommonLanguageServer(connection, runtimeEnv, _plugins) {
|
|
19
21
|
let params;
|
|
20
22
|
let options;
|
|
@@ -26,7 +28,7 @@ function createCommonLanguageServer(connection, runtimeEnv, _plugins) {
|
|
|
26
28
|
let plugins;
|
|
27
29
|
const documents = (0, snapshots_1.createSnapshots)(connection);
|
|
28
30
|
connection.onInitialize((_params) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
var _a, _b, _c;
|
|
31
|
+
var _a, _b, _c, _d;
|
|
30
32
|
params = _params;
|
|
31
33
|
options = params.initializationOptions;
|
|
32
34
|
plugins = _plugins.map(plugin => plugin(options));
|
|
@@ -44,26 +46,13 @@ function createCommonLanguageServer(connection, runtimeEnv, _plugins) {
|
|
|
44
46
|
textDocumentSync: (_b = options.textDocumentSync) !== null && _b !== void 0 ? _b : vscode.TextDocumentSyncKind.Incremental,
|
|
45
47
|
},
|
|
46
48
|
};
|
|
47
|
-
const ts = runtimeEnv.loadTypescript(options);
|
|
48
49
|
configHost = ((_c = params.capabilities.workspace) === null || _c === void 0 ? void 0 : _c.configuration) ? (0, configurationHost_1.createConfigurationHost)(params, connection) : undefined;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
(yield Promise.resolve().then(() => require('./features/documentFeatures'))).register(connection, documents, documentServiceHost);
|
|
56
|
-
}
|
|
57
|
-
if (options.languageFeatures) {
|
|
58
|
-
(yield Promise.resolve().then(() => require('./registers/registerlanguageFeatures'))).register(options.languageFeatures, result.capabilities, plugins);
|
|
59
|
-
fsHost = runtimeEnv.createFileSystemHost(ts, params.capabilities);
|
|
60
|
-
const tsLocalized = runtimeEnv.loadTypescriptLocalized(options);
|
|
61
|
-
projects = (0, workspaces_1.createWorkspaces)(runtimeEnv, plugins, fsHost, configHost, ts, tsLocalized, options, documents, connection);
|
|
62
|
-
for (const root of roots) {
|
|
63
|
-
projects.add(root);
|
|
64
|
-
}
|
|
65
|
-
(yield Promise.resolve().then(() => require('./features/customFeatures'))).register(connection, projects, plugins);
|
|
66
|
-
(yield Promise.resolve().then(() => require('./features/languageFeatures'))).register(connection, projects, options.languageFeatures, params);
|
|
50
|
+
const serverMode = (_d = options.serverMode) !== null && _d !== void 0 ? _d : types_1.ServerMode.Semantic;
|
|
51
|
+
(0, registerFeatures_1.setupSyntacticCapabilities)(params.capabilities, result.capabilities);
|
|
52
|
+
yield createDocumenntServiceHost();
|
|
53
|
+
if (serverMode === types_1.ServerMode.Semantic) {
|
|
54
|
+
(0, registerFeatures_1.setupSemanticCapabilities)(params.capabilities, result.capabilities, options, plugins);
|
|
55
|
+
yield createLanguageServiceHost();
|
|
67
56
|
}
|
|
68
57
|
try {
|
|
69
58
|
// show version on LSP logs
|
|
@@ -73,14 +62,14 @@ function createCommonLanguageServer(connection, runtimeEnv, _plugins) {
|
|
|
73
62
|
version: packageJson.version,
|
|
74
63
|
};
|
|
75
64
|
}
|
|
76
|
-
catch (
|
|
65
|
+
catch (_e) { }
|
|
77
66
|
return result;
|
|
78
67
|
}));
|
|
79
68
|
connection.onInitialized(() => __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
var
|
|
69
|
+
var _f;
|
|
81
70
|
fsHost === null || fsHost === void 0 ? void 0 : fsHost.ready(connection);
|
|
82
71
|
configHost === null || configHost === void 0 ? void 0 : configHost.ready();
|
|
83
|
-
if ((
|
|
72
|
+
if ((_f = params.capabilities.workspace) === null || _f === void 0 ? void 0 : _f.workspaceFolders) {
|
|
84
73
|
connection.workspace.onDidChangeWorkspaceFolders(e => {
|
|
85
74
|
for (const folder of e.added) {
|
|
86
75
|
documentServiceHost === null || documentServiceHost === void 0 ? void 0 : documentServiceHost.add(vscode_uri_1.URI.parse(folder.uri));
|
|
@@ -94,6 +83,41 @@ function createCommonLanguageServer(connection, runtimeEnv, _plugins) {
|
|
|
94
83
|
}
|
|
95
84
|
}));
|
|
96
85
|
connection.listen();
|
|
86
|
+
function createDocumenntServiceHost() {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const ts = runtimeEnv.loadTypescript(options.typescript.tsdk);
|
|
89
|
+
documentServiceHost = (0, documentServiceHost_1.createDocumentServiceHost)(runtimeEnv, plugins, ts, configHost);
|
|
90
|
+
for (const root of roots) {
|
|
91
|
+
documentServiceHost.add(root);
|
|
92
|
+
}
|
|
93
|
+
(yield Promise.resolve().then(() => require('./features/documentFeatures'))).register(connection, documents, documentServiceHost);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function createLanguageServiceHost() {
|
|
97
|
+
var _a, _b;
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
const ts = runtimeEnv.loadTypescript(options.typescript.tsdk);
|
|
100
|
+
fsHost = runtimeEnv.createFileSystemHost(ts, params.capabilities);
|
|
101
|
+
const tsLocalized = params.locale ? runtimeEnv.loadTypescriptLocalized(options.typescript.tsdk, params.locale) : undefined;
|
|
102
|
+
const _projects = (0, workspaces_1.createWorkspaces)(runtimeEnv, plugins, fsHost, configHost, ts, tsLocalized, params.capabilities, options, documents, connection);
|
|
103
|
+
projects = _projects;
|
|
104
|
+
for (const root of roots) {
|
|
105
|
+
projects.add(root);
|
|
106
|
+
}
|
|
107
|
+
(yield Promise.resolve().then(() => require('./features/customFeatures'))).register(connection, projects);
|
|
108
|
+
(yield Promise.resolve().then(() => require('./features/languageFeatures'))).register(connection, projects, params);
|
|
109
|
+
for (const plugin of plugins) {
|
|
110
|
+
(_b = (_a = plugin.languageService) === null || _a === void 0 ? void 0 : _a.onInitialize) === null || _b === void 0 ? void 0 : _b.call(_a, connection, getLanguageService);
|
|
111
|
+
}
|
|
112
|
+
function getLanguageService(uri) {
|
|
113
|
+
var _a;
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const project = (_a = (yield projects.getProject(uri))) === null || _a === void 0 ? void 0 : _a.project;
|
|
116
|
+
return project === null || project === void 0 ? void 0 : project.getLanguageService();
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
97
121
|
}
|
|
98
122
|
exports.createCommonLanguageServer = createCommonLanguageServer;
|
|
99
123
|
//# sourceMappingURL=server.js.map
|
package/out/types.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ export type FileSystemHost = {
|
|
|
15
15
|
};
|
|
16
16
|
export type FileSystem = Pick<ts.System, 'newLine' | 'useCaseSensitiveFileNames' | 'fileExists' | 'readFile' | 'readDirectory' | 'getCurrentDirectory' | 'realpath' | 'resolvePath'> & Partial<ts.System>;
|
|
17
17
|
export interface RuntimeEnvironment {
|
|
18
|
-
loadTypescript: (
|
|
19
|
-
loadTypescriptLocalized: (
|
|
18
|
+
loadTypescript: (tsdk: string) => typeof import('typescript/lib/tsserverlibrary');
|
|
19
|
+
loadTypescriptLocalized: (tsdk: string, locale: string) => any;
|
|
20
20
|
schemaRequestHandlers: {
|
|
21
21
|
[schema: string]: (uri: string, encoding?: BufferEncoding) => Promise<string>;
|
|
22
22
|
};
|
|
@@ -24,7 +24,7 @@ export interface RuntimeEnvironment {
|
|
|
24
24
|
fileSystemProvide: FileSystemProvider | undefined;
|
|
25
25
|
createFileSystemHost: (ts: typeof import('typescript/lib/tsserverlibrary'), capabilities: vscode.ClientCapabilities) => FileSystemHost;
|
|
26
26
|
}
|
|
27
|
-
export type LanguageServerPlugin<A extends
|
|
27
|
+
export type LanguageServerPlugin<A extends InitializationOptions = InitializationOptions, B extends embedded.LanguageServiceHost = embedded.LanguageServiceHost, C = embeddedLS.LanguageService> = (initOptions: A) => {
|
|
28
28
|
extensions: string[];
|
|
29
29
|
languageService?: {
|
|
30
30
|
semanticTokenLegend?: vscode.SemanticTokensLegend;
|
|
@@ -38,75 +38,21 @@ export type LanguageServerPlugin<A extends ServerInitializationOptions = ServerI
|
|
|
38
38
|
getServicePlugins?(context: embeddedLS.DocumentServiceRuntimeContext): embeddedLS.LanguageServicePlugin[];
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
-
export
|
|
42
|
-
|
|
41
|
+
export declare enum ServerMode {
|
|
42
|
+
Semantic = 0,
|
|
43
|
+
Syntactic = 2
|
|
44
|
+
}
|
|
45
|
+
export declare enum DiagnosticModel {
|
|
46
|
+
None = 0,
|
|
47
|
+
Push = 1,
|
|
48
|
+
Pull = 2
|
|
49
|
+
}
|
|
50
|
+
export interface InitializationOptions {
|
|
43
51
|
typescript: {
|
|
44
|
-
|
|
45
|
-
* Path to tsserverlibrary.js / tsserver.js / typescript.js
|
|
46
|
-
* @example
|
|
47
|
-
* '/usr/local/lib/node_modules/typescript/lib/tsserverlibrary.js' // use global typescript install
|
|
48
|
-
* 'typescript/lib/tsserverlibrary.js' // if `typescript` exist in `@volar/vue-lannguage-server` itself node_modules directory
|
|
49
|
-
* '../../../typescript/lib/tsserverlibrary.js' // relative path to @volar/vue-language-server/out/index.js
|
|
50
|
-
*/
|
|
51
|
-
serverPath: string;
|
|
52
|
-
/**
|
|
53
|
-
* Path to lib/xxx/diagnosticMessages.generated.json
|
|
54
|
-
* @example
|
|
55
|
-
* '/usr/local/lib/node_modules/typescript/lib/ja/diagnosticMessages.generated.json' // use global typescript install
|
|
56
|
-
* 'typescript/lib/ja/diagnosticMessages.generated.json' // if `typescript` exist in `@volar/vue-lannguage-server` itself node_modules directory
|
|
57
|
-
* '../../../typescript/lib/ja/diagnosticMessages.generated.json' // relative path to @volar/vue-language-server/out/index.js
|
|
58
|
-
*/
|
|
59
|
-
localizedPath?: string;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* typescript, html, css... language service will be create in server if this option is not null
|
|
63
|
-
*/
|
|
64
|
-
languageFeatures?: {
|
|
65
|
-
references?: boolean;
|
|
66
|
-
implementation?: boolean;
|
|
67
|
-
definition?: boolean;
|
|
68
|
-
typeDefinition?: boolean;
|
|
69
|
-
callHierarchy?: boolean;
|
|
70
|
-
hover?: boolean;
|
|
71
|
-
rename?: boolean;
|
|
72
|
-
renameFileRefactoring?: boolean;
|
|
73
|
-
signatureHelp?: boolean;
|
|
74
|
-
completion?: boolean | {
|
|
75
|
-
/**
|
|
76
|
-
* {@link __requests.GetDocumentSelectionRequest}
|
|
77
|
-
* */
|
|
78
|
-
getDocumentSelectionRequest?: boolean;
|
|
79
|
-
ignoreTriggerCharacters?: string;
|
|
80
|
-
};
|
|
81
|
-
documentHighlight?: boolean;
|
|
82
|
-
documentLink?: boolean;
|
|
83
|
-
workspaceSymbol?: boolean;
|
|
84
|
-
codeLens?: boolean | {
|
|
85
|
-
/**
|
|
86
|
-
* {@link __requests.ShowReferencesNotification}
|
|
87
|
-
* */
|
|
88
|
-
showReferencesNotification?: boolean;
|
|
89
|
-
};
|
|
90
|
-
semanticTokens?: boolean;
|
|
91
|
-
codeAction?: boolean;
|
|
92
|
-
inlayHints?: boolean;
|
|
93
|
-
diagnostics?: boolean;
|
|
94
|
-
schemaRequestService?: boolean | {
|
|
95
|
-
/**
|
|
96
|
-
* {@link __requests.GetDocumentContentRequest}
|
|
97
|
-
* */
|
|
98
|
-
getDocumentContentRequest?: boolean;
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* html language service will be create in server if this option is not null
|
|
103
|
-
*/
|
|
104
|
-
documentFeatures?: {
|
|
105
|
-
selectionRange?: boolean;
|
|
106
|
-
foldingRange?: boolean;
|
|
107
|
-
linkedEditingRange?: boolean;
|
|
108
|
-
documentSymbol?: boolean;
|
|
109
|
-
documentColor?: boolean;
|
|
110
|
-
documentFormatting?: boolean;
|
|
52
|
+
tsdk: string;
|
|
111
53
|
};
|
|
54
|
+
serverMode?: ServerMode;
|
|
55
|
+
diagnosticModel?: DiagnosticModel;
|
|
56
|
+
textDocumentSync?: vscode.TextDocumentSyncKind | number;
|
|
57
|
+
ignoreTriggerCharacters?: string[];
|
|
112
58
|
}
|
package/out/types.js
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.DiagnosticModel = exports.ServerMode = void 0;
|
|
3
|
+
var ServerMode;
|
|
4
|
+
(function (ServerMode) {
|
|
5
|
+
ServerMode[ServerMode["Semantic"] = 0] = "Semantic";
|
|
6
|
+
// PartialSemantic = 1, // not support yet
|
|
7
|
+
ServerMode[ServerMode["Syntactic"] = 2] = "Syntactic";
|
|
8
|
+
})(ServerMode = exports.ServerMode || (exports.ServerMode = {}));
|
|
9
|
+
var DiagnosticModel;
|
|
10
|
+
(function (DiagnosticModel) {
|
|
11
|
+
DiagnosticModel[DiagnosticModel["None"] = 0] = "None";
|
|
12
|
+
DiagnosticModel[DiagnosticModel["Push"] = 1] = "Push";
|
|
13
|
+
DiagnosticModel[DiagnosticModel["Pull"] = 2] = "Pull";
|
|
14
|
+
})(DiagnosticModel = exports.DiagnosticModel || (exports.DiagnosticModel = {}));
|
|
2
15
|
//# sourceMappingURL=types.js.map
|
package/out/utils/project.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import * as embeddedLS from '@volar/language-service';
|
|
|
2
2
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
3
3
|
import * as vscode from 'vscode-languageserver';
|
|
4
4
|
import { URI } from 'vscode-uri';
|
|
5
|
-
import { FileSystemHost, LanguageServerPlugin, RuntimeEnvironment,
|
|
5
|
+
import { FileSystemHost, LanguageServerPlugin, RuntimeEnvironment, InitializationOptions } from '../types';
|
|
6
6
|
import { createSnapshots } from './snapshots';
|
|
7
7
|
import { ConfigurationHost } from '@volar/vue-language-service';
|
|
8
8
|
export interface Project extends ReturnType<typeof createProject> {
|
|
9
9
|
}
|
|
10
|
-
export declare function createProject(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, ts: typeof import('typescript/lib/tsserverlibrary'), options:
|
|
10
|
+
export declare function createProject(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, ts: typeof import('typescript/lib/tsserverlibrary'), options: InitializationOptions, rootUri: URI, tsConfig: string | ts.CompilerOptions, tsLocalized: ts.MapLike<string> | undefined, documents: ReturnType<typeof createSnapshots>, connection: vscode.Connection, configHost: ConfigurationHost | undefined, documentRegistry: ts.DocumentRegistry | undefined): Promise<{
|
|
11
11
|
getLanguageService: () => {
|
|
12
12
|
doValidation: (uri: string, response?: ((result: vscode.Diagnostic[]) => void) | undefined, cancellationToken?: vscode.CancellationToken | undefined) => Promise<vscode.Diagnostic[]>;
|
|
13
13
|
findReferences: (uri: string, position: vscode.Position) => Promise<vscode.Location[] | undefined>;
|
|
@@ -26,7 +26,7 @@ export declare function createProject(runtimeEnv: RuntimeEnvironment, plugins: R
|
|
|
26
26
|
}>;
|
|
27
27
|
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>;
|
|
28
28
|
doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>;
|
|
29
|
-
doCompletionResolve: (item: vscode.CompletionItem
|
|
29
|
+
doCompletionResolve: (item: vscode.CompletionItem) => Promise<vscode.CompletionItem>;
|
|
30
30
|
getSignatureHelp: (uri: string, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext | undefined) => Promise<vscode.SignatureHelp | undefined>;
|
|
31
31
|
doCodeLens: (uri: string) => Promise<vscode.CodeLens[]>;
|
|
32
32
|
doCodeLensResolve: (item: vscode.CodeLens) => Promise<vscode.CodeLens>;
|
|
@@ -69,7 +69,7 @@ export declare function createProject(runtimeEnv: RuntimeEnvironment, plugins: R
|
|
|
69
69
|
}>;
|
|
70
70
|
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>;
|
|
71
71
|
doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>;
|
|
72
|
-
doCompletionResolve: (item: vscode.CompletionItem
|
|
72
|
+
doCompletionResolve: (item: vscode.CompletionItem) => Promise<vscode.CompletionItem>;
|
|
73
73
|
getSignatureHelp: (uri: string, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext | undefined) => Promise<vscode.SignatureHelp | undefined>;
|
|
74
74
|
doCodeLens: (uri: string) => Promise<vscode.CodeLens[]>;
|
|
75
75
|
doCodeLensResolve: (item: vscode.CodeLens) => Promise<vscode.CodeLens>;
|
package/out/utils/project.js
CHANGED
|
@@ -15,7 +15,6 @@ const embedded = require("@volar/language-core");
|
|
|
15
15
|
const vscode = require("vscode-languageserver");
|
|
16
16
|
const vscode_uri_1 = require("vscode-uri");
|
|
17
17
|
const config_1 = require("./config");
|
|
18
|
-
const requests_1 = require("../requests");
|
|
19
18
|
const upath = require("upath");
|
|
20
19
|
const path_1 = require("path");
|
|
21
20
|
function createProject(runtimeEnv, plugins, fsHost, ts, options, rootUri, tsConfig, tsLocalized, documents, connection, configHost, documentRegistry) {
|
|
@@ -57,24 +56,14 @@ function createProject(runtimeEnv, plugins, fsHost, ts, options, rootUri, tsConf
|
|
|
57
56
|
configurationHost: configHost,
|
|
58
57
|
fileSystemProvider: runtimeEnv.fileSystemProvide,
|
|
59
58
|
documentContext: getHTMLDocumentContext(ts, languageServiceHost),
|
|
60
|
-
schemaRequestService: uri => {
|
|
61
|
-
var _a;
|
|
59
|
+
schemaRequestService: (uri) => __awaiter(this, void 0, void 0, function* () {
|
|
62
60
|
const protocol = uri.substring(0, uri.indexOf(':'));
|
|
63
61
|
const builtInHandler = runtimeEnv.schemaRequestHandlers[protocol];
|
|
64
62
|
if (builtInHandler) {
|
|
65
|
-
return builtInHandler(uri);
|
|
63
|
+
return yield builtInHandler(uri);
|
|
66
64
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return responseText;
|
|
70
|
-
}, error => {
|
|
71
|
-
return Promise.reject(error.message);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
return Promise.reject('clientHandledGetDocumentContentRequest is false');
|
|
76
|
-
}
|
|
77
|
-
},
|
|
65
|
+
return '';
|
|
66
|
+
}),
|
|
78
67
|
},
|
|
79
68
|
documentRegistry,
|
|
80
69
|
});
|
|
@@ -2,12 +2,12 @@ import * as shared from '@volar/shared';
|
|
|
2
2
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
3
3
|
import * as vscode from 'vscode-languageserver';
|
|
4
4
|
import { Project } from './project';
|
|
5
|
-
import { LanguageServerPlugin, RuntimeEnvironment, FileSystemHost,
|
|
5
|
+
import { LanguageServerPlugin, RuntimeEnvironment, FileSystemHost, InitializationOptions } from '../types';
|
|
6
6
|
import { createSnapshots } from './snapshots';
|
|
7
7
|
import { URI } from 'vscode-uri';
|
|
8
8
|
import { ConfigurationHost } from '@volar/vue-language-service';
|
|
9
9
|
export declare const rootTsConfigNames: string[];
|
|
10
|
-
export declare function createWorkspaceProjects(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, rootUri: URI, ts: typeof import('typescript/lib/tsserverlibrary'), tsLocalized: ts.MapLike<string> | undefined, options:
|
|
10
|
+
export declare function createWorkspaceProjects(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, rootUri: URI, ts: typeof import('typescript/lib/tsserverlibrary'), tsLocalized: ts.MapLike<string> | undefined, options: InitializationOptions, documents: ReturnType<typeof createSnapshots>, connection: vscode.Connection, configHost: ConfigurationHost | undefined): Promise<{
|
|
11
11
|
projects: {
|
|
12
12
|
clear: () => void;
|
|
13
13
|
values: () => IterableIterator<Project>;
|
|
@@ -41,7 +41,7 @@ export declare function createWorkspaceProjects(runtimeEnv: RuntimeEnvironment,
|
|
|
41
41
|
}>;
|
|
42
42
|
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>;
|
|
43
43
|
doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>;
|
|
44
|
-
doCompletionResolve: (item: vscode.CompletionItem
|
|
44
|
+
doCompletionResolve: (item: vscode.CompletionItem) => Promise<vscode.CompletionItem>;
|
|
45
45
|
getSignatureHelp: (uri: string, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext | undefined) => Promise<vscode.SignatureHelp | undefined>;
|
|
46
46
|
doCodeLens: (uri: string) => Promise<vscode.CodeLens[]>;
|
|
47
47
|
doCodeLensResolve: (item: vscode.CodeLens) => Promise<vscode.CodeLens>;
|
|
@@ -84,7 +84,7 @@ export declare function createWorkspaceProjects(runtimeEnv: RuntimeEnvironment,
|
|
|
84
84
|
}>;
|
|
85
85
|
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>;
|
|
86
86
|
doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>;
|
|
87
|
-
doCompletionResolve: (item: vscode.CompletionItem
|
|
87
|
+
doCompletionResolve: (item: vscode.CompletionItem) => Promise<vscode.CompletionItem>;
|
|
88
88
|
getSignatureHelp: (uri: string, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext | undefined) => Promise<vscode.SignatureHelp | undefined>;
|
|
89
89
|
doCodeLens: (uri: string) => Promise<vscode.CodeLens[]>;
|
|
90
90
|
doCodeLensResolve: (item: vscode.CodeLens) => Promise<vscode.CodeLens>;
|
|
@@ -3,11 +3,11 @@ import { ConfigurationHost } from '@volar/vue-language-service';
|
|
|
3
3
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
4
4
|
import * as vscode from 'vscode-languageserver';
|
|
5
5
|
import { URI } from 'vscode-uri';
|
|
6
|
-
import { FileSystemHost, LanguageServerPlugin, RuntimeEnvironment,
|
|
6
|
+
import { FileSystemHost, LanguageServerPlugin, RuntimeEnvironment, InitializationOptions } from '../types';
|
|
7
7
|
import { createSnapshots } from './snapshots';
|
|
8
8
|
export interface Workspaces extends ReturnType<typeof createWorkspaces> {
|
|
9
9
|
}
|
|
10
|
-
export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, configurationHost: ConfigurationHost | undefined, ts: typeof import('typescript/lib/tsserverlibrary'), tsLocalized: ts.MapLike<string> | undefined, options:
|
|
10
|
+
export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, configurationHost: ConfigurationHost | undefined, ts: typeof import('typescript/lib/tsserverlibrary'), tsLocalized: ts.MapLike<string> | undefined, client: vscode.ClientCapabilities, options: InitializationOptions, documents: ReturnType<typeof createSnapshots>, connection: vscode.Connection): {
|
|
11
11
|
workspaces: Map<string, Promise<{
|
|
12
12
|
projects: {
|
|
13
13
|
clear: () => void;
|
|
@@ -42,7 +42,7 @@ export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins
|
|
|
42
42
|
}>;
|
|
43
43
|
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>;
|
|
44
44
|
doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>;
|
|
45
|
-
doCompletionResolve: (item: vscode.CompletionItem
|
|
45
|
+
doCompletionResolve: (item: vscode.CompletionItem) => Promise<vscode.CompletionItem>;
|
|
46
46
|
getSignatureHelp: (uri: string, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext | undefined) => Promise<vscode.SignatureHelp | undefined>;
|
|
47
47
|
doCodeLens: (uri: string) => Promise<vscode.CodeLens[]>;
|
|
48
48
|
doCodeLensResolve: (item: vscode.CodeLens) => Promise<vscode.CodeLens>;
|
|
@@ -85,7 +85,7 @@ export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins
|
|
|
85
85
|
}>;
|
|
86
86
|
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>;
|
|
87
87
|
doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>;
|
|
88
|
-
doCompletionResolve: (item: vscode.CompletionItem
|
|
88
|
+
doCompletionResolve: (item: vscode.CompletionItem) => Promise<vscode.CompletionItem>;
|
|
89
89
|
getSignatureHelp: (uri: string, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext | undefined) => Promise<vscode.SignatureHelp | undefined>;
|
|
90
90
|
doCodeLens: (uri: string) => Promise<vscode.CodeLens[]>;
|
|
91
91
|
doCodeLensResolve: (item: vscode.CodeLens) => Promise<vscode.CodeLens>;
|
|
@@ -139,7 +139,7 @@ export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins
|
|
|
139
139
|
}>;
|
|
140
140
|
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>;
|
|
141
141
|
doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>;
|
|
142
|
-
doCompletionResolve: (item: vscode.CompletionItem
|
|
142
|
+
doCompletionResolve: (item: vscode.CompletionItem) => Promise<vscode.CompletionItem>;
|
|
143
143
|
getSignatureHelp: (uri: string, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext | undefined) => Promise<vscode.SignatureHelp | undefined>;
|
|
144
144
|
doCodeLens: (uri: string) => Promise<vscode.CodeLens[]>;
|
|
145
145
|
doCodeLensResolve: (item: vscode.CodeLens) => Promise<vscode.CodeLens>;
|
|
@@ -182,7 +182,7 @@ export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins
|
|
|
182
182
|
}>;
|
|
183
183
|
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>;
|
|
184
184
|
doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>;
|
|
185
|
-
doCompletionResolve: (item: vscode.CompletionItem
|
|
185
|
+
doCompletionResolve: (item: vscode.CompletionItem) => Promise<vscode.CompletionItem>;
|
|
186
186
|
getSignatureHelp: (uri: string, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext | undefined) => Promise<vscode.SignatureHelp | undefined>;
|
|
187
187
|
doCodeLens: (uri: string) => Promise<vscode.CodeLens[]>;
|
|
188
188
|
doCodeLensResolve: (item: vscode.CodeLens) => Promise<vscode.CodeLens>;
|
|
@@ -231,7 +231,7 @@ export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins
|
|
|
231
231
|
}>;
|
|
232
232
|
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>;
|
|
233
233
|
doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>;
|
|
234
|
-
doCompletionResolve: (item: vscode.CompletionItem
|
|
234
|
+
doCompletionResolve: (item: vscode.CompletionItem) => Promise<vscode.CompletionItem>;
|
|
235
235
|
getSignatureHelp: (uri: string, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext | undefined) => Promise<vscode.SignatureHelp | undefined>;
|
|
236
236
|
doCodeLens: (uri: string) => Promise<vscode.CodeLens[]>;
|
|
237
237
|
doCodeLensResolve: (item: vscode.CodeLens) => Promise<vscode.CodeLens>;
|
|
@@ -274,7 +274,7 @@ export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins
|
|
|
274
274
|
}>;
|
|
275
275
|
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>;
|
|
276
276
|
doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>;
|
|
277
|
-
doCompletionResolve: (item: vscode.CompletionItem
|
|
277
|
+
doCompletionResolve: (item: vscode.CompletionItem) => Promise<vscode.CompletionItem>;
|
|
278
278
|
getSignatureHelp: (uri: string, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext | undefined) => Promise<vscode.SignatureHelp | undefined>;
|
|
279
279
|
doCodeLens: (uri: string) => Promise<vscode.CodeLens[]>;
|
|
280
280
|
doCodeLensResolve: (item: vscode.CodeLens) => Promise<vscode.CodeLens>;
|
package/out/utils/workspaces.js
CHANGED
|
@@ -11,8 +11,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
11
11
|
exports.createWorkspaces = void 0;
|
|
12
12
|
const shared = require("@volar/shared");
|
|
13
13
|
const vscode_uri_1 = require("vscode-uri");
|
|
14
|
+
const types_1 = require("../types");
|
|
14
15
|
const workspaceProjects_1 = require("./workspaceProjects");
|
|
15
|
-
function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, tsLocalized, options, documents, connection) {
|
|
16
|
+
function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, tsLocalized, client, options, documents, connection) {
|
|
16
17
|
var _a;
|
|
17
18
|
let semanticTokensReq = 0;
|
|
18
19
|
let documentUpdatedReq = 0;
|
|
@@ -68,11 +69,11 @@ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, ts
|
|
|
68
69
|
const req = ++semanticTokensReq;
|
|
69
70
|
yield updateDiagnostics();
|
|
70
71
|
if (req === semanticTokensReq) {
|
|
71
|
-
if ((_a =
|
|
72
|
+
if ((_a = client.textDocument) === null || _a === void 0 ? void 0 : _a.semanticTokens) {
|
|
72
73
|
connection.languages.semanticTokens.refresh();
|
|
73
74
|
}
|
|
74
|
-
if ((_b =
|
|
75
|
-
connection.languages.
|
|
75
|
+
if ((_b = client.textDocument) === null || _b === void 0 ? void 0 : _b.inlayHint) {
|
|
76
|
+
connection.languages.inlayHint.refresh();
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
});
|
|
@@ -80,7 +81,7 @@ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, ts
|
|
|
80
81
|
function updateDiagnostics(docUri) {
|
|
81
82
|
var _a;
|
|
82
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
if (
|
|
84
|
+
if (((_a = options.diagnosticModel) !== null && _a !== void 0 ? _a : types_1.DiagnosticModel.Push) !== types_1.DiagnosticModel.Push)
|
|
84
85
|
return;
|
|
85
86
|
const req = ++documentUpdatedReq;
|
|
86
87
|
const delay = yield (configurationHost === null || configurationHost === void 0 ? void 0 : configurationHost.getConfiguration('volar.diagnostics.delay'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-server",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.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.0-beta.
|
|
21
|
-
"@volar/language-service": "1.0.0-beta.
|
|
22
|
-
"@volar/shared": "1.0.0-beta.
|
|
20
|
+
"@volar/language-core": "1.0.0-beta.2",
|
|
21
|
+
"@volar/language-service": "1.0.0-beta.2",
|
|
22
|
+
"@volar/shared": "1.0.0-beta.2",
|
|
23
23
|
"request-light": "^0.5.8",
|
|
24
24
|
"upath": "^2.0.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": "a523013ad349e28c9d0a7d9ad3f0c0834e0067e7"
|
|
32
32
|
}
|