Skip to content

Commit 954a473

Browse files
committed
WIP fix partial auto-complete behavior and sort
Sort autocompletions, since right now we don't have any heuristic ranking for them. Fix autocompletion insertion behavior after partial auto-insertion.
1 parent 5d8cc9a commit 954a473

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main/java/edu/umich/soar/visualsoar/ruleeditor/RuleEditor.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,6 +1777,8 @@ private void valueComplete(int pos, String userType, String prodSoFar) {
17771777
}
17781778
}
17791779
}
1780+
1781+
Collections.sort(completeMatches);
17801782
complete(pos, userType, completeMatches);
17811783
} catch (ParseException pe) {
17821784
getToolkit().beep();
@@ -1816,11 +1818,12 @@ private void complete(int pos, String userType, List<String> completeMatches) {
18161818
++curPos;
18171819
}
18181820
}
1819-
// TODO: hmmm, no I don't think so, let the user choose what to insert
1821+
// TODO: hmmm, if the user decides they don't want the completion after all, then they have to undo. Not super smooth.
18201822
EditingUtils.insert(editorPane.getDocument(), addedCharacters, pos);
1823+
editorPane.colorSyntax();
18211824

18221825
//report all matches to the user
1823-
RuleEditor.this.showAutocompletePopup(pos, userType, completeMatches);
1826+
RuleEditor.this.showAutocompletePopup(pos + addedCharacters.length(), userType + addedCharacters, completeMatches);
18241827
if(completeMatches.isEmpty()) {
18251828
MainFrame.getMainFrame().getFeedbackManager().setStatusBarMsg("No auto-complete matches found.");
18261829
}
@@ -1830,12 +1833,8 @@ private void complete(int pos, String userType, List<String> completeMatches) {
18301833

18311834
private void attributeComplete(int pos, String userType, String prodSoFar) {
18321835
List<String> completeMatches = getMatchingStrings(userType, prodSoFar);
1833-
if (completeMatches.isEmpty()) {
1834-
return;
1835-
}
18361836
complete(pos, userType, completeMatches);
1837-
1838-
}//attributeComplete
1837+
}
18391838

18401839
private AutocompletePopup autocompletePopup = null;
18411840

@@ -1927,6 +1926,7 @@ private List<String> getMatchingStrings(String userType, String prodSoFar) {
19271926
completeMatches.add(matched);
19281927
}
19291928
}
1929+
Collections.sort(completeMatches);
19301930
return completeMatches;
19311931
}
19321932

0 commit comments

Comments
 (0)