String (@NotNull CompletionParameters parameters) { XmlElement position = (XmlElement)parameters.getPosition(); int startOffset = position.getTextOffset(); int endOffset = parameters.getOffset(); Document document = parameters.getEditor().getDocument(); return document.getText(new TextRange(startOffset, endOffset)); }