Skip to content

Commit 619eee4

Browse files
committed
fix(langserver): correct variable handling from resource imports
1 parent e603628 commit 619eee4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: packages/robot/src/robotcode/robot/diagnostics/namespace.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ def _import(
997997
top_level: bool = False,
998998
source: Optional[str] = None,
999999
parent_import: Optional[Import] = None,
1000-
) -> Tuple[Optional[LibraryEntry], Optional[Dict[str, Any]]]:
1000+
) -> Optional[LibraryEntry]:
10011001
result: Optional[LibraryEntry] = None
10021002
try:
10031003
if isinstance(value, LibraryImport):
@@ -1181,7 +1181,7 @@ def _import(
11811181
finally:
11821182
self._reset_global_variables()
11831183

1184-
return result, variables
1184+
return result
11851185

11861186
def _import_imports(
11871187
self,
@@ -1193,7 +1193,7 @@ def _import_imports(
11931193
source: Optional[str] = None,
11941194
parent_import: Optional[Import] = None,
11951195
depth: int = 0,
1196-
) -> None:
1196+
) -> Optional[Dict[str, Any]]:
11971197

11981198
current_time = time.monotonic()
11991199
self._logger.debug(lambda: f"{' '*depth}start imports for {self.document if top_level else source}")
@@ -1202,7 +1202,7 @@ def _import_imports(
12021202
if variables is None:
12031203
variables = self.get_resolvable_variables()
12041204

1205-
entry, variables = self._import(
1205+
entry = self._import(
12061206
imp,
12071207
variables=variables,
12081208
base_dir=base_dir,
@@ -1225,7 +1225,7 @@ def _import_imports(
12251225
variables = self.get_resolvable_variables()
12261226

12271227
try:
1228-
self._import_imports(
1228+
variables = self._import_imports(
12291229
entry.imports,
12301230
str(Path(entry.library_doc.source).parent),
12311231
top_level=False,
@@ -1388,6 +1388,8 @@ def _import_imports(
13881388
f"{self.document if top_level else source} in {time.monotonic() - current_time}s"
13891389
)
13901390

1391+
return variables
1392+
13911393
def _import_default_libraries(self, variables: Optional[Dict[str, Any]] = None) -> None:
13921394
def _import_lib(library: str, variables: Optional[Dict[str, Any]] = None) -> Optional[LibraryEntry]:
13931395
try:

0 commit comments

Comments
 (0)