You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With Robot Framework there is a tool coming that documents Robot Libraries and Keyword Resources to XML.
It is called Libdoc (robot.libdoc) python -m robot.libdoc --format XML:HTML SeleniumLibrary sl.xml
the format XML:HTML is used to tell libdoc to embed HTML rendered documentation text into the XML.
i think it could be very useful, if Language Server is able to read these XML Files.
One issue with getting all possible Keywords is, that you have three to four different sources where keywords can come from.
*.Resource Files. Here are the Robot Keywords defined, written by users.
*.py Libraries. (static) These are modules or classes where the methods/functions are the keywords.
*.py Libraries (dynamic) These classes have the keywords somewhere else and Robot Framework get the list of keywords by calling the method get_keyword_names()
These can not be parsed but actually "executed" to get the Keywords. This could be an issue.
Remote Libraries: These are Libraries written in a different language or just running on an other computer. The Remote Library connects to the Remote Server with xml-rpc and the Remote Server has the actual Library loaded. Without the Remote Server running it is not possible to get the names of the keywords.
Because of type 3 and 4 and because often when writing tests, the remote Libraries are not available on this particular machine, it would be good to be able to read keywords from XML.
Then the users can generate the XML once and just place it in their project folder.
Maybe these XML Files could even be the first implementation where to get the list of keywords.
And the second step could be using Robot Frameworks parser to read User Keywords from *.resource files.
@Snooz82 this seems like a good idea for a first implementation... I was thinking about using the api directly, but having that intermediary step with the xml seems good and can make things more flexible (I can probably generate those on-demand for the user and have instructions for the user to generate those when the language-server can't do it).
I think it could be a custom extension (maybe .robotapi) to be able to locate it (and maybe even allow libraries to provide it themselves)...
That way we'd search for these files in the following places:
PYTHONPATH folders,
Workspace folders
${extension}/robotframework/api/ (this is the place where the automatically generated files would be searched -- it'd probably have some intermediary directories so that we can match a python interpreter).
@pekkaklarck right now I think that one of the difficult things for the language server is discovering what are the libraries available. Having .robotapi files as proposed could be a solution to discover those.
So, we could ask for libraries to provide such a file and distribute it to make it possible to discover it automatically in the language server -- what do you think, is that something reasonable?
-- on some cases, after the user imports a library the language server could do that automatically, but if that file is already provided by a library it'd be able to suggest it as an import.
I agree supporting XML files that Libdoc can generate is a good idea. Good news is that Libdoc can also read these files using its LibraryDocumentation API that also handles all other kind of libraries. This is why robotframework/robotframework#3448 is so important.
@pekkaklarck@fabioz
As long as you have no strong opinions, i would propose to use *.libspec because RED (the eclipse plugin) already uses this extension for the XML files which it generates with Libdoc.
Using the same extension would help them to migrate to language Server later and would somehow standardize the ext.
I'm fine with .libspec if it's used by RED already. I'll submit an issue about Robot's LibraryDocumentation automatically supporting this extension when reading information from files.
Would it be a good idea to specify that libspec files should have their library and keyword docs in HTML? Libdoc nowadays supports that as XML:HTML format (robotframework/robotframework#3301) and I would expect it to be easiest for editors if they didn't need to think about different doc formats. If we do that, then
python -m robot.libdoc Example Example.libspec
should just automatically use the XML:HTML format. Deciding about this is part of robotframework/robotframework#3491 so let's continue discussion there.
Activity
Snooz82 commentedon Mar 3, 2020
Hi Fabio,
With Robot Framework there is a tool coming that documents Robot Libraries and Keyword Resources to XML.
It is called Libdoc (robot.libdoc)
python -m robot.libdoc --format XML:HTML SeleniumLibrary sl.xmlthe format XML:HTML is used to tell libdoc to embed HTML rendered documentation text into the XML.
i think it could be very useful, if Language Server is able to read these XML Files.
One issue with getting all possible Keywords is, that you have three to four different sources where keywords can come from.
These can not be parsed but actually "executed" to get the Keywords. This could be an issue.
Because of type 3 and 4 and because often when writing tests, the remote Libraries are not available on this particular machine, it would be good to be able to read keywords from XML.
Then the users can generate the XML once and just place it in their project folder.
Maybe these XML Files could even be the first implementation where to get the list of keywords.
And the second step could be using Robot Frameworks parser to read User Keywords from *.resource files.
Kind Regards
René
Snooz82 commentedon Mar 3, 2020
snipped of the XML:
fabioz commentedon Mar 4, 2020
@Snooz82 this seems like a good idea for a first implementation... I was thinking about using the api directly, but having that intermediary step with the xml seems good and can make things more flexible (I can probably generate those on-demand for the user and have instructions for the user to generate those when the language-server can't do it).
I think it could be a custom extension (maybe
.robotapi) to be able to locate it (and maybe even allow libraries to provide it themselves)...That way we'd search for these files in the following places:
PYTHONPATHfolders,${extension}/robotframework/api/(this is the place where the automatically generated files would be searched -- it'd probably have some intermediary directories so that we can match a python interpreter).@pekkaklarck right now I think that one of the difficult things for the language server is discovering what are the libraries available. Having
.robotapifiles as proposed could be a solution to discover those.So, we could ask for libraries to provide such a file and distribute it to make it possible to discover it automatically in the language server -- what do you think, is that something reasonable?
-- on some cases, after the user imports a library the language server could do that automatically, but if that file is already provided by a library it'd be able to suggest it as an import.
pekkaklarck commentedon Mar 4, 2020
I agree supporting XML files that Libdoc can generate is a good idea. Good news is that Libdoc can also read these files using its
LibraryDocumentationAPI that also handles all other kind of libraries. This is why robotframework/robotframework#3448 is so important.fabioz commentedon Mar 5, 2020
Note: the extension to be used is
.kwspec.Snooz82 commentedon Mar 5, 2020
@pekkaklarck @fabioz
As long as you have no strong opinions, i would propose to use *.libspec because RED (the eclipse plugin) already uses this extension for the XML files which it generates with Libdoc.
Using the same extension would help them to migrate to language Server later and would somehow standardize the ext.
fabioz commentedon Mar 5, 2020
I'm ok on any extension... Is
.libspecreasonable for you @pekkaklarck?pekkaklarck commentedon Mar 6, 2020
I'm fine with
.libspecif it's used by RED already. I'll submit an issue about Robot'sLibraryDocumentationautomatically supporting this extension when reading information from files.pekkaklarck commentedon Mar 6, 2020
Submitted robotframework/robotframework#3491 about official
*.libspecsupport.Would it be a good idea to specify that libspec files should have their library and keyword docs in HTML? Libdoc nowadays supports that as
XML:HTMLformat (robotframework/robotframework#3301) and I would expect it to be easiest for editors if they didn't need to think about different doc formats. If we do that, thenshould just automatically use the
XML:HTMLformat. Deciding about this is part of robotframework/robotframework#3491 so let's continue discussion there.fabioz commentedon Mar 30, 2020
The initial implementation for code-completion for keywords is now done in the language server (0.0.5) -- just released.