CSharp: added waiting for request_referencing and test for cross-file references

This commit is contained in:
MischaPanch authored and Michael Panchenko committed 2025-08-14 12:01:58 +02:00
1 parent b87c8a97ee
commit c82fab97c1
3 files changed
+50

No files matched your search

@@ -13,6 +13,7 @@ import threading
import urllib.request
import zipfile
from pathlib import Path
from time import sleep
from typing import cast
from overrides import override
@@ -21,6 +22,7 @@ from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls_exceptions import SolidLSPException
from solidlsp.ls_logger import LanguageServerLogger
from solidlsp.ls_types import Location
from solidlsp.ls_utils import PathUtils
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.lsp_protocol_handler.server import ProcessLaunchInfo
@@ -735,3 +737,10 @@ class CSharpLanguageServer(SolidLanguageServer):
project_uris = [PathUtils.path_to_uri(project_file) for project_file in project_files]
self.server.notify.send_notification("project/open", {"projects": project_uris})
self.logger.log(f"Opened project files: {project_files}", logging.DEBUG)
@override
def request_references(self, relative_file_path: str, line: int, column: int) -> list[Location]:
# Like in the typescript LS, we need to wait here for the language server to
# get correct results that include cross-file references.
sleep(1)
return super().request_references(relative_file_path, line, column)