diff --git a/robotframework-ls/src/robotframework_ls/server_api/client.py b/robotframework-ls/src/robotframework_ls/server_api/client.py index a526041306..c339c7cdf7 100644 --- a/robotframework-ls/src/robotframework_ls/server_api/client.py +++ b/robotframework-ls/src/robotframework_ls/server_api/client.py @@ -54,12 +54,25 @@ def _check_process_alive(self, raise_exception=True): return True def initialize( - self, msg_id=None, process_id=None, root_uri="", workspace_folders=() + self, config, msg_id=None, process_id=None, root_uri="", workspace_folders=() ): from robocorp_ls_core.options import NO_TIMEOUT, USE_TIMEOUTS self._check_process_alive() msg_id = msg_id if msg_id is not None else self.next_id() + + from robotframework_ls.impl.robot_generated_lsp_constants import ( + OPTION_ROBOT_TIMEOUT_USE, + ) + + timeout = 30 + if config and not config.get_setting( + OPTION_ROBOT_TIMEOUT_USE, bool, USE_TIMEOUTS + ): + timeout = NO_TIMEOUT + if not USE_TIMEOUTS: + timeout = NO_TIMEOUT + return self.request( { "jsonrpc": "2.0", @@ -71,7 +84,7 @@ def initialize( "workspaceFolders": workspace_folders, }, }, - timeout=30 if USE_TIMEOUTS else NO_TIMEOUT, + timeout=timeout, ) @implements(IRobotFrameworkApiClient.settings) diff --git a/robotframework-ls/src/robotframework_ls/server_manager.py b/robotframework-ls/src/robotframework_ls/server_manager.py index c34f597f24..ede94ab577 100644 --- a/robotframework-ls/src/robotframework_ls/server_manager.py +++ b/robotframework-ls/src/robotframework_ls/server_manager.py @@ -327,7 +327,9 @@ def on_received_message(msg): os.getpid(), server_process.pid, ) + config = self._config api.initialize( + config, process_id=os.getpid(), root_uri=workspace.root_uri, workspace_folders=list( @@ -336,7 +338,6 @@ def on_received_message(msg): ), ) - config = self._config log.debug("Forwarding config to api...") if config is not None: api.forward(