WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 675eb66

Browse files
committed
🚑 Fix UNI's methods
1 parent bcae968 commit 675eb66

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/termux_language_server/finders.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ def get_text_edits(self, uri: str, tree: Tree) -> list[TextEdit]:
181181
return []
182182
# swap 2 unis
183183
return [
184-
TextEdit(UNI.node2range(parent), UNI.node2text(_parent)),
185-
TextEdit(UNI.node2range(_parent), UNI.node2text(parent)),
184+
TextEdit(UNI(parent).range, UNI(_parent).text),
185+
TextEdit(UNI(_parent).range, UNI(parent).text),
186186
]
187187
return []
188188

@@ -247,7 +247,7 @@ def is_csv(self, uni: UNI) -> bool:
247247
parent.type == "variable_assignment"
248248
and uni.node == parent.children[-1]
249249
and (uni.node.type == "word" or uni.node.type == "string")
250-
and UNI.node2text(parent.children[0]) in self.csvs
250+
and UNI(parent.children[0]).text in self.csvs
251251
)
252252

253253
@staticmethod

src/termux_language_server/schema.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def from_string_node(cls, node: Node, parent: "Trie | None") -> "Trie":
3232
"""
3333
if node.type == "string" and node.children == 3:
3434
node = node.children[1]
35-
text = UNI.node2text(node)
36-
_range = UNI.node2range(node)
35+
text = UNI(node).text
36+
_range = UNI(node).range
3737
if node.type in {"string", "raw_string"} and node.children != 3:
3838
text = text.strip("'\"")
3939
_range.start.character += 1
@@ -61,13 +61,13 @@ def from_node(cls, node: Node, parent: "Trie | None") -> "Trie":
6161
if node.type in string_types:
6262
return cls.from_string_node(node, parent)
6363
if node.type == "function_definition":
64-
return cls(UNI.node2range(node), parent, 0)
64+
return cls(UNI(node).range, parent, 0)
6565
if node.type == "variable_assignment":
6666
if len(node.children) < 3:
67-
return cls(UNI.node2range(node), parent, "")
67+
return cls(UNI(node).range, parent, "")
6868
node = node.children[2]
6969
if node.type == "array":
70-
trie = cls(UNI.node2range(node), parent, [])
70+
trie = cls(UNI(node).range, parent, [])
7171
value: list[Trie] = trie.value # type: ignore
7272
trie.value = [
7373
cls.from_node(child, trie)
@@ -85,7 +85,7 @@ def from_node(cls, node: Node, parent: "Trie | None") -> "Trie":
8585
"variable_assignment",
8686
"function_definition",
8787
}:
88-
value[UNI.node2text(child.children[0])] = cls.from_node(
88+
value[UNI(child.children[0]).text] = cls.from_node(
8989
child, trie
9090
)
9191
return trie

0 commit comments

Comments
 (0)