diff --git a/src/solidlsp/ls.py b/src/solidlsp/ls.py index 990b1422..d0706a72 100644 --- a/src/solidlsp/ls.py +++ b/src/solidlsp/ls.py @@ -33,7 +33,7 @@ from solidlsp.dependency_provider import ( from solidlsp.initialize_params import DefaultInitializeParamsBuilder, InitializeParamsBuilder from solidlsp.ls_config import FilenameMatcher, LanguageServerConfig, LanguageServerId from solidlsp.ls_exceptions import InvalidTextLocationError, SolidLSPException -from solidlsp.ls_process import LanguageServerInterface, StdioLanguageServer +from solidlsp.ls_process import DEFAULT_LS_REQUEST_TIMEOUT, LanguageServerInterface, StdioLanguageServer from solidlsp.ls_types import UnifiedSymbolInformation from solidlsp.ls_utils import FileUtils, PathUtils, TextUtils from solidlsp.lsp_protocol_handler import lsp_types @@ -451,7 +451,7 @@ class SolidLanguageServer(ABC): cls, config: LanguageServerConfig, repository_root_path: str, - timeout: float | None = None, + timeout: float | None = DEFAULT_LS_REQUEST_TIMEOUT, solidlsp_settings: SolidLSPSettings | None = None, ) -> "SolidLanguageServer": """ @@ -463,7 +463,7 @@ class SolidLanguageServer(ABC): :param repository_root_path: The root path of the repository. :param config: language server configuration. :param logger: The logger to use. - :param timeout: the timeout for requests to the language server. If None, no timeout will be used. + :param timeout: the timeout, in seconds, for requests to the language server; if None, use no timeout :param solidlsp_settings: additional settings :return LanguageServer: A language specific LanguageServer instance. """ diff --git a/src/solidlsp/ls_process.py b/src/solidlsp/ls_process.py index 3acec5a5..c4c1d9e7 100644 --- a/src/solidlsp/ls_process.py +++ b/src/solidlsp/ls_process.py @@ -35,6 +35,12 @@ from solidlsp.util import subprocess_util log = logging.getLogger(__name__) + +DEFAULT_LS_REQUEST_TIMEOUT: float = 300.0 +""" +Default request timeout, in seconds, when callers do not pass an explicit timeout +""" + # Per the LSP spec, `ContentModified` (-32801) means the server discarded a stale, in-flight # computation because the workspace changed underneath it, not that the request itself is # invalid. A well-behaved client is expected to retry such requests -- but only requests it has