<commit_before>using System.Collections.Generic;
using System.Linq;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Plugins.Unity.Yaml.Psi.Caches;
using JetBrains.ReSharper.Plugins.Yaml.Psi;
using JetBrains.ReSharper.Plugins.Yaml.Psi.Search;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.ExtensionsAPI;
using JetBrains.Util.dataStructures;

namespace JetBrains.ReSharper.Plugins.Unity.Yaml.Psi.Search
{
    // Note that there isn't a default searcher factory for YAML because it has no declared elements to search for. This
    // searcher factory is looking for C# declared elements - class or method, etc.
    [PsiSharedComponent]
    public class UnityYamlUsageSearchFactory : DomainSpecificSearcherFactoryBase
    {
        public override bool IsCompatibleWithLanguage(PsiLanguageType languageType)
        {
            return languageType.Is<YamlLanguage>();
        }

        public override IDomainSpecificSearcher CreateReferenceSearcher(IDeclaredElementsSet elements,
            bool findCandidates)
        {
            // We're interested in classes for usages of MonoScript references, and methods for UnityEvent usages
            if (elements.All(e => e is IClass || e is IMethod))
                return new YamlReferenceSearcher(this, elements, findCandidates);
            return null;
        }

        // Used to filter files before searching for reference. Method references require the element short name while
        // class references use the class's file's asset guid. If the file doesn't contain one of these words, it won't
        // be searched
        public override IEnumerable<string> GetAllPossibleWordsInFile(IDeclaredElement element)<commit_msg>Fix find usages of property event handlers<commit_after>using System.Collections.Generic;
using System.Linq;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Plugins.Unity.Yaml.Psi.Caches;
using JetBrains.ReSharper.Plugins.Yaml.Psi;
using JetBrains.ReSharper.Plugins.Yaml.Psi.Search;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.ExtensionsAPI;
using JetBrains.Util.dataStructures;

namespace JetBrains.ReSharper.Plugins.Unity.Yaml.Psi.Search
{
    // Note that there isn't a default searcher factory for YAML because it has no declared elements to search for. This
    // searcher factory is looking for C# declared elements - class or method, etc.
    [PsiSharedComponent]
    public class UnityYamlUsageSearchFactory : DomainSpecificSearcherFactoryBase
    {
        public override bool IsCompatibleWithLanguage(PsiLanguageType languageType)
        {
            return languageType.Is<YamlLanguage>();
        }

        public override IDomainSpecificSearcher CreateReferenceSearcher(IDeclaredElementsSet elements,
            bool findCandidates)
        {
            // We're interested in classes for usages of MonoScript references, and methods for UnityEvent usages
            if (elements.All(e => e is IClass || e is IMethod || e is IProperty))
                return new YamlReferenceSearcher(this, elements, findCandidates);
            return null;
        }

        // Used to filter files before searching for reference. Method references require the element short name while
        // class references use the class's file's asset guid. If the file doesn't contain one of these words, it won't
        // be searched
        public override IEnumerable<string> GetAllPossibleWordsInFile(IDeclaredElement element)
{'fraction_non_alphanumeric': 0.06399538771980398, 'fraction_numerical': 0.0, 'mean_word_length': 3.4203821656050954, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3143140', 'n_tokens_mistral': 952, 'n_tokens_neox': 917, 'n_words': 292}