Skip to content

Commit

Permalink
More test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
wkillerud committed Nov 25, 2024
1 parent 4018d17 commit ff0b0ab
Show file tree
Hide file tree
Showing 2 changed files with 339 additions and 16 deletions.
12 changes: 9 additions & 3 deletions pkgs/sass_language_services/lib/src/lsp/text_document.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ class TextDocument {
}

var line = low - 1;
offset =
_ensureBeforeEndOfLine(offset: offset, lineOffset: lineOffsets[line]);
offset = _ensureBeforeEndOfLine(
offset: offset,
lineOffset: lineOffsets[line],
);

return Position(character: offset - lineOffsets[line], line: line);
}
Expand Down Expand Up @@ -151,8 +153,12 @@ class TextDocument {
lineOffsets[i + startLine + 1] = addedLineOffsets[i];
}
} else {
// Avoid going outside the range on weird range inputs.
lineOffsets.replaceRange(
startLine + 1, endLine - startLine, addedLineOffsets);
min(startLine + 1, lineOffsets.length),
min(endLine + 1, lineOffsets.length),
addedLineOffsets,
);
}

var diff = text.length - (endOffset - startOffset);
Expand Down
Loading

0 comments on commit ff0b0ab

Please sign in to comment.