This pull request changes various string comparison operations in the FsAutoComplete project to use StringComparison.Ordinal instead of the default culture-sensitive option. This improves the performance, consistency, and correctness of the code, as it avoids unnecessary allocations and potential bugs related to different cultures. The changes affect several modules and files, such as CodeGeneration.fs, Commands.fs, CompilerServiceInterface.fs, DocumentationFormatter.fs, InlayHints.fs, Lexer.fs, SignatureFormatter.fs, TestAdapter.fs, TipFormatter.fs, TypedAstUtils.fs, Utils.fs, and some code fixes.
π€ Generated by Copilot at 15b8219
StringComparison.Ordinal is the way to goNo culture can stop us, we're in controlWe generate the code with speed and precisionWe fix the bugs with ruthless decision
WHAT
π€ Generated by Copilot at 15b8219
This pull request changes various string comparison operations in the
FsAutoComplete
project to useStringComparison.Ordinal
instead of the default culture-sensitive option. This improves the performance, consistency, and correctness of the code, as it avoids unnecessary allocations and potential bugs related to different cultures. The changes affect several modules and files, such asCodeGeneration.fs
,Commands.fs
,CompilerServiceInterface.fs
,DocumentationFormatter.fs
,InlayHints.fs
,Lexer.fs
,SignatureFormatter.fs
,TestAdapter.fs
,TipFormatter.fs
,TypedAstUtils.fs
,Utils.fs
, and some code fixes.π€ Generated by Copilot at 15b8219
ππ οΈπ
WHY
Using Ordinal is both faster and more correct as our intent is to do symbolic compares. See https://learn.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings for the full story.
HOW
π€ Generated by Copilot at 15b8219
StringComparison.Ordinal
forStartsWith
,EndsWith
, andIndexOf
methods to avoid culture-sensitive comparisons and improve performance (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)open System
directive toLexer
andTestAdapter
modules to makeStringComparison
enum available (link, link)open System
directive toRemoveRedundantAttributeSuffix
module to makeStringComparison
enum available (link)