if (completionStartPos == -1) {
completionStartPos = offset;
} else {
completionStartPos = offset - (alreadyTyped.length() - completionStartPos);
}
proposals.add(new CompletionProposal(replacement.toString(), completionStartPos, offset - completionStartPos, cursorPosAfterReplace, null, display, null, null));
}
// create close current tag completionv
display = "/>";
replacement = new StringBuffer("/>");
cursorPosAfterReplace = replacement.length();
if (replacement.toString().startsWith(alreadyTyped.trim())) {
int completionStartPos = previousRegion.getOffset() + previousRegion.getLength() + 1 - replacement.length();
proposals.add(new CompletionProposal(replacement.toString(), completionStartPos, offset - completionStartPos, cursorPosAfterReplace, null, display, null, null));
}
break;
} else {
String replacement = "</tml:" + tagName + ">";
if (replacement.startsWith(alreadyTyped.trim())) {
int completionStartPos = alreadyTyped.lastIndexOf("<");
if (completionStartPos == -1) {
completionStartPos = offset;
} else {
completionStartPos = offset - (alreadyTyped.length() - completionStartPos);
}
proposals.add(new CompletionProposal(replacement, completionStartPos, offset - completionStartPos, replacement.length()));
break;
} else {
break;
}
}
} else {
// completion in following line
String replacement = "</tml:" + tagName + ">";
if (replacement.startsWith(alreadyTyped.trim())) {
int completionStartPos = alreadyTyped.lastIndexOf("<");
if (completionStartPos == -1) {
completionStartPos = offset;
} else {
completionStartPos = offset - (alreadyTyped.length() - completionStartPos);
}
proposals.add(new CompletionProposal(replacement, completionStartPos, offset - completionStartPos, replacement.length()));
break;
} else {
break;
}
}