Esempio n. 1
0
        public void ProcessAfterInterior(IElement element)
        {
            Assert.CheckNotNull(element);

            foreach (IReference reference in element.GetReferences())
            {
                IDeclaredElement resolved = reference.Resolve().DeclaredElement;
                if(resolved is IConstructor)
                {
                    resolved = resolved.GetContainingType();
                }

                {
                    ITypeElement typeElement = resolved as ITypeElement;

                    if (typeElement != null)
                    {
                        //                    IDeclaredType declaredType = TypeFactory.CreateType(typeElement);

                        IModule module = resolved.Module;
                        if (candidates.Contains(module))
                            candidates.Remove(module);
                    }
                }

            }
        }
Esempio n. 2
0
        protected void ProcessReferences(IElement element)
        {
            if(!CheckElement(element))
                return;

            IReference[] references = element.GetReferences();
            foreach (IReference reference in references)
            {
                CheckForResolveProblems(reference, element);

                if (!reference.IsValid())
                {
                    //ResolveErrorType result = reference.CheckResolveResult();
                    // TODO hightlight "can not resolve symbol 'blahblah' "
                    //if( reference.CheckResolveResult() == ResolveErrorType. ...)
                }
                else
                {
                    HighlightReference(element, reference);
                }

            }
        }
Esempio n. 3
0
        private void ProcessIdentifiers(IElement element)
        {
            IReference[] references = element.GetReferences();
            foreach (IReference reference in references)
            {
                CheckForResolveProblems(reference);

                if(!reference.IsValid())
                {
                    //ResolveErrorType result = reference.CheckResolveResult();
                    // TODO hightlight "can not resolve symbol 'blahblah' "
                    //if( reference.CheckResolveResult() == ResolveErrorType. ...)
                }
                else if(reference.ReferenceType == ReferenceType.TEXT
                    || reference.ReferenceType == ReferenceType.REFERENCE_NAME)
                {
                    ResolveResult resolveResult = reference.Resolve();
                    if(resolveResult.DeclaredElement != null)
                    {
                        DocumentRange range = reference.GetDocumentRange();
                        DocumentRange footerRange = GetFooterTagRange(element, range);
                        Highlight(range, resolveResult.DeclaredElement);
                        if (footerRange != DocumentRange.InvalidRange)
                            Highlight(footerRange, resolveResult.DeclaredElement);
                    }
                }
            }

            if (element is IAppenderRef)
            {
                Highlight(((IXmlTag)element).ToTreeNode().Header.Name, HighlightingAttributeIds.FIELD_IDENTIFIER_ATTRIBUTE);
            }

            // TODO remove double code
            if(element is ILogger &&  ((ILogger)element).TagName == L4NConstants.ROOT_LOGGER)
            {
                IXmlTagNode treeNode = ((IXmlTag)element).ToTreeNode();
                // TODO use ILoggerElement to get header range
                Highlight(treeNode.Header.Name, HighlightingAttributeIds.CONSTANT_IDENTIFIER_ATTRIBUTE);
            }
            else if(element is IAppender || element is ILogger)
            {
                // TODO use IAppenderElement to get header range
                IXmlTagNode treeNode = ((IXmlTag)element).ToTreeNode();
                Highlight(treeNode.Header.Name, HighlightingAttributeIds.TYPE_IDENTIFIER_ATTRIBUTE);
            }

            // TODO tooltips for predefined tags appender, appender-ref, logger, level etc
        }