You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use this snippet, instead of the autocomplete from coc-tsserver for useRef, the import statement is not added on top of the file.
import{useRef}from'react'
a pop-up should appear in Neovim suggesting to import useRef from 'react'.
This could be also fixed using a custom script to add imports on top + prettier to organize them.
Ultisnips seems to not support adding import statements on top of the file.
My solution is not using these snippets anymore, instead combining other snippets (in this case const does not need an import) with the coc-tsserver autocomplete. Thanks a lot
The text was updated successfully, but these errors were encountered:
There is another issue, but not with coc-snippets.
If the import already exist, auto-complete does not work.
for example, I already have import { useImperativeHandle } from 'react'.
The autocomplete for useImperativeHandle does not work, so in the end using custom snippets is better than the coc-tsserver auto-complete except if you need the auto-import functionality.
The coc-tsserver option
typescript.suggest.paths
does not work with snippets.I created a snippet for useRef.
When I use this snippet, instead of the autocomplete from coc-tsserver for useRef, the import statement is not added on top of the file.
a pop-up should appear in Neovim suggesting to import useRef from 'react'.
This could be also fixed using a custom script to add imports on top + prettier to organize them.
Ultisnips seems to not support adding import statements on top of the file.
https://github.com/SirVer/ultisnips/issues?q=is%3Aissue+import+statement+is%3Aclosed
The video below shows how useRef from coc-tsserver adds an import statement on top of the file
Screen.Recording.2024-07-31.at.11.37.24.AM.mov
The video below shows how my custom snippet does not add the import statement.
Screen.Recording.2024-07-31.at.11.39.11.AM.mov
My solution is not using these snippets anymore, instead combining other snippets (in this case const does not need an import) with the coc-tsserver autocomplete. Thanks a lot
The text was updated successfully, but these errors were encountered: