Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compiler): clone loc to ifNode #12131

Merged
merged 1 commit into from
Oct 11, 2024
Merged

Conversation

KazariEX
Copy link
Contributor

@KazariEX KazariEX commented Oct 8, 2024

fix vuejs/language-tools#4911

The incremental update of language tools increased the start offset twice on the same loc object when traversing the v-if node.

Copy link

github-actions bot commented Oct 8, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 101 kB 38.1 kB 34.2 kB
vue.global.prod.js 160 kB (+40 B) 58 kB (+20 B) 51.6 kB (+51 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 49.1 kB 18.9 kB 17.3 kB
createApp 55.7 kB 21.4 kB 19.6 kB
createSSRApp 59.7 kB 23.1 kB 21 kB
defineCustomElement 60.4 kB 23 kB 20.9 kB
overall 69.4 kB 26.5 kB 24.1 kB

Copy link

pkg-pr-new bot commented Oct 8, 2024

Open in Stackblitz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@12131

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@12131

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@12131

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@12131

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@12131

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@12131

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@12131

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@12131

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@12131

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@12131

vue

pnpm add https://pkg.pr.new/vue@12131

commit: 683ef82

@edison1105
Copy link
Member

Hi @KazariEX,

I reviewed this PR and I'm not entirely clear on the changes. Could you please provide a brief explanation of why these changes were necessary?

Thank you!

@edison1105 edison1105 added the need more info Further information is requested label Oct 9, 2024
@KazariEX
Copy link
Contributor Author

KazariEX commented Oct 9, 2024

ifNode and branch.children[0] share the same loc object, which means that the start offset of this loc will be increased one more time.

This explains why the semantic tokens in the issue have been moved one extra digit to the right.

https://github.com/vuejs/language-tools/blob/6916e42fb7109d9510e181de24f1a0f3d56da63b/packages/language-core/lib/plugins/vue-template-html.ts#L142-L146

@edison1105
Copy link
Member

/ecosystem-ci run

@edison1105 edison1105 added scope: compiler and removed need more info Further information is requested labels Oct 9, 2024
@vue-bot
Copy link
Contributor

vue-bot commented Oct 9, 2024

📝 Ran ecosystem CI: Open

suite result latest scheduled
language-tools failure failure
nuxt success success
pinia success success
primevue success success
quasar success success
radix-vue success success
router success success
test-utils success success
vant success success
vite-plugin-vue success success
vitepress success success
vue-i18n success success
vue-macros success success
vuetify success success
vueuse success success
vue-simple-compiler success success

@edison1105 edison1105 added ready to merge The PR is ready to be merged. 🧹 p1-chore Priority 1: this doesn't change code behavior. labels Oct 9, 2024
@yyx990803 yyx990803 merged commit cde2c06 into vuejs:main Oct 11, 2024
13 checks passed
@KazariEX KazariEX deleted the fix/v-if-loc branch October 11, 2024 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧹 p1-chore Priority 1: this doesn't change code behavior. ready to merge The PR is ready to be merged. scope: compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Semantic highlighting not updated on certain edits
4 participants