language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

How to turn off or configure snippet import

Open laterdayi opened this issue 1 year ago • 10 comments

What problem does this feature solve?

image

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?

laterdayi avatar Jul 15 '24 13:07 laterdayi

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

RayGuo-ergou avatar Jul 16 '24 00:07 RayGuo-ergou

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 avatar Jul 16 '24 00:07 laterdayi

image

That doesn't seem to work

laterdayi avatar Jul 16 '24 01:07 laterdayi

image

Neither approach worked

laterdayi avatar Jul 16 '24 01:07 laterdayi

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?

RayGuo-ergou avatar Jul 16 '24 01:07 RayGuo-ergou

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

laterdayi avatar Jul 16 '24 01:07 laterdayi

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.

RayGuo-ergou avatar Jul 16 '24 02:07 RayGuo-ergou

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

laterdayi avatar Jul 16 '24 02:07 laterdayi

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

RayGuo-ergou avatar Jul 16 '24 02:07 RayGuo-ergou

thank you

laterdayi avatar Jul 16 '24 02:07 laterdayi