mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-13 22:16:23 +00:00
Improve waiting logic for cross-file references to be ready
Now waiting only once instead of on each request, hopefully that's enough
This commit is contained in:
1 parent
a066202d02
commit
d4dedd5d84
5 files changed
+32
-22
No files matched your search
@@ -13,7 +13,6 @@ import threading
|
||||
import urllib.request
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
from time import sleep
|
||||
from typing import cast
|
||||
|
||||
from overrides import override
|
||||
@@ -22,7 +21,6 @@ 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
|
||||
@@ -739,8 +737,10 @@ class CSharpLanguageServer(SolidLanguageServer):
|
||||
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(2)
|
||||
return super().request_references(relative_file_path, line, column)
|
||||
def _get_wait_time_for_cross_file_referencing(self) -> float:
|
||||
is_windows = platform.system() == "Windows"
|
||||
# seems like on windows initialization may take longer
|
||||
if is_windows:
|
||||
return 3
|
||||
else:
|
||||
return 1
|
||||
Reference in new issue
Block a user