Esempio n. 1
0
 IEnumerable <ItemInfo> GetItems(MSBuildDocument document, SpellChecker checker, string name)
 {
     foreach (var match in checker.FindSimilarWords(name))
     {
         if (string.Equals(match, name, StringComparison.OrdinalIgnoreCase))
         {
             continue;
         }
         if (document.GetSchemas().GetItem(match) is ItemInfo info)
         {
             yield return(info);
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Finds symbols in this assembly that match the provided name in a fuzzy manner.
        /// </summary>
        public async Task <IEnumerable <ISymbol> > FuzzyFindAsync(AsyncLazy <IAssemblySymbol> lazyAssembly, string name, CancellationToken cancellationToken)
        {
            var similarNames = _spellChecker.FindSimilarWords(name);
            var result       = new List <ISymbol>();

            foreach (var similarName in similarNames)
            {
                var symbols = await FindAsync(lazyAssembly, similarName, ignoreCase : true, cancellationToken : cancellationToken).ConfigureAwait(false);

                result.AddRange(symbols);
            }

            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// Finds symbols in this assembly that match the provided name in a fuzzy manner.
        /// </summary>
        public IEnumerable <ISymbol> FuzzyFind(IAssemblySymbol assembly, string name, CancellationToken cancellationToken)
        {
            var similarNames = _spellChecker.FindSimilarWords(name);

            return(similarNames.SelectMany(n => Find(assembly, n, ignoreCase: true, cancellationToken: cancellationToken)));
        }