From a1ac3e2e9850980c2fff9c83c98831d63fb34748 Mon Sep 17 00:00:00 2001 From: Michael Panchenko Date: Mon, 7 Apr 2025 23:55:18 +0200 Subject: [PATCH] Fix ignore condition in should_ignore_path isfile was called on rel_path, which can't work --- src/multilspy/language_server.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/multilspy/language_server.py b/src/multilspy/language_server.py index 73ba5711..f3874469 100644 --- a/src/multilspy/language_server.py +++ b/src/multilspy/language_server.py @@ -14,6 +14,7 @@ import os import pathlib import pickle import re +from site import abs_paths import threading from collections import defaultdict from contextlib import asynccontextmanager, contextmanager @@ -259,7 +260,11 @@ class LanguageServer: """ # Check file extension if it's a file fn_matcher = self.language.get_source_fn_matcher() - if os.path.isfile(relative_path) and not fn_matcher.is_relevant_filename(relative_path): + abs_path = os.path.join(self.repository_root_path, relative_path) + if not os.path.exists(abs_path): + raise FileNotFoundError(f"File {abs_path} not found, the ignore check cannot be performed") + + if os.path.isfile(abs_path) and not fn_matcher.is_relevant_filename(abs_path): return True # Create normalized path for consistent handling