Skip to content
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

[regression] Workspace symbol search doesn't show results when query contains * #149144

Closed
fbricon opened this issue May 10, 2022 · 13 comments · May be fixed by #159377
Closed

[regression] Workspace symbol search doesn't show results when query contains * #149144

fbricon opened this issue May 10, 2022 · 13 comments · May be fixed by #159377
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) editor-symbols definitions, declarations, references quick-open Quick-open issues (search, commands) quick-pick Quick-pick widget issues

Comments

@fbricon
Copy link
Contributor

fbricon commented May 10, 2022

Does this issue occur when all extensions are disabled?: Maybe

  • VS Code Version: 1.67.0
  • OS Version: MacOS Monterey 12.3.1

We (vscode-java team) noticed that workspace symbol search doesn't show results anymore when the query contains a * character. This used to work at least 3 years ago, but I have no idea when that regression occurred.

The language server properly returns the search results, but they're just not displayed.

Steps to Reproduce:

  1. Use a workspace symbol provider that supports wildcard searches, enable tracing (eg. "java.trace.level":"verbose" for vscode-java)
  2. open a java file
  3. Open the symbol search palette and search for *Exception. You can see in the "Language Support for Java" output that results are returned, but none are actually displayed:
[Trace - 11:29:12 AM] Sending request 'workspace/symbol - (130)'.
Params: {
    "query": "*Exception"
}


[Trace - 11:29:12 AM] Received response 'workspace/symbol - (130)' in 82ms.
    {
        "name": "EOFException",
        "kind": 5,
        "location": {
            "uri": "jdt://contents/java.base/java.io/EOFException.class?=jdt.ls-java-project/%5C/Users%5C/fbricon%5C/.sdkman%5C/candidates%5C/java%5C/18-open%5C/lib%5C/jrt-fs.jar%60java.base=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/18%5C/docs%5C/api%5C/=/%3Cjava.io(EOFException.class",
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            }
        },
        "containerName": "java.io"
    },
    {
        "name": "TransportTimeoutException",
        "kind": 5,
        "location": {
            "uri": "jdt://contents/jdk.jdi/com.sun.jdi.connect/TransportTimeoutException.class?=jdt.ls-java-project/%5C/Users%5C/fbricon%5C/.sdkman%5C/candidates%5C/java%5C/18-open%5C/lib%5C/jrt-fs.jar%60jdk.jdi=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/18%5C/docs%5C/api%5C/=/%3Ccom.sun.jdi.connect(TransportTimeoutException.class",
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            }
        },
        "containerName": "com.sun.jdi.connect"
    },
    {
        "name": "CMMException",
        "kind": 5,
        "location": {
            "uri": "jdt://contents/java.desktop/java.awt.color/CMMException.class?=jdt.ls-java-project/%5C/Users%5C/fbricon%5C/.sdkman%5C/candidates%5C/java%5C/18-open%5C/lib%5C/jrt-fs.jar%60java.desktop=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/18%5C/docs%5C/api%5C/=/%3Cjava.awt.color(CMMException.class",
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            }
        },
        "containerName": "java.awt.color"
    },
    {
        "name": "SQLTimeoutException",
        "kind": 5,
        "location": {
            "uri": "jdt://contents/java.sql/java.sql/SQLTimeoutException.class?=jdt.ls-java-project/%5C/Users%5C/fbricon%5C/.sdkman%5C/candidates%5C/java%5C/18-open%5C/lib%5C/jrt-fs.jar%60java.sql=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/18%5C/docs%5C/api%5C/=/%3Cjava.sql(SQLTimeoutException.class",
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            }
        },
        "containerName": "java.sql"
    },
    {
        "name": "LoginException",
        "kind": 5,
        "location": {
            "uri": "jdt://contents/java.base/javax.security.auth.login/LoginException.class?=jdt.ls-java-project/%5C/Users%5C/fbricon%5C/.sdkman%5C/candidates%5C/java%5C/18-open%5C/lib%5C/jrt-fs.jar%60java.base=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/18%5C/docs%5C/api%5C/=/%3Cjavax.security.auth.login(LoginException.class",
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            }
        },
        "containerName": "javax.security.auth.login"
    },
    {
        "name": "PackagerException",
        "kind": 5,
        "location": {
            "uri": "jdt://contents/jdk.jpackage/jdk.jpackage.internal/PackagerException.class?=jdt.ls-java-project/%5C/Users%5C/fbricon%5C/.sdkman%5C/candidates%5C/java%5C/18-open%5C/lib%5C/jrt-fs.jar%60jdk.jpackage=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/18%5C/docs%5C/api%5C/=/%3Cjdk.jpackage.internal(PackagerException.class",
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            }
        },
        "containerName": "jdk.jpackage.internal"
    },
    {
        "name": "AttachOperationFailedException",
        "kind": 5,
        "location": {
            "uri": "jdt://contents/jdk.attach/com.sun.tools.attach/AttachOperationFailedException.class?=jdt.ls-java-project/%5C/Users%5C/fbricon%5C/.sdkman%5C/candidates%5C/java%5C/18-open%5C/lib%5C/jrt-fs.jar%60jdk.attach=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/18%5C/docs%5C/api%5C/=/%3Ccom.sun.tools.attach(AttachOperationFailedException.class",
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            }
        },
        "containerName": "com.sun.tools.attach"
    },

