Skip to content

Commit 7f96aae

Browse files
committed
Support S4 exports
1 parent 72ed267 commit 7f96aae

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

crates/ark/src/lsp/inputs/package_namespace.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@ impl Namespace {
3636
let root_node = tree.root_node();
3737

3838
// TODO: `import(foo, except = c(bar, baz))`
39+
//
40+
// Regarding `exportMethods`, see WRE: "Note that exporting methods on a
41+
// generic in the namespace will also export the generic"
3942
static NAMESPACE_QUERY: LazyLock<Query> = LazyLock::new(|| {
4043
let query_str = r#"
4144
(call
4245
function: (identifier) @fn_name
4346
arguments: (arguments (argument value: (identifier) @exported))
44-
(#eq? @fn_name "export")
47+
(#match? @fn_name "^(export|exportClasses|exportMethods)$")
4548
)
4649
(call
4750
function: (identifier) @fn_name
@@ -175,4 +178,15 @@ mod tests {
175178
assert_eq!(parsed.package_imports, vec!["bar", "foo"]);
176179
assert_eq!(parsed.exports, vec!["baz", "qux"]);
177180
}
181+
182+
#[test]
183+
fn parses_s4_exports() {
184+
let ns = r#"
185+
exportClasses(foo)
186+
exportClasses(bar, baz)
187+
exportMethods(qux)
188+
"#;
189+
let parsed = Namespace::parse(ns).unwrap();
190+
assert_eq!(parsed.exports, vec!["bar", "baz", "foo", "qux"]);
191+
}
178192
}

0 commit comments

Comments
 (0)