vuejs / language-tools

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

.vue file with js block comment will not fold/collapse if it's directly before an export default statement #4496

Closed jmalatia closed 13 hours ago

jmalatia commented 1 week ago

Vue - Official extension or vue-tsc version

Vue - Official v2.0.22,

VSCode version

1.90.2

Vue version

3.4.29

TypeScript version

5.4.5

System Info

System:
    OS: Windows 11 10.0.22621
    CPU: (8) x64 Intel(R) Core(TM) i7-9700KF CPU @ 3.60GHz
    Memory: 2.86 GB / 15.92 GB
  Binaries:
    Node: 20.13.1 - C:\Program Files\nodejs\node.EXE
    npm: 10.5.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 126.0.6478.114
    Edge: Chromium (125.0.2535.92)
    Internet Explorer: 11.0.22621.3527

Steps to reproduce

In a .vue file with a javascript block comment directly before export default, the comment can not be folded/collapsed in vscode. It make no difference if it's a <script>, <script lang="ts"> or <script lang="js"> tag

The below code will not fold (or offer the arrow to collapse when hovering the line):

<script lang="ts">
/**
 * @name 
 * @description 
 */
export default defineComponent({

});
</script>

6


However, if you add a line of js code between the comment and the export, the comment will fold as expected (and offer the arrow when hovering over the line):

<script lang="ts">
/**
 * @name 
 * @description 
 */
const a = "";
export default defineComponent({

});
</script>

4

Link to minimal reproduction

No response

Any additional comments?

No response

davidmatter commented 13 hours ago

This seems to be caused by vscode. The same behavior can be found when you edit a common html file without using the vue extension.

image