Skip to content

Commit a8c805c

Browse files
committed
correction completion of library and resources
1 parent bb3f4a3 commit a8c805c

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
An [extension](https://marketplace.visualstudio.com/VSCode) which brings support for [RobotFramework](https://robotframework.org/) to [Visual Studio Code](https://code.visualstudio.com/), including features like IntelliSense, linting, debugging, code navigation, code formatting, test explorer, find references for keywords and variables, and more!
44

5-
⚠️⚠️⚠️ THIS EXTENSION IS IN PREVIEW STATE, THERE ARE GOING TO BE BUGS ⚠️⚠️⚠️
6-
75
## Requirements
86

97
* Python 3.8 or above
@@ -16,6 +14,13 @@ RobotCode will automatically install [Python extension](https://marketplace.visu
1614

1715
Extensions installed through the marketplace are subject to the [Marketplace Terms of Use](https://cdn.vsassets.io/v/M146_20190123.39/_content/Microsoft-Visual-Studio-Marketplace-Terms-of-Use.pdf).
1816

17+
## Features
18+
19+
### Autocomplete and IntelliSense
20+
21+
22+
23+
1924
## Quick start
2025

2126
1. [Install a supported version of Python on your system](https://code.visualstudio.com/docs/python/python-tutorial#_prerequisites)
@@ -26,9 +31,10 @@ Extensions installed through the marketplace are subject to the [Marketplace Ter
2631
3. [Install the # RobotCode extension for Visual Studio Code](https://code.visualstudio.com/docs/editor/extension-gallery).
2732
4. Open or create a robot file and start coding! 😉
2833

34+
2935
## Setting up your environment
3036

31-
TODO
37+
You can alway use your local python environment, just select the correct python interpreter in Visual Studio Code.
3238

3339
### With pipenv
3440

@@ -51,6 +57,6 @@ This is the simpliest way to create an running environment.
5157
python -m pipenv install robotframework
5258
```
5359
- Open project in VSCode
60+
- Set the python interpreter to the created virtual environment
5461

55-
TODO
5662

robotcode/language_server/robotframework/parts/completion.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,13 @@ async def resolve(self, completion_item: CompletionItem) -> CompletionItem:
248248
name = completion_item.data.get("name", None)
249249
if name is not None:
250250
try:
251-
entry = (await self.namespace.get_libraries_matchers()).get(KeywordMatcher(name), None)
251+
lib_doc = await self.namespace.imports_manager.get_libdoc_for_library_import(
252+
name, (), str(document.uri.to_path().parent), sentinel=self
253+
)
252254

253-
if entry is not None:
255+
if lib_doc is not None:
254256
completion_item.documentation = MarkupContent(
255-
kind=MarkupKind.MARKDOWN, value=entry.library_doc.to_markdown(False)
257+
kind=MarkupKind.MARKDOWN, value=lib_doc.to_markdown(False)
256258
)
257259

258260
except (SystemExit, KeyboardInterrupt, asyncio.CancelledError):
@@ -265,11 +267,13 @@ async def resolve(self, completion_item: CompletionItem) -> CompletionItem:
265267
name = completion_item.data.get("name", None)
266268
if name is not None:
267269
try:
268-
entry = (await self.namespace.get_resources_matchers()).get(KeywordMatcher(name), None)
270+
lib_doc = await self.namespace.imports_manager.get_libdoc_for_resource_import(
271+
name, str(document.uri.to_path().parent), sentinel=self
272+
)
269273

270-
if entry is not None:
274+
if lib_doc is not None:
271275
completion_item.documentation = MarkupContent(
272-
kind=MarkupKind.MARKDOWN, value=entry.library_doc.to_markdown()
276+
kind=MarkupKind.MARKDOWN, value=lib_doc.to_markdown()
273277
)
274278

275279
except (SystemExit, KeyboardInterrupt, asyncio.CancelledError):

0 commit comments

Comments
 (0)