Skip to content

Commit

Permalink
Merge pull request #194 from pontem-network/fq-completion
Browse files Browse the repository at this point in the history
fully qualified path completion tests
  • Loading branch information
mkurnikov authored Oct 1, 2024
2 parents 8bfb9b4 + c8061bf commit c4828b6
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ version = pluginVersion
plugins {
id("java")
kotlin("jvm") version "2.0.20"
id("org.jetbrains.intellij.platform") version "2.0.1"
id("org.jetbrains.intellij.platform") version "2.1.0"
id("org.jetbrains.grammarkit") version "2022.3.2.2"
id("net.saliman.properties") version "1.5.2"
id("org.gradle.idea")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ fun applySharedCompletionFilters(
): RsResolveProcessor {
var processor = processor0
processor = filterPathVariantsByUseGroupContext(resolutionCtx, processor)
if (MODULE in ns) {
processor = removeCurrentModuleItem(resolutionCtx, processor)
}
// if (MODULE in ns) {
// processor = removeCurrentModuleItem(resolutionCtx, processor)
// }
return processor
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,12 @@ class HighlightingAnnotatorTest: AnnotatorTestCase(HighlightingAnnotator::class)
"""
)

fun `test enum highlighting`() = checkHighlighting("""
module 0x1::m {
<KEYWORD>enum</KEYWORD> <ENUM>S</ENUM> { One, Two(u8) }
}
""")

// fun `test resource access control keywords highlighting`() = checkHighlighting(
// """
// module 0x1::m {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,15 @@ class ModulesCompletionTest: CompletionTestCase() {
"""
)

fun `test module name itself should not be present in completion`() = checkNoCompletion(
"""
module 0x1::Main {
fun call() {
Ma/*caret*/
}
}
"""
)
// fun `test module name itself should not be present in completion`() = checkNoCompletion(
// """
// module 0x1::Main {
// fun call() {
// Ma/*caret*/
// }
// }
// """
// )

fun `test test_only modules not present in non test_only scopes`() = checkNoCompletion(
"""
Expand Down Expand Up @@ -272,4 +272,18 @@ class ModulesCompletionTest: CompletionTestCase() {
}
}
""")

fun `test current module completion for the fq address`() = doSingleCompletion("""
module 0x1::main {
fun main() {
0x1::m/*caret*/
}
}
""", """
module 0x1::main {
fun main() {
0x1::main/*caret*/
}
}
""")
}
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,20 @@ class StructsCompletionTest: CompletionTestCase() {
}
}
""")

fun `test fq enum completion`() = doSingleCompletion("""
module 0x1::m {
enum Color { Red, Blue }
fun main() {
let s: 0x1::m::Col/*caret*/
}
}
""", """
module 0x1::m {
enum Color { Red, Blue }
fun main() {
let s: 0x1::m::Color/*caret*/
}
}
""")
}

0 comments on commit c4828b6

Please sign in to comment.