ActionContext (@NotNull ProblemDescriptor descriptor) { PsiElement startElement = descriptor.getStartElement(); PsiFile file = startElement.getContainingFile(); PsiElement psiElement = descriptor.getPsiElement(); TextRange range = descriptor.getTextRangeInElement(); if (range != null) { range = range.shiftRight(psiElement.getTextRange().getStartOffset()); } else { range = psiElement.getTextRange(); } return new ActionContext(file.getProject(), file, range.getStartOffset(), range, startElement); }