Skip to content

Commit bcae968

Browse files
committed
⬆️ Upgrade lsp-tree-sitter
1 parent 73e81bf commit bcae968

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://python-jsonschema.readthedocs.io/en/stable/validate/#validating-formats
44
# validate hostname
55
fqdn
6-
lsp-tree-sitter >= 0.0.16
6+
lsp-tree-sitter >= 0.1.0
77
# ~/.config/pacman/template.md.j2
88
platformdirs
99
pygls >= 2.0.0

src/termux_language_server/finders.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class UnsortedKeywordFinder(UnFixedOrderFinder):
5050
def __init__(
5151
self,
5252
filetype: FILETYPE,
53-
message: str = "{{uni.get_text()}}: is unsorted due to {{_uni}}",
53+
message: str = "{{uni.text}}: is unsorted due to {{_uni}}",
5454
severity: DiagnosticSeverity = DiagnosticSeverity.Warning,
5555
) -> None:
5656
r"""Init.
@@ -154,7 +154,7 @@ def filter(self, uni: UNI) -> bool:
154154
:type uni: UNI
155155
:rtype: bool
156156
"""
157-
text = uni.get_text()
157+
text = uni.text
158158
return (
159159
text in self.order
160160
and text in self.keywords
@@ -194,7 +194,7 @@ class UnsortedCSVFinder(Finder):
194194
def __init__(
195195
self,
196196
filetype: FILETYPE,
197-
message: str = "{{uni.get_text()}}: unsorted",
197+
message: str = "{{uni.text}}: unsorted",
198198
severity: DiagnosticSeverity = DiagnosticSeverity.Warning,
199199
) -> None:
200200
r"""Init.
@@ -231,7 +231,7 @@ def __call__(self, uni: UNI) -> bool:
231231
:type uni: UNI
232232
:rtype: bool
233233
"""
234-
return self.is_csv(uni) and self.sort(uni.get_text()) != uni.get_text()
234+
return self.is_csv(uni) and self.sort(uni.text) != uni.text
235235

236236
def is_csv(self, uni: UNI) -> bool:
237237
r"""Is csv.
@@ -277,7 +277,7 @@ def get_text_edits(self, uri: str, tree: Tree) -> list[TextEdit]:
277277
:rtype: list[TextEdit]
278278
"""
279279
text_edits = [
280-
TextEdit(uni.get_range(), self.sort(uni.get_text()))
280+
TextEdit(uni.range, self.sort(uni.text))
281281
for uni in self.find_all(uri, tree)
282282
]
283283
return text_edits
@@ -319,7 +319,7 @@ def get_document_links(
319319
links = []
320320
for uni in self.find_all(uri, tree):
321321
start = list(uni.node.start_point)
322-
text = uni.get_text()
322+
text = uni.text
323323
if text.startswith('"'):
324324
text = text.strip('"')
325325
start[1] += 1
@@ -346,7 +346,7 @@ class PackageFinder(QueryFinder):
346346

347347
def __init__(
348348
self,
349-
message: str = "{{uni.get_text()}}: no such file",
349+
message: str = "{{uni.text}}: no such file",
350350
severity: DiagnosticSeverity = DiagnosticSeverity.Error,
351351
) -> None:
352352
r"""Init.
@@ -380,7 +380,7 @@ class MinGWFinder(QueryFinder):
380380

381381
def __init__(
382382
self,
383-
message: str = "{{uni.get_text()}}: no such file",
383+
message: str = "{{uni.text}}: no such file",
384384
severity: DiagnosticSeverity = DiagnosticSeverity.Error,
385385
) -> None:
386386
r"""Init.

src/termux_language_server/server.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ def document_link(params: DocumentLinkParams) -> list[DocumentLink]:
145145
)
146146
> 0
147147
):
148-
url = "https://packages.msys2.org/base/{{uni.get_text()}}"
148+
url = "https://packages.msys2.org/base/{{uni.text}}"
149149
else:
150-
url = "https://archlinux.org/packages/{{uni.get_text()}}"
150+
url = "https://archlinux.org/packages/{{uni.text}}"
151151
return PackageFinder().get_document_links(
152152
document.uri,
153153
self.trees[document.uri],
@@ -177,8 +177,8 @@ def hover(params: TextDocumentPositionParams) -> Hover | None:
177177
parent = uni.node.parent
178178
if parent is None:
179179
return None
180-
text = uni.get_text()
181-
_range = uni.get_range()
180+
text = uni.text
181+
_range = uni.range
182182
# we only hover variable names and function names
183183
if not (
184184
uni.node.type == "variable_name"
@@ -244,7 +244,7 @@ def completions(params: CompletionParams) -> CompletionList:
244244
parent = uni.node.parent
245245
if parent is None:
246246
return CompletionList(False, [])
247-
text = uni.get_text()
247+
text = uni.text
248248
if (
249249
parent.type == "array"
250250
and parent.parent is not None

0 commit comments

Comments
 (0)