Skip to content

Simplify TextSpan creation#21306

Merged
3 commits merged into
masterfrom
createTextSpan
Feb 8, 2018
Merged

Simplify TextSpan creation#21306
3 commits merged into
masterfrom
createTextSpan

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Jan 19, 2018

Adds a helper function and uses existing helpers more.

@ghost ghost force-pushed the createTextSpan branch from d523082 to 202445b Compare January 19, 2018 21:19
@ghost ghost requested a review from armanio123 January 19, 2018 21:35

private computeSpan(change: Change, _sourceFile: SourceFile): TextSpan {
return createTextSpanFromBounds(change.range.pos, change.range.end);
return createTextSpanFromRange(change.range);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this name the intended one? On other files the method is creatTextSpanFromStartEnd.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and createTextSpanFromStartEnd are basically the same functions, only some data structures use { start, end } and others use { pos, end } for some reason.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If both methods (FromStartEnd and FromRange) achieves the same goal, is it preferable to instead refactor to use the FromRange and not introduce a new method?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Changed this so that they call it pos consistently

@ghost ghost force-pushed the createTextSpan branch from 236c756 to 6e11d89 Compare January 23, 2018 22:37
@ghost ghost force-pushed the createTextSpan branch from 6e11d89 to edcc3f4 Compare February 8, 2018 20:55
@ghost ghost merged commit 16f3b93 into master Feb 8, 2018
@ghost ghost deleted the createTextSpan branch February 8, 2018 21:51
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants