@volar/language-server
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -18,2 +18,53 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function register(connection, projects) { | ||
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; | ||
for (const [rootUri, _workspace] of projects.workspaces) { | ||
console.log('workspace: ' + rootUri); | ||
const workspace = yield _workspace; | ||
console.log('documentRegistry stats: ' + workspace.documentRegistry.reportStats()); | ||
console.log(''); | ||
console.log('tsconfig: inferred'); | ||
const _inferredProject = workspace.getInferredProjectDontCreate(); | ||
if (_inferredProject) { | ||
console.log('loaded: true'); | ||
const inferredProject = yield _inferredProject; | ||
console.log('largest 10 files:'); | ||
for (const script of [...inferredProject.scripts.values()] | ||
.sort((a, b) => { var _a, _b, _c, _d; return ((_b = (_a = b.snapshot) === null || _a === void 0 ? void 0 : _a.getLength()) !== null && _b !== void 0 ? _b : 0) - ((_d = (_c = a.snapshot) === null || _c === void 0 ? void 0 : _c.getLength()) !== null && _d !== void 0 ? _d : 0); }) | ||
.slice(0, 10)) { | ||
console.log(' - ' + script.fileName); | ||
console.log(` size: ${(_a = script.snapshot) === null || _a === void 0 ? void 0 : _a.getLength()}`); | ||
} | ||
console.log('files:'); | ||
for (const script of inferredProject.scripts.values()) { | ||
console.log(' - ' + script.fileName); | ||
console.log(` size: ${(_b = script.snapshot) === null || _b === void 0 ? void 0 : _b.getLength()}`); | ||
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))})"`); | ||
} | ||
} | ||
else { | ||
console.log('loaded: false'); | ||
} | ||
console.log(''); | ||
for (const _project of workspace.projects.values()) { | ||
const project = yield _project; | ||
console.log('tsconfig: ' + project.tsConfig); | ||
console.log('loaded: ' + !!project.getLanguageServiceDontCreate()); | ||
console.log('largest 10 files:'); | ||
for (const script of [...project.scripts.values()] | ||
.sort((a, b) => { var _a, _b, _c, _d; return ((_b = (_a = b.snapshot) === null || _a === void 0 ? void 0 : _a.getLength()) !== null && _b !== void 0 ? _b : 0) - ((_d = (_c = a.snapshot) === null || _c === void 0 ? void 0 : _c.getLength()) !== null && _d !== void 0 ? _d : 0); }) | ||
.slice(0, 10)) { | ||
console.log(' - ' + script.fileName); | ||
console.log(` size: ${(_g = script.snapshot) === null || _g === void 0 ? void 0 : _g.getLength()}`); | ||
} | ||
console.log('files:'); | ||
for (const script of project.scripts.values()) { | ||
console.log(' - ' + script.fileName); | ||
console.log(` size: ${(_h = script.snapshot) === null || _h === void 0 ? void 0 : _h.getLength()}`); | ||
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))})"`); | ||
} | ||
} | ||
console.log(''); | ||
} | ||
})); | ||
connection.onRequest(protocol_1.GetMatchTsConfigRequest.type, (params) => __awaiter(this, void 0, void 0, function* () { | ||
@@ -28,7 +79,7 @@ const project = (yield projects.getProject(params.uri)); | ||
connection.onRequest(protocol_1.GetVirtualFileNamesRequest.type, (document) => __awaiter(this, void 0, void 0, function* () { | ||
var _a, _b; | ||
var _o, _p; | ||
const project = yield projects.getProject(document.uri); | ||
const fileNames = []; | ||
if (project) { | ||
const sourceFile = (_b = (_a = project.project) === null || _a === void 0 ? void 0 : _a.getLanguageService().context.core.mapper.get(shared.getPathOfUri(document.uri))) === null || _b === void 0 ? void 0 : _b[0]; | ||
const sourceFile = (_p = (_o = project.project) === null || _o === void 0 ? void 0 : _o.getLanguageService().context.core.mapper.get(shared.getPathOfUri(document.uri))) === null || _p === void 0 ? void 0 : _p[0]; | ||
if (sourceFile) { | ||
@@ -45,6 +96,6 @@ (0, language_core_1.forEachEmbeddeds)(sourceFile.embeddeds, e => { | ||
connection.onRequest(protocol_1.GetVirtualFileRequest.type, (params) => __awaiter(this, void 0, void 0, function* () { | ||
var _c, _d; | ||
var _q, _r; | ||
const project = yield projects.getProject(params.sourceFileUri); | ||
if (project) { | ||
const embeddedFile = (_d = (_c = project.project) === null || _c === void 0 ? void 0 : _c.getLanguageService().context.core.mapper.fromEmbeddedFileName(params.virtualFileName)) === null || _d === void 0 ? void 0 : _d.embedded; | ||
const embeddedFile = (_r = (_q = project.project) === null || _q === void 0 ? void 0 : _q.getLanguageService().context.core.mapper.fromEmbeddedFileName(params.virtualFileName)) === null || _r === void 0 ? void 0 : _r.embedded; | ||
if (embeddedFile) { | ||
@@ -62,7 +113,7 @@ return { | ||
connection.onNotification(protocol_1.WriteVirtualFilesNotification.type, (params) => __awaiter(this, void 0, void 0, function* () { | ||
var _e; | ||
var _s; | ||
const fs = yield Promise.resolve().then(() => require('fs')); | ||
const project = yield projects.getProject(params.uri); | ||
if (project) { | ||
const ls = (_e = (yield project.project)) === null || _e === void 0 ? void 0 : _e.getLanguageServiceDontCreate(); | ||
const ls = (_s = (yield project.project)) === null || _s === void 0 ? void 0 : _s.getLanguageServiceDontCreate(); | ||
if (ls) { | ||
@@ -82,3 +133,3 @@ const sourceFiles = new Set(ls.context.host.getScriptFileNames()); | ||
connection.onNotification(protocol_1.VerifyAllScriptsNotification.type, (params) => __awaiter(this, void 0, void 0, function* () { | ||
var _f; | ||
var _t; | ||
let errors = 0; | ||
@@ -90,3 +141,3 @@ let warnings = 0; | ||
if (project) { | ||
const ls = (_f = (yield project.project)) === null || _f === void 0 ? void 0 : _f.getLanguageServiceDontCreate(); | ||
const ls = (_t = (yield project.project)) === null || _t === void 0 ? void 0 : _t.getLanguageServiceDontCreate(); | ||
if (ls) { | ||
@@ -93,0 +144,0 @@ const allVueDocuments = ls.context.documents.getAll(); |
import * as vscode from 'vscode-languageserver'; | ||
import { CancellactionTokenHost } from '../utils/cancellationPipe'; | ||
import { CancellationTokenHost } from '../utils/cancellationPipe'; | ||
import type { Workspaces } from '../utils/workspaces'; | ||
export declare function register(connection: vscode.Connection, projects: Workspaces, initParams: vscode.InitializeParams, cancelHost: CancellactionTokenHost): void; | ||
export declare function register(connection: vscode.Connection, projects: Workspaces, initParams: vscode.InitializeParams, cancelHost: CancellationTokenHost): void; |
@@ -16,2 +16,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const shared = require("@volar/shared"); | ||
const registerFeatures_1 = require("../registerFeatures"); | ||
function register(connection, projects, initParams, cancelHost) { | ||
@@ -184,3 +185,3 @@ let lastCompleteUri; | ||
var _k; | ||
const result = (_k = yield (vueLs === null || vueLs === void 0 ? void 0 : vueLs.getSemanticTokens(params.textDocument.uri, undefined, token, tokens => resultProgress === null || resultProgress === void 0 ? void 0 : resultProgress.report(buildTokens(tokens))))) !== null && _k !== void 0 ? _k : []; | ||
const result = (_k = yield (vueLs === null || vueLs === void 0 ? void 0 : vueLs.getSemanticTokens(params.textDocument.uri, undefined, registerFeatures_1.semanticTokensLegend, token, tokens => resultProgress === null || resultProgress === void 0 ? void 0 : resultProgress.report(buildTokens(tokens))))) !== null && _k !== void 0 ? _k : []; | ||
return buildTokens(result); | ||
@@ -196,3 +197,3 @@ }))) !== null && _j !== void 0 ? _j : buildTokens([]); | ||
var _m; | ||
const result = (_m = yield (vueLs === null || vueLs === void 0 ? void 0 : vueLs.getSemanticTokens(params.textDocument.uri, params.range, token, tokens => resultProgress === null || resultProgress === void 0 ? void 0 : resultProgress.report(buildTokens(tokens))))) !== null && _m !== void 0 ? _m : []; | ||
const result = (_m = yield (vueLs === null || vueLs === void 0 ? void 0 : vueLs.getSemanticTokens(params.textDocument.uri, params.range, registerFeatures_1.semanticTokensLegend, token, tokens => resultProgress === null || resultProgress === void 0 ? void 0 : resultProgress.report(buildTokens(tokens))))) !== null && _m !== void 0 ? _m : []; | ||
return buildTokens(result); | ||
@@ -202,3 +203,3 @@ }))) !== null && _l !== void 0 ? _l : buildTokens([]); | ||
connection.languages.diagnostics.on((params, token, workDoneProgressReporter, resultProgressReporter) => __awaiter(this, void 0, void 0, function* () { | ||
token = cancelHost.createCancellactionToken(token); | ||
token = cancelHost.createCancellationToken(token); | ||
const result = yield worker(params.textDocument.uri, vueLs => { | ||
@@ -205,0 +206,0 @@ return vueLs.doValidation(params.textDocument.uri, token, errors => { |
@@ -77,2 +77,5 @@ import * as vscode from 'vscode-languageserver-protocol'; | ||
} | ||
export declare namespace ReportStats { | ||
const type: vscode.NotificationType0; | ||
} | ||
/** | ||
@@ -79,0 +82,0 @@ * FS request for browser |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FsReadDirectoryRequest = exports.FsReadFileRequest = exports.FsStatRequest = exports.GetVirtualFileRequest = exports.GetVirtualFileNamesRequest = exports.ReloadProjectNotification = exports.WriteVirtualFilesNotification = exports.VerifyAllScriptsNotification = exports.AutoInsertRequest = exports.GetMatchTsConfigRequest = exports.FindFileReferenceRequest = exports.ShowReferencesNotification = void 0; | ||
exports.FsReadDirectoryRequest = exports.FsReadFileRequest = exports.FsStatRequest = exports.ReportStats = exports.GetVirtualFileRequest = exports.GetVirtualFileNamesRequest = exports.ReloadProjectNotification = exports.WriteVirtualFilesNotification = exports.VerifyAllScriptsNotification = exports.AutoInsertRequest = exports.GetMatchTsConfigRequest = exports.FindFileReferenceRequest = exports.ShowReferencesNotification = void 0; | ||
const vscode = require("vscode-languageserver-protocol"); | ||
@@ -46,2 +46,6 @@ /** | ||
})(GetVirtualFileRequest = exports.GetVirtualFileRequest || (exports.GetVirtualFileRequest = {})); | ||
var ReportStats; | ||
(function (ReportStats) { | ||
ReportStats.type = new vscode.NotificationType0('vue/stats'); | ||
})(ReportStats = exports.ReportStats || (exports.ReportStats = {})); | ||
/** | ||
@@ -48,0 +52,0 @@ * FS request for browser |
import { LanguageServerPlugin, LanguageServerInitializationOptions } from './types'; | ||
import * as vscode from 'vscode-languageserver'; | ||
import { ClientCapabilities } from 'vscode-languageserver'; | ||
export declare const semanticTokensLegend: vscode.SemanticTokensLegend; | ||
export declare function setupSyntacticCapabilities(params: ClientCapabilities, server: vscode.ServerCapabilities): void; | ||
export declare function setupSemanticCapabilities(params: ClientCapabilities, server: vscode.ServerCapabilities, options: LanguageServerInitializationOptions, plugins: ReturnType<LanguageServerPlugin>[]): void; |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.setupSemanticCapabilities = exports.setupSyntacticCapabilities = void 0; | ||
exports.setupSemanticCapabilities = exports.setupSyntacticCapabilities = exports.semanticTokensLegend = void 0; | ||
const embedded = require("@volar/language-service"); | ||
const types_1 = require("./types"); | ||
const vscode = require("vscode-languageserver"); | ||
// https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#standard-token-types-and-modifiers | ||
exports.semanticTokensLegend = { | ||
tokenTypes: [ | ||
'namespace', | ||
'class', | ||
'enum', | ||
'interface', | ||
'struct', | ||
'typeParameter', | ||
'type', | ||
'parameter', | ||
'variable', | ||
'property', | ||
'enumMember', | ||
'decorator', | ||
'event', | ||
'function', | ||
'method', | ||
'macro', | ||
'label', | ||
'comment', | ||
'string', | ||
'keyword', | ||
'number', | ||
'regexp', | ||
'operator', | ||
], | ||
tokenModifiers: [ | ||
'declaration', | ||
'definition', | ||
'readonly', | ||
'static', | ||
'deprecated', | ||
'abstract', | ||
'async', | ||
'modification', | ||
'documentation', | ||
'defaultLibrary', | ||
], | ||
}; | ||
function setupSyntacticCapabilities(params, server) { | ||
@@ -39,3 +79,3 @@ var _a, _b, _c, _d, _e, _f, _g, _h; | ||
function setupSemanticCapabilities(params, server, options, plugins) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x; | ||
if ((_a = params.textDocument) === null || _a === void 0 ? void 0 : _a.references) { | ||
@@ -71,3 +111,7 @@ server.referencesProvider = true; | ||
{ pattern: { glob: '**/*.js' } }, | ||
{ pattern: { glob: '**/*.cjs' } }, | ||
{ pattern: { glob: '**/*.mjs' } }, | ||
{ pattern: { glob: '**/*.ts' } }, | ||
{ pattern: { glob: '**/*.cts' } }, | ||
{ pattern: { glob: '**/*.mts' } }, | ||
{ pattern: { glob: '**/*.jsx' } }, | ||
@@ -133,15 +177,6 @@ { pattern: { glob: '**/*.tsx' } }, | ||
full: false, | ||
legend: { | ||
tokenModifiers: [], | ||
tokenTypes: [], | ||
}, | ||
legend: exports.semanticTokensLegend, | ||
}; | ||
for (const plugin of plugins) { | ||
if ((_u = plugin.semanticService) === null || _u === void 0 ? void 0 : _u.semanticTokenLegend) { | ||
server.semanticTokensProvider.legend.tokenModifiers = server.semanticTokensProvider.legend.tokenModifiers.concat(plugin.semanticService.semanticTokenLegend.tokenModifiers); | ||
server.semanticTokensProvider.legend.tokenTypes = server.semanticTokensProvider.legend.tokenTypes.concat(plugin.semanticService.semanticTokenLegend.tokenTypes); | ||
} | ||
} | ||
} | ||
if ((_v = params.textDocument) === null || _v === void 0 ? void 0 : _v.codeAction) { | ||
if ((_u = params.textDocument) === null || _u === void 0 ? void 0 : _u.codeAction) { | ||
server.codeActionProvider = { | ||
@@ -162,6 +197,6 @@ codeActionKinds: [ | ||
} | ||
if ((_w = params.textDocument) === null || _w === void 0 ? void 0 : _w.inlayHint) { | ||
if ((_v = params.textDocument) === null || _v === void 0 ? void 0 : _v.inlayHint) { | ||
server.inlayHintProvider = true; | ||
} | ||
if (((_x = params.textDocument) === null || _x === void 0 ? void 0 : _x.diagnostic) && ((_y = options.diagnosticModel) !== null && _y !== void 0 ? _y : types_1.DiagnosticModel.Push) === types_1.DiagnosticModel.Pull) { | ||
if (((_w = params.textDocument) === null || _w === void 0 ? void 0 : _w.diagnostic) && ((_x = options.diagnosticModel) !== null && _x !== void 0 ? _x : types_1.DiagnosticModel.Push) === types_1.DiagnosticModel.Pull) { | ||
server.diagnosticProvider = { | ||
@@ -168,0 +203,0 @@ documentSelector: [ |
@@ -53,3 +53,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
(0, registerFeatures_1.setupSyntacticCapabilities)(params.capabilities, result.capabilities); | ||
yield createDocumenntServiceHost(); | ||
yield _createDocumentServiceHost(); | ||
if (serverMode === types_1.ServerMode.Semantic) { | ||
@@ -71,3 +71,3 @@ (0, registerFeatures_1.setupSemanticCapabilities)(params.capabilities, result.capabilities, options, plugins); | ||
connection.onInitialized(() => __awaiter(this, void 0, void 0, function* () { | ||
var _f; | ||
var _f, _g, _h; | ||
fsHost === null || fsHost === void 0 ? void 0 : fsHost.ready(connection); | ||
@@ -87,5 +87,21 @@ configHost === null || configHost === void 0 ? void 0 : configHost.ready(); | ||
} | ||
if ((_h = (_g = params.capabilities.workspace) === null || _g === void 0 ? void 0 : _g.didChangeWatchedFiles) === null || _h === void 0 ? void 0 : _h.dynamicRegistration) { | ||
connection.client.register(vscode.DidChangeWatchedFilesNotification.type, { | ||
watchers: [ | ||
...plugins.map(plugin => plugin.extraFileExtensions.map(ext => ({ globPattern: `**/*.${ext.extension}` }))).flat(), | ||
{ globPattern: '**/*.js' }, | ||
{ globPattern: '**/*.cjs' }, | ||
{ globPattern: '**/*.mjs' }, | ||
{ globPattern: '**/*.ts' }, | ||
{ globPattern: '**/*.cts' }, | ||
{ globPattern: '**/*.mts' }, | ||
{ globPattern: '**/*.jsx' }, | ||
{ globPattern: '**/*.tsx' }, | ||
{ globPattern: '**/*.json' }, | ||
] | ||
}); | ||
} | ||
})); | ||
connection.listen(); | ||
function createDocumenntServiceHost() { | ||
function _createDocumentServiceHost() { | ||
var _a, _b; | ||
@@ -110,3 +126,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
const tsLocalized = params.locale ? runtimeEnv.loadTypescriptLocalized(options.typescript.tsdk, params.locale) : undefined; | ||
const cancelTokenHost = (0, cancellationPipe_1.createCancellactionTokenHost)(options.cancellationPipeName); | ||
const cancelTokenHost = (0, cancellationPipe_1.createCancellationTokenHost)(options.cancellationPipeName); | ||
const _projects = (0, workspaces_1.createWorkspaces)(runtimeEnv, plugins, fsHost, configHost, ts, tsLocalized, params.capabilities, options, documents, connection, cancelTokenHost); | ||
@@ -113,0 +129,0 @@ projects = _projects; |
@@ -30,7 +30,6 @@ /// <reference types="node" /> | ||
semanticService?: { | ||
semanticTokenLegend?: vscode.SemanticTokensLegend; | ||
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, getLangaugeService: (uri: string) => Promise<C>): void; | ||
onInitialize?(connection: vscode.Connection, getLanguageService: (uri: string) => Promise<C>): void; | ||
}; | ||
@@ -37,0 +36,0 @@ syntacticService?: { |
import * as vscode from 'vscode-languageserver'; | ||
export type CancellactionTokenHost = ReturnType<typeof createCancellactionTokenHost>; | ||
export declare function createCancellactionTokenHost(_cancellationPipeName: string | undefined): { | ||
createCancellactionToken(original: vscode.CancellationToken): vscode.CancellationToken; | ||
export type CancellationTokenHost = ReturnType<typeof createCancellationTokenHost>; | ||
export declare function createCancellationTokenHost(_cancellationPipeName: string | undefined): { | ||
createCancellationToken(original: vscode.CancellationToken): vscode.CancellationToken; | ||
getMtime(): number; | ||
}; |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createCancellactionTokenHost = void 0; | ||
exports.createCancellationTokenHost = void 0; | ||
const vscode = require("vscode-languageserver"); | ||
function createCancellactionTokenHost(_cancellationPipeName) { | ||
function createCancellationTokenHost(_cancellationPipeName) { | ||
if (_cancellationPipeName === undefined) { | ||
return { | ||
createCancellactionToken(original) { | ||
createCancellationToken(original) { | ||
return original; | ||
@@ -18,6 +18,6 @@ }, | ||
return { | ||
createCancellactionToken, | ||
createCancellationToken, | ||
getMtime, | ||
}; | ||
function createCancellactionToken(original) { | ||
function createCancellationToken(original) { | ||
const mtime = getMtime(); | ||
@@ -44,3 +44,3 @@ const token = { | ||
} | ||
exports.createCancellactionTokenHost = createCancellactionTokenHost; | ||
exports.createCancellationTokenHost = createCancellationTokenHost; | ||
//# sourceMappingURL=cancellationPipe.js.map |
@@ -5,14 +5,19 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var _a; | ||
let configPath; | ||
try { | ||
const configPath = require.resolve('./volar.config.js', { paths: [dir] }); | ||
const config = require(configPath); | ||
// console.warn('Found', configPath, 'and loaded', config.plugins?.length, 'plugins.'); | ||
return (_a = config.plugins) !== null && _a !== void 0 ? _a : []; | ||
configPath = require.resolve('./volar.config.js', { paths: [dir] }); | ||
} | ||
catch (_b) { } | ||
try { | ||
if (configPath) { | ||
const config = require(configPath); | ||
return (_a = config.plugins) !== null && _a !== void 0 ? _a : []; | ||
} | ||
} | ||
catch (err) { | ||
// console.warn('No volar.config.js found in', dir); | ||
return []; | ||
console.log(err); | ||
} | ||
return []; | ||
} | ||
exports.loadCustomPlugins = loadCustomPlugins; | ||
//# sourceMappingURL=config.js.map |
@@ -0,1 +1,2 @@ | ||
import * as shared from '@volar/shared'; | ||
import * as embeddedLS from '@volar/language-service'; | ||
@@ -9,6 +10,50 @@ import type * as ts from 'typescript/lib/tsserverlibrary'; | ||
import * as path from 'typesafe-path'; | ||
import { CancellactionTokenHost } from './cancellationPipe'; | ||
import { CancellationTokenHost } from './cancellationPipe'; | ||
export interface Project extends ReturnType<typeof createProject> { | ||
} | ||
export declare function createProject(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, ts: typeof import('typescript/lib/tsserverlibrary'), rootUri: URI, tsConfig: path.PosixPath | ts.CompilerOptions, tsLocalized: ts.MapLike<string> | undefined, documents: ReturnType<typeof createSnapshots>, configHost: ConfigurationHost | undefined, documentRegistry: ts.DocumentRegistry | undefined, cancelTokenHost: CancellactionTokenHost, serverOptions: LanguageServerInitializationOptions): Promise<{ | ||
export declare function createProject(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, ts: typeof import('typescript/lib/tsserverlibrary'), rootUri: URI, tsConfig: path.PosixPath | ts.CompilerOptions, tsLocalized: ts.MapLike<string> | undefined, documents: ReturnType<typeof createSnapshots>, configHost: ConfigurationHost | undefined, documentRegistry: ts.DocumentRegistry | undefined, cancelTokenHost: CancellationTokenHost, serverOptions: LanguageServerInitializationOptions): Promise<{ | ||
tsConfig: ts.CompilerOptions | path.PosixPath; | ||
scripts: { | ||
clear: () => void; | ||
values: () => IterableIterator<{ | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}>; | ||
uriDelete: (_uri: string) => boolean; | ||
uriGet: (_uri: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
uriHas: (_uri: string) => boolean; | ||
uriSet: (_uri: string, item: { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}) => void; | ||
pathDelete: (rootUri: shared._2.URI, path: string) => boolean; | ||
pathGet: (rootUri: shared._2.URI, path: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
pathHas: (rootUri: shared._2.URI, path: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
pathSet: (rootUri: shared._2.URI, path: string, item: { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}) => void; | ||
}; | ||
languageServiceHost: embeddedLS.LanguageServiceHost; | ||
getLanguageService: () => { | ||
@@ -24,8 +69,5 @@ doValidation: (uri: string, token?: vscode.CancellationToken | undefined, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>; | ||
getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: embeddedLS.SemanticToken[]) => void) | undefined) => Promise<embeddedLS.SemanticToken[] | undefined> | undefined; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, cancelToken: vscode.CancellationToken, reportProgress?: ((tokens: embeddedLS.SemanticToken[]) => void) | undefined) => Promise<embeddedLS.SemanticToken[] | undefined> | undefined; | ||
doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{ | ||
isIncomplete: boolean; | ||
items: vscode.CompletionItem[]; | ||
}>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<vscode.CompletionList>; | ||
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>; | ||
@@ -68,8 +110,5 @@ doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>; | ||
getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: embeddedLS.SemanticToken[]) => void) | undefined) => Promise<embeddedLS.SemanticToken[] | undefined> | undefined; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, cancelToken: vscode.CancellationToken, reportProgress?: ((tokens: embeddedLS.SemanticToken[]) => void) | undefined) => Promise<embeddedLS.SemanticToken[] | undefined> | undefined; | ||
doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{ | ||
isIncomplete: boolean; | ||
items: vscode.CompletionItem[]; | ||
}>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<vscode.CompletionList>; | ||
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>; | ||
@@ -103,3 +142,4 @@ doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>; | ||
getParsedCommandLine: () => ts.ParsedCommandLine; | ||
tryAddFile: (fileName: string) => void; | ||
dispose: () => void; | ||
}>; |
@@ -37,5 +37,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return { | ||
tsConfig, | ||
scripts, | ||
languageServiceHost, | ||
getLanguageService, | ||
getLanguageServiceDontCreate: () => vueLs, | ||
getParsedCommandLine: () => parsedCommandLine, | ||
tryAddFile: (fileName) => { | ||
if (!parsedCommandLine.fileNames.includes(fileName)) { | ||
parsedCommandLine.fileNames.push(fileName); | ||
projectVersion++; | ||
} | ||
}, | ||
dispose, | ||
@@ -99,2 +108,3 @@ }; | ||
parsedCommandLine = createParsedCommandLine(ts, sys, shared.getPathOfUri(rootUri.toString()), tsConfig, plugins); | ||
projectVersion++; | ||
typeRootVersion++; | ||
@@ -212,3 +222,3 @@ } | ||
else { | ||
content = ts.parseJsonConfigFileContent({}, sys, rootPath, tsConfig, path.join(rootPath, 'jsconfig.json'), undefined, extraFileExtensions); | ||
content = ts.parseJsonConfigFileContent({ files: [] }, sys, rootPath, tsConfig, path.join(rootPath, 'jsconfig.json'), undefined, extraFileExtensions); | ||
} | ||
@@ -215,0 +225,0 @@ // fix https://github.com/johnsoncodehk/volar/issues/1786 |
@@ -6,3 +6,3 @@ import { TextDocument } from 'vscode-languageserver-textdocument'; | ||
interface IncrementalScriptSnapshotChange { | ||
applyed: boolean; | ||
applied: boolean; | ||
changeRange: ts.TextChangeRange | undefined; | ||
@@ -9,0 +9,0 @@ version: number; |
@@ -12,3 +12,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
{ | ||
applyed: true, | ||
applied: true, | ||
changeRange: undefined, | ||
@@ -28,3 +28,3 @@ version, | ||
{ | ||
applyed: true, | ||
applied: true, | ||
changeRange: undefined, | ||
@@ -70,3 +70,3 @@ version: params.textDocument.version, | ||
const lastChange = this.changes[this.changes.length - 1]; | ||
if (!lastChange.applyed) { | ||
if (!lastChange.applied) { | ||
this.applyVersionToRootDocument(lastChange.version, false); | ||
@@ -100,3 +100,3 @@ } | ||
} | ||
if (!change.applyed) { | ||
if (!change.applied) { | ||
if (change.contentChange) { | ||
@@ -112,3 +112,3 @@ change.changeRange = { | ||
} | ||
change.applyed = true; | ||
change.applied = true; | ||
} | ||
@@ -166,3 +166,3 @@ removeEnd = i + 1; | ||
incrementalSnapshot.changes.push({ | ||
applyed: false, | ||
applied: false, | ||
changeRange: undefined, | ||
@@ -169,0 +169,0 @@ contentChange, |
@@ -10,5 +10,5 @@ import * as shared from '@volar/shared'; | ||
import { ConfigurationHost } from '@volar/language-service'; | ||
import { CancellactionTokenHost } from './cancellationPipe'; | ||
import { CancellationTokenHost } from './cancellationPipe'; | ||
export declare const rootTsConfigNames: string[]; | ||
export declare function createWorkspaceProjects(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, rootUri: URI, ts: typeof import('typescript/lib/tsserverlibrary'), tsLocalized: ts.MapLike<string> | undefined, documents: ReturnType<typeof createSnapshots>, configHost: ConfigurationHost | undefined, cancelTokenHost: CancellactionTokenHost, serverOptions: LanguageServerInitializationOptions): Promise<{ | ||
export declare function createWorkspaceProjects(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, rootUri: URI, ts: typeof import('typescript/lib/tsserverlibrary'), tsLocalized: ts.MapLike<string> | undefined, documents: ReturnType<typeof createSnapshots>, configHost: ConfigurationHost | undefined, cancelTokenHost: CancellationTokenHost, serverOptions: LanguageServerInitializationOptions): Promise<{ | ||
projects: { | ||
@@ -26,5 +26,50 @@ clear: () => void; | ||
}; | ||
documentRegistry: ts.DocumentRegistry; | ||
getProjectAndTsConfig: (uri: string) => Promise<{ | ||
tsconfig: string; | ||
project: { | ||
tsConfig: ts.CompilerOptions | path.PosixPath; | ||
scripts: { | ||
clear: () => void; | ||
values: () => IterableIterator<{ | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}>; | ||
uriDelete: (_uri: string) => boolean; | ||
uriGet: (_uri: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
uriHas: (_uri: string) => boolean; | ||
uriSet: (_uri: string, item: { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}) => void; | ||
pathDelete: (rootUri: shared._2.URI, path: string) => boolean; | ||
pathGet: (rootUri: shared._2.URI, path: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
pathHas: (rootUri: shared._2.URI, path: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
pathSet: (rootUri: shared._2.URI, path: string, item: { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}) => void; | ||
}; | ||
languageServiceHost: import("@volar/language-service").LanguageServiceHost; | ||
getLanguageService: () => { | ||
@@ -40,8 +85,5 @@ doValidation: (uri: string, token?: vscode.CancellationToken | undefined, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>; | ||
getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, cancelToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{ | ||
isIncomplete: boolean; | ||
items: vscode.CompletionItem[]; | ||
}>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<vscode.CompletionList>; | ||
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>; | ||
@@ -84,8 +126,5 @@ doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>; | ||
getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, cancelToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{ | ||
isIncomplete: boolean; | ||
items: vscode.CompletionItem[]; | ||
}>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<vscode.CompletionList>; | ||
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>; | ||
@@ -119,2 +158,3 @@ doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>; | ||
getParsedCommandLine: () => ts.ParsedCommandLine; | ||
tryAddFile: (fileName: string) => void; | ||
dispose: () => void; | ||
@@ -124,2 +164,3 @@ }; | ||
getInferredProject: () => Project; | ||
getInferredProjectDontCreate: () => Project | undefined; | ||
reload: () => void; | ||
@@ -126,0 +167,0 @@ dispose(): void; |
@@ -55,4 +55,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
projects, | ||
documentRegistry, | ||
getProjectAndTsConfig, | ||
getInferredProject, | ||
getInferredProjectDontCreate: () => inferredProject, | ||
reload: clearProjects, | ||
@@ -59,0 +61,0 @@ dispose() { |
@@ -8,6 +8,7 @@ import * as shared from '@volar/shared'; | ||
import { createSnapshots } from './snapshots'; | ||
import { CancellactionTokenHost } from './cancellationPipe'; | ||
import * as path from 'typesafe-path'; | ||
import { CancellationTokenHost } from './cancellationPipe'; | ||
export interface Workspaces extends ReturnType<typeof createWorkspaces> { | ||
} | ||
export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, configurationHost: ConfigurationHost | undefined, ts: typeof import('typescript/lib/tsserverlibrary'), tsLocalized: ts.MapLike<string> | undefined, client: vscode.ClientCapabilities, options: LanguageServerInitializationOptions, documents: ReturnType<typeof createSnapshots>, connection: vscode.Connection, cancelTokenHost: CancellactionTokenHost): { | ||
export declare function createWorkspaces(runtimeEnv: RuntimeEnvironment, plugins: ReturnType<LanguageServerPlugin>[], fsHost: FileSystemHost, configurationHost: ConfigurationHost | undefined, ts: typeof import('typescript/lib/tsserverlibrary'), tsLocalized: ts.MapLike<string> | undefined, client: vscode.ClientCapabilities, options: LanguageServerInitializationOptions, documents: ReturnType<typeof createSnapshots>, connection: vscode.Connection, cancelTokenHost: CancellationTokenHost): { | ||
workspaces: Map<string, Promise<{ | ||
@@ -26,5 +27,50 @@ projects: { | ||
}; | ||
documentRegistry: ts.DocumentRegistry; | ||
getProjectAndTsConfig: (uri: string) => Promise<{ | ||
tsconfig: string; | ||
project: { | ||
tsConfig: ts.CompilerOptions | path.PosixPath; | ||
scripts: { | ||
clear: () => void; | ||
values: () => IterableIterator<{ | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}>; | ||
uriDelete: (_uri: string) => boolean; | ||
uriGet: (_uri: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
uriHas: (_uri: string) => boolean; | ||
uriSet: (_uri: string, item: { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}) => void; | ||
pathDelete: (rootUri: shared._2.URI, path: string) => boolean; | ||
pathGet: (rootUri: shared._2.URI, path: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
pathHas: (rootUri: shared._2.URI, path: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
pathSet: (rootUri: shared._2.URI, path: string, item: { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}) => void; | ||
}; | ||
languageServiceHost: import("@volar/language-service").LanguageServiceHost; | ||
getLanguageService: () => { | ||
@@ -40,8 +86,5 @@ doValidation: (uri: string, token?: vscode.CancellationToken | undefined, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>; | ||
getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, cancelToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{ | ||
isIncomplete: boolean; | ||
items: vscode.CompletionItem[]; | ||
}>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<vscode.CompletionList>; | ||
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>; | ||
@@ -84,8 +127,5 @@ doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>; | ||
getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, cancelToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{ | ||
isIncomplete: boolean; | ||
items: vscode.CompletionItem[]; | ||
}>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<vscode.CompletionList>; | ||
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>; | ||
@@ -119,2 +159,3 @@ doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>; | ||
getParsedCommandLine: () => ts.ParsedCommandLine; | ||
tryAddFile: (fileName: string) => void; | ||
dispose: () => void; | ||
@@ -124,2 +165,3 @@ }; | ||
getInferredProject: () => import("./project").Project; | ||
getInferredProjectDontCreate: () => import("./project").Project | undefined; | ||
reload: () => void; | ||
@@ -131,2 +173,46 @@ dispose(): void; | ||
project: { | ||
tsConfig: ts.CompilerOptions | path.PosixPath; | ||
scripts: { | ||
clear: () => void; | ||
values: () => IterableIterator<{ | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}>; | ||
uriDelete: (_uri: string) => boolean; | ||
uriGet: (_uri: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
uriHas: (_uri: string) => boolean; | ||
uriSet: (_uri: string, item: { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}) => void; | ||
pathDelete: (rootUri: shared._2.URI, path: string) => boolean; | ||
pathGet: (rootUri: shared._2.URI, path: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
pathHas: (rootUri: shared._2.URI, path: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
pathSet: (rootUri: shared._2.URI, path: string, item: { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}) => void; | ||
}; | ||
languageServiceHost: import("@volar/language-service").LanguageServiceHost; | ||
getLanguageService: () => { | ||
@@ -142,8 +228,5 @@ doValidation: (uri: string, token?: vscode.CancellationToken | undefined, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>; | ||
getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, cancelToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{ | ||
isIncomplete: boolean; | ||
items: vscode.CompletionItem[]; | ||
}>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<vscode.CompletionList>; | ||
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>; | ||
@@ -186,8 +269,5 @@ doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>; | ||
getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, cancelToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{ | ||
isIncomplete: boolean; | ||
items: vscode.CompletionItem[]; | ||
}>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<vscode.CompletionList>; | ||
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>; | ||
@@ -221,2 +301,3 @@ doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>; | ||
getParsedCommandLine: () => ts.ParsedCommandLine; | ||
tryAddFile: (fileName: string) => void; | ||
dispose: () => void; | ||
@@ -227,2 +308,46 @@ }; | ||
project: { | ||
tsConfig: ts.CompilerOptions | path.PosixPath; | ||
scripts: { | ||
clear: () => void; | ||
values: () => IterableIterator<{ | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}>; | ||
uriDelete: (_uri: string) => boolean; | ||
uriGet: (_uri: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
uriHas: (_uri: string) => boolean; | ||
uriSet: (_uri: string, item: { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}) => void; | ||
pathDelete: (rootUri: shared._2.URI, path: string) => boolean; | ||
pathGet: (rootUri: shared._2.URI, path: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
pathHas: (rootUri: shared._2.URI, path: string) => { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
} | undefined; | ||
pathSet: (rootUri: shared._2.URI, path: string, item: { | ||
version: number; | ||
fileName: string; | ||
snapshot: ts.IScriptSnapshot | undefined; | ||
snapshotVersion: number | undefined; | ||
}) => void; | ||
}; | ||
languageServiceHost: import("@volar/language-service").LanguageServiceHost; | ||
getLanguageService: () => { | ||
@@ -238,8 +363,5 @@ doValidation: (uri: string, token?: vscode.CancellationToken | undefined, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>; | ||
getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, cancelToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{ | ||
isIncomplete: boolean; | ||
items: vscode.CompletionItem[]; | ||
}>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<vscode.CompletionList>; | ||
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>; | ||
@@ -282,8 +404,5 @@ doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>; | ||
getEditsForFileRename: (oldUri: string, newUri: string) => Promise<vscode.WorkspaceEdit | undefined>; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
getSemanticTokens: (uri: string, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, cancelToken: vscode.CancellationToken, reportProgress?: ((tokens: import("@volar/language-service").SemanticToken[]) => void) | undefined) => Promise<import("@volar/language-service").SemanticToken[] | undefined> | undefined; | ||
doHover: (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<{ | ||
isIncomplete: boolean; | ||
items: vscode.CompletionItem[]; | ||
}>; | ||
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext | undefined) => Promise<vscode.CompletionList>; | ||
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext) => Promise<vscode.CodeAction[] | undefined>; | ||
@@ -317,2 +436,3 @@ doCodeActionResolve: (item: vscode.CodeAction) => Promise<vscode.CodeAction>; | ||
getParsedCommandLine: () => ts.ParsedCommandLine; | ||
tryAddFile: (fileName: string) => void; | ||
dispose: () => void; | ||
@@ -319,0 +439,0 @@ } | undefined; |
@@ -33,2 +33,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
else { | ||
onDriveFileUpdated(); | ||
} | ||
}); | ||
@@ -43,3 +46,5 @@ (_a = runtimeEnv.onDidChangeConfiguration) === null || _a === void 0 ? void 0 : _a.call(runtimeEnv, () => __awaiter(this, void 0, void 0, function* () { | ||
add: (rootUri) => { | ||
workspaces.set(rootUri.toString(), (0, workspaceProjects_1.createWorkspaceProjects)(runtimeEnv, plugins, fsHost, rootUri, ts, tsLocalized, documents, configurationHost, cancelTokenHost, options)); | ||
if (!workspaces.has(rootUri.toString())) { | ||
workspaces.set(rootUri.toString(), (0, workspaceProjects_1.createWorkspaceProjects)(runtimeEnv, plugins, fsHost, rootUri, ts, tsLocalized, documents, configurationHost, cancelTokenHost, options)); | ||
} | ||
}, | ||
@@ -92,3 +97,3 @@ remove: (rootUri) => { | ||
const delay = (_b = yield (configurationHost === null || configurationHost === void 0 ? void 0 : configurationHost.getConfiguration('volar.diagnostics.delay'))) !== null && _b !== void 0 ? _b : 200; | ||
const cancel = cancelTokenHost.createCancellactionToken({ | ||
const cancel = cancelTokenHost.createCancellationToken({ | ||
get isCancellationRequested() { | ||
@@ -115,2 +120,4 @@ return req !== documentUpdatedReq; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (cancel.isCancellationRequested) | ||
return; | ||
const project = (_a = (yield getProject(uri))) === null || _a === void 0 ? void 0 : _a.project; | ||
@@ -152,5 +159,7 @@ if (!project) | ||
if (rootUris.length) { | ||
const project = yield ((_a = (yield workspaces.get(rootUris[0]))) === null || _a === void 0 ? void 0 : _a.getInferredProject()); | ||
project === null || project === void 0 ? void 0 : project.tryAddFile(shared.getPathOfUri(uri)); | ||
return { | ||
tsconfig: undefined, | ||
project: yield ((_a = (yield workspaces.get(rootUris[0]))) === null || _a === void 0 ? void 0 : _a.getInferredProject()), | ||
project, | ||
}; | ||
@@ -157,0 +166,0 @@ } |
{ | ||
"name": "@volar/language-server", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"main": "out/index.js", | ||
@@ -20,5 +20,5 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/language-core": "1.0.8", | ||
"@volar/language-service": "1.0.8", | ||
"@volar/shared": "1.0.8", | ||
"@volar/language-core": "1.0.9", | ||
"@volar/language-service": "1.0.9", | ||
"@volar/shared": "1.0.9", | ||
"request-light": "^0.5.8", | ||
@@ -32,3 +32,3 @@ "typesafe-path": "^0.2.2", | ||
}, | ||
"gitHead": "10d1a6a8b4011adee0a7c309da25caae7fb4fea9" | ||
"gitHead": "be2081f56ce4608324795b8a0ae83c288a3a784d" | ||
} |
265902
5117
+ Added@volar/language-core@1.0.9(transitive)
+ Added@volar/language-service@1.0.9(transitive)
+ Added@volar/shared@1.0.9(transitive)
+ Added@volar/source-map@1.0.9(transitive)
+ Added@volar/transforms@1.0.9(transitive)
+ Added@volar/typescript-faster@1.0.9(transitive)
- Removed@volar/language-core@1.0.8(transitive)
- Removed@volar/language-service@1.0.8(transitive)
- Removed@volar/shared@1.0.8(transitive)
- Removed@volar/source-map@1.0.8(transitive)
- Removed@volar/transforms@1.0.8(transitive)
- Removed@volar/typescript-faster@1.0.8(transitive)
Updated@volar/language-core@1.0.9
Updated@volar/shared@1.0.9