Skip to content

Repository files navigation

Robot Framework for Zed

Robot Framework language support for Zed using RobotCode.

Features

  • Syntax highlighting (tree-sitter + semantic tokens)
  • Diagnostics and linting
  • Code formatting
  • Hover documentation
  • Go to definition
  • Find references
  • Rename/refactoring
  • Keyword completion
  • Signature help
  • Code actions
  • Document outline
  • Code snippets
  • Bracket matching and auto-close

Installation

Install the extension from Zed's extension marketplace (Cmd+Shift+X, search "Robot Framework").

Requirements

  • Python >= 3.10
  • Robot Framework >= 5.0

Install RobotCode with language server support:

pip install robotcode[languageserver]

Verify the installation:

robotcode --version

Configuration

RobotCode settings can be passed via Zed's settings.json:

{
  "lsp": {
    "robotcode": {
      "settings": {
        "robotcode": {
          "robot": {
            "pythonPath": "/path/to/python"
          }
        }
      }
    }
  }
}

Snippets

The extension includes snippets for common Robot Framework patterns. Snippets support tab navigation, mirrored placeholders, selectable choices, and proper Robot Framework variable escaping.

Imports

Prefix Description
libas Import a library with an alias
res Import a resource file
vars Import a variables file

Settings

Prefix Description
ssetup Suite setup
steardown Suite teardown
tsetup Test setup
tteardown Test teardown
doc Documentation setting
tags Tags setting
args Arguments setting
ret Return from a keyword

Logging

Prefix Description
logc Log a message to console
logv Log a variable to console

Keywords

Prefix Description
kwdoc Keyword with documentation
kwargs Keyword with documentation and arguments
kwfull Keyword with documentation, arguments, and tags

Test cases

Prefix Description
tcdoc Test case with documentation
tcfull Test case with documentation and tags

Variables

Prefix Description
setv Set scalar variable
list Create list variable
dict Create dictionary variable
setsuite Set suite variable
settest Set test variable
setlocal Set local variable

Control flow

Prefix Description
forin FOR ... IN loop
forrange FOR ... IN RANGE loop
forenum FOR ... IN ENUMERATE loop
while WHILE loop
if IF block
ife IF / ELSE block
ifei IF / ELSE IF / ELSE block
ifi Inline IF statement

Exception handling

Prefix Description
try TRY / EXCEPT block
trye TRY / EXCEPT / ELSE block
tryf TRY / EXCEPT / FINALLY block
tryef TRY / EXCEPT / ELSE / FINALLY block

Assertions and utilities

Prefix Description
should Common assertion (selectable)
rkars Run keyword and return status
rkaie Run keyword and ignore error
waitkw Wait until keyword succeeds

Known Issues

Open files lose LSP features after language server restart

If RobotCode is restarted, .robot or .resource files that were already open will stop receiving LSP features (diagnostics, formatting, hover, completions, etc.). Newly opened files work normally.

Cause: Zed does not re-send textDocument/didOpen for already-open buffers after a language server restart. RobotCode correctly ignores requests for documents it hasn't received a didOpen notification for.

Workaround: Close and reopen affected files, or restart Zed.

Development

Reload the extension after making changes:

Cmd+Shift+P → zed: reload extensions

Build manually:

cargo build --target wasm32-wasip2

Credits

License

MIT

About

Robot Framework language support for Zed using RobotCode

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages