@Nullable
  private static PsiLocalVariable findLocalVariable(@NotNull Editor editor, @NotNull PsiFile file) {
    SelectionModel selection = editor.getSelectionModel();
    if (selection.hasSelection()) {
      return PsiTreeUtil.findElementOfClassAtRange(file, selection.getSelectionStart(), selection.getSelectionEnd(), PsiLocalVariable.class);
    }
    else {
      return PsiTreeUtil.getParentOfType(file.findElementAt(editor.getCaretModel().getOffset()), PsiLocalVariable.class);
    }
  }
@Nullable
  private static PsiLocalVariable findLocalVariable(@NotNull Editor editor, @NotNull PsiFile file)