-
Notifications
You must be signed in to change notification settings - Fork 337
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
bugfix: Extension method completion with name conflict #5913
Conversation
@@ -261,6 +261,10 @@ class CompletionProvider( | |||
mkItem( | |||
"{" + sym.fullNameBackticked + completionTextSuffix + "}" | |||
) | |||
case _ if v.completionItemKind == CompletionItemKind.Method => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that it never makes sense for methods to put the full name:
//> using scala 3.3.1
object O {
def mmm = 3
class Test {
val mmm = "aaaa"
val foo = mmm@@
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it seems that the issue is that we don't see the extension method in the scope and we don't shorten the name. Especially this doesn't make sense for extension methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it's just that this part of the code isn't used exclusively for extension methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that it never makes sense for methods to put the full name
Thanks, I missed this case would also be changed, I changed it so the change applies only to extension methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
object O { def mmm = 3 class Test { val mmm = "aaaa" val foo = mmm@@ } }
Actually there is a bug in this case in Scala 2 (compiler thinks that def mmm
is in scope), I will work on it in a follow-up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Let's add the change to the compiler also. |
When symbol with the same name as extension method was present in scope, completion edit would insert full symbol name of this method, which was incorrect.