When formatting proto files, remove space after opening brackets and before closing brackets.
Change-Id: I87313f46afc3adc345840c6ac9c5290174d3baf9
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/formatting/ProtobufFormatter_Test.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/formatting/ProtobufFormatter_Test.java
index f154b68..f18c15a 100644
--- a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/formatting/ProtobufFormatter_Test.java
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/formatting/ProtobufFormatter_Test.java
@@ -155,6 +155,17 @@
assertThatFormattingWorksCorrectly();
}
+ // message Person {
+ // map < string, string > m = 1;
+ // }
+
+ // message Person {
+ // map <string, string> m = 1;
+ // }
+ @Test public void should_format_map() {
+ assertThatFormattingWorksCorrectly();
+ }
+
// syntax = "proto" // version on next line
// '3';
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/formatting/ProtobufFormatter.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/formatting/ProtobufFormatter.java
index e1115a6..6cb6f71 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/formatting/ProtobufFormatter.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/formatting/ProtobufFormatter.java
@@ -79,5 +79,11 @@
for (Keyword k : g.findKeywords(CLOSING_BRACKET.toString(), ")")) {
c.setNoSpace().before(k);
}
+ for (Keyword k : g.findKeywords(OPENING_BRACKET.toString(), "<")) {
+ c.setNoSpace().after(k);
+ }
+ for (Keyword k : g.findKeywords(CLOSING_BRACKET.toString(), ">")) {
+ c.setNoSpace().before(k);
+ }
}
}