Conversation
|
OMG, this code is... let's call it fragile. Please, don't touch it ever in the future. |
|
Perhaps in the future we'll be able to do away with all of these |
|
|
@dsyme Maybe rename |
|
@vasily-kirichenko this stuff is in FCS / not specific to VS and I think if it was to be renamed |
|
@smoothdeveloper As there are other zero line based editors, then yes, the functions should keep their names, but we should create aliases in FSharp.Editor project with the proposed names. |
|
@dotnet-bot test this please |
|
|
@KevinRansom fixed. |
| while i > 0 && (match sourceTextData.[i] with Some data -> not (data.IsValid(lines.[i])) | None -> true) do | ||
| i <- i - 1 | ||
| i | ||
| // Rescan the lines if necessary and report the information |
There was a problem hiding this comment.
scanStartLine made my head explode or at least the while loop condition did.
I don't know whether this is any more readable though:
let scanStartLine =
let rec scanStart i =
if i > 0 && (Option.isNone (sourceTextData.[i]) || not (sourceTextData.[i].Value.IsValid(lines.[i]))) then scanStart (i - 1)
else i
scanStart startLine
There was a problem hiding this comment.
I'm 100% with you on this. It must be covered by tests, then rewritten in a more functional and safe manner. The number of things this algorithm operates is not as huge to make the code so imperative.
* revert "Use Roslyn line numbers only in lexer cache" dotnet#2090 * fix OutOfRangeException in getCachedSourceLineData * fixed: lexer cache does not work at all * fix finding start line for relexing in getCachedSourceLineData
This fixes #2155
It reverts #2090, then fixes the
OutOfRangeExceptioningetCachedSourceLineData.