... skipped for brevity
@Tyriar Tyriar assigned jrieken and unassigned Tyriar May 10, 2022
@jrieken jrieken added bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) editor-symbols definitions, declarations, references labels May 11, 2022
@jrieken
Copy link
Member

jrieken commented May 11, 2022

This is a duplicate. Unfortunately, I don't recall the exact issue number nor its title 😳 Anyways, searching for issues with the same labels will likely help you 👉
https://github.com/microsoft/vscode/issues?utf8=✓&q=is%3Aopen+label%3Abug+label%3Aeditor-symbols

@raulvaldoleiros
Copy link

Hi @jrieken , the duplicated is this one #148833?

@fbricon
Copy link
Contributor Author

fbricon commented May 11, 2022

@raulvaldoleiros @jrieken I checked with the lastest vscode insiders build, assuming the fix for #148833 is included, it doesn't fix the issue when the query contains *

@fbricon
Copy link
Contributor Author

fbricon commented May 11, 2022

@jrieken were you referring to #98125 maybe?

@jrieken
Copy link
Member

jrieken commented May 11, 2022

No, I meant #148833 because that's the only regression in this area that we are aware of. I only now I see that apparently was working three years ago... Tho, #98125 sounds like a cool duplicate too.

@jrieken jrieken added quick-pick Quick-pick widget issues quick-open Quick-open issues (search, commands) and removed bug Issue identified by VS Code Team member as probable bug labels May 11, 2022
@Eskibear
Copy link
Member

#98215 is related but not the same topic. The similar use case in Java is to search types with "full qualified name". E.g. input a.b.c.MyString, and show item {name: "MyString", containerName: "a.b.c"} in quick-pick.

Back to this wildcard search problem with *. It's about inputing *String, and show the above item. Quick-pick used to skip "*" when filtering the results.

@fbricon I did a bisect test on old versions of vscode, finding it was working in v1.43.0, and not working since v1.44.0.

@jrieken Is that because fuzzy matcher no longer skips * since v1.44.0?

Attaching videos of the comparison, where the response of workspace/symbol should be the same.

SymbolSearch-1.43.0.mp4
SymbolSearch-1.44.0.mp4

@jrieken
Copy link
Member

jrieken commented May 19, 2022

@jrieken Is that because fuzzy matcher no longer skips * since v1.44.0?

Sorry, that's a really long time ago (~2yrs) and I don't really remember. Fuzzy score would always use every character but it might be that we have consolidated different algorithms during that time. Tho, in our defence it was always written that query character best all match: "A good rule of thumb is to match case-insensitive and to simply check that the..."

@Eskibear
Copy link
Member

Got it. AFAIK currently without * ahead, Java LS only returns symbols whose name starts with the query characters (probably for performance or accuracy concern, but i'm not sure).

Anyway let's get back to this use case.
The quickest solution to me might be skipping * as before if we can locate the "regression" point related to the behavior change. Do you have any concern if we go towards that direction, @jrieken ? Or do you think Java LS should always return fuzzy matching results? Will vscode's fuzzy score filter and rank the items, making sure most relavent items are on the top?

And @fbricon do you have any comment or any concern if we change the behavior of Java LS?

@jrieken
Copy link
Member

jrieken commented May 19, 2022

, @jrieken ? Or do you think Java LS should always return fuzzy matching results? Will vscode's fuzzy score filter and rank the items, making sure most relavent items are on the top?

"Yes" to both. A really simple and very fast way to do filtering is to ensure that all query characters appear in their order in the symbol name (ignoring casing). Like edt for editor, foolessditch, or textedit. The runtime for that is the min number of characters in the respective words. This is more or less our implementation

export function isPatternInWord(patternLow: string, patternPos: number, patternLen: number, wordLow: string, wordPos: number, wordLen: number, fillMinWordPosArr = false): boolean {
	while (patternPos < patternLen && wordPos < wordLen) {
		if (patternLow[patternPos] === wordLow[wordPos]) {
			patternPos += 1;
		}
		wordPos += 1;
	}
	return patternPos === patternLen; // pattern must be exhausted
}

When results are shown inside VS Code we use the same(*) filter logic but sort by "match rank", e.g Editor for edt is ranked higher than SomeDownVote

@tommai78101
Copy link

tommai78101 commented May 28, 2022

@jrieken May I ask what is the current status of this issue? Is this a duplicate issue, or is this a regression issue (and thus should be reopened, since it is tagged with the flairs, quick-pick and quick-open)?

It's kind of hard to keep track of this issue, especially when it's difficult to locate the original issue you mentioned about it 17 days ago. If we still couldn't find the original issue, may I recommend just not mark it as a duplicate, and just say it's a regression issue? We do have footage from Eskibear showing the regression between v1.43.0 and v1.44.0.

@raulvaldoleiros
Copy link

@jrieken can you accept the recommendation of @tommai78101 ? I still have the issue using vscode java and it really has a huge impact on my performance, eventually I will move to intellij if this keeps this way :(

@raulvaldoleiros
Copy link

Any updates on this?

@github-actions github-actions bot locked and limited conversation to collaborators Jun 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) editor-symbols definitions, declarations, references quick-open Quick-open issues (search, commands) quick-pick Quick-pick widget issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@fbricon @jrieken @Tyriar @Eskibear @tommai78101 @raulvaldoleiros and others