Skip to content

Commit 58f185b

Browse files
committed
refactor(langserver): remove async code from commands
1 parent 204624c commit 58f185b

File tree

1 file changed

+5
-7
lines changed
  • packages/language_server/src/robotcode/language_server/common/parts

1 file changed

+5
-7
lines changed

packages/language_server/src/robotcode/language_server/common/parts/commands.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
from __future__ import annotations
2-
31
import inspect
42
import typing
53
import uuid
64
from dataclasses import dataclass
7-
from typing import TYPE_CHECKING, Any, Awaitable, Callable, Dict, Final, List, Optional, cast
5+
from typing import TYPE_CHECKING, Any, Callable, Dict, Final, List, Optional, cast
86

97
from robotcode.core.concurrent import threaded
108
from robotcode.core.lsp.types import (
@@ -24,7 +22,7 @@
2422
from robotcode.language_server.common.protocol import LanguageServerProtocol
2523

2624

27-
_FUNC_TYPE = Callable[..., Awaitable[Optional[LSPAny]]]
25+
_FUNC_TYPE = Callable[..., Optional[LSPAny]]
2826

2927

3028
@dataclass
@@ -38,7 +36,7 @@ class CommandsProtocolPart(LanguageServerProtocolPart):
3836

3937
PREFIX: Final = f"{uuid.uuid4()}"
4038

41-
def __init__(self, parent: LanguageServerProtocol) -> None:
39+
def __init__(self, parent: "LanguageServerProtocol") -> None:
4240
super().__init__(parent)
4341
self.commands: Dict[str, CommandEntry] = {}
4442

@@ -72,7 +70,7 @@ def extend_capabilities(self, capabilities: ServerCapabilities) -> None:
7270

7371
@rpc_method(name="workspace/executeCommand", param_type=ExecuteCommandParams)
7472
@threaded
75-
async def _workspace_execute_command(
73+
def _workspace_execute_command(
7674
self, command: str, arguments: Optional[List[LSPAny]], *args: Any, **kwargs: Any
7775
) -> Optional[LSPAny]:
7876
self._logger.debug(lambda: f"execute command {command}")
@@ -91,4 +89,4 @@ async def _workspace_execute_command(
9189
if i < len(arguments):
9290
command_args.append(from_dict(arguments[i], type_hints[i]))
9391

94-
return await entry.callback(*command_args)
92+
return entry.callback(*command_args)

0 commit comments

Comments
 (0)