Skip to content

Don't merge code completion items having the same name. #12029

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

Merged
merged 1 commit into from
Apr 9, 2021

Conversation

prolativ
Copy link
Contributor

@prolativ prolativ commented Apr 8, 2021

Don't merge code completion items having the same name.
Also fix completion of references to primary constructor parameters.

Fixes #11313
Fixes #12018

/cc @tgodzik @dos65 @alexarchambault

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM fro my side!

Copy link
Contributor

@dos65 dos65 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM!

Comment on lines 134 to 135
* If several denotations share the same name, the type denotations appear before term denotations inside
* the same `Completion`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this part of the comment should be deleted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the comment instead for clarity

Also fix completion of references to primary constructor parameters
@prolativ prolativ force-pushed the dont-merge-completion-items branch from 0cf4732 to 3ff472f Compare April 8, 2021 12:43
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

.completion(m1, Set(("HashMap", Class, "java.util.HashMap"),
("HashMap", Module, "java.util.HashMap$"),
("HashMap2", Class, "java.util.HashMap"),
("HashMap2", Module, "java.util.HashMap$")))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be an orthogonal issue: for a module, it is more friendly to show java.util.HashMap instead of java.util.HashMap$.

It can be addressed in a different PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but that's because of how .show works by default. An even more enigmatic example is

code"class Foo { val foo: Runn${m1} }".withSource
      .completion(m1, Set(
        ("Runnable", Class, "java.lang.Runnable"),
        ("Runnable", Module, "Runnable$")
      ))

but that's definitely a separate issue

Copy link
Contributor

@alexarchambault alexarchambault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍, AFAIC.

@prolativ prolativ merged commit 0a83d2c into scala:master Apr 9, 2021
@prolativ prolativ deleted the dont-merge-completion-items branch April 9, 2021 08:19
@Kordyjan Kordyjan added this to the 3.0.1 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Completions doesn't return class member inside non-empty method body Representation of code completion suggestions
6 participants