Skip to content

Commit

Permalink
🔥 Remove ErrorQueryFinder()
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Feb 15, 2024
1 parent 98a9ee0 commit 338192e
Showing 1 changed file with 4 additions and 40 deletions.
44 changes: 4 additions & 40 deletions src/zathura_language_server/finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,13 @@
===========
"""

import os
from dataclasses import dataclass

from lsprotocol.types import DiagnosticSeverity
from tree_sitter_lsp.finders import ErrorFinder, QueryFinder, SchemaFinder
from tree_sitter_zathurarc import language

from .schema import ZathurarcTrie
from .utils import get_schema


@dataclass(init=False)
class ErrorZathurarcFinder(ErrorFinder):
r"""Error zathurarc finder."""

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__(language, message, severity)
from .utils import get_query, get_schema


@dataclass(init=False)
Expand All @@ -51,18 +27,7 @@ def __init__(
:param severity:
:type severity: DiagnosticSeverity
"""
with open(
os.path.join(
os.path.join(
os.path.join(os.path.dirname(__file__), "assets"),
"queries",
),
"import.scm",
)
) as f:
text = f.read()
query = language.query(text)
super().__init__(query, message, severity)
super().__init__(get_query("import"), message, severity)


@dataclass(init=False)
Expand All @@ -74,11 +39,10 @@ def __init__(self) -> None:
:rtype: None
"""
self.validator = self.schema2validator(get_schema())
self.cls = ZathurarcTrie
super().__init__(get_schema(), ZathurarcTrie)


DIAGNOSTICS_FINDER_CLASSES = [
ErrorZathurarcFinder,
ErrorFinder,
ZathurarcFinder,
]

0 comments on commit 338192e

Please sign in to comment.