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.
Summary: | PHP code formatter ignores "Expand Tabs to Spaces" setting | ||
---|---|---|---|
Product: | php | Reporter: | bobw <bobw> |
Component: | Formatting & Indentation | Assignee: | Petr Pisl <ppisl> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | fzamboj |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | Macintosh (x86) | ||
OS: | Mac OS X | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: |
Screenshot of before and after showing spaces v. tabs
Settings that resulted in attachment 99269 |
Description
bobw
2010-05-20 18:07:12 UTC
Created attachment 99269 [details]
Screenshot of before and after showing spaces v. tabs
Just noticed that the tabs in my code example got converted to spaces, either by my browser or by Bugzilla. To illustrate the problem properly, I copied the original and formatted text into BBEdit and turned on the feature to show whitespace characters. Tabs are depicted as triangles and spaces as diamonds.
Created attachment 99272 [details] Settings that resulted in attachment 99269 [details] I forgot to turn off the PHP settings override for my screenshot, so there are actually five spaces per indent and five spaces per tab, versus the four that I previously stated. This attachment shows the settings that were in effect. reproduced Product Version: NetBeans IDE Dev (Build 100607-272cdc06fedb) Java: 1.6.0_16; Java HotSpot(TM) 64-Bit Server VM 14.2-b01 1. disable expand tabs to spaces 2. add 1 tab if (0 != $status) { $detail = $detail; //there are spaces in the beginning } 3. add 2 tabs if (0 != $status) { $detail = $detail; //tab is there now } 4. format code and you are back on spaces. Now, you change tab size to 4 (so it equals to indent size) and it looks like everything works. 5. enable expand tabs to spaces and it works. Therefore I think that the only problem here is that users do not know that when you disable the feature you need to set up indent and tab size. @ppisl: are we going to make something about it? (just close if not, please) Unless I'm misunderstanding, I *had* properly set up the indent and tab sizes. Can you verify from my settings screenshot? I realized those were issues upon reading related bugs, before I filed this one. That said, testing now, with build 201006050001, this problem does seem to be fixed. One thing I'm noticing that may be the same issue is that many of the default PHP code templates have spaces for initial indentation. Depending on how many spaces there are, they may or may not be converted to tabs on insertion. Shouldn't the code templates *always* have tabs, which are then converted (or not) on insertion by the formatting engine? This issue I have fixed a few month ago. I can not reproduce it in NB 7.1, so closing as fix. Please reopen, if it still doesn't work for you. |