File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
src/FSharpLint.Core/Rules/Conventions/Naming Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -69,16 +69,17 @@ module QuickFixes =
6969 Some { FromText = ident.idText; FromRange = ident.idRange; ToText = camelCaseIdent })
7070
7171 let splitByCaseChange ( name : string ) : seq < string > =
72- let builder = System.Text.StringBuilder()
72+ let partitionPoints =
73+ seq {
74+ yield 0
75+ for ( index, ( current, next)) in name |> Seq.pairwise |> Seq.indexed do
76+ if ( Char.IsUpper next || not ( Char.IsLetter next)) && not ( Char.IsUpper current) then
77+ yield index + 1
78+ yield name.Length
79+ }
7380 seq {
74- let isUppercase = Char.IsUpper name.[ 0 ]
75- for char in name do
76- if isUppercase <> Char.IsUpper char then
77- yield builder.ToString()
78- builder.Clear() |> ignore< StringBuilder>
79- builder.Append char |> ignore< StringBuilder>
80- if builder.Length > 0 then
81- yield builder.ToString()
81+ for ( start, finish) in Seq.pairwise partitionPoints do
82+ yield name.Substring( start, finish - start)
8283 }
8384
8485 let private convertAllToCase ( caseMapping : string -> string ) ( underscoresConfig : Option < NamingUnderscores >) ( ident : Ident ) =
You can’t perform that action at this time.
0 commit comments