diff --git a/src/renamer.fs b/src/renamer.fs index 1b84bd00..87c74a5a 100644 --- a/src/renamer.fs +++ b/src/renamer.fs @@ -74,8 +74,8 @@ module private RenamerImpl = ) let mutable best = -10000, "" - // For performance, consider at most 25 candidates. - for word: string in candidates |> Seq.take 25 do + // For performance, consider at most 26 candidates. + for word: string in candidates |> Seq.take 26 do let firstLetter = word.[0] let lastLetter = word.[word.Length - 1] let mutable score = 0 @@ -353,7 +353,7 @@ module private RenamerImpl = let computeListOfNames text = let charCounts = Seq.countBy id text |> dict let count c = match charCounts.TryGetValue(c) with true, res -> res | _ -> 0 - let letters = ['a'..'z'] @ ['A'..'Z'] + let letters = ['a'..'z'] @ ['A'..'Z'] @ ['_'] [ // First, use most frequent letters yield! letters |> List.sortBy count |> List.rev |> List.map string diff --git a/tests/unit/many_variables.expected b/tests/unit/many_variables.expected index a850613d..a31ebb16 100644 --- a/tests/unit/many_variables.expected +++ b/tests/unit/many_variables.expected @@ -5,11 +5,11 @@ "{" "float M=L,f=K,N=J,O=I,P=H,Q=G;" "int R=1,S=2,T=3,U=4,V=5,W=6,X=7,Y=8;" - "float Z=F,a=E,b=D,c=C,d=B,e=A;" - "int g=1,h=2,i=3,j=4,k=5,l=6,m=7,n=8;" - "float o=0.;" - "int p=1,q=2,r=3,s=4,t=5,u=6,v=7,w=8;" - "float x=0.;" - "int y=1,z=2,at=3,aa=4,ab=5,ac=6,ad=7,aA=8;" - "return Y+n+w+aA;" + "float Z=F,_=E,a=D,b=C,c=B,d=A;" + "int e=1,g=2,h=3,i=4,j=5,k=6,l=7,m=8;" + "float n=0.;" + "int o=1,p=2,q=3,r=4,s=5,t=6,u=7,v=8;" + "float w=0.;" + "int x=1,y=2,z=3,at=4,aa=5,ab=6,ac=7,aA=8;" + "return Y+m+v+aA;" "}",