in package/src/languageServiceManager/kustoLanguageService.ts [1865:1879]
private static trimTrailingNewlineFromRange(
textInRange: string,
rangeStartOffset: number,
document: TextDocument,
range: ls.Range
) {
let currentIndex = textInRange.length - 1;
while (textInRange[currentIndex] === '\r' || textInRange[currentIndex] === '\n') {
--currentIndex;
}
const newEndOffset = rangeStartOffset + currentIndex + 1;
const newEndPosition = document.positionAt(newEndOffset);
const newRange = ls.Range.create(range.start, newEndPosition);
return newRange;
}