There is currently a generic formatting support API that makes it easier to create language formatters/indenters, especially for embedded languages: org.netbeans.modules.css.formatting.api. This API is currently placed in module css.editor, it should be moved to a more sensible place.
Petre & Davide, is the request still valid ? What's the relation of the formatting API to the Editor's Reformat/IndentTask SPI ?
This was fixed by Marek who moved the code from css.editor into a new web.indent module (CSS, HTML, XHTML and JSP indentation engines are implemented using this module). So in a way this issue has been resolved. On the other hand the API is generic and can be used by any language and so the prefix "web." could be dropped from its name.
(In reply to comment #1)
> What's the relation of the
> formatting API to the Editor's Reformat/IndentTask SPI ?
It's more high-level indentation API. When I wrote it I looked into implementation of several indentation engines and noticed that code was heavily copy&pasted and that fairly big amount of code dealt again and again with the same problems like applying calculated indents etc. So I defined an API where indentation logic, which is domain specific, is separated from applying of the indentation. All what language indentation engine has to do is to return list of indentation commands for a single line (eg. INDENT, CONTINUE, RETURN, NO_CHANGE, etc.). Special effort was made into supporting embedded languages and thanks to above described abstraction it is very easy - indentation commands provided by different languages are merged by infrastructure and indentation is applied. Having said that the code of the infrastructure is complex and non-trivial. It's backed by lots of tests and over last few year it worked really well for CSS, HTML, XHTML and JSP indenter.