mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[lsp] use completion from https://github.com/darthorimar/rekot for now until we have a proper document commit
GitOrigin-RevId: 83b1f74d7b907a1670e6d4e8ce309e076f90aaa9
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ccaaa440ae
commit
fde19b5fb7
+30
@@ -306,6 +306,36 @@ class KtSymbolFromIndexProvider(
|
||||
resolveExtensionScopeWithTopLevelDeclarations.callables(nameFilter)
|
||||
.filterNot { it.isExtension }
|
||||
|
||||
/**
|
||||
* Returns top-level callables, including extensions.
|
||||
*/
|
||||
context(KaSession)
|
||||
@OptIn(KaExperimentalApi::class)
|
||||
fun getTopLevelCallableSymbolsByNameFilterIncludingExtensions(
|
||||
nameFilter: (Name) -> Boolean,
|
||||
scope: GlobalSearchScope = analysisScope,
|
||||
psiFilter: (KtCallableDeclaration) -> Boolean = { true }
|
||||
): Sequence<KaCallableSymbol> = sequenceOf(
|
||||
KotlinTopLevelFunctionFqnNameIndex,
|
||||
KotlinTopLevelPropertyFqnNameIndex,
|
||||
).flatMap { helper ->
|
||||
val results = mutableListOf<KtCallableDeclaration>()
|
||||
val processor = cancelableCollectFilterProcessor(results) { declaration: KtCallableDeclaration ->
|
||||
declaration.isAcceptable(psiFilter)
|
||||
}
|
||||
|
||||
helper.processAllElements(
|
||||
project = project,
|
||||
scope = scope,
|
||||
filter = { nameFilter(getShortName(it)) },
|
||||
processor = processor,
|
||||
)
|
||||
|
||||
results
|
||||
}.map { it.symbol }
|
||||
.filterIsInstance<KaCallableSymbol>() +
|
||||
resolveExtensionScopeWithTopLevelDeclarations.callables(nameFilter)
|
||||
|
||||
context(KaSession)
|
||||
@OptIn(KaExperimentalApi::class)
|
||||
fun getExtensionCallableSymbolsByName(
|
||||
|
||||
+11
-2
@@ -3,6 +3,7 @@
|
||||
package org.jetbrains.kotlin.idea.completion.lookups
|
||||
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.kotlin.analysis.api.KaExperimentalApi
|
||||
import org.jetbrains.kotlin.analysis.api.KaSession
|
||||
import org.jetbrains.kotlin.analysis.api.signatures.KaCallableSignature
|
||||
@@ -18,14 +19,22 @@ import org.jetbrains.kotlin.idea.completion.lookups.CompletionShortNamesRenderer
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.renderer.render
|
||||
|
||||
internal object TailTextProvider {
|
||||
@ApiStatus.Internal
|
||||
object TailTextProvider {
|
||||
|
||||
context(KaSession)
|
||||
fun getTailText(
|
||||
signature: KaCallableSignature<*>,
|
||||
): String = buildString {
|
||||
): String {
|
||||
// use unsubstituted type when rendering receiver type of extension
|
||||
val symbol = signature.symbol
|
||||
return getTailText(symbol)
|
||||
}
|
||||
|
||||
context(KaSession)
|
||||
fun getTailText(
|
||||
symbol: KaCallableSymbol,
|
||||
): String = buildString {
|
||||
symbol.receiverType?.let { renderReceiverType(it) }
|
||||
|
||||
symbol.getContainerPresentation(isFunctionalVariableCall = false)?.let { append(it) }
|
||||
|
||||
Reference in New Issue
Block a user