From 705cd4bfb74236c9ecc9430e43e94aa37c893b04 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Sun, 25 Aug 2024 02:17:34 +0800 Subject: [PATCH 01/10] Rewrite completions tests --- package.json | 8 + packages/language-server/lib/initialize.ts | 2 +- packages/language-server/package.json | 1 + .../__snapshots__/completions.spec.ts.snap | 124 ++++++++++ .../language-server/tests/completions.spec.ts | 210 +++++++++++++++++ packages/language-server/tests/server.ts | 29 +++ packages/language-service/index.ts | 7 +- .../lib/requests/collectExtractProps.ts | 7 +- .../lib/requests/componentInfos.ts | 24 +- .../lib/requests/getPropertiesAtLocation.ts | 7 +- pnpm-lock.yaml | 213 ++++++++++-------- .../complete/#2454/input/entry.vue | 8 - .../complete/#2454/output/entry.vue | 8 - .../#2511/input/component-for-auto-import.vue | 1 - .../complete/#2511/input/entry.vue | 4 - .../complete/#2511/output/entry.vue | 4 - .../complete/#3658/input/entry.vue | 8 - .../complete/#3658/output/entry.vue | 8 - .../complete/#4639/input/entry.vue | 7 - .../complete/#4639/output/entry.vue | 7 - .../complete/$event/input/entry.vue | 4 - .../complete/$event/output/entry.vue | 4 - .../input/component-for-auto-import.vue | 1 - .../component-auto-import/input/entry.vue | 7 - .../component-auto-import/output/entry.vue | 9 - .../complete/core#8811/input/entry.vue | 12 - .../complete/core#8811/output/entry.vue | 12 - .../complete/directives/input/entry.vue | 12 - .../complete/directives/output/entry.vue | 12 - .../complete/script-setup/input/entry.vue | 8 - .../complete/script-setup/output/entry.vue | 8 - .../complete/slot-name/input/main.vue | 15 -- .../complete/slot-name/output/main.vue | 15 -- .../vue-file-path/input/alias-path.vue | 4 - .../vue-file-path/input/component.vue | 1 - .../vue-file-path/input/relative-path.vue | 4 - .../vue-file-path/output/alias-path.vue | 4 - .../vue-file-path/output/relative-path.vue | 4 - test-workspace/language-service/tsconfig.json | 2 +- test-workspace/tsconfigProject/empty.vue | 0 test-workspace/tsconfigProject/tsconfig.json | 9 + 41 files changed, 519 insertions(+), 315 deletions(-) create mode 100644 packages/language-server/tests/__snapshots__/completions.spec.ts.snap create mode 100644 packages/language-server/tests/completions.spec.ts create mode 100644 packages/language-server/tests/server.ts delete mode 100644 test-workspace/language-service/complete/#2454/input/entry.vue delete mode 100644 test-workspace/language-service/complete/#2454/output/entry.vue delete mode 100644 test-workspace/language-service/complete/#2511/input/component-for-auto-import.vue delete mode 100644 test-workspace/language-service/complete/#2511/input/entry.vue delete mode 100644 test-workspace/language-service/complete/#2511/output/entry.vue delete mode 100644 test-workspace/language-service/complete/#3658/input/entry.vue delete mode 100644 test-workspace/language-service/complete/#3658/output/entry.vue delete mode 100644 test-workspace/language-service/complete/#4639/input/entry.vue delete mode 100644 test-workspace/language-service/complete/#4639/output/entry.vue delete mode 100644 test-workspace/language-service/complete/$event/input/entry.vue delete mode 100644 test-workspace/language-service/complete/$event/output/entry.vue delete mode 100644 test-workspace/language-service/complete/component-auto-import/input/component-for-auto-import.vue delete mode 100644 test-workspace/language-service/complete/component-auto-import/input/entry.vue delete mode 100644 test-workspace/language-service/complete/component-auto-import/output/entry.vue delete mode 100644 test-workspace/language-service/complete/core#8811/input/entry.vue delete mode 100644 test-workspace/language-service/complete/core#8811/output/entry.vue delete mode 100644 test-workspace/language-service/complete/directives/input/entry.vue delete mode 100644 test-workspace/language-service/complete/directives/output/entry.vue delete mode 100644 test-workspace/language-service/complete/script-setup/input/entry.vue delete mode 100644 test-workspace/language-service/complete/script-setup/output/entry.vue delete mode 100644 test-workspace/language-service/complete/slot-name/input/main.vue delete mode 100644 test-workspace/language-service/complete/slot-name/output/main.vue delete mode 100644 test-workspace/language-service/complete/vue-file-path/input/alias-path.vue delete mode 100644 test-workspace/language-service/complete/vue-file-path/input/component.vue delete mode 100644 test-workspace/language-service/complete/vue-file-path/input/relative-path.vue delete mode 100644 test-workspace/language-service/complete/vue-file-path/output/alias-path.vue delete mode 100644 test-workspace/language-service/complete/vue-file-path/output/relative-path.vue create mode 100644 test-workspace/tsconfigProject/empty.vue create mode 100644 test-workspace/tsconfigProject/tsconfig.json diff --git a/package.json b/package.json index 12b5376536..7f31f5886e 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,14 @@ }, "pnpm": { "overrides": { + "@volar/kit": "https://pkg.pr.new/volarjs/volar.js/@volar/kit@01441c3", + "@volar/language-core": "https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3", + "@volar/language-server": "https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3", + "@volar/language-service": "https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3", + "@volar/source-map": "https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3", + "@volar/typescript": "https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3", + "@volar/vscode": "https://pkg.pr.new/volarjs/volar.js/@volar/vscode@01441c3", + "volar-service-typescript": "https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed", "inquirer": "9.2.23" } } diff --git a/packages/language-server/lib/initialize.ts b/packages/language-server/lib/initialize.ts index 0ef344ed69..450353bfcb 100644 --- a/packages/language-server/lib/initialize.ts +++ b/packages/language-server/lib/initialize.ts @@ -56,7 +56,7 @@ export function initialize( }; } ), - getFullLanguageServicePlugins(ts) + getFullLanguageServicePlugins(ts, { disableAutoImportCache: params.initializationOptions.typescript.disableAutoImportCache }) ); function updateFileWatcher(vueCompilerOptions: VueCompilerOptions) { diff --git a/packages/language-server/package.json b/packages/language-server/package.json index bd4773003b..543f4ee864 100644 --- a/packages/language-server/package.json +++ b/packages/language-server/package.json @@ -17,6 +17,7 @@ "dependencies": { "@volar/language-core": "~2.4.0", "@volar/language-server": "~2.4.0", + "@volar/test-utils": "~2.4.0", "@vue/language-core": "2.0.28", "@vue/language-service": "2.0.28", "@vue/typescript-plugin": "2.0.28", diff --git a/packages/language-server/tests/__snapshots__/completions.spec.ts.snap b/packages/language-server/tests/__snapshots__/completions.spec.ts.snap new file mode 100644 index 0000000000..f2b3dd1bf6 --- /dev/null +++ b/packages/language-server/tests/__snapshots__/completions.spec.ts.snap @@ -0,0 +1,124 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Completions > #2454 1`] = ` +" + + + + " +`; + +exports[`Completions > #2511 1`] = ` +" + + " +`; + +exports[`Completions > #3658 1`] = ` +" + + " +`; + +exports[`Completions > #4639 1`] = ` +" + + " +`; + +exports[`Completions > $event argument 1`] = `""`; + +exports[`Completions > + " +`; + +exports[`Completions > Alias path 1`] = ` +" + + " +`; + +exports[`Completions > Component auto import 1`] = ` +" + + + + " +`; + +exports[`Completions > Directives 1`] = `""`; + +exports[`Completions > Directives 2`] = `""`; + +exports[`Completions > Directives 3`] = `""`; + +exports[`Completions > Directives 4`] = `""`; + +exports[`Completions > Relative path 1`] = ` +" + + " +`; + +exports[`Completions > Slot name 1`] = ` +" + + + + " +`; + +exports[`Completions > core#8811 1`] = ` +" + + + + " +`; diff --git a/packages/language-server/tests/completions.spec.ts b/packages/language-server/tests/completions.spec.ts new file mode 100644 index 0000000000..13307a0b39 --- /dev/null +++ b/packages/language-server/tests/completions.spec.ts @@ -0,0 +1,210 @@ +import { InsertReplaceEdit, TextDocument, TextEdit } from '@volar/language-server'; +import { afterEach, describe, expect, it } from 'vitest'; +import { URI } from 'vscode-uri'; +import { getLanguageServer, testWorkspacePath } from './server.js'; + +describe('Completions', async () => { + + it('Directives', async () => { + await assertCompletion('fixture.vue', 'vue', ``, 'v-html'); + await assertCompletion('fixture.vue', 'vue', ``, 'v-cloak'); + await assertCompletion('fixture.vue', 'vue', ``, 'v-else'); + await assertCompletion('fixture.vue', 'vue', ``, 'v-pre'); + }); + + it('$event argument', async () => { + await assertCompletion('fixture.vue', 'vue', ``, '$event'); + }); + + it(' + `, 'foo'); + }); + + it('Slot name', async () => { + await assertCompletion('fixture.vue', 'vue', ` + + + + `, 'default'); + }); + + it('#2454', async () => { + await assertCompletion('fixture.vue', 'vue', ` + + + + `, 'v-loading'); + }); + + it('#2511', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await openDocument('tsconfigProject/component-for-auto-import.vue', 'vue', ``); + await assertCompletion('tsconfigProject/fixture.vue', 'vue', ` + + `, 'ComponentForAutoImport'); + }); + + it('#3658', async () => { + await assertCompletion('fixture.vue', 'vue', ` + + `, 'foo'); + }); + + it('#4639', async () => { + await assertCompletion('fixture.vue', 'vue', ` + + `, 'capture'); + }); + + it('Alias path', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await assertCompletion('tsconfigProject/fixture.vue', 'vue', ` + + `, 'empty.vue'); + }); + + it('Relative path', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await assertCompletion('tsconfigProject/fixture.vue', 'vue', ` + + `, 'empty.vue'); + }); + + it('Component auto import', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await openDocument('tsconfigProject/ComponentForAutoImport.vue', 'vue', ``); + await assertCompletion('tsconfigProject/fixture.vue', 'vue', ` + + + + `, 'ComponentForAutoImport'); + }); + + it('core#8811', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await assertCompletion('tsconfigProject/fixture.vue', 'vue', ` + + + + `, ':-foo-bar'); + }); + + const openedDocuments: TextDocument[] = []; + + afterEach(async () => { + const server = await getLanguageServer(); + for (const document of openedDocuments) { + await server.closeTextDocument(document.uri); + } + openedDocuments.length = 0; + }); + + /** + * @deprecated Remove this when #4717 fixed. + */ + async function ensureGlobalTypesHolder(folderName: string) { + const document = await openDocument(`${folderName}/globalTypesHolder.vue`, 'vue', ''); + const server = await getLanguageServer(); + await server.sendDocumentDiagnosticRequest(document.uri); + } + + async function assertCompletion(fileName: string, languageId: string, content: string, itemLabel: string) { + const offset = content.indexOf('|'); + content = content.slice(0, offset) + content.slice(offset + 1); + + const server = await getLanguageServer(); + let document = await openDocument(fileName, languageId, content); + + const position = document.positionAt(offset); + const completions = await server.sendCompletionRequest(document.uri, position); + + let completion = completions?.items.find(item => item.label === itemLabel); + expect(completion).toBeDefined(); + + completion = await server.sendCompletionResolveRequest(completion!); + expect(completion).toBeDefined(); + + const edits: TextEdit[] = []; + + if (completion.textEdit) { + if (InsertReplaceEdit.is(completion.textEdit)) { + edits.push({ newText: completion.textEdit.newText, range: completion.textEdit.replace }); + } + else { + edits.push(completion.textEdit); + } + } + else { + edits.push({ + newText: completion.insertText ?? completion.label, + range: { start: position, end: position }, + }); + } + if (completion.additionalTextEdits) { + edits.push(...completion.additionalTextEdits); + } + if (edits.length === 0) { + console.log(completion); + } + expect(edits.length).toBeGreaterThan(0); + + document = await server.updateTextDocument(document.uri, edits); + + expect(document.getText()).toMatchSnapshot(); + } + + async function openDocument(fileName: string, languageId: string, content: string) { + const server = await getLanguageServer(); + const uri = URI.file(`${testWorkspacePath}/${fileName}`); + const document = await server.openInMemoryDocument(uri.toString(), languageId, content); + if (openedDocuments.every(d => d.uri !== document.uri)) { + openedDocuments.push(document); + } + return document; + } +}); diff --git a/packages/language-server/tests/server.ts b/packages/language-server/tests/server.ts new file mode 100644 index 0000000000..d40cbf2077 --- /dev/null +++ b/packages/language-server/tests/server.ts @@ -0,0 +1,29 @@ +import * as path from 'path'; +import type { LanguageServerHandle } from '@volar/test-utils'; +import { startLanguageServer } from '@volar/test-utils'; +import { URI } from 'vscode-uri'; + +let serverHandle: LanguageServerHandle | undefined; + +export const testWorkspacePath = path.resolve(__dirname, '../../../test-workspace'); + +export async function getLanguageServer() { + if (!serverHandle) { + serverHandle = startLanguageServer(require.resolve('../bin/vue-language-server.js'), testWorkspacePath); + serverHandle.connection.onNotification('textDocument/publishDiagnostics', () => { }); + + await serverHandle.initialize( + URI.file(testWorkspacePath).toString(), + { + typescript: { + tsdk: path.dirname(require.resolve('typescript/lib/typescript.js')), + disableAutoImportCache: true, + }, + vue: { + hybridMode: false, + }, + } + ); + } + return serverHandle; +} diff --git a/packages/language-service/index.ts b/packages/language-service/index.ts index 42fef932bc..122442fa92 100644 --- a/packages/language-service/index.ts +++ b/packages/language-service/index.ts @@ -45,9 +45,12 @@ declare module '@volar/language-service' { } } -export function getFullLanguageServicePlugins(ts: typeof import('typescript')): LanguageServicePlugin[] { +export function getFullLanguageServicePlugins( + ts: typeof import('typescript'), + { disableAutoImportCache }: { disableAutoImportCache?: boolean; } = {} +): LanguageServicePlugin[] { const plugins: LanguageServicePlugin[] = [ - ...createTypeScriptPlugins(ts), + ...createTypeScriptPlugins(ts, { disableAutoImportCache }), ...getCommonLanguageServicePlugins( ts, getTsPluginClientForLSP diff --git a/packages/typescript-plugin/lib/requests/collectExtractProps.ts b/packages/typescript-plugin/lib/requests/collectExtractProps.ts index 5b785f6478..9d31da27de 100644 --- a/packages/typescript-plugin/lib/requests/collectExtractProps.ts +++ b/packages/typescript-plugin/lib/requests/collectExtractProps.ts @@ -1,5 +1,4 @@ import { VueVirtualCode, isSemanticTokensEnabled } from '@vue/language-core'; -import type * as ts from 'typescript'; import type { RequestContext } from './types'; export function collectExtractProps( @@ -19,11 +18,7 @@ export function collectExtractProps( type: string; model: boolean; }>(); - const program: ts.Program = (languageService as any).getCurrentProgram(); - if (!program) { - return; - } - + const program = languageService.getProgram()!; const sourceFile = program.getSourceFile(fileName)!; const checker = program.getTypeChecker(); const script = volarFile.generated?.languagePlugin.typescript?.getServiceScript(volarFile.generated.root); diff --git a/packages/typescript-plugin/lib/requests/componentInfos.ts b/packages/typescript-plugin/lib/requests/componentInfos.ts index 145a9e2e18..cb069cb09e 100644 --- a/packages/typescript-plugin/lib/requests/componentInfos.ts +++ b/packages/typescript-plugin/lib/requests/componentInfos.ts @@ -15,11 +15,7 @@ export function getComponentProps( return; } const vueCode = volarFile.generated.root; - const program: ts.Program = (languageService as any).getCurrentProgram(); - if (!program) { - return; - } - + const program = languageService.getProgram()!; const checker = program.getTypeChecker(); const components = getVariableType(ts, languageService, vueCode, '__VLS_components'); if (!components) { @@ -97,11 +93,7 @@ export function getComponentEvents( return; } const vueCode = volarFile.generated.root; - const program: ts.Program = (languageService as any).getCurrentProgram(); - if (!program) { - return; - } - + const program = languageService.getProgram()!; const checker = program.getTypeChecker(); const components = getVariableType(ts, languageService, vueCode, '__VLS_components'); if (!components) { @@ -221,10 +213,7 @@ export function getElementAttrs( if (!(volarFile?.generated?.root instanceof vue.VueVirtualCode)) { return; } - const program: ts.Program = (languageService as any).getCurrentProgram(); - if (!program) { - return; - } + const program = languageService.getProgram()!; let tsSourceFile: ts.SourceFile | undefined; @@ -251,14 +240,11 @@ export function getElementAttrs( function getVariableType( ts: typeof import('typescript'), - tsLs: ts.LanguageService, + languageService: ts.LanguageService, vueCode: vue.VueVirtualCode, name: string ) { - const program: ts.Program = (tsLs as any).getCurrentProgram(); - if (!program) { - return; - } + const program = languageService.getProgram()!; let tsSourceFile: ts.SourceFile | undefined; diff --git a/packages/typescript-plugin/lib/requests/getPropertiesAtLocation.ts b/packages/typescript-plugin/lib/requests/getPropertiesAtLocation.ts index 6713546d69..834e4ebe6b 100644 --- a/packages/typescript-plugin/lib/requests/getPropertiesAtLocation.ts +++ b/packages/typescript-plugin/lib/requests/getPropertiesAtLocation.ts @@ -37,12 +37,7 @@ export function getPropertiesAtLocation( } } - - const program: ts.Program = (languageService as any).getCurrentProgram(); - if (!program) { - return; - } - + const program = languageService.getProgram()!; const sourceFile = program.getSourceFile(fileName); if (!sourceFile) { return; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index af9786a46f..97373a8f40 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,6 +5,14 @@ settings: excludeLinksFromLockfile: false overrides: + '@volar/kit': https://pkg.pr.new/volarjs/volar.js/@volar/kit@01441c3 + '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 + '@volar/language-server': https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/source-map': https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3 + '@volar/typescript': https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 + '@volar/vscode': https://pkg.pr.new/volarjs/volar.js/@volar/vscode@01441c3 + volar-service-typescript: https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed inquirer: 9.2.23 importers: @@ -24,8 +32,8 @@ importers: specifier: latest version: 1.0.14 '@volar/language-service': - specifier: ~2.4.0 - version: 2.4.0 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + version: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 typescript: specifier: latest version: 5.5.3 @@ -45,8 +53,8 @@ importers: specifier: ^1.82.0 version: 1.91.0 '@volar/vscode': - specifier: ~2.4.0 - version: 2.4.0 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/vscode@01441c3 + version: https://pkg.pr.new/volarjs/volar.js/@volar/vscode@01441c3 '@vscode/vsce': specifier: latest version: 3.0.0 @@ -75,8 +83,8 @@ importers: packages/component-meta: dependencies: '@volar/typescript': - specifier: ~2.4.0 - version: 2.4.0 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 + version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 '@vue/language-core': specifier: 2.0.28 version: link:../language-core @@ -102,8 +110,8 @@ importers: packages/language-core: dependencies: '@volar/language-core': - specifier: ~2.4.0 - version: 2.4.0 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 + version: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 '@vue/compiler-dom': specifier: ^3.4.0 version: 3.4.31 @@ -139,8 +147,8 @@ importers: specifier: ^1.0.1 version: 1.0.2 '@volar/typescript': - specifier: ~2.4.0 - version: 2.4.0 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 + version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 '@vue/compiler-sfc': specifier: ^3.4.0 version: 3.4.31 @@ -148,8 +156,8 @@ importers: packages/language-plugin-pug: dependencies: '@volar/source-map': - specifier: ~2.4.0 - version: 2.4.0 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3 + version: https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3 volar-service-pug: specifier: 0.0.61 version: 0.0.61 @@ -164,9 +172,12 @@ importers: packages/language-server: dependencies: '@volar/language-core': - specifier: ~2.4.0 - version: 2.4.0 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 + version: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 '@volar/language-server': + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3 + version: https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3 + '@volar/test-utils': specifier: ~2.4.0 version: 2.4.0 '@vue/language-core': @@ -188,14 +199,14 @@ importers: packages/language-service: dependencies: '@volar/language-core': - specifier: ~2.4.0 - version: 2.4.0 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 + version: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 '@volar/language-service': - specifier: ~2.4.0 - version: 2.4.0 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + version: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 '@volar/typescript': - specifier: ~2.4.0 - version: 2.4.0 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 + version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 '@vue/compiler-dom': specifier: ^3.4.0 version: 3.4.31 @@ -216,28 +227,28 @@ importers: version: 1.0.1 volar-service-css: specifier: 0.0.61 - version: 0.0.61(@volar/language-service@2.4.0) + version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) volar-service-emmet: specifier: 0.0.61 - version: 0.0.61(@volar/language-service@2.4.0) + version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) volar-service-html: specifier: 0.0.61 - version: 0.0.61(@volar/language-service@2.4.0) + version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) volar-service-json: specifier: 0.0.61 - version: 0.0.61(@volar/language-service@2.4.0) + version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) volar-service-pug: specifier: 0.0.61 version: 0.0.61 volar-service-pug-beautify: specifier: 0.0.61 - version: 0.0.61(@volar/language-service@2.4.0) + version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) volar-service-typescript: - specifier: 0.0.61 - version: 0.0.61(@volar/language-service@2.4.0) + specifier: https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed + version: https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) volar-service-typescript-twoslash-queries: specifier: 0.0.61 - version: 0.0.61(@volar/language-service@2.4.0) + version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) vscode-html-languageservice: specifier: ^5.2.0 version: 5.3.0 @@ -255,8 +266,8 @@ importers: specifier: latest version: 1.0.2 '@volar/kit': - specifier: ~2.4.0 - version: 2.4.0(typescript@5.5.3) + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/kit@01441c3 + version: https://pkg.pr.new/volarjs/volar.js/@volar/kit@01441c3(typescript@5.5.3) vscode-languageserver-protocol: specifier: ^3.17.5 version: 3.17.5 @@ -264,8 +275,8 @@ importers: packages/tsc: dependencies: '@volar/typescript': - specifier: ~2.4.0 - version: 2.4.0 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 + version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 '@vue/language-core': specifier: 2.0.28 version: link:../language-core @@ -283,8 +294,8 @@ importers: packages/typescript-plugin: dependencies: '@volar/typescript': - specifier: ~2.4.0 - version: 2.4.0 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 + version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 '@vue/language-core': specifier: 2.0.28 version: link:../language-core @@ -1091,28 +1102,38 @@ packages: '@vitest/utils@2.0.3': resolution: {integrity: sha512-c/UdELMuHitQbbc/EVctlBaxoYAwQPQdSNwv7z/vHyBKy2edYZaFgptE27BRueZB7eW8po+cllotMNTDpL3HWg==} - '@volar/kit@2.4.0': - resolution: {integrity: sha512-uqwtPKhrbnP+3f8hs+ltDYXLZ6Wdbs54IzkaPocasI4aBhqWLht5qXctE1MqpZU52wbH359E0u9nhxEFmyon+w==} + '@volar/kit@https://pkg.pr.new/volarjs/volar.js/@volar/kit@01441c3': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/kit@01441c3} + version: 2.4.0 peerDependencies: typescript: '*' - '@volar/language-core@2.4.0': - resolution: {integrity: sha512-FTla+khE+sYK0qJP+6hwPAAUwiNHVMph4RUXpxf/FIPKUP61NFrVZorml4mjFShnueR2y9/j8/vnh09YwVdH7A==} + '@volar/language-core@https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3} + version: 2.4.0 - '@volar/language-server@2.4.0': - resolution: {integrity: sha512-rmGIjAxWekWQiGH97Mosb4juiD/hfFYNQKV5Py9r7vDOLSkbIwRhITbwHm88NJKs8P6TNc6w/PfBXN6yjKadJg==} + '@volar/language-server@https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3} + version: 2.4.0 - '@volar/language-service@2.4.0': - resolution: {integrity: sha512-4P3yeQXIL68mLfS3n6P3m02IRg3GnLHUU9k/1PCHEfm5FG9bySkDOc72dbBn2vAa2BxOqm18bmmZXrsWuQ5AOw==} + '@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3} + version: 2.4.0 - '@volar/source-map@2.4.0': - resolution: {integrity: sha512-2ceY8/NEZvN6F44TXw2qRP6AQsvCYhV2bxaBPWxV9HqIfkbRydSksTFObCF1DBDNBfKiZTS8G/4vqV6cvjdOIQ==} + '@volar/source-map@https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3} + version: 2.4.0 - '@volar/typescript@2.4.0': - resolution: {integrity: sha512-9zx3lQWgHmVd+JRRAHUSRiEhe4TlzL7U7e6ulWXOxHH/WNYxzKwCvZD7WYWEZFdw4dHfTD9vUR0yPQO6GilCaQ==} + '@volar/test-utils@2.4.0': + resolution: {integrity: sha512-hCXPEY/JrH7ooFvMIUu5V3xaqnCLEwqkKoeMT1UHC6DvsQOGsuyaFsJu2k59aCtE8mxAyq7qww7S4k8kRH8hFw==} - '@volar/vscode@2.4.0': - resolution: {integrity: sha512-VOnUgtmu+xGOqVKouRM8ZSeVOFPqmcTDfi3wif5peXpkOPsCgNdS/zns0xunuh9J6Ck5SV+QffPfmNW9XARnxw==} + '@volar/typescript@https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3} + version: 2.4.0 + + '@volar/vscode@https://pkg.pr.new/volarjs/volar.js/@volar/vscode@01441c3': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/vscode@01441c3} + version: 2.4.0 '@vscode/emmet-helper@2.9.3': resolution: {integrity: sha512-rB39LHWWPQYYlYfpv9qCoZOVioPCftKXXqrsyqN1mTWZM6dTnONT63Db+03vgrBbHzJN45IrgS/AGxw9iiqfEw==} @@ -3275,40 +3296,45 @@ packages: volar-service-css@0.0.61: resolution: {integrity: sha512-Ct9L/w+IB1JU8F4jofcNCGoHy6TF83aiapfZq9A0qYYpq+Kk5dH+ONS+rVZSsuhsunq8UvAuF8Gk6B8IFLfniw==} + version: 0.0.61 peerDependencies: - '@volar/language-service': ~2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 peerDependenciesMeta: '@volar/language-service': optional: true volar-service-emmet@0.0.61: resolution: {integrity: sha512-iiYqBxjjcekqrRruw4COQHZME6EZYWVbkHjHDbULpml3g8HGJHzpAMkj9tXNCPxf36A+f1oUYjsvZt36qPg4cg==} + version: 0.0.61 peerDependencies: - '@volar/language-service': ~2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 peerDependenciesMeta: '@volar/language-service': optional: true volar-service-html@0.0.61: resolution: {integrity: sha512-yFE+YmmgqIL5HI4ORqP++IYb1QaGcv+xBboI0WkCxJJ/M35HZj7f5rbT3eQ24ECLXFbFCFanckwyWJVz5KmN3Q==} + version: 0.0.61 peerDependencies: - '@volar/language-service': ~2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 peerDependenciesMeta: '@volar/language-service': optional: true volar-service-json@0.0.61: resolution: {integrity: sha512-9PpEib6XE99gFjjjl8IkITktSvfPW39jFAGsHggT6SdlIb8zC7J0+rMjkyVUAUOpWvY5jPqkByX43LcxZvkrdQ==} + version: 0.0.61 peerDependencies: - '@volar/language-service': ~2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 peerDependenciesMeta: '@volar/language-service': optional: true volar-service-pug-beautify@0.0.61: resolution: {integrity: sha512-FvZEZJdZ64pa3a0u1Urz08g4gHjuPcdMsEsJGiDLYqJnIZEGZRyhHUjSxfmAxihZCzp738W90tOMQDbgeQMGhA==} + version: 0.0.61 peerDependencies: - '@volar/language-service': ~2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 peerDependenciesMeta: '@volar/language-service': optional: true @@ -3318,16 +3344,18 @@ packages: volar-service-typescript-twoslash-queries@0.0.61: resolution: {integrity: sha512-99FICGrEF0r1E2tV+SvprHPw9Knyg7BdW2fUch0tf59kG+KG+Tj4tL6tUg+cy8f23O/VXlmsWFMIE+bx1dXPnQ==} + version: 0.0.61 peerDependencies: - '@volar/language-service': ~2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 peerDependenciesMeta: '@volar/language-service': optional: true - volar-service-typescript@0.0.61: - resolution: {integrity: sha512-4kRHxVbW7wFBHZWRU6yWxTgiKETBDIJNwmJUAWeP0mHaKpnDGj/astdRFKqGFRYVeEYl45lcUPhdJyrzanjsdQ==} + volar-service-typescript@https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed: + resolution: {tarball: https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed} + version: 0.0.61 peerDependencies: - '@volar/language-service': ~2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 peerDependenciesMeta: '@volar/language-service': optional: true @@ -4350,24 +4378,24 @@ snapshots: loupe: 3.1.1 tinyrainbow: 1.2.0 - '@volar/kit@2.4.0(typescript@5.5.3)': + '@volar/kit@https://pkg.pr.new/volarjs/volar.js/@volar/kit@01441c3(typescript@5.5.3)': dependencies: - '@volar/language-service': 2.4.0 - '@volar/typescript': 2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/typescript': https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 typesafe-path: 0.2.2 typescript: 5.5.3 vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 - '@volar/language-core@2.4.0': + '@volar/language-core@https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3': dependencies: - '@volar/source-map': 2.4.0 + '@volar/source-map': https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3 - '@volar/language-server@2.4.0': + '@volar/language-server@https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3': dependencies: - '@volar/language-core': 2.4.0 - '@volar/language-service': 2.4.0 - '@volar/typescript': 2.4.0 + '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/typescript': https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 path-browserify: 1.0.1 request-light: 0.7.0 vscode-languageserver: 9.0.1 @@ -4375,24 +4403,31 @@ snapshots: vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 - '@volar/language-service@2.4.0': + '@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3': dependencies: - '@volar/language-core': 2.4.0 + '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 vscode-languageserver-protocol: 3.17.5 vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 - '@volar/source-map@2.4.0': {} + '@volar/source-map@https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3': {} + + '@volar/test-utils@2.4.0': + dependencies: + '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 + '@volar/language-server': https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3 + vscode-languageserver-textdocument: 1.0.11 + vscode-uri: 3.0.8 - '@volar/typescript@2.4.0': + '@volar/typescript@https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3': dependencies: - '@volar/language-core': 2.4.0 + '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 path-browserify: 1.0.1 vscode-uri: 3.0.8 - '@volar/vscode@2.4.0': + '@volar/vscode@https://pkg.pr.new/volarjs/volar.js/@volar/vscode@01441c3': dependencies: - '@volar/language-server': 2.4.0 + '@volar/language-server': https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3 path-browserify: 1.0.1 vscode-languageclient: 9.0.1 vscode-nls: 5.2.0 @@ -6754,61 +6789,61 @@ snapshots: - supports-color - terser - volar-service-css@0.0.61(@volar/language-service@2.4.0): + volar-service-css@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3): dependencies: vscode-css-languageservice: 6.3.0 vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': 2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 - volar-service-emmet@0.0.61(@volar/language-service@2.4.0): + volar-service-emmet@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3): 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.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 - volar-service-html@0.0.61(@volar/language-service@2.4.0): + volar-service-html@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3): dependencies: vscode-html-languageservice: 5.3.0 vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': 2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 - volar-service-json@0.0.61(@volar/language-service@2.4.0): + volar-service-json@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3): dependencies: vscode-json-languageservice: 5.4.0 vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': 2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 - volar-service-pug-beautify@0.0.61(@volar/language-service@2.4.0): + volar-service-pug-beautify@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3): dependencies: '@johnsoncodehk/pug-beautify': 0.2.2 optionalDependencies: - '@volar/language-service': 2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 volar-service-pug@0.0.61: dependencies: - '@volar/language-service': 2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 muggle-string: 0.4.1 pug-lexer: 5.0.1 pug-parser: 6.0.0 - volar-service-html: 0.0.61(@volar/language-service@2.4.0) + volar-service-html: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) vscode-html-languageservice: 5.3.0 vscode-languageserver-textdocument: 1.0.11 - volar-service-typescript-twoslash-queries@0.0.61(@volar/language-service@2.4.0): + volar-service-typescript-twoslash-queries@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3): dependencies: vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': 2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 - volar-service-typescript@0.0.61(@volar/language-service@2.4.0): + volar-service-typescript@https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3): dependencies: path-browserify: 1.0.1 semver: 7.6.2 @@ -6817,7 +6852,7 @@ snapshots: vscode-nls: 5.2.0 vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': 2.4.0 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 vscode-css-languageservice@6.3.0: dependencies: diff --git a/test-workspace/language-service/complete/#2454/input/entry.vue b/test-workspace/language-service/complete/#2454/input/entry.vue deleted file mode 100644 index 5fd9768ec3..0000000000 --- a/test-workspace/language-service/complete/#2454/input/entry.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - diff --git a/test-workspace/language-service/complete/#2454/output/entry.vue b/test-workspace/language-service/complete/#2454/output/entry.vue deleted file mode 100644 index 0680fd0fe9..0000000000 --- a/test-workspace/language-service/complete/#2454/output/entry.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - diff --git a/test-workspace/language-service/complete/#2511/input/component-for-auto-import.vue b/test-workspace/language-service/complete/#2511/input/component-for-auto-import.vue deleted file mode 100644 index 6b4c19a058..0000000000 --- a/test-workspace/language-service/complete/#2511/input/component-for-auto-import.vue +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test-workspace/language-service/complete/#2511/input/entry.vue b/test-workspace/language-service/complete/#2511/input/entry.vue deleted file mode 100644 index 8f093eed73..0000000000 --- a/test-workspace/language-service/complete/#2511/input/entry.vue +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/test-workspace/language-service/complete/#2511/output/entry.vue b/test-workspace/language-service/complete/#2511/output/entry.vue deleted file mode 100644 index 223cf4517a..0000000000 --- a/test-workspace/language-service/complete/#2511/output/entry.vue +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/test-workspace/language-service/complete/#3658/input/entry.vue b/test-workspace/language-service/complete/#3658/input/entry.vue deleted file mode 100644 index fc9eb31456..0000000000 --- a/test-workspace/language-service/complete/#3658/input/entry.vue +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/test-workspace/language-service/complete/#3658/output/entry.vue b/test-workspace/language-service/complete/#3658/output/entry.vue deleted file mode 100644 index b8aa2161b7..0000000000 --- a/test-workspace/language-service/complete/#3658/output/entry.vue +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/test-workspace/language-service/complete/#4639/input/entry.vue b/test-workspace/language-service/complete/#4639/input/entry.vue deleted file mode 100644 index 730350bee7..0000000000 --- a/test-workspace/language-service/complete/#4639/input/entry.vue +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/test-workspace/language-service/complete/#4639/output/entry.vue b/test-workspace/language-service/complete/#4639/output/entry.vue deleted file mode 100644 index f470a01d83..0000000000 --- a/test-workspace/language-service/complete/#4639/output/entry.vue +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/test-workspace/language-service/complete/$event/input/entry.vue b/test-workspace/language-service/complete/$event/input/entry.vue deleted file mode 100644 index c8ee6a19cc..0000000000 --- a/test-workspace/language-service/complete/$event/input/entry.vue +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/test-workspace/language-service/complete/$event/output/entry.vue b/test-workspace/language-service/complete/$event/output/entry.vue deleted file mode 100644 index 0d0cfecd3f..0000000000 --- a/test-workspace/language-service/complete/$event/output/entry.vue +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/test-workspace/language-service/complete/component-auto-import/input/component-for-auto-import.vue b/test-workspace/language-service/complete/component-auto-import/input/component-for-auto-import.vue deleted file mode 100644 index 6b4c19a058..0000000000 --- a/test-workspace/language-service/complete/component-auto-import/input/component-for-auto-import.vue +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test-workspace/language-service/complete/component-auto-import/input/entry.vue b/test-workspace/language-service/complete/component-auto-import/input/entry.vue deleted file mode 100644 index dac432aed0..0000000000 --- a/test-workspace/language-service/complete/component-auto-import/input/entry.vue +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/test-workspace/language-service/complete/component-auto-import/output/entry.vue b/test-workspace/language-service/complete/component-auto-import/output/entry.vue deleted file mode 100644 index 1072e574b6..0000000000 --- a/test-workspace/language-service/complete/component-auto-import/output/entry.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/test-workspace/language-service/complete/core#8811/input/entry.vue b/test-workspace/language-service/complete/core#8811/input/entry.vue deleted file mode 100644 index 68b817417a..0000000000 --- a/test-workspace/language-service/complete/core#8811/input/entry.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/test-workspace/language-service/complete/core#8811/output/entry.vue b/test-workspace/language-service/complete/core#8811/output/entry.vue deleted file mode 100644 index e6ed09a9ae..0000000000 --- a/test-workspace/language-service/complete/core#8811/output/entry.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/test-workspace/language-service/complete/directives/input/entry.vue b/test-workspace/language-service/complete/directives/input/entry.vue deleted file mode 100644 index 7608ec9344..0000000000 --- a/test-workspace/language-service/complete/directives/input/entry.vue +++ /dev/null @@ -1,12 +0,0 @@ - \ No newline at end of file diff --git a/test-workspace/language-service/complete/directives/output/entry.vue b/test-workspace/language-service/complete/directives/output/entry.vue deleted file mode 100644 index 4800a2ef2f..0000000000 --- a/test-workspace/language-service/complete/directives/output/entry.vue +++ /dev/null @@ -1,12 +0,0 @@ - \ No newline at end of file diff --git a/test-workspace/language-service/complete/script-setup/input/entry.vue b/test-workspace/language-service/complete/script-setup/input/entry.vue deleted file mode 100644 index 6db91e021e..0000000000 --- a/test-workspace/language-service/complete/script-setup/input/entry.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/complete/script-setup/output/entry.vue b/test-workspace/language-service/complete/script-setup/output/entry.vue deleted file mode 100644 index 279f132f53..0000000000 --- a/test-workspace/language-service/complete/script-setup/output/entry.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/complete/slot-name/input/main.vue b/test-workspace/language-service/complete/slot-name/input/main.vue deleted file mode 100644 index 8d71f0755c..0000000000 --- a/test-workspace/language-service/complete/slot-name/input/main.vue +++ /dev/null @@ -1,15 +0,0 @@ - - - diff --git a/test-workspace/language-service/complete/slot-name/output/main.vue b/test-workspace/language-service/complete/slot-name/output/main.vue deleted file mode 100644 index 574449504f..0000000000 --- a/test-workspace/language-service/complete/slot-name/output/main.vue +++ /dev/null @@ -1,15 +0,0 @@ - - - diff --git a/test-workspace/language-service/complete/vue-file-path/input/alias-path.vue b/test-workspace/language-service/complete/vue-file-path/input/alias-path.vue deleted file mode 100644 index c3f2edbf7e..0000000000 --- a/test-workspace/language-service/complete/vue-file-path/input/alias-path.vue +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/test-workspace/language-service/complete/vue-file-path/input/component.vue b/test-workspace/language-service/complete/vue-file-path/input/component.vue deleted file mode 100644 index 6b4c19a058..0000000000 --- a/test-workspace/language-service/complete/vue-file-path/input/component.vue +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test-workspace/language-service/complete/vue-file-path/input/relative-path.vue b/test-workspace/language-service/complete/vue-file-path/input/relative-path.vue deleted file mode 100644 index b568bfed5b..0000000000 --- a/test-workspace/language-service/complete/vue-file-path/input/relative-path.vue +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/test-workspace/language-service/complete/vue-file-path/output/alias-path.vue b/test-workspace/language-service/complete/vue-file-path/output/alias-path.vue deleted file mode 100644 index 5d293a39d1..0000000000 --- a/test-workspace/language-service/complete/vue-file-path/output/alias-path.vue +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/test-workspace/language-service/complete/vue-file-path/output/relative-path.vue b/test-workspace/language-service/complete/vue-file-path/output/relative-path.vue deleted file mode 100644 index 5dcd613e80..0000000000 --- a/test-workspace/language-service/complete/vue-file-path/output/relative-path.vue +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/test-workspace/language-service/tsconfig.json b/test-workspace/language-service/tsconfig.json index 133cb386d9..08ba217a85 100644 --- a/test-workspace/language-service/tsconfig.json +++ b/test-workspace/language-service/tsconfig.json @@ -1,5 +1,5 @@ { - "exclude": "../tsconfig.json", + "exclude": [ "../tsconfig.json" ], "compilerOptions": { "paths": { "__COMPLETE_ROOT__/*": [ diff --git a/test-workspace/tsconfigProject/empty.vue b/test-workspace/tsconfigProject/empty.vue new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test-workspace/tsconfigProject/tsconfig.json b/test-workspace/tsconfigProject/tsconfig.json new file mode 100644 index 0000000000..885d9a3f6e --- /dev/null +++ b/test-workspace/tsconfigProject/tsconfig.json @@ -0,0 +1,9 @@ +{ + "exclude": [ "../tsconfig.json" ], + "include": [ "**/*" ], + "compilerOptions": { + "paths": { + "@/*": [ "./*" ] + } + } +} \ No newline at end of file From c2e54b9e5226f16a2f2e45c335d218664a8dcdf9 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Sun, 25 Aug 2024 02:57:47 +0800 Subject: [PATCH 02/10] Rewrite find definitions tests --- .../__snapshots__/completions.spec.ts.snap | 124 ------------------ .../__snapshots__/definitions.spec.ts.snap | 61 +++++++++ .../language-server/tests/definitions.spec.ts | 89 +++++++++++++ packages/language-service/tests/complete.ts | 118 ----------------- .../language-service/tests/findDefinition.ts | 94 ------------- .../find-definition/#2600/entry.vue | 4 - .../find-definition/#2600/foo.vue | 7 - .../find-definition/alias-path/entry.vue | 6 - .../find-definition/alias-path/foo.ts | 1 - .../find-definition/ts-to-vue/component.vue | 1 - .../find-definition/ts-to-vue/entry.ts | 4 - 11 files changed, 150 insertions(+), 359 deletions(-) delete mode 100644 packages/language-server/tests/__snapshots__/completions.spec.ts.snap create mode 100644 packages/language-server/tests/__snapshots__/definitions.spec.ts.snap create mode 100644 packages/language-server/tests/definitions.spec.ts delete mode 100644 packages/language-service/tests/complete.ts delete mode 100644 packages/language-service/tests/findDefinition.ts delete mode 100644 test-workspace/language-service/find-definition/#2600/entry.vue delete mode 100644 test-workspace/language-service/find-definition/#2600/foo.vue delete mode 100644 test-workspace/language-service/find-definition/alias-path/entry.vue delete mode 100644 test-workspace/language-service/find-definition/alias-path/foo.ts delete mode 100644 test-workspace/language-service/find-definition/ts-to-vue/component.vue delete mode 100644 test-workspace/language-service/find-definition/ts-to-vue/entry.ts diff --git a/packages/language-server/tests/__snapshots__/completions.spec.ts.snap b/packages/language-server/tests/__snapshots__/completions.spec.ts.snap deleted file mode 100644 index f2b3dd1bf6..0000000000 --- a/packages/language-server/tests/__snapshots__/completions.spec.ts.snap +++ /dev/null @@ -1,124 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`Completions > #2454 1`] = ` -" - - - - " -`; - -exports[`Completions > #2511 1`] = ` -" - - " -`; - -exports[`Completions > #3658 1`] = ` -" - - " -`; - -exports[`Completions > #4639 1`] = ` -" - - " -`; - -exports[`Completions > $event argument 1`] = `""`; - -exports[`Completions > - " -`; - -exports[`Completions > Alias path 1`] = ` -" - - " -`; - -exports[`Completions > Component auto import 1`] = ` -" - - - - " -`; - -exports[`Completions > Directives 1`] = `""`; - -exports[`Completions > Directives 2`] = `""`; - -exports[`Completions > Directives 3`] = `""`; - -exports[`Completions > Directives 4`] = `""`; - -exports[`Completions > Relative path 1`] = ` -" - - " -`; - -exports[`Completions > Slot name 1`] = ` -" - - - - " -`; - -exports[`Completions > core#8811 1`] = ` -" - - - - " -`; diff --git a/packages/language-server/tests/__snapshots__/definitions.spec.ts.snap b/packages/language-server/tests/__snapshots__/definitions.spec.ts.snap new file mode 100644 index 0000000000..ff893647c0 --- /dev/null +++ b/packages/language-server/tests/__snapshots__/definitions.spec.ts.snap @@ -0,0 +1,61 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Definitions > #2600 1`] = `"tsconfigProject/foo.vue"`; + +exports[`Definitions > #2600 2`] = ` +{ + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, +} +`; + +exports[`Definitions > Alias path 1`] = `"tsconfigProject/foo.ts"`; + +exports[`Definitions > Alias path 2`] = ` +{ + "end": { + "character": 25, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, +} +`; + +exports[`Definitions > TS to vue 1`] = `"tsconfigProject/empty.vue"`; + +exports[`Definitions > TS to vue 2`] = ` +{ + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, +} +`; + +exports[`Definitions > TS to vue 3`] = `"tsconfigProject/empty.vue"`; + +exports[`Definitions > TS to vue 4`] = ` +{ + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, +} +`; diff --git a/packages/language-server/tests/definitions.spec.ts b/packages/language-server/tests/definitions.spec.ts new file mode 100644 index 0000000000..0121718366 --- /dev/null +++ b/packages/language-server/tests/definitions.spec.ts @@ -0,0 +1,89 @@ +import { Location, TextDocument } from '@volar/language-server'; +import * as path from 'path'; +import { afterEach, describe, expect, it } from 'vitest'; +import { URI } from 'vscode-uri'; +import { getLanguageServer, testWorkspacePath } from './server.js'; + +describe('Definitions', async () => { + + it('TS to vue', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await assertDefinition('tsconfigProject/fixture1.ts', 'typescript', `import C|omponent from './empty.vue';`); + await assertDefinition('tsconfigProject/fixture2.ts', 'typescript', `import Component from '|./empty.vue';`); + }); + + it('Alias path', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await openDocument('tsconfigProject/foo.ts', 'typescript', `export const foo = 'foo';`); + await assertDefinition('tsconfigProject/fixture.vue', 'vue', ` + + `); + }); + + it('#2600', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await openDocument('tsconfigProject/foo.vue', 'vue', ` + + + + `); + await assertDefinition('tsconfigProject/fixture.vue', 'vue', ` + + `); + }); + + const openedDocuments: TextDocument[] = []; + + afterEach(async () => { + const server = await getLanguageServer(); + for (const document of openedDocuments) { + await server.closeTextDocument(document.uri); + } + openedDocuments.length = 0; + }); + + /** + * @deprecated Remove this when #4717 fixed. + */ + async function ensureGlobalTypesHolder(folderName: string) { + const document = await openDocument(`${folderName}/globalTypesHolder.vue`, 'vue', ''); + const server = await getLanguageServer(); + await server.sendDocumentDiagnosticRequest(document.uri); + } + + async function assertDefinition(fileName: string, languageId: string, content: string) { + const offset = content.indexOf('|'); + content = content.slice(0, offset) + content.slice(offset + 1); + + const server = await getLanguageServer(); + let document = await openDocument(fileName, languageId, content); + + const position = document.positionAt(offset); + const definition = await server.sendDefinitionRequest(document.uri, position) as Location[] | null; + expect(definition).toBeDefined(); + expect(definition!.length).greaterThan(0); + + for (const loc of definition!) { + expect(path.relative(testWorkspacePath, URI.parse(loc.uri).fsPath)).toMatchSnapshot(); + expect(loc.range).toMatchSnapshot(); + } + } + + async function openDocument(fileName: string, languageId: string, content: string) { + const server = await getLanguageServer(); + const uri = URI.file(`${testWorkspacePath}/${fileName}`); + const document = await server.openInMemoryDocument(uri.toString(), languageId, content); + if (openedDocuments.every(d => d.uri !== document.uri)) { + openedDocuments.push(document); + } + return document; + } +}); diff --git a/packages/language-service/tests/complete.ts b/packages/language-service/tests/complete.ts deleted file mode 100644 index 582287949d..0000000000 --- a/packages/language-service/tests/complete.ts +++ /dev/null @@ -1,118 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import { describe, expect, it } from 'vitest'; -import type * as vscode from 'vscode-languageserver-protocol'; -import { TextDocument } from 'vscode-languageserver-textdocument'; -import { tester } from './utils/createTester'; -import { fileNameToUri } from './utils/mockEnv'; - -const baseDir = path.resolve(__dirname, '../../../test-workspace/language-service/complete'); -const testDirs = fs.readdirSync(baseDir); -const getLineText = (text: string, line: number) => text.replace(/\r\n/g, '\n').split('\n')[line]; - -for (const dirName of testDirs) { - - describe(`complete: ${dirName}`, async () => { - - const dir = path.join(baseDir, dirName); - const inputFiles = readFiles(path.join(dir, 'input')); - const outputFiles = readFiles(path.join(dir, 'output')); - - for (const file in inputFiles) { - - const filePath = path.join(dir, 'input', file); - const uri = fileNameToUri(filePath); - const fileText = inputFiles[file]; - const document = TextDocument.create('', '', 0, fileText); - const actions = findCompleteActions(fileText); - - const expectedFileText = outputFiles[file]; - - for (const action of actions) { - - const position = document.positionAt(action.offset); - - position.line--; - - const location = `${filePath}:${position.line + 1}:${position.character + 1}`; - - it(`${location} => ${action.label}`, async () => { - - expect(expectedFileText).toBeDefined(); - - let complete = await tester.languageService.getCompletionItems( - uri, - position, - { triggerKind: 1 satisfies typeof vscode.CompletionTriggerKind.Invoked } - ); - - if (!complete.items.length) { - // fix #2511 test case, it's a bug of TS 5.3 - complete = await tester.languageService.getCompletionItems( - uri, - position, - { triggerKind: 1 satisfies typeof vscode.CompletionTriggerKind.Invoked } - ); - } - - let item = complete.items.find(item => item.label === action.label)!; - - expect(item).toBeDefined(); - - item = await tester.languageService.resolveCompletionItem(item); - - let edits: vscode.TextEdit[] = []; - - if (item.textEdit) { - if ('replace' in item.textEdit) { - edits.push({ range: item.textEdit.replace, newText: item.textEdit.newText }); - } - else { - edits.push(item.textEdit); - } - } - else { - edits.push({ range: { start: position, end: position }, newText: item.insertText ?? item.label }); - } - - if (item.additionalTextEdits) { - edits = edits.concat(item.additionalTextEdits); - } - - let result = TextDocument.applyEdits(TextDocument.create('', '', 0, fileText), edits); - - result = result.replace(/\$0/g, '').replace(/\$1/g, ''); - - expect(getLineText(result, position.line)).toBe(getLineText(expectedFileText, position.line)); - }); - } - } - }); -} - -function readFiles(dir: string) { - - const filesText: Record = {}; - const files = fs.readdirSync(dir); - - for (const file of files) { - const filePath = path.join(dir, file); - filesText[file] = fs.readFileSync(filePath, 'utf8'); - } - - return filesText; -} - -function findCompleteActions(text: string) { - - return [...text.matchAll(/(\^*)complete:\s*([\S]*)/g)].map(flag => { - - const offset = flag.index; - const label = flag[2]; - - return { - offset, - label, - }; - }); -} diff --git a/packages/language-service/tests/findDefinition.ts b/packages/language-service/tests/findDefinition.ts deleted file mode 100644 index c359d44e3b..0000000000 --- a/packages/language-service/tests/findDefinition.ts +++ /dev/null @@ -1,94 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import { describe, expect, it } from 'vitest'; -import { TextDocument } from 'vscode-languageserver-textdocument'; -import { tester } from './utils/createTester'; -import { fileNameToUri } from './utils/mockEnv'; - -const baseDir = path.resolve(__dirname, '../../../test-workspace/language-service/find-definition'); -const testDirs = fs.readdirSync(baseDir); - -for (const dirName of testDirs) { - - describe(`find definition: ${dirName}`, async () => { - - const dir = path.join(baseDir, dirName); - const inputFiles = readFiles(dir); - - for (const file in inputFiles) { - - const filePath = path.join(dir, file); - const uri = fileNameToUri(filePath); - const fileText = inputFiles[file]; - const document = TextDocument.create('', '', 0, fileText); - const actions = findActions(fileText); - - for (const action of actions) { - - const position = document.positionAt(action.offset); - - position.line--; - - const targetFile = path.resolve(dir, action.targetFile); - const targetDocument = TextDocument.create('', '', 0, fs.readFileSync(targetFile, 'utf8')); - - it(`${filePath}:${position.line + 1}:${position.character + 1} => ${targetFile}:${action.targeRange.start}`, async () => { - - const locations = await tester.languageService.getDefinition( - uri, - position - ); - - expect(locations).toBeDefined(); - - const location = locations?.find(loc => - loc.targetUri === fileNameToUri(targetFile).toString() - && targetDocument.offsetAt(loc.targetSelectionRange.start) === action.targeRange.start - && targetDocument.offsetAt(loc.targetSelectionRange.end) === action.targeRange.end - ); - - if (!location) { - console.log(JSON.stringify(locations, null, 2)); - console.log(action.targeRange); - } - - expect(location).toBeDefined(); - }); - } - } - }); -} - -function readFiles(dir: string) { - - const filesText: Record = {}; - const files = fs.readdirSync(dir); - - for (const file of files) { - const filePath = path.join(dir, file); - filesText[file] = fs.readFileSync(filePath, 'utf8'); - } - - return filesText; -} - -const definitionReg = /(\^*)definition:\s*([\S]*),\s*([\S]*),\s*([\S]*)/g; - -function findActions(text: string) { - - return [...text.matchAll(definitionReg)].map(flag => { - - const offset = flag.index; - const targetFile = flag[2]; - const targeRange = { - start: Number(flag[3]), - end: Number(flag[4]), - }; - - return { - offset, - targetFile, - targeRange, - }; - }); -} diff --git a/test-workspace/language-service/find-definition/#2600/entry.vue b/test-workspace/language-service/find-definition/#2600/entry.vue deleted file mode 100644 index a39313dd73..0000000000 --- a/test-workspace/language-service/find-definition/#2600/entry.vue +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/test-workspace/language-service/find-definition/#2600/foo.vue b/test-workspace/language-service/find-definition/#2600/foo.vue deleted file mode 100644 index 35fd4030f5..0000000000 --- a/test-workspace/language-service/find-definition/#2600/foo.vue +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/test-workspace/language-service/find-definition/alias-path/entry.vue b/test-workspace/language-service/find-definition/alias-path/entry.vue deleted file mode 100644 index 0df2ffefbb..0000000000 --- a/test-workspace/language-service/find-definition/alias-path/entry.vue +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/test-workspace/language-service/find-definition/alias-path/foo.ts b/test-workspace/language-service/find-definition/alias-path/foo.ts deleted file mode 100644 index 3329a7d972..0000000000 --- a/test-workspace/language-service/find-definition/alias-path/foo.ts +++ /dev/null @@ -1 +0,0 @@ -export const foo = 'foo'; diff --git a/test-workspace/language-service/find-definition/ts-to-vue/component.vue b/test-workspace/language-service/find-definition/ts-to-vue/component.vue deleted file mode 100644 index 6b4c19a058..0000000000 --- a/test-workspace/language-service/find-definition/ts-to-vue/component.vue +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test-workspace/language-service/find-definition/ts-to-vue/entry.ts b/test-workspace/language-service/find-definition/ts-to-vue/entry.ts deleted file mode 100644 index d3e3c899c0..0000000000 --- a/test-workspace/language-service/find-definition/ts-to-vue/entry.ts +++ /dev/null @@ -1,4 +0,0 @@ -import Component from './component.vue'; - // ^definition: ./component.vue, 0, 0 -import Component from './component.vue'; - // ^definition: ./component.vue, 0, 0 From 117ce52907d39f16b37b1520c11b94215914fe62 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Sun, 25 Aug 2024 03:23:34 +0800 Subject: [PATCH 03/10] Rewrite find references tests --- .../__snapshots__/completions.spec.ts.snap | 124 ++++++++++++++++++ .../__snapshots__/references.spec.ts.snap | 91 +++++++++++++ .../language-server/tests/references.spec.ts | 106 +++++++++++++++ .../reference/slot-default/entry.vue | 4 - .../reference/slot-default/foo.vue | 9 -- .../reference/slot-named/entry.vue | 4 - .../reference/slot-named/foo.vue | 7 - .../reference/v-bind-shorthand/child.vue | 6 - .../reference/v-bind-shorthand/entry.vue | 13 -- vitest.config.ts | 5 +- 10 files changed, 324 insertions(+), 45 deletions(-) create mode 100644 packages/language-server/tests/__snapshots__/completions.spec.ts.snap create mode 100644 packages/language-server/tests/__snapshots__/references.spec.ts.snap create mode 100644 packages/language-server/tests/references.spec.ts delete mode 100644 test-workspace/language-service/reference/slot-default/entry.vue delete mode 100644 test-workspace/language-service/reference/slot-default/foo.vue delete mode 100644 test-workspace/language-service/reference/slot-named/entry.vue delete mode 100644 test-workspace/language-service/reference/slot-named/foo.vue delete mode 100644 test-workspace/language-service/reference/v-bind-shorthand/child.vue delete mode 100644 test-workspace/language-service/reference/v-bind-shorthand/entry.vue diff --git a/packages/language-server/tests/__snapshots__/completions.spec.ts.snap b/packages/language-server/tests/__snapshots__/completions.spec.ts.snap new file mode 100644 index 0000000000..f2b3dd1bf6 --- /dev/null +++ b/packages/language-server/tests/__snapshots__/completions.spec.ts.snap @@ -0,0 +1,124 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Completions > #2454 1`] = ` +" + + + + " +`; + +exports[`Completions > #2511 1`] = ` +" + + " +`; + +exports[`Completions > #3658 1`] = ` +" + + " +`; + +exports[`Completions > #4639 1`] = ` +" + + " +`; + +exports[`Completions > $event argument 1`] = `""`; + +exports[`Completions > + " +`; + +exports[`Completions > Alias path 1`] = ` +" + + " +`; + +exports[`Completions > Component auto import 1`] = ` +" + + + + " +`; + +exports[`Completions > Directives 1`] = `""`; + +exports[`Completions > Directives 2`] = `""`; + +exports[`Completions > Directives 3`] = `""`; + +exports[`Completions > Directives 4`] = `""`; + +exports[`Completions > Relative path 1`] = ` +" + + " +`; + +exports[`Completions > Slot name 1`] = ` +" + + + + " +`; + +exports[`Completions > core#8811 1`] = ` +" + + + + " +`; diff --git a/packages/language-server/tests/__snapshots__/references.spec.ts.snap b/packages/language-server/tests/__snapshots__/references.spec.ts.snap new file mode 100644 index 0000000000..b741277166 --- /dev/null +++ b/packages/language-server/tests/__snapshots__/references.spec.ts.snap @@ -0,0 +1,91 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Definitions > Default slot 1`] = `"tsconfigProject/foo.vue"`; + +exports[`Definitions > Default slot 2`] = ` +{ + "end": { + "character": 16, + "line": 7, + }, + "start": { + "character": 5, + "line": 7, + }, +} +`; + +exports[`Definitions > Default slot 3`] = `"tsconfigProject/fixture.vue"`; + +exports[`Definitions > Default slot 4`] = ` +{ + "end": { + "character": 9, + "line": 2, + }, + "start": { + "character": 5, + "line": 2, + }, +} +`; + +exports[`Definitions > Named slot 1`] = `"tsconfigProject/foo.vue"`; + +exports[`Definitions > Named slot 2`] = ` +{ + "end": { + "character": 17, + "line": 6, + }, + "start": { + "character": 14, + "line": 6, + }, +} +`; + +exports[`Definitions > Named slot 3`] = `"tsconfigProject/fixture.vue"`; + +exports[`Definitions > Named slot 4`] = ` +{ + "end": { + "character": 19, + "line": 2, + }, + "start": { + "character": 16, + "line": 2, + }, +} +`; + +exports[`Definitions > v-bind shorthand 1`] = `"tsconfigProject/fixture.vue"`; + +exports[`Definitions > v-bind shorthand 2`] = ` +{ + "end": { + "character": 13, + "line": 6, + }, + "start": { + "character": 10, + "line": 6, + }, +} +`; + +exports[`Definitions > v-bind shorthand 3`] = `"tsconfigProject/fixture.vue"`; + +exports[`Definitions > v-bind shorthand 4`] = ` +{ + "end": { + "character": 12, + "line": 2, + }, + "start": { + "character": 9, + "line": 2, + }, +} +`; diff --git a/packages/language-server/tests/references.spec.ts b/packages/language-server/tests/references.spec.ts new file mode 100644 index 0000000000..34225abf5d --- /dev/null +++ b/packages/language-server/tests/references.spec.ts @@ -0,0 +1,106 @@ +import { TextDocument } from '@volar/language-server'; +import * as path from 'path'; +import { afterEach, describe, expect, it } from 'vitest'; +import { URI } from 'vscode-uri'; +import { getLanguageServer, testWorkspacePath } from './server.js'; + +describe('Definitions', async () => { + + it('Default slot', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await openDocument('tsconfigProject/foo.vue', 'vue', ` + + + + `); + await assertReferences('tsconfigProject/fixture.vue', 'vue', ` + + `); + }); + + it('Named slot', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await openDocument('tsconfigProject/foo.vue', 'vue', ` + + + + `); + await assertReferences('tsconfigProject/fixture.vue', 'vue', ` + + `); + }); + + it('v-bind shorthand', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await assertReferences('tsconfigProject/fixture.vue', 'vue', ` + + + + `); + }); + + const openedDocuments: TextDocument[] = []; + + afterEach(async () => { + const server = await getLanguageServer(); + for (const document of openedDocuments) { + await server.closeTextDocument(document.uri); + } + openedDocuments.length = 0; + }); + + /** + * @deprecated Remove this when #4717 fixed. + */ + async function ensureGlobalTypesHolder(folderName: string) { + const document = await openDocument(`${folderName}/globalTypesHolder.vue`, 'vue', ''); + const server = await getLanguageServer(); + await server.sendDocumentDiagnosticRequest(document.uri); + } + + async function assertReferences(fileName: string, languageId: string, content: string) { + const offset = content.indexOf('|'); + content = content.slice(0, offset) + content.slice(offset + 1); + + const server = await getLanguageServer(); + let document = await openDocument(fileName, languageId, content); + + const position = document.positionAt(offset); + const references = await server.sendReferencesRequest(document.uri, position, { includeDeclaration: false }); + expect(references).toBeDefined(); + expect(references!.length).greaterThan(0); + + for (const loc of references!) { + expect(path.relative(testWorkspacePath, URI.parse(loc.uri).fsPath)).toMatchSnapshot(); + expect(loc.range).toMatchSnapshot(); + } + } + + async function openDocument(fileName: string, languageId: string, content: string) { + const server = await getLanguageServer(); + const uri = URI.file(`${testWorkspacePath}/${fileName}`); + const document = await server.openInMemoryDocument(uri.toString(), languageId, content); + if (openedDocuments.every(d => d.uri !== document.uri)) { + openedDocuments.push(document); + } + return document; + } +}); diff --git a/test-workspace/language-service/reference/slot-default/entry.vue b/test-workspace/language-service/reference/slot-default/entry.vue deleted file mode 100644 index a09b7689aa..0000000000 --- a/test-workspace/language-service/reference/slot-default/entry.vue +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/test-workspace/language-service/reference/slot-default/foo.vue b/test-workspace/language-service/reference/slot-default/foo.vue deleted file mode 100644 index 91ed6dfe33..0000000000 --- a/test-workspace/language-service/reference/slot-default/foo.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/test-workspace/language-service/reference/slot-named/entry.vue b/test-workspace/language-service/reference/slot-named/entry.vue deleted file mode 100644 index b4f17d8bc7..0000000000 --- a/test-workspace/language-service/reference/slot-named/entry.vue +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/test-workspace/language-service/reference/slot-named/foo.vue b/test-workspace/language-service/reference/slot-named/foo.vue deleted file mode 100644 index 0add3c2b7a..0000000000 --- a/test-workspace/language-service/reference/slot-named/foo.vue +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/test-workspace/language-service/reference/v-bind-shorthand/child.vue b/test-workspace/language-service/reference/v-bind-shorthand/child.vue deleted file mode 100644 index 51b389e379..0000000000 --- a/test-workspace/language-service/reference/v-bind-shorthand/child.vue +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/test-workspace/language-service/reference/v-bind-shorthand/entry.vue b/test-workspace/language-service/reference/v-bind-shorthand/entry.vue deleted file mode 100644 index 5f9a43593c..0000000000 --- a/test-workspace/language-service/reference/v-bind-shorthand/entry.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/vitest.config.ts b/vitest.config.ts index 7f9fdf64dd..c18a84c391 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -2,9 +2,10 @@ import { defineConfig } from 'vitest/config'; export default defineConfig({ test: { + include: ['packages/language-server/tests/**/*.spec.ts'], poolOptions: { - threads: { - singleThread: true, + forks: { + singleFork: true, isolate: false, }, }, From 1c864d30d981d456763a38409a0ca563a02fd213 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Sun, 25 Aug 2024 03:59:18 +0800 Subject: [PATCH 04/10] Rewrite inlay hints tests --- package.json | 15 +- .../__snapshots__/inlayHints.spec.ts.snap | 80 +++++++ .../language-server/tests/completions.spec.ts | 1 + .../language-server/tests/definitions.spec.ts | 1 + .../language-server/tests/inlayHints.spec.ts | 143 ++++++++++++ .../language-server/tests/references.spec.ts | 1 + packages/language-server/tests/server.ts | 13 ++ packages/language-service/tests/inlayHint.ts | 80 ------- packages/language-service/tests/reference.ts | 79 ------- pnpm-lock.yaml | 206 +++++++++--------- .../inlay-hint/destructured-props/entry.vue | 52 ----- .../inline-handler-leading/entry.vue | 8 - .../inlay-hint/missing-props/Comp.vue | 5 - .../inlay-hint/missing-props/entry.vue | 8 - .../inlay-hint/option-wrapper/entry.vue | 4 - vitest.config.ts | 2 +- 16 files changed, 352 insertions(+), 346 deletions(-) create mode 100644 packages/language-server/tests/__snapshots__/inlayHints.spec.ts.snap create mode 100644 packages/language-server/tests/inlayHints.spec.ts delete mode 100644 packages/language-service/tests/inlayHint.ts delete mode 100644 packages/language-service/tests/reference.ts delete mode 100644 test-workspace/language-service/inlay-hint/destructured-props/entry.vue delete mode 100644 test-workspace/language-service/inlay-hint/inline-handler-leading/entry.vue delete mode 100644 test-workspace/language-service/inlay-hint/missing-props/Comp.vue delete mode 100644 test-workspace/language-service/inlay-hint/missing-props/entry.vue delete mode 100644 test-workspace/language-service/inlay-hint/option-wrapper/entry.vue diff --git a/package.json b/package.json index 7f31f5886e..7bd8603bfc 100644 --- a/package.json +++ b/package.json @@ -31,13 +31,14 @@ }, "pnpm": { "overrides": { - "@volar/kit": "https://pkg.pr.new/volarjs/volar.js/@volar/kit@01441c3", - "@volar/language-core": "https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3", - "@volar/language-server": "https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3", - "@volar/language-service": "https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3", - "@volar/source-map": "https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3", - "@volar/typescript": "https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3", - "@volar/vscode": "https://pkg.pr.new/volarjs/volar.js/@volar/vscode@01441c3", + "@volar/kit": "https://pkg.pr.new/volarjs/volar.js/@volar/kit@87ad0b2", + "@volar/language-core": "https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2", + "@volar/language-server": "https://pkg.pr.new/volarjs/volar.js/@volar/language-server@87ad0b2", + "@volar/language-service": "https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2", + "@volar/source-map": "https://pkg.pr.new/volarjs/volar.js/@volar/source-map@87ad0b2", + "@volar/test-utils": "https://pkg.pr.new/volarjs/volar.js/@volar/test-utils@87ad0b2", + "@volar/typescript": "https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2", + "@volar/vscode": "https://pkg.pr.new/volarjs/volar.js/@volar/vscode@87ad0b2", "volar-service-typescript": "https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed", "inquirer": "9.2.23" } diff --git a/packages/language-server/tests/__snapshots__/inlayHints.spec.ts.snap b/packages/language-server/tests/__snapshots__/inlayHints.spec.ts.snap new file mode 100644 index 0000000000..72d2107aaa --- /dev/null +++ b/packages/language-server/tests/__snapshots__/inlayHints.spec.ts.snap @@ -0,0 +1,80 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Definitions > Destructured props 1`] = ` +" + + " +`; + +exports[`Definitions > Inline handler leading 1`] = ` +" + + + + " +`; + +exports[`Definitions > Missing props 1`] = ` +" + + + + " +`; + +exports[`Definitions > Options wrapper 1`] = ` +" + + " +`; diff --git a/packages/language-server/tests/completions.spec.ts b/packages/language-server/tests/completions.spec.ts index 13307a0b39..560ac8a007 100644 --- a/packages/language-server/tests/completions.spec.ts +++ b/packages/language-server/tests/completions.spec.ts @@ -155,6 +155,7 @@ describe('Completions', async () => { async function assertCompletion(fileName: string, languageId: string, content: string, itemLabel: string) { const offset = content.indexOf('|'); + expect(offset).toBeGreaterThanOrEqual(0); content = content.slice(0, offset) + content.slice(offset + 1); const server = await getLanguageServer(); diff --git a/packages/language-server/tests/definitions.spec.ts b/packages/language-server/tests/definitions.spec.ts index 0121718366..2f10402043 100644 --- a/packages/language-server/tests/definitions.spec.ts +++ b/packages/language-server/tests/definitions.spec.ts @@ -61,6 +61,7 @@ describe('Definitions', async () => { async function assertDefinition(fileName: string, languageId: string, content: string) { const offset = content.indexOf('|'); + expect(offset).toBeGreaterThanOrEqual(0); content = content.slice(0, offset) + content.slice(offset + 1); const server = await getLanguageServer(); diff --git a/packages/language-server/tests/inlayHints.spec.ts b/packages/language-server/tests/inlayHints.spec.ts new file mode 100644 index 0000000000..108da9c8a8 --- /dev/null +++ b/packages/language-server/tests/inlayHints.spec.ts @@ -0,0 +1,143 @@ +import { TextDocument } from '@volar/language-server'; +import { afterEach, describe, expect, it } from 'vitest'; +import { URI } from 'vscode-uri'; +import { getLanguageServer, testWorkspacePath } from './server.js'; + +describe('Definitions', async () => { + + it('Inline handler leading', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await assertInlayHints('tsconfigProject/fixture.vue', 'vue', ` + + + + `); + }); + + it('Missing props', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + openDocument('tsconfigProject/foo.vue', 'vue', ` + + `); + await assertInlayHints('tsconfigProject/fixture.vue', 'vue', ` + + + + `); + }); + + it('Options wrapper', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await assertInlayHints('tsconfigProject/fixture.vue', 'vue', ` + + `); + }); + + it('Destructured props', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await assertInlayHints('tsconfigProject/fixture.vue', 'vue', ` + + `); + }); + + const openedDocuments: TextDocument[] = []; + + afterEach(async () => { + const server = await getLanguageServer(); + for (const document of openedDocuments) { + await server.closeTextDocument(document.uri); + } + openedDocuments.length = 0; + }); + + /** + * @deprecated Remove this when #4717 fixed. + */ + async function ensureGlobalTypesHolder(folderName: string) { + const document = await openDocument(`${folderName}/globalTypesHolder.vue`, 'vue', ''); + const server = await getLanguageServer(); + await server.sendDocumentDiagnosticRequest(document.uri); + } + + async function assertInlayHints(fileName: string, languageId: string, content: string) { + const server = await getLanguageServer(); + let document = await openDocument(fileName, languageId, content); + + const inlayHints = await server.sendInlayHintRequest(document.uri, { start: document.positionAt(0), end: document.positionAt(content.length) }); + expect(inlayHints).toBeDefined(); + expect(inlayHints!.length).greaterThan(0); + + let text = document.getText(); + for (const hint of inlayHints!.sort((a, b) => document.offsetAt(b.position) - document.offsetAt(a.position))) { + const offset = document.offsetAt(hint.position); + text = text.slice(0, offset) + '[' + hint.label + ']' + text.slice(offset); + } + + expect(text).toMatchSnapshot(); + } + + async function openDocument(fileName: string, languageId: string, content: string) { + const server = await getLanguageServer(); + const uri = URI.file(`${testWorkspacePath}/${fileName}`); + const document = await server.openInMemoryDocument(uri.toString(), languageId, content); + if (openedDocuments.every(d => d.uri !== document.uri)) { + openedDocuments.push(document); + } + return document; + } +}); diff --git a/packages/language-server/tests/references.spec.ts b/packages/language-server/tests/references.spec.ts index 34225abf5d..5f356080e8 100644 --- a/packages/language-server/tests/references.spec.ts +++ b/packages/language-server/tests/references.spec.ts @@ -78,6 +78,7 @@ describe('Definitions', async () => { async function assertReferences(fileName: string, languageId: string, content: string) { const offset = content.indexOf('|'); + expect(offset).toBeGreaterThanOrEqual(0); content = content.slice(0, offset) + content.slice(offset + 1); const server = await getLanguageServer(); diff --git a/packages/language-server/tests/server.ts b/packages/language-server/tests/server.ts index d40cbf2077..4cf2d1360a 100644 --- a/packages/language-server/tests/server.ts +++ b/packages/language-server/tests/server.ts @@ -11,6 +11,14 @@ export async function getLanguageServer() { if (!serverHandle) { serverHandle = startLanguageServer(require.resolve('../bin/vue-language-server.js'), testWorkspacePath); serverHandle.connection.onNotification('textDocument/publishDiagnostics', () => { }); + serverHandle.connection.onRequest('workspace/configuration', ({ items }) => { + return items.map(({ section }) => { + if (section.startsWith('vue.inlayHints.')) { + return true; + } + return null; + }); + }); await serverHandle.initialize( URI.file(testWorkspacePath).toString(), @@ -22,6 +30,11 @@ export async function getLanguageServer() { vue: { hybridMode: false, }, + }, + { + workspace: { + configuration: true, + }, } ); } diff --git a/packages/language-service/tests/inlayHint.ts b/packages/language-service/tests/inlayHint.ts deleted file mode 100644 index 47a4acc65f..0000000000 --- a/packages/language-service/tests/inlayHint.ts +++ /dev/null @@ -1,80 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import { describe, expect, it } from 'vitest'; -import { Range } from 'vscode-languageserver-protocol'; -import { TextDocument } from 'vscode-languageserver-textdocument'; -import { tester } from './utils/createTester'; -import { fileNameToUri } from './utils/mockEnv'; - -const baseDir = path.resolve(__dirname, '../../../test-workspace/language-service/inlay-hint'); -const testDirs = fs.readdirSync(baseDir); - -for (const dirName of testDirs) { - - describe(`inlay hint: ${dirName}`, async () => { - - const dir = path.join(baseDir, dirName); - const inputFiles = readFiles(dir); - - for (const file in inputFiles) { - - const filePath = path.join(dir, file); - const uri = fileNameToUri(filePath); - const fileText = inputFiles[file]; - const document = TextDocument.create('', '', 0, fileText); - const actions = findActions(fileText); - - for (const action of actions) { - - const position = document.positionAt(action.offset); - - position.line--; - - const range = Range.create(position, { ...position, character: position.character + 1 }); - - const location = `${filePath}:${position.line + 1}:${position.character + 1}`; - - it(`${location}`, async () => { - - const inlayHints = await tester.languageService.getInlayHints( - uri, - range - ); - - const inlayHint = inlayHints?.find(inlayHint => inlayHint.label === action.label); - - expect(inlayHint).toBeDefined(); - }); - } - } - }); -} - -function readFiles(dir: string) { - - const filesText: Record = {}; - const files = fs.readdirSync(dir); - - for (const file of files) { - const filePath = path.join(dir, file); - filesText[file] = fs.readFileSync(filePath, 'utf8'); - } - - return filesText; -} - -const inlayHintReg = /(\^*)inlayHint:\s*"(.+)"/g; - -function findActions(text: string) { - - return [...text.matchAll(inlayHintReg)].map(flag => { - - const offset = flag.index; - const label = flag[2]; - - return { - offset, - label - }; - }); -} diff --git a/packages/language-service/tests/reference.ts b/packages/language-service/tests/reference.ts deleted file mode 100644 index d7fab82f3b..0000000000 --- a/packages/language-service/tests/reference.ts +++ /dev/null @@ -1,79 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import { describe, expect, it } from 'vitest'; -import { TextDocument } from 'vscode-languageserver-textdocument'; -import { tester } from './utils/createTester'; -import { fileNameToUri } from './utils/mockEnv'; - -const baseDir = path.resolve(__dirname, '../../../test-workspace/language-service/reference'); -const testDirs = fs.readdirSync(baseDir); - -for (const dirName of testDirs) { - - describe(`find reference: ${dirName}`, async () => { - - const dir = path.join(baseDir, dirName); - const inputFiles = readFiles(dir); - - for (const file in inputFiles) { - - const filePath = path.join(dir, file); - const uri = fileNameToUri(filePath); - const fileText = inputFiles[file]; - const document = TextDocument.create('', '', 0, fileText); - const actions = findActions(fileText); - - for (const action of actions) { - - const position = document.positionAt(action.offset); - - position.line--; - - const location = `${filePath}:${position.line + 1}:${position.character + 1}`; - - it(`${location} => count: ${action.count}`, async () => { - - const locations = await tester.languageService.getReferences( - uri, - position, - { includeDeclaration: true } - ); - - expect(locations).toBeDefined(); - - expect(locations?.length).toBe(action.count); - }); - } - } - }); -} - -function readFiles(dir: string) { - - const filesText: Record = {}; - const files = fs.readdirSync(dir); - - for (const file of files) { - const filePath = path.join(dir, file); - filesText[file] = fs.readFileSync(filePath, 'utf8'); - } - - return filesText; -} - -const referenceReg = /(\^*)reference:\s*([\S]*)/g; - -function findActions(text: string) { - - return [...text.matchAll(referenceReg)].map(flag => { - - const offset = flag.index; - // The definition itself is also counted - const count = Number(flag[2]) + 1; - - return { - offset, - count, - }; - }); -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 97373a8f40..1dfc3fa342 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,13 +5,14 @@ settings: excludeLinksFromLockfile: false overrides: - '@volar/kit': https://pkg.pr.new/volarjs/volar.js/@volar/kit@01441c3 - '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 - '@volar/language-server': https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3 - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 - '@volar/source-map': https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3 - '@volar/typescript': https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 - '@volar/vscode': https://pkg.pr.new/volarjs/volar.js/@volar/vscode@01441c3 + '@volar/kit': https://pkg.pr.new/volarjs/volar.js/@volar/kit@87ad0b2 + '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2 + '@volar/language-server': https://pkg.pr.new/volarjs/volar.js/@volar/language-server@87ad0b2 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 + '@volar/source-map': https://pkg.pr.new/volarjs/volar.js/@volar/source-map@87ad0b2 + '@volar/typescript': https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2 + '@volar/test-utils': https://pkg.pr.new/volarjs/volar.js/@volar/test-utils@87ad0b2 + '@volar/vscode': https://pkg.pr.new/volarjs/volar.js/@volar/vscode@87ad0b2 volar-service-typescript: https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed inquirer: 9.2.23 @@ -32,8 +33,8 @@ importers: specifier: latest version: 1.0.14 '@volar/language-service': - specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 - version: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 typescript: specifier: latest version: 5.5.3 @@ -53,8 +54,8 @@ importers: specifier: ^1.82.0 version: 1.91.0 '@volar/vscode': - specifier: https://pkg.pr.new/volarjs/volar.js/@volar/vscode@01441c3 - version: https://pkg.pr.new/volarjs/volar.js/@volar/vscode@01441c3 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/vscode@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/vscode@87ad0b2 '@vscode/vsce': specifier: latest version: 3.0.0 @@ -83,8 +84,8 @@ importers: packages/component-meta: dependencies: '@volar/typescript': - specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 - version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2 '@vue/language-core': specifier: 2.0.28 version: link:../language-core @@ -110,8 +111,8 @@ importers: packages/language-core: dependencies: '@volar/language-core': - specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 - version: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2 '@vue/compiler-dom': specifier: ^3.4.0 version: 3.4.31 @@ -147,8 +148,8 @@ importers: specifier: ^1.0.1 version: 1.0.2 '@volar/typescript': - specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 - version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2 '@vue/compiler-sfc': specifier: ^3.4.0 version: 3.4.31 @@ -156,8 +157,8 @@ importers: packages/language-plugin-pug: dependencies: '@volar/source-map': - specifier: https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3 - version: https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/source-map@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/source-map@87ad0b2 volar-service-pug: specifier: 0.0.61 version: 0.0.61 @@ -172,14 +173,14 @@ importers: packages/language-server: dependencies: '@volar/language-core': - specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 - version: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2 '@volar/language-server': - specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3 - version: https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-server@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/language-server@87ad0b2 '@volar/test-utils': - specifier: ~2.4.0 - version: 2.4.0 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/test-utils@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/test-utils@87ad0b2 '@vue/language-core': specifier: 2.0.28 version: link:../language-core @@ -199,14 +200,14 @@ importers: packages/language-service: dependencies: '@volar/language-core': - specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 - version: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2 '@volar/language-service': - specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 - version: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 '@volar/typescript': - specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 - version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2 '@vue/compiler-dom': specifier: ^3.4.0 version: 3.4.31 @@ -227,28 +228,28 @@ importers: version: 1.0.1 volar-service-css: specifier: 0.0.61 - version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) + version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2) volar-service-emmet: specifier: 0.0.61 - version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) + version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2) volar-service-html: specifier: 0.0.61 - version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) + version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2) volar-service-json: specifier: 0.0.61 - version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) + version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2) volar-service-pug: specifier: 0.0.61 version: 0.0.61 volar-service-pug-beautify: specifier: 0.0.61 - version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) + version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2) volar-service-typescript: specifier: https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed - version: https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) + version: https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2) volar-service-typescript-twoslash-queries: specifier: 0.0.61 - version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) + version: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2) vscode-html-languageservice: specifier: ^5.2.0 version: 5.3.0 @@ -266,8 +267,8 @@ importers: specifier: latest version: 1.0.2 '@volar/kit': - specifier: https://pkg.pr.new/volarjs/volar.js/@volar/kit@01441c3 - version: https://pkg.pr.new/volarjs/volar.js/@volar/kit@01441c3(typescript@5.5.3) + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/kit@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/kit@87ad0b2(typescript@5.5.3) vscode-languageserver-protocol: specifier: ^3.17.5 version: 3.17.5 @@ -275,8 +276,8 @@ importers: packages/tsc: dependencies: '@volar/typescript': - specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 - version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2 '@vue/language-core': specifier: 2.0.28 version: link:../language-core @@ -294,8 +295,8 @@ importers: packages/typescript-plugin: dependencies: '@volar/typescript': - specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 - version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 + specifier: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2 + version: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2 '@vue/language-core': specifier: 2.0.28 version: link:../language-core @@ -1102,37 +1103,38 @@ packages: '@vitest/utils@2.0.3': resolution: {integrity: sha512-c/UdELMuHitQbbc/EVctlBaxoYAwQPQdSNwv7z/vHyBKy2edYZaFgptE27BRueZB7eW8po+cllotMNTDpL3HWg==} - '@volar/kit@https://pkg.pr.new/volarjs/volar.js/@volar/kit@01441c3': - resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/kit@01441c3} + '@volar/kit@https://pkg.pr.new/volarjs/volar.js/@volar/kit@87ad0b2': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/kit@87ad0b2} version: 2.4.0 peerDependencies: typescript: '*' - '@volar/language-core@https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3': - resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3} + '@volar/language-core@https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2} version: 2.4.0 - '@volar/language-server@https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3': - resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3} + '@volar/language-server@https://pkg.pr.new/volarjs/volar.js/@volar/language-server@87ad0b2': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/language-server@87ad0b2} version: 2.4.0 - '@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3': - resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3} + '@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2} version: 2.4.0 - '@volar/source-map@https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3': - resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3} + '@volar/source-map@https://pkg.pr.new/volarjs/volar.js/@volar/source-map@87ad0b2': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/source-map@87ad0b2} version: 2.4.0 - '@volar/test-utils@2.4.0': - resolution: {integrity: sha512-hCXPEY/JrH7ooFvMIUu5V3xaqnCLEwqkKoeMT1UHC6DvsQOGsuyaFsJu2k59aCtE8mxAyq7qww7S4k8kRH8hFw==} + '@volar/test-utils@https://pkg.pr.new/volarjs/volar.js/@volar/test-utils@87ad0b2': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/test-utils@87ad0b2} + version: 2.4.0 - '@volar/typescript@https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3': - resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3} + '@volar/typescript@https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2} version: 2.4.0 - '@volar/vscode@https://pkg.pr.new/volarjs/volar.js/@volar/vscode@01441c3': - resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/vscode@01441c3} + '@volar/vscode@https://pkg.pr.new/volarjs/volar.js/@volar/vscode@87ad0b2': + resolution: {tarball: https://pkg.pr.new/volarjs/volar.js/@volar/vscode@87ad0b2} version: 2.4.0 '@vscode/emmet-helper@2.9.3': @@ -3298,7 +3300,7 @@ packages: resolution: {integrity: sha512-Ct9L/w+IB1JU8F4jofcNCGoHy6TF83aiapfZq9A0qYYpq+Kk5dH+ONS+rVZSsuhsunq8UvAuF8Gk6B8IFLfniw==} version: 0.0.61 peerDependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 peerDependenciesMeta: '@volar/language-service': optional: true @@ -3307,7 +3309,7 @@ packages: resolution: {integrity: sha512-iiYqBxjjcekqrRruw4COQHZME6EZYWVbkHjHDbULpml3g8HGJHzpAMkj9tXNCPxf36A+f1oUYjsvZt36qPg4cg==} version: 0.0.61 peerDependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 peerDependenciesMeta: '@volar/language-service': optional: true @@ -3316,7 +3318,7 @@ packages: resolution: {integrity: sha512-yFE+YmmgqIL5HI4ORqP++IYb1QaGcv+xBboI0WkCxJJ/M35HZj7f5rbT3eQ24ECLXFbFCFanckwyWJVz5KmN3Q==} version: 0.0.61 peerDependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 peerDependenciesMeta: '@volar/language-service': optional: true @@ -3325,7 +3327,7 @@ packages: resolution: {integrity: sha512-9PpEib6XE99gFjjjl8IkITktSvfPW39jFAGsHggT6SdlIb8zC7J0+rMjkyVUAUOpWvY5jPqkByX43LcxZvkrdQ==} version: 0.0.61 peerDependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 peerDependenciesMeta: '@volar/language-service': optional: true @@ -3334,7 +3336,7 @@ packages: resolution: {integrity: sha512-FvZEZJdZ64pa3a0u1Urz08g4gHjuPcdMsEsJGiDLYqJnIZEGZRyhHUjSxfmAxihZCzp738W90tOMQDbgeQMGhA==} version: 0.0.61 peerDependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 peerDependenciesMeta: '@volar/language-service': optional: true @@ -3346,7 +3348,7 @@ packages: resolution: {integrity: sha512-99FICGrEF0r1E2tV+SvprHPw9Knyg7BdW2fUch0tf59kG+KG+Tj4tL6tUg+cy8f23O/VXlmsWFMIE+bx1dXPnQ==} version: 0.0.61 peerDependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 peerDependenciesMeta: '@volar/language-service': optional: true @@ -3355,7 +3357,7 @@ packages: resolution: {tarball: https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed} version: 0.0.61 peerDependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 peerDependenciesMeta: '@volar/language-service': optional: true @@ -4378,24 +4380,24 @@ snapshots: loupe: 3.1.1 tinyrainbow: 1.2.0 - '@volar/kit@https://pkg.pr.new/volarjs/volar.js/@volar/kit@01441c3(typescript@5.5.3)': + '@volar/kit@https://pkg.pr.new/volarjs/volar.js/@volar/kit@87ad0b2(typescript@5.5.3)': dependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 - '@volar/typescript': https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 + '@volar/typescript': https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2 typesafe-path: 0.2.2 typescript: 5.5.3 vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 - '@volar/language-core@https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3': + '@volar/language-core@https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2': dependencies: - '@volar/source-map': https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3 + '@volar/source-map': https://pkg.pr.new/volarjs/volar.js/@volar/source-map@87ad0b2 - '@volar/language-server@https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3': + '@volar/language-server@https://pkg.pr.new/volarjs/volar.js/@volar/language-server@87ad0b2': dependencies: - '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 - '@volar/typescript': https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3 + '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 + '@volar/typescript': https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2 path-browserify: 1.0.1 request-light: 0.7.0 vscode-languageserver: 9.0.1 @@ -4403,31 +4405,31 @@ snapshots: vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 - '@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3': + '@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2': dependencies: - '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 + '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2 vscode-languageserver-protocol: 3.17.5 vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 - '@volar/source-map@https://pkg.pr.new/volarjs/volar.js/@volar/source-map@01441c3': {} + '@volar/source-map@https://pkg.pr.new/volarjs/volar.js/@volar/source-map@87ad0b2': {} - '@volar/test-utils@2.4.0': + '@volar/test-utils@https://pkg.pr.new/volarjs/volar.js/@volar/test-utils@87ad0b2': dependencies: - '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 - '@volar/language-server': https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3 + '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2 + '@volar/language-server': https://pkg.pr.new/volarjs/volar.js/@volar/language-server@87ad0b2 vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 - '@volar/typescript@https://pkg.pr.new/volarjs/volar.js/@volar/typescript@01441c3': + '@volar/typescript@https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2': dependencies: - '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@01441c3 + '@volar/language-core': https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2 path-browserify: 1.0.1 vscode-uri: 3.0.8 - '@volar/vscode@https://pkg.pr.new/volarjs/volar.js/@volar/vscode@01441c3': + '@volar/vscode@https://pkg.pr.new/volarjs/volar.js/@volar/vscode@87ad0b2': dependencies: - '@volar/language-server': https://pkg.pr.new/volarjs/volar.js/@volar/language-server@01441c3 + '@volar/language-server': https://pkg.pr.new/volarjs/volar.js/@volar/language-server@87ad0b2 path-browserify: 1.0.1 vscode-languageclient: 9.0.1 vscode-nls: 5.2.0 @@ -6789,61 +6791,61 @@ snapshots: - supports-color - terser - volar-service-css@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3): + volar-service-css@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2): dependencies: vscode-css-languageservice: 6.3.0 vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 - volar-service-emmet@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3): + volar-service-emmet@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2): 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': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 - volar-service-html@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3): + volar-service-html@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2): dependencies: vscode-html-languageservice: 5.3.0 vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 - volar-service-json@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3): + volar-service-json@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2): dependencies: vscode-json-languageservice: 5.4.0 vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 - volar-service-pug-beautify@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3): + volar-service-pug-beautify@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2): dependencies: '@johnsoncodehk/pug-beautify': 0.2.2 optionalDependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 volar-service-pug@0.0.61: dependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 muggle-string: 0.4.1 pug-lexer: 5.0.1 pug-parser: 6.0.0 - volar-service-html: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3) + volar-service-html: 0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2) vscode-html-languageservice: 5.3.0 vscode-languageserver-textdocument: 1.0.11 - volar-service-typescript-twoslash-queries@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3): + volar-service-typescript-twoslash-queries@0.0.61(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2): dependencies: vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 - volar-service-typescript@https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3): + volar-service-typescript@https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed(@volar/language-service@https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2): dependencies: path-browserify: 1.0.1 semver: 7.6.2 @@ -6852,7 +6854,7 @@ snapshots: vscode-nls: 5.2.0 vscode-uri: 3.0.8 optionalDependencies: - '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@01441c3 + '@volar/language-service': https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2 vscode-css-languageservice@6.3.0: dependencies: diff --git a/test-workspace/language-service/inlay-hint/destructured-props/entry.vue b/test-workspace/language-service/inlay-hint/destructured-props/entry.vue deleted file mode 100644 index abc2c07f58..0000000000 --- a/test-workspace/language-service/inlay-hint/destructured-props/entry.vue +++ /dev/null @@ -1,52 +0,0 @@ - \ No newline at end of file diff --git a/test-workspace/language-service/inlay-hint/inline-handler-leading/entry.vue b/test-workspace/language-service/inlay-hint/inline-handler-leading/entry.vue deleted file mode 100644 index 56026683aa..0000000000 --- a/test-workspace/language-service/inlay-hint/inline-handler-leading/entry.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/inlay-hint/missing-props/Comp.vue b/test-workspace/language-service/inlay-hint/missing-props/Comp.vue deleted file mode 100644 index 2cf8ee629f..0000000000 --- a/test-workspace/language-service/inlay-hint/missing-props/Comp.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/test-workspace/language-service/inlay-hint/missing-props/entry.vue b/test-workspace/language-service/inlay-hint/missing-props/entry.vue deleted file mode 100644 index 670696c726..0000000000 --- a/test-workspace/language-service/inlay-hint/missing-props/entry.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - diff --git a/test-workspace/language-service/inlay-hint/option-wrapper/entry.vue b/test-workspace/language-service/inlay-hint/option-wrapper/entry.vue deleted file mode 100644 index ae02ba0771..0000000000 --- a/test-workspace/language-service/inlay-hint/option-wrapper/entry.vue +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/vitest.config.ts b/vitest.config.ts index c18a84c391..d51443eb94 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from 'vitest/config'; export default defineConfig({ test: { - include: ['packages/language-server/tests/**/*.spec.ts'], + include: ['packages/language-server/tests/**/inlayHints.spec.ts'], poolOptions: { forks: { singleFork: true, From 79eec70573098d00ccfc41a8be5dbc2913599d25 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Sun, 25 Aug 2024 04:41:23 +0800 Subject: [PATCH 05/10] Rewrite renaming tests --- .../tests/__snapshots__/renaming.spec.ts.snap | 573 ++++++++++++++++++ .../language-server/tests/renaming.spec.ts | 214 +++++++ packages/language-server/tests/server.ts | 9 +- packages/language-service/tests/index.spec.ts | 5 - packages/language-service/tests/rename.ts | 99 --- .../tests/utils/createTester.ts | 109 ---- .../language-service/tests/utils/mockEnv.ts | 82 --- .../rename/#2410/input/entry.vue | 4 - .../rename/#2410/output/entry.vue | 4 - .../rename/component-prop/input/component.vue | 8 - .../rename/component-prop/input/entry.vue | 8 - .../component-prop/output/component.vue | 8 - .../rename/component-prop/output/entry.vue | 8 - .../rename/component-tag/input/component.vue | 2 - .../rename/component-tag/input/entry.vue | 9 - .../rename/component-tag/output/component.vue | 2 - .../rename/component-tag/output/entry.vue | 9 - .../component-type-prop/input/component.vue | 8 - .../component-type-prop/input/entry.vue | 8 - .../component-type-prop/output/component.vue | 8 - .../component-type-prop/output/entry.vue | 8 - .../rename/css-module/input/entry.vue | 13 - .../rename/css-module/output/entry.vue | 13 - .../rename/css-scoped/input/entry.vue | 8 - .../rename/css-scoped/output/entry.vue | 8 - .../rename/css-vars/input/entry.vue | 20 - .../rename/css-vars/output/entry.vue | 20 - .../rename/dynamic-prop/input/entry.vue | 9 - .../rename/dynamic-prop/output/entry.vue | 9 - .../rename/regular-component/input/entry.vue | 17 - .../rename/regular-component/output/entry.vue | 17 - .../rename/script-setup/input/entry.vue | 9 - .../rename/script-setup/output/entry.vue | 9 - test-workspace/language-service/tsconfig.json | 14 - 34 files changed, 792 insertions(+), 559 deletions(-) create mode 100644 packages/language-server/tests/__snapshots__/renaming.spec.ts.snap create mode 100644 packages/language-server/tests/renaming.spec.ts delete mode 100644 packages/language-service/tests/index.spec.ts delete mode 100644 packages/language-service/tests/rename.ts delete mode 100644 packages/language-service/tests/utils/createTester.ts delete mode 100644 packages/language-service/tests/utils/mockEnv.ts delete mode 100644 test-workspace/language-service/rename/#2410/input/entry.vue delete mode 100644 test-workspace/language-service/rename/#2410/output/entry.vue delete mode 100644 test-workspace/language-service/rename/component-prop/input/component.vue delete mode 100644 test-workspace/language-service/rename/component-prop/input/entry.vue delete mode 100644 test-workspace/language-service/rename/component-prop/output/component.vue delete mode 100644 test-workspace/language-service/rename/component-prop/output/entry.vue delete mode 100644 test-workspace/language-service/rename/component-tag/input/component.vue delete mode 100644 test-workspace/language-service/rename/component-tag/input/entry.vue delete mode 100644 test-workspace/language-service/rename/component-tag/output/component.vue delete mode 100644 test-workspace/language-service/rename/component-tag/output/entry.vue delete mode 100644 test-workspace/language-service/rename/component-type-prop/input/component.vue delete mode 100644 test-workspace/language-service/rename/component-type-prop/input/entry.vue delete mode 100644 test-workspace/language-service/rename/component-type-prop/output/component.vue delete mode 100644 test-workspace/language-service/rename/component-type-prop/output/entry.vue delete mode 100644 test-workspace/language-service/rename/css-module/input/entry.vue delete mode 100644 test-workspace/language-service/rename/css-module/output/entry.vue delete mode 100644 test-workspace/language-service/rename/css-scoped/input/entry.vue delete mode 100644 test-workspace/language-service/rename/css-scoped/output/entry.vue delete mode 100644 test-workspace/language-service/rename/css-vars/input/entry.vue delete mode 100644 test-workspace/language-service/rename/css-vars/output/entry.vue delete mode 100644 test-workspace/language-service/rename/dynamic-prop/input/entry.vue delete mode 100644 test-workspace/language-service/rename/dynamic-prop/output/entry.vue delete mode 100644 test-workspace/language-service/rename/regular-component/input/entry.vue delete mode 100644 test-workspace/language-service/rename/regular-component/output/entry.vue delete mode 100644 test-workspace/language-service/rename/script-setup/input/entry.vue delete mode 100644 test-workspace/language-service/rename/script-setup/output/entry.vue delete mode 100644 test-workspace/language-service/tsconfig.json diff --git a/packages/language-server/tests/__snapshots__/renaming.spec.ts.snap b/packages/language-server/tests/__snapshots__/renaming.spec.ts.snap new file mode 100644 index 0000000000..4ba2f85a1e --- /dev/null +++ b/packages/language-server/tests/__snapshots__/renaming.spec.ts.snap @@ -0,0 +1,573 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Renaming > #2410 1`] = `"fixture.vue"`; + +exports[`Renaming > #2410 2`] = ` +[ + { + "newText": "h2", + "range": { + "end": { + "character": 18, + "line": 0, + }, + "start": { + "character": 16, + "line": 0, + }, + }, + }, + { + "newText": "h2", + "range": { + "end": { + "character": 13, + "line": 0, + }, + "start": { + "character": 11, + "line": 0, + }, + }, + }, +] +`; + +exports[`Renaming > #2410 3`] = `"fixture.vue"`; + +exports[`Renaming > #2410 4`] = ` +[ + { + "newText": "h2", + "range": { + "end": { + "character": 18, + "line": 0, + }, + "start": { + "character": 16, + "line": 0, + }, + }, + }, + { + "newText": "h2", + "range": { + "end": { + "character": 13, + "line": 0, + }, + "start": { + "character": 11, + "line": 0, + }, + }, + }, +] +`; + +exports[`Renaming > + + + + + `, 'bar'); + }); + + it('Component props', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await openDocument('tsconfigProject/foo.vue', 'vue', ` + + + + `); + await assertRenaming('tsconfigProject/fixture.vue', 'vue', ` + + + + `, 'cccDdd'); + }); + + it('Component type props', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await openDocument('tsconfigProject/foo.vue', 'vue', ` + + + + `); + await assertRenaming('tsconfigProject/fixture.vue', 'vue', ` + + + + `, 'cccDdd'); + }); + + it('Component dynamic props', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await assertRenaming('tsconfigProject/fixture.vue', 'vue', ` + + + + `, 'bar'); + }); + + it('Component returns', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await assertRenaming('tsconfigProject/fixture.vue', 'vue', ` + + + + `, 'bar'); + }); + + it(' + `, 'bar'); + }); + + it('Component tags', async () => { + await ensureGlobalTypesHolder('tsconfigProject'); + await assertRenaming('tsconfigProject/fixture.vue', 'vue', ` + + + + `, 'CcDd'); + }); + + const openedDocuments: TextDocument[] = []; + + afterEach(async () => { + const server = await getLanguageServer(); + for (const document of openedDocuments) { + await server.closeTextDocument(document.uri); + } + openedDocuments.length = 0; + }); + + /** + * @deprecated Remove this when #4717 fixed. + */ + async function ensureGlobalTypesHolder(folderName: string) { + const document = await openDocument(`${folderName}/globalTypesHolder.vue`, 'vue', ''); + const server = await getLanguageServer(); + await server.sendDocumentDiagnosticRequest(document.uri); + } + + async function assertRenaming(fileName: string, languageId: string, _content: string, newName: string) { + const offset = _content.indexOf('|'); + expect(offset).toBeGreaterThanOrEqual(0); + const content = _content.slice(0, offset) + _content.slice(offset + 1); + + const server = await getLanguageServer(); + let document = await openDocument(fileName, languageId, content); + + const position = document.positionAt(offset); + const edit = await server.sendRenameRequest(document.uri, position, newName); + expect(edit).toBeDefined(); + expect(edit?.changes).toBeDefined(); + + for (const [uri, edits] of Object.entries(edit!.changes!)) { + expect(path.relative(testWorkspacePath, URI.parse(uri).fsPath)).toMatchSnapshot(); + expect(edits).toMatchSnapshot(); + } + } + + async function openDocument(fileName: string, languageId: string, content: string) { + const server = await getLanguageServer(); + const uri = URI.file(`${testWorkspacePath}/${fileName}`); + const document = await server.openInMemoryDocument(uri.toString(), languageId, content); + if (openedDocuments.every(d => d.uri !== document.uri)) { + openedDocuments.push(document); + } + return document; + } +}); diff --git a/packages/language-server/tests/server.ts b/packages/language-server/tests/server.ts index 4cf2d1360a..13b4464e0f 100644 --- a/packages/language-server/tests/server.ts +++ b/packages/language-server/tests/server.ts @@ -1,6 +1,7 @@ -import * as path from 'path'; +import { ConfigurationRequest, PublishDiagnosticsNotification } from '@volar/language-server'; import type { LanguageServerHandle } from '@volar/test-utils'; import { startLanguageServer } from '@volar/test-utils'; +import * as path from 'path'; import { URI } from 'vscode-uri'; let serverHandle: LanguageServerHandle | undefined; @@ -10,10 +11,10 @@ export const testWorkspacePath = path.resolve(__dirname, '../../../test-workspac export async function getLanguageServer() { if (!serverHandle) { serverHandle = startLanguageServer(require.resolve('../bin/vue-language-server.js'), testWorkspacePath); - serverHandle.connection.onNotification('textDocument/publishDiagnostics', () => { }); - serverHandle.connection.onRequest('workspace/configuration', ({ items }) => { + serverHandle.connection.onNotification(PublishDiagnosticsNotification.type, () => { }); + serverHandle.connection.onRequest(ConfigurationRequest.type, ({ items }) => { return items.map(({ section }) => { - if (section.startsWith('vue.inlayHints.')) { + if (section?.startsWith('vue.inlayHints.')) { return true; } return null; diff --git a/packages/language-service/tests/index.spec.ts b/packages/language-service/tests/index.spec.ts deleted file mode 100644 index d06f93278c..0000000000 --- a/packages/language-service/tests/index.spec.ts +++ /dev/null @@ -1,5 +0,0 @@ -import './complete'; -import './findDefinition'; -import './rename'; -import './reference'; -import './inlayHint'; diff --git a/packages/language-service/tests/rename.ts b/packages/language-service/tests/rename.ts deleted file mode 100644 index b3655b0ab4..0000000000 --- a/packages/language-service/tests/rename.ts +++ /dev/null @@ -1,99 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import { describe, expect, it } from 'vitest'; -import { TextDocument } from 'vscode-languageserver-textdocument'; -import { tester } from './utils/createTester'; -import { fileNameToUri } from './utils/mockEnv'; - -const baseDir = path.resolve(__dirname, '../../../test-workspace/language-service/rename'); -const testDirs = fs.readdirSync(baseDir); - -for (const dirName of testDirs) { - - describe(`rename: ${dirName}`, async () => { - - const dir = path.join(baseDir, dirName); - const inputFiles = readFiles(path.join(dir, 'input')); - const outputFiles = readFiles(path.join(dir, 'output')); - - for (const file in inputFiles) { - - const filePath = path.join(dir, 'input', file); - const uri = fileNameToUri(filePath); - const fileText = inputFiles[file]; - const document = TextDocument.create('', '', 0, fileText); - const actions = findRenameActions(fileText); - - for (const action of actions) { - - for (let offset = action.start; offset <= action.end; offset++) { - - const position = document.positionAt(offset); - - position.line--; - - const location = `${filePath}:${position.line + 1}:${position.character + 1}`; - - it(`${location} => ${action.newName}`, async () => { - - const edit = await tester.languageService.getRenameEdits( - uri, - position, - action.newName - ); - - expect(edit).toBeDefined(); - - const tempFiles = { ...inputFiles }; - - for (const uri in edit!.changes) { - for (const file in tempFiles) { - if (uri.endsWith(file)) { - tempFiles[file] = TextDocument.applyEdits(TextDocument.create('', '', 0, tempFiles[file]), edit!.changes[uri]); - } - } - } - - expect(Object.keys(tempFiles).length).toBe(Object.keys(outputFiles).length); - - for (const file in tempFiles) { - expect(tempFiles[file]).toBe(outputFiles[file]); - } - }); - } - } - - } - }); -} - -function readFiles(dir: string) { - - const filesText: Record = {}; - const files = fs.readdirSync(dir); - - for (const file of files) { - const filePath = path.join(dir, file); - filesText[file] = fs.readFileSync(filePath, 'utf8'); - } - - return filesText; -} - -const renameReg = /(\^*)rename:\s*([\S]*)/g; - -function findRenameActions(text: string) { - - return [...text.matchAll(renameReg)].map(flag => { - - const start = flag.index; - const end = start + flag[1].length; - const newName = flag[2]; - - return { - start, - end, - newName, - }; - }); -} diff --git a/packages/language-service/tests/utils/createTester.ts b/packages/language-service/tests/utils/createTester.ts deleted file mode 100644 index e0c9e6f017..0000000000 --- a/packages/language-service/tests/utils/createTester.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { ProjectContext, createLanguage, createLanguageService, createUriMap } from '@volar/language-service'; -import { TypeScriptProjectHost, createLanguageServiceHost, resolveFileLanguageId } from '@volar/typescript'; -import * as path from 'path'; -import * as ts from 'typescript'; -import { URI } from 'vscode-uri'; -import { createParsedCommandLine, createRootFileChecker, createVueLanguagePlugin2, getFullLanguageServicePlugins } from '../..'; -import { createMockServiceEnv, fileNameToUri, uriToFileName } from './mockEnv'; - -export const rootUri = URI.file(path.resolve(__dirname, '../../../../test-workspace/language-service')); -export const tester = createTester(rootUri); - -function createTester(rootUri: URI) { - - const serviceEnv = createMockServiceEnv(rootUri, () => currentVSCodeSettings ?? defaultVSCodeSettings); - const rootPath = uriToFileName(rootUri); - const realTsConfig = path.join(rootPath, 'tsconfig.json').replace(/\\/g, '/'); - const parsedCommandLine = createParsedCommandLine(ts, ts.sys, realTsConfig); - parsedCommandLine.fileNames = parsedCommandLine.fileNames.map(fileName => fileName.replace(/\\/g, '/')); - const scriptSnapshots = new Map(); - const projectHost: TypeScriptProjectHost = { - getCurrentDirectory: () => uriToFileName(rootUri), - getProjectVersion: () => '0', - getScriptFileNames: () => parsedCommandLine.fileNames, - getCompilationSettings: () => parsedCommandLine.options, - }; - const vueLanguagePlugin = createVueLanguagePlugin2( - ts, - uriToFileName, - createRootFileChecker( - projectHost.getProjectVersion ? () => projectHost.getProjectVersion!() : undefined, - () => projectHost.getScriptFileNames(), - ts.sys.useCaseSensitiveFileNames - ), - parsedCommandLine.options, - parsedCommandLine.vueOptions - ); - const vueServicePlugins = getFullLanguageServicePlugins(ts); - const defaultVSCodeSettings: any = { - 'typescript.preferences.quoteStyle': 'single', - 'javascript.preferences.quoteStyle': 'single', - 'vue.inlayHints.destructuredProps': true, - 'vue.inlayHints.missingProps': true, - 'vue.inlayHints.optionsWrapper': true, - 'vue.inlayHints.inlineHandlerLeading': true, - }; - let currentVSCodeSettings: any; - const language = createLanguage( - [ - vueLanguagePlugin, - { - getLanguageId(uri) { - return resolveFileLanguageId(uri.fsPath); - }, - }, - ], - createUriMap(), - uri => { - const snapshot = getScriptSnapshot(uriToFileName(uri)); - if (snapshot) { - language.scripts.set(uri, snapshot); - } - else { - language.scripts.delete(uri); - } - } - ); - const project: ProjectContext = {}; - project.typescript = { - configFileName: realTsConfig, - sys: ts.sys, - uriConverter: { - asFileName: uriToFileName, - asUri: fileNameToUri, - }, - ...createLanguageServiceHost(ts, ts.sys, language, fileNameToUri, projectHost), - }; - project.vue = { - compilerOptions: parsedCommandLine.vueOptions, - }; - const languageService = createLanguageService(language, vueServicePlugins, serviceEnv, project); - - return { - serviceEnv, - projectHost, - languageService, - setVSCodeSettings, - }; - - function setVSCodeSettings(settings: any = undefined) { - currentVSCodeSettings = settings; - } - function getScriptSnapshot(fileName: string) { - const snapshot = scriptSnapshots.get(fileName); - if (snapshot) { - return snapshot; - } - const text = getScriptText(fileName); - if (text !== undefined) { - const snapshot = ts.ScriptSnapshot.fromString(text); - scriptSnapshots.set(fileName, snapshot); - return snapshot; - } - } - function getScriptText(fileName: string) { - if (ts.sys.fileExists(fileName)) { - return ts.sys.readFile(fileName, 'utf8'); - } - } -} diff --git a/packages/language-service/tests/utils/mockEnv.ts b/packages/language-service/tests/utils/mockEnv.ts deleted file mode 100644 index 2f642fe373..0000000000 --- a/packages/language-service/tests/utils/mockEnv.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { FileType, LanguageServiceEnvironment } from '@volar/language-service'; -import { URI } from 'vscode-uri'; -import * as fs from 'fs'; - -export const uriToFileName = (uri: URI) => uri.fsPath.replace(/\\/g, '/'); - -export const fileNameToUri = (fileName: string) => URI.file(fileName); - -export function createMockServiceEnv( - rootUri: URI, - getSettings = () => ({} as any) -): LanguageServiceEnvironment { - return { - workspaceFolders: [rootUri], - getConfiguration(section: string) { - const settings = getSettings(); - if (settings[section]) { - return settings[section]; - } - let result: Record | undefined; - for (const key in settings) { - if (key.startsWith(section + '.')) { - const newKey = key.slice(section.length + 1); - result ??= {}; - result[newKey] = settings[key]; - } - } - return result; - }, - fs: { - stat(uri) { - if (uri.scheme === 'file') { - try { - const stats = fs.statSync(uriToFileName(uri), { throwIfNoEntry: false }); - if (stats) { - return { - type: stats.isFile() ? FileType.File - : stats.isDirectory() ? FileType.Directory - : stats.isSymbolicLink() ? FileType.SymbolicLink - : FileType.Unknown, - ctime: stats.ctimeMs, - mtime: stats.mtimeMs, - size: stats.size, - }; - } - } - catch { - return undefined; - } - } - }, - readFile(uri, encoding) { - if (uri.scheme === 'file') { - try { - return fs.readFileSync(uriToFileName(uri), { encoding: encoding as 'utf-8' ?? 'utf-8' }); - } - catch { - return undefined; - } - } - }, - readDirectory(uri) { - if (uri.scheme === 'file') { - try { - const dirName = uriToFileName(uri); - const files = fs.readdirSync(dirName, { withFileTypes: true }); - return files.map<[string, FileType]>(file => { - return [file.name, file.isFile() ? FileType.File - : file.isDirectory() ? FileType.Directory - : file.isSymbolicLink() ? FileType.SymbolicLink - : FileType.Unknown]; - }); - } - catch { - return []; - } - } - return []; - }, - } - }; -} diff --git a/test-workspace/language-service/rename/#2410/input/entry.vue b/test-workspace/language-service/rename/#2410/input/entry.vue deleted file mode 100644 index 899d61b095..0000000000 --- a/test-workspace/language-service/rename/#2410/input/entry.vue +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/test-workspace/language-service/rename/#2410/output/entry.vue b/test-workspace/language-service/rename/#2410/output/entry.vue deleted file mode 100644 index 98c4da87c6..0000000000 --- a/test-workspace/language-service/rename/#2410/output/entry.vue +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/test-workspace/language-service/rename/component-prop/input/component.vue b/test-workspace/language-service/rename/component-prop/input/component.vue deleted file mode 100644 index 1927ea488c..0000000000 --- a/test-workspace/language-service/rename/component-prop/input/component.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/component-prop/input/entry.vue b/test-workspace/language-service/rename/component-prop/input/entry.vue deleted file mode 100644 index bbbb4de943..0000000000 --- a/test-workspace/language-service/rename/component-prop/input/entry.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/component-prop/output/component.vue b/test-workspace/language-service/rename/component-prop/output/component.vue deleted file mode 100644 index c2c6ae66c4..0000000000 --- a/test-workspace/language-service/rename/component-prop/output/component.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/component-prop/output/entry.vue b/test-workspace/language-service/rename/component-prop/output/entry.vue deleted file mode 100644 index 6c8426c210..0000000000 --- a/test-workspace/language-service/rename/component-prop/output/entry.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/component-tag/input/component.vue b/test-workspace/language-service/rename/component-tag/input/component.vue deleted file mode 100644 index bc692573ed..0000000000 --- a/test-workspace/language-service/rename/component-tag/input/component.vue +++ /dev/null @@ -1,2 +0,0 @@ - diff --git a/test-workspace/language-service/rename/component-tag/input/entry.vue b/test-workspace/language-service/rename/component-tag/input/entry.vue deleted file mode 100644 index fc092f4a40..0000000000 --- a/test-workspace/language-service/rename/component-tag/input/entry.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/component-tag/output/component.vue b/test-workspace/language-service/rename/component-tag/output/component.vue deleted file mode 100644 index bc692573ed..0000000000 --- a/test-workspace/language-service/rename/component-tag/output/component.vue +++ /dev/null @@ -1,2 +0,0 @@ - diff --git a/test-workspace/language-service/rename/component-tag/output/entry.vue b/test-workspace/language-service/rename/component-tag/output/entry.vue deleted file mode 100644 index 1d104e4130..0000000000 --- a/test-workspace/language-service/rename/component-tag/output/entry.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/component-type-prop/input/component.vue b/test-workspace/language-service/rename/component-type-prop/input/component.vue deleted file mode 100644 index 092840f2d0..0000000000 --- a/test-workspace/language-service/rename/component-type-prop/input/component.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/component-type-prop/input/entry.vue b/test-workspace/language-service/rename/component-type-prop/input/entry.vue deleted file mode 100644 index bbbb4de943..0000000000 --- a/test-workspace/language-service/rename/component-type-prop/input/entry.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/component-type-prop/output/component.vue b/test-workspace/language-service/rename/component-type-prop/output/component.vue deleted file mode 100644 index 540e4f2c81..0000000000 --- a/test-workspace/language-service/rename/component-type-prop/output/component.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/component-type-prop/output/entry.vue b/test-workspace/language-service/rename/component-type-prop/output/entry.vue deleted file mode 100644 index 6c8426c210..0000000000 --- a/test-workspace/language-service/rename/component-type-prop/output/entry.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/css-module/input/entry.vue b/test-workspace/language-service/rename/css-module/input/entry.vue deleted file mode 100644 index de45f0f390..0000000000 --- a/test-workspace/language-service/rename/css-module/input/entry.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/css-module/output/entry.vue b/test-workspace/language-service/rename/css-module/output/entry.vue deleted file mode 100644 index 86b15434ce..0000000000 --- a/test-workspace/language-service/rename/css-module/output/entry.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/css-scoped/input/entry.vue b/test-workspace/language-service/rename/css-scoped/input/entry.vue deleted file mode 100644 index a1cee689ed..0000000000 --- a/test-workspace/language-service/rename/css-scoped/input/entry.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/css-scoped/output/entry.vue b/test-workspace/language-service/rename/css-scoped/output/entry.vue deleted file mode 100644 index 662a634665..0000000000 --- a/test-workspace/language-service/rename/css-scoped/output/entry.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/css-vars/input/entry.vue b/test-workspace/language-service/rename/css-vars/input/entry.vue deleted file mode 100644 index d5243c4f62..0000000000 --- a/test-workspace/language-service/rename/css-vars/input/entry.vue +++ /dev/null @@ -1,20 +0,0 @@ - - - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/css-vars/output/entry.vue b/test-workspace/language-service/rename/css-vars/output/entry.vue deleted file mode 100644 index 356c312f92..0000000000 --- a/test-workspace/language-service/rename/css-vars/output/entry.vue +++ /dev/null @@ -1,20 +0,0 @@ - - - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/dynamic-prop/input/entry.vue b/test-workspace/language-service/rename/dynamic-prop/input/entry.vue deleted file mode 100644 index 27273ad7af..0000000000 --- a/test-workspace/language-service/rename/dynamic-prop/input/entry.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/dynamic-prop/output/entry.vue b/test-workspace/language-service/rename/dynamic-prop/output/entry.vue deleted file mode 100644 index 6b7618d004..0000000000 --- a/test-workspace/language-service/rename/dynamic-prop/output/entry.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/regular-component/input/entry.vue b/test-workspace/language-service/rename/regular-component/input/entry.vue deleted file mode 100644 index d48540a7f5..0000000000 --- a/test-workspace/language-service/rename/regular-component/input/entry.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/regular-component/output/entry.vue b/test-workspace/language-service/rename/regular-component/output/entry.vue deleted file mode 100644 index 9fb7b7f589..0000000000 --- a/test-workspace/language-service/rename/regular-component/output/entry.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/script-setup/input/entry.vue b/test-workspace/language-service/rename/script-setup/input/entry.vue deleted file mode 100644 index f61a482552..0000000000 --- a/test-workspace/language-service/rename/script-setup/input/entry.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/rename/script-setup/output/entry.vue b/test-workspace/language-service/rename/script-setup/output/entry.vue deleted file mode 100644 index 5a819003ef..0000000000 --- a/test-workspace/language-service/rename/script-setup/output/entry.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - \ No newline at end of file diff --git a/test-workspace/language-service/tsconfig.json b/test-workspace/language-service/tsconfig.json deleted file mode 100644 index 08ba217a85..0000000000 --- a/test-workspace/language-service/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "exclude": [ "../tsconfig.json" ], - "compilerOptions": { - "paths": { - "__COMPLETE_ROOT__/*": [ - "./complete/*" - ], - "__FIND_DEFINITION_ROOT__/*": [ - "./find-definition/*" - ] - }, - }, - "include": [ "**/*" ], -} \ No newline at end of file From e60187428e42bc3052557ce228c5c98e2f735ce1 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Sun, 25 Aug 2024 14:48:22 +0800 Subject: [PATCH 06/10] Unused .snap files --- package.json | 17 +- .../__snapshots__/completions.spec.ts.snap | 124 --- .../__snapshots__/definitions.spec.ts.snap | 61 -- .../__snapshots__/inlayHints.spec.ts.snap | 80 -- .../__snapshots__/references.spec.ts.snap | 91 -- .../tests/__snapshots__/renaming.spec.ts.snap | 573 ------------ .../language-server/tests/completions.spec.ts | 199 +++-- .../language-server/tests/definitions.spec.ts | 111 ++- .../language-server/tests/inlayHints.spec.ts | 219 +++-- .../language-server/tests/references.spec.ts | 136 ++- .../language-server/tests/renaming.spec.ts | 830 +++++++++++++++--- pnpm-lock.yaml | 206 ++--- 12 files changed, 1317 insertions(+), 1330 deletions(-) delete mode 100644 packages/language-server/tests/__snapshots__/completions.spec.ts.snap delete mode 100644 packages/language-server/tests/__snapshots__/definitions.spec.ts.snap delete mode 100644 packages/language-server/tests/__snapshots__/inlayHints.spec.ts.snap delete mode 100644 packages/language-server/tests/__snapshots__/references.spec.ts.snap delete mode 100644 packages/language-server/tests/__snapshots__/renaming.spec.ts.snap diff --git a/package.json b/package.json index 7bd8603bfc..2e95edd2db 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "release:next-base": "npm run release:base -- --dist-tag next", "release:next-vue": "cd ./extensions/vscode && npm run release:next", "test": "vitest run", + "test:update": "vitest run --update", "lint": "tsslint --projects {tsconfig.json,packages/*/tsconfig.json,extensions/*/tsconfig.json}", "lint:fix": "npm run lint -- --fix", "chrome": "vscode-test-web --browserType=chromium --extensionDevelopmentPath=./extensions/vscode ../volar-starter" @@ -31,14 +32,14 @@ }, "pnpm": { "overrides": { - "@volar/kit": "https://pkg.pr.new/volarjs/volar.js/@volar/kit@87ad0b2", - "@volar/language-core": "https://pkg.pr.new/volarjs/volar.js/@volar/language-core@87ad0b2", - "@volar/language-server": "https://pkg.pr.new/volarjs/volar.js/@volar/language-server@87ad0b2", - "@volar/language-service": "https://pkg.pr.new/volarjs/volar.js/@volar/language-service@87ad0b2", - "@volar/source-map": "https://pkg.pr.new/volarjs/volar.js/@volar/source-map@87ad0b2", - "@volar/test-utils": "https://pkg.pr.new/volarjs/volar.js/@volar/test-utils@87ad0b2", - "@volar/typescript": "https://pkg.pr.new/volarjs/volar.js/@volar/typescript@87ad0b2", - "@volar/vscode": "https://pkg.pr.new/volarjs/volar.js/@volar/vscode@87ad0b2", + "@volar/kit": "https://pkg.pr.new/volarjs/volar.js/@volar/kit@28cbdee", + "@volar/language-core": "https://pkg.pr.new/volarjs/volar.js/@volar/language-core@28cbdee", + "@volar/language-server": "https://pkg.pr.new/volarjs/volar.js/@volar/language-server@28cbdee", + "@volar/language-service": "https://pkg.pr.new/volarjs/volar.js/@volar/language-service@28cbdee", + "@volar/source-map": "https://pkg.pr.new/volarjs/volar.js/@volar/source-map@28cbdee", + "@volar/test-utils": "https://pkg.pr.new/volarjs/volar.js/@volar/test-utils@28cbdee", + "@volar/typescript": "https://pkg.pr.new/volarjs/volar.js/@volar/typescript@28cbdee", + "@volar/vscode": "https://pkg.pr.new/volarjs/volar.js/@volar/vscode@28cbdee", "volar-service-typescript": "https://pkg.pr.new/volarjs/services/volar-service-typescript@177b9ed", "inquirer": "9.2.23" } diff --git a/packages/language-server/tests/__snapshots__/completions.spec.ts.snap b/packages/language-server/tests/__snapshots__/completions.spec.ts.snap deleted file mode 100644 index f2b3dd1bf6..0000000000 --- a/packages/language-server/tests/__snapshots__/completions.spec.ts.snap +++ /dev/null @@ -1,124 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`Completions > #2454 1`] = ` -" - - - - " -`; - -exports[`Completions > #2511 1`] = ` -" - - " -`; - -exports[`Completions > #3658 1`] = ` -" - - " -`; - -exports[`Completions > #4639 1`] = ` -" - - " -`; - -exports[`Completions > $event argument 1`] = `""`; - -exports[`Completions > - " -`; - -exports[`Completions > Alias path 1`] = ` -" - - " -`; - -exports[`Completions > Component auto import 1`] = ` -" - - - - " -`; - -exports[`Completions > Directives 1`] = `""`; - -exports[`Completions > Directives 2`] = `""`; - -exports[`Completions > Directives 3`] = `""`; - -exports[`Completions > Directives 4`] = `""`; - -exports[`Completions > Relative path 1`] = ` -" - - " -`; - -exports[`Completions > Slot name 1`] = ` -" - - - - " -`; - -exports[`Completions > core#8811 1`] = ` -" - - - - " -`; diff --git a/packages/language-server/tests/__snapshots__/definitions.spec.ts.snap b/packages/language-server/tests/__snapshots__/definitions.spec.ts.snap deleted file mode 100644 index ff893647c0..0000000000 --- a/packages/language-server/tests/__snapshots__/definitions.spec.ts.snap +++ /dev/null @@ -1,61 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`Definitions > #2600 1`] = `"tsconfigProject/foo.vue"`; - -exports[`Definitions > #2600 2`] = ` -{ - "end": { - "character": 0, - "line": 0, - }, - "start": { - "character": 0, - "line": 0, - }, -} -`; - -exports[`Definitions > Alias path 1`] = `"tsconfigProject/foo.ts"`; - -exports[`Definitions > Alias path 2`] = ` -{ - "end": { - "character": 25, - "line": 0, - }, - "start": { - "character": 0, - "line": 0, - }, -} -`; - -exports[`Definitions > TS to vue 1`] = `"tsconfigProject/empty.vue"`; - -exports[`Definitions > TS to vue 2`] = ` -{ - "end": { - "character": 0, - "line": 0, - }, - "start": { - "character": 0, - "line": 0, - }, -} -`; - -exports[`Definitions > TS to vue 3`] = `"tsconfigProject/empty.vue"`; - -exports[`Definitions > TS to vue 4`] = ` -{ - "end": { - "character": 0, - "line": 0, - }, - "start": { - "character": 0, - "line": 0, - }, -} -`; diff --git a/packages/language-server/tests/__snapshots__/inlayHints.spec.ts.snap b/packages/language-server/tests/__snapshots__/inlayHints.spec.ts.snap deleted file mode 100644 index 72d2107aaa..0000000000 --- a/packages/language-server/tests/__snapshots__/inlayHints.spec.ts.snap +++ /dev/null @@ -1,80 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`Definitions > Destructured props 1`] = ` -" - - " -`; - -exports[`Definitions > Inline handler leading 1`] = ` -" - - - - " -`; - -exports[`Definitions > Missing props 1`] = ` -" - - - - " -`; - -exports[`Definitions > Options wrapper 1`] = ` -" - - " -`; diff --git a/packages/language-server/tests/__snapshots__/references.spec.ts.snap b/packages/language-server/tests/__snapshots__/references.spec.ts.snap deleted file mode 100644 index b741277166..0000000000 --- a/packages/language-server/tests/__snapshots__/references.spec.ts.snap +++ /dev/null @@ -1,91 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`Definitions > Default slot 1`] = `"tsconfigProject/foo.vue"`; - -exports[`Definitions > Default slot 2`] = ` -{ - "end": { - "character": 16, - "line": 7, - }, - "start": { - "character": 5, - "line": 7, - }, -} -`; - -exports[`Definitions > Default slot 3`] = `"tsconfigProject/fixture.vue"`; - -exports[`Definitions > Default slot 4`] = ` -{ - "end": { - "character": 9, - "line": 2, - }, - "start": { - "character": 5, - "line": 2, - }, -} -`; - -exports[`Definitions > Named slot 1`] = `"tsconfigProject/foo.vue"`; - -exports[`Definitions > Named slot 2`] = ` -{ - "end": { - "character": 17, - "line": 6, - }, - "start": { - "character": 14, - "line": 6, - }, -} -`; - -exports[`Definitions > Named slot 3`] = `"tsconfigProject/fixture.vue"`; - -exports[`Definitions > Named slot 4`] = ` -{ - "end": { - "character": 19, - "line": 2, - }, - "start": { - "character": 16, - "line": 2, - }, -} -`; - -exports[`Definitions > v-bind shorthand 1`] = `"tsconfigProject/fixture.vue"`; - -exports[`Definitions > v-bind shorthand 2`] = ` -{ - "end": { - "character": 13, - "line": 6, - }, - "start": { - "character": 10, - "line": 6, - }, -} -`; - -exports[`Definitions > v-bind shorthand 3`] = `"tsconfigProject/fixture.vue"`; - -exports[`Definitions > v-bind shorthand 4`] = ` -{ - "end": { - "character": 12, - "line": 2, - }, - "start": { - "character": 9, - "line": 2, - }, -} -`; diff --git a/packages/language-server/tests/__snapshots__/renaming.spec.ts.snap b/packages/language-server/tests/__snapshots__/renaming.spec.ts.snap deleted file mode 100644 index 4ba2f85a1e..0000000000 --- a/packages/language-server/tests/__snapshots__/renaming.spec.ts.snap +++ /dev/null @@ -1,573 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`Renaming > #2410 1`] = `"fixture.vue"`; - -exports[`Renaming > #2410 2`] = ` -[ - { - "newText": "h2", - "range": { - "end": { - "character": 18, - "line": 0, - }, - "start": { - "character": 16, - "line": 0, - }, - }, - }, - { - "newText": "h2", - "range": { - "end": { - "character": 13, - "line": 0, - }, - "start": { - "character": 11, - "line": 0, - }, - }, - }, -] -`; - -exports[`Renaming > #2410 3`] = `"fixture.vue"`; - -exports[`Renaming > #2410 4`] = ` -[ - { - "newText": "h2", - "range": { - "end": { - "character": 18, - "line": 0, - }, - "start": { - "character": 16, - "line": 0, - }, - }, - }, - { - "newText": "h2", - "range": { - "end": { - "character": 13, - "line": 0, - }, - "start": { - "character": 11, - "line": 0, - }, - }, - }, -] -`; - -exports[`Renaming > @@ -58,16 +82,32 @@ describe('Completions', async () => { it('#2511', async () => { await ensureGlobalTypesHolder('tsconfigProject'); - await openDocument('tsconfigProject/component-for-auto-import.vue', 'vue', ``); - await assertCompletion('tsconfigProject/fixture.vue', 'vue', ` - - `, 'ComponentForAutoImport'); + await prepareDocument('tsconfigProject/component-for-auto-import.vue', 'vue', ``); + expect( + (await requestCompletionItem('tsconfigProject/fixture.vue', 'vue', ` + + `, 'ComponentForAutoImport')).textEdit + ).toMatchInlineSnapshot(` + { + "newText": "import componentForAutoImport$1 from './component-for-auto-import.vue';", + "range": { + "end": { + "character": 23, + "line": 2, + }, + "start": { + "character": 4, + "line": 2, + }, + }, + } + `); }); it('#3658', async () => { - await assertCompletion('fixture.vue', 'vue', ` + await requestCompletionItem('fixture.vue', 'vue', ` `); - await assertReferences('tsconfigProject/fixture.vue', 'vue', ` + expect( + await requestReferences('tsconfigProject/fixture.vue', 'vue', ` + `) + ).toMatchInlineSnapshot(` + [ + { + "range": { + "end": { + "character": 17, + "line": 6, + }, + "start": { + "character": 14, + "line": 6, + }, + }, + "uri": "file://\${testWorkspacePath}/tsconfigProject/foo.vue", + }, + { + "range": { + "end": { + "character": 19, + "line": 2, + }, + "start": { + "character": 16, + "line": 2, + }, + }, + "uri": "file://\${testWorkspacePath}/tsconfigProject/fixture.vue", + }, + ] `); }); it('v-bind shorthand', async () => { await ensureGlobalTypesHolder('tsconfigProject'); - await assertReferences('tsconfigProject/fixture.vue', 'vue', ` - + expect( + await requestReferences('tsconfigProject/fixture.vue', 'vue', ` + - + + `) + ).toMatchInlineSnapshot(` + [ + { + "range": { + "end": { + "character": 14, + "line": 6, + }, + "start": { + "character": 11, + "line": 6, + }, + }, + "uri": "file://\${testWorkspacePath}/tsconfigProject/fixture.vue", + }, + { + "range": { + "end": { + "character": 13, + "line": 2, + }, + "start": { + "character": 10, + "line": 2, + }, + }, + "uri": "file://\${testWorkspacePath}/tsconfigProject/fixture.vue", + }, + ] `); }); @@ -71,31 +163,31 @@ describe('Definitions', async () => { * @deprecated Remove this when #4717 fixed. */ async function ensureGlobalTypesHolder(folderName: string) { - const document = await openDocument(`${folderName}/globalTypesHolder.vue`, 'vue', ''); + const document = await prepareDocument(`${folderName}/globalTypesHolder.vue`, 'vue', ''); const server = await getLanguageServer(); await server.sendDocumentDiagnosticRequest(document.uri); } - async function assertReferences(fileName: string, languageId: string, content: string) { + async function requestReferences(fileName: string, languageId: string, content: string) { const offset = content.indexOf('|'); expect(offset).toBeGreaterThanOrEqual(0); content = content.slice(0, offset) + content.slice(offset + 1); const server = await getLanguageServer(); - let document = await openDocument(fileName, languageId, content); + let document = await prepareDocument(fileName, languageId, content); const position = document.positionAt(offset); const references = await server.sendReferencesRequest(document.uri, position, { includeDeclaration: false }); expect(references).toBeDefined(); - expect(references!.length).greaterThan(0); for (const loc of references!) { - expect(path.relative(testWorkspacePath, URI.parse(loc.uri).fsPath)).toMatchSnapshot(); - expect(loc.range).toMatchSnapshot(); + loc.uri = loc.uri.replace(testWorkspacePath, '${testWorkspacePath}'); } + + return references!; } - async function openDocument(fileName: string, languageId: string, content: string) { + async function prepareDocument(fileName: string, languageId: string, content: string) { const server = await getLanguageServer(); const uri = URI.file(`${testWorkspacePath}/${fileName}`); const document = await server.openInMemoryDocument(uri.toString(), languageId, content); diff --git a/packages/language-server/tests/renaming.spec.ts b/packages/language-server/tests/renaming.spec.ts index 20c357c7ef..f9b5905b86 100644 --- a/packages/language-server/tests/renaming.spec.ts +++ b/packages/language-server/tests/renaming.spec.ts @@ -7,82 +7,443 @@ import { getLanguageServer, testWorkspacePath } from './server.js'; describe('Renaming', async () => { it('#2410', async () => { - await assertRenaming('fixture.vue', 'vue', ``, 'h2'); - await assertRenaming('fixture.vue', 'vue', ``, 'h2'); + expect( + await requestRename('fixture.vue', 'vue', ``, 'h2') + ).toMatchInlineSnapshot(` + { + "changes": { + "file://\${testWorkspacePath}/fixture.vue": [ + { + "newText": "h2", + "range": { + "end": { + "character": 18, + "line": 0, + }, + "start": { + "character": 16, + "line": 0, + }, + }, + }, + { + "newText": "h2", + "range": { + "end": { + "character": 13, + "line": 0, + }, + "start": { + "character": 11, + "line": 0, + }, + }, + }, + ], + }, + } + `); + expect( + await requestRename('fixture.vue', 'vue', ``, 'h2') + ).toMatchInlineSnapshot(` + { + "changes": { + "file://\${testWorkspacePath}/fixture.vue": [ + { + "newText": "h2", + "range": { + "end": { + "character": 18, + "line": 0, + }, + "start": { + "character": 16, + "line": 0, + }, + }, + }, + { + "newText": "h2", + "range": { + "end": { + "character": 13, + "line": 0, + }, + "start": { + "character": 11, + "line": 0, + }, + }, + }, + ], + }, + } + `); }); it('CSS', async () => { - await assertRenaming('fixture.vue', 'vue', ` - + expect( + await requestRename('fixture.vue', 'vue', ` + - + - - `, 'bar'); - await assertRenaming('fixture.vue', 'vue', ` - + + `, 'bar') + ).toMatchInlineSnapshot(` + { + "changes": { + "file://\${testWorkspacePath}/fixture.vue": [ + { + "newText": "bar", + "range": { + "end": { + "character": 28, + "line": 2, + }, + "start": { + "character": 25, + "line": 2, + }, + }, + }, + { + "newText": "bar", + "range": { + "end": { + "character": 8, + "line": 7, + }, + "start": { + "character": 5, + "line": 7, + }, + }, + }, + ], + }, + } + `); + expect( + await requestRename('fixture.vue', 'vue', ` + - - `, 'bar'); - await assertRenaming('fixture.vue', 'vue', ` - + + `, 'bar') + ).toMatchInlineSnapshot(` + { + "changes": { + "file://\${testWorkspacePath}/fixture.vue": [ + { + "newText": "bar", + "range": { + "end": { + "character": 20, + "line": 2, + }, + "start": { + "character": 17, + "line": 2, + }, + }, + }, + { + "newText": "bar", + "range": { + "end": { + "character": 8, + "line": 6, + }, + "start": { + "character": 5, + "line": 6, + }, + }, + }, + ], + }, + } + `); + expect( + await requestRename('fixture.vue', 'vue', ` + - - - - `, 'bar'); + + + + `, 'bar') + ).toMatchInlineSnapshot(` + { + "changes": { + "file://\${testWorkspacePath}/fixture.vue": [ + { + "newText": "bar", + "range": { + "end": { + "character": 34, + "line": 10, + }, + "start": { + "character": 31, + "line": 10, + }, + }, + }, + { + "newText": "bar", + "range": { + "end": { + "character": 28, + "line": 10, + }, + "start": { + "character": 25, + "line": 10, + }, + }, + }, + { + "newText": "bar", + "range": { + "end": { + "character": 28, + "line": 7, + }, + "start": { + "character": 25, + "line": 7, + }, + }, + }, + { + "newText": "bar", + "range": { + "end": { + "character": 13, + "line": 2, + }, + "start": { + "character": 10, + "line": 2, + }, + }, + }, + { + "newText": "bar", + "range": { + "end": { + "character": 35, + "line": 12, + }, + "start": { + "character": 32, + "line": 12, + }, + }, + }, + { + "newText": "bar", + "range": { + "end": { + "character": 29, + "line": 12, + }, + "start": { + "character": 26, + "line": 12, + }, + }, + }, + { + "newText": "bar", + "range": { + "end": { + "character": 35, + "line": 11, + }, + "start": { + "character": 32, + "line": 11, + }, + }, + }, + { + "newText": "bar", + "range": { + "end": { + "character": 29, + "line": 11, + }, + "start": { + "character": 26, + "line": 11, + }, + }, + }, + { + "newText": "bar", + "range": { + "end": { + "character": 29, + "line": 9, + }, + "start": { + "character": 26, + "line": 9, + }, + }, + }, + { + "newText": "bar", + "range": { + "end": { + "character": 29, + "line": 8, + }, + "start": { + "character": 26, + "line": 8, + }, + }, + }, + ], + }, + } + `); }); it('Component props', async () => { await ensureGlobalTypesHolder('tsconfigProject'); - await openDocument('tsconfigProject/foo.vue', 'vue', ` - + expect( + await prepareDocument('tsconfigProject/foo.vue', 'vue', ` + - + + `) + ).toMatchInlineSnapshot(` + FullTextDocument { + "_content": " + + + + ", + "_languageId": "vue", + "_lineOffsets": undefined, + "_uri": "file:///Users/johnsonchu/Desktop/volar/vue/test-workspace/tsconfigProject/foo.vue", + "_version": 1, + } `); - await assertRenaming('tsconfigProject/fixture.vue', 'vue', ` - + expect( + await requestRename('tsconfigProject/fixture.vue', 'vue', ` + - - `, 'cccDdd'); + + `, 'cccDdd') + ).toMatchInlineSnapshot(` + { + "changes": { + "file://\${testWorkspacePath}/tsconfigProject/fixture.vue": [ + { + "newText": "cccDdd", + "range": { + "end": { + "character": 24, + "line": 6, + }, + "start": { + "character": 18, + "line": 6, + }, + }, + }, + { + "newText": "cccDdd", + "range": { + "end": { + "character": 14, + "line": 2, + }, + "start": { + "character": 8, + "line": 2, + }, + }, + }, + ], + "file://\${testWorkspacePath}/tsconfigProject/foo.vue": [ + { + "newText": "cccDdd", + "range": { + "end": { + "character": 18, + "line": 3, + }, + "start": { + "character": 12, + "line": 3, + }, + }, + }, + { + "newText": "ccc-ddd", + "range": { + "end": { + "character": 19, + "line": 2, + }, + "start": { + "character": 12, + "line": 2, + }, + }, + }, + ], + }, + } + `); }); it('Component type props', async () => { await ensureGlobalTypesHolder('tsconfigProject'); - await openDocument('tsconfigProject/foo.vue', 'vue', ` + await prepareDocument('tsconfigProject/foo.vue', 'vue', `