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 215883 - Automatic indentation setting
Summary: Automatic indentation setting
Status: NEW
Alias: None
Product: xml
Classification: Unclassified
Component: Text-Edit (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Svata Dedic
Depends on:
Reported: 2012-07-24 14:36 UTC by Jesse Glick
Modified: 2012-07-24 14:36 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2012-07-24 14:36:52 UTC
While I like to use the IDE's default indentation level of four spaces for newly written XML files, a lot of existing XML files use two spaces to indent (or occasionally other values such as one or three). Editing such files in NetBeans is quite tedious, since you need to manually correct indentation on every line you edit... and Alt-Shift-Left/Right will only happen to do something useful if you want to adjust indentation of a block by a multiple of four spaces, i.e. this will not work if you are wrapping a block in a single tag.

Suggest making the editor automatically configure its indentation according to the indentation of the first child of the document element, falling back to four spaces in case there is no unambiguous answer this way. This should work well for both new and existing files without needing to add any new configuration UI.

(I looked under Tools > Options > Editor > Formatting > Language, but XML was not listed as an option, so I could not even temporarily set the Number of Spaces per Indent to 2 without affecting non-XML files too.)