Skip to main content

Language server, debugger and tools for Robot Framework

Project description

RobotCode - Language support for Robot Framework for Visual Studio Code

Visual Studio Marketplace Installs Build Status License

PyPI - Version PyPI - Python Version PyPI - Downloads


An extension which brings support for RobotFramework to Visual Studio Code, including features like code completion, debugging, test explorer, refactoring and more!

Quick start

  1. Install a supported version of Python on your system (note: only Python 3.8 and above are supported)

  2. Install a supported version of RobotFramwork on your system (note: only RobotFramework 4.0 and above are supported)

  3. Install the RobotCode extension for Visual Studio Code.

  4. Open or create a robot file and start coding! 😉

Requirements

  • Python 3.8 or above
  • Robotframework 4.1 and above
  • VSCode version 1.74 and above

Features

With RobotCode you can edit your code with auto-completion, code navigation, syntax checking and many more. Here is a list of Features:

Autocomplete and IntelliSense

Autocompletion for:

  • Libraries with parameters
  • Resources,
  • Variables
  • Keywords with parameters
  • Namespaces

Autocomplete Libraries and Keywords

Autocompletion supports all supported variables types

  • local variables
  • variables from resource files
  • variables from variables file (.py and .yaml)
    • static and dynamic
  • command line variables
  • builtin variables

Autocomplete Variables

Code Navigation

  • Symbols
  • Goto definitions and implementations
    • Keywords
    • Variables
    • Libraries
    • Resources
  • Find references
    • Keywords
    • Variables
    • Imports
      • Libraries
      • Resources
      • Variables
    • Tags
  • Errors and Warnings

Diagnostics and Linting

RobotCode analyse your code and show diagnostics for:

  • Syntax Errors
  • Unknown keywords
  • Duplicate keywords
  • Missing libraries, resource and variable imports
  • Duplicate libraries, resource and variable imports
  • ... and many more

For most things RobotCode uses the installed RobotFramework version to parse and analyse the code, so you get the same errors as when you run it.

Get additional code analysis with Robocop. Just install it in your python environment.

Code Formatting

RobotCode can format your code with the internal RobotFramework robot.tidy tool (deprecated), but also with Robotidy. Just install it.

Running and Debugging

RobotCode supports running and debugging of RobotFramework testcases and tasks out of the box, directly from the definition of the test or suite.

Running Tests

In the debug console you can see all log messages of the current run and navigate to the keyword the message was written by.

Multi-root Workspace folders

RobotCodes support for Multi-root Workspaces, enables loading and editing different Robotframework projects/folders with different RobotFramework/Python environments and settings at the same time or you can share the same RobotFramework/Python environment and settings for all folders in the workspace.

Installed extensions

RobotCode will automatically install Python extension.

Extensions installed through the marketplace are subject to the Marketplace Terms of Use.

Setting up your environment

You can alway use your local python environment, just select the correct python interpreter in Visual Studio Code.

With pipenv

This is the simpliest way to create an running environment.

  • As a prerequisite you need to install pipenv like this:

    python -m pip install pipenv
    
  • Create your project directory (robottest is just an example)

    mkdir robottest
    cd robottest
    
  • Install robotframework

    python -m pipenv install robotframework
    
  • Open project in VSCode

  • Set the python interpreter to the created virtual environment

Customization

Editor Style

You can change some stylings for RobotFramework files in VSCode editor, independently of the current theme. (see Customizing a Color Theme)

See the difference:

Before After
Without customization With customization

As a template you can put the following code to your user settings of VSCode.

Open the user settings.json like this:

Ctrl + Shift + P or F1 or CMD + Shift + P

and then type:

Preferences: Open Settings (JSON)

put this to the settings.json

"editor.tokenColorCustomizations": {
    "textMateRules": [
        {
            "scope": "variable.function.keyword-call.inner.robotframework",
            "settings": {
                "fontStyle": "italic"
            }
        },
        {
            "scope": "variable.function.keyword-call.robotframework",
            "settings": {
                //"fontStyle": "bold"
            }
        },
        {
            "scope": "string.unquoted.embeddedArgument.robotframework",
            "settings": {
                "fontStyle": "italic"
            }
        },
        {
            "scope": "entity.name.function.testcase.name.robotframework",
            "settings": {
                "fontStyle": "bold underline"
            }
        },
        {
            "scope": "entity.name.function.keyword.name.robotframework",
            "settings": {
                "fontStyle": "bold italic"
            }
        },
        {
            "scope": "variable.other.readwrite.robotframework",
            "settings": {
                //"fontStyle": "italic",
            }
        },
        {
            "scope": "keyword.control.import.robotframework",
            "settings": {
                "fontStyle": "italic"
            }
        },
        {
            "scope": "keyword.other.header.setting.robotframework",
            "settings": {
                "fontStyle": "bold underline"
            }
        },
        {
            "scope": "keyword.other.header.variable.robotframework",
            "settings": {
                "fontStyle": "bold underline"
            }
        },
        {
            "scope": "keyword.other.header.testcase.robotframework",
            "settings": {
                "fontStyle": "bold underline"
            }
        },
        {
            "scope": "keyword.other.header.keyword.robotframework",
            "settings": {
                "fontStyle": "bold underline"
            }
        },
        {
            "scope": "keyword.other.header.setting.robotframework",
            "settings": {
                "fontStyle": "bold underline"
            }
        },
        {
            "scope": "keyword.other.header.comment.robotframework",
            "settings": {
                "fontStyle": "bold italic underline"
            }
        },
        {
            "scope": "constant.character.escape.robotframework",
            "settings": {
                //"foreground": "#FF0000",
            }
        }
    ]
},

"editor.semanticTokenColorCustomizations": {
    "rules": {
        "*.documentation:robotframework": {
            "fontStyle": "italic",
            //"foreground": "#aaaaaa"
        }
    }
}

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotcode-0.28.2.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robotcode-0.28.2-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file robotcode-0.28.2.tar.gz.

File metadata

  • Download URL: robotcode-0.28.2.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.3

File hashes

Hashes for robotcode-0.28.2.tar.gz
Algorithm Hash digest
SHA256 caaef3634542752772a7bae0dd3f6bfcbcec5379154472fdf785d77eb927fdf0
MD5 6486c9ad205f9ed9987f7cc4ff9ebd05
BLAKE2b-256 6f35d491a027b65c9aedf1ec25116e730971a5b0c87b5f7ee06f2f9d7f297901

See more details on using hashes here.

File details

Details for the file robotcode-0.28.2-py3-none-any.whl.

File metadata

  • Download URL: robotcode-0.28.2-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.3

File hashes

Hashes for robotcode-0.28.2-py3-none-any.whl
Algorithm Hash digest
SHA256 77b52383cd15347d9bb21fc5a5355196bd363a2a6cc978b51876aeafeee7cd34
MD5 26453cadf63b41773d3d06906682d0e6
BLAKE2b-256 3b18f2099744859eb698f471cdb474d8bd005d642c964069c51b936363b97606

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page