vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

Search classes by partial name

Open raulvaldoleiros opened this issue 2 years ago • 13 comments

The goal is to search a class by partial name through find symbol.

Steps To Reproduce
  1. Create a class named UserInfo
  2. Find by symbol and type "Info", actual on the command input will be "#Info"
Current Result

Doesn't return the UserInfo class

Expected Result

UserInfo class available for selection

raulvaldoleiros avatar May 05 '22 11:05 raulvaldoleiros

You should be able to do *Info or UInfo

fbricon avatar May 05 '22 14:05 fbricon

The UInfo worked, thanks for sharing. image

But the *Info didn't worked, don't know if is a configuration. image

raulvaldoleiros avatar May 05 '22 15:05 raulvaldoleiros

You can try to add the following JDT property:

org.eclipse.jdt.core.codeComplete.subwordMatch = enabled

See https://github.com/redhat-developer/vscode-java/wiki/Formatter-settings

snjeza avatar May 05 '22 16:05 snjeza

Thanks for the suggestion, but it also didn't worked. I created a file with the content org.eclipse.jdt.core.codeComplete.subwordMatch=enabled org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.subwordMatch=enabled And set the java.settings.url property pointing to that file.

raulvaldoleiros avatar May 05 '22 20:05 raulvaldoleiros

@raulvaldoleiros could you attach your log - Enable Logging

snjeza avatar May 05 '22 21:05 snjeza

@snjeza thanks for the help, the files you requested: Archive.zip

raulvaldoleiros avatar May 06 '22 08:05 raulvaldoleiros

I think this might be a bug. For *info My logs clearly show the language server returning ~300 symbols of which a class I declared as "UserInfo", would be in the results. However, the client shows nothing.

[Trace - 2:16:12 p.m.] Sending request 'workspace/symbol - (185)'.
Params: {
    "query": "*info"
}
...
...
[Info  - 2:16:12 p.m.] May 9, 2022, 2:16:12 p.m. Symbol Search found 302 symbols.
[Trace - 2:16:12 p.m.] Received response 'workspace/symbol - (185)' in 31ms.
Result: [
...
...

rgrunber avatar May 09 '22 18:05 rgrunber

I opened https://github.com/microsoft/vscode/issues/149144 upstream

fbricon avatar May 10 '22 09:05 fbricon

@fbricon That issue is closed as a duplicate. Not sure what has become of the current status for this issue right now.

tommai78101 avatar May 13 '22 19:05 tommai78101

For two years, I thought I didn't have this function. When I promoted vscode-Java, it was also a suspected object, which was mistaken for not powerful enough. To sum up, this bug is a big obstacle.

mozhuanzuojing avatar May 14 '22 23:05 mozhuanzuojing

In https://github.com/eclipse/eclipse.jdt.ls/issues/2084 , I've implemented wildcard, and qualfied searching. The problem is VS Code won't display any of the returned results :\ Even something like java.util.arr doesn't show despite plenty of valid candidates.

I can merge it so that it's at least supported for any other clients but VS Code needs to relax the constraints on what's returned.

rgrunber avatar May 26 '22 01:05 rgrunber

Anything that can be done here? 😢

raulvaldoleiros avatar Jun 23 '22 08:06 raulvaldoleiros

@rgrunber @jdneo Could you help me to reach someone in vscode team to review this change https://github.com/microsoft/vscode/pull/159377. This change actually adds support for * in the search query. It passes the raw query into LS and then compare the results by trying to fix the score if the other side doesn't have a *.

gayanper avatar Sep 07 '22 06:09 gayanper

@rgrunber any update on this? :(

raulvaldoleiros avatar Mar 26 '24 10:03 raulvaldoleiros

Searching for partial class names works well as long as you don't use * in the serach term. That's still a problem with how VS Code handles the results. I don't think we have any control over that. I just did :

[Trace - 07:47:16] Sending request 'workspace/symbol - (83)'.
Params: {
    "query": "*list"
}

The language server responded with ~100 entries, but VS Code's workspace symbol search showed nothing.

rgrunber avatar Mar 26 '24 11:03 rgrunber

ok, thanks for sharing

It feels we will never have it solved :(

raulvaldoleiros avatar Mar 26 '24 16:03 raulvaldoleiros