Use of substringBefore/After
This commit is contained in:
@@ -286,8 +286,7 @@ class BasicCompletionSession(configuration: CompletionSessionConfiguration,
|
||||
addReferenceVariants(kindFilter, runtimeReceiverType = false)
|
||||
}
|
||||
|
||||
val ampIndex = prefix.indexOf("@")
|
||||
val keywordsPrefix = if (ampIndex < 0) prefix else prefix.substring(0, ampIndex) // if there is '@' in the prefix - use shorter prefix to not loose 'this' etc
|
||||
val keywordsPrefix = prefix.substringBefore('@') // if there is '@' in the prefix - use shorter prefix to not loose 'this' etc
|
||||
KeywordCompletion.complete(expression ?: parameters.getPosition(), keywordsPrefix) { lookupElement ->
|
||||
val keyword = lookupElement.getLookupString()
|
||||
when (keyword) {
|
||||
|
||||
@@ -110,8 +110,7 @@ public class LookupElementFactory(
|
||||
}
|
||||
|
||||
val qualifiedName = psiClass.getQualifiedName()!!
|
||||
val dotIndex = qualifiedName.lastIndexOf('.')
|
||||
val packageName = if (dotIndex <= 0) "<root>" else qualifiedName.substring(0, dotIndex)
|
||||
val packageName = qualifiedName.substringBeforeLast('.', "<root>")
|
||||
element = element.appendTailText(" ($packageName)", true)
|
||||
|
||||
if (psiClass.isDeprecated()) {
|
||||
|
||||
Reference in New Issue
Block a user