PyCharm with LSP

Short version:

  1. Install Robot Framework 3.2.1: pip install -U robotframework
  2. Install Robot Framework LSP server: pip install -U robotframework-lsp
  3. Install LSP Support Plugin to PyCharm: https://plugins.jetbrains.com/plugin/10209-lsp-support
  4. Add Server Definitions to Language Server Protocol (Executable, robot, )
  5. Download robot.tmlanguage
  6. Add path to tmLanguage file to Editor > TextMate Bundles in Pycharm Preferences.

Originally posted by @René in Slack

2 Likes

Longer version:

  1. Install Robot Framework 3.2.1: pip install -U robotframework
  2. Install Robot Framework LSP server: pip install -U robotframework-lsp
  3. Install LSP Support Plugin in PyCharm*
    image
  4. Add Server Definition to LSP Support
    Preferences > Languages & Frameworks > Language Server Protocol > Server Definitions
    Select Executable and select the robotframework-ls executable in the python bin or scripts folder.
    As alternative you could use the path to python executable in Path field and -u <path to repo>/src/robotframework_ls in the Args field.On windows use \ instead of / in these paths
  5. Download TMLanguage definition
    The TMLanguage is the definition file to get s proper syntax highlighting. This is completely independent from LSP and code completion itself.
    Download this file and put it in a directory where it can stay.
  6. Add robotframework.tmLanguage to TextMate Bundles
    Add the folder where the tmLanguage file is saved in. Not the file directly
  7. Restart PyCharm and enjoy

:robot: Updated new Syntax Highlighting:

robot.tmLanguage (33.2 KB)

1 Like

Just as an information.
Code Completion seems to be case sensitive in PyCharm at the moment.

So you have to type in Wait instead of wait to get suggestions for all Wait-Keywords

1 Like

Worth mentioning is that if you are trying to run lsp on Mac, lsp might be failing because it tries to open a lot of files and and default 256 open filehandles is running out… To fix this temporarily, ulimit -n 4096 on shell might help.

2 Likes