Improve plugin symbol accuracy in completion and docs

This commit is contained in:
sergeych committed 2026-02-15 11:05:57 +03:00
1 parent 3f2c38c471
commit b233d4c15f
7 files changed
+212 -34

No files matched your search

@@ -225,6 +225,21 @@ class MiniAstTest {
assertTrue(names.contains("V2"), "Should contain V2")
}
@Test
fun complete_static_members_only() = runTest {
val code = """
class C {
static fun s() {}
fun i() {}
}
C.<caret>
"""
val items = CompletionEngineLight.completeAtMarkerSuspend(code)
val names = items.map { it.name }.toSet()
assertTrue(names.contains("s"), "Should contain static member")
assertTrue(!names.contains("i"), "Should not contain instance member")
}
@Test
fun miniAst_captures_extern_docs() = runTest {
val code = """
@@ -84,6 +84,23 @@ class LyngLanguageToolsTest {
assertEquals("Box docs", doc.doc?.summary)
}
@Test
fun languageTools_completion_includes_local_types() = runTest {
val code = """
fun f() {
val local: String = "x"
<caret>
}
""".trimIndent()
val caret = code.indexOf("<caret>")
val text = code.replace("<caret>", "")
val res = LyngLanguageTools.analyze(text, "locals.lyng")
val items = LyngLanguageTools.completions(text, caret, res)
val local = items.firstOrNull { it.name == "local" }
assertNotNull(local, "Completion should include local")
assertTrue(local.typeText?.contains("String") == true, "Expected type for local, got ${local.typeText}")
}
@Test
fun languageTools_definition_and_usages() = runTest {
val code = """