The REPL in VS Code
RobotCode's REPL runs Robot Framework statements one by one: import a library, call a keyword and see its result at once, without writing a test. It is a good place to try out a library or to find the right arguments for a keyword.
RobotCode: Start Terminal REPL, also in the RobotCode menu (RobotCode: Show Tool Menu), opens a terminal named "Robot REPL" in the workspace folder of the active file and starts the REPL in it. The REPL runs in the Python environment that RobotCode uses for the folder, the same as the language server, with the configuration profiles you selected and with the settings that runs use, such as robotcode.robot.variables and robotcode.robot.pythonPath:
![The terminal Robot REPL: robotcode repl at the prompt robotcode-demo $, the banner RobotCode REPL 2.7.0 (Robot Framework 7.5, Python 3.13.12 on linux) with its hint to type .help for commands and .exit to quit, the inputs Import Library ShopLibrary and ${price}= Price Of coffee, the output [ INFO ] ${price} = 4.5, and the next >>> prompt.](/_astro/repl-terminal-light.VS9jXEFv_Z20uqL9.webp)
![The terminal Robot REPL: robotcode repl at the prompt robotcode-demo $, the banner RobotCode REPL 2.7.0 (Robot Framework 7.5, Python 3.13.12 on linux) with its hint to type .help for commands and .exit to quit, the inputs Import Library ShopLibrary and ${price}= Price Of coffee, the output [ INFO ] ${price} = 4.5, and the next >>> prompt.](/_astro/repl-terminal-dark.CKHOUKKk_ZCq6mW.webp)
Type statements as you would write them in a test, with at least two spaces between the keyword and its arguments. In a workspace with several folders, the terminal carries the folder's name. .exit ends the REPL and closes the terminal; VS Code does not restore it after a restart. If the folder's Python environment cannot run the REPL, for example because Robot Framework is missing in it, an error message names the problem and no terminal opens. The same holds when a selected configuration profile is not defined in the folder's configuration: the message names it and offers Remove from Selection and Select Configuration Profiles.
What the REPL can do, from history and completion to saving a session as a test and debugging at the prompt, is described in Interactive Robot Framework with robotcode repl.
Released under the Apache-2.0. Copyright © 2022-present Daniel Biehl