Skip to content

Commit 8b6631d

Browse files
committed
Ignore global module completions for now
1 parent 52f9b5d commit 8b6631d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ fun completions(file: CompiledFile, cursor: Int, index: SymbolIndex, config: Com
8181
/** Finds completions in the global symbol index, for potentially unimported symbols. */
8282
private fun indexCompletionItems(parsedFile: KtFile, index: SymbolIndex, partial: String): Sequence<CompletionItem> = index
8383
.query(partial, limit = MAX_COMPLETION_ITEMS)
84+
.asSequence()
85+
.filter { it.kind != Symbol.Kind.MODULE } // Ignore global module/package name completions for now, since they cannot be 'imported'
8486
.map { CompletionItem().apply {
8587
label = it.fqName.shortName().toString()
8688
kind = when (it.kind) {
@@ -98,7 +100,6 @@ private fun indexCompletionItems(parsedFile: KtFile, index: SymbolIndex, partial
98100
val pos = findImportInsertionPosition(parsedFile, it.fqName)
99101
additionalTextEdits = listOf(TextEdit(Range(pos, pos), "\nimport ${it.fqName}")) // TODO: CRLF?
100102
} }
101-
.asSequence()
102103

103104
/** Finds a good insertion position for a new import of the given fully-qualified name. */
104105
private fun findImportInsertionPosition(parsedFile: KtFile, fqName: FqName): Position =

0 commit comments

Comments
 (0)