Skip to content

Commit 3fa4e46

Browse files
committed
⬆️ Upgrade lsp-tree-sitter
1 parent 508c2aa commit 3fa4e46

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env -S pip install -r
22

3-
lsp-tree-sitter >= 0.0.16
3+
lsp-tree-sitter >= 0.1.0
44
pygls >= 2.0.0
55
tree-sitter-make

src/make_language_server/finders.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class InvalidPathFinder(QueryFinder):
2323

2424
def __init__(
2525
self,
26-
message: str = "{{uni.get_text()}}: no such file",
26+
message: str = "{{uni.text}}: no such file",
2727
severity: DiagnosticSeverity = DiagnosticSeverity.Error,
2828
) -> None:
2929
r"""Init.
@@ -52,17 +52,15 @@ def capture2uni(
5252
"""
5353
uni = UNI(uri, nodes[0])
5454
return (
55-
uni
56-
if label == "path" and not os.path.isfile(uni.get_path())
57-
else None
55+
uni if label == "path" and not os.path.isfile(uni.path) else None
5856
)
5957

6058

6159
@dataclass
6260
class RepeatedTargetFinder(RepeatedFinder):
6361
r"""Repeatedtargetfinder."""
6462

65-
message: str = "{{uni.get_text()}}: is repeated on {{_uni}}"
63+
message: str = "{{uni.text}}: is repeated on {{_uni}}"
6664
severity: DiagnosticSeverity = DiagnosticSeverity.Warning
6765

6866
def __post_init__(self) -> None:
@@ -99,7 +97,7 @@ def filter(self, uni: UNI) -> bool:
9997
:rtype: bool
10098
"""
10199
if parent := uni.node.parent:
102-
text = uni.get_text()
100+
text = uni.text
103101
return (
104102
uni.node.type == "word"
105103
and parent.type == "targets"
@@ -153,7 +151,7 @@ def is_function_define(self, uni: UNI) -> bool:
153151
return False
154152
return (
155153
parent.type == "define_directive"
156-
and uni.get_text() == self.name
154+
and uni.text == self.name
157155
and node == parent.children[1]
158156
)
159157

@@ -170,7 +168,7 @@ def is_variable_define(self, uni: UNI) -> bool:
170168
return False
171169
return (
172170
parent.type == "variable_assignment"
173-
and uni.get_text() == self.name
171+
and uni.text == self.name
174172
and node == parent.children[0]
175173
)
176174

@@ -185,7 +183,7 @@ def is_target_define(self, uni: UNI) -> bool:
185183
parent = node.parent
186184
if parent is None:
187185
return False
188-
return parent.type == "targets" and uni.get_text() == self.name
186+
return parent.type == "targets" and uni.text == self.name
189187

190188
def __call__(self, uni: UNI) -> bool:
191189
r"""Call.
@@ -271,7 +269,7 @@ def is_variable_reference(self, uni: UNI) -> bool:
271269
if parent is None:
272270
return False
273271
return (
274-
uni.get_text() == self.name
272+
uni.text == self.name
275273
and node.type == "word"
276274
and (
277275
parent.type == "variable_reference"
@@ -292,7 +290,7 @@ def is_target_reference(self, uni: UNI) -> bool:
292290
parent = node.parent
293291
if parent is None:
294292
return False
295-
return parent.type == "targets" and uni.get_text() == self.name
293+
return parent.type == "targets" and uni.text == self.name
296294

297295
def __call__(self, uni: UNI) -> bool:
298296
r"""Call.

src/make_language_server/server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def definition(params: TextDocumentPositionParams) -> list[Location]:
9595
if uni is None:
9696
return []
9797
return [
98-
uni.get_location()
98+
uni.location
9999
for uni in DefinitionFinder(uni.node).find_all(
100100
document.uri, self.trees[document.uri]
101101
)
@@ -118,7 +118,7 @@ def references(params: TextDocumentPositionParams) -> list[Location]:
118118
if uni is None:
119119
return []
120120
return [
121-
uni.get_location()
121+
uni.location
122122
for uni in ReferenceFinder(uni.node).find_all(
123123
document.uri, self.trees[document.uri]
124124
)
@@ -140,8 +140,8 @@ def hover(params: TextDocumentPositionParams) -> Hover | None:
140140
)
141141
if uni is None:
142142
return None
143-
text = uni.get_text()
144-
_range = uni.get_range()
143+
text = uni.text
144+
_range = uni.range
145145
parent = uni.node.parent
146146
if parent is None:
147147
return None

0 commit comments

Comments
 (0)