Skip to content

Commit

Permalink
🐛 Fix #3: NotImplementedError
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Nov 25, 2023
1 parent bd9f84d commit 9c930a3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repos:
args:
- --msg-filename
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.7.2
rev: 2.7.3
hooks:
- id: editorconfig-checker
- repo: https://github.com/jumanjihouse/pre-commit-hooks
Expand All @@ -51,7 +51,7 @@ repos:
hooks:
- id: actionlint
- repo: https://github.com/adrienverge/yamllint
rev: v1.32.0
rev: v1.33.0
hooks:
- id: yamllint
- repo: https://github.com/executablebooks/mdformat
Expand All @@ -74,7 +74,7 @@ repos:
additional_dependencies:
- markdown-it-texmath
- repo: https://github.com/psf/black
rev: 23.9.1
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
Expand All @@ -88,7 +88,7 @@ repos:
additional_dependencies:
- tomli
- repo: https://github.com/kumaraditya303/mirrors-pyright
rev: v1.1.329
rev: v1.1.335
hooks:
- id: pyright
- repo: https://github.com/PyCQA/bandit
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S pip install -r

tree-sitter-languages
tree-sitter-lsp
tree-sitter-lsp >= 0.0.4
6 changes: 2 additions & 4 deletions src/autotools_language_server/finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def __init__(self, node: Node) -> None:
parent = node.parent
if parent is None:
raise TypeError
self.is_define = lambda _: False
if parent.type == "arguments":
self.is_define = self.is_function_define
# https://github.com/alemuller/tree-sitter-make/issues/8
Expand All @@ -158,8 +159,6 @@ def __init__(self, node: Node) -> None:
self.is_define = self.is_variable_define
elif parent.type == "prerequisites":
self.is_define = self.is_target_define
else:
raise NotImplementedError

def is_function_define(self, uni: UNI) -> bool:
r"""Is function define.
Expand Down Expand Up @@ -255,14 +254,13 @@ def __init__(self, node: Node) -> None:
parent = node.parent
if parent is None:
raise TypeError
self.is_reference = lambda _: False
if parent.type == "define_directive":
self.is_reference = self.is_function_reference
elif parent.type == "variable_assignment":
self.is_reference = self.is_variable_reference
elif parent.type == "prerequisites":
self.is_reference = self.is_target_reference
else:
raise NotImplementedError

def is_function_reference(self, uni: UNI) -> bool:
r"""Is function reference.
Expand Down

0 comments on commit 9c930a3

Please sign in to comment.