Description
Is your enhancement request related to a problem? Please describe.
i'm seeing these errors from the robotcode vscode extension:
foo.py(2, 1): Importing test library 'tests.sandpit.foo' failed: ImportError: cannot import name 'TypeForm' from 'typing_extensions' (c:\Users\user\.vscode\extensions\d-biehl.robotcode-1.0.3\bundled\libs\typing_extensions.py)
Traceback (most recent call last):
File "C:\Users\user\no_onedrive\project\tests\sandpit\__init__.py", line 1, in <module>
from tests.sandpit import foo
File "C:\Users\user\no_onedrive\project\tests\sandpit\foo.py", line 2, in <module>
from typing_extensions import TypeForm
PYTHONPATH:
c:\Users\user\.vscode\extensions\d-biehl.robotcode-1.0.3\bundled\libs
c:\Users\user\.vscode\extensions\d-biehl.robotcode-1.0.3\bundled\tool\robotcode
C:\Users\user\AppData\Roaming\uv\python\cpython-3.13.1-windows-x86_64-none\python313.zip
C:\Users\user\AppData\Roaming\uv\python\cpython-3.13.1-windows-x86_64-none\DLLs
C:\Users\user\AppData\Roaming\uv\python\cpython-3.13.1-windows-x86_64-none\Lib
C:\Users\user\AppData\Roaming\uv\python\cpython-3.13.1-windows-x86_64-none
c:\Users\user\no_onedrive\project\.venv
c:\Users\user\no_onedrive\project\.venv\Lib\site-packages
C:\Users\user\no_onedrive\project
this is because i have a keyword with a type annotation that uses the new TypeForm
type, which was only recently added to typing_extensions
in the latest release (4.13.0):
# ./tests/sandpit/foo.py
from robot.api.deco import keyword
from typing_extensions import TypeForm
@keyword
def foo(value: TypeForm[object]): ...
*** Settings ***
Library tests.sandpit.foo # Import definition contains errors. (ImportContainsErrors)
*** Test Cases ***
Asdf
Foo None
this error is a false positive though because my project has the latest version of typing_extensions
in its dependencies, but it seems that the version of the robotcode language server used by the vscode extension is bundled with the extension.
in my project i have the robotcode[languageserver]
pypi package installed, so i would expect it to use that, along with the dependencies in my project's venv instead of the versions bundled with vscode.
since i also use robotcode[analyze]
in my CI, having vscode use a different version of robotcode causes vscode to show different errors to the CI.
Describe the solution you'd like
most vscode language server extensions solve this problem with an importStrategy
setting. for example ruff. it would be nice if robotcode did the same thing (ideally it would default to "fromEnvironment"
)
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.