final int parenPos = text.lastIndexOf('(');
final int leftBracketPos = text.lastIndexOf('{');
final int interrogationMarkPos = text.lastIndexOf('?');
final int arrowPos = text.lastIndexOf("->");
RecordCompletion rc = null;
if (hashMarkPos >= 0) {
final IErlProject aproject = project;
if (aproject != null) {
rc = ErlangEngine
.getInstance()
.getContextAssistService()
.checkRecordCompletion(BackendCore.getBuildBackend(aproject),
text);
}
}
if (rc != null && rc.isNameWanted()) {
options.flags = EnumSet.of(Kinds.RECORD_DEFS);
options.pos = hashMarkPos;
options.text = rc.getPrefix();
} else if (rc != null && rc.isFieldWanted()) {
options.flags = EnumSet.of(Kinds.RECORD_FIELDS);
options.pos = hashMarkPos;
if (dotPos > hashMarkPos) {
options.pos = dotPos;
} else if (leftBracketPos > hashMarkPos) {
options.pos = leftBracketPos;
} else {
assert false;
}
options.text = rc.getPrefix();
options.moduleOrRecord = rc.getName();
options.fieldsSoFar = rc.getFields();
} else if (colonPos > commaPos && colonPos > parenPos) {
if (doubleColon) {
options.flags = EnumSet.of(Kinds.TYPES);
options.pos = colonPos;
options.text = text.substring(colonPos + 1);