Jump to content

Macros/ScriptForge/ConfigureVSCode

From The Document Foundation Wiki


How to configure Visual Studio Code to show ScriptForge hints in Python scripts

Authored by PauL M (Amourspirit).

Advanced Python IDE's like PyCharm or Visual Studio Code utilize type hints to offer autocomplete suggestions during code writing by analyzing type annotations and combining them with the code context. Type hints, also referred to as type annotations, are comments embedded in the code specifying the data types of variables, parameters, and return values. Python scripts may benefit from the support of type hints when using the ScriptForge API.

Visual Studio Code would need to be installed and configured for working with Python; those details are beyond the scope of this wiki. As a bare minimum, Pylance[1] VS Code extension would need to be installed.

When working with ScriptForge, the types-scriptforge[2] package needs to be installed via pip in your system, after your virtual environment is activated in VS Code (usually, automatically after virtual environment is created).

When installing this types-scriptforge, the types-unopy[3] package will also be automatically installed. types-unopy will give full type support and auto completion for all the LibreOffice API objects, and types-scriptforge will give type support and auto completion for ScriptForge objects.

List of references