@Override protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull final CompletionResultSet result) { LegacyCompletionContributor.processReferences(parameters, result, new PairConsumer<PsiReference, CompletionResultSet>() { @Override public void consume(PsiReference reference, CompletionResultSet set) { if (reference instanceof TagNameReference) { collectCompletionVariants((TagNameReference)reference, set); } else if (reference instanceof SchemaPrefixReference) { TagNameReference tagNameReference = ((SchemaPrefixReference)reference).getTagNameReference(); if (tagNameReference != null && !tagNameReference.isStartTagFlag()) { set.consume(createClosingTagLookupElement((XmlTag)tagNameReference.getElement(), true, tagNameReference.getNameElement())); } } } }); }
@Override public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull final CompletionResultSet result) { LegacyCompletionContributor.processReferences(parameters, result, (reference, set) -> { if(reference instanceof TagNameReference) { collectCompletionVariants((TagNameReference) reference, set); } else if(reference instanceof SchemaPrefixReference) { TagNameReference tagNameReference = ((SchemaPrefixReference) reference).getTagNameReference(); if(tagNameReference != null && !tagNameReference.isStartTagFlag()) { set.consume(createClosingTagLookupElement((XmlTag) tagNameReference.getElement(), true, tagNameReference.getNameElement())); } } }); }
public static void collectCompletionVariants(TagNameReference tagNameReference, Consumer<LookupElement> consumer) { PsiElement element = tagNameReference.getElement(); if(element instanceof XmlTag) { if(!tagNameReference.isStartTagFlag()) { consumer.consume(createClosingTagLookupElement((XmlTag) element, false, tagNameReference.getNameElement())); } else { XmlTag tag = (XmlTag) element; for(LookupElement variant : getTagNameVariants(tag, tag.getNamespacePrefix())) { consumer.consume(variant); } } } }
private void completeVariable(Editor editor) { String prefix = this.myNameSuggestionsField.getEnteredName(); PsiReference reference = this.myTag.getReference(); if(reference instanceof TagNameReference) { LookupElement[] lookupItems = TagNameReferenceCompletionProvider.getTagNameVariants(this.myTag, this.myTag.getNamespacePrefix()); editor.getCaretModel().moveToOffset(prefix.length()); editor.getSelectionModel().removeSelection(); LookupManager.getInstance(this.getProject()).showLookup(editor, lookupItems, prefix); } }
public static void collectCompletionVariants(TagNameReference tagNameReference, Consumer<LookupElement> consumer) { PsiElement element = tagNameReference.getElement(); if (element instanceof XmlTag) { if (!tagNameReference.isStartTagFlag()) { consumer.consume(createClosingTagLookupElement((XmlTag)element, false, tagNameReference.getNameElement())); } else { XmlTag tag = (XmlTag) element; for(LookupElement variant: getTagNameVariants(tag, tag.getNamespacePrefix())) { consumer.consume(variant); } } } }
private void completeVariable(final Editor editor) { String prefix = myNameSuggestionsField.getEnteredName(); final PsiReference reference = myTag.getReference(); if (reference instanceof TagNameReference) { LookupElement[] lookupItems = TagNameReferenceCompletionProvider.getTagNameVariants(myTag, myTag.getNamespacePrefix()); editor.getCaretModel().moveToOffset(prefix.length()); editor.getSelectionModel().removeSelection(); LookupManager.getInstance(getProject()).showLookup(editor, lookupItems, prefix); } }
@Nullable @Override public TagNameReference createTagNameReference(ASTNode nameElement, boolean startTagFlag) { return AndroidXmlReferenceProvider.areReferencesProvidedByReferenceProvider(nameElement) ? null : new AndroidClassTagNameReference(nameElement, startTagFlag); }
@NotNull private static Collection<?> getVariants(CompletionParameters parameters) { if (!MavenDomUtil.isMavenFile(parameters.getOriginalFile())) return Collections.emptyList(); SmartList<?> result = new SmartList<Object>(); for (PsiReference each : getReferences(parameters)) { if (each instanceof TagNameReference) continue; if (each instanceof GenericDomValueReference) { GenericDomValueReference reference = (GenericDomValueReference)each; Converter converter = reference.getConverter(); if (converter instanceof MavenSmartConverter) { result.addAll(((MavenSmartConverter)converter).getSmartVariants(reference.getConvertContext())); } else if (converter instanceof ResolvingConverter) { //noinspection unchecked result.addAll(((ResolvingConverter)converter).getVariants(reference.getConvertContext())); } } else { //noinspection unchecked Collections.addAll((Collection)result, each.getVariants()); } } return result; }
private void completeVariable(final Editor editor) { String prefix = myNameSuggestionsField.getEnteredName(); final PsiReference reference = myTag.getReference(); if(reference instanceof TagNameReference) { LookupElement[] lookupItems = TagNameReferenceCompletionProvider.getTagNameVariants(myTag, myTag.getNamespacePrefix()); editor.getCaretModel().moveToOffset(prefix.length()); editor.getSelectionModel().removeSelection(); LookupManager.getInstance(getProject()).showLookup(editor, lookupItems, prefix); } }
public TagNameReference createTagNameReference(final ASTNode nameElement, final boolean startTagFlag) { return new BPMNTagNameReference(nameElement, startTagFlag); }
@Nullable public TagNameReference createTagNameReference(final ASTNode nameElement, final boolean startTagFlag) { return new TagNameReference(nameElement, startTagFlag); }
public void registerFixes(@NotNull PsiReference ref, @NotNull QuickFixActionRegistrar registrar) { if (ref instanceof TagNameReference || ref instanceof AntDomReference) { registrar.register(new AntChangeContextFix()); } }
public TagNameReference createTagNameReference(final ASTNode nameElement, final boolean startTagFlag) { return new JavaFxTagNameReference(nameElement, startTagFlag); }
public void registerFixes(PsiReference ref, QuickFixActionRegistrar registrar) { if (ref instanceof TagNameReference || ref instanceof AntDomReference) { registrar.register(new AntChangeContextFix()); } }
@Override public TagNameReference createTagNameReference(final ASTNode nameElement, final boolean startTagFlag) { return new JavaFxTagNameReference(nameElement, startTagFlag); }