File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,9 @@ export function possiblyWrappedNode(
143
143
) : NodeMatcher {
144
144
return ( editor : TextEditor , node : SyntaxNode ) => {
145
145
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
146
149
return null ;
147
150
}
148
151
@@ -155,9 +158,11 @@ export function possiblyWrappedNode(
155
158
}
156
159
157
160
/**
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
161
166
*/
162
167
export function cascadingMatcher ( ...matchers : NodeMatcher [ ] ) : NodeMatcher {
163
168
return ( editor : TextEditor , node : SyntaxNode ) => {
You can’t perform that action at this time.
0 commit comments