Skip to content

Commit a7ba998

Browse files
committed
fix(langserver): resolving variables as variable import arguments does not work correctly
1 parent b225a73 commit a7ba998

File tree

58 files changed

+951
-9905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+951
-9905
lines changed

packages/language_server/src/robotcode/language_server/robotframework/diagnostics/imports_manager.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,16 @@ def __init__(
400400
self,
401401
name: str,
402402
args: Tuple[Any, ...],
403+
working_dir: str,
404+
base_dir: str,
403405
parent: ImportsManager,
404-
get_variables_doc_coroutine: Callable[[], Coroutine[Any, Any, VariablesDoc]],
406+
get_variables_doc_coroutine: Callable[[str, Tuple[Any, ...], str, str], Coroutine[Any, Any, VariablesDoc]],
405407
) -> None:
406408
super().__init__(parent)
407409
self.name = name
408410
self.args = args
411+
self.working_dir = working_dir
412+
self.base_dir = base_dir
409413
self._get_variables_doc_coroutine = get_variables_doc_coroutine
410414
self._lib_doc: Optional[VariablesDoc] = None
411415

@@ -438,7 +442,7 @@ async def check_file_changed(self, changes: List[FileEvent]) -> Optional[FileCha
438442
return None
439443

440444
async def _update(self) -> None:
441-
self._lib_doc = await self._get_variables_doc_coroutine()
445+
self._lib_doc = await self._get_variables_doc_coroutine(self.name, self.args, self.working_dir, self.base_dir)
442446

443447
if self._lib_doc is not None:
444448
self.file_watchers.append(
@@ -1225,7 +1229,7 @@ async def get_libdoc_for_variables_import(
12251229
variables,
12261230
)
12271231

1228-
async def _get_libdoc() -> VariablesDoc:
1232+
async def _get_libdoc(name: str, args: Tuple[Any, ...], working_dir: str, base_dir: str) -> VariablesDoc:
12291233
meta, source = await self.get_variables_meta(
12301234
name,
12311235
base_dir,
@@ -1311,7 +1315,9 @@ async def _get_libdoc() -> VariablesDoc:
13111315

13121316
async with self._variables_lock:
13131317
if entry_key not in self._variables:
1314-
self._variables[entry_key] = _VariablesEntry(name, args, self, _get_libdoc)
1318+
self._variables[entry_key] = _VariablesEntry(
1319+
name, resolved_args, str(self.folder.to_path()), base_dir, self, _get_libdoc
1320+
)
13151321

13161322
entry = self._variables[entry_key]
13171323

0 commit comments

Comments
 (0)