vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.68k stars 382 forks source link

Outside hybridMode, hover might show result of `_VLS_ctx` instead of particular property (off-by-one offset bug) #4536

Open tomblachut opened 1 month ago

tomblachut commented 1 month ago

Vue - Official extension or vue-tsc version

v2.0.26

VSCode version

1.91.0

Vue version

^3.4.18

TypeScript version

~5.0.4

System Info

No response

Steps to reproduce

  1. hybridMode: false
  2. Consider example file below
  3. Hover over the 1st character of a JS reference inside template, l is the easiest to try.
<script setup lang="ts">

/**
 * docs have to be removed in quick nav, preserved in quick doc!
 */
let local = 323 as number | null;
let l = 323 as number | null;

local;
</script>

<template>
  <div v-text="local"></div>
  <div v-text="l"></div>
  <div>{{local}}</div>
</template>

What is expected?

Screenshot 2024-07-05 at 17 16 01

What is actually happening?

Screenshot 2024-07-05 at 17 15 54

Link to minimal reproduction

No response

Any additional comments?

This is affecting WebStorm sadly, as we're not using hybridMode. I've checked and we sent the same offsets as VSCode does, but in hybridMode, Vue LS returns

[Trace - 16:57:08] Sending request 'textDocument/hover - (20)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/tomblachut/Work/Playgrounds/vue3-vite-ts5/src/components/injections/NullChecksTeamCity.vue"
    },
    "position": {
        "line": 11,
        "character": 15
    }
}

[Trace - 16:57:08] Received response 'textDocument/hover - (20)' in 8ms.
No result returned.
so1ve commented 1 month ago

Not sure if this is an upstream issue