Skip to content

Commit 1377f0d

Browse files
committed
Include the extract operator within help topic node
1 parent 5ee0c69 commit 1377f0d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/ark/src/lsp/help_topic.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ fn locate_help_node(tree: &Tree, point: Point) -> Option<Node> {
8989
// Even if they are at `p<>kg::fun`, we assume they really want docs for `fun`.
9090
let node = match node.parent() {
9191
Some(parent) if matches!(parent.node_type(), NodeType::NamespaceOperator(_)) => parent,
92+
Some(parent) if matches!(parent.node_type(), NodeType::ExtractOperator(_)) => parent,
9293
Some(_) => node,
9394
None => node,
9495
};
@@ -138,5 +139,12 @@ mod tests {
138139
let node = locate_help_node(&tree, point).unwrap();
139140
let text = node.utf8_text(text.as_bytes()).unwrap();
140141
assert_eq!(text, "dplyr:::across");
142+
143+
// R6 methods, or reticulate accessors
144+
let (text, point) = point_from_cursor("tf$a@bs(x)");
145+
let tree = parser.parse(text.as_str(), None).unwrap();
146+
let node = locate_help_node(&tree, point).unwrap();
147+
let text = node.utf8_text(text.as_bytes()).unwrap();
148+
assert_eq!(text, "tf$abs");
141149
}
142150
}

0 commit comments

Comments
 (0)