// OS in existence) We have to get rid of line feeds all together to get rid of parsing errors
String windowsLineSeparator = "\r\n";
entireTextField = entireTextField.replaceAll(windowsLineSeparator, "\n");
final String textField = entireTextField;
final AutoCompleteHelper ach = new AutoCompleteHelper(new AutoCompleteHelper.Document() {
public char getChar(int offset) {
return textField.charAt(offset);
}
public String get(int startIndex, int length) {
return textField.substring(startIndex, startIndex + length);
}
});
// Find the text we are completing (ex: no in "Prelude.no")
String userInput = ach.getLastIncompleteIdentifier(caretPosition);
userInputWordLength = userInput.length();
final Pair<String, List<Integer>> scopingAndOffset = ach.getIdentifierScoping(caretPosition);
final String moduleNameString = scopingAndOffset.fst();
final List<Integer> componentPositions = scopingAndOffset.snd();
final int startOfModuleName = (componentPositions.get(0)).intValue();
// Now if we are completing a qualification, find the module (ex: Prelude in "Prelude.no")
final boolean qualification = moduleNameString.length() > 0;