Hi!
Scala macros are functions called by the compiler during program
compilation. For the past time I've been working around the support of
macros in scala-ide.
The screencast shows, that macros can be turned off by clicking on the
icon, M1+M2+M(Ctrl-Shift-M) shortcut or through preference page.
Now there are two different macros API in ASTrees.
First is the
default MacroExpansionAttachment The second one is the Palladium
API. If Palladium API is available macro expansions are made of its
attachments. But if Palladium attachments are unavailable , then
After Getting the sources annotations are constructed. As shown
previously macro support in Scala ide is designed through a custom
action accompanied by a custom gutter icon that expands/collapses
macro applications inline. On images above one can see such a gutter
icon in two states: collapsed (red) and expanded (grey).
When clicking on such an icon macros on line get expanded or collapsed
respectively.
Expansions are done into the source code itself. So the document
content changes. But from the users point of view, when expanding the
state is used. It replaces the internal
dirtyState variable through a
After expanding to the source code presentation compiler analizes
sources and all the semantic services (syntax highlighting, error
detections, go to definitions functionality, e.t.c) works out of the
box.
macros are and change line numbers where neccesary.
Macros are expanded inline, so their expansions definitely shouldn’t
be saved to disk. When triggering save command performSave function of
ScalaSourceFileEditor is called. Before actual save every macro is
erased with its expandee, so that source file doesn't contain any
macro applications. After saving the document macros are expanded with
the state that they were before save happened.
Could you review the code? Anything to change, fix, clarify?
I absolutely sure, that lost/forgot some things to fix from previous PR.
Artem.