Macros support.

Macro functionality is done through Annotations. When clicking on
expand macro annotation macro expands into the source code, annotation
to collapse is added to expanded region. When clicking on collapse
macro annotation macro is erased with expandee.

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.

Through createLineNumberRulerColumn function line number
column for custom line numbering is integrated. It internally stores regions, where
macros are and change line numbers where neccesary.

Macros can be turned off by clicking on the Enable macro icon,
M1+M2+M(Ctrl-Shift-M) shortcut or through preference page.
You mean something like this:
        // If there exist an attachment conforming to the ScalaMeta API
        val macroAttachment = if (t.attachments.get[java.util.HashMap[String, Any]].isDefined) {
          t.attachments.get[java.util.HashMap[String, Any]].map { att =>
            (att.get("expandeeTree").asInstanceOf[Tree], att.get("expansionString").asInstanceOf[String])
          }
        } 
        // Or if there exist an attachment, conforming to macro-engine API
        else if (t.attachments.get[compiler.analyzer.MacroExpansionAttachment].isDefined) {
          t.attachments.get[compiler.analyzer.MacroExpansionAttachment].map { att =>
            (att.expandee, compiler.showCode(att.expanded.asInstanceOf[Tree]))
          }
        } else None