Skip to content

Commit 737dd38

Browse files
committed
correct _ResourcesEntry dead lock in get_libdoc
1 parent 66152de commit 737dd38

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ testpaths = ["tests"]
7474
junit_suite_name = "robotcode"
7575
log_cli = true
7676
log_cli_level = "DEBUG"
77+
log_cli_format = "%(levelname)s %(name)s: %(message)s"
7778

7879
[tool.isort]
7980
profile = "black"

robotcode/language_server/common/parts/workspace.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,9 @@ async def add_file_watchers(
407407
watchers=[FileSystemWatcher(glob_pattern=w.glob_pattern, kind=w.kind) for w in _watchers]
408408
),
409409
)
410-
# TODO: implement own filewatcher if not supported by language server client
410+
else:
411+
# TODO: implement own filewatcher if not supported by language server client
412+
self._logger.warning("client did not support workspace/didChangeWatchedFiles.")
411413

412414
def remove() -> None:
413415
if self._loop.is_running():

robotcode/language_server/robotframework/diagnostics/imports_manager.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,17 @@ async def is_valid(self) -> bool:
314314
async def get_document(self) -> TextDocument:
315315
if self._document is None:
316316
async with self._lock:
317-
if self._document is None:
318-
await self._update()
317+
await self._get_document()
318+
319+
assert self._document is not None
320+
321+
return self._document
322+
323+
async def _get_document(self) -> TextDocument:
324+
if self._document is None:
325+
await self._update()
319326

320-
assert self._document is not None
327+
assert self._document is not None
321328

322329
return self._document
323330

@@ -330,7 +337,7 @@ async def get_libdoc(self) -> LibraryDoc:
330337
if self._lib_doc is None:
331338
self._lib_doc = await (
332339
await self.parent.parent_protocol.documents_cache.get_resource_namespace(
333-
await self.get_document()
340+
await self._get_document()
334341
)
335342
).get_library_doc()
336343
return self._lib_doc

tests/robotcode/language_server/robotframework/parts/data/goto.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Library ${CURDIR}/libs/myvariables.py
77
Variables ${CURDIR}/libs/myvariables.py
88
# TODO ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Variables Import: len(result) == 1 and result[0].target_uri.endswith("libs/myvariables.py")
99
Resource ${CURDIR}/resources/firstresource.resource
10-
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Resource Import: len(result) == 1 and result[0].target_uri.endswith("/resources/firstresource.resource")
10+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Resource Import: len(result) == 1 and result[0].target_uri.endswith("/resources/firstresource.resource")
1111

1212
*** Variables ***
1313
${A VAR} i'm a var

0 commit comments

Comments
 (0)