-
Notifications
You must be signed in to change notification settings - Fork 53
Usage
For *.txt files: right click a file in project explorer and select Open With - Robot Framework Textfile Editor
.
For *.robot files: just doubleclick on a file in project explorer.
The opened text file now has syntax highlighting and content assistant for variables and keywords.
If most of your *.txt files in your workspace are robot test suites, you might want to consider setting the Robot editor as the default editor for *.txt files. Or alternatively consider renaming your files to use the .robot extension instead (supported starting with robotframework 2.7.6 and EclipseIDE plugin version 1.4.0).
Setting the Robot editor as the default editor for *.txt files, choose Window > Preferences from the menu, navigate to General > Editors > File Associations, choose *.txt from the upper list, choose "Robot Framework Textfile Editor" from the lower list, click the "Default" button and finally click OK. After this, to open non-robot test suites as with the regular text editor, right click the file and choose Open With > Text Editor. Once a specific editor has been chosen with the "Open With" procedure, eclipse remembers the editor you used for that file, so you will only have to do it once per file.
Content assistant has two working modes: one for keywords and one for variables. That is, it is context sensitive and the correct content assistant is activated depending whether you are writing a keyword or its arguments.
When writing a keyword, press Ctrl+Space
or alt+Space
(YMMV, depending on your key mappings) to activate content assistant for keywords. To get the full listing of keywords available activate the content assistant before typing any characters and choose a keyword from the full listing.
When writing arguments for keywords activating the content assistant allows you to choose from existing variables quickly. Writing few first characters narrows down the options and the whole variables list can be seen by activating the content assistant before you have typed any characters.
Currently the robot editor does not automatically detect available keywords and variables imported from libraries in robot test suites. However by including index files listing per-library keywords and variables it can complete those too. In the future we hope to be able to get rid of this manual step.
The index file format is simply a text file with one keyword or variable per line. They should be put in a directory called "robot-indices" directly below the root of the eclipse project your robot test suite files reside in. The file name should be LibraryName.index. For supporting keywords and variables built into the Robot Framework itself the filename should be BuiltIn.index.
We have pre-created index files for some libraries and they are included in the git repository. You can browse them here. Please note that the versioned directory names exist in the git repository only to allow for storing multiple versions of the same library. So robot-indices/RobotFramework-2.6.3/BuiltIn.index should go into MyEclipseRobotProject/robot-indices/BuiltIn.index
in your project.
Robot Framework can be configured by selecting from the Menu Window -> Preferences
and then from the left menu Robot Framework
. There you can select for example what colors the syntax hilight will use and how the table names should be formatted when using content assist.
The editor supports hyperlinks for navigation. Use Ctrl-LeftMouseClick
(or similar) to navigate to the definition of the keyword or variable the mouse points at. If the editor does not recognize where the keyword is defined (missing "Resource" statement) or if it is defined in a library (in which case the source is typically not available), a hyperlink does not appear and nothing happens. Similarly hyperlinks to locally defined variables (inside test case or keyword) are not supported at the moment.
File references in Resource or Variable settings in the Settings section are also hyperlinked.