*Fix extended tab completion for l3d, linear, mask patterns

This commit is contained in:
Jesse Boyd 2016-12-09 02:03:46 +11:00
parent 551b25baf6
commit 502b620bde
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 6 additions and 5 deletions

View File

@ -34,8 +34,9 @@ public class SuggestInputParseException extends InputParseException {
return MainUtil.prepend(prefix, suggestions);
}
public void prepend(String input) {
public SuggestInputParseException prepend(String input) {
this.prefix = input + prefix;
return this;
}
public static SuggestInputParseException get(Throwable e) {

View File

@ -162,7 +162,7 @@ public class HashTagPatternParser extends InputParser<Pattern>{
if (len != 3) {
if (len <= 3) {
if (split3.get(len - 1).endsWith(":")) {
throw new SuggestInputParseException(null, ALL_PATTERNS);
throw new SuggestInputParseException(null, ALL_PATTERNS).prepend(input);
}
String[] args = new String[]{"<mask>", "<pattern-if>", "<pattern-else>"};
throw new SuggestInputParseException(input, input + ":" + StringMan.join(Arrays.copyOfRange(args, len, 3), ":"));
@ -240,7 +240,7 @@ public class HashTagPatternParser extends InputParser<Pattern>{
patterns.add(catchSuggestion(input, token, context));
}
if (patterns.isEmpty()) {
throw new SuggestInputParseException(null, ALL_PATTERNS);
throw new SuggestInputParseException(null, ALL_PATTERNS).prepend(input);
}
return new LinearBlockPattern(patterns.toArray(new Pattern[patterns.size()]));
}
@ -251,12 +251,12 @@ public class HashTagPatternParser extends InputParser<Pattern>{
patterns.add(catchSuggestion(input, token, context));
}
if (patterns.isEmpty()) {
throw new SuggestInputParseException(null, ALL_PATTERNS);
throw new SuggestInputParseException(null, ALL_PATTERNS).prepend(input);
}
return new Linear3DBlockPattern(patterns.toArray(new Pattern[patterns.size()]));
}
default:
throw new SuggestInputParseException(split2[0], DELEGATE_PATTERNS);
throw new SuggestInputParseException(input, DELEGATE_PATTERNS);
}
}
throw new SuggestInputParseException(input, MainUtil.joinArrayGeneric(SIMPLE_PATTERNS, DELEGATE_PATTERNS));