Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 363647

Summary: [formatting] Insert spaces for tabs setting is not working within the Java text editor
Product: [Eclipse Project] JDT Reporter: Sheila Miguez <shekay>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, shekay
Version: 3.8   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
installation details none

Description Sheila Miguez CLA 2011-11-12 13:31:18 EST
Build Identifier: 20110916-0149

The spaces-for-tabs setting is not working within the Java text editor. Sometimes the editor inserts all tabs rather than spaces, sometimes it inserts spaces until it gets to the starting column of the block, followed by a tab. This happens differently depending on where the cursor is placed.

Reproducible: Always

Steps to Reproduce:
1. Start typing a new method in a java class. public void foo() {
2. Press return after the signature

Expected behavior:

Expect to see spaces all the way to where you'd expect the cursor to be.

Actual behavior:

Spaces appear until the starting column of the method, then a tab.
Comment 1 Sheila Miguez CLA 2011-11-12 13:34:24 EST
Created attachment 206894 [details]
installation details
Comment 2 Sheila Miguez CLA 2011-11-12 13:36:27 EST
I don't know if this happens in other perspectives. I opened a PyDev one and started editing a python file and didn't reproduce it when typing a new function; however, I don't typically use Eclipse when I edit python files, so I have not spent very much time working in this perspective. Perhaps if I had, I'd find cases where the insert setting was not honored.
Comment 3 Dani Megert CLA 2011-11-14 02:50:45 EST
The Java code formatting settings override this. Please check your formatter settings. If you still see the problem then please attach your formatter profile here and reopen the bug.
Comment 4 Sheila Miguez CLA 2011-11-14 09:48:25 EST
Thank you kindly!

I'm not sure why I wasn't seeing that behavior in earlier versions of eclipse. Maybe one of my plugins interacted with it to prevent that behavior. I use viPlugin, for example.