KT-9787 Auto-popup parameter info on typing '['

#KT-9787 Fixed
This commit is contained in:
Valentin Kipyatkov
2015-10-30 17:20:55 +03:00
parent def0e01e8d
commit c2cf95bcd4
@@ -124,11 +124,29 @@ public class KotlinTypedHandler extends TypedHandlerDelegate {
case ':':
autoPopupCallableReferenceLookup(project, editor);
return Result.CONTINUE;
case '[':
autoPopupParameterInfo(project, editor);
return Result.CONTINUE;
}
return Result.CONTINUE;
}
private static void autoPopupParameterInfo(Project project, Editor editor) {
int offset = editor.getCaretModel().getOffset();
if (offset == 0) return;
HighlighterIterator iterator = ((EditorEx) editor).getHighlighter().createIterator(offset - 1);
IElementType tokenType = iterator.getTokenType();
if (KtTokens.COMMENTS.contains(tokenType)
|| tokenType == KtTokens.REGULAR_STRING_PART
|| tokenType == KtTokens.OPEN_QUOTE
|| tokenType == KtTokens.CHARACTER_LITERAL) return;
AutoPopupController.getInstance(project).autoPopupParameterInfo(editor, null);
}
private static void autoPopupMemberLookup(Project project, final Editor editor) {
AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, new Condition<PsiFile>() {
@Override