TextRange (@NotNull VirtualFile virtualFile, int line, int column) { Document document = FileDocumentManager.getInstance().getDocument(virtualFile); assert document != null; int lineCount = document.getLineCount(); if (line > lineCount) { line = lineCount; } line = line <= 0 ? 0 : line - 1; int offset = document.getLineStartOffset(line) + (column <= 0 ? 0 : column - 1); return new TextRange(offset, offset); }