Repository navigation
Conversation
The source offset mapped from the virtual script code can fall outside the script blocks, e.g. in the template. In that case no block matched and the loop fell through to the ref check, so bail out instead.
Contributor
|
Thank you for looking into #6272. It is fixed by #6402, so I am closing this one. This pull request stops the <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 Posted for johnsoncodehk by this workflow run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
vue.autoInsert.dotValueenabled, typing the name of arefdeclared in<script setup>also appends.valueinside the template, where top-level refs are already unwrapped. That produces broken code and a type error. It started in v3.3.12.provideAutoInsertSnippetinvue-autoinsert-dotvalue.tsmaps the selection back to a source offset and then loops over the script blocks to decide whether the position should be skipped. When the offset lands in the template no block matches, the loop ends silently andisRefAtPositionis still consulted. That used to be harmless because template interpolations were generated as__VLS_ctx.x, whose type is already unwrapped; since #6184 generates them as direct references (__VLS_unwrap(x, ...)) the identifier is typedRef<...>and the check returns true. The plugin now tracks whether the offset is actually inside a script block and bails out otherwise.close #6272