-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for looking up Classes and Methods on classpath #204
Comments
You can already find classes and interfaces available in the classpath: Search for interface implementors is something we'll implement, eventually, see eclipse-jdtls/eclipse.jdt.ls#99. Method autocompletion requires the type to be imported in the 1st place. If you have a specific workflow in mind, could you please describe it, or point us to similar workflows in other IDEs? |
I was thinking more like "pop up dialog by some key combination" type, get class or class.method by matching, press enter, open .java or .class file. To do that in the file you're working on atm directly is a little hackish (ie you introduce errors in the current file, you might not want to use said clase in the current file at all but are looking for general usage details/impl details for the class). Eclipse does this and calls it: |
So as I understand it, that'd be something similar to the I'm not too fond of the idea of introducing additional windows/wizards if we could avoid it. So ideally, we could perform a workspace wide search for all types with our own custom prefix in the command palette (say We could still perform the full classpath search when hitting |
In the context of Java I consider this as fair play to implement the LSP protocol |
@egamma ok so I gave it a try and unfortunately it just doesn't scale. Including JDK and other classpath dependencies to the workspace symbol search, for the spring-amqp project as an example, the search engine returns 67862 hits, that are transformed into SymbolInformations. So everything is super slow until the UI just freezes and we never even see one result on screen. Obviously we need to limit the results, but then the problem is no new search is triggered if you continue typing in the search bar. |
@fbricon I did not expect that this works without some more tuning. I remember all the effort that was put into Eclipse to make this fast. How many of the hits are types? The Intellisense widget can handle hits of this magnitude, we have tests with about 20k hits. One difference is that the Intellisense widget is using a newer tuned list widget, whereas quick pick is still using the tree. So this is another optimization area. I've added @aeschli his memory is more fresh than mine on what was all done in Eclipse to make this fast. |
I thought the Java Language server already implement the workspace symbols request. This should run very performant as it limits itself to types (no fields or methods) which is highly tuned in JDT. To avoid the huge result set, the API should be used with a filter string. If I remember right, in Eclipse, the open type dialog didn't start a query unless the user provided a filter string. I suggest that LS clients do the same. |
That sounds great, even if only classes/types and not methods, it would definitely be a major plus with a more experimental development flow (getting to know the framework/library you're using, reading the code representation of a class, etc). |
@egamma @aeschli when forcing a non empty query, things get better, but still feels too sluggish. When sending |
@fbricon Something must go wrong in WorkspaceSymbolHandler, causing to resolve the TypeNameMatch's underlying JavaElement. Instead use
|
Thanks for the pointer @aeschli. I'll try that as soon as I can |
FYI and unsure if you already do that, but resolving workspace symbols can happen in two steps: First (when |
@jrieken For now location for types is not computed, always set to 0,0. so that's not an issue. The performance issue is indeed caused by computing the types, as @aeschli hinted, but we also loaded each type's buffer at some point which was unnecessary. I'm down to ~1 sec to load the types starting with letter A now, but I need to figure out why I'm seeing duplicates and some results cause an error. Anyway, making progress here :-) |
Fixes redhat-developer/vscode-java#204 This fix also includes generating stub class body for source-less classes. Signed-off-by: Fred Bricon <[email protected]>
Fixes redhat-developer/vscode-java#204 This fix also includes generating stub class body for source-less classes. Signed-off-by: Fred Bricon <[email protected]>
Fixes redhat-developer/vscode-java#204 This fix also includes generating stub class body for source-less classes. Signed-off-by: Fred Bricon <[email protected]>
Fixes redhat-developer/vscode-java#204 This fix also includes generating stub class body for source-less classes. Signed-off-by: Fred Bricon <[email protected]>
Ctrl+T now lists all classes from the workspace |
Just updated to 0.4.0 and tested this, works great! Much appreciated. I'm still awed by how quick you implemented this. Thanks again! |
Hi, |
@dmarrazzo CamelCase search is supported: so, in your case, you should try searching for |
Can you please attach a sample projects reproducing the issue? |
here is my gradle and vs code files |
Hi Team, I am able to search types based on the java class name or Interface name, but could not list the types that are with the package. Say example, when I type |
I also looking for search java classes which the classes are in some jars. |
Currently vscode-java allows completion and introspection of Classes and Methods on-the-fly while editing your code. Afaik, currently the only way for someone to find the source of a class or method is to have the Class imported.
It would be amazingly helpful if you could find Classes, Interfaces (and their implementations) and methods that are available to you (i.e. configured on the classpath, either explicitly or via Maven dependencies).
Environment
Steps To Reproduce
N/A, Feature request.
The text was updated successfully, but these errors were encountered: