Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

How hard to implement goto symbol? #86

Open
dyross opened this issue May 13, 2018 · 7 comments
Open

How hard to implement goto symbol? #86

dyross opened this issue May 13, 2018 · 7 comments

Comments

@dyross
Copy link

dyross commented May 13, 2018

In vscode, you can command+t to do fuzzy find based on symbol and it uses the same functionality as goto definition. How hard would this be to implement?

@dragos
Copy link
Owner

dragos commented May 14, 2018

I think Ensime offers similar functionality (though, it needs an index if this is supposed to work at the workspace level as opposed to in-file only). If that's the case, it's not too hard:

  • identify the Ensime API to call
  • check and add if needed the language server protocol message/request types
  • implement the message/request parts

It would make for a great contribution. :)

@dinkelhacker
Copy link

According to the readme there is a feature

goto definition (F12 and CMD-F12)

Is this already implemented?

@dragos
Copy link
Owner

dragos commented Jul 8, 2018

Yes, go to symbol is already implemented. It's different from what the OP is asking, though: it works if you have the identifier in a source file that doesn't have errors (or at least, that particular identifier can be correctly resolved). Then, you can ctrl-click or press F12.

To to a global search in the whole project/classpath you'd need a lot more (if you're wondering why it's harder, it's because in the source-file the compiler already has the imports where that symbol is coming from).

@dinkelhacker
Copy link

Okay, I'd like to help out on this.
Guess I'll start reading the VS Code documentation on implementing a LS to get a hang of this.
If you have other suggestions what I should check out let me know.

@dragos
Copy link
Owner

dragos commented Jul 9, 2018

I think the best way to start is:

  • look at the existing code for go to symbol. (it delegates to Ensime)
  • check in the Ensime codebase how they implement workspace wide search. I think this is the request to make
  • hook up the LSP parts, see what messages are exchanged by following working examples in this project, perhaps all case classes are already available

PS. Thanks a lot for picking up this ticket!

@dinkelhacker
Copy link

I am a bit confused. The API call you mentioned isn't available in the 3.0 or 2.0 branch, right? So its also not available in the version specified in the dependencies.
If you wouldn't send the link to the specific tree I wouldn't have found it.

@dragos
Copy link
Owner

dragos commented Jul 16, 2018

You're right, I had an old checkout of the 2.0 branch, but this call was removed soon after. I'm not sure what's the current way to query this functionality, maybe @fommil could give us a hint?

In general, since the emacs client is the most complete ensime client, it's the place to look for API use examples.

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

No branches or pull requests

3 participants