Skip to content

Commit

Permalink
bugfix: Extension method completion with name conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
jkciesluk committed Dec 5, 2023
1 parent 1870e89 commit f4fdc6a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ class CompletionProvider(
mkItem(
"{" + sym.fullNameBackticked + completionTextSuffix + "}"
)
case _ if v.completionItemKind == CompletionItemKind.Method =>
mkItem(
ident.backticked(backtickSoftKeyword) + completionTextSuffix
)
case _ =>
mkItem(
sym.fullNameBackticked(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,36 @@ class CompletionExtensionMethodSuite extends BaseCompletionSuite {
|""".stripMargin
)

checkEdit(
"name-conflict",
"""|package example
|
|import example.enrichments.*
|
|object enrichments:
| extension (num: Int)
| def plus(other: Int): Int = num + other
|
|def main = {
| val plus = 100.plus(19)
| val y = 19.pl@@
|}
|""".stripMargin,
"""|package example
|
|import example.enrichments.*
|
|object enrichments:
| extension (num: Int)
| def plus(other: Int): Int = num + other
|
|def main = {
| val plus = 100.plus(19)
| val y = 19.plus($0)
|}
|""".stripMargin
)

// NOTE: In 3.1.3, package object name includes the whole path to file
// eg. in 3.2.2 we get `A$package`, but in 3.1.3 `/some/path/to/file/A$package`
check(
Expand Down

0 comments on commit f4fdc6a

Please sign in to comment.