1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00

fix(lsp): folding range adjustment panic (#10030)

Fixes #10029
This commit is contained in:
Kitson Kelly 2021-04-06 13:27:27 +10:00 committed by GitHub
parent 91e80ada8a
commit 2c52c0a145
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1288,7 +1288,7 @@ impl OutliningSpan {
content: &[u8],
line_folding_only: bool,
) -> u32 {
if line_folding_only && range.end.character > 0 {
if line_folding_only && range.end.line > 0 && range.end.character > 0 {
let offset_end: usize = line_index.offset(range.end).unwrap().into();
let fold_end_char = content[offset_end - 1];
if FOLD_END_PAIR_CHARACTERS.contains(&fold_end_char) {