@volar/language-server 1.0.19 → 1.0.21
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 +25 -5
- package/out/common/project.js +61 -39
- package/out/common/server.d.ts +1 -1
- package/out/common/server.js +13 -36
- 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/workspace.d.ts +218 -38
- package/out/common/workspace.js +18 -14
- package/out/common/workspaces.d.ts +269 -49
- package/out/common/workspaces.js +12 -9
- 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 -53
|
@@ -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
|