public bool ProcessProjectItem <TResult>(IPsiSourceFile sourceFile, IFindResultConsumer <TResult> consumer)
        {
            if (!myDeferredCacheController.CompletedOnce.Value)
            {
                return(false);
            }

            foreach (var element in myElements)
            {
                if (element is IMethod || element is IProperty)
                {
                    var usages = myAssetMethodsElementContainer.GetAssetUsagesFor(sourceFile, element);
                    foreach (var assetMethodData in usages)
                    {
                        var hierarchyElement = myAssetDocumentHierarchyElementContainer.GetHierarchyElement(assetMethodData.Location, false);
                        if (hierarchyElement != null)
                        {
                            consumer.Accept(new UnityMethodsFindResult(sourceFile, element, assetMethodData, hierarchyElement));
                        }
                    }
                }

                if (element is ITypeElement typeElement)
                {
                    var usages = myAssetUsagesElementContainer.GetAssetUsagesFor(sourceFile, typeElement);

                    foreach (var assetUsage in usages)
                    {
                        var hierarchyElement = myAssetDocumentHierarchyElementContainer.GetHierarchyElement(assetUsage.Location, false);
                        if (hierarchyElement == null)
                        {
                            continue;
                        }

                        consumer.Accept(new UnityScriptsFindResults(sourceFile, element, assetUsage, hierarchyElement));
                    }
                }

                if (element is IField field)
                {
                    var usages = myAssetInspectorValuesContainer.GetAssetUsagesFor(sourceFile, field);
                    foreach (var assetUsage in usages)
                    {
                        var hierarchyElement = myAssetDocumentHierarchyElementContainer.GetHierarchyElement(assetUsage.Location, false);
                        if (hierarchyElement == null)
                        {
                            continue;
                        }

                        consumer.Accept(new UnityInspectorFindResults(sourceFile, element, assetUsage, hierarchyElement));
                    }
                }
            }

            return(false);
        }
        private IEnumerable <(InspectorVariableUsage usage, bool isPrefabModification)> GetUsages(IPsiSourceFile sourceFile)
        {
            var dataElement = myPointers.GetValueSafe(sourceFile)?.GetElement(sourceFile, Id) as AssetInspectorValuesDataElement;

            if (dataElement == null)
            {
                yield break;
            }

            foreach (var usage in dataElement.VariableUsages)
            {
                yield return(usage, false);
            }

            foreach (var(reference, modification) in dataElement.ImportedInspectorValues.Modifications)
            {
                var hierearchyElement = myHierarchyElementContainer.GetHierarchyElement(reference.LocalReference, true);
                Assertion.Assert(hierearchyElement != null, "hierearchyElement != null");
                if (!(hierearchyElement is IScriptComponentHierarchy scriptElement))
                {
                    continue;
                }
                yield return(new InspectorVariableUsage(reference.LocalReference, scriptElement.ScriptReference, reference.Name, modification.value ?? modification.objectReference), true);
            }
        }
        private string GetScriptGuid(AssetMethodData assetMethodData)
        {
            var reference       = assetMethodData.TargetScriptReference;
            var scriptComponent = myAssetDocumentHierarchyElementContainer.GetHierarchyElement(reference, true) as IScriptComponentHierarchy;
            var guid            = scriptComponent?.ScriptReference?.ExternalAssetGuid;

            return(guid);
        }