@@ -97,7 +97,7 @@ private static final void addSnippetsIfApplicable(LinkedCorrectionProposalCore p
9797 PositionInformation [] positionList = group .getPositions ();
9898 StringBuilder snippet = new StringBuilder ();
9999 snippet .append (SNIPPET_CHOICE_INDICATOR );
100- if (proposalList .length > 1 ) {
100+ if (proposalList .length > 0 ) {
101101 for (int i = 0 ; i < positionList .length ; i ++) {
102102 int offset = positionList [i ].getOffset ();
103103 int length = positionList [i ].getLength ();
@@ -113,11 +113,16 @@ private static final void addSnippetsIfApplicable(LinkedCorrectionProposalCore p
113113 snippet .append (((ReplaceEdit ) editWithText ).getText ());
114114 }
115115 }
116- // If snippet is empty or only has one choice , ignore this group
117- if (snippet .toString ().equals (String .valueOf (SNIPPET_CHOICE_INDICATOR )) || snippet . indexOf ( SNIPPET_CHOICE_DELIMITER ) == - 1 ) {
116+ // If snippet is empty, ignore this group
117+ if (snippet .toString ().equals (String .valueOf (SNIPPET_CHOICE_INDICATOR ))) {
118118 break ;
119119 }
120120 snippet .append (SNIPPET_CHOICE_POSTFIX );
121+ // If snippet only has one choice, remove choice indicators
122+ if (snippet .indexOf (SNIPPET_CHOICE_DELIMITER ) == -1 ) {
123+ snippet .setCharAt (0 , ':' );
124+ snippet .deleteCharAt (snippet .length () - 2 );
125+ }
121126 }
122127 snippets .add (new Triple (snippet .toString (), offset , length ));
123128 }
0 commit comments