From 0fc957e31be72c202d35b76a3e77c9d6810ffce1 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Wed, 26 Jun 2024 21:36:18 +0800 Subject: [PATCH] refactor(language-server): reorganize the code structure (#4507) --- extensions/vscode/package.json | 2 +- extensions/vscode/src/features/doctor.ts | 11 +- extensions/vscode/src/features/nameCasing.ts | 36 ++- .../vscode/src/features/splitEditors.ts | 18 +- package.json | 7 +- packages/component-meta/lib/base.ts | 3 + packages/component-meta/package.json | 2 +- packages/language-core/index.ts | 10 + packages/language-core/lib/languageModule.ts | 1 + packages/language-core/package.json | 3 +- packages/language-plugin-pug/package.json | 4 +- packages/language-server/index.ts | 5 +- .../language-server/lib/hybridModeProject.ts | 56 ++-- packages/language-server/lib/initialize.ts | 80 ++++++ packages/language-server/lib/protocol.ts | 51 ---- packages/language-server/node.ts | 190 +++--------- packages/language-server/package.json | 4 +- packages/language-service/index.ts | 202 ++++++++----- .../lib/plugins/vue-autoinsert-dotvalue.ts | 1 + .../lib/plugins/vue-document-drop.ts | 10 +- .../lib/plugins/vue-template.ts | 37 ++- packages/language-service/package.json | 24 +- .../tests/utils/createTester.ts | 7 +- .../language-service/tests/utils/format.ts | 8 +- packages/tsc/index.ts | 9 +- packages/tsc/package.json | 2 +- packages/typescript-plugin/package.json | 2 +- pnpm-lock.yaml | 270 +++++++++--------- 28 files changed, 549 insertions(+), 506 deletions(-) create mode 100644 packages/language-server/lib/initialize.ts delete mode 100644 packages/language-server/lib/protocol.ts diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index d494ac5e77..c09bb0757a 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -543,7 +543,7 @@ "devDependencies": { "@types/semver": "^7.5.3", "@types/vscode": "^1.82.0", - "@volar/vscode": "~2.3.4", + "@volar/vscode": "~2.4.0-alpha.0", "@vue/language-core": "2.0.22", "@vue/language-server": "2.0.22", "@vue/typescript-plugin": "2.0.22", diff --git a/extensions/vscode/src/features/doctor.ts b/extensions/vscode/src/features/doctor.ts index 86caa8344c..4f8e4fbc19 100644 --- a/extensions/vscode/src/features/doctor.ts +++ b/extensions/vscode/src/features/doctor.ts @@ -1,5 +1,5 @@ -import { BaseLanguageClient, getTsdk } from '@volar/vscode'; -import { ParseSFCRequest } from '@vue/language-server'; +import { BaseLanguageClient, getTsdk, ExecuteCommandRequest, ExecuteCommandParams } from '@volar/vscode'; +import { commands, SFCParseResult } from '@vue/language-server'; import * as semver from 'semver'; import * as vscode from 'vscode'; import { config } from '../config'; @@ -85,7 +85,12 @@ export async function register(context: vscode.ExtensionContext, client: BaseLan async function getProblems(fileUri: vscode.Uri) { const vueDoc = vscode.workspace.textDocuments.find(doc => doc.fileName === fileUri.fsPath); - const sfc = await (vueDoc ? client.sendRequest(ParseSFCRequest.type, vueDoc.getText()) : undefined); + const sfc: SFCParseResult = vueDoc + ? await client.sendRequest(ExecuteCommandRequest.type, { + command: commands.parseSfc, + arguments: [vueDoc.getText()], + } satisfies ExecuteCommandParams) + : undefined; const vueMod = getPackageJsonOfWorkspacePackage(fileUri.fsPath, 'vue'); const domMod = getPackageJsonOfWorkspacePackage(fileUri.fsPath, '@vue/runtime-dom'); const problems: { diff --git a/extensions/vscode/src/features/nameCasing.ts b/extensions/vscode/src/features/nameCasing.ts index e3ddc41fdc..40106388c3 100644 --- a/extensions/vscode/src/features/nameCasing.ts +++ b/extensions/vscode/src/features/nameCasing.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; import { quickPick } from '@volar/vscode/lib/common'; -import { BaseLanguageClient, State } from '@volar/vscode'; -import { AttrNameCasing, TagNameCasing, DetectNameCasingRequest, GetConvertAttrCasingEditsRequest, GetConvertTagCasingEditsRequest } from '@vue/language-server'; +import { BaseLanguageClient, ExecuteCommandParams, ExecuteCommandRequest, State, TextEdit } from '@volar/vscode'; +import { AttrNameCasing, TagNameCasing, commands } from '@vue/language-server'; import { config } from '../config'; export const attrNameCasings = new Map(); @@ -97,10 +97,13 @@ export async function activate(_context: vscode.ExtensionContext, client: BaseLa async function convertTag(editor: vscode.TextEditor, casing: TagNameCasing) { - const response = await client.sendRequest(GetConvertTagCasingEditsRequest.type, { - textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(editor.document), - casing, - }); + const response: TextEdit[] = await client.sendRequest(ExecuteCommandRequest.type, { + command: casing === TagNameCasing.Kebab + ? commands.convertTagsToKebabCase + : commands.convertTagsToPascalCase, + arguments: [client.code2ProtocolConverter.asUri(editor.document.uri)], + } satisfies ExecuteCommandParams); + const edits = await client.protocol2CodeConverter.asTextEdits(response); if (edits) { @@ -117,10 +120,13 @@ export async function activate(_context: vscode.ExtensionContext, client: BaseLa async function convertAttr(editor: vscode.TextEditor, casing: AttrNameCasing) { - const response = await client.sendRequest(GetConvertAttrCasingEditsRequest.type, { - textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(editor.document), - casing, - }); + const response: TextEdit[] = await client.sendRequest(ExecuteCommandRequest.type, { + command: casing === AttrNameCasing.Kebab + ? commands.convertPropsToKebabCase + : commands.convertPropsToCamelCase, + arguments: [client.code2ProtocolConverter.asUri(editor.document.uri)], + } satisfies ExecuteCommandParams); + const edits = await client.protocol2CodeConverter.asTextEdits(response); if (edits) { @@ -188,8 +194,14 @@ export async function activate(_context: vscode.ExtensionContext, client: BaseLa } } - function detect(document: vscode.TextDocument) { - return client.sendRequest(DetectNameCasingRequest.type, { textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document) }); + function detect(document: vscode.TextDocument): Promise<{ + tag: TagNameCasing[], + attr: AttrNameCasing[], + }> { + return client.sendRequest(ExecuteCommandRequest.type, { + command: commands.detectNameCasing, + arguments: [client.code2ProtocolConverter.asUri(document.uri)], + } satisfies ExecuteCommandParams); } function updateStatusBarText() { diff --git a/extensions/vscode/src/features/splitEditors.ts b/extensions/vscode/src/features/splitEditors.ts index c9737dd958..0e470d09e1 100644 --- a/extensions/vscode/src/features/splitEditors.ts +++ b/extensions/vscode/src/features/splitEditors.ts @@ -1,9 +1,9 @@ -import type { BaseLanguageClient } from '@volar/vscode'; -import { ParseSFCRequest } from '@vue/language-server'; +import { ExecuteCommandParams, ExecuteCommandRequest, type BaseLanguageClient } from '@volar/vscode'; +import { commands, type SFCParseResult } from '@vue/language-server'; import * as vscode from 'vscode'; import { config } from '../config'; -type SFCBlock = ParseSFCRequest.ResponseType['descriptor']['customBlocks'][number]; +type SFCBlock = SFCParseResult['descriptor']['customBlocks'][number]; export function register(context: vscode.ExtensionContext, client: BaseLanguageClient) { @@ -20,7 +20,10 @@ export function register(context: vscode.ExtensionContext, client: BaseLanguageC const layout = config.splitEditors.layout; const doc = editor.document; - const { descriptor } = await getDocDescriptor(doc.getText()); + const descriptor = (await getDocDescriptor(doc.getText()))?.descriptor; + if (!descriptor) { + return; + } let leftBlocks: SFCBlock[] = []; let rightBlocks: SFCBlock[] = []; @@ -96,14 +99,17 @@ export function register(context: vscode.ExtensionContext, client: BaseLanguageC function useDocDescriptor() { let splitDocText: string | undefined; - let splitDocDescriptor: any; + let splitDocDescriptor: SFCParseResult | undefined; return getDescriptor; async function getDescriptor(text: string) { if (text !== splitDocText) { splitDocText = text; - splitDocDescriptor = await client.sendRequest(ParseSFCRequest.type, text); + splitDocDescriptor = await client.sendRequest(ExecuteCommandRequest.type, { + command: commands.parseSfc, + arguments: [text], + } satisfies ExecuteCommandParams); } return splitDocDescriptor; } diff --git a/package.json b/package.json index 8643745788..57ce5ceef8 100644 --- a/package.json +++ b/package.json @@ -24,14 +24,9 @@ "@lerna-lite/publish": "latest", "@tsslint/cli": "latest", "@tsslint/config": "latest", - "@volar/language-service": "~2.3.4", + "@volar/language-service": "~2.4.0-alpha.0", "typescript": "latest", "vite": "latest", "vitest": "latest" - }, - "pnpm": { - "overrides": { - "vscode-html-languageservice": "npm:@johnsoncodehk/vscode-html-languageservice" - } } } diff --git a/packages/component-meta/lib/base.ts b/packages/component-meta/lib/base.ts index fe4f392ef3..489e9dffac 100644 --- a/packages/component-meta/lib/base.ts +++ b/packages/component-meta/lib/base.ts @@ -189,6 +189,9 @@ export function baseCreate( asScriptId: s => s, ...createLanguageServiceHost(ts, ts.sys, language, s => s, projectHost), }; + language.vue = { + compilerOptions: vueCompilerOptions, + }; const { languageServiceHost } = language.typescript; const tsLs = ts.createLanguageService(languageServiceHost); diff --git a/packages/component-meta/package.json b/packages/component-meta/package.json index c156036af1..6ac2177dc4 100644 --- a/packages/component-meta/package.json +++ b/packages/component-meta/package.json @@ -12,7 +12,7 @@ "directory": "packages/component-meta" }, "dependencies": { - "@volar/typescript": "~2.3.4", + "@volar/typescript": "~2.4.0-alpha.0", "@vue/language-core": "2.0.22", "path-browserify": "^1.0.1", "vue-component-type-helpers": "2.0.22" diff --git a/packages/language-core/index.ts b/packages/language-core/index.ts index 390a66f6aa..67983bda38 100644 --- a/packages/language-core/index.ts +++ b/packages/language-core/index.ts @@ -1,3 +1,5 @@ +import type { VueCompilerOptions } from './lib/types'; + export * from './lib/codegen/template'; export * from './lib/languageModule'; export * from './lib/parsers/scriptSetupRanges'; @@ -13,3 +15,11 @@ export { tsCodegen } from './lib/plugins/vue-tsx'; export * from '@volar/language-core'; export type * as CompilerDOM from '@vue/compiler-dom'; + +declare module '@volar/language-core' { + export interface Language { + vue?: { + compilerOptions: VueCompilerOptions; + }; + } +} diff --git a/packages/language-core/lib/languageModule.ts b/packages/language-core/lib/languageModule.ts index 770c834519..cd3fc6d4d3 100644 --- a/packages/language-core/lib/languageModule.ts +++ b/packages/language-core/lib/languageModule.ts @@ -8,6 +8,7 @@ import * as CompilerVue2 from './utils/vue2TemplateCompiler'; import useHtmlFilePlugin from './plugins/file-html'; import useMdFilePlugin from './plugins/file-md'; import useVueFilePlugin from './plugins/file-vue'; +import type * as _ from '@volar/typescript'; const normalFileRegistries: { key: string; diff --git a/packages/language-core/package.json b/packages/language-core/package.json index 38f004f8c8..e9a1358a14 100644 --- a/packages/language-core/package.json +++ b/packages/language-core/package.json @@ -12,7 +12,7 @@ "directory": "packages/language-core" }, "dependencies": { - "@volar/language-core": "~2.3.4", + "@volar/language-core": "~2.4.0-alpha.0", "@vue/compiler-dom": "^3.4.0", "@vue/shared": "^3.4.0", "computeds": "^0.0.1", @@ -25,6 +25,7 @@ "@types/minimatch": "^5.1.2", "@types/node": "latest", "@types/path-browserify": "^1.0.1", + "@volar/typescript": "~2.4.0-alpha.0", "@vue/compiler-sfc": "^3.4.0" }, "peerDependencies": { diff --git a/packages/language-plugin-pug/package.json b/packages/language-plugin-pug/package.json index 7ecb79f603..4b81cc1ef0 100644 --- a/packages/language-plugin-pug/package.json +++ b/packages/language-plugin-pug/package.json @@ -16,7 +16,7 @@ "@vue/language-core": "2.0.22" }, "dependencies": { - "@volar/source-map": "~2.3.4", - "volar-service-pug": "0.0.54" + "@volar/source-map": "~2.4.0-alpha.0", + "volar-service-pug": "0.0.55" } } diff --git a/packages/language-server/index.ts b/packages/language-server/index.ts index ca16716577..d92c980f11 100644 --- a/packages/language-server/index.ts +++ b/packages/language-server/index.ts @@ -1,9 +1,10 @@ -export * from './lib/protocol'; +export { commands } from '@vue/language-service'; export * from './lib/types'; +export * from './lib/initialize'; // export protocol and types of parent package -export * from '@volar/language-server/protocol'; export * from '@volar/language-server/lib/types'; +export * from '@volar/language-server/protocol'; // only export types of depend packages export * from '@vue/language-service/lib/types'; diff --git a/packages/language-server/lib/hybridModeProject.ts b/packages/language-server/lib/hybridModeProject.ts index 3e64588cd6..cfb46643bd 100644 --- a/packages/language-server/lib/hybridModeProject.ts +++ b/packages/language-server/lib/hybridModeProject.ts @@ -1,32 +1,24 @@ -import type { LanguagePlugin, LanguageServer, LanguageServerProject, ProviderResult } from '@volar/language-server'; +import type { Language, LanguagePlugin, LanguageServer, LanguageServerProject, ProviderResult } from '@volar/language-server'; import { createLanguageServiceEnvironment } from '@volar/language-server/lib/project/simpleProject'; import { createLanguage } from '@vue/language-core'; -import { Disposable, LanguageService, LanguageServiceEnvironment, createLanguageService, createUriMap } from '@vue/language-service'; -import { searchNamedPipeServerForFile, TypeScriptProjectHost } from '@vue/typescript-plugin/lib/utils'; -import type * as ts from 'typescript'; +import { createLanguageService, createUriMap, LanguageService } from '@vue/language-service'; +import { searchNamedPipeServerForFile } from '@vue/typescript-plugin/lib/utils'; import { URI } from 'vscode-uri'; -export type GetLanguagePlugin = (params: { - serviceEnv: LanguageServiceEnvironment, - asFileName: (scriptId: T) => string, - configFileName?: string, - projectHost?: TypeScriptProjectHost, - sys?: ts.System & { - version: number; - sync(): Promise; - } & Disposable, -}) => ProviderResult[]>; - export function createHybridModeProject( - sys: ts.System, - getLanguagePlugins: GetLanguagePlugin + create: (params: { + configFileName?: string; + asFileName: (scriptId: URI) => string; + }) => ProviderResult<{ + languagePlugins: LanguagePlugin[]; + setup?(language: Language): void; + }> ): LanguageServerProject { let initialized = false; let simpleLs: Promise | undefined; - let serviceEnv: LanguageServiceEnvironment | undefined; let server: LanguageServer; - const tsconfigProjects = createUriMap>(sys.useCaseSensitiveFileNames); + const tsconfigProjects = createUriMap>(); return { setup(_server) { @@ -44,30 +36,23 @@ export function createHybridModeProject( const tsconfigUri = URI.file(tsconfig); if (!tsconfigProjects.has(tsconfigUri)) { tsconfigProjects.set(tsconfigUri, (async () => { - serviceEnv ??= createLanguageServiceEnvironment(server, [...server.workspaceFolders.keys()]); - const languagePlugins = await getLanguagePlugins({ - serviceEnv, + const { languagePlugins, setup } = await create({ configFileName: tsconfig, - sys: { - ...sys, - version: 0, - async sync() { - return await 0; - }, - dispose() { }, - }, asFileName, }); - return createLs(server, serviceEnv, languagePlugins); + const languageService = createLs(server, languagePlugins); + setup?.(languageService.context.language); + return languageService; })()); } return await tsconfigProjects.get(tsconfigUri)!; } else { simpleLs ??= (async () => { - serviceEnv ??= createLanguageServiceEnvironment(server, [...server.workspaceFolders.keys()]); - const languagePlugins = await getLanguagePlugins({ serviceEnv, asFileName }); - return createLs(server, serviceEnv, languagePlugins); + const { languagePlugins, setup } = await create({ asFileName }); + const languageService = createLs(server, languagePlugins); + setup?.(languageService.context.language); + return languageService; })(); return await simpleLs; } @@ -109,7 +94,6 @@ export function createHybridModeProject( function createLs( server: LanguageServer, - serviceEnv: LanguageServiceEnvironment, languagePlugins: LanguagePlugin[] ) { const language = createLanguage([ @@ -128,7 +112,7 @@ export function createHybridModeProject( return createLanguageService( language, server.languageServicePlugins, - serviceEnv + createLanguageServiceEnvironment(server, [...server.workspaceFolders.keys()]) ); } } diff --git a/packages/language-server/lib/initialize.ts b/packages/language-server/lib/initialize.ts new file mode 100644 index 0000000000..dfb24bf321 --- /dev/null +++ b/packages/language-server/lib/initialize.ts @@ -0,0 +1,80 @@ +import { LanguageServer } from '@volar/language-server'; +import { createTypeScriptProject } from '@volar/language-server/node'; +import { createParsedCommandLine, createVueLanguagePlugin, FileMap, resolveVueCompilerOptions, VueCompilerOptions } from '@vue/language-core'; +import { Disposable, getFullLanguageServicePlugins, InitializeParams } from '@vue/language-service'; +import type * as ts from 'typescript'; + +export function initialize( + server: LanguageServer, + params: InitializeParams, + ts: typeof import('typescript'), + tsLocalized: ts.MapLike | undefined +) { + const watchingExtensions = new Set(); + let fileWatcher: Promise | undefined; + + return server.initialize( + params, + createTypeScriptProject( + ts, + tsLocalized, + async ({ configFileName, sys, projectHost, asFileName }) => { + let vueCompilerOptions: VueCompilerOptions; + if (configFileName) { + let commandLine = createParsedCommandLine(ts, sys, configFileName); + let sysVersion = sys.version; + let newSysVersion = await sys.sync(); + while (sysVersion !== newSysVersion) { + commandLine = createParsedCommandLine(ts, sys, configFileName); + sysVersion = newSysVersion; + newSysVersion = await sys.sync(); + } + vueCompilerOptions = commandLine.vueOptions; + } + else { + vueCompilerOptions = resolveVueCompilerOptions({}); + } + updateFileWatcher(vueCompilerOptions); + return { + languagePlugins: [createVueLanguagePlugin( + ts, + asFileName, + () => projectHost?.getProjectVersion?.() ?? '', + fileName => { + const fileMap = new FileMap(sys?.useCaseSensitiveFileNames ?? false); + for (const vueFileName of projectHost?.getScriptFileNames() ?? []) { + fileMap.set(vueFileName, undefined); + } + return fileMap.has(fileName); + }, + projectHost.getCompilationSettings(), + vueCompilerOptions + )], + setup(language) { + language.vue = { + compilerOptions: vueCompilerOptions, + }; + }, + }; + } + ), + getFullLanguageServicePlugins(ts) + ); + + function updateFileWatcher(vueCompilerOptions: VueCompilerOptions) { + const extensions = [ + 'js', 'cjs', 'mjs', 'ts', 'cts', 'mts', 'jsx', 'tsx', 'json', + ...vueCompilerOptions.extensions.map(ext => ext.slice(1)), + ...vueCompilerOptions.vitePressExtensions.map(ext => ext.slice(1)), + ...vueCompilerOptions.petiteVueExtensions.map(ext => ext.slice(1)), + ]; + const newExtensions = extensions.filter(ext => !watchingExtensions.has(ext)); + if (newExtensions.length) { + for (const ext of newExtensions) { + watchingExtensions.add(ext); + } + fileWatcher?.then(dispose => dispose.dispose()); + fileWatcher = server.watchFiles(['**/*.{' + [...watchingExtensions].join(',') + '}']); + } + } +} diff --git a/packages/language-server/lib/protocol.ts b/packages/language-server/lib/protocol.ts deleted file mode 100644 index d85d71f2a8..0000000000 --- a/packages/language-server/lib/protocol.ts +++ /dev/null @@ -1,51 +0,0 @@ -import type { AttrNameCasing, SFCParseResult, TagNameCasing } from '@vue/language-service'; -import * as vscode from 'vscode-languageserver-protocol'; - -export namespace DetectNameCasingRequest { - export type ParamsType = { - textDocument: vscode.TextDocumentIdentifier, - }; - export type ResponseType = { - tag: TagNameCasing[], - attr: AttrNameCasing[], - } | null | undefined; - export type ErrorType = never; - export const type = new vscode.RequestType('vue/detectTagCasing'); -} - -export namespace GetConvertTagCasingEditsRequest { - export type ParamsType = { - textDocument: vscode.TextDocumentIdentifier, - casing: TagNameCasing, - }; - export type ResponseType = vscode.TextEdit[] | null | undefined; - export type ErrorType = never; - export const type = new vscode.RequestType('vue/convertTagNameCasing'); -} - -export namespace GetConvertAttrCasingEditsRequest { - export type ParamsType = { - textDocument: vscode.TextDocumentIdentifier, - casing: AttrNameCasing, - }; - export type ResponseType = vscode.TextEdit[] | null | undefined; - export type ErrorType = never; - export const type = new vscode.RequestType('vue/convertPropNameCasing'); -} - -export namespace ParseSFCRequest { - export type ParamsType = string; - export type ResponseType = SFCParseResult; - export type ErrorType = never; - export const type = new vscode.RequestType('vue/parseSfc'); -} - -export namespace GetConnectedNamedPipeServerRequest { - export type ParamsType = string; - export type ResponseType = { - path: string, - serverKind: number, - } | undefined; - export type ErrorType = never; - export const type = new vscode.RequestType('vue/namedPipeServer'); -} diff --git a/packages/language-server/node.ts b/packages/language-server/node.ts index ac7e818d28..5c2a1f24fa 100644 --- a/packages/language-server/node.ts +++ b/packages/language-server/node.ts @@ -1,161 +1,57 @@ -import type { Connection } from '@volar/language-server'; -import { createConnection, createServer, createTypeScriptProject, loadTsdkByPath } from '@volar/language-server/node'; -import { FileMap, ParsedCommandLine, VueCompilerOptions, createParsedCommandLine, createVueLanguagePlugin, parse, resolveVueCompilerOptions } from '@vue/language-core'; -import { LanguageServiceEnvironment, convertAttrName, convertTagName, createDefaultGetTsPluginClient, detect, getVueLanguageServicePlugins } from '@vue/language-service'; -import * as tsPluginClient from '@vue/typescript-plugin/lib/client'; -import { searchNamedPipeServerForFile } from '@vue/typescript-plugin/lib/utils'; -import { URI } from 'vscode-uri'; -import { GetLanguagePlugin, createHybridModeProject } from './lib/hybridModeProject'; -import { DetectNameCasingRequest, GetConnectedNamedPipeServerRequest, GetConvertAttrCasingEditsRequest, GetConvertTagCasingEditsRequest, ParseSFCRequest } from './lib/protocol'; +import { createConnection, createServer, loadTsdkByPath } from '@volar/language-server/node'; +import { createParsedCommandLine, createVueLanguagePlugin, resolveVueCompilerOptions } from '@vue/language-core'; +import { getHybridModeLanguageServicePlugins } from '@vue/language-service'; +import * as namedPipeClient from '@vue/typescript-plugin/lib/client'; +import { createHybridModeProject } from './lib/hybridModeProject'; +import { initialize } from './lib/initialize'; import type { VueInitializationOptions } from './lib/types'; -let tsdk: ReturnType; -let hybridMode: boolean; -let getTsPluginClient: ReturnType; - -const envToVueOptions = new WeakMap(); -const watchedExtensions = new Set(); - -export const connection: Connection = createConnection(); - -export const server = createServer(connection); - -export const getLanguagePlugins: GetLanguagePlugin = async ({ serviceEnv, configFileName, projectHost, sys, asFileName }) => { - const commandLine = await parseCommandLine(); - const vueOptions = commandLine?.vueOptions ?? resolveVueCompilerOptions({}); - const vueLanguagePlugin = createVueLanguagePlugin( - tsdk.typescript, - asFileName, - () => projectHost?.getProjectVersion?.() ?? '', - fileName => { - const fileMap = new FileMap(sys?.useCaseSensitiveFileNames ?? false); - for (const vueFileName of projectHost?.getScriptFileNames() ?? []) { - fileMap.set(vueFileName, undefined); - } - return fileMap.has(fileName); - }, - commandLine?.options ?? {}, - vueOptions - ); - if (!hybridMode) { - const extensions = [ - 'js', 'cjs', 'mjs', 'ts', 'cts', 'mts', 'jsx', 'tsx', 'json', - ...vueOptions.extensions.map(ext => ext.slice(1)), - ...vueOptions.vitePressExtensions.map(ext => ext.slice(1)), - ...vueOptions.petiteVueExtensions.map(ext => ext.slice(1)), - ]; - const newExtensions = extensions.filter(ext => !watchedExtensions.has(ext)); - if (newExtensions.length) { - for (const ext of newExtensions) { - watchedExtensions.add(ext); - } - server.watchFiles(['**/*.{' + newExtensions.join(',') + '}']); - } - } - - envToVueOptions.set(serviceEnv, vueOptions); - - return [vueLanguagePlugin]; - - async function parseCommandLine() { - let commandLine: ParsedCommandLine | undefined; - let sysVersion: number | undefined; - if (sys) { - let newSysVersion = await sys.sync(); - while (sysVersion !== newSysVersion) { - sysVersion = newSysVersion; - if (configFileName) { - commandLine = createParsedCommandLine(tsdk.typescript, sys, configFileName); - } - newSysVersion = await sys.sync(); - } - } - return commandLine; - } -}; +const connection = createConnection(); +const server = createServer(connection); connection.listen(); connection.onInitialize(params => { const options: VueInitializationOptions = params.initializationOptions; - - hybridMode = options.vue?.hybridMode ?? true; - tsdk = loadTsdkByPath(options.typescript.tsdk, params.locale); - + const { typescript: ts, diagnosticMessages } = loadTsdkByPath(options.typescript.tsdk, params.locale); + const hybridMode = options.vue?.hybridMode ?? true; if (hybridMode) { - getTsPluginClient = () => tsPluginClient; + return server.initialize( + params, + createHybridModeProject( + ({ asFileName, configFileName }) => { + const commandLine = configFileName + ? createParsedCommandLine(ts, ts.sys, configFileName) + : { + vueOptions: resolveVueCompilerOptions({}), + options: ts.getDefaultCompilerOptions(), + }; + return { + languagePlugins: [createVueLanguagePlugin( + ts, + asFileName, + () => '', + () => false, + commandLine.options, + commandLine.vueOptions + )], + setup(language) { + language.vue = { + compilerOptions: commandLine.vueOptions, + }; + }, + }; + } + ), + getHybridModeLanguageServicePlugins(ts, namedPipeClient), + { pullModelDiagnostics: true } + ); } else { - getTsPluginClient = createDefaultGetTsPluginClient(tsdk.typescript); - } - - const result = server.initialize( - params, - hybridMode - ? createHybridModeProject(tsdk.typescript.sys, getLanguagePlugins) - : createTypeScriptProject(tsdk.typescript, tsdk.diagnosticMessages, (env, ctx) => getLanguagePlugins({ - serviceEnv: env, - configFileName: ctx.configFileName, - projectHost: ctx.projectHost, - sys: ctx.sys, - asFileName: ctx.asFileName, - })), - getVueLanguageServicePlugins( - tsdk.typescript, - env => envToVueOptions.get(env)!, - getTsPluginClient, - hybridMode - ), - { - pullModelDiagnostics: hybridMode, - } - ); - if (hybridMode) { - // provided by tsserver + @vue/typescript-plugin - result.capabilities.semanticTokensProvider = undefined; + return initialize(server, params, ts, diagnosticMessages); } - return result; }); -connection.onInitialized(() => { - server.initialized(); -}); - -connection.onShutdown(() => { - server.shutdown(); -}); - -connection.onRequest(ParseSFCRequest.type, params => { - return parse(params); -}); - -connection.onRequest(DetectNameCasingRequest.type, async params => { - const uri = URI.parse(params.textDocument.uri); - const languageService = await server.project.getLanguageService(uri); - if (languageService) { - return await detect(languageService.context, uri); - } -}); +connection.onInitialized(server.initialized); -connection.onRequest(GetConvertTagCasingEditsRequest.type, async params => { - const uri = URI.parse(params.textDocument.uri); - const languageService = await server.project.getLanguageService(uri); - if (languageService) { - return await convertTagName(languageService.context, uri, params.casing, getTsPluginClient(languageService.context)); - } -}); - -connection.onRequest(GetConvertAttrCasingEditsRequest.type, async params => { - const uri = URI.parse(params.textDocument.uri); - const languageService = await server.project.getLanguageService(uri); - if (languageService) { - return await convertAttrName(languageService.context, uri, params.casing, getTsPluginClient(languageService.context)); - } -}); - -connection.onRequest(GetConnectedNamedPipeServerRequest.type, async fileName => { - const server = (await searchNamedPipeServerForFile(fileName))?.server; - if (server) { - return server; - } -}); +connection.onShutdown(server.shutdown); diff --git a/packages/language-server/package.json b/packages/language-server/package.json index fd29fde0fb..a6a2154ce5 100644 --- a/packages/language-server/package.json +++ b/packages/language-server/package.json @@ -15,8 +15,8 @@ "directory": "packages/language-server" }, "dependencies": { - "@volar/language-core": "~2.3.4", - "@volar/language-server": "~2.3.4", + "@volar/language-core": "~2.4.0-alpha.0", + "@volar/language-server": "~2.4.0-alpha.0", "@vue/language-core": "2.0.22", "@vue/language-service": "2.0.22", "@vue/typescript-plugin": "2.0.22", diff --git a/packages/language-service/index.ts b/packages/language-service/index.ts index 43e51b6331..e1c8f0d9e0 100644 --- a/packages/language-service/index.ts +++ b/packages/language-service/index.ts @@ -3,8 +3,8 @@ export * from '@vue/language-core'; export * from './lib/ideFeatures/nameCasing'; export * from './lib/types'; -import type { LanguageServicePlugin, LanguageServiceContext, LanguageServiceEnvironment } from '@volar/language-service'; -import type { VueCompilerOptions } from './lib/types'; +import type { LanguageServiceContext, LanguageServicePlugin } from '@volar/language-service'; +import { AttrNameCasing, TagNameCasing } from './lib/types'; import { create as createEmmetPlugin } from 'volar-service-emmet'; import { create as createJsonPlugin } from 'volar-service-json'; @@ -26,6 +26,7 @@ import { create as createVueToggleVBindPlugin } from './lib/plugins/vue-toggle-v import { create as createVueTwoslashQueriesPlugin } from './lib/plugins/vue-twoslash-queries'; import { create as createVueVisualizeHiddenCallbackParamPlugin } from './lib/plugins/vue-visualize-hidden-callback-param'; +import { parse } from '@vue/language-core'; import { decorateLanguageServiceForVue } from '@vue/typescript-plugin/lib/common'; import { collectExtractProps } from '@vue/typescript-plugin/lib/requests/collectExtractProps'; import { getComponentEvents, getComponentNames, getComponentProps, getElementAttrs, getTemplateContextProps } from '@vue/typescript-plugin/lib/requests/componentInfos'; @@ -34,78 +35,46 @@ import { getPropertiesAtLocation } from '@vue/typescript-plugin/lib/requests/get import { getQuickInfoAtPosition } from '@vue/typescript-plugin/lib/requests/getQuickInfoAtPosition'; import type { RequestContext } from '@vue/typescript-plugin/lib/requests/types'; import { URI } from 'vscode-uri'; +import { convertAttrName, convertTagName, detect } from './lib/ideFeatures/nameCasing'; -export function getVueLanguageServicePlugins( - ts: typeof import('typescript'), - getVueOptions: (env: LanguageServiceEnvironment) => VueCompilerOptions, - getTsPluginClient = createDefaultGetTsPluginClient(ts), - hybridMode = false -): LanguageServicePlugin[] { - const plugins: LanguageServicePlugin[] = []; - if (!hybridMode) { - plugins.push(...createTypeScriptPlugins(ts)); - for (let i = 0; i < plugins.length; i++) { - const plugin = plugins[i]; - if (plugin.name === 'typescript-semantic') { - plugins[i] = { - ...plugin, - create(context) { - const created = plugin.create(context); - if (!context.language.typescript) { - return created; - } - const languageService = (created.provide as import('volar-service-typescript').Provide)['typescript/languageService'](); - const vueOptions = getVueOptions(context.env); +export function getFullLanguageServicePlugins(ts: typeof import('typescript')): LanguageServicePlugin[] { + const plugins: LanguageServicePlugin[] = [ + ...createTypeScriptPlugins(ts), + ...getCommonLanguageServicePlugins( + ts, + getTsPluginClientForLSP + ) + ]; + for (let i = 0; i < plugins.length; i++) { + const plugin = plugins[i]; + if (plugin.name === 'typescript-semantic') { + plugins[i] = { + ...plugin, + create(context) { + const created = plugin.create(context); + if (!context.language.typescript) { + return created; + } + const languageService = (created.provide as import('volar-service-typescript').Provide)['typescript/languageService'](); + if (context.language.vue) { decorateLanguageServiceForVue( context.language, languageService, - vueOptions, + context.language.vue.compilerOptions, ts, false, - fileName => context.language.typescript?.asScriptId(fileName) ?? URI.file(fileName) + context.language.typescript.asScriptId ); - return created; - }, - }; - break; - } + } + return created; + }, + }; + break; } } - else { - plugins.push( - createTypeScriptSyntacticPlugin(ts), - createTypeScriptDocCommentTemplatePlugin(ts) - ); - } - plugins.push( - createTypeScriptTwoslashQueriesPlugin(ts), - createCssPlugin(), - createPugFormatPlugin(), - createJsonPlugin(), - createVueTemplatePlugin('html', ts, getVueOptions, getTsPluginClient), - createVueTemplatePlugin('pug', ts, getVueOptions, getTsPluginClient), - createVueSfcPlugin(), - createVueTwoslashQueriesPlugin(ts, getTsPluginClient), - createVueDocumentLinksPlugin(), - createVueDocumentDropPlugin(ts, getVueOptions, getTsPluginClient), - createVueAutoDotValuePlugin(ts, getTsPluginClient), - createVueAutoAddSpacePlugin(), - createVueVisualizeHiddenCallbackParamPlugin(), - createVueDirectiveCommentsPlugin(), - createVueExtractFilePlugin(ts, getTsPluginClient), - createVueToggleVBindPlugin(ts), - createEmmetPlugin({ - mappedLanguages: { - 'vue': 'html', - 'postcss': 'scss', - }, - }) - ); return plugins; -} -export function createDefaultGetTsPluginClient(ts: typeof import('typescript')): (context: LanguageServiceContext) => typeof import('@vue/typescript-plugin/lib/client') | undefined { - return context => { + function getTsPluginClientForLSP(context: LanguageServiceContext): typeof import('@vue/typescript-plugin/lib/client') | undefined { if (!context.language.typescript) { return; } @@ -150,5 +119,110 @@ export function createDefaultGetTsPluginClient(ts: typeof import('typescript')): return await getQuickInfoAtPosition.apply(requestContext, args); }, }; - }; + } +} + +export function getHybridModeLanguageServicePlugins( + ts: typeof import('typescript'), + getTsPluginClient: typeof import("@vue/typescript-plugin/lib/client") +): LanguageServicePlugin[] { + const plugins = [ + createTypeScriptSyntacticPlugin(ts), + createTypeScriptDocCommentTemplatePlugin(ts), + ...getCommonLanguageServicePlugins(ts, () => getTsPluginClient) + ]; + for (const plugin of plugins) { + // avoid affecting TS plugin + delete plugin.capabilities.semanticTokensProvider; + } + return plugins; +} + +export const commands = { + parseSfc: 'vue.parseSfc', + detectNameCasing: 'vue.detectNameCasing', + convertTagsToKebabCase: 'vue.convertTagsToKebabCase', + convertTagsToPascalCase: 'vue.convertTagsToPascalCase', + convertPropsToKebabCase: 'vue.convertPropsToKebabCase', + convertPropsToCamelCase: 'vue.convertPropsToCamelCase', +}; + +function getCommonLanguageServicePlugins( + ts: typeof import('typescript'), + getTsPluginClient: (context: LanguageServiceContext) => typeof import('@vue/typescript-plugin/lib/client') | undefined +): LanguageServicePlugin[] { + return [ + createTypeScriptTwoslashQueriesPlugin(ts), + createCssPlugin(), + createPugFormatPlugin(), + createJsonPlugin(), + createVueTemplatePlugin('html', ts, getTsPluginClient), + createVueTemplatePlugin('pug', ts, getTsPluginClient), + createVueSfcPlugin(), + createVueTwoslashQueriesPlugin(ts, getTsPluginClient), + createVueDocumentLinksPlugin(), + createVueDocumentDropPlugin(ts, getTsPluginClient), + createVueAutoDotValuePlugin(ts, getTsPluginClient), + createVueAutoAddSpacePlugin(), + createVueVisualizeHiddenCallbackParamPlugin(), + createVueDirectiveCommentsPlugin(), + createVueExtractFilePlugin(ts, getTsPluginClient), + createVueToggleVBindPlugin(ts), + createEmmetPlugin({ + mappedLanguages: { + 'vue': 'html', + 'postcss': 'scss', + }, + }), + { + name: 'vue-parse-sfc', + capabilities: { + executeCommandProvider: { + commands: [commands.parseSfc], + }, + }, + create() { + return { + executeCommand(_command, [source]) { + return parse(source); + }, + }; + }, + }, + { + name: 'vue-name-casing', + capabilities: { + executeCommandProvider: { + commands: [ + commands.detectNameCasing, + commands.convertTagsToKebabCase, + commands.convertTagsToPascalCase, + commands.convertPropsToKebabCase, + commands.convertPropsToCamelCase, + ], + } + }, + create(context) { + return { + executeCommand(command, [uri]) { + if (command === commands.detectNameCasing) { + return detect(context, URI.parse(uri)); + } + else if (command === commands.convertTagsToKebabCase) { + return convertTagName(context, URI.parse(uri), TagNameCasing.Kebab, getTsPluginClient(context)); + } + else if (command === commands.convertTagsToPascalCase) { + return convertTagName(context, URI.parse(uri), TagNameCasing.Pascal, getTsPluginClient(context)); + } + else if (command === commands.convertPropsToKebabCase) { + return convertAttrName(context, URI.parse(uri), AttrNameCasing.Kebab, getTsPluginClient(context)); + } + else if (command === commands.convertPropsToCamelCase) { + return convertAttrName(context, URI.parse(uri), AttrNameCasing.Camel, getTsPluginClient(context)); + } + }, + }; + }, + } + ]; } diff --git a/packages/language-service/lib/plugins/vue-autoinsert-dotvalue.ts b/packages/language-service/lib/plugins/vue-autoinsert-dotvalue.ts index 21c78abecb..aeece4f564 100644 --- a/packages/language-service/lib/plugins/vue-autoinsert-dotvalue.ts +++ b/packages/language-service/lib/plugins/vue-autoinsert-dotvalue.ts @@ -3,6 +3,7 @@ import { hyphenateAttr } from '@vue/language-core'; import type * as ts from 'typescript'; import type { TextDocument } from 'vscode-languageserver-textdocument'; import { URI } from 'vscode-uri'; +import * as _ from '@volar/typescript'; const asts = new WeakMap(); diff --git a/packages/language-service/lib/plugins/vue-document-drop.ts b/packages/language-service/lib/plugins/vue-document-drop.ts index 45bb58adc0..80ad116e16 100644 --- a/packages/language-service/lib/plugins/vue-document-drop.ts +++ b/packages/language-service/lib/plugins/vue-document-drop.ts @@ -1,15 +1,14 @@ -import { VueCompilerOptions, VueVirtualCode, forEachEmbeddedCode } from '@vue/language-core'; +import { VueVirtualCode, forEachEmbeddedCode } from '@vue/language-core'; import { camelize, capitalize, hyphenate } from '@vue/shared'; import * as path from 'path-browserify'; import { getUserPreferences } from 'volar-service-typescript/lib/configs/getUserPreferences'; import type * as vscode from 'vscode-languageserver-protocol'; import { URI } from 'vscode-uri'; import { createAddComponentToOptionEdit, getLastImportNode } from '../plugins/vue-extract-file'; -import { LanguageServiceContext, LanguageServiceEnvironment, LanguageServicePlugin, LanguageServicePluginInstance, TagNameCasing } from '../types'; +import { LanguageServiceContext, LanguageServicePlugin, LanguageServicePluginInstance, TagNameCasing } from '../types'; export function create( ts: typeof import('typescript'), - getVueOptions: (env: LanguageServiceEnvironment) => VueCompilerOptions, getTsPluginClient?: (context: LanguageServiceContext) => typeof import('@vue/typescript-plugin/lib/client') | undefined ): LanguageServicePlugin { return { @@ -18,11 +17,14 @@ export function create( // documentDropEditsProvider: true, }, create(context): LanguageServicePluginInstance { + if (!context.language.vue) { + return {}; + } let casing = TagNameCasing.Pascal as TagNameCasing; // TODO const tsPluginClient = getTsPluginClient?.(context); - const vueCompilerOptions = getVueOptions(context.env); + const vueCompilerOptions = context.language.vue.compilerOptions; return { async provideDocumentDropEdits(document, _position, dataTransfer) { diff --git a/packages/language-service/lib/plugins/vue-template.ts b/packages/language-service/lib/plugins/vue-template.ts index cc67094f89..597b78627e 100644 --- a/packages/language-service/lib/plugins/vue-template.ts +++ b/packages/language-service/lib/plugins/vue-template.ts @@ -1,16 +1,16 @@ -import type { Disposable, LanguageServiceContext, LanguageServiceEnvironment, LanguageServicePluginInstance } from '@volar/language-service'; -import { VueVirtualCode, hyphenateAttr, hyphenateTag, parseScriptSetupRanges, tsCodegen } from '@vue/language-core'; +import type { Disposable, LanguageServiceContext, LanguageServicePluginInstance } from '@volar/language-service'; +import { VueCompilerOptions, VueVirtualCode, hyphenateAttr, hyphenateTag, parseScriptSetupRanges, tsCodegen } from '@vue/language-core'; import { camelize, capitalize, hyphenate } from '@vue/shared'; +import { getComponentSpans } from '@vue/typescript-plugin/lib/common'; import { create as createHtmlService } from 'volar-service-html'; import { create as createPugService } from 'volar-service-pug'; import * as html from 'vscode-html-languageservice'; import type * as vscode from 'vscode-languageserver-protocol'; import type { TextDocument } from 'vscode-languageserver-textdocument'; +import { URI, Utils } from 'vscode-uri'; import { getNameCasing } from '../ideFeatures/nameCasing'; -import { AttrNameCasing, LanguageServicePlugin, TagNameCasing, VueCompilerOptions } from '../types'; +import { AttrNameCasing, LanguageServicePlugin, TagNameCasing } from '../types'; import { loadModelModifiersData, loadTemplateData } from './data'; -import { URI, Utils } from 'vscode-uri'; -import { getComponentSpans } from '@vue/typescript-plugin/lib/common'; let builtInData: html.HTMLDataV1; let modelData: html.HTMLDataV1; @@ -18,10 +18,8 @@ let modelData: html.HTMLDataV1; export function create( mode: 'html' | 'pug', ts: typeof import('typescript'), - getVueOptions: (env: LanguageServiceEnvironment) => VueCompilerOptions, getTsPluginClient?: (context: LanguageServiceContext) => typeof import('@vue/typescript-plugin/lib/client') | undefined ): LanguageServicePlugin { - let customData: html.IHTMLDataProvider[] = []; let extraCustomData: html.IHTMLDataProvider[] = []; let lastCompletionComponentNames = new Set(); @@ -79,7 +77,6 @@ export function create( create(context): LanguageServicePluginInstance { const tsPluginClient = getTsPluginClient?.(context); const baseServiceInstance = baseService.create(context); - const vueCompilerOptions = getVueOptions(context.env); builtInData ??= loadTemplateData(context.env.locale ?? 'en'); modelData ??= loadModelModifiersData(context.env.locale ?? 'en'); @@ -133,6 +130,11 @@ export function create( return; } + if (!context.language.vue) { + return; + } + const vueCompilerOptions = context.language.vue.compilerOptions; + let sync: (() => Promise) | undefined; let currentVersion: number | undefined; @@ -143,7 +145,7 @@ export function create( // #4298: Precompute HTMLDocument before provideHtmlData to avoid parseHTMLDocument requesting component names from tsserver baseServiceInstance.provideCompletionItems?.(document, position, completionContext, token); - sync = (await provideHtmlData(sourceScript.id, sourceScript.generated.root)).sync; + sync = (await provideHtmlData(vueCompilerOptions, sourceScript.id, sourceScript.generated.root)).sync; currentVersion = await sync(); } @@ -171,6 +173,11 @@ export function create( return; } + if (!context.language.vue) { + return; + } + const vueCompilerOptions = context.language.vue.compilerOptions; + const enabled = await context.env.getConfiguration?.('vue.inlayHints.missingProps') ?? false; if (!enabled) { return; @@ -359,6 +366,10 @@ export function create( if (!isSupportedDocument(document)) { return; } + if (!context.language.vue) { + return; + } + const vueCompilerOptions = context.language.vue.compilerOptions; const languageService = context.inject<(import('volar-service-typescript').Provide), 'typescript/languageService'>('typescript/languageService'); if (!languageService) { return; @@ -378,7 +389,7 @@ export function create( files: context.language.scripts, languageService, typescript: ts, - vueOptions: getVueOptions(context.env), + vueOptions: vueCompilerOptions, }, sourceScript.generated.root, template, @@ -400,7 +411,7 @@ export function create( }, }; - async function provideHtmlData(sourceDocumentUri: URI, vueCode: VueVirtualCode) { + async function provideHtmlData(vueCompilerOptions: VueCompilerOptions, sourceDocumentUri: URI, vueCode: VueVirtualCode) { await (initializing ??= initialize()); @@ -458,7 +469,9 @@ export function create( })()); return []; } - const scriptSetupRanges = vueCode.sfc.scriptSetup ? parseScriptSetupRanges(ts, vueCode.sfc.scriptSetup.ast, vueCompilerOptions) : undefined; + const scriptSetupRanges = vueCode.sfc.scriptSetup + ? parseScriptSetupRanges(ts, vueCode.sfc.scriptSetup.ast, vueCompilerOptions) + : undefined; const names = new Set(); const tags: html.ITagData[] = []; diff --git a/packages/language-service/package.json b/packages/language-service/package.json index b43a17a17b..bd10403c85 100644 --- a/packages/language-service/package.json +++ b/packages/language-service/package.json @@ -16,23 +16,23 @@ "update-html-data": "node ./scripts/update-html-data.js" }, "dependencies": { - "@volar/language-core": "~2.3.4", - "@volar/language-service": "~2.3.4", - "@volar/typescript": "~2.3.4", + "@volar/language-core": "~2.4.0-alpha.0", + "@volar/language-service": "~2.4.0-alpha.0", + "@volar/typescript": "~2.4.0-alpha.0", "@vue/compiler-dom": "^3.4.0", "@vue/language-core": "2.0.22", "@vue/shared": "^3.4.0", "@vue/typescript-plugin": "2.0.22", "computeds": "^0.0.1", "path-browserify": "^1.0.1", - "volar-service-css": "0.0.54", - "volar-service-emmet": "0.0.54", - "volar-service-html": "0.0.54", - "volar-service-json": "0.0.54", - "volar-service-pug": "0.0.54", - "volar-service-pug-beautify": "0.0.54", - "volar-service-typescript": "0.0.54", - "volar-service-typescript-twoslash-queries": "0.0.54", + "volar-service-css": "0.0.55", + "volar-service-emmet": "0.0.55", + "volar-service-html": "0.0.55", + "volar-service-json": "0.0.55", + "volar-service-pug": "0.0.55", + "volar-service-pug-beautify": "0.0.55", + "volar-service-typescript": "0.0.55", + "volar-service-typescript-twoslash-queries": "0.0.55", "vscode-html-languageservice": "^5.2.0", "vscode-languageserver-textdocument": "^1.0.11", "vscode-uri": "^3.0.8" @@ -40,7 +40,7 @@ "devDependencies": { "@types/node": "latest", "@types/path-browserify": "latest", - "@volar/kit": "~2.3.4", + "@volar/kit": "~2.4.0-alpha.0", "vscode-languageserver-protocol": "^3.17.5" } } diff --git a/packages/language-service/tests/utils/createTester.ts b/packages/language-service/tests/utils/createTester.ts index f94d641c54..f9fd5f0c40 100644 --- a/packages/language-service/tests/utils/createTester.ts +++ b/packages/language-service/tests/utils/createTester.ts @@ -3,7 +3,7 @@ import { TypeScriptProjectHost, createLanguageServiceHost, resolveFileLanguageId import * as path from 'path'; import * as ts from 'typescript'; import { URI } from 'vscode-uri'; -import { createParsedCommandLine, createVueLanguagePlugin, getVueLanguageServicePlugins } from '../..'; +import { createParsedCommandLine, createVueLanguagePlugin, getFullLanguageServicePlugins } from '../..'; import { createMockServiceEnv, fileNameToUri, uriToFileName } from './mockEnv'; export const rootUri = URI.file(path.resolve(__dirname, '../../../../test-workspace/language-service')); @@ -38,7 +38,7 @@ function createTester(rootUri: URI) { parsedCommandLine.options, parsedCommandLine.vueOptions ); - const vueServicePlugins = getVueLanguageServicePlugins(ts, () => parsedCommandLine.vueOptions); + const vueServicePlugins = getFullLanguageServicePlugins(ts); const defaultVSCodeSettings: any = { 'typescript.preferences.quoteStyle': 'single', 'javascript.preferences.quoteStyle': 'single', @@ -74,6 +74,9 @@ function createTester(rootUri: URI) { asScriptId: fileNameToUri, ...createLanguageServiceHost(ts, ts.sys, language, fileNameToUri, projectHost), }; + language.vue = { + compilerOptions: parsedCommandLine.vueOptions, + }; const languageService = createLanguageService(language, vueServicePlugins, serviceEnv); return { diff --git a/packages/language-service/tests/utils/format.ts b/packages/language-service/tests/utils/format.ts index 19f479d0a1..8b62801b82 100644 --- a/packages/language-service/tests/utils/format.ts +++ b/packages/language-service/tests/utils/format.ts @@ -2,7 +2,7 @@ import * as kit from '@volar/kit'; import * as ts from 'typescript'; import { describe, expect, it } from 'vitest'; import type { URI } from 'vscode-uri'; -import { createVueLanguagePlugin, getVueLanguageServicePlugins, resolveVueCompilerOptions } from '../..'; +import { createVueLanguagePlugin, getFullLanguageServicePlugins, resolveVueCompilerOptions } from '../..'; const resolvedVueOptions = resolveVueCompilerOptions({}); const vueLanguagePlugin = createVueLanguagePlugin( @@ -11,9 +11,9 @@ const vueLanguagePlugin = createVueLanguagePlugin( () => '', () => false, {}, - resolvedVueOptions, + resolvedVueOptions ); -const vueServicePLugins = getVueLanguageServicePlugins(ts, () => resolvedVueOptions); +const vueServicePLugins = getFullLanguageServicePlugins(ts); const formatter = kit.createFormatter([vueLanguagePlugin], vueServicePLugins); export function defineFormatTest(options: { @@ -32,7 +32,7 @@ export function defineFormatTest(options: { const formatted = await formatter.format( options.input, options.languageId, - { insertSpaces: false, tabSize: 4 }, + { insertSpaces: false, tabSize: 4 } ); expect(formatted.replace(/\r\n/g, '\n')).toBe((options.output ?? options.input).replace(/\r\n/g, '\n')); diff --git a/packages/tsc/index.ts b/packages/tsc/index.ts index 120a15534d..1a718aee57 100644 --- a/packages/tsc/index.ts +++ b/packages/tsc/index.ts @@ -43,7 +43,14 @@ export function run() { options.options, vueOptions ); - return [vueLanguagePlugin]; + return { + plugins: [vueLanguagePlugin], + setup(language) { + language.vue = { + compilerOptions: vueOptions, + }; + }, + }; } else { runExtensions = allExtensions; diff --git a/packages/tsc/package.json b/packages/tsc/package.json index c686989f0d..81dc3e4477 100644 --- a/packages/tsc/package.json +++ b/packages/tsc/package.json @@ -16,7 +16,7 @@ "vue-tsc": "./bin/vue-tsc.js" }, "dependencies": { - "@volar/typescript": "~2.3.4", + "@volar/typescript": "~2.4.0-alpha.0", "@vue/language-core": "2.0.22", "semver": "^7.5.4" }, diff --git a/packages/typescript-plugin/package.json b/packages/typescript-plugin/package.json index 02e4306f0f..693d02768f 100644 --- a/packages/typescript-plugin/package.json +++ b/packages/typescript-plugin/package.json @@ -12,7 +12,7 @@ "directory": "packages/typescript-plugin" }, "dependencies": { - "@volar/typescript": "~2.3.4", + "@volar/typescript": "~2.4.0-alpha.0", "@vue/language-core": "2.0.22", "@vue/shared": "^3.4.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1060b6de59..0e0481d42f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,9 +4,6 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false -overrides: - vscode-html-languageservice: npm:@johnsoncodehk/vscode-html-languageservice - importers: .: @@ -24,8 +21,8 @@ importers: specifier: latest version: 1.0.13 '@volar/language-service': - specifier: ~2.3.4 - version: 2.3.4 + specifier: ~2.4.0-alpha.0 + version: 2.4.0-alpha.0 typescript: specifier: latest version: 5.5.2 @@ -45,8 +42,8 @@ importers: specifier: ^1.82.0 version: 1.90.0 '@volar/vscode': - specifier: ~2.3.4 - version: 2.3.4 + specifier: ~2.4.0-alpha.0 + version: 2.4.0-alpha.0 '@vue/language-core': specifier: 2.0.22 version: link:../../packages/language-core @@ -75,8 +72,8 @@ importers: packages/component-meta: dependencies: '@volar/typescript': - specifier: ~2.3.4 - version: 2.3.4 + specifier: ~2.4.0-alpha.0 + version: 2.4.0-alpha.0 '@vue/language-core': specifier: 2.0.22 version: link:../language-core @@ -102,8 +99,8 @@ importers: packages/language-core: dependencies: '@volar/language-core': - specifier: ~2.3.4 - version: 2.3.4 + specifier: ~2.4.0-alpha.0 + version: 2.4.0-alpha.0 '@vue/compiler-dom': specifier: ^3.4.0 version: 3.4.29 @@ -138,6 +135,9 @@ importers: '@types/path-browserify': specifier: ^1.0.1 version: 1.0.2 + '@volar/typescript': + specifier: ~2.4.0-alpha.0 + version: 2.4.0-alpha.0 '@vue/compiler-sfc': specifier: ^3.4.0 version: 3.4.29 @@ -145,11 +145,11 @@ importers: packages/language-plugin-pug: dependencies: '@volar/source-map': - specifier: ~2.3.4 - version: 2.3.4 + specifier: ~2.4.0-alpha.0 + version: 2.4.0-alpha.0 volar-service-pug: - specifier: 0.0.54 - version: 0.0.54 + specifier: 0.0.55 + version: 0.0.55 devDependencies: '@types/node': specifier: latest @@ -161,11 +161,11 @@ importers: packages/language-server: dependencies: '@volar/language-core': - specifier: ~2.3.4 - version: 2.3.4 + specifier: ~2.4.0-alpha.0 + version: 2.4.0-alpha.0 '@volar/language-server': - specifier: ~2.3.4 - version: 2.3.4 + specifier: ~2.4.0-alpha.0 + version: 2.4.0-alpha.0 '@vue/language-core': specifier: 2.0.22 version: link:../language-core @@ -185,14 +185,14 @@ importers: packages/language-service: dependencies: '@volar/language-core': - specifier: ~2.3.4 - version: 2.3.4 + specifier: ~2.4.0-alpha.0 + version: 2.4.0-alpha.0 '@volar/language-service': - specifier: ~2.3.4 - version: 2.3.4 + specifier: ~2.4.0-alpha.0 + version: 2.4.0-alpha.0 '@volar/typescript': - specifier: ~2.3.4 - version: 2.3.4 + specifier: ~2.4.0-alpha.0 + version: 2.4.0-alpha.0 '@vue/compiler-dom': specifier: ^3.4.0 version: 3.4.29 @@ -212,32 +212,32 @@ importers: specifier: ^1.0.1 version: 1.0.1 volar-service-css: - specifier: 0.0.54 - version: 0.0.54(@volar/language-service@2.3.4) + specifier: 0.0.55 + version: 0.0.55(@volar/language-service@2.4.0-alpha.0) volar-service-emmet: - specifier: 0.0.54 - version: 0.0.54(@volar/language-service@2.3.4) + specifier: 0.0.55 + version: 0.0.55(@volar/language-service@2.4.0-alpha.0) volar-service-html: - specifier: 0.0.54 - version: 0.0.54(@volar/language-service@2.3.4) + specifier: 0.0.55 + version: 0.0.55(@volar/language-service@2.4.0-alpha.0) volar-service-json: - specifier: 0.0.54 - version: 0.0.54(@volar/language-service@2.3.4) + specifier: 0.0.55 + version: 0.0.55(@volar/language-service@2.4.0-alpha.0) volar-service-pug: - specifier: 0.0.54 - version: 0.0.54 + specifier: 0.0.55 + version: 0.0.55 volar-service-pug-beautify: - specifier: 0.0.54 - version: 0.0.54(@volar/language-service@2.3.4) + specifier: 0.0.55 + version: 0.0.55(@volar/language-service@2.4.0-alpha.0) volar-service-typescript: - specifier: 0.0.54 - version: 0.0.54(@volar/language-service@2.3.4) + specifier: 0.0.55 + version: 0.0.55(@volar/language-service@2.4.0-alpha.0) volar-service-typescript-twoslash-queries: - specifier: 0.0.54 - version: 0.0.54(@volar/language-service@2.3.4) + specifier: 0.0.55 + version: 0.0.55(@volar/language-service@2.4.0-alpha.0) vscode-html-languageservice: - specifier: npm:@johnsoncodehk/vscode-html-languageservice - version: '@johnsoncodehk/vscode-html-languageservice@5.2.0-34a5462' + specifier: ^5.2.0 + version: 5.3.0 vscode-languageserver-textdocument: specifier: ^1.0.11 version: 1.0.11 @@ -252,8 +252,8 @@ importers: specifier: latest version: 1.0.2 '@volar/kit': - specifier: ~2.3.4 - version: 2.3.4(typescript@5.5.2) + specifier: ~2.4.0-alpha.0 + version: 2.4.0-alpha.0(typescript@5.5.2) vscode-languageserver-protocol: specifier: ^3.17.5 version: 3.17.5 @@ -261,8 +261,8 @@ importers: packages/tsc: dependencies: '@volar/typescript': - specifier: ~2.3.4 - version: 2.3.4 + specifier: ~2.4.0-alpha.0 + version: 2.4.0-alpha.0 '@vue/language-core': specifier: 2.0.22 version: link:../language-core @@ -280,8 +280,8 @@ importers: packages/typescript-plugin: dependencies: '@volar/typescript': - specifier: ~2.3.4 - version: 2.3.4 + specifier: ~2.4.0-alpha.0 + version: 2.4.0-alpha.0 '@vue/language-core': specifier: 2.0.22 version: link:../language-core @@ -521,9 +521,6 @@ packages: '@johnsoncodehk/pug-beautify@0.2.2': resolution: {integrity: sha512-qqNS/YD0Nck5wtQLCPHAfGVgWbbGafxSPjNh0ekYPFSNNqnDH2kamnduzYly8IiADmeVx/MfAE1njMEjVeHTMA==} - '@johnsoncodehk/vscode-html-languageservice@5.2.0-34a5462': - resolution: {integrity: sha512-etqLfpSJ5zaw76KUNF603be6d6QsiQPmaHr9FKEp4zhLZJzWCCMH6Icak7MtLUFLZLMpL761mZNImi/joBo1ZA==} - '@jridgewell/sourcemap-codec@1.4.15': resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} @@ -853,31 +850,31 @@ packages: '@vitest/utils@1.6.0': resolution: {integrity: sha512-21cPiuGMoMZwiOHa2i4LXkMkMkCGzA+MVFV70jRwHo95dL4x/ts5GZhML1QWuy7yfp3WzK3lRvZi3JnXTYqrBw==} - '@volar/kit@2.3.4': - resolution: {integrity: sha512-MVDrvAHiYMCrt9kEB0Z8ui/CW88fMFj5ZBYslmIsldsalKoJsaSL6ZeKcPmJFn5R5FU6tAlRh3UqcZFbrd9G5Q==} + '@volar/kit@2.4.0-alpha.0': + resolution: {integrity: sha512-Z+HfuVNxaCRBkw1O1PTujiupjHI+idl4Legbn6b5MGbLmjTQYveBQLTgciZdyhqc+g2RyiGUUKNlg7/a4CXjRQ==} peerDependencies: typescript: '*' - '@volar/language-core@2.3.4': - resolution: {integrity: sha512-wXBhY11qG6pCDAqDnbBRFIDSIwbqkWI7no+lj5+L7IlA7HRIjRP7YQLGzT0LF4lS6eHkMSsclXqy9DwYJasZTQ==} + '@volar/language-core@2.4.0-alpha.0': + resolution: {integrity: sha512-cxjq/Hn3Bm4sU9nA5EB0bEm3quT9MmKEtggiIviTyfWXW/LhEYKLyOUQv8hPo3TdBWQfd+lw/1Mmg8l30HFxLA==} - '@volar/language-server@2.3.4': - resolution: {integrity: sha512-I0usa8dI0nTVTqbNyVTQNMDMOHeOaBs84Onmr6oJH3K0EiqLb+Py/Zd5hP/mX22P6MQLhPI2cMVmk0DrSyZFaw==} + '@volar/language-server@2.4.0-alpha.0': + resolution: {integrity: sha512-kSSiu3dvJTd6DIKDwq721Qf8SLEbLQqYROma8S/6iM8VmlkDObgaB6G7+qdphCmSS7feo9wU/gdq5F819OW4RQ==} - '@volar/language-service@2.3.4': - resolution: {integrity: sha512-mtzvYb33l17VVRwmX7C39EjVHBU9LbBJeo1rLXFKoXOzbZCanm0XtPZEENsm05VUvse929y4ParujW7k4G5H0w==} + '@volar/language-service@2.4.0-alpha.0': + resolution: {integrity: sha512-byJtJIEM4YCCJngOrP5/2+4QxR0pu5aPZyl9l0jsw4CixZY1YOZ6M7pGR5uM/ck5qDYUHOg9swyN2y0Z80bzpQ==} - '@volar/snapshot-document@2.3.4': - resolution: {integrity: sha512-mSyxrKWa181r5Hv7CRjwrYXEnzqBLJ3M2Nse9+0KPRff2pAGIx0yl03O7e3Z7IyvMAkXxv3MIVYvP14zY3gVEQ==} + '@volar/snapshot-document@2.4.0-alpha.0': + resolution: {integrity: sha512-XZj2MaLYIkZAASRiIOMIMzmNwfgaBMWNLL5ly4W0C7j1jKcdKuYGUfBfSZdYRvZ30ZCqkjzqp5Vasr6pD7ry2Q==} - '@volar/source-map@2.3.4': - resolution: {integrity: sha512-C+t63nwcblqLIVTYXaVi/+gC8NukDaDIQI72J3R7aXGvtgaVB16c+J8Iz7/VfOy7kjYv7lf5GhBny6ACw9fTGQ==} + '@volar/source-map@2.4.0-alpha.0': + resolution: {integrity: sha512-sVP18DjST+axol4/+N/ZvE0IWpp7VOb7s4n2pmNRN/r+X7+UApYhv9cheh0lMS8Yqd0e4RhjBk5ESrdULpjHIg==} - '@volar/typescript@2.3.4': - resolution: {integrity: sha512-acCvt7dZECyKcvO5geNybmrqOsu9u8n5XP1rfiYsOLYGPxvHRav9BVmEdRyZ3vvY6mNyQ1wLL5Hday4IShe17w==} + '@volar/typescript@2.4.0-alpha.0': + resolution: {integrity: sha512-uBmX5+53dnfX5QD7FIARb2xhlBKUp8ejUwjKjt1df3zNDDo/GuPckRbXf6f8LhtXa9dP5FQxU4dC9FpBpzo5mw==} - '@volar/vscode@2.3.4': - resolution: {integrity: sha512-rdsFjEvRiQbh16a/vhp64aQ/7nxpbWGIC8NmTkaXRCH1YBCMs/06akhXy7lriw3XDDtv9/ntu2eMZgIGnyohIw==} + '@volar/vscode@2.4.0-alpha.0': + resolution: {integrity: sha512-CmLHIrINdfDyJJJ2hfqBRGpUseAeBGt0P9YP6k3531FsWjYmXb/CLn57Kxxv2E2yX8EZ/hk5zqPKu78xU37CqQ==} '@vscode/emmet-helper@2.9.3': resolution: {integrity: sha512-rB39LHWWPQYYlYfpv9qCoZOVioPCftKXXqrsyqN1mTWZM6dTnONT63Db+03vgrBbHzJN45IrgS/AGxw9iiqfEw==} @@ -2882,61 +2879,61 @@ packages: jsdom: optional: true - volar-service-css@0.0.54: - resolution: {integrity: sha512-YU7kOVnH0THS7aBQ+GspRN3HNu4MgyIXQCJtog8ftwANMjR7C3G9DCAQD6+DG5B3g62eQd4tGDQe/0nRZEEtUQ==} + volar-service-css@0.0.55: + resolution: {integrity: sha512-ZA3pRm770HuzK5YrCrSHNKaHQfRhIvnI9613/Lk+YkEiJKUU9TiqY5IGHNO7b/HiyNHkinbeF/31LcpxKAtPZQ==} peerDependencies: - '@volar/language-service': ~2.3.1 + '@volar/language-service': ~2.4.0-alpha.0 peerDependenciesMeta: '@volar/language-service': optional: true - volar-service-emmet@0.0.54: - resolution: {integrity: sha512-DwOdMyIRBq2n4Z0l0WChF1dptnR6nM4wloHcHYvYW2GJYKeF4XVAWFQxZ4DHxwijU6Pw4d04GvINimcvtKhI3Q==} + volar-service-emmet@0.0.55: + resolution: {integrity: sha512-+PsVFHhN2CXzuxp0XhKF0PgeCLvp4km3QRdeV53nbkF0GwZwoOwmigfedcgJJ8/X9yF8/8SSnHpWE3iDuzRLFw==} peerDependencies: - '@volar/language-service': ~2.3.1 + '@volar/language-service': ~2.4.0-alpha.0 peerDependenciesMeta: '@volar/language-service': optional: true - volar-service-html@0.0.54: - resolution: {integrity: sha512-FibBrjlzBNiSWrdTj+P+H1dpJ3blJ8N7I+Y9T0r6N0+1nD4Ly88LDsN4EKG7DjyNIh0MDtNBotTT96UiRRurSg==} + volar-service-html@0.0.55: + resolution: {integrity: sha512-LwYf0zQLeAhrZe2cIeAM/eX66xeci6w0p4cBxitKJuOMkaM5hUMAGpktGPd3p5b3QXfYvWgP56RRlf/CPpZKMA==} peerDependencies: - '@volar/language-service': ~2.3.1 + '@volar/language-service': ~2.4.0-alpha.0 peerDependenciesMeta: '@volar/language-service': optional: true - volar-service-json@0.0.54: - resolution: {integrity: sha512-XqhWYW22j6G4YrbPRPmbPaKowa0VjsyBHlTrzm8fz7ePEPWO5H/G5GBg0R14zC1q55Iv2IUpiiA+oUUgRYUfBA==} + volar-service-json@0.0.55: + resolution: {integrity: sha512-/Bpvv3skoc0BWvRwvHHV/+PjTxcDUzUDK26xjRvcxb871KJhF4fMTejAHBL9gR2WnqnRu6EPFMRsyO4LN9bYJw==} peerDependencies: - '@volar/language-service': ~2.3.1 + '@volar/language-service': ~2.4.0-alpha.0 peerDependenciesMeta: '@volar/language-service': optional: true - volar-service-pug-beautify@0.0.54: - resolution: {integrity: sha512-ZeZSbzcoMrBRbimdktoAZeKWsbvF/Bb9gz6SED5V+tFckpeP+QBKDYBd5xGnPd6aF//XlXoFFjRCq7d0f8sOFQ==} + volar-service-pug-beautify@0.0.55: + resolution: {integrity: sha512-i6yJTtNins4/euDa6jmrtsUC8qFazNgH2O+wm5K3DdjpWKKOxQXNtTVC6FmDlYglxr3Iz98Mgx6hwc0O6IE4DA==} peerDependencies: - '@volar/language-service': ~2.3.1 + '@volar/language-service': ~2.4.0-alpha.0 peerDependenciesMeta: '@volar/language-service': optional: true - volar-service-pug@0.0.54: - resolution: {integrity: sha512-nqYcKcQcZdiyTLjfKVzU5BkURMn24PY16tlUuTmq+q0aoF65TMyaHiPxfZ2v7Fk8TbDnWxiEPo7Ao48ANCqK4g==} + volar-service-pug@0.0.55: + resolution: {integrity: sha512-/1Dnxp+UQA1Ig6cmZ3B9rjGSsdmVgzdgIOUUKHX4zPXKaVKASDxMzX57JBvNFjDSNO10klO2TBJuQrH+aMT5gQ==} - volar-service-typescript-twoslash-queries@0.0.54: - resolution: {integrity: sha512-zMyMYbnJWrOCfYNwtPA9QzWXqJrvDz2K+sitKsZ9zUSIWMY97XQmibZhf9jkra0N+2WVQ8jelVyaObbXeMsUUg==} + volar-service-typescript-twoslash-queries@0.0.55: + resolution: {integrity: sha512-xRy5AqY2hst/NR01C1Hmo5+lr+hbCi39fliViX8nUlUWNRIh0Q2vuFkyxeL4mJuNFIZJpw1xxz09ypEGvfJYEQ==} peerDependencies: - '@volar/language-service': ~2.3.1 + '@volar/language-service': ~2.4.0-alpha.0 peerDependenciesMeta: '@volar/language-service': optional: true - volar-service-typescript@0.0.54: - resolution: {integrity: sha512-kwYsfliESC+NK+iqfL0UqM5etEtERXxvtnrpVpAKHN3+dUexrPvGJWmHTNI9jYj8XUPT8B8oGbpGZKR94S6mcQ==} + volar-service-typescript@0.0.55: + resolution: {integrity: sha512-z/rF20SeQdc1Zi97bLl0haWMd1tvhAavirhNkO1vXD1/ShJxGhY9+ZzwzD4ltVTWouiluFp3QAsCYuKJAMUa1w==} peerDependencies: - '@volar/language-service': ~2.3.1 + '@volar/language-service': ~2.4.0-alpha.0 peerDependenciesMeta: '@volar/language-service': optional: true @@ -2950,6 +2947,9 @@ packages: vscode-css-languageservice@6.3.0: resolution: {integrity: sha512-nU92imtkgzpCL0xikrIb8WvedV553F2BENzgz23wFuok/HLN5BeQmroMy26pUwFxV2eV8oNRmYCUv8iO7kSMhw==} + vscode-html-languageservice@5.3.0: + resolution: {integrity: sha512-C4Z3KsP5Ih+fjHpiBc5jxmvCl+4iEwvXegIrzu2F5pktbWvQaBT3YkVPk8N+QlSSMk8oCG6PKtZ/Sq2YHb5e8g==} + vscode-json-languageservice@5.4.0: resolution: {integrity: sha512-NCkkCr63OHVkE4lcb0xlUAaix6vE5gHQW4NrswbLEh3ArXj81lrGuFTsGEYEUXlNHdnc53vWPcjeSy/nMTrfXg==} @@ -3247,13 +3247,6 @@ snapshots: '@johnsoncodehk/pug-beautify@0.2.2': {} - '@johnsoncodehk/vscode-html-languageservice@5.2.0-34a5462': - dependencies: - '@vscode/l10n': 0.0.18 - vscode-languageserver-textdocument: 1.0.11 - vscode-languageserver-types: 3.17.5 - vscode-uri: 3.0.8 - '@jridgewell/sourcemap-codec@1.4.15': {} '@lerna-lite/cli@3.5.1(@lerna-lite/publish@3.5.2(typescript@5.5.2))(@lerna-lite/version@3.5.2(@lerna-lite/publish@3.5.2(typescript@5.5.2))(typescript@5.5.2))(typescript@5.5.2)': @@ -3711,25 +3704,25 @@ snapshots: loupe: 2.3.7 pretty-format: 29.7.0 - '@volar/kit@2.3.4(typescript@5.5.2)': + '@volar/kit@2.4.0-alpha.0(typescript@5.5.2)': dependencies: - '@volar/language-service': 2.3.4 - '@volar/typescript': 2.3.4 + '@volar/language-service': 2.4.0-alpha.0 + '@volar/typescript': 2.4.0-alpha.0 typesafe-path: 0.2.2 typescript: 5.5.2 vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 - '@volar/language-core@2.3.4': + '@volar/language-core@2.4.0-alpha.0': dependencies: - '@volar/source-map': 2.3.4 + '@volar/source-map': 2.4.0-alpha.0 - '@volar/language-server@2.3.4': + '@volar/language-server@2.4.0-alpha.0': dependencies: - '@volar/language-core': 2.3.4 - '@volar/language-service': 2.3.4 - '@volar/snapshot-document': 2.3.4 - '@volar/typescript': 2.3.4 + '@volar/language-core': 2.4.0-alpha.0 + '@volar/language-service': 2.4.0-alpha.0 + '@volar/snapshot-document': 2.4.0-alpha.0 + '@volar/typescript': 2.4.0-alpha.0 path-browserify: 1.0.1 request-light: 0.7.0 vscode-languageserver: 9.0.1 @@ -3737,29 +3730,29 @@ snapshots: vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 - '@volar/language-service@2.3.4': + '@volar/language-service@2.4.0-alpha.0': dependencies: - '@volar/language-core': 2.3.4 + '@volar/language-core': 2.4.0-alpha.0 vscode-languageserver-protocol: 3.17.5 vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 - '@volar/snapshot-document@2.3.4': + '@volar/snapshot-document@2.4.0-alpha.0': dependencies: vscode-languageserver-protocol: 3.17.5 vscode-languageserver-textdocument: 1.0.11 - '@volar/source-map@2.3.4': {} + '@volar/source-map@2.4.0-alpha.0': {} - '@volar/typescript@2.3.4': + '@volar/typescript@2.4.0-alpha.0': dependencies: - '@volar/language-core': 2.3.4 + '@volar/language-core': 2.4.0-alpha.0 path-browserify: 1.0.1 vscode-uri: 3.0.8 - '@volar/vscode@2.3.4': + '@volar/vscode@2.4.0-alpha.0': dependencies: - '@volar/language-server': 2.3.4 + '@volar/language-server': 2.4.0-alpha.0 path-browserify: 1.0.1 vscode-languageclient: 9.0.1 vscode-nls: 5.2.0 @@ -5898,61 +5891,61 @@ snapshots: - supports-color - terser - volar-service-css@0.0.54(@volar/language-service@2.3.4): + volar-service-css@0.0.55(@volar/language-service@2.4.0-alpha.0): dependencies: vscode-css-languageservice: 6.3.0 vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': 2.3.4 + '@volar/language-service': 2.4.0-alpha.0 - volar-service-emmet@0.0.54(@volar/language-service@2.3.4): + volar-service-emmet@0.0.55(@volar/language-service@2.4.0-alpha.0): dependencies: '@emmetio/css-parser': 0.4.0 '@emmetio/html-matcher': 1.3.0 '@vscode/emmet-helper': 2.9.3 vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': 2.3.4 + '@volar/language-service': 2.4.0-alpha.0 - volar-service-html@0.0.54(@volar/language-service@2.3.4): + volar-service-html@0.0.55(@volar/language-service@2.4.0-alpha.0): dependencies: - vscode-html-languageservice: '@johnsoncodehk/vscode-html-languageservice@5.2.0-34a5462' + vscode-html-languageservice: 5.3.0 vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': 2.3.4 + '@volar/language-service': 2.4.0-alpha.0 - volar-service-json@0.0.54(@volar/language-service@2.3.4): + volar-service-json@0.0.55(@volar/language-service@2.4.0-alpha.0): dependencies: vscode-json-languageservice: 5.4.0 vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': 2.3.4 + '@volar/language-service': 2.4.0-alpha.0 - volar-service-pug-beautify@0.0.54(@volar/language-service@2.3.4): + volar-service-pug-beautify@0.0.55(@volar/language-service@2.4.0-alpha.0): dependencies: '@johnsoncodehk/pug-beautify': 0.2.2 optionalDependencies: - '@volar/language-service': 2.3.4 + '@volar/language-service': 2.4.0-alpha.0 - volar-service-pug@0.0.54: + volar-service-pug@0.0.55: dependencies: - '@volar/language-service': 2.3.4 + '@volar/language-service': 2.4.0-alpha.0 muggle-string: 0.4.1 pug-lexer: 5.0.1 pug-parser: 6.0.0 - volar-service-html: 0.0.54(@volar/language-service@2.3.4) - vscode-html-languageservice: '@johnsoncodehk/vscode-html-languageservice@5.2.0-34a5462' + volar-service-html: 0.0.55(@volar/language-service@2.4.0-alpha.0) + vscode-html-languageservice: 5.3.0 vscode-languageserver-textdocument: 1.0.11 - volar-service-typescript-twoslash-queries@0.0.54(@volar/language-service@2.3.4): + volar-service-typescript-twoslash-queries@0.0.55(@volar/language-service@2.4.0-alpha.0): dependencies: vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': 2.3.4 + '@volar/language-service': 2.4.0-alpha.0 - volar-service-typescript@0.0.54(@volar/language-service@2.3.4): + volar-service-typescript@0.0.55(@volar/language-service@2.4.0-alpha.0): dependencies: path-browserify: 1.0.1 semver: 7.6.2 @@ -5961,7 +5954,7 @@ snapshots: vscode-nls: 5.2.0 vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': 2.3.4 + '@volar/language-service': 2.4.0-alpha.0 vsce@2.15.0: dependencies: @@ -5993,6 +5986,13 @@ snapshots: vscode-languageserver-types: 3.17.5 vscode-uri: 3.0.8 + vscode-html-languageservice@5.3.0: + dependencies: + '@vscode/l10n': 0.0.18 + vscode-languageserver-textdocument: 1.0.11 + vscode-languageserver-types: 3.17.5 + vscode-uri: 3.0.8 + vscode-json-languageservice@5.4.0: dependencies: '@vscode/l10n': 0.0.18