Skip to content
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

Compute LG SourceRange based on content instead of parsed token #3077

Merged
merged 4 commits into from
Nov 19, 2020

Conversation

Danieladu
Copy link
Contributor

@Danieladu Danieladu commented Nov 19, 2020

Fixes #3076

Root cause

Previously, the sourceRange(start and end line position) of a LG template is calculated based on the parsed token. But in certain scenarios that, when there are extra empty character (line breaks) at the end of a template, will cause this calculation not correct, and thus causing the further update on this lg file misplaced in the wrong position, causing potential data loss.

Fix

Use the real content received to calculate start\end line. Content is the golden truth, more trustworthy than parsed tokens.

Impact

Composer

@coveralls
Copy link

coveralls commented Nov 19, 2020

Pull Request Test Coverage Report for Build 371449104

  • 9 of 9 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 84.785%

Totals Coverage Status
Change from base Build 370698341: 0.02%
Covered Lines: 17312
Relevant Lines: 19498

💛 - Coveralls

@Danieladu Danieladu marked this pull request as ready for review November 19, 2020 02:02
@Danieladu Danieladu requested a review from a team as a code owner November 19, 2020 02:02
@boydc2014 boydc2014 changed the title Fix CRUD issue raised by Composer Compute LG SourceRange based on content instead of parsed token Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lg update template to the wrong position.
3 participants