This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 178224 - Move common formatting API (o.n.m.css.formatting.api) from css.editor to a more suitable place
Summary: Move common formatting API (o.n.m.css.formatting.api) from css.editor to a mo...
Alias: None
Product: editor
Classification: Unclassified
Component: CSL (API & infrastructure) (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: David Konecny
Depends on:
Reported: 2009-12-07 04:31 UTC by Petr Jiricka
Modified: 2012-12-11 21:31 UTC (History)
1 user (show)

See Also:
Issue Type: TASK
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Petr Jiricka 2009-12-07 04:31:28 UTC
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.
Comment 1 Svata Dedic 2012-12-11 20:50:26 UTC
Petre & Davide, is the request still valid ? What's the relation of the formatting API to the Editor's Reformat/IndentTask SPI ?
Comment 2 David Konecny 2012-12-11 21:31:33 UTC
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.