Skip to content

Commit 0ded408

Browse files
committed
Mark deprecated items as deprecated in completion lists
1 parent 1bfe613 commit 0ded408

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
@@ -3,6 +3,7 @@ package org.javacs.kt.completion
33
import com.google.common.cache.CacheBuilder
44
import org.eclipse.lsp4j.CompletionItem
55
import org.eclipse.lsp4j.CompletionItemKind
6+
import org.eclipse.lsp4j.CompletionItemTag
67
import org.eclipse.lsp4j.CompletionList
78
import org.javacs.kt.CompiledFile
89
import org.javacs.kt.LOG
@@ -13,6 +14,7 @@ import org.javacs.kt.util.noResult
1314
import org.javacs.kt.util.stringDistance
1415
import org.javacs.kt.util.toPath
1516
import org.javacs.kt.util.onEachIndexed
17+
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
1618
import org.jetbrains.kotlin.container.get
1719
import org.jetbrains.kotlin.descriptors.*
1820
import org.jetbrains.kotlin.js.resolve.diagnostics.findPsi
@@ -109,6 +111,10 @@ private fun completionItem(d: DeclarationDescriptor, surroundingElement: KtEleme
109111
result.filterText = name
110112
}
111113

114+
if (KotlinBuiltIns.isDeprecated(d)) {
115+
result.tags = listOf(CompletionItemTag.Deprecated)
116+
}
117+
112118
val matchCall = callPattern.matchEntire(result.insertText)
113119
if (file.lineAfter(surroundingElement.endOffset).startsWith("(") && matchCall != null) {
114120
result.insertText = matchCall.groups[1]!!.value

0 commit comments

Comments
 (0)