Skip to content

fix(language-service): skip .value auto insert outside script blocks - #6274

Closed
lazerg wants to merge 1 commit into
vuejs:masterfrom
lazerg:fix/issue-6272-dotvalue-template
Closed

lazerg wants to merge 1 commit into
vuejs:masterfrom
lazerg:fix/issue-6272-dotvalue-template

Conversation

@lazerg

@lazerg lazerg commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #6272

Template interpolations are generated into the same script_ virtual code as <script setup>, so the dotValue plugin ran for them too. The script block loop only skipped the shouldSkip check when the offset was outside every block, and then still went on to isRefAtPosition, which now sees a ref there. This returns early when the source offset is not inside <script> or <script setup>.

@lazerg

lazerg commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Hey @serkodev, please take a look when you have time~

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Thank you for looking into #6272. It is fixed by #6402, so I am closing this one.

This pull request stops the .value auto insert for the whole template. That removes the wrong insert for a top-level ref, but also the right one for refs the template does not unwrap. With this branch built, both of these no longer get .value (3.3.11 inserted it):

<div v-for="item in list">{{ item }}</div>   <!-- const list = [ref(1), ref(2)] -->
{{ obj.count }}                              <!-- const obj = { count: ref(1) } -->

The cause was one level down: since #6184 the template reads a setup binding as __VLS_unwrap(x) or x.value, and the check still asked for the type of the identifier x alone, which is the Ref. #6402 asks for the type of the generated read, which gives the three cases their right answers; they are in its tests.

Posted for johnsoncodehk by this workflow run.

@github-actions github-actions Bot closed this Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vue.autoInsert.dotValue incorrectly inserts .value in Vue template

1 participant