nuxt / nuxt

The Intuitive Vue Framework.
https://nuxt.com
MIT License
54.91k stars 5.02k forks source link

disable vs-code auto-refactoring generated `.d.ts` files (or document) #19627

Open 171h opened 1 year ago

171h commented 1 year ago

Environment

Nuxt 3.2.2 Nodejs 19

Reproduction

My components is nested 5~6 layers.

Describe the bug

When I change too many code or rename deep component,the VS Code maybe open /.nuxt/components.d.ts file automatically,then cosole report many error. These error will disappear just when I delete .nuxt folder and recompile with yarn dev

Additional context

No response

Logs

No response

ddahan commented 1 year ago

As a sidenote, I would like to add that as a beginner, this is confusing because the file is open with pending modifications. If I try to close the window, I'll be prompted to save modifications. If I say yes (which is likely), I'll break some nuxt actions and the project might not work until this .d.ts file is regenerated again.

In addition, I often use the "save all files" feature. If I don't notice a .d.ts file has opened and use the feature, it may break things.

cannap commented 1 year ago

yea plus one for this when it comes to override stuff which is modified in backend i automatically press the wrong buttons xD

its not a big deal i tried to fix this stuff via vscode itself but i just dont know how is this possible to fix with nuxt itself? or does it need a vscode extension which will "prevent the file top open"

i also tried but it still pops up some times

 "files.exclude": {
    ".nuxt": true,
    "node_modules": true
  },
danielroe commented 1 year ago

I took a look at this and couldn't initially devise a way to prevent VSCode from doing this without also disabling the effect of the declaration files. We might need to open an upstream feature request (to VSCode) for an option to disable this feature on certain paths.

GoudekettingRM commented 1 year ago

I'm not 100% sure if this issue belongs to this one, but it feels related. Whenever I add or change components (or composables/plugins for that matter), VSCode opens the imports.d.ts/components.d.ts files and I have to manually save them. After which it complains about changes that have already been saved (I presume because Nuxt saves them before VSCode has fully processed and opened the files).