Have editor services operate on the resulting/decorated AST (1)
If Spoofax were to pass the desugared ast node to resolve and hover, the plugin builder is saved from the trouble of desugaring the position information.
The interface of analyze-ast would then become:
Submitted by Nathan Bruning on 30 March 2010 at 14:15
(ast, path, fullpath) -> (ast’, errors, warnings, notes)
Issue Log
This one has been on my long time wish list. I added it now because of all the demand ;) Seems to work now, but with the reverse origin tracking it may potentially me more fragile than the position projection approach. Would be good to get some feedback on how well this works!
Now you can write:
editor-resolve:
(selected, position, ast, path, project-path) -> target
where
target := selected
<+
target := <parent-at-position(|position)> astinstead of
editor-resolve:
(selected, position, ast, path, project-path) -> target
where
position’ := <desugar-position(basic-desugar|ast)> position
where
target := <term-at-position(|position’)>
<+
target := <parent-at-position(|position’)>Note that this also affects builders. So you may want to write:
builder : “Show abstract syntax” = generate-aterm (openeditor) (realtime) (meta) (source)instead of
builder : “Show abstract syntax” = generate-aterm (openeditor) (realtime) (meta)
to get the source AST instead of the resulting/decorated AST.
Note that content completion still operates on the non-decorated AST, since it changed after the last analysis (see Spoofax/183).
Log in to post comments