Outline builder consistency with other builders / Outline analyzed AST
I propose refactoring to “the tuple of five” to make it consistent with the other builders.
Also the outline builder should then have a
(source)
option to get the non-analyzed AST and get the analyzed AST otherwise.I guess these changes can be implemented backwards compatible by first trying with the tuple of five, and if that fails try the non-analyzed AST.
(Related issue: https://yellowgrass.org/issue/Spoofax/754 on different outline types)
Workaround for analyzed AST outline (almost)
To get an analyzed AST outline in the mean time:
outline2 = simple-label-outline(to-outline-label) outline: ast -> <outline2> analyzed-ast with index-setup(|<language>, <project-path>); task-setup(|<project-path>) with path := <origin-relative-path>; (analyzed-ast, _, _, _) := <analysis-single-default-interface>(ast, path, <project-path>)
however
Submitted by Daco Harkes on 25 March 2014 at 16:17<project-path>
is broken from the context of the outline view: it returns the empty string. So<origin-relative-path>
returns the complete instead of relative path. (<project-path>
works fine in the rest of the project.)
Issue Log
The outliner now supports the five tuple as well as selection-based outlining. There is no support yet for an outline based on the analyzed AST, so I’m leaving this issue open.
There are now two new outline options available:
(source)
and(onselection)
.
The(source)
option currently has no effect, but this will change once there is support for an outline based on the analyzed AST.
The(onselection)
makes the outline update every time the selection changes and provides you with the selection AST.
For example, if you haveoutline view: editor-outline (source)
in yourYourLang-Views.esv
, then theeditor-outline
below will be invoked every time a new AST is generated. Furthermore, thenode
andast
variables will both hold the source AST.editor-outline: (node, position, ast, path, project-path) -> outline where outline := <simple-label-outline(to-outline-label)> ast
If you have
outline view: editor-outline (source) (onselection)
in yourYourLang-Views.esv
, then theeditor-outline
below will be invoked every time the user changes the text selection in the editor. Furthermore, thenode
andast
variables will hold the selection AST and the source AST respectively.editor-outline: (node, position, ast, path, project-path) -> outline where outline := <simple-label-outline(to-outline-label)> node
Thanks!
Looking forward to the analysed one.
Log in to post comments