summaryrefslogtreecommitdiffstats
path: root/src/debputy/lsp/lsp_debian_debputy_manifest.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/debputy/lsp/lsp_debian_debputy_manifest.py')
-rw-r--r--src/debputy/lsp/lsp_debian_debputy_manifest.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/debputy/lsp/lsp_debian_debputy_manifest.py b/src/debputy/lsp/lsp_debian_debputy_manifest.py
index 2f9920e..97fffcc 100644
--- a/src/debputy/lsp/lsp_debian_debputy_manifest.py
+++ b/src/debputy/lsp/lsp_debian_debputy_manifest.py
@@ -45,6 +45,12 @@ _LANGUAGE_IDS = [
lsp_standard_handler(_LANGUAGE_IDS, TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL)
+def is_valid_file(path: str) -> bool:
+ # For debian/debputy.manifest, the language ID is often set to makefile meaning we get random
+ # "non-debian/debputy.manifest" YAML files here. Skip those.
+ return path.endswith("debian/debputy.manifest")
+
+
def _word_range_at_position(
lines: List[str],
line_no: int,
@@ -69,10 +75,12 @@ def _word_range_at_position(
@lint_diagnostics(_LANGUAGE_IDS)
def _lint_debian_debputy_manifest(
_doc_reference: str,
- _path: str,
+ path: str,
lines: List[str],
position_codec: LintCapablePositionCodec,
) -> Optional[List[Diagnostic]]:
+ if not is_valid_file(path):
+ return None
diagnostics = []
try:
MANIFEST_YAML.load("".join(lines))