@volar/language-server 1.0.18 → 1.0.20
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/browser/index.d.ts +3 -1
- package/out/browser/index.js +8 -4
- package/out/common/features/customFeatures.js +16 -16
- package/out/common/features/languageFeatures.js +45 -0
- package/out/common/project.d.ts +32 -12
- package/out/common/project.js +96 -77
- package/out/common/server.d.ts +2 -2
- package/out/common/server.js +25 -49
- package/out/common/utils/inferredCompilerOptions.d.ts +1 -1
- package/out/common/utils/inferredCompilerOptions.js +5 -5
- package/out/common/utils/registerFeatures.d.ts +1 -2
- package/out/common/utils/registerFeatures.js +68 -51
- package/out/common/utils/serverConfig.d.ts +4 -1
- package/out/common/utils/serverConfig.js +5 -7
- package/out/common/workspace.d.ts +231 -51
- package/out/common/workspace.js +31 -34
- package/out/common/workspaces.d.ts +285 -64
- package/out/common/workspaces.js +66 -62
- package/out/node/index.d.ts +3 -1
- package/out/node/index.js +8 -5
- package/out/types.d.ts +7 -13
- package/package.json +5 -5
- package/out/common/features/documentFeatures.d.ts +0 -4
- package/out/common/features/documentFeatures.js +0 -73
- package/out/common/syntaxServicesHost.d.ts +0 -29
- package/out/common/syntaxServicesHost.js +0 -51
package/out/common/server.js
CHANGED
|
@@ -8,32 +8,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.
|
|
11
|
+
exports.startCommonLanguageServer = void 0;
|
|
12
12
|
const vscode = require("vscode-languageserver");
|
|
13
13
|
const vscode_uri_1 = require("vscode-uri");
|
|
14
14
|
const types_1 = require("../types");
|
|
15
15
|
const cancellationPipe_1 = require("./cancellationPipe");
|
|
16
16
|
const configurationHost_1 = require("./configurationHost");
|
|
17
17
|
const documents_1 = require("./documents");
|
|
18
|
-
const syntaxServicesHost_1 = require("./syntaxServicesHost");
|
|
19
18
|
const registerFeatures_1 = require("./utils/registerFeatures");
|
|
20
19
|
const workspaces_1 = require("./workspaces");
|
|
21
|
-
function
|
|
22
|
-
const { connection, runtimeEnv, plugins: _plugins } = params;
|
|
20
|
+
function startCommonLanguageServer(context) {
|
|
23
21
|
let initParams;
|
|
24
22
|
let options;
|
|
25
23
|
let roots = [];
|
|
26
24
|
let fsHost;
|
|
27
25
|
let projects;
|
|
28
|
-
let documentServiceHost;
|
|
29
26
|
let configurationHost;
|
|
30
27
|
let plugins;
|
|
31
|
-
const documents = (0, documents_1.createDocuments)(connection);
|
|
32
|
-
connection.onInitialize((_params) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
var _a, _b, _c
|
|
28
|
+
const documents = (0, documents_1.createDocuments)(context.connection);
|
|
29
|
+
context.connection.onInitialize((_params) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
var _a, _b, _c;
|
|
34
31
|
initParams = _params;
|
|
35
32
|
options = initParams.initializationOptions;
|
|
36
|
-
plugins =
|
|
33
|
+
plugins = context.plugins.map(plugin => plugin(options));
|
|
37
34
|
if (((_a = initParams.capabilities.workspace) === null || _a === void 0 ? void 0 : _a.workspaceFolders) && initParams.workspaceFolders) {
|
|
38
35
|
roots = initParams.workspaceFolders.map(folder => vscode_uri_1.URI.parse(folder.uri));
|
|
39
36
|
}
|
|
@@ -48,14 +45,9 @@ function createCommonLanguageServer(params) {
|
|
|
48
45
|
textDocumentSync: (_b = options.textDocumentSync) !== null && _b !== void 0 ? _b : vscode.TextDocumentSyncKind.Incremental,
|
|
49
46
|
},
|
|
50
47
|
};
|
|
51
|
-
configurationHost = ((_c = initParams.capabilities.workspace) === null || _c === void 0 ? void 0 : _c.configuration) ? (0, configurationHost_1.createConfigurationHost)(initParams, connection) : undefined;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
yield _createDocumentServiceHost();
|
|
55
|
-
if (serverMode === types_1.ServerMode.Semantic) {
|
|
56
|
-
(0, registerFeatures_1.setupSemanticCapabilities)(initParams.capabilities, result.capabilities, options, plugins, getSemanticTokensLegend());
|
|
57
|
-
yield createLanguageServiceHost();
|
|
58
|
-
}
|
|
48
|
+
configurationHost = ((_c = initParams.capabilities.workspace) === null || _c === void 0 ? void 0 : _c.configuration) ? (0, configurationHost_1.createConfigurationHost)(initParams, context.connection) : undefined;
|
|
49
|
+
(0, registerFeatures_1.setupCapabilities)(initParams.capabilities, result.capabilities, options, plugins, getSemanticTokensLegend());
|
|
50
|
+
yield createLanguageServiceHost();
|
|
59
51
|
try {
|
|
60
52
|
// show version on LSP logs
|
|
61
53
|
const packageJson = require('../package.json');
|
|
@@ -64,21 +56,19 @@ function createCommonLanguageServer(params) {
|
|
|
64
56
|
version: packageJson.version,
|
|
65
57
|
};
|
|
66
58
|
}
|
|
67
|
-
catch (
|
|
59
|
+
catch (_d) { }
|
|
68
60
|
return result;
|
|
69
61
|
}));
|
|
70
|
-
connection.onInitialized(() => {
|
|
62
|
+
context.connection.onInitialized(() => {
|
|
71
63
|
var _a, _b, _c;
|
|
72
|
-
fsHost === null || fsHost === void 0 ? void 0 : fsHost.ready(connection);
|
|
64
|
+
fsHost === null || fsHost === void 0 ? void 0 : fsHost.ready(context.connection);
|
|
73
65
|
configurationHost === null || configurationHost === void 0 ? void 0 : configurationHost.ready();
|
|
74
66
|
if ((_a = initParams.capabilities.workspace) === null || _a === void 0 ? void 0 : _a.workspaceFolders) {
|
|
75
|
-
connection.workspace.onDidChangeWorkspaceFolders(e => {
|
|
67
|
+
context.connection.workspace.onDidChangeWorkspaceFolders(e => {
|
|
76
68
|
for (const folder of e.added) {
|
|
77
|
-
documentServiceHost === null || documentServiceHost === void 0 ? void 0 : documentServiceHost.add(vscode_uri_1.URI.parse(folder.uri));
|
|
78
69
|
projects === null || projects === void 0 ? void 0 : projects.add(vscode_uri_1.URI.parse(folder.uri));
|
|
79
70
|
}
|
|
80
71
|
for (const folder of e.removed) {
|
|
81
|
-
documentServiceHost === null || documentServiceHost === void 0 ? void 0 : documentServiceHost.remove(vscode_uri_1.URI.parse(folder.uri));
|
|
82
72
|
projects === null || projects === void 0 ? void 0 : projects.remove(vscode_uri_1.URI.parse(folder.uri));
|
|
83
73
|
}
|
|
84
74
|
});
|
|
@@ -86,7 +76,7 @@ function createCommonLanguageServer(params) {
|
|
|
86
76
|
if (options.serverMode !== types_1.ServerMode.Syntactic
|
|
87
77
|
&& !options.disableFileWatcher
|
|
88
78
|
&& ((_c = (_b = initParams.capabilities.workspace) === null || _b === void 0 ? void 0 : _b.didChangeWatchedFiles) === null || _c === void 0 ? void 0 : _c.dynamicRegistration)) {
|
|
89
|
-
connection.client.register(vscode.DidChangeWatchedFilesNotification.type, {
|
|
79
|
+
context.connection.client.register(vscode.DidChangeWatchedFilesNotification.type, {
|
|
90
80
|
watchers: [
|
|
91
81
|
{
|
|
92
82
|
globPattern: `**/*.{${[
|
|
@@ -99,37 +89,23 @@ function createCommonLanguageServer(params) {
|
|
|
99
89
|
'jsx',
|
|
100
90
|
'tsx',
|
|
101
91
|
'json',
|
|
102
|
-
...plugins.map(plugin => plugin.extraFileExtensions.map(ext => ext.extension)).flat(),
|
|
92
|
+
...plugins.map(plugin => { var _a, _b; return (_b = (_a = plugin.extraFileExtensions) === null || _a === void 0 ? void 0 : _a.map(ext => ext.extension)) !== null && _b !== void 0 ? _b : []; }).flat(),
|
|
103
93
|
].join(',')}}`
|
|
104
94
|
},
|
|
105
95
|
]
|
|
106
96
|
});
|
|
107
97
|
}
|
|
108
98
|
});
|
|
109
|
-
connection.listen();
|
|
110
|
-
function _createDocumentServiceHost() {
|
|
111
|
-
var _a, _b;
|
|
112
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
-
const ts = runtimeEnv.loadTypescript(options.typescript.tsdk);
|
|
114
|
-
documentServiceHost = (0, syntaxServicesHost_1.createSyntaxServicesHost)(runtimeEnv, plugins, ts, configurationHost, options);
|
|
115
|
-
for (const root of roots) {
|
|
116
|
-
documentServiceHost.add(root);
|
|
117
|
-
}
|
|
118
|
-
(yield Promise.resolve().then(() => require('./features/documentFeatures'))).register(connection, documents, documentServiceHost);
|
|
119
|
-
for (const plugin of plugins) {
|
|
120
|
-
(_b = (_a = plugin.syntacticService) === null || _a === void 0 ? void 0 : _a.onInitialize) === null || _b === void 0 ? void 0 : _b.call(_a, connection);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}
|
|
99
|
+
context.connection.listen();
|
|
124
100
|
function createLanguageServiceHost() {
|
|
125
|
-
var _a
|
|
101
|
+
var _a;
|
|
126
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
-
const ts = runtimeEnv.loadTypescript(options.typescript.tsdk);
|
|
128
|
-
fsHost = runtimeEnv.createFileSystemHost(ts, initParams.capabilities);
|
|
129
|
-
const tsLocalized = initParams.locale ? yield runtimeEnv.loadTypescriptLocalized(options.typescript.tsdk, initParams.locale) : undefined;
|
|
103
|
+
const ts = options.typescript ? context.runtimeEnv.loadTypescript(options.typescript.tsdk) : undefined;
|
|
104
|
+
fsHost = ts ? context.runtimeEnv.createFileSystemHost(ts, initParams.capabilities) : undefined;
|
|
105
|
+
const tsLocalized = options.typescript && initParams.locale ? yield context.runtimeEnv.loadTypescriptLocalized(options.typescript.tsdk, initParams.locale) : undefined;
|
|
130
106
|
const cancelTokenHost = (0, cancellationPipe_1.createCancellationTokenHost)(options.cancellationPipeName);
|
|
131
107
|
const _projects = (0, workspaces_1.createWorkspaces)({
|
|
132
|
-
server:
|
|
108
|
+
server: context,
|
|
133
109
|
fileSystemHost: fsHost,
|
|
134
110
|
configurationHost,
|
|
135
111
|
ts,
|
|
@@ -144,10 +120,10 @@ function createCommonLanguageServer(params) {
|
|
|
144
120
|
for (const root of roots) {
|
|
145
121
|
projects.add(root);
|
|
146
122
|
}
|
|
147
|
-
(yield Promise.resolve().then(() => require('./features/customFeatures'))).register(connection, projects);
|
|
148
|
-
(yield Promise.resolve().then(() => require('./features/languageFeatures'))).register(connection, projects, initParams, cancelTokenHost, getSemanticTokensLegend());
|
|
123
|
+
(yield Promise.resolve().then(() => require('./features/customFeatures'))).register(context.connection, projects);
|
|
124
|
+
(yield Promise.resolve().then(() => require('./features/languageFeatures'))).register(context.connection, projects, initParams, cancelTokenHost, getSemanticTokensLegend());
|
|
149
125
|
for (const plugin of plugins) {
|
|
150
|
-
(
|
|
126
|
+
(_a = plugin.onInitialize) === null || _a === void 0 ? void 0 : _a.call(plugin, context.connection, getLanguageService);
|
|
151
127
|
}
|
|
152
128
|
function getLanguageService(uri) {
|
|
153
129
|
var _a;
|
|
@@ -168,7 +144,7 @@ function createCommonLanguageServer(params) {
|
|
|
168
144
|
};
|
|
169
145
|
}
|
|
170
146
|
}
|
|
171
|
-
exports.
|
|
147
|
+
exports.startCommonLanguageServer = startCommonLanguageServer;
|
|
172
148
|
// https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#standard-token-types-and-modifiers
|
|
173
149
|
const standardSemanticTokensLegend = {
|
|
174
150
|
tokenTypes: [
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ConfigurationHost } from '@volar/language-service';
|
|
2
2
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
3
|
-
export declare function getInferredCompilerOptions(
|
|
3
|
+
export declare function getInferredCompilerOptions(configurationHost: ConfigurationHost | undefined): Promise<ts.CompilerOptions>;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.getInferredCompilerOptions = void 0;
|
|
12
|
-
function getInferredCompilerOptions(
|
|
12
|
+
function getInferredCompilerOptions(configurationHost) {
|
|
13
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
14
|
let [implicitProjectConfig_1, implicitProjectConfig_2] = yield Promise.all([
|
|
15
15
|
configurationHost === null || configurationHost === void 0 ? void 0 : configurationHost.getConfiguration('js/ts.implicitProjectConfig'),
|
|
@@ -21,7 +21,7 @@ function getInferredCompilerOptions(ts, configurationHost) {
|
|
|
21
21
|
const experimentalDecorators = readExperimentalDecorators();
|
|
22
22
|
const strictNullChecks = readImplicitStrictNullChecks();
|
|
23
23
|
const strictFunctionTypes = readImplicitStrictFunctionTypes();
|
|
24
|
-
const options = Object.assign(Object.assign({}, inferredProjectCompilerOptions('typescript')), { allowJs: true, allowSyntheticDefaultImports: true, allowNonTsExtensions: true, resolveJsonModule: true, jsx: ts.JsxEmit.Preserve });
|
|
24
|
+
const options = Object.assign(Object.assign({}, inferredProjectCompilerOptions('typescript')), { allowJs: true, allowSyntheticDefaultImports: true, allowNonTsExtensions: true, resolveJsonModule: true, jsx: 1 /* ts.JsxEmit.Preserve */ });
|
|
25
25
|
return options;
|
|
26
26
|
function readCheckJs() {
|
|
27
27
|
var _a, _b;
|
|
@@ -41,9 +41,9 @@ function getInferredCompilerOptions(ts, configurationHost) {
|
|
|
41
41
|
}
|
|
42
42
|
function inferredProjectCompilerOptions(projectType) {
|
|
43
43
|
const projectConfig = {
|
|
44
|
-
module: ts.ModuleKind.CommonJS
|
|
45
|
-
target: ts.ScriptTarget.ES2020
|
|
46
|
-
jsx: ts.JsxEmit.Preserve
|
|
44
|
+
module: 1 /* ts.ModuleKind.CommonJS */,
|
|
45
|
+
target: 7 /* ts.ScriptTarget.ES2020 */,
|
|
46
|
+
jsx: 1 /* ts.JsxEmit.Preserve */,
|
|
47
47
|
};
|
|
48
48
|
if (checkJs) {
|
|
49
49
|
projectConfig.checkJs = true;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { LanguageServerPlugin, LanguageServerInitializationOptions } from '../../types';
|
|
2
2
|
import * as vscode from 'vscode-languageserver';
|
|
3
3
|
import { ClientCapabilities } from 'vscode-languageserver';
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function setupSemanticCapabilities(params: ClientCapabilities, server: vscode.ServerCapabilities, initOptions: LanguageServerInitializationOptions, plugins: ReturnType<LanguageServerPlugin>[], semanticTokensLegend: vscode.SemanticTokensLegend): void;
|
|
4
|
+
export declare function setupCapabilities(params: ClientCapabilities, server: vscode.ServerCapabilities, initOptions: LanguageServerInitializationOptions, plugins: ReturnType<LanguageServerPlugin>[], semanticTokensLegend: vscode.SemanticTokensLegend): void;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.
|
|
2
|
+
exports.setupCapabilities = void 0;
|
|
3
3
|
const embedded = require("@volar/language-service");
|
|
4
4
|
const types_1 = require("../../types");
|
|
5
5
|
const vscode = require("vscode-languageserver");
|
|
6
|
-
function
|
|
7
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6
|
+
function setupCapabilities(params, server, initOptions, plugins, semanticTokensLegend) {
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
|
8
|
+
// Syntactic
|
|
8
9
|
if (!initOptions.respectClientCapabilities || ((_a = params.textDocument) === null || _a === void 0 ? void 0 : _a.selectionRange)) {
|
|
9
10
|
server.selectionRangeProvider = true;
|
|
10
11
|
}
|
|
@@ -33,60 +34,37 @@ function setupSyntacticCapabilities(params, server, initOptions) {
|
|
|
33
34
|
moreTriggerCharacter: ['}', '\n'],
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
function setupSemanticCapabilities(params, server, initOptions, plugins, semanticTokensLegend) {
|
|
39
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
40
|
-
if (!initOptions.respectClientCapabilities || ((_a = params.textDocument) === null || _a === void 0 ? void 0 : _a.references)) {
|
|
37
|
+
// Semantic
|
|
38
|
+
if (!initOptions.respectClientCapabilities || ((_j = params.textDocument) === null || _j === void 0 ? void 0 : _j.references)) {
|
|
41
39
|
server.referencesProvider = true;
|
|
42
40
|
}
|
|
43
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
41
|
+
if (!initOptions.respectClientCapabilities || ((_k = params.textDocument) === null || _k === void 0 ? void 0 : _k.implementation)) {
|
|
44
42
|
server.implementationProvider = true;
|
|
45
43
|
}
|
|
46
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
44
|
+
if (!initOptions.respectClientCapabilities || ((_l = params.textDocument) === null || _l === void 0 ? void 0 : _l.definition)) {
|
|
47
45
|
server.definitionProvider = true;
|
|
48
46
|
}
|
|
49
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
47
|
+
if (!initOptions.respectClientCapabilities || ((_m = params.textDocument) === null || _m === void 0 ? void 0 : _m.typeDefinition)) {
|
|
50
48
|
server.typeDefinitionProvider = true;
|
|
51
49
|
}
|
|
52
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
50
|
+
if (!initOptions.respectClientCapabilities || ((_o = params.textDocument) === null || _o === void 0 ? void 0 : _o.callHierarchy)) {
|
|
53
51
|
server.callHierarchyProvider = true;
|
|
54
52
|
}
|
|
55
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
53
|
+
if (!initOptions.respectClientCapabilities || ((_p = params.textDocument) === null || _p === void 0 ? void 0 : _p.hover)) {
|
|
56
54
|
server.hoverProvider = true;
|
|
57
55
|
}
|
|
58
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
56
|
+
if (!initOptions.respectClientCapabilities || ((_q = params.textDocument) === null || _q === void 0 ? void 0 : _q.rename)) {
|
|
59
57
|
server.renameProvider = {
|
|
60
58
|
prepareProvider: true,
|
|
61
59
|
};
|
|
62
60
|
}
|
|
63
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
64
|
-
server.workspace = {
|
|
65
|
-
fileOperations: {
|
|
66
|
-
willRename: {
|
|
67
|
-
filters: [
|
|
68
|
-
...plugins.map(plugin => plugin.extraFileExtensions.map(ext => ({ pattern: { glob: `**/*.${ext.extension}` } }))).flat(),
|
|
69
|
-
{ pattern: { glob: '**/*.js' } },
|
|
70
|
-
{ pattern: { glob: '**/*.cjs' } },
|
|
71
|
-
{ pattern: { glob: '**/*.mjs' } },
|
|
72
|
-
{ pattern: { glob: '**/*.ts' } },
|
|
73
|
-
{ pattern: { glob: '**/*.cts' } },
|
|
74
|
-
{ pattern: { glob: '**/*.mts' } },
|
|
75
|
-
{ pattern: { glob: '**/*.jsx' } },
|
|
76
|
-
{ pattern: { glob: '**/*.tsx' } },
|
|
77
|
-
{ pattern: { glob: '**/*.json' } },
|
|
78
|
-
]
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
if (!initOptions.respectClientCapabilities || ((_j = params.textDocument) === null || _j === void 0 ? void 0 : _j.signatureHelp)) {
|
|
61
|
+
if (!initOptions.respectClientCapabilities || ((_r = params.textDocument) === null || _r === void 0 ? void 0 : _r.signatureHelp)) {
|
|
84
62
|
server.signatureHelpProvider = {
|
|
85
63
|
triggerCharacters: ['(', ',', '<'],
|
|
86
64
|
retriggerCharacters: [')'],
|
|
87
65
|
};
|
|
88
66
|
}
|
|
89
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
67
|
+
if (!initOptions.respectClientCapabilities || ((_s = params.textDocument) === null || _s === void 0 ? void 0 : _s.completion)) {
|
|
90
68
|
server.completionProvider = {
|
|
91
69
|
// triggerCharacters: '!@#$%^&*()_+-=`~{}|[]\:";\'<>?,./ '.split(''), // all symbols on keyboard
|
|
92
70
|
// hardcode to fix https://github.com/sublimelsp/LSP-volar/issues/114
|
|
@@ -103,35 +81,32 @@ function setupSemanticCapabilities(params, server, initOptions, plugins, semanti
|
|
|
103
81
|
resolveProvider: true,
|
|
104
82
|
};
|
|
105
83
|
if (initOptions.ignoreTriggerCharacters) {
|
|
106
|
-
server.completionProvider.triggerCharacters = (
|
|
84
|
+
server.completionProvider.triggerCharacters = (_t = server.completionProvider.triggerCharacters) === null || _t === void 0 ? void 0 : _t.filter(c => !initOptions.ignoreTriggerCharacters.includes(c));
|
|
107
85
|
}
|
|
108
86
|
}
|
|
109
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
87
|
+
if (!initOptions.respectClientCapabilities || ((_u = params.textDocument) === null || _u === void 0 ? void 0 : _u.documentHighlight)) {
|
|
110
88
|
server.documentHighlightProvider = true;
|
|
111
89
|
}
|
|
112
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
90
|
+
if (!initOptions.respectClientCapabilities || ((_v = params.textDocument) === null || _v === void 0 ? void 0 : _v.documentLink)) {
|
|
113
91
|
server.documentLinkProvider = {
|
|
114
92
|
resolveProvider: false, // TODO
|
|
115
93
|
};
|
|
116
94
|
}
|
|
117
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
118
|
-
server.workspaceSymbolProvider = true;
|
|
119
|
-
}
|
|
120
|
-
if (!initOptions.respectClientCapabilities || ((_q = params.textDocument) === null || _q === void 0 ? void 0 : _q.codeLens)) {
|
|
95
|
+
if (!initOptions.respectClientCapabilities || ((_w = params.textDocument) === null || _w === void 0 ? void 0 : _w.codeLens)) {
|
|
121
96
|
server.codeLensProvider = {
|
|
122
97
|
resolveProvider: true,
|
|
123
98
|
};
|
|
124
|
-
server.executeCommandProvider = { commands: [...(
|
|
99
|
+
server.executeCommandProvider = { commands: [...(_y = (_x = server.executeCommandProvider) === null || _x === void 0 ? void 0 : _x.commands) !== null && _y !== void 0 ? _y : []] };
|
|
125
100
|
server.executeCommandProvider.commands.push(embedded.executePluginCommand);
|
|
126
101
|
}
|
|
127
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
102
|
+
if (!initOptions.respectClientCapabilities || ((_z = params.textDocument) === null || _z === void 0 ? void 0 : _z.semanticTokens)) {
|
|
128
103
|
server.semanticTokensProvider = {
|
|
129
104
|
range: true,
|
|
130
105
|
full: false,
|
|
131
106
|
legend: semanticTokensLegend,
|
|
132
107
|
};
|
|
133
108
|
}
|
|
134
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
109
|
+
if (!initOptions.respectClientCapabilities || ((_0 = params.textDocument) === null || _0 === void 0 ? void 0 : _0.codeAction)) {
|
|
135
110
|
server.codeActionProvider = {
|
|
136
111
|
codeActionKinds: [
|
|
137
112
|
vscode.CodeActionKind.Empty,
|
|
@@ -147,19 +122,61 @@ function setupSemanticCapabilities(params, server, initOptions, plugins, semanti
|
|
|
147
122
|
resolveProvider: true,
|
|
148
123
|
};
|
|
149
124
|
}
|
|
150
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
125
|
+
if (!initOptions.respectClientCapabilities || ((_1 = params.textDocument) === null || _1 === void 0 ? void 0 : _1.inlayHint)) {
|
|
151
126
|
server.inlayHintProvider = true;
|
|
152
127
|
}
|
|
153
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
128
|
+
if ((!initOptions.respectClientCapabilities || ((_2 = params.textDocument) === null || _2 === void 0 ? void 0 : _2.diagnostic)) && ((_3 = initOptions.diagnosticModel) !== null && _3 !== void 0 ? _3 : types_1.DiagnosticModel.Push) === types_1.DiagnosticModel.Pull) {
|
|
154
129
|
server.diagnosticProvider = {
|
|
155
130
|
documentSelector: [
|
|
156
|
-
|
|
157
|
-
|
|
131
|
+
{
|
|
132
|
+
pattern: `**/*.{${[
|
|
133
|
+
'js',
|
|
134
|
+
'cjs',
|
|
135
|
+
'mjs',
|
|
136
|
+
'ts',
|
|
137
|
+
'cts',
|
|
138
|
+
'mts',
|
|
139
|
+
'jsx',
|
|
140
|
+
'tsx',
|
|
141
|
+
// 'json',
|
|
142
|
+
...plugins.map(plugin => { var _a, _b; return (_b = (_a = plugin.extraFileExtensions) === null || _a === void 0 ? void 0 : _a.map(ext => ext.extension)) !== null && _b !== void 0 ? _b : []; }).flat(),
|
|
143
|
+
].join(',')}}`
|
|
144
|
+
}
|
|
158
145
|
],
|
|
159
146
|
interFileDependencies: true,
|
|
160
147
|
workspaceDiagnostics: false,
|
|
161
148
|
};
|
|
162
149
|
}
|
|
150
|
+
// cross file features
|
|
151
|
+
if (!initOptions.respectClientCapabilities || ((_4 = params.workspace) === null || _4 === void 0 ? void 0 : _4.fileOperations)) {
|
|
152
|
+
server.workspace = {
|
|
153
|
+
fileOperations: {
|
|
154
|
+
willRename: {
|
|
155
|
+
filters: [
|
|
156
|
+
{
|
|
157
|
+
pattern: {
|
|
158
|
+
glob: `**/*.{${[
|
|
159
|
+
'js',
|
|
160
|
+
'cjs',
|
|
161
|
+
'mjs',
|
|
162
|
+
'ts',
|
|
163
|
+
'cts',
|
|
164
|
+
'mts',
|
|
165
|
+
'jsx',
|
|
166
|
+
'tsx',
|
|
167
|
+
'json',
|
|
168
|
+
...plugins.map(plugin => { var _a, _b; return (_b = (_a = plugin.extraFileExtensions) === null || _a === void 0 ? void 0 : _a.map(ext => ext.extension)) !== null && _b !== void 0 ? _b : []; }).flat(),
|
|
169
|
+
].join(',')}}`
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
if (!initOptions.respectClientCapabilities || ((_5 = params.workspace) === null || _5 === void 0 ? void 0 : _5.symbol)) {
|
|
178
|
+
server.workspaceSymbolProvider = true;
|
|
179
|
+
}
|
|
163
180
|
}
|
|
164
|
-
exports.
|
|
181
|
+
exports.setupCapabilities = setupCapabilities;
|
|
165
182
|
//# sourceMappingURL=registerFeatures.js.map
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { LanguageServicePlugin } from '@volar/language-service';
|
|
2
|
-
export
|
|
2
|
+
export interface ServerConfig {
|
|
3
|
+
plugins?: LanguageServicePlugin[];
|
|
4
|
+
}
|
|
5
|
+
export declare function loadServerConfig(dir: string, configFile: string | undefined): ServerConfig | undefined;
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.
|
|
3
|
-
function
|
|
4
|
-
var _a;
|
|
2
|
+
exports.loadServerConfig = void 0;
|
|
3
|
+
function loadServerConfig(dir, configFile) {
|
|
5
4
|
let configPath;
|
|
6
5
|
try {
|
|
7
6
|
configPath = require.resolve(configFile !== null && configFile !== void 0 ? configFile : './volar.config.js', { paths: [dir] });
|
|
8
7
|
}
|
|
9
|
-
catch (
|
|
8
|
+
catch (_a) { }
|
|
10
9
|
try {
|
|
11
10
|
if (configPath) {
|
|
12
11
|
const config = require(configPath);
|
|
13
12
|
delete require.cache[configPath];
|
|
14
|
-
return
|
|
13
|
+
return config;
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
16
|
catch (err) {
|
|
18
17
|
console.log(err);
|
|
19
18
|
}
|
|
20
|
-
return [];
|
|
21
19
|
}
|
|
22
|
-
exports.
|
|
20
|
+
exports.loadServerConfig = loadServerConfig;
|
|
23
21
|
//# sourceMappingURL=serverConfig.js.map
|