Closed gavinking closed 10 years ago
All tabs and fields done - I am in Git hell right now. I rebased from master and did not rebase your changes to the formatter-profiles
branch. Will push it shortly.
@lucaswerkmeister : Will you be able to add the hook into the FormatAction
to load the selected profile: There are static methods in CeylonStyle that can do that.
Sure.
Okay, I cherry-picked all commits on formatter-profiles
that weren’t already in master
onto master
in the new branch formatter-profiles-rebase
(with a small change to your latest commit because it used createPreviewHeader()
, which I removed in e559615f9b0a0a8a6f87bd1ab41156223a3445e4).
Yes, I have removed that now :) Thanks. I have pushed everything I have.
I will rebuild IDE plugin and continue in about 4 hours.
I can’t build it right now because FormatterTabMisc
is missing.
Ooops. Pushed now. I will continue comparing and fixing after build.
@lucaswerkmeister Updated FormatterPreferences as well - was left from merge. I believe merge complete now.
Okay, I updated formatter-profiles-rebase
as well. I don’t think we should merge formatter-profiles
as it is now because it contains loads of double commits…
I’ll build now and check it out.
I get an “Unhandled event loop exception” trying to edit profiles now…
java.lang.ClassCastException: ceylon.formatter.options.parseFormattingOption_$2 cannot be cast to [Ljava.lang.String; at com.redhat.ceylon.eclipse.code.style.FormatterPreferences.get(FormatterPreferences.java:240) at com.redhat.ceylon.eclipse.code.style.FormatterTabPage$StringPreference.updateWidget(FormatterTabPage.java:607) at com.redhat.ceylon.eclipse.code.style.FormatterTabPage$StringPreference.
(FormatterTabPage.java:535) at com.redhat.ceylon.eclipse.code.style.FormatterTabPage.createStringPref(FormatterTabPage.java:976) at com.redhat.ceylon.eclipse.code.style.FormatterTabMisc.doCreatePreferences(FormatterTabMisc.java:54) at com.redhat.ceylon.eclipse.code.style.FormatterTabPage.createContents(FormatterTabPage.java:823) at com.redhat.ceylon.eclipse.code.style.FormatterModifyProfileDialog.addTabPage(FormatterModifyProfileDialog.java:252) at com.redhat.ceylon.eclipse.code.style.FormatterModifyProfileDialog.addPages(FormatterModifyProfileDialog.java:82) at com.redhat.ceylon.eclipse.code.style.FormatterModifyProfileDialog.createDialogArea(FormatterModifyProfileDialog.java:130) at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:768) ...
This is the last field on the misc tab probably, see issue above. If you want to release today, please take out the inline annotations from the misc tab. Then we can close this issue and open that as another issue to add that field.
Yes. Please merge your new branch with master. I had to skip rebase and merge and re commit on the foematter-profiles branch to get your changea
I fixed the inline annotations joining (5bae6883acfdbcc354614b2efc4854bea1c9fe2d), but now I get another error:
java.lang.NullPointerException at com.redhat.ceylon.eclipse.code.style.FormatterTabPage.doUpdatePreview(FormatterTabPage.java:96) at com.redhat.ceylon.eclipse.code.style.FormatterTabMisc.doUpdatePreview(FormatterTabMisc.java:103) at com.redhat.ceylon.eclipse.code.style.FormatterTabPage$1.update(FormatterTabPage.java:102)
Take it out :) Default value is good until 1.2. I will only have time tonight (Eastern Time Zone)
Take what out? Default value for what? I don’t think this is related to the inline annotations.
Apparently, for FormatterTabMisc
, doCreatePreviewPane()
isn’t called, so in doUpdatePreview()
fPreview
is still null
.
Ah, no, it is actually related to inline annotations – because the preference is updated after creation, when a listener is registered, which then wants to update the preview, which doesn’t exist yet because we’re still initializing.
Okay, fixed as well. There’s still a small problem – if you check “all” (annotations) and reopen the config, it’s unchecked and the annotations string pref now contains [Ljava.lang.String;@abcdef
, but at least it can be opened :)
Whew, that was a hairy fix, including a runtime subtyping check bug :( but now it works!
Yes, I was stuck on this last night.
Great stuff!! You take the lead and let me know what you want me to add or change. Update the sample code?
Unrelated to formatter, but I will add hooks to the new module wizard for author name and version number (variables just to fill in the Style tab that makes room for formatter tab under it..
Okay, I think I’m done for now! The only two remaining problems I have:
CeylonStyle
saves the used profile in style.formatterProfile
in a separate file, while the CLI formatter tool uses the profile from formattool.profile
in the default config file. I think the IDE should use the same option as the CLI.How about we take out the main Style tab (with the author version) and the .ceylon/style
file out. It was just a placeholder for a project properties page, and when we have some real style options, we can bring that back in if needed.
@lucaswerkmeister , @quintesse What should the nesting structure for project properties?
- Ceylon Formatter
- Ceylon Compiler
-- Build Paths
-- Module Repositories
-- OR --
- Ceylon
-- Compiler Build Paths
-- Module Repositories
-- Formatter Profiles
How about we take out the main Style tab
Yeah, that might be better for now.
What should the nesting structure for project properties?
Java / JDT has four toplevel property “pages”(?), but I don’t see why that would be an advantage… toplevel Ceylon seems more natural to me.
I think @gavinking might have a stronger opinion on that than I do. Personally I'd probably copy Java's example, but I have no strong feelings about it.
I took the liberty of calling the top-level 'Ceylon Configuration' for that is literally what the four tabs do - update the Ceylon configuration for the project. Please change text in plugin.xml if needed.
I think we are ready to merge with master.
Bug: does not switch config value for profile back to default. Looking into it. But go ahead with merge.
@akberc I think I’ve found the bug:
public boolean performApply() {
try {
if (fFormatterProfileManager.getSelected() != null
&& fFormatterProfileManager.getSelected().getName() != "default"
&& fFormatterProfileManager.getSelected().getName() != "unnamed") {
CeylonStyle.writeProfileToFile(fFormatterProfileManager
.getSelected(), project.getLocation().toFile());
CeylonStyle.setFormatterProfile(project,
fFormatterProfileManager.getSelected().getName());
}
You still need to set the formatter profile even if it’s the default. (But it’s probably correct that you don’t have to write it.) FormatterConfigurationBlock.java
, around line 570.
How about we take out the main Style tab
Yeah, that might be better for now.
Yes, please get rid of it. We don't want a page with one text field on it.
@lucaswerkmeister Bug fixed - and made the values constants for safety
Works great now, thanks a lot @akberc!
Done!! Thanks a lot @akberc for all your work here!
No worries. Thank you for testing, input and making the options variable! Sorry for being a bit late on this.
On another note, Github Windows client seem to have clobbered the plugin.xml
git history on push, showing the whole file as replaced.
I will delete branch formatter-profiles
- the original branch I was committing to.
Alright, so thanks so much, @akberc and @lucaswerkmeister, this is overall actually really well done. I've cleaned the presentation of some of the options a little, but those were really very small changes.
Great work!
We need a way to configure the formatter.
So a properties file type thing would be a great start, though I suppose we will eventually want a GUI for it.