Skip to content

Commit

Permalink
refactor(language-service): reorganize variable definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jan 4, 2025
1 parent 76b353d commit 59d2177
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/language-service/lib/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@ export function findOverlapCodeRange(
const overlap = getOverlapRange(start, end, mappingStart, mappingEnd);
if (overlap) {
const curMappedStart = (overlap.start - mappingStart) + mapping.generatedOffsets[0];

mappedStart = mappedStart === undefined ? curMappedStart : Math.min(mappedStart, curMappedStart);

const lastGeneratedLength = (mapping.generatedLengths ?? mapping.lengths)[mapping.generatedOffsets.length - 1];
const curMappedEndOffset = Math.min(overlap.end - mapping.sourceOffsets[mapping.sourceOffsets.length - 1], lastGeneratedLength);

const curMappedEnd = mapping.generatedOffsets[mapping.generatedOffsets.length - 1] + curMappedEndOffset;

mappedStart = mappedStart === undefined ? curMappedStart : Math.min(mappedStart, curMappedStart);
mappedEnd = mappedEnd === undefined ? curMappedEnd : Math.max(mappedEnd, curMappedEnd);
}
}
Expand Down

0 comments on commit 59d2177

Please sign in to comment.