mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-60499 Parameter Info not displayed when no closing paren
This commit is contained in:
@@ -20,6 +20,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiWhiteSpace;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
@@ -34,10 +35,15 @@ import java.util.Set;
|
||||
public class ParameterInfoUtils {
|
||||
public static final String DEFAULT_PARAMETER_CLOSE_CHARS = ",){}";
|
||||
|
||||
public static <T extends PsiElement> T findParentOfType (PsiFile file, int offset, Class<T> parentClass) {
|
||||
public static @Nullable <T extends PsiElement> T findParentOfType (PsiFile file, int offset, Class<T> parentClass) {
|
||||
PsiElement element = file.findElementAt(offset);
|
||||
if (element == null) return null;
|
||||
return PsiTreeUtil.getParentOfType(element, parentClass);
|
||||
|
||||
T parentOfType = PsiTreeUtil.getParentOfType(element, parentClass);
|
||||
if (element instanceof PsiWhiteSpace) {
|
||||
parentOfType = PsiTreeUtil.getParentOfType(PsiTreeUtil.prevLeaf(element), parentClass);
|
||||
}
|
||||
return parentOfType;
|
||||
}
|
||||
|
||||
public static int getCurrentParameterIndex(ASTNode argList, int offset, IElementType delimiterType) {
|
||||
|
||||
Reference in New Issue
Block a user