private CompletionParameters createCompletionParameters(
     int invocationCount, final CompletionContext newContext, Editor editor) {
   final int offset = newContext.getStartOffset();
   final PsiFile fileCopy = newContext.file;
   PsiFile originalFile = fileCopy.getOriginalFile();
   final PsiElement insertedElement =
       findCompletionPositionLeaf(newContext, offset, fileCopy, originalFile);
   insertedElement.putUserData(CompletionContext.COMPLETION_CONTEXT_KEY, newContext);
   return new CompletionParameters(
       insertedElement, originalFile, myCompletionType, offset, invocationCount, editor);
 }
Пример #2
0
  protected void doComplete(
      final int offset1,
      final int offset2,
      final CompletionContext context,
      final FileCopyPatcher dummyIdentifier,
      final Editor editor,
      final int invocationCount) {
    PsiFile file = context.file;
    int offset = context.getStartOffset();

    PsiElement lastElement = file.findElementAt(offset - 1);
    if (lastElement == null || !StringUtil.endsWithChar(lastElement.getText(), '@')) return;

    super.doComplete(offset1, offset2, context, dummyIdentifier, editor, invocationCount);
  }