From d2d8e5d2a37cf5ba47507a49ceb530c09d6c7d7b Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Sat, 28 Mar 2026 00:00:03 +0100 Subject: [PATCH] VueTypeScriptServer: Fix incorrect ignore behaviour .vue files were incorrectly ignored because the source filename matcher of the language (TS) was used --- .../language_servers/vue_language_server.py | 7 +++- src/solidlsp/ls.py | 34 ++++++++++++------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/solidlsp/language_servers/vue_language_server.py b/src/solidlsp/language_servers/vue_language_server.py index 1314bec1..c7407117 100644 --- a/src/solidlsp/language_servers/vue_language_server.py +++ b/src/solidlsp/language_servers/vue_language_server.py @@ -21,7 +21,7 @@ from solidlsp.language_servers.typescript_language_server import ( prefer_non_node_modules_definition, ) from solidlsp.ls import LSPFileBuffer, SolidLanguageServer -from solidlsp.ls_config import Language, LanguageServerConfig +from solidlsp.ls_config import FilenameMatcher, Language, LanguageServerConfig from solidlsp.ls_exceptions import SolidLSPException from solidlsp.ls_types import Location from solidlsp.ls_utils import PathUtils @@ -47,6 +47,11 @@ class VueTypeScriptServer(TypeScriptLanguageServer): """ return Language.TYPESCRIPT + def get_source_fn_matcher(self) -> FilenameMatcher: + # must override with Vue-specific matcher to ensure .vue files are included (as they can be discovered via references, + # for instance; otherwise, we may find references in .vue files but then filter the results out, because .vue files are ignored.) + return Language.VUE.get_source_fn_matcher() + class DependencyProvider(TypeScriptLanguageServer.DependencyProvider): override_ts_ls_executable: str | None = None diff --git a/src/solidlsp/ls.py b/src/solidlsp/ls.py index 34352299..134d5c36 100644 --- a/src/solidlsp/ls.py +++ b/src/solidlsp/ls.py @@ -23,7 +23,7 @@ from sensai.util.string import ToStringMixin from serena.util.file_system import match_path from serena.util.text_utils import MatchedConsecutiveLines from solidlsp import ls_types -from solidlsp.ls_config import Language, LanguageServerConfig +from solidlsp.ls_config import FilenameMatcher, Language, LanguageServerConfig from solidlsp.ls_exceptions import SolidLSPException from solidlsp.ls_process import LanguageServerProcess from solidlsp.ls_types import UnifiedSymbolInformation @@ -583,6 +583,14 @@ class SolidLanguageServer(ABC): """ return self._ignore_spec + def get_source_fn_matcher(self) -> FilenameMatcher: + """ + :return: the source filename matcher for this language server, which must positively match all files that + are understood by this language server or are discovered as containing sources indirectly, e.g. via references + """ + # By default, use the matcher of the language + return self.language.get_source_fn_matcher() + def is_ignored_path(self, relative_path: str, ignore_unsupported_files: bool = True) -> bool: """ Determine if a path should be ignored based on file type @@ -600,7 +608,7 @@ class SolidLanguageServer(ABC): # Check file extension if it's a file is_file = os.path.isfile(abs_path) if is_file and ignore_unsupported_files: - fn_matcher = self.language.get_source_fn_matcher() + fn_matcher = self.get_source_fn_matcher() if not fn_matcher.is_relevant_filename(abs_path): return True @@ -917,10 +925,10 @@ class SolidLanguageServer(ABC): uri = cast(str, item[LSPConstants.URI]) range_d = cast(ls_types.Range, item[LSPConstants.RANGE]) elif ( - allow_location_links - and LSPConstants.TARGET_URI in item - and LSPConstants.TARGET_RANGE in item - and LSPConstants.TARGET_SELECTION_RANGE in item + allow_location_links + and LSPConstants.TARGET_URI in item + and LSPConstants.TARGET_RANGE in item + and LSPConstants.TARGET_SELECTION_RANGE in item ): uri = cast(str, item[LSPConstants.TARGET_URI]) range_d = cast(ls_types.Range, item[LSPConstants.TARGET_SELECTION_RANGE]) @@ -950,13 +958,13 @@ class SolidLanguageServer(ABC): class DefinitionLocationRequest(SymbolLocationRequest): def __init__( - self, - language_server: "SolidLanguageServer", - relative_file_path: str, - line: int, - column: int, - *, - request_name: str = "request_definition", + self, + language_server: "SolidLanguageServer", + relative_file_path: str, + line: int, + column: int, + *, + request_name: str = "request_definition", ) -> None: super().__init__( language_server,