dragos / dragos-vscode-scala

Other
253 stars 39 forks source link

How hard to implement goto symbol? #86

Open dyross opened 6 years ago

dyross commented 6 years ago

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 commented 6 years ago

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:

It would make for a great contribution. :)

dinkelhacker commented 6 years ago

According to the readme there is a feature

goto definition (F12 and CMD-F12)

Is this already implemented?

dragos commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

I think the best way to start is:

PS. Thanks a lot for picking up this ticket!

dinkelhacker commented 6 years ago

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 commented 6 years ago

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.