@volar/language-server
Advanced tools
Comparing version 1.2.0-alpha.8 to 1.2.0-alpha.9
@@ -81,3 +81,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
(0, language_core_1.forEachEmbeddedFile)(rootVirtualFile, e => { | ||
if (e.snapshot.getLength() && e.kind === language_core_1.FileKind.TypeScriptHostFile) { | ||
if (e.snapshot.getLength() && e.kind === language_core_1.FileKind.TypeScriptHostFile && e.capabilities.diagnostic) { | ||
fileNames.push(e.fileName); | ||
@@ -84,0 +84,0 @@ } |
@@ -117,15 +117,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
})); | ||
connection.onExecuteCommand((params, token, workDoneProgress) => __awaiter(this, void 0, void 0, function* () { | ||
if (params.command === embedded.executePluginCommand) { | ||
connection.onExecuteCommand((params) => __awaiter(this, void 0, void 0, function* () { | ||
if (params.command === embedded.showReferencesCommand | ||
&& params.arguments) { | ||
const args = params.arguments; | ||
if (!args) { | ||
return; | ||
} | ||
return worker(args[0], token, service => { | ||
return service.doExecuteCommand(params.command, args, { | ||
token, | ||
workDoneProgress, | ||
applyEdit: (paramOrEdit) => connection.workspace.applyEdit(paramOrEdit), | ||
showReferences: (params) => connection.sendNotification(protocol_1.ShowReferencesNotification.type, params), | ||
}); | ||
yield connection.sendNotification(protocol_1.ShowReferencesNotification.type, { | ||
textDocument: { | ||
uri: args[0], | ||
}, | ||
position: args[1], | ||
references: args[2], | ||
}); | ||
@@ -132,0 +129,0 @@ } |
@@ -101,3 +101,2 @@ import * as embedded from '@volar/language-core'; | ||
}) => Promise<NonNullable<string | embeddedLS.TextEdit | null | undefined> | undefined>; | ||
doExecuteCommand: (command: string, args: embeddedLS.ExecutePluginCommandArgs, executeCommandContext: embeddedLS.ExecuteCommandContext) => Promise<void>; | ||
getInlayHints: (uri: string, range: embeddedLS.Range) => Promise<embeddedLS.InlayHint[] | undefined>; | ||
@@ -110,3 +109,3 @@ callHierarchy: { | ||
dispose: () => void | undefined; | ||
context: embeddedLS.LanguageServiceRuntimeContext<embedded.LanguageServiceHost>; | ||
context: embeddedLS.LanguageServicePluginContext; | ||
}; | ||
@@ -153,3 +152,2 @@ getLanguageServiceDontCreate: () => { | ||
}) => Promise<NonNullable<string | embeddedLS.TextEdit | null | undefined> | undefined>; | ||
doExecuteCommand: (command: string, args: embeddedLS.ExecutePluginCommandArgs, executeCommandContext: embeddedLS.ExecuteCommandContext) => Promise<void>; | ||
getInlayHints: (uri: string, range: embeddedLS.Range) => Promise<embeddedLS.InlayHint[] | undefined>; | ||
@@ -162,3 +160,3 @@ callHierarchy: { | ||
dispose: () => void | undefined; | ||
context: embeddedLS.LanguageServiceRuntimeContext<embedded.LanguageServiceHost>; | ||
context: embeddedLS.LanguageServicePluginContext; | ||
} | undefined; | ||
@@ -165,0 +163,0 @@ getParsedCommandLine: () => ts.ParsedCommandLine; |
@@ -65,3 +65,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function getLanguageService() { | ||
var _a, _b, _c, _d; | ||
var _a, _b, _c, _d, _e, _f; | ||
if (!languageService) { | ||
@@ -71,3 +71,3 @@ const config = { | ||
plugins: Object.assign({}, (_b = context.serverConfig) === null || _b === void 0 ? void 0 : _b.plugins), | ||
rules: Object.assign({}, (_c = context.serverConfig) === null || _c === void 0 ? void 0 : _c.rules), | ||
lint: Object.assign(Object.assign({}, (_c = context.serverConfig) === null || _c === void 0 ? void 0 : _c.lint), { rules: Object.assign({}, (_e = (_d = context.serverConfig) === null || _d === void 0 ? void 0 : _d.lint) === null || _e === void 0 ? void 0 : _e.rules) }), | ||
}; | ||
@@ -96,3 +96,3 @@ const env = { | ||
for (const plugin of context.workspace.workspaces.plugins) { | ||
(_d = plugin.resolveConfig) === null || _d === void 0 ? void 0 : _d.call(plugin, config, lsCtx); | ||
(_f = plugin.resolveConfig) === null || _f === void 0 ? void 0 : _f.call(plugin, config, lsCtx); | ||
} | ||
@@ -99,0 +99,0 @@ languageService = embeddedLS.createLanguageService(languageServiceHost, config, env, context.documentRegistry); |
@@ -7,3 +7,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
function setupCapabilities(params, server, initOptions, plugins, semanticTokensLegend) { | ||
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; | ||
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; | ||
// Syntactic | ||
@@ -89,6 +89,6 @@ if (!initOptions.respectClientCapabilities || ((_a = params.textDocument) === null || _a === void 0 ? void 0 : _a.selectionRange)) { | ||
}; | ||
server.executeCommandProvider = { commands: [...(_y = (_x = server.executeCommandProvider) === null || _x === void 0 ? void 0 : _x.commands) !== null && _y !== void 0 ? _y : []] }; | ||
server.executeCommandProvider.commands.push(embedded.executePluginCommand); | ||
(_x = server.executeCommandProvider) !== null && _x !== void 0 ? _x : (server.executeCommandProvider = { commands: [] }); | ||
server.executeCommandProvider.commands.push(embedded.showReferencesCommand); | ||
} | ||
if (!initOptions.respectClientCapabilities || ((_z = params.textDocument) === null || _z === void 0 ? void 0 : _z.semanticTokens)) { | ||
if (!initOptions.respectClientCapabilities || ((_y = params.textDocument) === null || _y === void 0 ? void 0 : _y.semanticTokens)) { | ||
server.semanticTokensProvider = { | ||
@@ -100,3 +100,3 @@ range: true, | ||
} | ||
if (!initOptions.respectClientCapabilities || ((_0 = params.textDocument) === null || _0 === void 0 ? void 0 : _0.codeAction)) { | ||
if (!initOptions.respectClientCapabilities || ((_z = params.textDocument) === null || _z === void 0 ? void 0 : _z.codeAction)) { | ||
server.codeActionProvider = { | ||
@@ -117,6 +117,6 @@ codeActionKinds: [ | ||
} | ||
if (!initOptions.respectClientCapabilities || ((_1 = params.textDocument) === null || _1 === void 0 ? void 0 : _1.inlayHint)) { | ||
if (!initOptions.respectClientCapabilities || ((_0 = params.textDocument) === null || _0 === void 0 ? void 0 : _0.inlayHint)) { | ||
server.inlayHintProvider = true; | ||
} | ||
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) { | ||
if ((!initOptions.respectClientCapabilities || ((_1 = params.textDocument) === null || _1 === void 0 ? void 0 : _1.diagnostic)) && ((_2 = initOptions.diagnosticModel) !== null && _2 !== void 0 ? _2 : types_1.DiagnosticModel.Push) === types_1.DiagnosticModel.Pull) { | ||
const selector = plugins.map(plugin => { var _a; return (_a = plugin.diagnosticDocumentSelector) !== null && _a !== void 0 ? _a : []; }).flat(); | ||
@@ -132,3 +132,3 @@ if (selector) { | ||
// cross file features | ||
if (!initOptions.respectClientCapabilities || ((_4 = params.workspace) === null || _4 === void 0 ? void 0 : _4.fileOperations)) { | ||
if (!initOptions.respectClientCapabilities || ((_3 = params.workspace) === null || _3 === void 0 ? void 0 : _3.fileOperations)) { | ||
const exts = plugins.map(plugin => plugin.extensions.fileRenameOperationFilter).flat(); | ||
@@ -151,3 +151,3 @@ if (exts.length) { | ||
} | ||
if (!initOptions.respectClientCapabilities || ((_5 = params.workspace) === null || _5 === void 0 ? void 0 : _5.symbol)) { | ||
if (!initOptions.respectClientCapabilities || ((_4 = params.workspace) === null || _4 === void 0 ? void 0 : _4.symbol)) { | ||
server.workspaceSymbolProvider = true; | ||
@@ -154,0 +154,0 @@ } |
@@ -133,14 +133,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const errors = yield languageService.doValidation(uri, cancel, result => { | ||
context.server.connection.sendDiagnostics({ uri: uri, diagnostics: result.map(addVersion), version }); | ||
context.server.connection.sendDiagnostics({ uri: uri, diagnostics: result, version }); | ||
}); | ||
context.server.connection.sendDiagnostics({ uri: uri, diagnostics: errors.map(addVersion), version }); | ||
function addVersion(error) { | ||
if (error.data === undefined) { | ||
error.data = { version }; | ||
} | ||
else if (typeof error.data === 'object') { | ||
error.data.version = version; | ||
} | ||
return error; | ||
} | ||
context.server.connection.sendDiagnostics({ uri: uri, diagnostics: errors, version }); | ||
}); | ||
@@ -147,0 +138,0 @@ } |
@@ -8,3 +8,3 @@ /// <reference types="node" /> | ||
import { URI } from 'vscode-uri'; | ||
import { Config, LanguageServiceRuntimeContext } from '@volar/language-service'; | ||
import { Config, LanguageServicePluginContext } from '@volar/language-service'; | ||
import { ProjectContext } from './common/project'; | ||
@@ -33,3 +33,3 @@ export type FileSystemHost = { | ||
project: ProjectContext; | ||
env: LanguageServiceRuntimeContext['env']; | ||
env: LanguageServicePluginContext['env']; | ||
host: embedded.LanguageServiceHost; | ||
@@ -36,0 +36,0 @@ sys: FileSystem; |
{ | ||
"name": "@volar/language-server", | ||
"version": "1.2.0-alpha.8", | ||
"version": "1.2.0-alpha.9", | ||
"main": "out/index.js", | ||
@@ -20,5 +20,5 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/language-core": "1.2.0-alpha.8", | ||
"@volar/language-service": "1.2.0-alpha.8", | ||
"@volar/shared": "1.2.0-alpha.8", | ||
"@volar/language-core": "1.2.0-alpha.9", | ||
"@volar/language-service": "1.2.0-alpha.9", | ||
"@volar/shared": "1.2.0-alpha.9", | ||
"@vscode/l10n": "^0.0.10", | ||
@@ -33,3 +33,3 @@ "request-light": "^0.6.0", | ||
}, | ||
"gitHead": "9437b4560f35d2a153a9e2ae0dd0f64285bbb3b3" | ||
"gitHead": "ac8ebe9dd13bb6881769afb8612d3a9489ba7799" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
475048
7710
+ Added@volar/language-core@1.2.0-alpha.9(transitive)
+ Added@volar/language-service@1.2.0-alpha.9(transitive)
+ Added@volar/shared@1.2.0-alpha.9(transitive)
+ Added@volar/source-map@1.2.0-alpha.9(transitive)
+ Added@volar/typescript-faster@1.2.0-alpha.9(transitive)
- Removed@volar/language-core@1.2.0-alpha.8(transitive)
- Removed@volar/language-service@1.2.0-alpha.8(transitive)
- Removed@volar/shared@1.2.0-alpha.8(transitive)
- Removed@volar/source-map@1.2.0-alpha.8(transitive)
- Removed@volar/typescript-faster@1.2.0-alpha.8(transitive)
Updated@volar/shared@1.2.0-alpha.9