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.
Created attachment 145827 [details] Formatting Html When I set HTML formatting to indentation of 1 (See attachment FormattingHtml.png) and set JS formatting to indentation of 3 (See attachment FormattingJavascript.png) and I format the code, all inline CSS and JS will be formatted wrong, it will be formatted with the HTML formatting rules and not with its own (See attachment WrongFormatting.png and ExpectedFormatting.png). I think as I see it inside the navigator, that he can recognize JS, CSS and HTML, than the rules should recognice it too. (See the attachment Navigator.png) Regards Chris
Created attachment 145828 [details] Formatting Javascript
Created attachment 145829 [details] Wrong formatting
Created attachment 145830 [details] Expected Formatting
Created attachment 145831 [details] Navigator
Reproducible Product Version: NetBeans IDE 8.0 (Build 201403052200) Java: 1.8.0; Java HotSpot(TM) Client VM 25.0-b69 Runtime: Java(TM) SE Runtime Environment 1.8.0-b131 System: Linux version 3.2.0-48-generic-pae running on i386; UTF-8; en_US (nb)
In another words it looks like the embedded languages always get the settings from the embedding language regardless what their own settings are.
I tried to fix the AbstractIndenter so it gets proper settings for its language (it used to use IndentUtils.indentLevelSize(document) which always returned the top level language settings) but even if the AbstractIndenter.indentationSize property was correctly set, the indentation kept behaving wrong. When I set html indent level to 1, the html code was indented using level 4. Which is the opposite of the original state!?!?! Javascript indenter/formatter doesn't seem to be extending/using web.indent/AbstractIndenter so it is either its fault it reads incorrect settings (as AbstractIndenter did) or the top level HTMLIndenter screws it up afterwards. Anyway as the AbstractIndenter logic is not a code a feel familiar with, I'm passing this issue to David Konecny. I'll attach a patch which IMO correctly fixes the way how the AI sets the indentationSize property.
Created attachment 147969 [details] The AbstractIndenter patch
The root of the problem is in JavaScript indenter (I think). I fixed the HTML/CSS indenter to be capable of using different indent levels for different languages - 7d3660b27538. The fix is based on Marek's patch (thanks!) and expanded a bit.
Integrated into 'main-silver', will be available in build *201407170001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/7d3660b27538 User: David Konecny <dkonecny@netbeans.org> Log: #242649 - Wrong formatting for inline JavaScript and CSS with different HTML formatting.
Fixed in web-main 7f53ae3f879c.
Integrated into 'main-silver', will be available in build *201407180001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/cc1805fe3a06 User: Ondrej Brejla <obrejla@netbeans.org> Log: Regenerated golden files in respect to fixes in issue #242649.