codemirror-ts icon indicating copy to clipboard operation
codemirror-ts copied to clipboard

Go to definition

Open tmcw opened this issue 1 year ago • 4 comments

CleanShot 2023-11-17 at 17 13 06@2x

Should already be possible given the data in the hint extension, but if people want to replicate this experience we should make that possible as well.

tmcw avatar Nov 17 '23 22:11 tmcw

Yes!

I'm also working on / interested in this

Related:

  • https://github.com/vizhub-core/vzcode/issues/201
  • https://github.com/vizhub-core/vzcode/issues/177

curran avatar Dec 06 '23 21:12 curran

Found the API for it

https://github.com/typescript-language-server/typescript-language-server/tree/b224b878652438bcdd639137a6b1d1a6630129e4?tab=readme-ov-file#go-to-source-definition

curran avatar Apr 24 '24 17:04 curran

The interaction in VSCode:

  • Hold CTRL
  • Hover on a variable, it underlines if you can jump to its definition
  • CTRL+Click to jump to definition

curran avatar Apr 24 '24 17:04 curran

That's in the typescript-language-server project, which is a 3rd party adapter from the TypeScript interface to the LSP interface, because TypeScript doesn't actually implement LSP (which is a thing I rant about all the time, Microsoft get your act together, etc). This module currently uses TypeScript, but not the extra language server. It'd probably use the language server if this adopted more of a client-server architecture, or maybe it should in general, but for now, it's integrating with TypeScript, and we'll need to figure out what's under the hood of the LSP adapter's implementation.

tmcw avatar Apr 24 '24 20:04 tmcw