@Override public void getCompletion(final CompletionCallback callback) { callback.onCompletion( new Completion() { @Override public void apply(Document document) { document.replace(offset, length, macro.getName()); } @Override public LinearRange getSelection(Document document) { LinearRange.PartialLinearRange start = LinearRange.createWithStart(offset + macro.getName().length()); return start.andLength(0); } }); }