vuejs / language-tools

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

How to turn off or configure snippet import #4588

Open laterdayi opened 4 months ago

laterdayi commented 4 months ago

What problem does this feature solve?

! [image] (https://github.com/user-attachments/assets/cefc01ef-5470-488a-9ed6-dfd73faa7c27)

How to turn off or configure snippet import

I currently have a global snippet, but the plugin will import some node_modules snippets, can I configure or cancel it?

What does the proposed solution look like?

I currently have a global snippet, but the plugin will import some node_modules snippets, can I configure or cancel it?

RayGuo-ergou commented 4 months ago

Don't include node_module in your tsconfig or set "skipLibCheck": true

laterdayi commented 4 months ago

Don't include node_module in your tsconfig or set "skipLibCheck": true

Looking at the name is to prohibit package checking, does that mean there is some other effect besides not importing code snippets? Can you list them?

laterdayi commented 4 months ago

image

That doesn't seem to work

laterdayi commented 4 months ago

! [image] (https://github.com/user-attachments/assets/a7f82b8c-28fc-432b-a75f-97bec4139036)

Neither approach worked

RayGuo-ergou commented 4 months ago

skipLibCheck means don't check declare files inside node_modules, I suspected you included files like **/*.ts but from the screenshot it seems correct.

Can you share a reproduction repo?

laterdayi commented 4 months ago

https://github.com/laterdayi/tests Thank you for your help, after running in vue or js file, enter cl will appear node_Modules code snippet

RayGuo-ergou commented 4 months ago

I think the type is not exposed (e.g. not listed in package.json ), and supposed to be used internally.

import { ci } from 'node_modules/@fullcalendar/core/internal-common'

The behavior here is correct because it can ONLY be imported this way.

laterdayi commented 4 months ago

I didn't have this feature before, but in many cases I don't need to import node_modules. Is there a way to disable it

RayGuo-ergou commented 4 months ago

I don't use vscode but you can check this comment: https://github.com/microsoft/TypeScript/issues/35395#issuecomment-1430783726

laterdayi commented 4 months ago

thank you