Html: Custom tag completion

This commit is contained in:
Fedor Korotkov
2013-05-07 12:40:11 +04:00
parent 8f0a05c226
commit 9bd45c2ab0
4 changed files with 41 additions and 4 deletions
@@ -139,6 +139,7 @@ label.edit.external.resource.configure.ignored.resources=&Ignored Schemas and DT
no.external.resources=No external resources
no.ignored.resources=No ignored resources
custom.html.tag=Custom Html Tag
add.custom.html.tag=Add {0} to custom html tags
add.custom.html.attribute=Add {0} to custom html attributes
add.optional.html.attribute=Add {0} to not required html attributes
@@ -18,6 +18,8 @@
interface="com.intellij.xml.XmlSchemaProvider"/>
<extensionPoint name="xml.xmlExtension"
interface="com.intellij.xml.XmlExtension"/>
<extensionPoint name="xml.tagNameProvider"
interface="com.intellij.xml.XmlTagNameProvider"/>
<extensionPoint name="xml.fileNSInfoProvider"
interface="com.intellij.psi.xml.XmlFileNSInfoProvider"/>
<extensionPoint name="xml.attributeDescriptorsProvider"
@@ -42,10 +42,7 @@ import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.NullableFunction;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.xml.XmlElementDescriptor;
import com.intellij.xml.XmlElementDescriptorAwareAboutChildren;
import com.intellij.xml.XmlExtension;
import com.intellij.xml.XmlNSDescriptor;
import com.intellij.xml.*;
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor;
import com.intellij.xml.impl.schema.XmlElementDescriptorImpl;
import com.intellij.xml.util.HtmlUtil;
@@ -232,6 +229,9 @@ public class TagNameReference implements PsiReference {
}
elements.add(lookupElement.withInsertHandler(XmlTagInsertHandler.INSTANCE));
}
for (XmlTagNameProvider tagNameProvider : XmlTagNameProvider.EP_NAME.getExtensions()) {
tagNameProvider.addTagNameVariants(elements, tag, prefix);
}
return elements.toArray(new LookupElement[elements.size()]);
}
@@ -0,0 +1,34 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.xml;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.psi.xml.XmlTag;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* Provides custom tag names.
*
* @see HtmlCustomTagNameProvider
*/
public interface XmlTagNameProvider {
ExtensionPointName<XmlTagNameProvider> EP_NAME = new ExtensionPointName<XmlTagNameProvider>("com.intellij.xml.tagNameProvider");
void addTagNameVariants(List<LookupElement> elements, @NotNull XmlTag tag, String prefix);
}