Skip to content

Fuzzy search in completions is not working correctly #23151

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

Open
rochala opened this issue May 14, 2025 · 2 comments
Open

Fuzzy search in completions is not working correctly #23151

rochala opened this issue May 14, 2025 · 2 comments
Assignees
Labels
area:presentation-compiler Related to the presentation compiler module used by Metals and possibly other tools itype:bug Spree Suitable for a future Spree

Comments

@rochala
Copy link
Contributor

rochala commented May 14, 2025

Compiler version

3.7.0

Minimized code

object M:
  def scalaVersion(scalaVersion0: String): String =
    sa@@

Output

saferExceptions

Expectation

scalaVersion + scalaVersion0 as it does for e.g

object M:
  def scalaVersion(scalaVersion0: String): String =
    sl@@
@rochala rochala added itype:bug Spree Suitable for a future Spree area:presentation-compiler Related to the presentation compiler module used by Metals and possibly other tools labels May 14, 2025
@rochala rochala assigned rochala and unassigned rochala May 14, 2025
@rochala
Copy link
Contributor Author

rochala commented May 15, 2025

The problem is actually different. It is not working for both cases because we support fuzzy just for the member completions:

  lazy val fuzzyMatcher: Name => Boolean = name =>
    if completionMode.is(Mode.Member) then CompletionFuzzy.matchesSubCharacters(completionPos.query, name.toString)
    else CompletionFuzzy.matches(completionPos.query, name.toString)

I'd opt to change it to just

CompletionFuzzy.matchesSubCharacters(completionPos.query, name.toString)

It is also how other state of the art LSP servers handle such completions (e.g. sumneko lua)

@rochala
Copy link
Contributor Author

rochala commented May 15, 2025

It has been decided that we will proceed with this approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:presentation-compiler Related to the presentation compiler module used by Metals and possibly other tools itype:bug Spree Suitable for a future Spree
Projects
None yet
Development

No branches or pull requests

1 participant