Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331426 - Code Style formatted contribution in a product
Summary: Code Style formatted contribution in a product
Status: ASSIGNED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 8.0   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2010-11-30 08:43 EST by Rudolf Hornig CLA
Modified: 2020-09-04 15:25 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rudolf Hornig CLA 2010-11-30 08:43:23 EST
Build Identifier: 7.0.1

Adding new built-in profiles using athe plugin_customization.ini is not working as expected: the org.eclipse.cdt.ui/org.eclipse.cdt.ui.formatterprofiles should contain now the FULL profile on a single line. Instead of this, it would be better to specify the URL to the file i.e something like:

org.eclipse.cdt.ui/org.eclipse.cdt.ui.formatterprofiles=product:contributed_profiles.xml

At the moment the whole XML file must be pasted into the INI file.

Reproducible: Always
Comment 1 James Blackburn CLA 2010-11-30 08:50:04 EST
> is not working as expected ...

That's generally how customisation ini files work.  Patches are always appreciated.
Comment 2 James Blackburn CLA 2010-11-30 09:36:07 EST
It's actually worse than this, you must also set the cdt.core formatter properties individually to match your default profile:

org.eclipse.cdt.core/org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.cdt.core/org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
org.eclipse.cdt.core/org.eclipse.cdt.core.formatter.alignment_for_compact_if=0
org.eclipse.cdt.core/org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.cdt.core/org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
org.eclipse.cdt.core/org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
etc.

If I remember correctly these settings are only updated when the user changes profile, and aren't correctly initialised to the settings defined by the formatter profile.
Comment 3 Hans-Erik Floryd CLA 2011-07-18 13:21:52 EDT
(In reply to comment #2)
> It's actually worse than this, you must also set the cdt.core formatter
> properties individually to match your default profile:

[...]
> If I remember correctly these settings are only updated when the user changes
> profile, and aren't correctly initialised to the settings defined by the
> formatter profile.

I have been trying to add a new coding style and can verify that this is true. The coding style I set via:

org.eclipse.cdt.ui/org.eclipse.cdt.ui.formatterprofiles=[xml for myprofile]
org.eclipse.cdt.ui/formatter_profile=myprofile

is set as default in the Code Style preference dialog, but the settings don't take effect unless I select another coding style, and then revert back to the myprofile.

So it appears that the only way to get it work is to also set the cdt.core formatter properties? Should this be a new bug?