提交 64b20a99 编写于 作者: C Cyrus Najmabadi

Use a consistent comparison method for BKTrees and EditDistance.

上级 65e034a8
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Roslyn.Utilities; using Roslyn.Utilities;
using static Roslyn.Utilities.PortableShim;
namespace Microsoft.CodeAnalysis.FindSymbols namespace Microsoft.CodeAnalysis.FindSymbols
{ {
...@@ -236,7 +237,6 @@ internal static SymbolTreeInfo Create(VersionStamp version, IAssemblySymbol asse ...@@ -236,7 +237,6 @@ internal static SymbolTreeInfo Create(VersionStamp version, IAssemblySymbol asse
GenerateNodes(assembly.GlobalNamespace, list); GenerateNodes(assembly.GlobalNamespace, list);
var spellChecker = new SpellChecker(list.Select(n => n.Name)); var spellChecker = new SpellChecker(list.Select(n => n.Name));
return new SymbolTreeInfo(version, SortNodes(list), spellChecker); return new SymbolTreeInfo(version, SortNodes(list), spellChecker);
} }
......
...@@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis.FindSymbols ...@@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis.FindSymbols
internal partial class SymbolTreeInfo : IObjectWritable internal partial class SymbolTreeInfo : IObjectWritable
{ {
private const string PrefixMetadataSymbolTreeInfo = "<MetadataSymbolTreeInfoPersistence>_"; private const string PrefixMetadataSymbolTreeInfo = "<MetadataSymbolTreeInfoPersistence>_";
private const string SerializationFormat = "8"; private const string SerializationFormat = "9";
/// <summary> /// <summary>
/// this is for a metadata reference in a solution /// this is for a metadata reference in a solution
......
...@@ -105,7 +105,7 @@ public Builder(IEnumerable<string> values) ...@@ -105,7 +105,7 @@ public Builder(IEnumerable<string> values)
foreach (var ch in value) foreach (var ch in value)
{ {
_concatenatedLowerCaseWords[characterIndex] = char.ToLower(ch); _concatenatedLowerCaseWords[characterIndex] = CaseInsensitiveComparison.ToLower(ch);
characterIndex++; characterIndex++;
} }
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Microsoft.CodeAnalysis;
using Roslyn.Utilities; using Roslyn.Utilities;
using static System.Math; using static System.Math;
...@@ -82,7 +83,7 @@ public IList<string> Find(string value, int? threshold = null) ...@@ -82,7 +83,7 @@ public IList<string> Find(string value, int? threshold = null)
{ {
for (var i = 0; i < value.Length; i++) for (var i = 0; i < value.Length; i++)
{ {
lowerCaseCharacters[i] = char.ToLower(value[i]); lowerCaseCharacters[i] = CaseInsensitiveComparison.ToLower(value[i]);
} }
threshold = threshold ?? WordSimilarityChecker.GetThreshold(value); threshold = threshold ?? WordSimilarityChecker.GetThreshold(value);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
using Microsoft.CodeAnalysis;
using static System.Math; using static System.Math;
namespace Roslyn.Utilities namespace Roslyn.Utilities
...@@ -61,7 +62,7 @@ private static char[] ConvertToLowercaseArray(string text) ...@@ -61,7 +62,7 @@ private static char[] ConvertToLowercaseArray(string text)
var array = ArrayPool<char>.GetArray(text.Length); var array = ArrayPool<char>.GetArray(text.Length);
for (int i = 0; i < text.Length; i++) for (int i = 0; i < text.Length; i++)
{ {
array[i] = char.ToLower(text[i]); array[i] = CaseInsensitiveComparison.ToLower(text[i]);
} }
return array; return array;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册