|Re: [pdt-dev] Access PHP AST from within WTP/WST|
sorry for delayed answer.
You shouldnât work on AST in this case. It might be not synced with current edit. For autoedit you schould work with SSE IDocument DOM.
See how work PHP autoedit strategies, for ex. org.eclipse.php.internal.ui.autoEdit.CloseTagAutoEditStrategyPHP.
Anyway, if you still need AST, you should know that autoedit strategies work in UI context, so you can âjustâ ask workbench for current editor (see getActiveTextEditor in mentioned class). PHPStructuredTextEditor have method to return ISourceModule. When you have source module you are able to Â ask for AST.
PDT have two AST models:
1. One based on DLTK basic elements (very similar to JDT Compiler model). Itâs used for validation, type inference and code assist.
2. Internal PDT DOM AST, itâs more heavy, and available for current editor only (see SharedASTProvider). Itâs used for code manipulating, highlighting and formatting.
Reply:ÂPDT Developers <pdt-dev@xxxxxxxxxxx>
Date:Â10 August 2016 at 13:42:38
Subject:Â [pdt-dev] Access PHP AST from within WTP/WST