Skip to content

Commit 109f91e

Browse files
committed
Check visibility in index completions
1 parent 92b791e commit 109f91e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ private fun indexCompletionItems(parsedFile: KtFile, index: SymbolIndex, partial
8989
.asSequence()
9090
.filter { it.kind != Symbol.Kind.MODULE } // Ignore global module/package name completions for now, since they cannot be 'imported'
9191
.filter { it.fqName.shortName() !in importedNames }
92+
.filter {
93+
// TODO: Visibility checker should be less liberal
94+
it.visibility == Symbol.Visibility.PUBLIC
95+
|| it.visibility == Symbol.Visibility.PROTECTED
96+
|| it.visibility == Symbol.Visibility.INTERNAL
97+
}
9298
.map { CompletionItem().apply {
9399
label = it.fqName.shortName().toString()
94100
kind = when (it.kind) {

0 commit comments

Comments
 (0)