Atom Packages Directory

a package directory for a text editor of the 21st Century

Autocomplete Robot Framework

Install with:
    apm install autocomplete-robot-framework
  

autocomplete-robot-framework

An autocomplete-plus provider for Robot Framework.

Demo

Install

shell apm install language-robot-framework apm install autocomplete-robot-framework

Usage

Opening a robot file will scan the parent project for keywords that will later be available as suggestions.

Works only for files that are included in an Atom project. Opening an independent robot resource won’t provide any suggestions. Space separated .robot and .txt files are supported.

Suggestions

Keywords may be suggested by partial keyword name separated or not by spaces, or even acronyms.

text run if # suggests 'Run Keyword If' sheq # suggests 'Should Be Equal' cfl # acronyms also work and suggest 'Continue For Loop', ... Sugestions are not limited to keywords. Library or resource names are suggested by prefixing their name.

```text Library OperatingSystem Library robot.libraries.DateTime Resource path/MyKeywords.robot

oper # Suggests OperatingSystem date # Suggests robot.libraries.DateTime robot # Also suggests robot.libraries.DateTime my # Suggest MyKeywords ```

Note that library names are suggested as long as they are successfully imported. See below.

Using ‘WITH NAME’ on a library is not taken in consideration at this time.

Scopes

By default suggestions are limited to imported libraries and resources. Scope modifiers allow us to override the default scope and search for keywords beyond current imports. * this. - suggests keywords from current file only * . - searches all available keywords * libraryOrResourceName. - limits suggestions to one source

text Collections. # Suggests all keywords from Collections Collections.copy # As above but limits suggestions MyKeywords. # Same rules apply for resources as well this. # Show only local keywords .append # Search 'append' through all indexed keywords

Library import

Python libraries have to be scanned for keywords just as regular robot files are. For this mechanism to work following requirements should be met. * Python environment is accessible and correctly configured * Supported versions: cpython 2.7, jython 2.7.0, ironpython 2.7.6 * Python executable is correctly defined in Atom package settings (defaults to ‘python’) * Robotframework 3.0 is installed according to instructions

Be sure to have PYTHONPATH, JYTHONPATH, CLASSPATH and IRONPYTHONPATH environment properly defined.

At this time libraries with mandatory parameters in constructor are not supported.

Libraries identified by path do not work - ‘Library path/PythonLibrary.py’

To help troubleshoot wrong imports and python environment problems take a look at Status panel below.

Fallback libraries

Official Robot Framework libraries are included for convenience, just in case library import mechanism is not working for some reasons. This could be the case for example if using the RF Jar distribution without any python interpreter available.

Fallback libraries are libdoc xml files generated with libdoc tool. Any such .xml file encountered in Atom project will be parsed for keywords together with the other .robot files.

To create a fallback library of your own use libdoc tool and copy the result somewhere in robot project so it can be scanned. Note that name of the file must be the fully qualified library name. If you use the import below

*** Settings ***
Library    my.utilities.Arrays

it would need a libdoc named my.utilities.Arrays.xml.

Status

Status pane shows imported libraries and python environment information together with any error occurred during import process.

It can be activated from Packages->Robot Framework->Show autocomplete status.

Troubleshooting

API

An API is available to enable cooperation with other packages by providing access to underlying keyword repository. * getKeywordNames() * getKeywordsByName(name) * getResourceKeys() * getResourceByKey(resourceKey)

Keyword { name: 'keyword name', documentation : 'documentation', arguments : ['arg1', ...], startRowNo : 0, startColNo : 0, resource : { path : 'resource path', name : 'resource name', libraryPath : 'python library source path if available', hasTestCases : true/false, hasKeywords : true/false, isLibrary : true/false, imports : { libraries : [{name : '', alias : ''}], resources : [{name : '', extension : ''}] } }

Resource { path: 'resource path', name : 'resource name', libraryPath : 'python library source path if available', hasTestCases: true/false, hasKeywords: true/false, isLibrary : true/false, imports : { libraries : [{name : '', alias : ''}], resources : [{name : '', extension : ''}] }, keywords: [keyword1, ...] } ## Testing apm test python/robot framework must be installed and operational. ‘python’ command must be available in PATH.

Changelog

Keywords: autocomplete, robot, framework Suggest keywords
Fork me on GitHub