Skip to content

Commit c1e3c48

Browse files
committed
Showing function name and now also list of parameters as provided to us in completion list
1 parent e106e02 commit c1e3c48

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,13 @@ fun completions(file: CompiledFile, cursor: Int): CompletionList {
4848
}
4949

5050
private val callPattern = Regex("(.*)\\((\\$\\d+)?\\)")
51+
private val methodSignature = Regex("""(?:fun|constructor) (?:<(?:[a-zA-Z\?\!\: ]+)(?:, [A-Z])*> )?([a-zA-Z]+\(.*\))""")
5152

5253
private fun completionItem(d: DeclarationDescriptor, surroundingElement: KtElement, file: CompiledFile): CompletionItem {
5354
val result = d.accept(RenderCompletionItem(), null)
5455

56+
result.label = methodSignature.find(result.detail)?.groupValues?.get(1) ?: result.label
57+
5558
if (isGetter(d) || isSetter(d)) {
5659
val name = extractVarName(d)
5760

0 commit comments

Comments
 (0)