Skip to content

Commit 0c38843

Browse files
committed
refactor(langserver): remove async code from diagnostics, selection range, workspace, signature help
1 parent 4e1b23c commit 0c38843

File tree

20 files changed

+268
-447
lines changed

20 files changed

+268
-447
lines changed

packages/core/src/robotcode/core/concurrent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ def run_in_thread(callable: Callable[..., _TResult], *args: Any, **kwargs: Any)
126126
)
127127
_running_callables[future] = thread
128128
future.add_done_callback(_remove_future_from_running_callables)
129-
129+
# TODO: don't set daemon=True because it can be deprecated in future pyhton versions
130+
thread.daemon = True
130131
thread.start()
131132

132133
return future

packages/core/src/robotcode/core/event.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def __iter__(self) -> Iterator[Callable[_TParams, _TResult]]:
7373
def _notify(
7474
self,
7575
*__args: _TParams.args,
76+
return_exceptions: Optional[bool] = True,
7677
callback_filter: Optional[Callable[[Callable[..., Any]], bool]] = None,
7778
**__kwargs: _TParams.kwargs,
7879
) -> Iterator[Union[_TResult, BaseException]]:
@@ -83,7 +84,10 @@ def _notify(
8384
try:
8485
yield method(*__args, **__kwargs)
8586
except BaseException as e:
86-
yield e
87+
if return_exceptions:
88+
yield e
89+
else:
90+
raise
8791

8892

8993
class EventIterator(EventResultIteratorBase[_TParams, _TResult]):

packages/jsonrpc2/src/robotcode/jsonrpc2/protocol.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,15 +561,15 @@ def send_request(
561561
self,
562562
method: str,
563563
params: Optional[Any] = None,
564-
return_type_or_converter: Optional[Type[_TResult]] = None,
564+
return_type: Optional[Type[_TResult]] = None,
565565
) -> FutureEx[_TResult]:
566566
result: FutureEx[_TResult] = FutureEx()
567567

568568
with self._sended_request_lock:
569569
self._sended_request_count += 1
570570
id = self._sended_request_count
571571

572-
self._sended_request[id] = SendedRequestEntry(result, return_type_or_converter)
572+
self._sended_request[id] = SendedRequestEntry(result, return_type)
573573

574574
request = JsonRPCRequest(id=id, method=method, params=params)
575575
self.send_message(request)
@@ -580,9 +580,9 @@ def send_request_async(
580580
self,
581581
method: str,
582582
params: Optional[Any] = None,
583-
return_type: Optional[Type[_TResult]] = None,
583+
return_type_or_converter: Optional[Type[_TResult]] = None,
584584
) -> asyncio.Future[_TResult]:
585-
return asyncio.wrap_future(self.send_request(method, params, return_type))
585+
return asyncio.wrap_future(self.send_request(method, params, return_type_or_converter))
586586

587587
@__logger.call
588588
def send_notification(self, method: str, params: Any) -> None:

0 commit comments

Comments
 (0)