When a mapping / token in the source code has a greater length than the generated one, the end offset / end character position ends up being the shorter generated one when the longer in the source code is should be provided for selection / range for vscode.
Example:
Source code:
import {
TrackedArray,
TrackedObject,
TrackedSet,
TrackedMap,
createRefKey,
} from 'ripple';
Generated code:
import { TrackedArray, TrackedObject, TrackedSet, TrackedMap, createRefKey } from 'ripple';
The offset in the source code is 97 and 91 in the generated code.
The end position when translating generated to source for vscode's source locations ends up being { line 6, character: 10 } where it should be { line: 6, character: 16 }. This stems from the calculation of the wrong offset 91 from the generated one as the function translateOffset() always selects the smallest offset based on Math.min().
Looks like the fix would be to provide contextual info for the function translateOffset() to prefer selecting the longer offset when translating generated to source offsets when calculating the end source position.
I'll put up a pr shortly.