Skip to content

Conversation

@nojaf
Copy link
Contributor

@nojaf nojaf commented Sep 14, 2023

In Fantomas, we have an extension for ISourceText to grab the text based on a range.

I find myself copying this over to other projects that consume FCS quite often, and I would like to have this in FCS.

@nojaf nojaf requested a review from a team as a code owner September 14, 2023 14:33
@psfinaki
Copy link
Contributor

I'd say this can go in - but just trying to understand, can this be redesigned to actually not have duplicate implementations?

@nojaf
Copy link
Contributor Author

nojaf commented Sep 20, 2023

I guess, any suggestions on where to extract the code?

Copy link
Contributor

@psfinaki psfinaki left a 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.

@nojaf
Copy link
Contributor Author

nojaf commented Sep 27, 2023

The module SourceText is defined underneath the type.

module SourceText =

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants