Skip to content

Commit

Permalink
⬆️ Upgrade tree-sitter-lsp
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Feb 16, 2024
1 parent 1b65c8e commit fe667df
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 27 deletions.
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env -S pip install -r

tree-sitter-languages
tree-sitter-lsp >= 0.0.4
# ErrorFinder
tree-sitter-lsp >= 0.0.13
2 changes: 1 addition & 1 deletion requirements/misc.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env -S pip install -r

tree-sitter-lsp[misc] >= 0.0.2
tree-sitter-lsp[misc]
28 changes: 3 additions & 25 deletions src/autotools_language_server/finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,14 @@
from tree_sitter_languages import get_parser
from tree_sitter_lsp import UNI
from tree_sitter_lsp.finders import (
ErrorQueryFinder,
ErrorFinder,
QueryFinder,
RepeatedFinder,
)

from .utils import get_query


@dataclass(init=False)
class ErrorMakeFinder(ErrorQueryFinder):
r"""Errormakefinder."""

def __init__(
self,
message: str = "{{uni.get_text()}}: error",
severity: DiagnosticSeverity = DiagnosticSeverity.Error,
) -> None:
r"""Init.
:param filetype:
:type filetype: str
:param message:
:type message: str
:param severity:
:type severity: DiagnosticSeverity
:rtype: None
"""
super().__init__("make", message, severity)


@dataclass(init=False)
class InvalidPathFinder(QueryFinder):
r"""Invalidpathfinder."""
Expand Down Expand Up @@ -73,7 +51,7 @@ def capture2uni(self, capture: tuple[Node, str], uri: str) -> UNI | None:
uni = UNI(uri, node)
return (
uni
if label == "path" and not os.path.isfile(self.uni2path(uni))
if label == "path" and not os.path.isfile(uni.get_path())
else None
)

Expand Down Expand Up @@ -326,7 +304,7 @@ def __call__(self, uni: UNI) -> bool:


DIAGNOSTICS_FINDER_CLASSES = [
ErrorMakeFinder,
ErrorFinder,
InvalidPathFinder,
RepeatedTargetFinder,
]

0 comments on commit fe667df

Please sign in to comment.