Skip to content

Commit bcd620a

Browse files
committed
Use short names when checking index completions
1 parent 8fb9a9c commit bcd620a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/src/main/kotlin/org/javacs/kt/completion/Completions.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ fun completions(file: CompiledFile, cursor: Int, index: SymbolIndex, config: Com
7878

7979
/** Finds completions in the global symbol index, for potentially unimported symbols. */
8080
private fun indexCompletionItems(parsedFile: KtFile, index: SymbolIndex, partial: String): Sequence<CompletionItem> {
81-
val importedFqNames = parsedFile.importDirectives.mapNotNull { it.importedFqName }.toSet()
81+
val importedNames = parsedFile.importDirectives.mapNotNull { it.importedFqName?.shortName() }.toSet()
8282

8383
return index
8484
.query(partial, limit = MAX_COMPLETION_ITEMS)
8585
.asSequence()
8686
.filter { it.kind != Symbol.Kind.MODULE } // Ignore global module/package name completions for now, since they cannot be 'imported'
87-
.filter { it.fqName !in importedFqNames }
87+
.filter { it.fqName.shortName() !in importedNames }
8888
.map { CompletionItem().apply {
8989
label = it.fqName.shortName().toString()
9090
kind = when (it.kind) {

0 commit comments

Comments
 (0)