The Unified and Autonomous Development Platform
Hide suggestion menu if it only contains the same suggestion as input to make it easier to use
robin shenc48dd5e306e4
diff --git a/web/src/main/java/com/gitplex/server/web/behavior/BranchPatternAssistBehavior.java b/web/src/main/java/com/gitplex/server/web/behavior/BranchPatternAssistBehavior.javaindex b651a5df70..10d84683c6 100644--- a/web/src/main/java/com/gitplex/server/web/behavior/BranchPatternAssistBehavior.java+++ b/web/src/main/java/com/gitplex/server/web/behavior/BranchPatternAssistBehavior.java@@ -31,10 +31,10 @@ public class BranchPatternAssistBehavior extends InputAssistBehavior {}@Override- protected List<InputCompletion> getSuggestions(InputStatus inputStatus, int count) {+ protected List<InputCompletion> getSuggestions(InputStatus inputStatus) {List<InputCompletion> completions = new ArrayList<>();for (InputSuggestion suggestion: SuggestionUtils.suggestBranch(depotModel.getObject(),- inputStatus.getContentBeforeCaret().trim(), count)) {+ inputStatus.getContentBeforeCaret().trim())) {int caret = suggestion.getCaret();if (caret == -1)caret = suggestion.getContent().length();diff --git a/web/src/main/java/com/gitplex/server/web/behavior/PathPatternAssistBehavior.java b/web/src/main/java/com/gitplex/server/web/behavior/PathPatternAssistBehavior.javaindex 8af7369b11..6f3037eece 100644--- a/web/src/main/java/com/gitplex/server/web/behavior/PathPatternAssistBehavior.java+++ b/web/src/main/java/com/gitplex/server/web/behavior/PathPatternAssistBehavior.java@@ -31,10 +31,10 @@ public class PathPatternAssistBehavior extends InputAssistBehavior {}@Override- protected List<InputCompletion> getSuggestions(InputStatus inputStatus, int count) {+ protected List<InputCompletion> getSuggestions(InputStatus inputStatus) {List<InputCompletion> completions = new ArrayList<>();for (InputSuggestion suggestion: SuggestionUtils.suggestPath(depotModel.getObject(),- inputStatus.getContentBeforeCaret().trim(), count)) {+ inputStatus.getContentBeforeCaret().trim())) {int caret = suggestion.getCaret();if (caret == -1)caret = suggestion.getContent().length();diff --git a/web/src/main/java/com/gitplex/server/web/behavior/TagPatternAssistBehavior.java b/web/src/main/java/com/gitplex/server/web/behavior/TagPatternAssistBehavior.javaindex 2d86e44ca5..b077af2885 100644--- a/web/src/main/java/com/gitplex/server/web/behavior/TagPatternAssistBehavior.java+++ b/web/src/main/java/com/gitplex/server/web/behavior/TagPatternAssistBehavior.java@@ -31,10 +31,10 @@ public class TagPatternAssistBehavior extends InputAssistBehavior {}@Override- protected List<InputCompletion> getSuggestions(InputStatus inputStatus, int count) {+ protected List<InputCompletion> getSuggestions(InputStatus inputStatus) {List<InputCompletion> completions = new ArrayList<>();for (InputSuggestion suggestion: SuggestionUtils.suggestTag(depotModel.getObject(),- inputStatus.getContentBeforeCaret().trim(), count)) {+ inputStatus.getContentBeforeCaret().trim())) {int caret = suggestion.getCaret();if (caret == -1)caret = suggestion.getContent().length();diff --git a/web/src/main/java/com/gitplex/server/web/behavior/inputassist/ANTLRAssistBehavior.java b/web/src/main/java/com/gitplex/server/web/behavior/inputassist/ANTLRAssistBehavior.javaindex 67759eb423..ad31d5dec1 100644--- a/web/src/main/java/com/gitplex/server/web/behavior/inputassist/ANTLRAssistBehavior.java+++ b/web/src/main/java/com/gitplex/server/web/behavior/inputassist/ANTLRAssistBehavior.java@@ -66,8 +66,8 @@ public abstract class ANTLRAssistBehavior extends InputAssistBehavior {codeAssist = new CodeAssist(lexerClass, grammarFiles, tokenFile) {@Override- protected List<InputSuggestion> suggest(ParentedElement element, String matchWith, int count) {- return ANTLRAssistBehavior.this.suggest(element, matchWith, count);+ protected List<InputSuggestion> suggest(ParentedElement element, String matchWith) {+ return ANTLRAssistBehavior.this.suggest(element, matchWith);}@Override@@ -94,8 +94,8 @@ public abstract class ANTLRAssistBehavior extends InputAssistBehavior {}@Override- protected List<InputCompletion> getSuggestions(InputStatus inputStatus, int count) {- return codeAssist.suggest(inputStatus, ruleName, count);+ protected List<InputCompletion> getSuggestions(InputStatus inputStatus) {+ return codeAssist.suggest(inputStatus, ruleName);}protected int getEndOfMatch(ElementSpec spec, String content) {@@ -217,7 +217,7 @@ public abstract class ANTLRAssistBehavior extends InputAssistBehavior {}}- protected abstract List<InputSuggestion> suggest(ParentedElement element, String matchWith, int count);+ protected abstract List<InputSuggestion> suggest(ParentedElement element, String matchWith);@Overrideprotected final List<String> getHints(InputStatus inputStatus) {diff --git a/web/src/main/java/com/gitplex/server/web/behavior/inputassist/AssistPanel.java b/web/src/main/java/com/gitplex/server/web/behavior/inputassist/AssistPanel.javaindex 2234457074..efb21e0af4 100644--- a/web/src/main/java/com/gitplex/server/web/behavior/inputassist/AssistPanel.java+++ b/web/src/main/java/com/gitplex/server/web/behavior/inputassist/AssistPanel.java@@ -19,18 +19,20 @@ import com.gitplex.server.web.behavior.infinitescroll.InfiniteScrollBehavior;@SuppressWarnings("serial")class AssistPanel extends Panel {- private final InputAssistBehavior assistBehavior;+ private static final int PAGE_SIZE = 25;- private final InputStatus inputStatus;+ private final Component input;- private final List<InputCompletion> suggestions;+ private final InputStatus inputStatus;private final List<String> hints;- public AssistPanel(String id, InputAssistBehavior assistBehavior, InputStatus inputStatus,- List<InputCompletion> suggestions, List<String> hints) {+ private final List<InputCompletion> suggestions;++ public AssistPanel(String id, Component input, InputStatus inputStatus, List<InputCompletion> suggestions,+ List<String> hints) {super(id);- this.assistBehavior = assistBehavior;+ this.input = input;this.inputStatus = inputStatus;this.hints = hints;this.suggestions = suggestions;@@ -44,18 +46,19 @@ class AssistPanel extends Panel {add(suggestionsContainer);RepeatingView suggestionsView = new RepeatingView("suggestions");suggestionsContainer.add(suggestionsView);- for (InputCompletion suggestion: suggestions)- suggestionsView.add(newSuggestionItem(suggestionsView.newChildId(), suggestion));+ int count = 0;+ for (InputCompletion suggestion: suggestions) {+ if (++count <= PAGE_SIZE)+ suggestionsView.add(newSuggestionItem(suggestionsView.newChildId(), suggestion));+ }- suggestionsContainer.add(new InfiniteScrollBehavior(InputAssistBehavior.PAGE_SIZE) {+ suggestionsContainer.add(new InfiniteScrollBehavior(PAGE_SIZE) {@Overrideprotected void appendPage(AjaxRequestTarget target, int page) {- List<InputCompletion> suggestions = assistBehavior.getSuggestions(inputStatus, page*InputAssistBehavior.PAGE_SIZE);- int prevSize = (page-1)*InputAssistBehavior.PAGE_SIZE;- if (suggestions.size() > prevSize) {- List<InputCompletion> newSuggestions = suggestions.subList(prevSize, suggestions.size());- for (InputCompletion suggestion: newSuggestions) {+ for (int i=(page-1)*PAGE_SIZE; i<page*PAGE_SIZE; i++) {+ if (i < suggestions.size()) {+ InputCompletion suggestion = suggestions.get(i);Component suggestionItem = newSuggestionItem(suggestionsView.newChildId(), suggestion);suggestionsView.add(suggestionItem);String script = String.format("$('#%s .suggestions>table>tbody').append('<tr id=\"%s\"></tr>');",@@ -63,8 +66,10 @@ class AssistPanel extends Panel {target.prependJavaScript(script);target.add(suggestionItem);script = String.format("$('#%s').click(function() {$('#%s').data('update')($(this));});",- suggestionItem.getMarkupId(), assistBehavior.getInputField().getMarkupId());+ suggestionItem.getMarkupId(), input.getMarkupId());target.appendJavaScript(script);+ } else {+ break;}}}diff --git a/web/src/main/java/com/gitplex/server/web/behavior/inputassist/InputAssistBehavior.java b/web/src/main/java/com/gitplex/server/web/behavior/inputassist/InputAssistBehavior.javaindex c2571501a5..56b29f24f8 100644--- a/web/src/main/java/com/gitplex/server/web/behavior/inputassist/InputAssistBehavior.java+++ b/web/src/main/java/com/gitplex/server/web/behavior/inputassist/InputAssistBehavior.java@@ -3,6 +3,7 @@ package com.gitplex.server.web.behavior.inputassist;import static org.apache.wicket.ajax.attributes.CallbackParameter.explicit;import java.util.ArrayList;+import java.util.Iterator;import java.util.List;import org.apache.wicket.Component;@@ -34,7 +35,7 @@ import com.google.common.base.Splitter;@SuppressWarnings("serial")public abstract class InputAssistBehavior extends AbstractPostAjaxBehavior {- static final int PAGE_SIZE = 25;+ public static final int MAX_SUGGESTIONS = 1000;private FloatingPanel dropdown;@@ -128,8 +129,20 @@ public abstract class InputAssistBehavior extends AbstractPostAjaxBehavior {target.appendJavaScript(script);if (inputCaret != null) {- final InputStatus inputStatus = new InputStatus(inputContent, inputCaret);- final List<InputCompletion> suggestions = getSuggestions(new InputStatus(inputContent, inputCaret), PAGE_SIZE);+ InputStatus inputStatus = new InputStatus(inputContent, inputCaret);+ List<InputCompletion> suggestions = getSuggestions(new InputStatus(inputContent, inputCaret));+ for (Iterator<InputCompletion> it = suggestions.iterator(); it.hasNext();) {+ InputCompletion suggestion = it.next();+ if (inputStatus.getContentBeforeCaret().equals(suggestion.getReplaceContent())) {+ it.remove();+ }+ }+ int count = 0;+ for (Iterator<InputCompletion> it = suggestions.iterator(); it.hasNext();) {+ it.next();+ if (++count > MAX_SUGGESTIONS)+ it.remove();+ }if (!suggestions.isEmpty()) {int anchor = getAnchor(inputContent.substring(0, inputCaret));if (dropdown == null) {@@ -137,8 +150,8 @@ public abstract class InputAssistBehavior extends AbstractPostAjaxBehavior {@Overrideprotected Component newContent(String id) {- return new AssistPanel(id, InputAssistBehavior.this, inputStatus,- suggestions, getHints(inputStatus));+ return new AssistPanel(id, getComponent(), inputStatus, suggestions,+ getHints(inputStatus));}@Override@@ -153,8 +166,8 @@ public abstract class InputAssistBehavior extends AbstractPostAjaxBehavior {target.appendJavaScript(script);} else {Component content = dropdown.getContent();- Component newContent = new AssistPanel(content.getId(), InputAssistBehavior.this,- inputStatus, suggestions, getHints(inputStatus));+ Component newContent = new AssistPanel(content.getId(), getComponent(), inputStatus,+ suggestions, getHints(inputStatus));content.replaceWith(newContent);target.add(newContent);@@ -180,10 +193,6 @@ public abstract class InputAssistBehavior extends AbstractPostAjaxBehavior {dropdown.close();}- Component getInputField() {- return super.getComponent();- }-@Overridepublic void renderHead(Component component, IHeaderResponse response) {super.renderHead(component, response);@@ -197,7 +206,7 @@ public abstract class InputAssistBehavior extends AbstractPostAjaxBehavior {response.render(OnDomReadyHeaderItem.forScript(script));}- protected abstract List<InputCompletion> getSuggestions(InputStatus inputStatus, int count);+ protected abstract List<InputCompletion> getSuggestions(InputStatus inputStatus);protected List<String> getHints(InputStatus inputStatus) {return new ArrayList<>();diff --git a/web/src/main/java/com/gitplex/server/web/component/diff/revision/RevisionDiffPanel.java b/web/src/main/java/com/gitplex/server/web/component/diff/revision/RevisionDiffPanel.javaindex 66b42dc17b..ebfbf44a05 100644--- a/web/src/main/java/com/gitplex/server/web/component/diff/revision/RevisionDiffPanel.java+++ b/web/src/main/java/com/gitplex/server/web/component/diff/revision/RevisionDiffPanel.java@@ -542,10 +542,10 @@ public class RevisionDiffPanel extends Panel {filterInput.add(new InputAssistBehavior() {@Override- protected List<InputCompletion> getSuggestions(InputStatus inputStatus, int count) {+ protected List<InputCompletion> getSuggestions(InputStatus inputStatus) {List<InputCompletion> completions = new ArrayList<>();for (InputSuggestion suggestion: SuggestionUtils.suggestPath(listOfInvolvedPaths,- inputStatus.getContentBeforeCaret().trim(), count)) {+ inputStatus.getContentBeforeCaret().trim())) {int caret = suggestion.getCaret();if (caret == -1)caret = suggestion.getContent().length();diff --git a/web/src/main/java/com/gitplex/server/web/component/reviewappointment/ReviewAppointmentAssistBehavior.java b/web/src/main/java/com/gitplex/server/web/component/reviewappointment/ReviewAppointmentAssistBehavior.javaindex 529feceec1..714551727c 100644--- a/web/src/main/java/com/gitplex/server/web/component/reviewappointment/ReviewAppointmentAssistBehavior.java+++ b/web/src/main/java/com/gitplex/server/web/component/reviewappointment/ReviewAppointmentAssistBehavior.java@@ -40,19 +40,19 @@ public class ReviewAppointmentAssistBehavior extends ANTLRAssistBehavior {}@Override- protected List<InputSuggestion> suggest(final ParentedElement expectedElement, String matchWith, int count) {+ protected List<InputSuggestion> suggest(final ParentedElement expectedElement, String matchWith) {if (expectedElement.getSpec() instanceof LexerRuleRefElementSpec) {LexerRuleRefElementSpec spec = (LexerRuleRefElementSpec) expectedElement.getSpec();if (spec.getRuleName().equals("Value")) {return new FenceAware(codeAssist.getGrammar(), VALUE_OPEN, VALUE_CLOSE) {@Override- protected List<InputSuggestion> match(String unfencedMatchWith, int count) {+ protected List<InputSuggestion> match(String unfencedMatchWith) {if (expectedElement.findParentByRule("userCriteria") != null) {return SuggestionUtils.suggestUser(depotModel.getObject(), DepotPrivilege.READ,- unfencedMatchWith, count);+ unfencedMatchWith);} else {- return SuggestionUtils.suggestTeam(depotModel.getObject(), unfencedMatchWith, count);+ return SuggestionUtils.suggestTeam(depotModel.getObject(), unfencedMatchWith);}}@@ -61,7 +61,7 @@ public class ReviewAppointmentAssistBehavior extends ANTLRAssistBehavior {return "value needs to be enclosed in brackets";}- }.suggest(expectedElement.getSpec(), matchWith, count);+ }.suggest(expectedElement.getSpec(), matchWith);} else if (spec.getRuleName().equals("DIGIT")) {List<InputSuggestion> suggestions = new ArrayList<>();suggestions.add(new InputSuggestion("1", "require one review from the team", null));diff --git a/web/src/main/java/com/gitplex/server/web/editable/filechoice/FileChoiceEditor.java b/web/src/main/java/com/gitplex/server/web/editable/filechoice/FileChoiceEditor.javaindex 05d75585e9..0ba099831f 100644--- a/web/src/main/java/com/gitplex/server/web/editable/filechoice/FileChoiceEditor.java+++ b/web/src/main/java/com/gitplex/server/web/editable/filechoice/FileChoiceEditor.java@@ -51,10 +51,10 @@ public class FileChoiceEditor extends PropertyEditor<String> {input.add(new InputAssistBehavior() {@Override- protected List<InputCompletion> getSuggestions(InputStatus inputStatus, int count) {+ protected List<InputCompletion> getSuggestions(InputStatus inputStatus) {List<InputCompletion> completions = new ArrayList<>();for (InputSuggestion suggestion: SuggestionUtils.suggestPath(choices,- inputStatus.getContentBeforeCaret().trim(), count)) {+ inputStatus.getContentBeforeCaret().trim())) {int caret = suggestion.getCaret();if (caret == -1)caret = suggestion.getContent().length();diff --git a/web/src/main/java/com/gitplex/server/web/page/depot/commit/QueryAssistBehavior.java b/web/src/main/java/com/gitplex/server/web/page/depot/commit/QueryAssistBehavior.javaindex 7f656fdf04..10e5b907f9 100644--- a/web/src/main/java/com/gitplex/server/web/page/depot/commit/QueryAssistBehavior.java+++ b/web/src/main/java/com/gitplex/server/web/page/depot/commit/QueryAssistBehavior.java@@ -51,24 +51,24 @@ public class QueryAssistBehavior extends ANTLRAssistBehavior {}@Override- protected List<InputSuggestion> suggest(ParentedElement expectedElement, String matchWith, int count) {+ protected List<InputSuggestion> suggest(ParentedElement expectedElement, String matchWith) {if (expectedElement.getSpec() instanceof LexerRuleRefElementSpec) {LexerRuleRefElementSpec spec = (LexerRuleRefElementSpec) expectedElement.getSpec();if (spec.getRuleName().equals("Value")) {return new FenceAware(codeAssist.getGrammar(), VALUE_OPEN, VALUE_CLOSE) {@Override- protected List<InputSuggestion> match(String unfencedMatchWith, int count) {+ protected List<InputSuggestion> match(String unfencedMatchWith) {int tokenType = expectedElement.getRoot().getLastMatchedToken().getType();String unfencedLowerCaseMatchWith = unfencedMatchWith.toLowerCase();List<InputSuggestion> suggestions = new ArrayList<>();Depot depot = depotModel.getObject();switch (tokenType) {case CommitQueryParser.BRANCH:- suggestions.addAll(SuggestionUtils.suggestBranch(depot, unfencedMatchWith, count));+ suggestions.addAll(SuggestionUtils.suggestBranch(depot, unfencedMatchWith));break;case CommitQueryParser.TAG:- suggestions.addAll(SuggestionUtils.suggestTag(depot, unfencedMatchWith, count));+ suggestions.addAll(SuggestionUtils.suggestTag(depot, unfencedMatchWith));break;case CommitQueryParser.AUTHOR:case CommitQueryParser.COMMITTER:@@ -88,11 +88,8 @@ public class QueryAssistBehavior extends ANTLRAssistBehavior {content = content.trim();PatternApplied applied = WildcardUtils.applyPattern(unfencedLowerCaseMatchWith, content,false);- if (applied != null) {+ if (applied != null)suggestedInputs.put(applied.getText(), applied.getMatchRange());- if (suggestedInputs.size() == count)- break;- }}for (Map.Entry<String, Range> entry: suggestedInputs.entrySet())@@ -104,21 +101,18 @@ public class QueryAssistBehavior extends ANTLRAssistBehavior {if (unfencedMatchWith.length() != 0) {String fenced = VALUE_OPEN + unfencedMatchWith + VALUE_CLOSE;Range matchRange = new Range(0, fenced.length());- if (suggestions.size() < count)- suggestions.add(new InputSuggestion(fenced, -1, true, getFencingDescription(), matchRange));+ suggestions.add(new InputSuggestion(fenced, -1, true, getFencingDescription(),+ matchRange));}- if (suggestions.size() < count)- suggestions.add(new InputSuggestion(WebConstants.DATETIME_FORMATTER.print(System.currentTimeMillis())));- if (suggestions.size() < count)- suggestions.add(new InputSuggestion(WebConstants.DATE_FORMATTER.print(System.currentTimeMillis())));+ suggestions.add(new InputSuggestion(WebConstants.DATETIME_FORMATTER.print(System.currentTimeMillis())));+ suggestions.add(new InputSuggestion(WebConstants.DATE_FORMATTER.print(System.currentTimeMillis())));for (String dateExample: DATE_EXAMPLES) {- if (suggestions.size() < count)- suggestions.add(new InputSuggestion(dateExample));+ suggestions.add(new InputSuggestion(dateExample));}}break;case CommitQueryParser.PATH:- suggestions.addAll(SuggestionUtils.suggestPath(depotModel.getObject(), unfencedMatchWith, count));+ suggestions.addAll(SuggestionUtils.suggestPath(depotModel.getObject(), unfencedMatchWith));break;}return suggestions;@@ -129,7 +123,7 @@ public class QueryAssistBehavior extends ANTLRAssistBehavior {return "value needs to be enclosed in parenthesis";}- }.suggest(expectedElement.getSpec(), matchWith, count);+ }.suggest(expectedElement.getSpec(), matchWith);}}return null;diff --git a/web/src/main/java/com/gitplex/server/web/util/SuggestionUtils.java b/web/src/main/java/com/gitplex/server/web/util/SuggestionUtils.javaindex f449789f82..8f4f3825a7 100644--- a/web/src/main/java/com/gitplex/server/web/util/SuggestionUtils.java+++ b/web/src/main/java/com/gitplex/server/web/util/SuggestionUtils.java@@ -21,18 +21,19 @@ import com.gitplex.server.security.SecurityUtils;import com.gitplex.server.security.privilege.DepotPrivilege;import com.gitplex.server.util.stringmatch.PatternApplied;import com.gitplex.server.util.stringmatch.WildcardUtils;+import com.gitplex.server.web.behavior.inputassist.InputAssistBehavior;import com.google.common.base.Preconditions;public class SuggestionUtils {- public static List<InputSuggestion> suggestBranch(Depot depot, String matchWith, int count) {+ public static List<InputSuggestion> suggestBranch(Depot depot, String matchWith) {String lowerCaseMatchWith = matchWith.toLowerCase();int numSuggestions = 0;List<InputSuggestion> suggestions = new ArrayList<>();for (RefInfo ref: depot.getBranches()) {String branch = GitUtils.ref2branch(ref.getRef().getName());int index = branch.toLowerCase().indexOf(lowerCaseMatchWith);- if (index != -1 && numSuggestions++<count) {+ if (index != -1 && numSuggestions++<InputAssistBehavior.MAX_SUGGESTIONS) {Range matchRange = new Range(index, index+lowerCaseMatchWith.length());suggestions.add(new InputSuggestion(branch, null, matchRange));}@@ -40,14 +41,14 @@ public class SuggestionUtils {return suggestions;}- public static List<InputSuggestion> suggestTag(Depot depot, String matchWith, int count) {+ public static List<InputSuggestion> suggestTag(Depot depot, String matchWith) {String lowerCaseMatchWith = matchWith.toLowerCase();int numSuggestions = 0;List<InputSuggestion> suggestions = new ArrayList<>();for (RefInfo ref: depot.getTags()) {String tag = GitUtils.ref2tag(ref.getRef().getName());int index = tag.toLowerCase().indexOf(lowerCaseMatchWith);- if (index != -1 && numSuggestions++<count) {+ if (index != -1 && numSuggestions++<InputAssistBehavior.MAX_SUGGESTIONS) {Range matchRange = new Range(index, index+lowerCaseMatchWith.length());suggestions.add(new InputSuggestion(tag, null, matchRange));}@@ -55,14 +56,14 @@ public class SuggestionUtils {return suggestions;}- public static List<InputSuggestion> suggestUser(Depot depot, DepotPrivilege privilege, String matchWith, int count) {+ public static List<InputSuggestion> suggestUser(Depot depot, DepotPrivilege privilege, String matchWith) {String lowerCaseMatchWith = matchWith.toLowerCase();int numSuggestions = 0;List<InputSuggestion> suggestions = new ArrayList<>();for (Account user: SecurityUtils.findUsersCan(depot, privilege)) {String name = user.getName();int index = name.toLowerCase().indexOf(lowerCaseMatchWith);- if (index != -1 && numSuggestions++<count) {+ if (index != -1 && numSuggestions++<InputAssistBehavior.MAX_SUGGESTIONS) {Range matchRange = new Range(index, index+lowerCaseMatchWith.length());suggestions.add(new InputSuggestion(name, matchRange));}@@ -70,14 +71,13 @@ public class SuggestionUtils {return suggestions;}- public static List<InputSuggestion> suggestTeam(Depot depot, String matchWith, int count) {+ public static List<InputSuggestion> suggestTeam(Depot depot, String matchWith) {String lowerCaseMatchWith = matchWith.toLowerCase();- int numSuggestions = 0;List<InputSuggestion> suggestions = new ArrayList<>();for (Team team: depot.getAccount().getDefinedTeams()) {String name = team.getName();int index = name.toLowerCase().indexOf(lowerCaseMatchWith);- if (index != -1 && numSuggestions++<count) {+ if (index != -1) {Range matchRange = new Range(index, index+lowerCaseMatchWith.length());suggestions.add(new InputSuggestion(name, matchRange));}@@ -85,9 +85,9 @@ public class SuggestionUtils {return suggestions;}- public static List<InputSuggestion> suggestPath(Depot depot, String matchWith, int count) {+ public static List<InputSuggestion> suggestPath(Depot depot, String matchWith) {CommitInfoManager commitInfoManager = GitPlex.getInstance(CommitInfoManager.class);- return suggestPath(commitInfoManager.getFiles(depot), matchWith, count);+ return suggestPath(commitInfoManager.getFiles(depot), matchWith);}private static Set<String> getChildren(List<PatternApplied> allApplied, String path) {@@ -105,7 +105,7 @@ public class SuggestionUtils {return children;}- public static List<InputSuggestion> suggestPath(List<String> files, String matchWith, int count) {+ public static List<InputSuggestion> suggestPath(List<String> files, String matchWith) {String lowerCaseMatchWith = matchWith.toLowerCase();List<InputSuggestion> suggestions = new ArrayList<>();@@ -146,7 +146,7 @@ public class SuggestionUtils {suggestedInput += suffix;}suggestedInputs.put(suggestedInput, matchRange);- if (suggestedInputs.size() == count)+ if (suggestedInputs.size() == InputAssistBehavior.MAX_SUGGESTIONS)break;}