@volar/language-server 1.4.0-alpha.9 → 1.4.1
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/common/features/languageFeatures.js +10 -5
- package/out/common/project.d.ts +7 -3
- package/out/common/project.js +2 -5
- package/out/common/server.js +4 -4
- package/out/common/utils/registerFeatures.js +4 -2
- package/out/common/workspace.d.ts +63 -27
- package/out/common/workspaces.d.ts +77 -33
- package/out/common/workspaces.js +10 -6
- package/out/types.d.ts +4 -5
- package/package.json +4 -4
|
@@ -11,6 +11,8 @@ function register(connection, projects, initParams, initOptions, cancelHost, sem
|
|
|
11
11
|
let lastCodeLensLs;
|
|
12
12
|
let lastCodeActionLs;
|
|
13
13
|
let lastCallHierarchyLs;
|
|
14
|
+
let lastDocumentLinkLs;
|
|
15
|
+
let lastInlayHintLs;
|
|
14
16
|
connection.onDocumentFormatting(async (params, token) => {
|
|
15
17
|
return worker(params.textDocument.uri, token, service => {
|
|
16
18
|
return service.format(params.textDocument.uri, params.options, undefined, undefined, token);
|
|
@@ -180,9 +182,13 @@ function register(connection, projects, initParams, initOptions, cancelHost, sem
|
|
|
180
182
|
});
|
|
181
183
|
connection.onDocumentLinks(async (params, token) => {
|
|
182
184
|
return await worker(params.textDocument.uri, token, service => {
|
|
185
|
+
lastDocumentLinkLs = service;
|
|
183
186
|
return service.findDocumentLinks(params.textDocument.uri, token);
|
|
184
187
|
});
|
|
185
188
|
});
|
|
189
|
+
connection.onDocumentLinkResolve(async (link, token) => {
|
|
190
|
+
return await lastDocumentLinkLs.doDocumentLinkResolve(link, token);
|
|
191
|
+
});
|
|
186
192
|
connection.onWorkspaceSymbol(async (params, token) => {
|
|
187
193
|
let results = [];
|
|
188
194
|
for (const _workspace of projects.workspaces.values()) {
|
|
@@ -247,15 +253,14 @@ function register(connection, projects, initParams, initOptions, cancelHost, sem
|
|
|
247
253
|
});
|
|
248
254
|
connection.languages.inlayHint.on(async (params, token) => {
|
|
249
255
|
return worker(params.textDocument.uri, token, async (service) => {
|
|
256
|
+
lastInlayHintLs = service;
|
|
250
257
|
return service.getInlayHints(params.textDocument.uri, params.range, token);
|
|
251
258
|
});
|
|
252
259
|
});
|
|
253
|
-
|
|
260
|
+
connection.languages.inlayHint.resolve(async (hint, token) => {
|
|
261
|
+
return await lastInlayHintLs.doInlayHintResolve(hint, token);
|
|
262
|
+
});
|
|
254
263
|
connection.workspace.onWillRenameFiles(async (params, token) => {
|
|
255
|
-
const config = await connection.workspace.getConfiguration('volar.updateImportsOnFileMove.enabled');
|
|
256
|
-
if (!config) {
|
|
257
|
-
return null;
|
|
258
|
-
}
|
|
259
264
|
const _edits = await Promise.all(params.files.map(async (file) => {
|
|
260
265
|
return await worker(file.oldUri, token, service => {
|
|
261
266
|
return service.getEditsForFileRename(file.oldUri, file.newUri, token) ?? null;
|
package/out/common/project.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface ProjectContext {
|
|
|
12
12
|
}
|
|
13
13
|
export type Project = ReturnType<typeof createProject>;
|
|
14
14
|
export declare function createProject(context: ProjectContext): Promise<{
|
|
15
|
-
tsConfig:
|
|
15
|
+
tsConfig: ts.CompilerOptions | path.PosixPath;
|
|
16
16
|
scripts: {
|
|
17
17
|
clear: () => void;
|
|
18
18
|
values: () => IterableIterator<{
|
|
@@ -71,7 +71,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
71
71
|
findDocumentSymbols: (uri: string, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.DocumentSymbol[] | undefined>;
|
|
72
72
|
findDocumentColors: (uri: string, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.ColorInformation[] | undefined>;
|
|
73
73
|
getColorPresentations: (uri: string, color: embeddedLS.Color, range: embeddedLS.Range, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.ColorPresentation[] | undefined>;
|
|
74
|
-
doValidation: (uri: string, mode: "
|
|
74
|
+
doValidation: (uri: string, mode: "semantic" | "all" | "syntactic", token?: embeddedLS.CancellationToken | undefined, response?: ((result: embeddedLS.Diagnostic[]) => void) | undefined) => Promise<embeddedLS.Diagnostic[]>;
|
|
75
75
|
findReferences: (uri: string, position: embeddedLS.Position, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.Location[] | undefined>;
|
|
76
76
|
findFileReferences: (uri: string, token?: embeddedLS.CancellationToken | undefined) => embeddedLS.NullableResult<embeddedLS.Location[]>;
|
|
77
77
|
findDefinition: (uri: string, position: embeddedLS.Position, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.LocationLink[] | undefined>;
|
|
@@ -91,9 +91,11 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
91
91
|
doCodeLensResolve: (item: embeddedLS.CodeLens, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.CodeLens>;
|
|
92
92
|
findDocumentHighlights: (uri: string, position: embeddedLS.Position, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.DocumentHighlight[] | undefined>;
|
|
93
93
|
findDocumentLinks: (uri: string, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.DocumentLink[]>;
|
|
94
|
+
doDocumentLinkResolve: (item: embeddedLS.CodeLens, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.CodeLens>;
|
|
94
95
|
findWorkspaceSymbols: (query: string, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.WorkspaceSymbol[]>;
|
|
95
96
|
doAutoInsert: (uri: string, position: embeddedLS.Position, autoInsertContext: embeddedLS.AutoInsertionContext, token?: embeddedLS.CancellationToken | undefined) => Promise<NonNullable<string | embeddedLS.TextEdit | null | undefined> | undefined>;
|
|
96
97
|
getInlayHints: (uri: string, range: embeddedLS.Range, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.InlayHint[] | undefined>;
|
|
98
|
+
doInlayHintResolve: (item: embeddedLS.InlayHint, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.InlayHint>;
|
|
97
99
|
callHierarchy: {
|
|
98
100
|
doPrepare(uri: string, position: embeddedLS.Position, token?: embeddedLS.CancellationToken | undefined): Promise<embeddedLS.CallHierarchyItem[] | undefined>;
|
|
99
101
|
getIncomingCalls(item: embeddedLS.CallHierarchyItem, token: embeddedLS.CancellationToken): Promise<embeddedLS.CallHierarchyIncomingCall[]>;
|
|
@@ -117,7 +119,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
117
119
|
findDocumentSymbols: (uri: string, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.DocumentSymbol[] | undefined>;
|
|
118
120
|
findDocumentColors: (uri: string, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.ColorInformation[] | undefined>;
|
|
119
121
|
getColorPresentations: (uri: string, color: embeddedLS.Color, range: embeddedLS.Range, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.ColorPresentation[] | undefined>;
|
|
120
|
-
doValidation: (uri: string, mode: "
|
|
122
|
+
doValidation: (uri: string, mode: "semantic" | "all" | "syntactic", token?: embeddedLS.CancellationToken | undefined, response?: ((result: embeddedLS.Diagnostic[]) => void) | undefined) => Promise<embeddedLS.Diagnostic[]>;
|
|
121
123
|
findReferences: (uri: string, position: embeddedLS.Position, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.Location[] | undefined>;
|
|
122
124
|
findFileReferences: (uri: string, token?: embeddedLS.CancellationToken | undefined) => embeddedLS.NullableResult<embeddedLS.Location[]>;
|
|
123
125
|
findDefinition: (uri: string, position: embeddedLS.Position, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.LocationLink[] | undefined>;
|
|
@@ -137,9 +139,11 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
137
139
|
doCodeLensResolve: (item: embeddedLS.CodeLens, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.CodeLens>;
|
|
138
140
|
findDocumentHighlights: (uri: string, position: embeddedLS.Position, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.DocumentHighlight[] | undefined>;
|
|
139
141
|
findDocumentLinks: (uri: string, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.DocumentLink[]>;
|
|
142
|
+
doDocumentLinkResolve: (item: embeddedLS.CodeLens, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.CodeLens>;
|
|
140
143
|
findWorkspaceSymbols: (query: string, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.WorkspaceSymbol[]>;
|
|
141
144
|
doAutoInsert: (uri: string, position: embeddedLS.Position, autoInsertContext: embeddedLS.AutoInsertionContext, token?: embeddedLS.CancellationToken | undefined) => Promise<NonNullable<string | embeddedLS.TextEdit | null | undefined> | undefined>;
|
|
142
145
|
getInlayHints: (uri: string, range: embeddedLS.Range, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.InlayHint[] | undefined>;
|
|
146
|
+
doInlayHintResolve: (item: embeddedLS.InlayHint, token?: embeddedLS.CancellationToken | undefined) => Promise<embeddedLS.InlayHint>;
|
|
143
147
|
callHierarchy: {
|
|
144
148
|
doPrepare(uri: string, position: embeddedLS.Position, token?: embeddedLS.CancellationToken | undefined): Promise<embeddedLS.CallHierarchyItem[] | undefined>;
|
|
145
149
|
getIncomingCalls(item: embeddedLS.CallHierarchyItem, token: embeddedLS.CancellationToken): Promise<embeddedLS.CallHierarchyIncomingCall[]>;
|
package/out/common/project.js
CHANGED
|
@@ -88,7 +88,7 @@ async function createProject(context) {
|
|
|
88
88
|
};
|
|
89
89
|
for (const plugin of context.workspace.workspaces.plugins) {
|
|
90
90
|
if (plugin.resolveConfig) {
|
|
91
|
-
config = plugin.resolveConfig(config,
|
|
91
|
+
config = plugin.resolveConfig(config, lsCtx);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
languageService = embeddedLS.createLanguageService(options, context.documentRegistry);
|
|
@@ -295,10 +295,7 @@ function getDocumentContext(fileNameToUri, uriToFileName, ts, host, rootUri) {
|
|
|
295
295
|
return ref;
|
|
296
296
|
}
|
|
297
297
|
if (ref[0] === '/') { // resolve absolute path against the current workspace folder
|
|
298
|
-
|
|
299
|
-
if (folderUri) {
|
|
300
|
-
return folderUri + ref.substr(1);
|
|
301
|
-
}
|
|
298
|
+
return rootUri + ref;
|
|
302
299
|
}
|
|
303
300
|
const baseUri = vscode_uri_1.URI.parse(base);
|
|
304
301
|
const baseUriDir = baseUri.path.endsWith('/') ? baseUri : vscode_uri_1.Utils.dirname(baseUri);
|
package/out/common/server.js
CHANGED
|
@@ -26,7 +26,9 @@ function startCommonLanguageServer(connection, getCtx) {
|
|
|
26
26
|
initParams = _params;
|
|
27
27
|
options = initParams.initializationOptions;
|
|
28
28
|
context = getCtx(options);
|
|
29
|
-
plugins = context.plugins.map(plugin => plugin(options
|
|
29
|
+
plugins = context.plugins.map(plugin => plugin(options, {
|
|
30
|
+
typescript: options.typescript ? context.runtimeEnv.loadTypescript(options.typescript.tsdk) : undefined
|
|
31
|
+
}));
|
|
30
32
|
documents = (0, documents_1.createDocuments)(context.runtimeEnv, connection);
|
|
31
33
|
if (options.l10n) {
|
|
32
34
|
await l10n.config({ uri: options.l10n.location });
|
|
@@ -54,13 +56,12 @@ function startCommonLanguageServer(connection, getCtx) {
|
|
|
54
56
|
};
|
|
55
57
|
configurationHost = initParams.capabilities.workspace?.configuration ? (0, configurationHost_1.createConfigurationHost)(initParams, connection) : undefined;
|
|
56
58
|
let lsPlugins = {};
|
|
57
|
-
const ts = options.typescript ? context.runtimeEnv.loadTypescript(options.typescript.tsdk) : undefined;
|
|
58
59
|
for (const root of roots) {
|
|
59
60
|
if (root.scheme === 'file') {
|
|
60
61
|
let config = (0, serverConfig_1.loadConfig)(root.path, options.configFilePath) ?? {};
|
|
61
62
|
for (const plugin of plugins) {
|
|
62
63
|
if (plugin.resolveConfig) {
|
|
63
|
-
config = plugin.resolveConfig(config,
|
|
64
|
+
config = plugin.resolveConfig(config, undefined);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
if (config.plugins) {
|
|
@@ -98,7 +99,6 @@ function startCommonLanguageServer(connection, getCtx) {
|
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
101
|
if (options.serverMode !== types_1.ServerMode.Syntactic
|
|
101
|
-
&& !options.disableFileWatcher
|
|
102
102
|
&& initParams.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration) {
|
|
103
103
|
const exts = plugins.map(plugin => plugin.watchFileExtensions).flat();
|
|
104
104
|
if (exts.length) {
|
|
@@ -48,7 +48,7 @@ function setupCapabilities(server, initOptions, plugins, semanticTokensLegend, l
|
|
|
48
48
|
}
|
|
49
49
|
server.documentHighlightProvider = true;
|
|
50
50
|
server.documentLinkProvider = {
|
|
51
|
-
resolveProvider:
|
|
51
|
+
resolveProvider: true,
|
|
52
52
|
};
|
|
53
53
|
server.codeLensProvider = {
|
|
54
54
|
resolveProvider: true,
|
|
@@ -72,7 +72,9 @@ function setupCapabilities(server, initOptions, plugins, semanticTokensLegend, l
|
|
|
72
72
|
],
|
|
73
73
|
resolveProvider: true,
|
|
74
74
|
};
|
|
75
|
-
server.inlayHintProvider =
|
|
75
|
+
server.inlayHintProvider = {
|
|
76
|
+
resolveProvider: true,
|
|
77
|
+
};
|
|
76
78
|
const exts = plugins.map(plugin => plugin.watchFileExtensions).flat();
|
|
77
79
|
if (exts.length) {
|
|
78
80
|
server.workspace = {
|