typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

LSP: Jump to the function name

Open shinichy opened this issue 8 months ago • 5 comments

Improved the "Go to Definition" command to jump to the function name instead of the beginning of the function keyword.

Example:

function foo() {
   ...
}

foo(); // "Go to Definition" jumps to `foo` instead of `function`.

shinichy avatar Apr 13 '25 04:04 shinichy

@iisaduan is working on find-all-refs, so she may have already looked at this code.

Should some tests change? I'm not sure if fourslash tests are available yet.

sandersn avatar Apr 30 '25 17:04 sandersn

It's pretty separate from the find all refs work I've been doing, so there's no duplication. But the PR probably should update tests, so we have some sort of reference for what has been ported already/what we expect to work

iisaduan avatar Apr 30 '25 17:04 iisaduan

I could probably test this with my find all refs testing, but it's not quite ready yet

iisaduan avatar Apr 30 '25 17:04 iisaduan

It's good to know that there's no duplication, as that's something I was concerned about since your team seems to be actively working on the ls package. I'll also try to add a test.

shinichy avatar May 01 '25 05:05 shinichy

I added a basic test. Please let me know if I should cover more test cases, as there are currently no tests for definition.go.

shinichy avatar May 07 '25 03:05 shinichy

This has unfortunately gotten out of date as main has changed. Any chance you could update this so we can review it?

jakebailey avatar Jun 24 '25 23:06 jakebailey

Yes, let me merge main and resolve the conflicts.

shinichy avatar Jun 25 '25 03:06 shinichy

@jakebailey I've merged main and resolved the conflicts.

shinichy avatar Jun 28 '25 05:06 shinichy