New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@volar/language-server

Package Overview
Dependencies
Maintainers
1
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@volar/language-server - npm Package Compare versions

Comparing version 1.0.19 to 1.0.20

4

out/browser/index.d.ts

@@ -0,3 +1,5 @@

import * as vscode from 'vscode-languageserver/browser';
import { LanguageServerPlugin } from '../types';
export * from '../index';
export declare function createLanguageServer(plugins: LanguageServerPlugin[]): void;
export declare function createConnection(): vscode.Connection;
export declare function startLanguageServer(connection: vscode.Connection, ...plugins: LanguageServerPlugin[]): void;

@@ -25,3 +25,3 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.createLanguageServer = void 0;
exports.startLanguageServer = exports.createConnection = void 0;
const request_light_1 = require("request-light");

@@ -35,7 +35,11 @@ const ts = require("typescript/lib/tsserverlibrary"); // bundle typescript lib in web

__exportStar(require("../index"), exports);
function createLanguageServer(plugins) {
function createConnection() {
const messageReader = new vscode.BrowserMessageReader(self);
const messageWriter = new vscode.BrowserMessageWriter(self);
const connection = vscode.createConnection(messageReader, messageWriter);
(0, server_1.createCommonLanguageServer)({
return connection;
}
exports.createConnection = createConnection;
function startLanguageServer(connection, ...plugins) {
(0, server_1.startCommonLanguageServer)({
plugins,

@@ -69,3 +73,3 @@ connection,

}
exports.createLanguageServer = createLanguageServer;
exports.startLanguageServer = startLanguageServer;
//# sourceMappingURL=index.js.map

@@ -17,7 +17,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

connection.onNotification(protocol_1.ReportStats.type, () => __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
for (const [rootUri, _workspace] of projects.workspaces) {
connection.console.log('workspace: ' + rootUri);
const workspace = yield _workspace;
connection.console.log('documentRegistry stats: ' + workspace.documentRegistry.reportStats());
connection.console.log('documentRegistry stats: ' + ((_a = workspace.documentRegistry) === null || _a === void 0 ? void 0 : _a.reportStats()));
connection.console.log('');

@@ -34,3 +34,3 @@ connection.console.log('tsconfig: inferred');

connection.console.log(' - ' + script.fileName);
connection.console.log(` size: ${(_a = script.snapshot) === null || _a === void 0 ? void 0 : _a.getLength()}`);
connection.console.log(` size: ${(_b = script.snapshot) === null || _b === void 0 ? void 0 : _b.getLength()}`);
}

@@ -40,4 +40,4 @@ connection.console.log('files:');

connection.console.log(' - ' + script.fileName);
connection.console.log(` size: ${(_b = script.snapshot) === null || _b === void 0 ? void 0 : _b.getLength()}`);
connection.console.log(` ref counts: "${(_d = (_c = workspace.documentRegistry).getLanguageServiceRefCounts) === null || _d === void 0 ? void 0 : _d.call(_c, script.fileName, (_f = (_e = inferredProject.languageServiceHost).getScriptKind) === null || _f === void 0 ? void 0 : _f.call(_e, script.fileName))})"`);
connection.console.log(` size: ${(_c = script.snapshot) === null || _c === void 0 ? void 0 : _c.getLength()}`);
connection.console.log(` ref counts: "${(_e = (_d = workspace.documentRegistry).getLanguageServiceRefCounts) === null || _e === void 0 ? void 0 : _e.call(_d, script.fileName, (_g = (_f = inferredProject.languageServiceHost).getScriptKind) === null || _g === void 0 ? void 0 : _g.call(_f, script.fileName))})"`);
}

@@ -58,3 +58,3 @@ }

connection.console.log(' - ' + script.fileName);
connection.console.log(` size: ${(_g = script.snapshot) === null || _g === void 0 ? void 0 : _g.getLength()}`);
connection.console.log(` size: ${(_h = script.snapshot) === null || _h === void 0 ? void 0 : _h.getLength()}`);
}

@@ -64,4 +64,4 @@ connection.console.log('files:');

connection.console.log(' - ' + script.fileName);
connection.console.log(` size: ${(_h = script.snapshot) === null || _h === void 0 ? void 0 : _h.getLength()}`);
connection.console.log(` ref counts: "${(_k = (_j = workspace.documentRegistry).getLanguageServiceRefCounts) === null || _k === void 0 ? void 0 : _k.call(_j, script.fileName, (_m = (_l = project.languageServiceHost).getScriptKind) === null || _m === void 0 ? void 0 : _m.call(_l, script.fileName))})"`);
connection.console.log(` size: ${(_j = script.snapshot) === null || _j === void 0 ? void 0 : _j.getLength()}`);
connection.console.log(` ref counts: "${(_l = (_k = workspace.documentRegistry).getLanguageServiceRefCounts) === null || _l === void 0 ? void 0 : _l.call(_k, script.fileName, (_o = (_m = project.languageServiceHost).getScriptKind) === null || _o === void 0 ? void 0 : _o.call(_m, script.fileName))})"`);
}

@@ -79,7 +79,7 @@ }

connection.onRequest(protocol_1.GetVirtualFileNamesRequest.type, (document) => __awaiter(this, void 0, void 0, function* () {
var _o, _p;
var _p, _q;
const project = yield projects.getProject(document.uri);
const fileNames = [];
if (project) {
const sourceFile = (_p = (_o = project.project) === null || _o === void 0 ? void 0 : _o.getLanguageService().context.core.virtualFiles.get(shared.getPathOfUri(document.uri))) === null || _p === void 0 ? void 0 : _p[1];
const sourceFile = (_q = (_p = project.project) === null || _p === void 0 ? void 0 : _p.getLanguageService().context.core.virtualFiles.get(shared.getPathOfUri(document.uri))) === null || _q === void 0 ? void 0 : _q[1];
if (sourceFile) {

@@ -96,6 +96,6 @@ (0, language_core_1.forEachEmbeddedFile)(sourceFile, e => {

connection.onRequest(protocol_1.GetVirtualFileRequest.type, (params) => __awaiter(this, void 0, void 0, function* () {
var _q, _r, _s;
var _r, _s, _t;
const project = yield projects.getProject(params.sourceFileUri);
if (project) {
const sourceAndVirtual = (_q = project.project) === null || _q === void 0 ? void 0 : _q.getLanguageService().context.core.virtualFiles.getSourceByVirtualFileName(params.virtualFileName);
const sourceAndVirtual = (_r = project.project) === null || _r === void 0 ? void 0 : _r.getLanguageService().context.core.virtualFiles.getSourceByVirtualFileName(params.virtualFileName);
if (sourceAndVirtual) {

@@ -105,4 +105,4 @@ const virtualFile = sourceAndVirtual[2];

for (const mapping of virtualFile.mappings) {
const sourceUri = shared.getUriByPath((_r = mapping.source) !== null && _r !== void 0 ? _r : sourceAndVirtual[0]);
(_s = mappings[sourceUri]) !== null && _s !== void 0 ? _s : (mappings[sourceUri] = []);
const sourceUri = shared.getUriByPath((_s = mapping.source) !== null && _s !== void 0 ? _s : sourceAndVirtual[0]);
(_t = mappings[sourceUri]) !== null && _t !== void 0 ? _t : (mappings[sourceUri] = []);
mappings[sourceUri].push(mapping);

@@ -121,7 +121,7 @@ }

connection.onNotification(protocol_1.WriteVirtualFilesNotification.type, (params) => __awaiter(this, void 0, void 0, function* () {
var _t;
var _u;
const fs = yield Promise.resolve().then(() => require('fs'));
const project = yield projects.getProject(params.uri);
if (project) {
const ls = (_t = (yield project.project)) === null || _t === void 0 ? void 0 : _t.getLanguageServiceDontCreate();
const ls = (_u = (yield project.project)) === null || _u === void 0 ? void 0 : _u.getLanguageServiceDontCreate();
if (ls) {

@@ -128,0 +128,0 @@ const sourceFiles = new Set(ls.context.host.getScriptFileNames());

@@ -22,2 +22,47 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

let lastCallHierarchyLs;
connection.onDocumentFormatting((params) => __awaiter(this, void 0, void 0, function* () {
return worker(params.textDocument.uri, vueLs => {
return vueLs.format(params.textDocument.uri, params.options);
});
}));
connection.onDocumentRangeFormatting((params) => __awaiter(this, void 0, void 0, function* () {
return worker(params.textDocument.uri, vueLs => {
return vueLs.format(params.textDocument.uri, params.options, params.range);
});
}));
connection.onDocumentOnTypeFormatting((params) => __awaiter(this, void 0, void 0, function* () {
return worker(params.textDocument.uri, vueLs => {
return vueLs.format(params.textDocument.uri, params.options, undefined, params);
});
}));
connection.onSelectionRanges((params) => __awaiter(this, void 0, void 0, function* () {
return worker(params.textDocument.uri, vueLs => {
return vueLs.getSelectionRanges(params.textDocument.uri, params.positions);
});
}));
connection.onFoldingRanges((params) => __awaiter(this, void 0, void 0, function* () {
return worker(params.textDocument.uri, vueLs => {
return vueLs.getFoldingRanges(params.textDocument.uri);
});
}));
connection.languages.onLinkedEditingRange((params) => __awaiter(this, void 0, void 0, function* () {
return worker(params.textDocument.uri, vueLs => {
return vueLs.findLinkedEditingRanges(params.textDocument.uri, params.position);
});
}));
connection.onDocumentSymbol((params) => __awaiter(this, void 0, void 0, function* () {
return worker(params.textDocument.uri, vueLs => {
return vueLs.findDocumentSymbols(params.textDocument.uri);
});
}));
connection.onDocumentColor((params) => __awaiter(this, void 0, void 0, function* () {
return worker(params.textDocument.uri, vueLs => {
return vueLs.findDocumentColors(params.textDocument.uri);
});
}));
connection.onColorPresentation((params) => __awaiter(this, void 0, void 0, function* () {
return worker(params.textDocument.uri, vueLs => {
return vueLs.getColorPresentations(params.textDocument.uri, params.color, params.range);
});
}));
connection.onCompletion((params) => __awaiter(this, void 0, void 0, function* () {

@@ -24,0 +69,0 @@ return worker(params.textDocument.uri, (vueLs) => __awaiter(this, void 0, void 0, function* () {

@@ -12,3 +12,3 @@ import * as embedded from '@volar/language-core';

tsConfig: path.PosixPath | ts.CompilerOptions;
documentRegistry: ts.DocumentRegistry;
documentRegistry: ts.DocumentRegistry | undefined;
serverConfig: ServerConfig | undefined;

@@ -63,2 +63,12 @@ }

getLanguageService: () => {
format: (uri: string, options: embeddedLS.FormattingOptions, range?: embeddedLS.Range | undefined, onTypeParams?: {
ch: string;
position: embeddedLS.Position;
} | undefined) => Promise<embeddedLS.TextEdit[] | undefined>;
getFoldingRanges: (uri: string) => Promise<embeddedLS.FoldingRange[] | undefined>;
getSelectionRanges: (uri: string, positions: embeddedLS.Position[]) => Promise<embeddedLS.SelectionRange[] | undefined>;
findLinkedEditingRanges: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.LinkedEditingRanges | undefined>;
findDocumentSymbols: (uri: string) => Promise<embeddedLS.SymbolInformation[] | undefined>;
findDocumentColors: (uri: string) => Promise<embeddedLS.ColorInformation[] | undefined>;
getColorPresentations: (uri: string, color: embeddedLS.Color, range: embeddedLS.Range) => Promise<embeddedLS.ColorPresentation[] | undefined>;
doValidation: (uri: string, token?: embeddedLS.CancellationToken | undefined, response?: ((result: embeddedLS.Diagnostic[]) => void) | undefined) => Promise<embeddedLS.Diagnostic[]>;

@@ -100,6 +110,16 @@ findReferences: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.Location[] | undefined>;

};
dispose: () => void;
context: embeddedLS.LanguageServiceRuntimeContext;
dispose: () => void | undefined;
context: embeddedLS.LanguageServiceRuntimeContext<embedded.LanguageServiceHost>;
};
getLanguageServiceDontCreate: () => {
format: (uri: string, options: embeddedLS.FormattingOptions, range?: embeddedLS.Range | undefined, onTypeParams?: {
ch: string;
position: embeddedLS.Position;
} | undefined) => Promise<embeddedLS.TextEdit[] | undefined>;
getFoldingRanges: (uri: string) => Promise<embeddedLS.FoldingRange[] | undefined>;
getSelectionRanges: (uri: string, positions: embeddedLS.Position[]) => Promise<embeddedLS.SelectionRange[] | undefined>;
findLinkedEditingRanges: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.LinkedEditingRanges | undefined>;
findDocumentSymbols: (uri: string) => Promise<embeddedLS.SymbolInformation[] | undefined>;
findDocumentColors: (uri: string) => Promise<embeddedLS.ColorInformation[] | undefined>;
getColorPresentations: (uri: string, color: embeddedLS.Color, range: embeddedLS.Range) => Promise<embeddedLS.ColorPresentation[] | undefined>;
doValidation: (uri: string, token?: embeddedLS.CancellationToken | undefined, response?: ((result: embeddedLS.Diagnostic[]) => void) | undefined) => Promise<embeddedLS.Diagnostic[]>;

@@ -141,4 +161,4 @@ findReferences: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.Location[] | undefined>;

};
dispose: () => void;
context: embeddedLS.LanguageServiceRuntimeContext;
dispose: () => void | undefined;
context: embeddedLS.LanguageServiceRuntimeContext<embedded.LanguageServiceHost>;
} | undefined;

@@ -145,0 +165,0 @@ getParsedCommandLine: () => ts.ParsedCommandLine;

@@ -17,6 +17,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

const vscode = require("vscode-languageserver");
const types_1 = require("../types");
const uriMap_1 = require("./utils/uriMap");
function createProject(context) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const sys = context.workspace.workspaces.fileSystemHost.getWorkspaceFileSystem(context.rootUri);
const sys = context.workspace.workspaces.initOptions.serverMode === types_1.ServerMode.Syntactic || !context.workspace.workspaces.fileSystemHost
? {
newLine: '\n',
useCaseSensitiveFileNames: false,
fileExists: () => false,
readFile: () => undefined,
readDirectory: () => [],
getCurrentDirectory: () => '',
realpath: () => '',
resolvePath: () => '',
}
: context.workspace.workspaces.fileSystemHost.getWorkspaceFileSystem(context.rootUri);
let typeRootVersion = 0;

@@ -29,3 +42,3 @@ let projectVersion = 0;

const languageServiceHost = createLanguageServiceHost();
const disposeWatchEvent = context.workspace.workspaces.fileSystemHost.onDidChangeWatchedFiles(params => {
const disposeWatchEvent = (_a = context.workspace.workspaces.fileSystemHost) === null || _a === void 0 ? void 0 : _a.onDidChangeWatchedFiles(params => {
onWorkspaceFilesChanged(params.changes);

@@ -55,3 +68,3 @@ });

if (!languageService) {
const languageModules = context.workspace.workspaces.plugins.map(plugin => { var _a, _b, _c; return (_c = (_b = (_a = plugin.semanticService) === null || _a === void 0 ? void 0 : _a.getLanguageModules) === null || _b === void 0 ? void 0 : _b.call(_a, languageServiceHost)) !== null && _c !== void 0 ? _c : []; }).flat();
const languageModules = context.workspace.workspaces.plugins.map(plugin => { var _a, _b; return (_b = (_a = plugin.getLanguageModules) === null || _a === void 0 ? void 0 : _a.call(plugin, languageServiceHost)) !== null && _b !== void 0 ? _b : []; }).flat();
const languageContext = embedded.createLanguageContext(languageServiceHost, languageModules);

@@ -65,3 +78,3 @@ const languageServiceContext = embeddedLS.createLanguageServiceContext({

...(_b = (_a = context.serverConfig) === null || _a === void 0 ? void 0 : _a.plugins) !== null && _b !== void 0 ? _b : [],
...context.workspace.workspaces.plugins.map(plugin => { var _a, _b, _c; return (_c = (_b = (_a = plugin.semanticService) === null || _a === void 0 ? void 0 : _a.getServicePlugins) === null || _b === void 0 ? void 0 : _b.call(_a, languageServiceHost, languageService)) !== null && _c !== void 0 ? _c : []; }).flat(),
...context.workspace.workspaces.plugins.map(plugin => { var _a, _b; return (_b = (_a = plugin.getLanguageServicePlugins) === null || _a === void 0 ? void 0 : _a.call(plugin, languageServiceHost, languageServiceContext)) !== null && _b !== void 0 ? _b : []; }).flat(),
];

@@ -73,3 +86,5 @@ },

fileSystemProvider: context.workspace.workspaces.server.runtimeEnv.fileSystemProvide,
documentContext: getHTMLDocumentContext(context.workspace.workspaces.ts, languageServiceHost),
documentContext: context.workspace.workspaces.ts
? getHTMLDocumentContext(context.workspace.workspaces.ts, languageServiceHost)
: undefined,
schemaRequestService: (uri) => __awaiter(this, void 0, void 0, function* () {

@@ -85,2 +100,3 @@ const protocol = uri.substring(0, uri.indexOf(':'));

documentRegistry: context.documentRegistry,
getLanguageService: () => languageService,
});

@@ -124,3 +140,2 @@ languageService = embeddedLS.createLanguageService(languageServiceContext);

function createLanguageServiceHost() {
var _a;
const token = {

@@ -148,9 +163,12 @@ isCancellationRequested() {

getDefaultLibFileName: options => {
try {
return context.workspace.workspaces.ts.getDefaultLibFilePath(options);
if (context.workspace.workspaces.initOptions.typescript && context.workspace.workspaces.ts) {
try {
return context.workspace.workspaces.ts.getDefaultLibFilePath(options);
}
catch (_a) {
// web
return context.workspace.workspaces.initOptions.typescript.tsdk + '/' + context.workspace.workspaces.ts.getDefaultLibFileName(options);
}
}
catch (_a) {
// web
return context.workspace.workspaces.initOptions.typescript.tsdk + '/' + context.workspace.workspaces.ts.getDefaultLibFileName(options);
}
return '';
},

@@ -163,3 +181,5 @@ getProjectVersion: () => projectVersion.toString(),

getScriptSnapshot,
getTypeScriptModule: () => context.workspace.workspaces.ts,
getTypeScriptModule: () => {
return context.workspace.workspaces.ts;
},
};

@@ -174,4 +194,4 @@ if (context.workspace.workspaces.initOptions.noProjectReferences) {

for (const plugin of context.workspace.workspaces.plugins) {
if ((_a = plugin.semanticService) === null || _a === void 0 ? void 0 : _a.resolveLanguageServiceHost) {
host = plugin.semanticService.resolveLanguageServiceHost(context.workspace.workspaces.ts, sys, context.tsConfig, host);
if (context.workspace.workspaces.ts && plugin.resolveLanguageServiceHost) {
host = plugin.resolveLanguageServiceHost(context.workspace.workspaces.ts, sys, context.tsConfig, host);
}

@@ -198,3 +218,3 @@ }

}
if (sys.fileExists(fileName)) {
if (context.workspace.workspaces.ts && sys.fileExists(fileName)) {
if (context.workspace.workspaces.initOptions.maxFileSize) {

@@ -230,3 +250,3 @@ const fileSize = (_a = sys.getFileSize) === null || _a === void 0 ? void 0 : _a.call(sys, fileName);

scripts.clear();
disposeWatchEvent();
disposeWatchEvent === null || disposeWatchEvent === void 0 ? void 0 : disposeWatchEvent();
disposeDocChange();

@@ -238,27 +258,29 @@ }

function createParsedCommandLine(ts, sys, rootPath, tsConfig, plugins) {
const extraFileExtensions = plugins.map(plugin => plugin.extraFileExtensions).flat();
try {
let content;
if (typeof tsConfig === 'string') {
const config = ts.readJsonConfigFile(tsConfig, sys.readFile);
content = ts.parseJsonSourceFileConfigFileContent(config, sys, path.dirname(tsConfig), {}, tsConfig, undefined, extraFileExtensions);
const extraFileExtensions = plugins.map(plugin => { var _a; return (_a = plugin.extraFileExtensions) !== null && _a !== void 0 ? _a : []; }).flat();
if (ts) {
try {
let content;
if (typeof tsConfig === 'string') {
const config = ts.readJsonConfigFile(tsConfig, sys.readFile);
content = ts.parseJsonSourceFileConfigFileContent(config, sys, path.dirname(tsConfig), {}, tsConfig, undefined, extraFileExtensions);
}
else {
content = ts.parseJsonConfigFileContent({ files: [] }, sys, rootPath, tsConfig, path.join(rootPath, 'jsconfig.json'), undefined, extraFileExtensions);
}
// fix https://github.com/johnsoncodehk/volar/issues/1786
// https://github.com/microsoft/TypeScript/issues/30457
// patching ts server broke with outDir + rootDir + composite/incremental
content.options.outDir = undefined;
content.fileNames = content.fileNames.map(shared.normalizeFileName);
return content;
}
else {
content = ts.parseJsonConfigFileContent({ files: [] }, sys, rootPath, tsConfig, path.join(rootPath, 'jsconfig.json'), undefined, extraFileExtensions);
catch (_a) {
// will be failed if web fs host first result not ready
}
// fix https://github.com/johnsoncodehk/volar/issues/1786
// https://github.com/microsoft/TypeScript/issues/30457
// patching ts server broke with outDir + rootDir + composite/incremental
content.options.outDir = undefined;
content.fileNames = content.fileNames.map(shared.normalizeFileName);
return content;
}
catch (_a) {
// will be failed if web fs host first result not ready
return {
errors: [],
fileNames: [],
options: {},
};
}
return {
errors: [],
fileNames: [],
options: {},
};
}

@@ -265,0 +287,0 @@ function getHTMLDocumentContext(ts, host) {

@@ -8,2 +8,2 @@ import * as vscode from 'vscode-languageserver';

}
export declare function createCommonLanguageServer(context: ServerContext): void;
export declare function startCommonLanguageServer(context: ServerContext): void;

@@ -11,3 +11,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.createCommonLanguageServer = void 0;
exports.startCommonLanguageServer = void 0;
const vscode = require("vscode-languageserver");

@@ -19,6 +19,5 @@ const vscode_uri_1 = require("vscode-uri");

const documents_1 = require("./documents");
const syntaxServicesHost_1 = require("./syntaxServicesHost");
const registerFeatures_1 = require("./utils/registerFeatures");
const workspaces_1 = require("./workspaces");
function createCommonLanguageServer(context) {
function startCommonLanguageServer(context) {
let initParams;

@@ -29,3 +28,2 @@ let options;

let projects;
let documentServiceHost;
let configurationHost;

@@ -35,3 +33,3 @@ let plugins;

context.connection.onInitialize((_params) => __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c, _d;
var _a, _b, _c;
initParams = _params;

@@ -55,9 +53,4 @@ options = initParams.initializationOptions;

configurationHost = ((_c = initParams.capabilities.workspace) === null || _c === void 0 ? void 0 : _c.configuration) ? (0, configurationHost_1.createConfigurationHost)(initParams, context.connection) : undefined;
const serverMode = (_d = options.serverMode) !== null && _d !== void 0 ? _d : types_1.ServerMode.Semantic;
(0, registerFeatures_1.setupSyntacticCapabilities)(initParams.capabilities, result.capabilities, options);
yield _createDocumentServiceHost();
if (serverMode === types_1.ServerMode.Semantic) {
(0, registerFeatures_1.setupSemanticCapabilities)(initParams.capabilities, result.capabilities, options, plugins, getSemanticTokensLegend());
yield createLanguageServiceHost();
}
(0, registerFeatures_1.setupCapabilities)(initParams.capabilities, result.capabilities, options, plugins, getSemanticTokensLegend());
yield createLanguageServiceHost();
try {

@@ -71,3 +64,3 @@ // show version on LSP logs

}
catch (_e) { }
catch (_d) { }
return result;

@@ -82,7 +75,5 @@ }));

for (const folder of e.added) {
documentServiceHost === null || documentServiceHost === void 0 ? void 0 : documentServiceHost.add(vscode_uri_1.URI.parse(folder.uri));
projects === null || projects === void 0 ? void 0 : projects.add(vscode_uri_1.URI.parse(folder.uri));
}
for (const folder of e.removed) {
documentServiceHost === null || documentServiceHost === void 0 ? void 0 : documentServiceHost.remove(vscode_uri_1.URI.parse(folder.uri));
projects === null || projects === void 0 ? void 0 : projects.remove(vscode_uri_1.URI.parse(folder.uri));

@@ -108,3 +99,3 @@ }

'json',
...plugins.map(plugin => plugin.extraFileExtensions.map(ext => ext.extension)).flat(),
...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(),
].join(',')}}`

@@ -117,22 +108,8 @@ },

context.connection.listen();
function _createDocumentServiceHost() {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
const ts = context.runtimeEnv.loadTypescript(options.typescript.tsdk);
documentServiceHost = (0, syntaxServicesHost_1.createSyntaxServicesHost)(context.runtimeEnv, plugins, ts, configurationHost, options);
for (const root of roots) {
documentServiceHost.add(root);
}
(yield Promise.resolve().then(() => require('./features/documentFeatures'))).register(context.connection, documents, documentServiceHost);
for (const plugin of plugins) {
(_b = (_a = plugin.syntacticService) === null || _a === void 0 ? void 0 : _a.onInitialize) === null || _b === void 0 ? void 0 : _b.call(_a, context.connection);
}
});
}
function createLanguageServiceHost() {
var _a, _b;
var _a;
return __awaiter(this, void 0, void 0, function* () {
const ts = context.runtimeEnv.loadTypescript(options.typescript.tsdk);
fsHost = context.runtimeEnv.createFileSystemHost(ts, initParams.capabilities);
const tsLocalized = initParams.locale ? yield context.runtimeEnv.loadTypescriptLocalized(options.typescript.tsdk, initParams.locale) : undefined;
const ts = options.typescript ? context.runtimeEnv.loadTypescript(options.typescript.tsdk) : undefined;
fsHost = ts ? context.runtimeEnv.createFileSystemHost(ts, initParams.capabilities) : undefined;
const tsLocalized = options.typescript && initParams.locale ? yield context.runtimeEnv.loadTypescriptLocalized(options.typescript.tsdk, initParams.locale) : undefined;
const cancelTokenHost = (0, cancellationPipe_1.createCancellationTokenHost)(options.cancellationPipeName);

@@ -158,3 +135,3 @@ const _projects = (0, workspaces_1.createWorkspaces)({

for (const plugin of plugins) {
(_b = (_a = plugin.semanticService) === null || _a === void 0 ? void 0 : _a.onInitialize) === null || _b === void 0 ? void 0 : _b.call(_a, context.connection, getLanguageService);
(_a = plugin.onInitialize) === null || _a === void 0 ? void 0 : _a.call(plugin, context.connection, getLanguageService);
}

@@ -180,3 +157,3 @@ function getLanguageService(uri) {

}
exports.createCommonLanguageServer = createCommonLanguageServer;
exports.startCommonLanguageServer = startCommonLanguageServer;
// https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#standard-token-types-and-modifiers

@@ -183,0 +160,0 @@ const standardSemanticTokensLegend = {

import { ConfigurationHost } from '@volar/language-service';
import type * as ts from 'typescript/lib/tsserverlibrary';
export declare function getInferredCompilerOptions(ts: typeof import('typescript/lib/tsserverlibrary'), configurationHost: ConfigurationHost | undefined): Promise<ts.CompilerOptions>;
export declare function getInferredCompilerOptions(configurationHost: ConfigurationHost | undefined): Promise<ts.CompilerOptions>;

@@ -12,3 +12,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

exports.getInferredCompilerOptions = void 0;
function getInferredCompilerOptions(ts, configurationHost) {
function getInferredCompilerOptions(configurationHost) {
return __awaiter(this, void 0, void 0, function* () {

@@ -25,3 +25,3 @@ let [implicitProjectConfig_1, implicitProjectConfig_2] = yield Promise.all([

const strictFunctionTypes = readImplicitStrictFunctionTypes();
const options = Object.assign(Object.assign({}, inferredProjectCompilerOptions('typescript')), { allowJs: true, allowSyntheticDefaultImports: true, allowNonTsExtensions: true, resolveJsonModule: true, jsx: ts.JsxEmit.Preserve });
const options = Object.assign(Object.assign({}, inferredProjectCompilerOptions('typescript')), { allowJs: true, allowSyntheticDefaultImports: true, allowNonTsExtensions: true, resolveJsonModule: true, jsx: 1 /* ts.JsxEmit.Preserve */ });
return options;

@@ -46,5 +46,5 @@ function readCheckJs() {

const projectConfig = {
module: ts.ModuleKind.CommonJS,
target: ts.ScriptTarget.ES2020,
jsx: ts.JsxEmit.Preserve,
module: 1 /* ts.ModuleKind.CommonJS */,
target: 7 /* ts.ScriptTarget.ES2020 */,
jsx: 1 /* ts.JsxEmit.Preserve */,
};

@@ -51,0 +51,0 @@ if (checkJs) {

import { LanguageServerPlugin, LanguageServerInitializationOptions } from '../../types';
import * as vscode from 'vscode-languageserver';
import { ClientCapabilities } from 'vscode-languageserver';
export declare function setupSyntacticCapabilities(params: ClientCapabilities, server: vscode.ServerCapabilities, initOptions: LanguageServerInitializationOptions): void;
export declare function setupSemanticCapabilities(params: ClientCapabilities, server: vscode.ServerCapabilities, initOptions: LanguageServerInitializationOptions, plugins: ReturnType<LanguageServerPlugin>[], semanticTokensLegend: vscode.SemanticTokensLegend): void;
export declare function setupCapabilities(params: ClientCapabilities, server: vscode.ServerCapabilities, initOptions: LanguageServerInitializationOptions, plugins: ReturnType<LanguageServerPlugin>[], semanticTokensLegend: vscode.SemanticTokensLegend): void;
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupSemanticCapabilities = exports.setupSyntacticCapabilities = void 0;
exports.setupCapabilities = void 0;
const embedded = require("@volar/language-service");
const types_1 = require("../../types");
const vscode = require("vscode-languageserver");
function setupSyntacticCapabilities(params, server, initOptions) {
var _a, _b, _c, _d, _e, _f, _g, _h;
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;
// Syntactic
if (!initOptions.respectClientCapabilities || ((_a = params.textDocument) === null || _a === void 0 ? void 0 : _a.selectionRange)) {

@@ -36,25 +37,22 @@ server.selectionRangeProvider = true;

}
}
exports.setupSyntacticCapabilities = setupSyntacticCapabilities;
function setupSemanticCapabilities(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;
if (!initOptions.respectClientCapabilities || ((_a = params.textDocument) === null || _a === void 0 ? void 0 : _a.references)) {
// Semantic
if (!initOptions.respectClientCapabilities || ((_j = params.textDocument) === null || _j === void 0 ? void 0 : _j.references)) {
server.referencesProvider = true;
}
if (!initOptions.respectClientCapabilities || ((_b = params.textDocument) === null || _b === void 0 ? void 0 : _b.implementation)) {
if (!initOptions.respectClientCapabilities || ((_k = params.textDocument) === null || _k === void 0 ? void 0 : _k.implementation)) {
server.implementationProvider = true;
}
if (!initOptions.respectClientCapabilities || ((_c = params.textDocument) === null || _c === void 0 ? void 0 : _c.definition)) {
if (!initOptions.respectClientCapabilities || ((_l = params.textDocument) === null || _l === void 0 ? void 0 : _l.definition)) {
server.definitionProvider = true;
}
if (!initOptions.respectClientCapabilities || ((_d = params.textDocument) === null || _d === void 0 ? void 0 : _d.typeDefinition)) {
if (!initOptions.respectClientCapabilities || ((_m = params.textDocument) === null || _m === void 0 ? void 0 : _m.typeDefinition)) {
server.typeDefinitionProvider = true;
}
if (!initOptions.respectClientCapabilities || ((_e = params.textDocument) === null || _e === void 0 ? void 0 : _e.callHierarchy)) {
if (!initOptions.respectClientCapabilities || ((_o = params.textDocument) === null || _o === void 0 ? void 0 : _o.callHierarchy)) {
server.callHierarchyProvider = true;
}
if (!initOptions.respectClientCapabilities || ((_f = params.textDocument) === null || _f === void 0 ? void 0 : _f.hover)) {
if (!initOptions.respectClientCapabilities || ((_p = params.textDocument) === null || _p === void 0 ? void 0 : _p.hover)) {
server.hoverProvider = true;
}
if (!initOptions.respectClientCapabilities || ((_g = params.textDocument) === null || _g === void 0 ? void 0 : _g.rename)) {
if (!initOptions.respectClientCapabilities || ((_q = params.textDocument) === null || _q === void 0 ? void 0 : _q.rename)) {
server.renameProvider = {

@@ -64,23 +62,3 @@ prepareProvider: true,

}
if (!initOptions.respectClientCapabilities || ((_h = params.workspace) === null || _h === void 0 ? void 0 : _h.fileOperations)) {
server.workspace = {
fileOperations: {
willRename: {
filters: [
...plugins.map(plugin => plugin.extraFileExtensions.map(ext => ({ pattern: { glob: `**/*.${ext.extension}` } }))).flat(),
{ pattern: { glob: '**/*.js' } },
{ pattern: { glob: '**/*.cjs' } },
{ pattern: { glob: '**/*.mjs' } },
{ pattern: { glob: '**/*.ts' } },
{ pattern: { glob: '**/*.cts' } },
{ pattern: { glob: '**/*.mts' } },
{ pattern: { glob: '**/*.jsx' } },
{ pattern: { glob: '**/*.tsx' } },
{ pattern: { glob: '**/*.json' } },
]
}
}
};
}
if (!initOptions.respectClientCapabilities || ((_j = params.textDocument) === null || _j === void 0 ? void 0 : _j.signatureHelp)) {
if (!initOptions.respectClientCapabilities || ((_r = params.textDocument) === null || _r === void 0 ? void 0 : _r.signatureHelp)) {
server.signatureHelpProvider = {

@@ -91,3 +69,3 @@ triggerCharacters: ['(', ',', '<'],

}
if (!initOptions.respectClientCapabilities || ((_k = params.textDocument) === null || _k === void 0 ? void 0 : _k.completion)) {
if (!initOptions.respectClientCapabilities || ((_s = params.textDocument) === null || _s === void 0 ? void 0 : _s.completion)) {
server.completionProvider = {

@@ -109,9 +87,9 @@ // triggerCharacters: '!@#$%^&*()_+-=`~{}|[]\:";\'<>?,./ '.split(''), // all symbols on keyboard

if (initOptions.ignoreTriggerCharacters) {
server.completionProvider.triggerCharacters = (_l = server.completionProvider.triggerCharacters) === null || _l === void 0 ? void 0 : _l.filter(c => !initOptions.ignoreTriggerCharacters.includes(c));
server.completionProvider.triggerCharacters = (_t = server.completionProvider.triggerCharacters) === null || _t === void 0 ? void 0 : _t.filter(c => !initOptions.ignoreTriggerCharacters.includes(c));
}
}
if (!initOptions.respectClientCapabilities || ((_m = params.textDocument) === null || _m === void 0 ? void 0 : _m.documentHighlight)) {
if (!initOptions.respectClientCapabilities || ((_u = params.textDocument) === null || _u === void 0 ? void 0 : _u.documentHighlight)) {
server.documentHighlightProvider = true;
}
if (!initOptions.respectClientCapabilities || ((_o = params.textDocument) === null || _o === void 0 ? void 0 : _o.documentLink)) {
if (!initOptions.respectClientCapabilities || ((_v = params.textDocument) === null || _v === void 0 ? void 0 : _v.documentLink)) {
server.documentLinkProvider = {

@@ -121,13 +99,10 @@ resolveProvider: false, // TODO

}
if (!initOptions.respectClientCapabilities || ((_p = params.workspace) === null || _p === void 0 ? void 0 : _p.symbol)) {
server.workspaceSymbolProvider = true;
}
if (!initOptions.respectClientCapabilities || ((_q = params.textDocument) === null || _q === void 0 ? void 0 : _q.codeLens)) {
if (!initOptions.respectClientCapabilities || ((_w = params.textDocument) === null || _w === void 0 ? void 0 : _w.codeLens)) {
server.codeLensProvider = {
resolveProvider: true,
};
server.executeCommandProvider = { commands: [...(_s = (_r = server.executeCommandProvider) === null || _r === void 0 ? void 0 : _r.commands) !== null && _s !== void 0 ? _s : []] };
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);
}
if (!initOptions.respectClientCapabilities || ((_t = params.textDocument) === null || _t === void 0 ? void 0 : _t.semanticTokens)) {
if (!initOptions.respectClientCapabilities || ((_z = params.textDocument) === null || _z === void 0 ? void 0 : _z.semanticTokens)) {
server.semanticTokensProvider = {

@@ -139,3 +114,3 @@ range: true,

}
if (!initOptions.respectClientCapabilities || ((_u = params.textDocument) === null || _u === void 0 ? void 0 : _u.codeAction)) {
if (!initOptions.respectClientCapabilities || ((_0 = params.textDocument) === null || _0 === void 0 ? void 0 : _0.codeAction)) {
server.codeActionProvider = {

@@ -156,10 +131,22 @@ codeActionKinds: [

}
if (!initOptions.respectClientCapabilities || ((_v = params.textDocument) === null || _v === void 0 ? void 0 : _v.inlayHint)) {
if (!initOptions.respectClientCapabilities || ((_1 = params.textDocument) === null || _1 === void 0 ? void 0 : _1.inlayHint)) {
server.inlayHintProvider = true;
}
if (!initOptions.respectClientCapabilities || ((_w = params.textDocument) === null || _w === void 0 ? void 0 : _w.diagnostic) && ((_x = initOptions.diagnosticModel) !== null && _x !== void 0 ? _x : types_1.DiagnosticModel.Push) === types_1.DiagnosticModel.Pull) {
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) {
server.diagnosticProvider = {
documentSelector: [
...plugins.map(plugin => plugin.extraFileExtensions.map(ext => ({ pattern: `**/*.${ext.extension}` }))).flat(),
{ pattern: '**/*.{ts,js,tsx,jsx}' },
{
pattern: `**/*.{${[
'js',
'cjs',
'mjs',
'ts',
'cts',
'mts',
'jsx',
'tsx',
// 'json',
...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(),
].join(',')}}`
}
],

@@ -170,4 +157,34 @@ interFileDependencies: true,

}
// cross file features
if (!initOptions.respectClientCapabilities || ((_4 = params.workspace) === null || _4 === void 0 ? void 0 : _4.fileOperations)) {
server.workspace = {
fileOperations: {
willRename: {
filters: [
{
pattern: {
glob: `**/*.{${[
'js',
'cjs',
'mjs',
'ts',
'cts',
'mts',
'jsx',
'tsx',
'json',
...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(),
].join(',')}}`
}
},
]
}
}
};
}
if (!initOptions.respectClientCapabilities || ((_5 = params.workspace) === null || _5 === void 0 ? void 0 : _5.symbol)) {
server.workspaceSymbolProvider = true;
}
}
exports.setupSemanticCapabilities = setupSemanticCapabilities;
exports.setupCapabilities = setupCapabilities;
//# sourceMappingURL=registerFeatures.js.map

@@ -22,10 +22,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

function createWorkspace(context) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
let inferredProject;
const serverConfig = (0, serverConfig_1.loadServerConfig)(shared.getPathOfUri(context.rootUri.toString()), context.workspaces.initOptions.configFilePath);
const sys = context.workspaces.fileSystemHost.getWorkspaceFileSystem(context.rootUri);
const documentRegistry = context.workspaces.ts.createDocumentRegistry(sys.useCaseSensitiveFileNames, shared.getPathOfUri(context.rootUri.toString()));
const sys = (_a = context.workspaces.fileSystemHost) === null || _a === void 0 ? void 0 : _a.getWorkspaceFileSystem(context.rootUri);
const documentRegistry = sys ? (_b = context.workspaces.ts) === null || _b === void 0 ? void 0 : _b.createDocumentRegistry(sys.useCaseSensitiveFileNames, shared.getPathOfUri(context.rootUri.toString())) : undefined;
const projects = (0, uriMap_1.createUriMap)();
const rootTsConfigs = new Set(sys.readDirectory(shared.getPathOfUri(context.rootUri.toString()), exports.rootTsConfigNames, undefined, ['**/*']).map(fileName => shared.normalizeFileName(fileName)));
const disposeTsConfigWatch = context.workspaces.fileSystemHost.onDidChangeWatchedFiles(({ changes }) => {
const rootTsConfigs = new Set(sys === null || sys === void 0 ? void 0 : sys.readDirectory(shared.getPathOfUri(context.rootUri.toString()), exports.rootTsConfigNames, undefined, ['**/*']).map(fileName => shared.normalizeFileName(fileName)));
const disposeTsConfigWatch = (_c = context.workspaces.fileSystemHost) === null || _c === void 0 ? void 0 : _c.onDidChangeWatchedFiles(({ changes }) => {
for (const change of changes) {

@@ -58,3 +59,3 @@ if (exports.rootTsConfigNames.includes(change.uri.substring(change.uri.lastIndexOf('/') + 1))) {

clearProjects();
disposeTsConfigWatch();
disposeTsConfigWatch === null || disposeTsConfigWatch === void 0 ? void 0 : disposeTsConfigWatch();
},

@@ -89,3 +90,3 @@ };

inferredProject = (() => __awaiter(this, void 0, void 0, function* () {
const inferOptions = yield (0, inferredCompilerOptions_1.getInferredCompilerOptions)(context.workspaces.ts, context.workspaces.configurationHost);
const inferOptions = yield (0, inferredCompilerOptions_1.getInferredCompilerOptions)(context.workspaces.configurationHost);
return (0, project_1.createProject)({

@@ -123,5 +124,6 @@ workspace: context,

return findTsconfig((tsconfig) => __awaiter(this, void 0, void 0, function* () {
var _a;
const map = (0, uriMap_1.createUriMap)();
const parsedCommandLine = yield getParsedCommandLine(tsconfig);
for (const fileName of parsedCommandLine.fileNames) {
for (const fileName of (_a = parsedCommandLine === null || parsedCommandLine === void 0 ? void 0 : parsedCommandLine.fileNames) !== null && _a !== void 0 ? _a : []) {
map.pathSet(fileName, true);

@@ -134,6 +136,6 @@ }

return findTsconfig((tsconfig) => __awaiter(this, void 0, void 0, function* () {
var _a;
var _a, _b;
const project = yield projects.pathGet(tsconfig);
const ls = project === null || project === void 0 ? void 0 : project.getLanguageServiceDontCreate();
const validDoc = (_a = ls === null || ls === void 0 ? void 0 : ls.context.typescriptLanguageService.getProgram()) === null || _a === void 0 ? void 0 : _a.getSourceFile(shared.getPathOfUri(uri.toString()));
const validDoc = (_b = (_a = ls === null || ls === void 0 ? void 0 : ls.context.typescript) === null || _a === void 0 ? void 0 : _a.languageService.getProgram()) === null || _b === void 0 ? void 0 : _b.getSourceFile(shared.getPathOfUri(uri.toString()));
return !!validDoc;

@@ -175,3 +177,3 @@ }));

// fix https://github.com/johnsoncodehk/volar/issues/712
if (!sys.fileExists(tsConfigPath)) {
if (sys && !sys.fileExists(tsConfigPath)) {
const newTsConfigPath = path.join(tsConfigPath, 'tsconfig.json');

@@ -192,4 +194,6 @@ const newJsConfigPath = path.join(tsConfigPath, 'jsconfig.json');

const referenceParsedCommandLine = yield getParsedCommandLine(tsConfigPath);
for (const chain of yield getReferencesChains(referenceParsedCommandLine, tsConfigPath, [...before, tsConfig])) {
newChains.push(chain);
if (referenceParsedCommandLine) {
for (const chain of yield getReferencesChains(referenceParsedCommandLine, tsConfigPath, [...before, tsConfig])) {
newChains.push(chain);
}
}

@@ -208,3 +212,3 @@ }

const project = yield getProjectByCreate(tsConfig);
return project.getParsedCommandLine();
return project === null || project === void 0 ? void 0 : project.getParsedCommandLine();
});

@@ -217,3 +221,3 @@ }

let project = projects.pathGet(tsConfig);
if (!project) {
if (!project && documentRegistry) {
project = (0, project_1.createProject)({

@@ -220,0 +224,0 @@ workspace: context,

@@ -17,3 +17,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

function createWorkspaces(context) {
var _a, _b;
var _a, _b, _c;
const workspaces = new Map();

@@ -28,3 +28,3 @@ let semanticTokensReq = 0;

});
context.fileSystemHost.onDidChangeWatchedFiles(({ changes }) => {
(_a = context.fileSystemHost) === null || _a === void 0 ? void 0 : _a.onDidChangeWatchedFiles(({ changes }) => {
const tsConfigChanges = changes.filter(change => workspace_1.rootTsConfigNames.includes(change.uri.substring(change.uri.lastIndexOf('/') + 1)));

@@ -38,3 +38,3 @@ if (tsConfigChanges.length) {

});
(_b = (_a = context.server.runtimeEnv).onDidChangeConfiguration) === null || _b === void 0 ? void 0 : _b.call(_a, () => __awaiter(this, void 0, void 0, function* () {
(_c = (_b = context.server.runtimeEnv).onDidChangeConfiguration) === null || _c === void 0 ? void 0 : _c.call(_b, () => __awaiter(this, void 0, void 0, function* () {
updateDiagnosticsAndSemanticTokens();

@@ -64,4 +64,5 @@ }));

function reloadProject() {
var _a;
return __awaiter(this, void 0, void 0, function* () {
context.fileSystemHost.reload();
(_a = context.fileSystemHost) === null || _a === void 0 ? void 0 : _a.reload();
for (const [_, workspace] of workspaces) {

@@ -155,7 +156,9 @@ (yield workspace).reload();

.sort((a, b) => (0, workspace_1.sortTsConfigs)(shared.getPathOfUri(uri), shared.getPathOfUri(a), shared.getPathOfUri(b)));
for (const rootUri of rootUris) {
const workspace = yield workspaces.get(rootUri);
const projectAndTsConfig = yield (workspace === null || workspace === void 0 ? void 0 : workspace.getProjectAndTsConfig(uri));
if (projectAndTsConfig) {
return projectAndTsConfig;
if (context.initOptions.serverMode !== types_1.ServerMode.Syntactic) {
for (const rootUri of rootUris) {
const workspace = yield workspaces.get(rootUri);
const projectAndTsConfig = yield (workspace === null || workspace === void 0 ? void 0 : workspace.getProjectAndTsConfig(uri));
if (projectAndTsConfig) {
return projectAndTsConfig;
}
}

@@ -162,0 +165,0 @@ }

@@ -0,3 +1,5 @@

import * as vscode from 'vscode-languageserver/node';
import { LanguageServerPlugin } from '../types';
export * from '../index';
export declare function createLanguageServer(plugins: LanguageServerPlugin[]): void;
export declare function createConnection(): vscode._Connection<vscode._, vscode._, vscode._, vscode._, vscode._, vscode._, vscode._, vscode._>;
export declare function startLanguageServer(connection: vscode.Connection, ...plugins: LanguageServerPlugin[]): void;

@@ -25,3 +25,3 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.createLanguageServer = void 0;
exports.startLanguageServer = exports.createConnection = void 0;
const shared = require("@volar/shared");

@@ -37,5 +37,8 @@ const fs = require("fs");

__exportStar(require("../index"), exports);
function createLanguageServer(plugins) {
const connection = vscode.createConnection(vscode.ProposedFeatures.all);
(0, server_1.createCommonLanguageServer)({
function createConnection() {
return vscode.createConnection(vscode.ProposedFeatures.all);
}
exports.createConnection = createConnection;
function startLanguageServer(connection, ...plugins) {
(0, server_1.startCommonLanguageServer)({
plugins,

@@ -108,3 +111,3 @@ connection,

}
exports.createLanguageServer = createLanguageServer;
exports.startLanguageServer = startLanguageServer;
//# sourceMappingURL=index.js.map

@@ -8,2 +8,3 @@ /// <reference types="node" />

import { URI } from 'vscode-uri';
import { LanguageServiceRuntimeContext } from '@volar/language-service';
export type FileSystemHost = {

@@ -27,14 +28,7 @@ ready(connection: vscode.Connection): void;

export type LanguageServerPlugin<A extends LanguageServerInitializationOptions = LanguageServerInitializationOptions, B extends embedded.LanguageServiceHost = embedded.LanguageServiceHost, C = embeddedLS.LanguageService> = (initOptions: A) => {
extraFileExtensions: ts.FileExtensionInfo[];
semanticService?: {
resolveLanguageServiceHost?(ts: typeof import('typescript/lib/tsserverlibrary'), sys: FileSystem, tsConfig: string | ts.CompilerOptions, host: embedded.LanguageServiceHost): B;
getLanguageModules?(host: B): embedded.LanguageModule[];
getServicePlugins?(host: B, service: embeddedLS.LanguageService): embeddedLS.LanguageServicePlugin[];
onInitialize?(connection: vscode.Connection, getLanguageService: (uri: string) => Promise<C>): void;
};
syntacticService?: {
getLanguageModules?(ts: typeof import('typescript/lib/tsserverlibrary'), env: embeddedLS.LanguageServicePluginContext['env']): embedded.LanguageModule[];
getServicePlugins?(context: embeddedLS.DocumentServiceRuntimeContext): embeddedLS.LanguageServicePlugin[];
onInitialize?(connection: vscode.Connection): void;
};
extraFileExtensions?: ts.FileExtensionInfo[];
resolveLanguageServiceHost?(ts: typeof import('typescript/lib/tsserverlibrary'), sys: FileSystem, tsConfig: string | ts.CompilerOptions, host: embedded.LanguageServiceHost): B;
getLanguageModules?(host: B): embedded.LanguageModule[];
getLanguageServicePlugins?(host: B, context: LanguageServiceRuntimeContext): embeddedLS.LanguageServicePlugin[];
onInitialize?(connection: vscode.Connection, getLanguageService: (uri: string) => Promise<C>): void;
};

@@ -51,3 +45,3 @@ export declare enum ServerMode {

export interface LanguageServerInitializationOptions {
typescript: {
typescript?: {
tsdk: string;

@@ -54,0 +48,0 @@ };

{
"name": "@volar/language-server",
"version": "1.0.19",
"version": "1.0.20",
"main": "out/index.js",

@@ -20,5 +20,5 @@ "license": "MIT",

"dependencies": {
"@volar/language-core": "1.0.19",
"@volar/language-service": "1.0.19",
"@volar/shared": "1.0.19",
"@volar/language-core": "1.0.20",
"@volar/language-service": "1.0.20",
"@volar/shared": "1.0.20",
"request-light": "^0.6.0",

@@ -32,3 +32,3 @@ "typesafe-path": "^0.2.2",

},
"gitHead": "02267fe83a5567b1cae7025e834cf084c8248546"
"gitHead": "e00f068e812677791c93efe9cf20995764350ec6"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc