context.commitDocument(); PsiElement element = findNextToken(context); char completionChar = context.getCompletionChar(); boolean putCaretInside = completionChar == '[' || placeCaretInsideParentheses(context, item); if (completionChar == '[') { if (context.getCompletionChar() == '[') { tail = context.getTailOffset(); if (tail < document.getTextLength() && StringUtil.isJavaIdentifierPart(document.getCharsSequence().charAt(tail))) {
public void handleInsert(InsertionContext context, LookupElement item) { Editor editor = context.getEditor(); char completionChar = context.getCompletionChar(); if (completionChar == ' ' || StringUtil.containsChar(myIgnoreOnChars, completionChar)) { return; } Project project = editor.getProject(); if (project != null) { int completionCharOffset = getCompletionCharOffset(editor); if (completionCharOffset == -1) { EditorModificationUtil.insertStringAtCaret(editor, ";", false, 1); PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); } else { editor.getCaretModel().moveToOffset(editor.getCaretModel().getOffset() + completionCharOffset + 1); } if (myTriggerAutoPopup) { AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, null); } } }
public void handleInsert(InsertionContext context, LookupElement item) { Editor editor = context.getEditor(); char completionChar = context.getCompletionChar(); if (completionChar == ' ' || StringUtil.containsChar(myIgnoreOnChars, completionChar)) { return; } Project project = editor.getProject(); if (project != null) { int completionCharOffset = getCompletionCharOffset(editor); if (completionCharOffset == -1) { EditorModificationUtil.insertStringAtCaret(editor, " {}", false, 2); PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); } else { editor.getCaretModel().moveToOffset(editor.getCaretModel().getOffset() + completionCharOffset + 1); } if (myTriggerAutoPopup) { AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, null); } } }
public void handleInsert(InsertionContext context, LookupElement item) { Editor editor = context.getEditor(); char completionChar = context.getCompletionChar(); if (completionChar == ' ' || StringUtil.containsChar(myIgnoreOnChars, completionChar)) { return; } Project project = editor.getProject(); if (project != null) { int completionCharOffset = getCompletionCharOffset(editor); if (completionCharOffset == -1) { EditorModificationUtil.insertStringAtCaret(editor, "()", false, 1); PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); } else { editor.getCaretModel().moveToOffset(editor.getCaretModel().getOffset() + completionCharOffset + 1); } if (myTriggerAutoPopup) { AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, null); } } }
public void handleInsert(InsertionContext context, LookupElement item) { Editor editor = context.getEditor(); char completionChar = context.getCompletionChar(); if (completionChar == ' ' || StringUtil.containsChar(myIgnoreOnChars, completionChar)) { return; } Project project = editor.getProject(); if (project != null) { int completionCharOffset = getCompletionCharOffset(editor); if (completionCharOffset == -1) { EditorModificationUtil.insertStringAtCaret(editor, "();", false, 1); PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); } else { editor.getCaretModel().moveToOffset(editor.getCaretModel().getOffset() + completionCharOffset + 1); } if (myTriggerAutoPopup) { AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, null); } } }
public void handleInsert(InsertionContext context, LookupElement item) { Editor editor = context.getEditor(); char completionChar = context.getCompletionChar(); if (completionChar == ' ' || StringUtil.containsChar(myIgnoreOnChars, completionChar)) { return; } Project project = editor.getProject(); if (project != null) { int completionCharOffset = getCompletionCharOffset(editor); if (completionCharOffset == -1) { EditorModificationUtil.insertStringAtCaret(editor, ":", false, 1); if (myWithSpace) { EditorModificationUtil.insertStringAtCaret(editor, " ", false, 1); } PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); } else { editor.getCaretModel().moveToOffset(editor.getCaretModel().getOffset() + completionCharOffset + 1); } if (myTriggerAutoPopup) { AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, null); } } }
public void handleInsert(InsertionContext context, LookupElement item) { Editor editor = context.getEditor(); char completionChar = context.getCompletionChar(); if (completionChar == ' ' || StringUtil.containsChar(myIgnoreOnChars, completionChar)) { return;
@Override public void handleInsert(@NotNull final InsertionContext context, @NotNull final LookupElement item) { // fixme this is bad check for auto-inserting, i belive if (context.getCompletionChar() != '\u0000') { context.setLaterRunnable(() -> { Editor editor = context.getEditor(); new CodeCompletionHandlerBase(CompletionType.BASIC).invokeCompletion(context.getProject(), editor, 1); }); } } }
context.commitDocument(); char completionChar = context.getCompletionChar(); context.setAddCompletionChar(false);