Skip to content

Commit 63c4dce

Browse files
authored
fix(python):fix class/function with decorator (#782)
If in the same file you have both class/function with decorator and without it then move/select won't work for class/function without decorator. I found this bug in the `main` branch, so maybe main problem not in the query, but this fix works.
1 parent 6f2dc7e commit 63c4dce

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

queries/python/textobjects.scm

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
((decorated_definition)?
2-
(function_definition
3-
body: (block)? @function.inner)) @function.outer
1+
(decorated_definition
2+
(function_definition)) @function.outer
43

5-
((decorated_definition)?
6-
(class_definition
7-
body: (block)? @class.inner)) @class.outer
4+
(function_definition
5+
body: (block)? @function.inner) @function.outer
6+
7+
(decorated_definition
8+
(class_definition)) @class.outer
9+
10+
(class_definition
11+
body: (block)? @class.inner) @class.outer
812

913
(while_statement
1014
body: (block)? @loop.inner) @loop.outer

0 commit comments

Comments
 (0)