-
Notifications
You must be signed in to change notification settings - Fork 783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GetSubTextFromRange to ISourceText #15979
Conversation
.../FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl
Show resolved
Hide resolved
tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/SourceText.fs
Outdated
Show resolved
Hide resolved
I'd say this can go in - but just trying to understand, can this be redesigned to actually not have duplicate implementations? |
I guess, any suggestions on where to extract the code? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess at least this part
else
(let sourceText = this :> ISourceText)
let startLine = range.StartLine - 1
let line = sourceText.GetLineString startLine
...
can be moved to a method in SourceText
and then reused elsewhere.
The module SourceText is defined underneath the type. fsharp/src/Compiler/Facilities/prim-lexing.fs Line 147 in 11b1934
|
In Fantomas, we have an extension for
ISourceText
to grab the text based on arange
.I find myself copying this over to other projects that consume FCS quite often, and I would like to have this in
FCS
.