| Summary: | Extension point "org.eclipse.cdt.core.CodeFormatter" fails to engage with custom code formatter | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Haroogan <Haroogan> |
| Component: | cdt-core | Assignee: | Project Inbox <cdt-core-inbox> |
| Status: | RESOLVED WORKSFORME | QA Contact: | Doug Schaefer <cdtdoug> |
| Severity: | normal | ||
| Priority: | P3 | CC: | aleherb+eclipse |
| Version: | 8.0.1 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Haroogan
This works for me. Just tried with the Astyle Eclipse plugin from http://astyleclipse.sourceforge.net/ Can you provide your custom formatter plugin? (In reply to comment #1) > This works for me. Just tried with the Astyle Eclipse plugin from > http://astyleclipse.sourceforge.net/ > > Can you provide your custom formatter plugin? No problem, here you go: [http://dl.dropbox.com/u/43869765/ru.haroogan.astyle.rar] NOTE: ***Windows x86 only for now*** Instructions: 1. Open "Window -> Preferences -> AStyle Preference Page" and select "Options.txt" as "Options File"; 2. Go to "Window -> Preferences -> C/C++ -> Code Style" and switch to "AStyle Code Formatter"; 3. Test. I'm keen to learn what causes the issue! ;) P. S. One more thing to consider: [https://bugs.eclipse.org/bugs/show_bug.cgi?id=309787] Maybe CDT's CodeFormatter has the same fate? (In reply to comment #2) > One more thing to consider: > [https://bugs.eclipse.org/bugs/show_bug.cgi?id=309787] > Maybe CDT's CodeFormatter has the same fate? There are no plans to deprecate this extension point. I tried your plugin, but there is a problem loading the DLL. It cannot find a few dependent libraries. Still I could verify that your formatter gets called both for the preview and also using Ctrl+Shift+F, because it throws this exception (which is a consequence of the DLL loading issue). java.lang.NoClassDefFoundError: Could not initialize class ru.haroogan.astyle.AStyleInterface at ru.haroogan.astyle.AStyleCodeFormatter.format(AStyleCodeFormatter.java:27) at org.eclipse.cdt.internal.corext.util.CodeFormatterUtil.format(CodeFormatterUtil.java:129) at org.eclipse.cdt.internal.ui.text.CFormattingStrategy.format(CFormattingStrategy.java:62) at org.eclipse.jface.text.formatter.MultiPassContentFormatter.formatMaster(MultiPassContentFormatter.java:193) at org.eclipse.jface.text.formatter.MultiPassContentFormatter.format(MultiPassContentFormatter.java:142) at org.eclipse.cdt.internal.ui.preferences.formatter.TranslationUnitPreview.doFormatPreview(TranslationUnitPreview.java:68) at org.eclipse.cdt.internal.ui.preferences.formatter.CPreview.update(CPreview.java:161) at org.eclipse.cdt.internal.ui.preferences.formatter.CodeFormatterConfigurationBlock$PreviewController.update(CodeFormatterConfigurationBlock.java:52) Sorry for that, here you go, the dependencies: [http://dl.dropbox.com/u/43869765/Dependency.rar] Sorry for that, please re-download: [http://dl.dropbox.com/u/43869765/ru.haroogan.astyle.rar] I have rebuilt DLL to mitigate dependencies. Hope this works now! Update: I've noticed that it works, but only when I switch from [built-in] to custom formatter SPECIFICALLY in some project's "Code Style" settings. Therefore, now I have a reasonable question: why having custom formatter in global "Code Style" settings has no effect? - Actually, it looks like a bug. (In reply to comment #6) > Update: I've noticed that it works, but only when I switch from [built-in] to > custom formatter SPECIFICALLY in some project's "Code Style" settings. > > Therefore, now I have a reasonable question: why having custom formatter in > global "Code Style" settings has no effect? - Actually, it looks like a bug. As soon as you specify project specific settings in your project properties, the workspace settings have no effect for that project. I think that's reasonable. Works as designed. |