Skip to content

Commit

Permalink
add current module to fq completiom
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurnikov committed Sep 30, 2024
1 parent 4be28f1 commit 0471c3d
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 12 deletions.
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 @@ -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,36 @@ class StructsCompletionTest: CompletionTestCase() {
}
}
""")

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

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

0 comments on commit 0471c3d

Please sign in to comment.