Example #1
0
        public override IDeclaredElement Analyze(IDeclaration node, IHighlightingConsumer consumer, DaemonProcessKind kind)
        {
            if (!(node is IClassLikeDeclaration element))
            {
                return(null);
            }

            var typeElement = element.DeclaredElement;

            if (typeElement != null)
            {
                if (myUnityApi.IsDescendantOfMonoBehaviour(typeElement))
                {
                    AddMonoBehaviourHiglighting(consumer, element, "Script", "Unity script", kind);
                }
                else if (myUnityApi.IsDescendantOf(KnownTypes.Editor, typeElement) ||
                         myUnityApi.IsDescendantOf(KnownTypes.EditorWindow, typeElement))
                {
                    AddEditorHiglighting(consumer, element, "Editor", "Custom Unity Editor", kind);
                }
                else if (myUnityApi.IsUnityType(typeElement))
                {
                    AddUnityTypeHighlighting(consumer, element, "Unity type", "Custom Unity type", kind);
                }
                else if (myUnityApi.IsUnityECSType(typeElement))
                {
                    AddUnityECSHighlighting(consumer, element, "Unity ECS", "Unity entity component system object",
                                            kind);
                }

                return(typeElement);
            }

            return(null);
        }
Example #2
0
        private bool IsSerializedViaFileId(IType type)
        {
            var typeElement = type.GetTypeElement();

            if (typeElement == null)
            {
                return(false);
            }

            return(myUnityApi.IsDescendantOf(KnownTypes.GameObject, typeElement) ||
                   myUnityApi.IsDescendantOf(KnownTypes.Component, typeElement));
        }