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
COMP: Show the trait of an method #1213
Conversation
@@ -17,6 +17,11 @@ object CompletionEngine { | |||
const val KEYWORD_PRIORITY = 10.0 | |||
} | |||
|
|||
fun RsFunction.generateAppendTailText(): String { |
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.
This can be private
.
15799cf
to
7589d94
Compare
@@ -35,6 +40,7 @@ fun RsCompositeElement.createLookupElement(scopeName: String): LookupElement { | |||
is RsFunction -> base | |||
.withTypeText(retType?.typeReference?.text ?: "()") | |||
.withTailText(valueParameterList?.text?.replace("\\s+".toRegex(), " ") ?: "()") | |||
.appendTailText(generateAppendTailText(), false) |
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.
Don't you think it'll look better with grayed = true
? Won't distract from the function signature so much.
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.
Look better
private fun RsFunction.generateAppendTailText(): String { | ||
val trait = parentOfType<RsImplItem>()?.traitRef?.text ?: return "" | ||
return " by $trait" | ||
} |
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.
It looks more like a property. Could also be more compact:
private val RsFunction.extraTailText: String
get() = parentOfType<RsImplItem>()?.traitRef?.text?.let { " of $it" } ?: ""
7589d94
to
19afb98
Compare
Thanks! |
bors r+ |
Build succeeded |
Fixes #1190