Hi,
I was having a look at the code around
as it seems quite allocation heavy, and when looking noticed that it didn't
appear to behave correctly when there are multiple block comments present, as it removes the blocks starting from the start of the source string, and each removal changes the offsets of any following comments.
Basically, If I add a new test like
[<Test>]
member this.FunctionTooManyLinesWithMultiLineComments() =
this.Parse($"""
module Program
let dog x =
(*
Foo
Bar
*)
(*
Foo
Bar
*)
%s{generateNewLines (FunctionLength - 8) 4}
()""")
Assert.IsFalse this.ErrorsExist
Then the generated source is
dog x =
(*
Foo
Bar
*)
(*
Foo
Bar
*)
printf System.String.Empty
printf System.String.Empty
printf System.String.Empty
printf System.String.Empty
printf System.String.Empty
...
And after stripMultilineComments has run it looks like
dog x =
(*
Foo
Bar
*).Empty
printf System.String.Empty
printf System.String.Empty
printf System.String.Empty
printf System.String.Empty
...
Which doesn't seem right?
Basically I wonder if it should maybe be removing the blocks in reverse order (starting from the one latest in the file), so the offsets for earlier comments don't change?
Hi,
I was having a look at the code around
FSharpLint/src/FSharpLint.Core/Rules/Conventions/SourceLength/SourceLengthHelper.fs
Line 63 in bd94a09
Basically, If I add a new test like
Then the generated source is
And after
stripMultilineCommentshas run it looks likeWhich doesn't seem right?
Basically I wonder if it should maybe be removing the blocks in reverse order (starting from the one latest in the file), so the offsets for earlier comments don't change?