String (@NotNull Document document, int offset) { CharSequence text = document.getCharsSequence(); if (offset >= text.length()) { return null; } int line = document.getLineNumber(offset); int lineStartOffset = document.getLineStartOffset(line); int lineEndOffset = document.getLineEndOffset(line); int i = CharArrayUtil.shiftForward(text, lineStartOffset, " \t"); if (i > lineEndOffset || text.charAt(i) != '*') { return null; } int start = i + 1; int end = CharArrayUtil.shiftForward(text, start, " \t"); end = Math.min(end, lineEndOffset); return end > start ? text.subSequence(start, end).toString() : ""; }