Skip to content

Commit f0f9c36

Browse files
committed
Comments
1 parent 30a29e2 commit f0f9c36

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/nodeMatchers.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ export function possiblyWrappedNode(
143143
): NodeMatcher {
144144
return (editor: TextEditor, node: SyntaxNode) => {
145145
if (isWrapperNode(node.parent!)) {
146+
// We don't want to return the target node if it is wrapped. We return
147+
// null, knowing that the ancestor walk will call us again with the
148+
// wrapper node
146149
return null;
147150
}
148151

@@ -155,9 +158,11 @@ export function possiblyWrappedNode(
155158
}
156159

157160
/**
158-
* Create a new matcher by cascading the given matchers
159-
* @param matchers A list of matchers to try in sequence until one doesn't return null
160-
* @returns A NodeMatcher that tries the given matters in sequence
161+
* Create a new matcher that will try the given matchers in sequence until one
162+
* returns non-null
163+
* @param matchers A list of matchers to try in sequence until one doesn't
164+
* return null
165+
* @returns A NodeMatcher that tries the given matchers in sequence
161166
*/
162167
export function cascadingMatcher(...matchers: NodeMatcher[]): NodeMatcher {
163168
return (editor: TextEditor, node: SyntaxNode) => {

0 commit comments

Comments
 (0)