eclipse-archived / ceylon.formatter

A formatter for the Ceylon programming language, written in Ceylon.
Apache License 2.0
14 stars 11 forks source link

Dogfooding #29

Closed lucaswerkmeister closed 10 years ago

lucaswerkmeister commented 10 years ago

Format the formatter with itself.

lucaswerkmeister commented 10 years ago

As of c78f371, dogfooding is almost achieved! This was the only difference between the once and twice formatted versions:

diff --git a/source/ceylon/formatter/Patterns.ceylon b/source/ceylon/formatter/Patterns.ceylon
index 51342a8..5aa8f2f 100644
--- a/source/ceylon/formatter/Patterns.ceylon
+++ b/source/ceylon/formatter/Patterns.ceylon
@@ -17,7 +17,6 @@ import ceylon.interop.java {
 // TODO
 // remove assertions before release; they’re probably useful for finding bugs,
 // but impact performance negatively
-
 FormattingWriter.FormattingContext writeBacktickOpening(FormattingWriter writer, Token backtick) {
     assert (backtick.text == "`");
     value context = writer.writeToken {

Original code has two blank lines, each pass removes one blank line.

lucaswerkmeister commented 10 years ago

And as of 137dd05, dogfooding works – the formatter can format itself, and a second run introduces no further changes. Woo!

Now I’ll review the changes that the formatter introduces, probably fix a few uglinesses, and then make a commit with the formatted code that will close this issue.

lucaswerkmeister commented 10 years ago

And after that, my commit workflow should probably be

git commit
ceylon run ceylon.formatter source
git diff # verify that changes are okay
git commit -a --amend --no-edit

3?

lucaswerkmeister commented 10 years ago

Okay, I’ve looked through the diff, opened a few issues with Milestone “Dogfooding”, and when these get fixed, we should be good to go.

lucaswerkmeister commented 10 years ago

It’s done. Woo!

And I gotta say, looking at the changes that 9e8d84e introduces, there were some silly formatting mistakes in my code (trailing space, missing or extraneous spaces in assert (, stuff like that)… goes to demonstrate why this formatter is necessary after all :D

gavinking commented 10 years ago

Congrats!

When are we going to integrate it into the IDE?

lucaswerkmeister commented 10 years ago

I suppose that’s the next step now… I’ve created a milestone for any issues that pop up, and given you and David access to the repository, in case you want to change something directly.