Custom Robot Framework keywords in Visual Studio Code IntelliSense

Hello! Did you extend your Robot Framework with plenty of new methods? Would you like to make them available in VS Code IntelliSense to make a test development smooth and easy? Here I’m to help you!

Configuration

First of all, you have to get the Robot Framework Intellisense extension created by Tomi Turtiainen.
Robot Framework Intellisense

Now, you have to customize settings. Hit ctrl/cmd + shift + P, type “Open Settings”, and open “Preferences: Open Settings (JSON)”.

Note: “Preferences: Open Settings (JSON)” opens user settings. You can edit workspace settings instead.

At the end of the file, right before closing bracket, add a new property:

"rfLanguageServer.libraries": [
  {
    "name": "{libraryName}",
    "version": "1.0.0",
    "keywords": [
    {
      "name": "{keyword}",
      "args": [
        "{arg1}",
        "{arg2}"	
      ],
      "doc": "{documentation}"
    },
],​

Fill the property with your library data and keywords:

  • {libraryName} – name of your library i.e. “Graph”,
  • {keyword} – exact name of your keyword i.e. “Delete Group By Name”,
  • {arg1}, {arg2} – names of arguments. Use a descriptive name to make it easy to understand e.g. “groupName”. It’s just a tip for a user,
  • {documentation} – description of your function. It is displayed in the tooltip.

Here is an example of my configuration:

"rfLanguageServer.libraries": [
  {
    "name": "Graph",
    "version": "1.0.0",
    "keywords": [
    {
      "name": "Delete Group By Name",
      "args": [
        "groupName"
      ],
      "doc": "Deletes Office 365 group."
    },
],​

Go to a .robot file and start typing a keyword name. VS Code will show you a tooltip with your keyword.

IntelliSense

Final thoughts

If you develop extensions for your Robot Framework workspace and you want to share the IntelliSense configuration with your team, you can use VS Code workspace settings. It creates settings.json file in the .vscode folder. You can include this file in your repository, but keep in mind that other users may add their settings there. By the time, I haven’t found the usable solution for separating local and shareable settings. There is a workaround using Multi-root Workspaces, but it adds another layer to a project structure.