Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run import-js after snippet completion #34

Open
zerinoid opened this issue Mar 31, 2022 · 2 comments
Open

Run import-js after snippet completion #34

zerinoid opened this issue Mar 31, 2022 · 2 comments

Comments

@zerinoid
Copy link

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

@kevinkehl
Copy link
Collaborator

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.

@zerinoid
Copy link
Author

zerinoid commented Apr 4, 2022

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants