fix: take the last range element by default if the query error isn't found

This commit is contained in:
Amaan Qureshi 2023-07-24 01:27:13 -04:00
parent 3f44b89685
commit 137483c7b9
No known key found for this signature in database
GPG key ID: E67890ADC4227273

View file

@ -782,7 +782,7 @@ impl<'a> LanguageConfiguration<'a> {
let (path, range) = ranges
.iter()
.find(|(_, range)| range.contains(&offset_within_section))
.unwrap();
.unwrap_or(ranges.last().unwrap());
error.offset = offset_within_section - range.start;
error.row = source[range.start..offset_within_section]
.chars()