Skip to content

Commit e11c95e

Browse files
committed
fix a crash
1 parent 4080c9f commit e11c95e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • crates/emmylua_ls/src/handlers/completion/providers

crates/emmylua_ls/src/handlers/completion/providers/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ fn get_text_edit_range_in_string(
156156
}
157157

158158
if text.ends_with('"') || text.ends_with('\'') {
159-
end_offset -= 1;
159+
end_offset = end_offset.saturating_sub(1);
160+
}
161+
162+
if end_offset <= start_offset {
163+
return None;
160164
}
161165

162166
let new_text_range = TextRange::new(start_offset.into(), end_offset.into());

0 commit comments

Comments
 (0)