Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Honor the OPTION_ROBOT_TIMEOUT_USE for initialization as well #932

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions robotframework-ls/src/robotframework_ls/server_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -71,7 +84,7 @@ def initialize(
"workspaceFolders": workspace_folders,
},
},
timeout=30 if USE_TIMEOUTS else NO_TIMEOUT,
timeout=timeout,
)

@implements(IRobotFrameworkApiClient.settings)
Expand Down
3 changes: 2 additions & 1 deletion robotframework-ls/src/robotframework_ls/server_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down