Skip to content

Commit d765174

Browse files
committed
chore: call namespace_invalidated in a task and not threaded
1 parent 68ea92d commit d765174

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

robotcode/language_server/robotframework/parts/diagnostics.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import asyncio
55
from typing import TYPE_CHECKING, Any, List, Optional
66

7-
from ....utils.async_tools import check_canceled, threaded
7+
from ....utils.async_tools import check_canceled, create_sub_task, threaded
88
from ....utils.logging import LoggingDescriptor
99
from ....utils.uri import Uri
1010
from ...common.decorators import language_id
@@ -51,10 +51,7 @@ def __init__(self, parent: RobotLanguageServerProtocol) -> None:
5151

5252
parent.documents_cache.namespace_invalidated.add(self.namespace_invalidated)
5353

54-
@language_id("robotframework")
55-
@threaded()
56-
@_logger.call
57-
async def namespace_invalidated(self, sender: Any, namespace: Namespace) -> None:
54+
async def namespace_invalidated_task(self, namespace: Namespace) -> None:
5855
if namespace.document is not None:
5956
refresh = namespace.document.opened_in_editor
6057

@@ -72,6 +69,11 @@ async def namespace_invalidated(self, sender: Any, namespace: Namespace) -> None
7269
if refresh:
7370
await self.parent.diagnostics.refresh()
7471

72+
@language_id("robotframework")
73+
@_logger.call
74+
async def namespace_invalidated(self, sender: Any, namespace: Namespace) -> None:
75+
create_sub_task(self.namespace_invalidated_task(namespace), loop=self.parent.diagnostics.diagnostics_loop)
76+
7577
@language_id("robotframework")
7678
@threaded()
7779
@_logger.call

0 commit comments

Comments
 (0)