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 243073 - Per-directory configuration (formatting specifically)
Summary: Per-directory configuration (formatting specifically)
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-20 07:50 UTC by bracketworks
Modified: 2014-03-20 08:00 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bracketworks 2014-03-20 07:50:20 UTC
Currently, PHP projects support per-project formatting configuration.

I'd like to propose that this feature be extended to per-directory formatting configuration, as well as extend the configuration options to include the "On Save" behaviors (such as reformatting and whitespace stripping).

While in most cases the global or per-project formatting configuration options are satisfactory, there are circumstances where they do not coincide with a particular set of files (which I've found to typically be isolated to a specific directory). These circumstances include directories of PHP "template" files (contrasted with class or other definition files).

Part of this issue stems from the fact that by default, PHP treats non-PHP code (code between ?> ... <?php) as HTML. This is not always the case; it may be plain-text, SQL, etc.

When "Format On Save" is enabled (or you manually format the file), non-PHP code is automatically formatted as HTML, which in the absence of HTML/XML tags will left-align everything. This is, obviously, *not* the desired effect.

Currently, the only solution is to disable the "On Save" options, which I find to be invaluable otherwise.

This issue/request could be implemented in a number of ways, I'm sure, however the most pragmatic approach seems to me to introduce per-directory configuration, and to include the "On Save" behavior therein. In the same way as the global vs. per-project configuration, the configuration option could be resolved in a cascading manner: global > project > directory > directory > ...

I'd gladly work out a patch myself, however my Java-fu is less than adequate.
Comment 1 bracketworks 2014-03-20 08:00:00 UTC
If unclear, the proposed feature would provide a fix for this use-case by allowing the following:

1) Locate directory containing PHP templates (or other PHP you wish to be formatted differently, not at all, etc.)

2) Assign per-directory configuration to disable the "On Save" behavior.

3) Continue coding; all other global/per-project formatting options remain intact, the template directory is only affected by the per-directory configuration change, and "On Save" is disabled for files therein.

This seems like a pretty optimal workflow option. The per-directory configuration seems like it would be valuable in other aspects too.

Whether the per-directory configuration is stored *in* the affected directory, or in the nbproject metadata directory is open to discussion of course.