int (boolean isNext) { if (!(myParameterInfoControllerData.getHandler() instanceof ParameterInfoHandlerWithTabActionSupport handler)) return -1; IElementType delimiter = handler.getActualParameterDelimiterType(); boolean noDelimiter = delimiter == TokenType.WHITE_SPACE; int caretOffset = myEditor.getCaretModel().getOffset(); CharSequence text = myEditor.getDocument().getImmutableCharSequence(); int offset = noDelimiter ? caretOffset : CharArrayUtil.shiftBackward(text, caretOffset - 1, WHITESPACE) + 1; int lbraceOffset = myLbraceMarker.getStartOffset(); PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(myEditor.getDocument()); PsiElement argList = lbraceOffset < offset ? findArgumentList(file, offset, lbraceOffset) : null; if (argList == null) return -1; @SuppressWarnings("unchecked") PsiElement[] parameters = handler.getActualParameters(argList); int currentParameterIndex = getParameterIndex(parameters, delimiter, offset); if (CodeInsightSettings.getInstance().SHOW_PARAMETER_NAME_HINTS_ON_COMPLETION) { if (currentParameterIndex < 0 || currentParameterIndex >= parameters.length && parameters.length > 0) return -1; if (offset >= argList.getTextRange().getEndOffset()) currentParameterIndex = isNext ? -1 : parameters.length; int prevOrNextParameterIndex = currentParameterIndex + (isNext ? 1 : -1); if (prevOrNextParameterIndex < 0 || prevOrNextParameterIndex >= parameters.length) { PsiElement parameterOwner = myParameterInfoControllerData.getParameterOwner(); return parameterOwner != null && parameterOwner.isValid() ? parameterOwner.getTextRange().getEndOffset() : -1; } else { return getParameterNavigationOffset(parameters[prevOrNextParameterIndex], text); } } else { int prevOrNextParameterIndex = isNext && currentParameterIndex < parameters.length - 1 ? currentParameterIndex + 1 : !isNext && currentParameterIndex > 0 ? currentParameterIndex - 1 : -1; return prevOrNextParameterIndex != -1 ? parameters[prevOrNextParameterIndex].getTextRange().getStartOffset() : -1; } }