-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suggest wilcard import in completions
When in import mode, and there's no prefix or the prefix is `_`, and the qualifier has a stable type, add the wildcard import to the completion suggestion.
- Loading branch information
Showing
2 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,6 +181,10 @@ object Completion { | |
// Implicit conversions do not kick in when importing | ||
implicitConversionTargets(qual)(ctx.fresh.setExploreTyperState()) | ||
.foreach(addAccessibleMembers) | ||
} else if (qual.tpe.isStable && (prefix.isEmpty || prefix == nme.WILDCARD.toString)) { | ||
// In import mode, suggest the wildcard import if there's no prefix or it is `_`. | ||
val wildcard = ctx.newCompletePackageSymbol(qual.symbol, nme.WILDCARD) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
smarter
Member
|
||
completions.enter(wildcard) | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'd rather not create fake symbols, can we move this check at the end and just add a string to the completion list ?