diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000000..30ab299dd9 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +link-workspace-packages=true diff --git a/packages/language-service/lib/plugins/vue-template.ts b/packages/language-service/lib/plugins/vue-template.ts index b24eda61ab..d1524feef9 100644 --- a/packages/language-service/lib/plugins/vue-template.ts +++ b/packages/language-service/lib/plugins/vue-template.ts @@ -449,7 +449,7 @@ export function create( } for (const binding of scriptSetupRanges?.bindings ?? []) { - const name = vueCode.sfc.scriptSetup!.content.substring(binding.start, binding.end); + const name = vueCode.sfc.scriptSetup.content.substring(binding.start, binding.end); if (casing.tag === TagNameCasing.Kebab) { names.add(hyphenateTag(name)); } @@ -498,8 +498,8 @@ export function create( return []; } let ctxVars = [ - ..._tsCodegen.scriptRanges()?.bindings.map(binding => vueCode.sfc.script!.content.substring(binding.start, binding.end)) ?? [], - ..._tsCodegen.scriptSetupRanges()?.bindings.map(binding => vueCode.sfc.scriptSetup!.content.substring(binding.start, binding.end)) ?? [], + ..._tsCodegen.scriptRanges()?.bindings.map(binding => vueCode.sfc.script.content.substring(binding.start, binding.end)) ?? [], + ..._tsCodegen.scriptSetupRanges()?.bindings.map(binding => vueCode.sfc.scriptSetup.content.substring(binding.start, binding.end)) ?? [], ...templateContextProps, ]; ctxVars = [...new Set(ctxVars)]; diff --git a/packages/typescript-plugin/lib/requests/collectExtractProps.ts b/packages/typescript-plugin/lib/requests/collectExtractProps.ts index 0ebdf05a89..7f49b4584b 100644 --- a/packages/typescript-plugin/lib/requests/collectExtractProps.ts +++ b/packages/typescript-plugin/lib/requests/collectExtractProps.ts @@ -47,8 +47,8 @@ export function collectExtractProps( const source = map.getSourceOffset(name.getEnd() - (isTsPlugin ? volarFile.snapshot.getLength() : 0)); if ( source - && source[0] >= sfc.template!.startTagEnd + templateCodeRange[0] - && source[0] <= sfc.template!.startTagEnd + templateCodeRange[1] + && source[0] >= sfc.template.startTagEnd + templateCodeRange[0] + && source[0] <= sfc.template.startTagEnd + templateCodeRange[1] && isSemanticTokensEnabled(source[1].data) ) { if (!result.has(name.text)) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 965812b208..19f3142be7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,13 +46,13 @@ importers: version: 2.2.0-alpha.10 '@vue/language-core': specifier: 2.0.13 - version: 2.0.13(typescript@5.4.5) + version: link:../../packages/language-core '@vue/language-server': specifier: 2.0.13 - version: 2.0.13(typescript@5.4.5) + version: link:../../packages/language-server '@vue/typescript-plugin': specifier: 2.0.13 - version: 2.0.13(typescript@5.4.5) + version: link:../../packages/typescript-plugin esbuild: specifier: latest version: 0.20.1 @@ -76,7 +76,7 @@ importers: version: 2.2.0-alpha.10 '@vue/language-core': specifier: 2.0.13 - version: 2.0.13(typescript@5.3.3) + version: link:../language-core path-browserify: specifier: ^1.0.1 version: 1.0.1 @@ -85,7 +85,7 @@ importers: version: 5.3.3 vue-component-type-helpers: specifier: 2.0.13 - version: 2.0.13 + version: link:../component-type-helpers devDependencies: '@types/node': specifier: latest @@ -150,7 +150,7 @@ importers: version: 20.11.21 '@vue/language-core': specifier: 2.0.13 - version: 2.0.13(typescript@5.4.5) + version: link:../language-core packages/language-server: dependencies: @@ -162,13 +162,13 @@ importers: version: 2.2.0-alpha.10 '@vue/language-core': specifier: 2.0.13 - version: 2.0.13(typescript@5.4.5) + version: link:../language-core '@vue/language-service': specifier: 2.0.13 - version: 2.0.13(typescript@5.4.5) + version: link:../language-service '@vue/typescript-plugin': specifier: 2.0.13 - version: 2.0.13(typescript@5.4.5) + version: link:../typescript-plugin vscode-languageserver-protocol: specifier: ^3.17.5 version: 3.17.5 @@ -189,13 +189,13 @@ importers: version: 3.4.20 '@vue/language-core': specifier: 2.0.13 - version: 2.0.13(typescript@5.4.5) + version: link:../language-core '@vue/shared': specifier: ^3.4.0 version: 3.4.20 '@vue/typescript-plugin': specifier: 2.0.13 - version: 2.0.13(typescript@5.4.5) + version: link:../typescript-plugin computeds: specifier: ^0.0.1 version: 0.0.1 @@ -256,7 +256,7 @@ importers: version: 2.2.0-alpha.10 '@vue/language-core': specifier: 2.0.13 - version: 2.0.13(typescript@5.3.3) + version: link:../language-core semver: specifier: ^7.5.4 version: 7.6.0 @@ -275,7 +275,7 @@ importers: version: 2.2.0-alpha.10 '@vue/language-core': specifier: 2.0.13 - version: 2.0.13(typescript@5.4.5) + version: link:../language-core '@vue/shared': specifier: ^3.4.0 version: 3.4.20 @@ -291,7 +291,7 @@ importers: version: 3.4.20(typescript@5.4.5) vue-component-type-helpers: specifier: 2.0.13 - version: 2.0.13 + version: link:../packages/component-type-helpers vue2: specifier: npm:vue@2.7.16 version: vue@2.7.16 @@ -1115,33 +1115,18 @@ packages: '@volar/language-core@2.2.0-alpha.10': resolution: {integrity: sha512-njVJLtpu0zMvDaEk7K5q4BRpOgbyEUljU++un9TfJoJNhxG0z/hWwpwgTRImO42EKvwIxF3XUzeMk+qatAFy7Q==} - '@volar/language-core@2.2.0-alpha.8': - resolution: {integrity: sha512-Ew1Iw7/RIRNuDLn60fWJdOLApAlfTVPxbPiSLzc434PReC9kleYtaa//Wo2WlN1oiRqneW0pWQQV0CwYqaimLQ==} - '@volar/language-server@2.2.0-alpha.10': resolution: {integrity: sha512-PpmgXRvgTN0R5539X5XjBY3zYt/NCoz/LPLw2dFcL8O1lBssYufVPAtSov8mogJLx0PejQFIWLBbdDpCKJT6qw==} - '@volar/language-server@2.2.0-alpha.8': - resolution: {integrity: sha512-OTKTDvJNBkP+/AZU0a7FaL/OTWgCIExGPrTv6hI9NKwjwhWOXiDDbhAPplqJuhBFwFaUWSEQ57rT55dCA4tDEw==} - '@volar/language-service@2.2.0-alpha.10': resolution: {integrity: sha512-gnAEPGGfjl/DFFJGzAKV6kZ/GrG3qrVhn95eLtC1rB832ehQNwcq20rAk2F9I05yhves0VjstfDL2/2RrTNp5g==} - '@volar/language-service@2.2.0-alpha.8': - resolution: {integrity: sha512-dk08ztdmKNz41GK/3zx3sgTDSanA8tcHuUnt1q0NHac8ozVWAlEd94KWmFKtuefJc2y7B3FCTZ9outFf/EkLKw==} - '@volar/snapshot-document@2.2.0-alpha.10': resolution: {integrity: sha512-d5rK7cfRdDTJ6JA/+Oc99rV0yRCSE1j9mFn4SqDduzGwKVQFR4gmjLPNKeT8iRI17PjmUZCUMdH0PM1u89G9fA==} - '@volar/snapshot-document@2.2.0-alpha.8': - resolution: {integrity: sha512-/MbcEM/7lND+kFOSnPfvwSb5dmASKiDd+bOyHygO1nRgnNflNbS0mMYTiNmbOjOTtjedPF/BAOww6Fk+2zotww==} - '@volar/source-map@2.2.0-alpha.10': resolution: {integrity: sha512-nrdWApVkP5cksAnDEyy1JD9rKdwOJsEq1B+seWO4vNXmZNcxQQCx4DULLBvKt7AzRUAQiAuw5aQkb9RBaSqdVA==} - '@volar/source-map@2.2.0-alpha.8': - resolution: {integrity: sha512-E1ZVmXFJ5DU4fWDcWHzi8OLqqReqIDwhXvIMhVdk6+VipfMVv4SkryXu7/rs4GA/GsebcRyJdaSkKBB3OAkIcA==} - '@volar/tsl-config@0.0.0-20240315.2': resolution: {integrity: sha512-bv57xhmegLkfjW0/FZL/sberfmUch7yLAkXlRXj5KxHPYCjIU4T1ciPuLWrtVzCa+o0q7ykQ6aR+Q/z7MSMf6w==} peerDependencies: @@ -1150,9 +1135,6 @@ packages: '@volar/typescript@2.2.0-alpha.10': resolution: {integrity: sha512-GCa0vTVVdA9ULUsu2Rx7jwsIuyZQPvPVT9o3NrANTbYv+523Ao1gv3glC5vzNSDPM6bUl37r94HbCj7KINQr+g==} - '@volar/typescript@2.2.0-alpha.8': - resolution: {integrity: sha512-RLbRDI+17CiayHZs9HhSzlH0FhLl/+XK6o2qoiw2o2GGKcyD1aDoY6AcMd44acYncTOrqoTNoY6LuCiRyiJiGg==} - '@volar/vscode@2.2.0-alpha.10': resolution: {integrity: sha512-ws4GrTJira5QV3KTgF36cs+FLTrf1JbIWW2nHuO8ZeZ1av7ghG8aSYsJ+FpuRtt7sAxj654P2PrjDqUMFvFZsQ==} @@ -1180,21 +1162,6 @@ packages: '@vue/compiler-ssr@3.4.20': resolution: {integrity: sha512-b3gFQPiHLvI12C56otzBPpQhZ5kgkJ5RMv/zpLjLC2BIFwX5GktDqYQ7xg0Q2grP6uFI8al3beVKvAVxFtXmIg==} - '@vue/language-core@2.0.13': - resolution: {integrity: sha512-oQgM+BM66SU5GKtUMLQSQN0bxHFkFpLSSAiY87wVziPaiNQZuKVDt/3yA7GB9PiQw0y/bTNL0bOc0jM/siYjKg==} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - - '@vue/language-server@2.0.13': - resolution: {integrity: sha512-wZaWrLRcyQiOpk5c0eAHgHeVXFGx9b+qJAuleyyz5pyBmvTaSD0eAa0mqCzN0f4ttIPLAJTkMmLuW+pN2Lru9A==} - hasBin: true - - '@vue/language-service@2.0.13': - resolution: {integrity: sha512-LXua9LLqUCNA1JwyT4y4UxB1EhaP8wX+cUvnSwqs9jOw5jQDkTdWqyVFftDTxfQnjcVTZLmwfFbPCeQmHOOadg==} - '@vue/reactivity@3.4.20': resolution: {integrity: sha512-P5LJcxUkG6inlHr6MHVA4AVFAmRYJQ7ONGWJILNjMjoYuEXFhYviSCb9BEMyszSG/1kWCZbtWQlKSLasFRpThw==} @@ -1212,9 +1179,6 @@ packages: '@vue/shared@3.4.20': resolution: {integrity: sha512-KTEngal0aiUvNJ6I1Chk5Ew5XqChsFsxP4GKAYXWb99zKJWjNU72p2FWEOmZWHxHcqtniOJsgnpd3zizdpfEag==} - '@vue/typescript-plugin@2.0.13': - resolution: {integrity: sha512-0I2rw8ic3jF+dKiwj45YIJCuslw5W+qXy8dilzHKV268r+EsfE5+9V6Wa5ZVCwgAhAWxaCAV1EWltRzrxUKHPw==} - JSONStream@1.3.5: resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} hasBin: true @@ -3286,9 +3250,6 @@ packages: vscode-uri@3.0.8: resolution: {integrity: sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==} - vue-component-type-helpers@2.0.13: - resolution: {integrity: sha512-xNO5B7DstNWETnoYflLkVgh8dK8h2ZDgxY1M2O0zrqGeBNq5yAZ8a10yCS9+HnixouNGYNX+ggU9MQQq86HTpg==} - vue-template-compiler@2.7.16: resolution: {integrity: sha512-AYbUWAJHLGGQM7+cNTELw+KsOG9nl2CnSv467WobS5Cv9uk3wFcnr1Etsz2sEIHEZvw1U+o9mRlEO6QbZvUPGQ==} @@ -4190,10 +4151,6 @@ snapshots: dependencies: '@volar/source-map': 2.2.0-alpha.10 - '@volar/language-core@2.2.0-alpha.8': - dependencies: - '@volar/source-map': 2.2.0-alpha.8 - '@volar/language-server@2.2.0-alpha.10': dependencies: '@volar/language-core': 2.2.0-alpha.10 @@ -4208,20 +4165,6 @@ snapshots: vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 - '@volar/language-server@2.2.0-alpha.8': - dependencies: - '@volar/language-core': 2.2.0-alpha.8 - '@volar/language-service': 2.2.0-alpha.8 - '@volar/snapshot-document': 2.2.0-alpha.8 - '@volar/typescript': 2.2.0-alpha.8 - '@vscode/l10n': 0.0.16 - path-browserify: 1.0.1 - request-light: 0.7.0 - vscode-languageserver: 9.0.1 - vscode-languageserver-protocol: 3.17.5 - vscode-languageserver-textdocument: 1.0.11 - vscode-uri: 3.0.8 - '@volar/language-service@2.2.0-alpha.10': dependencies: '@volar/language-core': 2.2.0-alpha.10 @@ -4229,31 +4172,15 @@ snapshots: vscode-languageserver-textdocument: 1.0.11 vscode-uri: 3.0.8 - '@volar/language-service@2.2.0-alpha.8': - dependencies: - '@volar/language-core': 2.2.0-alpha.8 - vscode-languageserver-protocol: 3.17.5 - vscode-languageserver-textdocument: 1.0.11 - vscode-uri: 3.0.8 - '@volar/snapshot-document@2.2.0-alpha.10': dependencies: vscode-languageserver-protocol: 3.17.5 vscode-languageserver-textdocument: 1.0.11 - '@volar/snapshot-document@2.2.0-alpha.8': - dependencies: - vscode-languageserver-protocol: 3.17.5 - vscode-languageserver-textdocument: 1.0.11 - '@volar/source-map@2.2.0-alpha.10': dependencies: muggle-string: 0.4.1 - '@volar/source-map@2.2.0-alpha.8': - dependencies: - muggle-string: 0.4.1 - '@volar/tsl-config@0.0.0-20240315.2(tsl@0.0.10(typescript@5.3.3))': dependencies: tsl: 0.0.10(typescript@5.3.3) @@ -4263,11 +4190,6 @@ snapshots: '@volar/language-core': 2.2.0-alpha.10 path-browserify: 1.0.1 - '@volar/typescript@2.2.0-alpha.8': - dependencies: - '@volar/language-core': 2.2.0-alpha.8 - path-browserify: 1.0.1 - '@volar/vscode@2.2.0-alpha.10': dependencies: '@volar/language-server': 2.2.0-alpha.10 @@ -4325,66 +4247,6 @@ snapshots: '@vue/compiler-dom': 3.4.20 '@vue/shared': 3.4.20 - '@vue/language-core@2.0.13(typescript@5.3.3)': - dependencies: - '@volar/language-core': 2.2.0-alpha.8 - '@vue/compiler-dom': 3.4.20 - '@vue/shared': 3.4.20 - computeds: 0.0.1 - minimatch: 9.0.3 - path-browserify: 1.0.1 - vue-template-compiler: 2.7.16 - optionalDependencies: - typescript: 5.3.3 - - '@vue/language-core@2.0.13(typescript@5.4.5)': - dependencies: - '@volar/language-core': 2.2.0-alpha.8 - '@vue/compiler-dom': 3.4.20 - '@vue/shared': 3.4.20 - computeds: 0.0.1 - minimatch: 9.0.3 - path-browserify: 1.0.1 - vue-template-compiler: 2.7.16 - optionalDependencies: - typescript: 5.4.5 - - '@vue/language-server@2.0.13(typescript@5.4.5)': - dependencies: - '@volar/language-core': 2.2.0-alpha.8 - '@volar/language-server': 2.2.0-alpha.8 - '@vue/language-core': 2.0.13(typescript@5.4.5) - '@vue/language-service': 2.0.13(typescript@5.4.5) - '@vue/typescript-plugin': 2.0.13(typescript@5.4.5) - vscode-languageserver-protocol: 3.17.5 - transitivePeerDependencies: - - typescript - - '@vue/language-service@2.0.13(typescript@5.4.5)': - dependencies: - '@volar/language-core': 2.2.0-alpha.8 - '@volar/language-service': 2.2.0-alpha.8 - '@volar/typescript': 2.2.0-alpha.8 - '@vue/compiler-dom': 3.4.20 - '@vue/language-core': 2.0.13(typescript@5.4.5) - '@vue/shared': 3.4.20 - '@vue/typescript-plugin': 2.0.13(typescript@5.4.5) - computeds: 0.0.1 - path-browserify: 1.0.1 - volar-service-css: 0.0.38(@volar/language-service@2.2.0-alpha.8) - volar-service-emmet: 0.0.38(@volar/language-service@2.2.0-alpha.8) - volar-service-html: 0.0.38(@volar/language-service@2.2.0-alpha.8) - volar-service-json: 0.0.38(@volar/language-service@2.2.0-alpha.8) - volar-service-pug: 0.0.38 - volar-service-pug-beautify: 0.0.38(@volar/language-service@2.2.0-alpha.8) - volar-service-typescript: 0.0.38(@volar/language-service@2.2.0-alpha.8) - volar-service-typescript-twoslash-queries: 0.0.38(@volar/language-service@2.2.0-alpha.8) - vscode-html-languageservice: 5.1.2 - vscode-languageserver-textdocument: 1.0.11 - vscode-uri: 3.0.8 - transitivePeerDependencies: - - typescript - '@vue/reactivity@3.4.20': dependencies: '@vue/shared': 3.4.20 @@ -4408,14 +4270,6 @@ snapshots: '@vue/shared@3.4.20': {} - '@vue/typescript-plugin@2.0.13(typescript@5.4.5)': - dependencies: - '@volar/typescript': 2.2.0-alpha.8 - '@vue/language-core': 2.0.13(typescript@5.4.5) - '@vue/shared': 3.4.20 - transitivePeerDependencies: - - typescript - JSONStream@1.3.5: dependencies: jsonparse: 1.3.1 @@ -6504,14 +6358,6 @@ snapshots: optionalDependencies: '@volar/language-service': 2.2.0-alpha.10 - volar-service-css@0.0.38(@volar/language-service@2.2.0-alpha.8): - dependencies: - vscode-css-languageservice: 6.2.12 - vscode-languageserver-textdocument: 1.0.11 - vscode-uri: 3.0.8 - optionalDependencies: - '@volar/language-service': 2.2.0-alpha.8 - volar-service-emmet@0.0.38(@volar/language-service@2.2.0-alpha.10): dependencies: '@vscode/emmet-helper': 2.9.2 @@ -6519,13 +6365,6 @@ snapshots: optionalDependencies: '@volar/language-service': 2.2.0-alpha.10 - volar-service-emmet@0.0.38(@volar/language-service@2.2.0-alpha.8): - dependencies: - '@vscode/emmet-helper': 2.9.2 - vscode-html-languageservice: 5.1.2 - optionalDependencies: - '@volar/language-service': 2.2.0-alpha.8 - volar-service-html@0.0.38(@volar/language-service@2.2.0-alpha.10): dependencies: vscode-html-languageservice: 5.1.2 @@ -6534,14 +6373,6 @@ snapshots: optionalDependencies: '@volar/language-service': 2.2.0-alpha.10 - volar-service-html@0.0.38(@volar/language-service@2.2.0-alpha.8): - dependencies: - vscode-html-languageservice: 5.1.2 - vscode-languageserver-textdocument: 1.0.11 - vscode-uri: 3.0.8 - optionalDependencies: - '@volar/language-service': 2.2.0-alpha.8 - volar-service-json@0.0.38(@volar/language-service@2.2.0-alpha.10): dependencies: vscode-json-languageservice: 5.3.9 @@ -6549,25 +6380,12 @@ snapshots: optionalDependencies: '@volar/language-service': 2.2.0-alpha.10 - volar-service-json@0.0.38(@volar/language-service@2.2.0-alpha.8): - dependencies: - vscode-json-languageservice: 5.3.9 - vscode-uri: 3.0.8 - optionalDependencies: - '@volar/language-service': 2.2.0-alpha.8 - volar-service-pug-beautify@0.0.38(@volar/language-service@2.2.0-alpha.10): dependencies: '@johnsoncodehk/pug-beautify': 0.2.2 optionalDependencies: '@volar/language-service': 2.2.0-alpha.10 - volar-service-pug-beautify@0.0.38(@volar/language-service@2.2.0-alpha.8): - dependencies: - '@johnsoncodehk/pug-beautify': 0.2.2 - optionalDependencies: - '@volar/language-service': 2.2.0-alpha.8 - volar-service-pug@0.0.38: dependencies: '@volar/language-service': 2.2.0-alpha.10 @@ -6581,10 +6399,6 @@ snapshots: optionalDependencies: '@volar/language-service': 2.2.0-alpha.10 - volar-service-typescript-twoslash-queries@0.0.38(@volar/language-service@2.2.0-alpha.8): - optionalDependencies: - '@volar/language-service': 2.2.0-alpha.8 - volar-service-typescript@0.0.38(@volar/language-service@2.2.0-alpha.10): dependencies: path-browserify: 1.0.1 @@ -6595,16 +6409,6 @@ snapshots: optionalDependencies: '@volar/language-service': 2.2.0-alpha.10 - volar-service-typescript@0.0.38(@volar/language-service@2.2.0-alpha.8): - dependencies: - path-browserify: 1.0.1 - semver: 7.6.0 - typescript-auto-import-cache: 0.3.2 - vscode-languageserver-textdocument: 1.0.11 - vscode-nls: 5.2.0 - optionalDependencies: - '@volar/language-service': 2.2.0-alpha.8 - vsce@2.15.0: dependencies: azure-devops-node-api: 11.2.0 @@ -6677,8 +6481,6 @@ snapshots: vscode-uri@3.0.8: {} - vue-component-type-helpers@2.0.13: {} - vue-template-compiler@2.7.16: dependencies: de-indent: 1.0.2