Closed Cb1MOH closed 6 years ago
The plugin needs few configurations to be set and then you must execute few Sublime Text commands to create internal database for keywords. The configuration is explained in here: https://github.com/andriyko/sublime-robot-framework-assistant/blob/master/README.md#configuration Creation and maintenance of the internal database is explained here: https://github.com/andriyko/sublime-robot-framework-assistant/wiki/Internal-database-for-keywords-and-variables
If the automatic completion does not work after reading and fixing the configuration, then please show the user settings file from Preferences | Package settings | Robot Framework Assistant | Settings - User. Also provide the Sublime Text console output when you populate the internal database.
Yes, I'm already configured the plugin. As per conversation with creator of the plugin Andriy Hrytskiv - the feature with autocomplete of the sentence is not supported. Only autocomplete for keywords is supported for now. My current User settings for the plugin:
` / Robot Framework Assistant default settings / { / Sublime settings to make Robot Framework data editing more clearer and easier. Refer the Sublime default settings for more details. / "translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"draw_white_space": "all",
/*
Same as the Sublime default in Build 3103 with one exception,
it does not contain the * character. When the * is not in
word_separators the snippets containing * in tabTrigger
work out of the box.
If * is needed as a word separator, then the snippets
should be accessed by pressing tab key multiple times.
*/
"word_separators": "./\\()\"'-:,.;<>~!@#$%^&|+=[]{}`~?",
/*
Robot Framework Workspace
Defines a root folder where Test Suite located.
Before the Robot Framework Assistant can provide the keyword
and variable completion features, it needs to scan and index
the test suite and resource files. The argument defines the root folder
where scanning of robot data is performed.
In windows the backslash is the folder separator and in json
backslash is the escape character. Therefore, in windows write
double backslash to write literal backslash.
Linux example: "/home/User/myRobotTests"
Windows example: "c:\\Users\\User\\Desktop\\myRobotTests"
*/
"robot_framework_workspace": "/Users/maksimchernyshou/Work/PyCharm Projects/Keywords",
/*
Defines how keyword argument are formatted when keyword
completion is used. When set to false, each argument is
formatted to individual lines. If set to true keyword
and arguments are returned in single line.
*/
"robot_framework_keyword_argument_format": false,
/*
File extension defines which types of files the Robot Framework
Assistant plugin will search and index from the folder defined
in the robot_framework_workspace option.
This setting does not affect to the which files are uses the
syntax highlight.
*/
"robot_framework_extension": "robot",
/*
Path to Python binary
In order the scanning and indexing of keywords and variables to
work, path to Python binary must be defined. It must be the same
Python binary where the Robot Framework is installed.
In Linux like environments this could be like: /usr/bin/python
and in Windows this could be like: C:\Python27\python.exe
*/
"path_to_python": "/usr/bin/python",
/*
Module search path defines a list of paths where the
Robot Framework libraries are searched. Example if you have imported
a library with the library name, then module search path must
contain the folder where the library can be located.
The Robot Framework Assistant uses the Robot Framework API to parse
the test data and libraries. All changes, which are not system
wide, to locate the libraries, must also be added in the
module search path in the Robot Framework Assistant
More details how libraries is searched in Robot Framework can be
found from be the Robot Framework User guide:
http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#module-search-path
*/
"robot_framework_module_search_path":
[
"/Users/maksimchernyshou/Work/PyCharm Projects/Keywords",
"/other/path/to/libraries"
],
/*
Automatic database update on saving file
The robot_framework_automatic_database_update setting controls the
internal database updating. If the set to true, the internal
database table and index are created after a Robot Framework test data
file is saved. If set to false, the internal database tables are
only updated when the `Create Database`, `Create Database Tables`
or `Update Internal Database For Active Tab`
commands are run.
The setting only controls the Robot Framework test data. If a
libraries or a variable files are updated, then `Create Database`,
`Create Database Tables` or `Create Database Table From Active Tab`
commands must be run to update the internal database.
*/
"robot_framework_automatic_database_update": true,
/*
Robot Framework libraries in XML
When the library is not available during parsing time,
example if library is imported with Remote library interface.
Then this setting can be used to import libraries in libdoc XML
format.
Libraries found from the this path are globally available, in
same manner as the BuiltIn library
*/
"robot_framework_libraries_in_xml": "/path/to/library/documentation",
/*
Robot Framework variables
Robot Framework comes by default some predefined and built in
variables. These variables names may change between different
Robot Framework versions. Use this setting to define the
Robot Framework default variables.
The variables in the default settings are from Robot Framework
version 2.9.2
*/
"robot_framework_builtin_variables":
[
"${/}",
"${:}",
"${\\n}",
"${CURDIR}",
"${DEBUG_FILE}",
"${EMPTY}",
"@{EMPTY}",
"&{EMPTY}",
"${EXECDIR}",
"${False}",
"${LOG_FILE}",
"${LOG_LEVEL}",
"${None}",
"${null}",
"${OUTPUT_DIR}",
"${OUTPUT_FILE}",
"${PREV_TEST_MESSAGE}",
"${PREV_TEST_NAME}",
"${PREV_TEST_STATUS}",
"${REPORT_FILE}",
"${SPACE}",
"${SUITE_DOCUMENTATION}",
"${SUITE_NAME}",
"${SUITE_SOURCE}",
"${TEMPDIR}",
"${TEST_DOCUMENTATION}",
"${TEST_NAME}",
"${True}",
"&{SUITE_METADATA}",
"@{TEST_TAGS}"
],
/*
Path to internal database
By default internal database is created in plugin installation
directory, in database folder. Sometimes it could be useful to
change the default database location.
Example if the robot_framework_workspace is defined in the
Sublime workspace file and user wants to change between
different projects. Then it is useful to define
robot_framework_database_path setting also be project specific.
When the internal database is project specific, user does not
recreate the database when the project is changed.
The robot_framework_database_path must be a path to a folder.
If the setting is not path to a folder, then the database
is created in the plugin installation directory.
*/
"robot_framework_database_path": false,
/*
Sublime Text log_commands
This setting controls will the 'Robot Framework: Command Logging'
command enable or disable the Sublime Text log_commands API call.
If the robot_framework_log_commands setting evaluates as Python
True, then log_commands API call is enabled. If setting
evaluates as Python False, log_commands API call is disabled.
If log_commands API call is enabled. all commands run from key
bindings and the menu will be logged to the console.
*/
"robot_framework_log_commands": false
} `
It's true that Sublime Text does not support automatic completion of centenses, but it should still provide you some keywords. If it doesn't, then it's likely that there is bug somewhere. It do not see any obvious errors in your settings, but I have few questions.
1) From command line, if you do find /Users/maksimchernyshou/Work/PyCharm Projects/Keywords
does it list you the correct files? If not could you correct the robot_framework_workspace setting
2) From command line, if you do: /usr/bin/python --version
does it display the Python version. Because *nix can have multiple Python installations, is it the Python where you have installed Robot Framework? If not could you correct the path_to_python setting.
3) When you press the Ctrl + Alt + a
, which will run the Robot Framework: Create Database command, what does the Sublime Text console show?
I've renamed project's folder to PyCharm_Projects and after find /Users/maksimchernyshou/Work/PyCharm_Projects/Keywords the result is the list of my files.
/usr/bin/python --version Python 2.7.10
File "/Users/maksimchernyshou/Library/Application Support/Sublime Text 3/Packages/Robot Framework Assistant/commands/scan.py", line 40, in run sublime.set_timeout_async(self.runscan(file), 0) File "/Users/maksimchernyshou/Library/Application Support/Sublime Text 3/Packages/Robot Framework Assistant/commands/scan.py", line 60, in run_scan raise ValueError('Error in scanning result code: {0}'.format(rc)) ValueError: Error in scanning result code: 1 Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/sublimeplugin.py", line 818, in run return self.run(edit) File "/Users/maksimchernyshou/Library/Application Support/Sublime Text 3/Packages/Robot Framework Assistant/commands/scan_and_index.py", line 53, in run sublime.set_timeout_async(add_builtin_vars(db_dir)) File "/Users/maksimchernyshou/Library/Application Support/Sublime Text 3/Packages/Robot Framework Assistant/commands/scan_and_index.py", line 35, in add_builtin_vars f_table = open(table_path, 'r') FileNotFoundError: [Errno 2] No such file or directory: '/Users/maksimchernyshou/Library/Application Support/Sublime Text 3/Packages/Robot Framework Assistant/database/scanner/BuiltIn-ca8f2e8d70641ce17b9b304086c19657.json'
The error indicates that the plugin, for some reason, could not open Json file which contains keywords for the BuiltIn library. The plugin creates that file before it tries to open the file, so therefore something went wrong when the file was created. The plugin creates a log file, when it updates the internal database and the log file might contain information why the Json file was not created successfully. Could you press Ctrl + Alt + a
again (just to be sure that log file contains all the need information) and then attached the log file to the issue. You should find the log file from: /Users/maksimchernyshou/Library/Application Support/Sublime Text 3/Packages/Robot Framework Assistant/database/scan_index.log
Did forget to say that, please check that the log file does not contain any sensitive information. It example contains the names of your libraries, resources and test suites and sometimes one may want to hide that information.
Here it is. scan_index.log
Based on the error message in the log file, it looks like the /usr/bin/python
doesn't have Robot Framework installed. Could you change path_to_python setting to point to a Python installation where Robot Framework is installed.
I didn't catch. path_to_python setting is responsible for directory where python is installed? Should I add the directory where Robot Framework is installed or should I replace the path where python is installed to path where Robot Framework is installed?
The path_to_python
setting must point to the Python binary, which has Robot Framework installed. In practice this should: /usr/bin/python -c "from robot import run;run('--help')"
should display this:
[ ERROR ] Parsing '--help' failed: Data source does not exist.
Try --help for usage information.
Ok. I've did it but the behaviour is the same. Autocomplete works only by words and not for statements. scan_index.log
Autocomplete does only work for words, but it performs fuzzy search in the background. Example if one is looking for SeleniumLibrary keyword Wait Until Page Does Not Contain, you can type: WaiPaN
and then the first selection, in the completion list, is Wait Until Page Does Not Contain
(this of course depends is the SeleniumLibrary import available in the test data).
Here are some example how it works: https://github.com/andriyko/sublime-robot-framework-assistant/wiki/How-to#keyword-and-variable-completion
Because this issue turned more a support issue for the plugin than a feature request, I am closing the issue. If you still want an engagement for the plugin, please raise an new issue.
I'm using PyCharm to create test scenarios for Robot Framework. So there are libraries with already implemented keywords. When I'm creating new file with tests autocomplete works fine in PyCharm. sentences can be already automated and it will be great to reuse it in different test cases. It looks like:
But the same feature is not available in Sublime Text 3. I'm already installed Robot Framework Assistant and configured it. But the main issue that autocompletion that sublime provided is only for the words not for whole statements as in PyCharm.
Best regards