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

Bug 546439

Summary: Project-specific java indent level config not working
Product: [Eclipse Project] JDT Reporter: Phil Adams <padamstx>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: mateusz.matela
Version: 4.8   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Phil Adams CLA 2019-04-15 11:51:11 EDT
I have a default set of Java code formatter settings configured for all projects where the indent level is 4. I also have a project-specific setting of 2 configured for a single project.   Unfortunately, for that project eclipse is still using an indent level of 4.

If I change my global code formatter settings to use the project-specific set, then all projects start to use indent level 2 (as I would expect).   But, I want the global setting to be 4, except for the one specific project where I have the indent level set to 2.   But this is not working.

I'm using Eclipse Photon (v4.8) which includes version 3.14.0.v20180611-0500 of "Eclipse Java Development Tools".
Comment 1 Mateusz Matela CLA 2019-04-28 08:48:37 EDT
Does it affect any other settings or only indentation level?
And what do you mean by that: "indention size", "tab size" or "default indentation for wrapped lines"?

Can you try with the newest version?
And also with a clean installation and a fresh workspace to make sure it's not caused by some plugins?
Comment 2 Phil Adams CLA 2019-04-30 09:59:49 EDT
I installed a fresh copy of eclipse (2019-03) and then created two projects ("indent2" and "indent4") in a new workspace. Everything seemed to work correctly in terms of the indent level of each project.  
I set my *global* code formatter settings (imported from my other eclipse installation) such that the indentation size is 4 spaces.   I then re-formatted the test java class in each of the two projects mentioned above and 4 spaces were correctly used for the indentation.
I then modified the project settings for the "indent2" project such that the indentation size is 2 spaces instead of 4.   I then re-formatted the test java class in that project and it changed the formatting to use 2 spaces instead of 4, as expected.

So... it looks like something else must be at play here.   I'll just migrate my projects forward to this version of eclipse and create new workspaces, etc.

Thanks for looking into this.
Comment 3 Phil Adams CLA 2019-04-30 10:00:37 EDT
Closing as I can't reproduce this is a clean environment on eclipse 2019-03.
Comment 4 Phil Adams CLA 2019-04-30 10:47:07 EDT
Follow-up...  After trying unsuccessfully to reproduce this in a clean workspace on the 2019-03 version of eclipse, I went ahead and opened up the 2019-03 version on my existing workspace where I originally encountered the problem, and everything seems to work fine there now.   So, perhaps something was fixed between the Photon and 2019-03 releases.