RobotCode v1.7.0 format issues

I have problems getting formatting to work in two instances:

  • Mark section, then right klick ‘Format Selection’ - Executing `robotidy` failed: No module named ‘robotidy’

  • Using ‘Editor: Format On Save’ - No feedback and nothing happens when saving

I have no issues using ‘Format Document’. Any ideas?

Just remove robotidy from your project and update robotframework-pabot and robotframework to the latest ones.

After that in settings.json in VS Code write this:

    "[robotframework]": {
        "editor.defaultFormatter": null,
        "editor.formatOnSave": false
    },
    "emeraldwalk.runonsave": {
        "commands": [
            {
                "match": "\\.robot$",
                "cmd": "poetry run robocop format ${file}",
                "autoShowOutputPanel": "error"
            },
            {
                "match": "\\.resource$",
                "cmd": "poetry run robocop format ${file}",
                "autoShowOutputPanel": "error"
            }
        ]
    }

Oki so the solution is to rely on another extession?

You can try to downgrade the libraries: robotframework-robocop to 5.x and robotframework-tidy to 4.x.

The settings.json would be like this:


    "[robotframework]": {
        "editor.defaultFormatter": "d-biehl.robotcode",
        "editor.formatOnSave": true
    }