emacs-import-js icon indicating copy to clipboard operation
emacs-import-js copied to clipboard

Run import-js after snippet completion

Open zerinoid opened this issue 3 years ago • 2 comments

Is there a way to trigger import js after yasnippet completion?

I know I can use a custom hook or even yasnippet's 'expand-env' function but what import-js function should I use?

import-js-import will import only on-point expressions, I would need to use something that takes part of the snippet text as argument

zerinoid avatar Mar 31 '22 02:03 zerinoid

Hey @zerinoid - do you require that import-js would run only on a specific snippet, or would import-js-fix suffice?

The easiest path I see here to importing after snippet expansion would be to run import-js-fix on the current file just after expanding, which will apply imports to the whole file.

kevinkehl avatar Apr 01 '22 22:04 kevinkehl

@kevinkehl Hi, thank you.

I thought about that but import-js-fix end up importing things wrongly, Like catch's 'error' parameter which it imports as a component name Error:

image

Don't know why this happens.

zerinoid avatar Apr 04 '22 20:04 zerinoid