mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
logging
This commit is contained in:
@@ -22,6 +22,7 @@ import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.codeInsight.lookup.TailTypeDecorator;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -53,6 +54,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
public class TagNameReference implements PsiReference {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.xml.TagNameReference");
|
||||
|
||||
protected final boolean myStartTagFlag;
|
||||
private final ASTNode myNameElement;
|
||||
|
||||
@@ -109,6 +112,11 @@ public class TagNameReference implements PsiReference {
|
||||
final XmlTag tag = getTagElement();
|
||||
final XmlElementDescriptor descriptor = tag != null ? tag.getDescriptor():null;
|
||||
|
||||
LOG.debug("Descriptor for tag " +
|
||||
(tag != null ? tag.getName() : "NULL") +
|
||||
" is " +
|
||||
(descriptor != null ? (descriptor.toString() + ": " + descriptor.getClass().getCanonicalName()) : "NULL"));
|
||||
|
||||
if (descriptor != null){
|
||||
return descriptor instanceof AnyXmlElementDescriptor ? tag : descriptor.getDeclaration();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.dtd.DTDLanguage;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.PomManager;
|
||||
import com.intellij.pom.PomModel;
|
||||
import com.intellij.pom.event.PomModelEvent;
|
||||
@@ -198,6 +199,11 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument {
|
||||
|
||||
if (XmlUtil.HTML_URI.equals(namespace)) {
|
||||
XmlNSDescriptor nsDescriptor = doctype != null ? getNsDescriptorFormDocType(doctype, containingFile, true) : null;
|
||||
if (doctype != null) {
|
||||
LOG.debug(
|
||||
"Descriptor from doctype " + doctype + " is " + (nsDescriptor != null ? nsDescriptor.getClass().getCanonicalName() : "NULL"));
|
||||
}
|
||||
|
||||
if (nsDescriptor == null) {
|
||||
String htmlns = ExternalResourceManagerEx.getInstanceEx().getDefaultHtmlDoctype(getProject());
|
||||
if (htmlns == null || htmlns.length() == 0) {
|
||||
@@ -257,16 +263,38 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String getFilePathForLogging(@Nullable PsiFile file) {
|
||||
if (file == null) {
|
||||
return "NULL";
|
||||
}
|
||||
final VirtualFile vFile = file.getVirtualFile();
|
||||
return vFile != null ? vFile.getPath() : "NULL_VFILE";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private XmlNSDescriptor getNsDescriptorFormDocType(final XmlDoctype doctype, final XmlFile containingFile, final boolean forHtml) {
|
||||
XmlNSDescriptor descriptor = getNSDescriptorFromMetaData(doctype.getMarkupDecl(), true);
|
||||
|
||||
final String filePath = getFilePathForLogging(containingFile);
|
||||
|
||||
final String dtdUri = XmlUtil.getDtdUri(doctype);
|
||||
LOG.debug("DTD url for doctype " + doctype.getText() + " in file " + filePath + " is " + dtdUri);
|
||||
|
||||
if (dtdUri != null && dtdUri.length() > 0){
|
||||
final XmlFile xmlFile = XmlUtil.findNamespace(containingFile, dtdUri);
|
||||
final String schemaFilePath = getFilePathForLogging(xmlFile);
|
||||
|
||||
LOG.debug("Schema file for " + filePath + " is " + schemaFilePath);
|
||||
|
||||
XmlNSDescriptor descriptorFromDtd = getNSDescriptorFromMetaData(xmlFile == null ? null : xmlFile.getDocument(), forHtml);
|
||||
|
||||
LOG.debug("Descriptor from meta data for schema file " +
|
||||
schemaFilePath +
|
||||
" is " +
|
||||
(descriptorFromDtd != null ? descriptorFromDtd.getClass().getCanonicalName() : "NULL"));
|
||||
|
||||
if (descriptor != null && descriptorFromDtd != null){
|
||||
descriptor = new XmlNSDescriptorSequence(new XmlNSDescriptor[]{descriptor, descriptorFromDtd});
|
||||
}
|
||||
|
||||
@@ -447,6 +447,10 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag {
|
||||
|
||||
XmlElementDescriptor elementDescriptor = null;
|
||||
final XmlNSDescriptor nsDescriptor = getNSDescriptor(namespace, false);
|
||||
|
||||
LOG.debug(
|
||||
"Descriptor for namespace " + namespace + " is " + (nsDescriptor != null ? nsDescriptor.getClass().getCanonicalName() : "NULL"));
|
||||
|
||||
if (nsDescriptor != null) {
|
||||
if (!DumbService.getInstance(getProject()).isDumb() || DumbService.isDumbAware(nsDescriptor)) {
|
||||
elementDescriptor = nsDescriptor.getElementDescriptor(this);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.intellij.html;
|
||||
|
||||
import com.intellij.html.RelaxedHtmlNSDescriptor;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.xml.XmlDocument;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
@@ -31,9 +32,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @author Eugene.Kudelevsky
|
||||
*/
|
||||
public class RelaxedHtmlFromRngNSDescriptor extends RngNsDescriptor implements RelaxedHtmlNSDescriptor {
|
||||
private static final Logger LOG = Logger.getInstance("#org.intellij.html.RelaxedHtmlFromRngNSDescriptor");
|
||||
|
||||
public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
|
||||
XmlElementDescriptor elementDescriptor = super.getElementDescriptor(tag);
|
||||
|
||||
LOG.debug("Descriptor from rng for tag " +
|
||||
tag.getName() +
|
||||
" is " +
|
||||
(elementDescriptor != null ? elementDescriptor.getClass().getCanonicalName() : "NULL"));
|
||||
|
||||
String namespace;
|
||||
if (elementDescriptor == null &&
|
||||
!((namespace = tag.getNamespace()).equals(XmlUtil.XHTML_URI))) {
|
||||
|
||||
Reference in New Issue
Block a user