Skip to content

Commit 81220eb

Browse files
committed
queries: simplification
1 parent 3fce85a commit 81220eb

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

src/cedarscript_editor/tree_sitter_identifier_queries.py

+1-25
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
.
3737
(expression_statement
3838
(string) @{type}.docstring)?
39-
.
40-
) @{type}.body
39+
) @{type}.body
4140
"""
4241

4342
_definition_base_template = """
@@ -63,29 +62,6 @@
6362
{common_body}
6463
) @function.definition
6564
)
66-
67-
; Methods in Classes
68-
(class_definition
69-
body: (block
70-
(function_definition
71-
{definition_base}
72-
{common_body}
73-
) @function.definition
74-
)
75-
)
76-
77-
; Decorated Methods in Classes
78-
(class_definition
79-
body: (block
80-
(decorated_definition
81-
(decorator)+ @function.decorator
82-
(function_definition
83-
{definition_base}
84-
{common_body}
85-
) @function.definition
86-
)
87-
)
88-
)
8965
""".format(
9066
definition_base=_definition_base_template.format(type="function"),
9167
common_body=_common_template.format(type="function")

src/text_manipulation/range_spec.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def start_line(self) -> int:
366366
@property
367367
def body_start_line(self) -> int:
368368
"""Return the 1-indexed start line of the identifier's body."""
369-
return self.body.start + 1
369+
return self.body.start + 1 if self.body else None
370370

371371
@property
372372
def end_line(self) -> int:

0 commit comments

Comments
 (0)