Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322326 - Auto code insert does not honour user whitespace settings
Summary: Auto code insert does not honour user whitespace settings
Status: CLOSED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.7   Edit
Hardware: All Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-11 05:25 EDT by Timothy Mowlem CLA
Modified: 2010-08-11 13:05 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Mowlem CLA 2010-08-11 05:25:02 EDT
Build Identifier: 3.7.0 Build id: I20100805-1700

I have Eclipse set to use tabs instead of spaces (my choice) in the preferences (General->Editors->Text Editors, tab width is 4 and "Insert Spaces for Tabs" is unchecked). Yet when code is automatically added by Eclipse (e.g. when an error is shown and I select a suggested fix which adds code) then the code inserted completely ignores my tabs preference and uses spaces.

Code added by Eclipse should honour the formatting and whitespace options that are in effect.

An example is when a piece of code in a try block trows an exception with no catch defined. It shows as an error. However over and a quick fix option is add catch clause. This inserts a catch clause and block but the inserted code has spaces before the inserted lines. this is REALLY ANNOYING as I have to go through and hand change them all to tabs.

Reproducible: Always

Steps to Reproduce:
1. Set prefs to use tabs not spaces
2. Perform an action that causes Eclipse to add code automatically
3. Spend all day laboriously hand changing it to what you said you wanted in the first place
4. Grow old quickly and die young as an embittered shell of a person!
Comment 1 Timothy Mowlem CLA 2010-08-11 05:25:44 EDT
Is like this in all versions prior to and including 3.7M1
Comment 2 Remy Suen CLA 2010-08-11 05:50:03 EDT
If you set your Java formatter to use spaces, this shouldn't be a problem.
Comment 3 Markus Keller CLA 2010-08-11 06:27:55 EDT
You changed the settings for plain text editors. The Java editor has many more formatting options, and those have to be configured in Java > Code Style > Formatter.
Comment 4 Timothy Mowlem CLA 2010-08-11 13:05:03 EDT
Apologies but I missed the "Use spaces to indent wrapped lines" checkbox in the formatter indentation options. Having unchecked this it seems to work okay.