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: | More advanced space formatting rules | ||
---|---|---|---|
Product: | editor | Reporter: | andyexeter |
Component: | Formatting & Indentation | Assignee: | Dusan Balek <dbalek> |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 8.1 | ||
Hardware: | PC | ||
OS: | Linux | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
This is my first post of this kind, so please excuse me if I've missed anything I should have included or have posted this in the wrong place. I format code for WordPress plugins and the like according to WordPress Coding Standards (wpcs), and for the most part NetBeans allows me to set up formatting rules so I can pass PHP CodeSniffer's tests with those standards. One thing I'm unable to configure NetBeans to format correctly is spaces around array brackets. I currently have it set up to add a space between array brackets by ticking the Within Parentheses > Array Brackets option in Formatting options. The problem with this is wpcs doesn't expect spaces in all cases. The current wording for the reported errors is: > Array keys must NOT be surrounded by spaces if they only contain a string or an integer So while the following is valid: $array[ $value ]; These are reported as errors: $array[ 1 ]; $array[ 'value' ]; $array[ "value" ]; It'd be great if there was a way we could add regex patterns to dictate whether or not a space should appear. I'm aware that'd be a bit more complex than the way the space formatting currently works, but it'd be nice for code to be able to pass all wpcs sniffs without having to run a bash script after every time I format it.