public int getOffset(PsiFile file) {
return getOffset(file, line, column);
}
public static int getOffset(PsiFile psiFile, int line, int col) {
LazyRangeMarkerFactory factory = LazyRangeMarkerFactory.getInstance(psiFile.getProject());
RangeMarker rangeMarker = factory.createRangeMarker(
psiFile.getVirtualFile(), Math.max(0, line - 1), Math.max(0, col - 1), false
);
return rangeMarker.getStartOffset();
}