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 154675 - Indentation Settings Based on File Types
Summary: Indentation Settings Based on File Types
Status: RESOLVED WORKSFORME
Alias: None
Product: editor
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-05 07:31 UTC by nabing
Modified: 2015-04-06 20:10 UTC (History)
1 user (show)

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 nabing 2008-12-05 07:31:50 UTC
Netbeans needs to support indentation settings based on file types. As of version 6.5 you can only set *global*
indentation settings for tab size, spaces per indent, expand tabs to spaces. Different file types have different
indentation conventions. For example (based on conventions I am currently using):

Python:
tab size: 4
spaces per indent: 4
expand tabs to spaces: true

Ruby:
tab size: 2
spaces per indent: 2
expand tabs to spaces: true

PHP:
tab size: 8
spaces per indent: 8
expand tabs to spaces: false

C and C++:
tab size: 8
spaces per indent: 8
expand tabs to spaces: false

HTML:
tab size: 2
spaces per indent: 2
expand tabs to spaces: true

CSS:
tab size: 4
spaces per indent: 4
expand tabs to spaces: true

Javascript:
tab size: 8
spaces per indent: 8
expand tabs to spaces: false

Being able to customize indentation settings based on file types is the first thing I look for when trying out an IDE or
text editor. Customizable text editors such as Vim and Emacs have this feature. If you open a Python file, the
indentation settings for Python are used. If you open a PHP file the indentation settings for PHP are used.

What would make this feature really useful is to also be able to save these settings on a per-project basis. Different
projects might have different indentation conventions despite the fact that there is already a convention for the
language that the project uses.

Additionally, it would also be nice to be able to copy settings from another language. C and C++ indentation settings
can be copied to Javascript indentation settings.

Lastly, it would also be nice to be able to override editor settings altogether using Emacs or Vim style mode lines.
Comment 1 Jiri Prox 2008-12-05 08:24:41 UTC
The language specific formatting setting are already implemented, if you don't have setting for language you're
expecting, please file an issue against related module (e.g cnd, javascript, ...)

Per project formatting setting are also implemented, see project properties
Comment 2 nabing 2008-12-05 08:48:32 UTC
Ah, I see it. So this is a module-dependent thing. Is there no way to make this standardized? I see that CND module does
it's own thing when it comes to formatting settings. Python module does not seem to have indentation settings yet. The
best one I have seen is for Java which provides a "Override Global Options" check box and it would be nice if it was a
standard for all module implementations, e.g. new programming language module automatically have this configuration option.
Comment 3 brettryan 2009-06-04 18:40:34 UTC
I would also like to see this support, especially for HTML and XML based content.

Can modeline support be added allowing each file to contain the required tabstop etc? I work on a 4GL system where we
have a rule that the author of the original program determines the tabstop, someone modifying that program must comply
to their rules, we achieve this through VIM modelines.

Comment 4 markiewb 2015-04-06 20:10:55 UTC
(In reply to nabing from comment #2)
> Ah, I see it. So this is a module-dependent thing. Is there no way to make
> this standardized? 

Resolve a worksforme NB8.0.2

At Options|Editor|Formatting|Language there is a setting for "All languages", where you can set tab size,spaces per indent,expand tabs to spaces...