neoclide / coc-tsserver

Tsserver extension for coc.nvim that provide rich features like VSCode for javascript & typescript
MIT License
1.06k stars 68 forks source link

typescript.preferGoToSourceDefinition #449

Closed preslavmihaylov closed 6 months ago

preslavmihaylov commented 8 months ago

Is there a setting in coc-tsserver which acts the same way vscode's typescript.preferTGoToSourceDefinition does?

Without this, working in a monorepo which relies on typechecking via declaration files vs implementation breaks the functionality for going into a func implementation https://twitter.com/kamilogorek/status/1735947897986769136

fannheyward commented 8 months ago

coc-tsserver already supports tsserver.goToSourceDefinition command https://github.com/neoclide/coc-tsserver/pull/384.

You can add custom mapping for TS file only:

autocmd FileType typescript nnoremap <buffer><silent> gd :CocCommand tsserver.goToSourceDefinition<CR>
fannheyward commented 7 months ago

This feature has been released in coc-tsserver-dev, try :CocUninstall coc-tsserver and :CocInstall coc-tsserver-dev.

Note: coc-tsserver-dev is only used for unmerged PRs, and after PR merged into coc-tsserver, you should use coc-tsserver instead.

preslavmihaylov commented 7 months ago

Nice, thank you!

fabOnReact commented 2 months ago

go to the definition does not work with libraries like React.js

https://github.com/microsoft/TypeScript/issues/37777#issuecomment-2259714084

https://github.com/user-attachments/assets/6b8f0747-9bd1-406d-b5db-d40436ddfdd1

for example, I can not navigate the source code implementation of useRef. It is minified. https://github.com/neoclide/coc-tsserver/pull/384 https://github.com/microsoft/TypeScript/issues/37777