private static JetValueArgumentList findCallAndUpdateContext(UpdateParameterInfoContext context) { PsiFile file = context.getFile(); PsiElement element = file.findElementAt(context.getOffset()); if (element == null) return null; PsiElement parent = element.getParent(); while (parent != null && !(parent instanceof JetValueArgumentList)) { element = element.getParent(); parent = parent.getParent(); } if (parent == null) return null; JetValueArgumentList argumentList = (JetValueArgumentList) parent; if (element instanceof JetValueArgument) { JetValueArgument arg = (JetValueArgument) element; int i = argumentList.getArguments().indexOf(arg); context.setCurrentParameter(i); context.setHighlightedParameter(arg); } return argumentList; }
@Override public PsiElement findElementForUpdatingParameterInfo(UpdateParameterInfoContext context) { return context.getFile().findElementAt(context.getEditor().getCaretModel().getOffset()); }
public PsiElement findElementForUpdatingParameterInfo(UpdateParameterInfoContext context) { return findAnchorElement(context.getEditor().getCaretModel().getOffset(), context.getFile()); }