mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-27 19:02:07 +00:00
Avoid panic in get_injections
This commit is contained in:
parent
7d11329e80
commit
5ab1ae1521
1 changed files with 4 additions and 2 deletions
|
@ -1114,6 +1114,8 @@ fn get_injections(
|
|||
let mut query_cursor = QueryCursorHandle::new();
|
||||
let mut prev_match = None;
|
||||
|
||||
// Ensure that a `ParseStep` is created for every combined injection language, even
|
||||
// if there currently no matches for that injection.
|
||||
combined_injection_ranges.clear();
|
||||
for pattern in &config.patterns {
|
||||
if let (Some(language_name), true) = (pattern.language.as_ref(), pattern.combined) {
|
||||
|
@ -1174,8 +1176,8 @@ fn get_injections(
|
|||
if let Some(language) = language {
|
||||
if combined {
|
||||
combined_injection_ranges
|
||||
.get_mut(&language.clone())
|
||||
.unwrap()
|
||||
.entry(language.clone())
|
||||
.or_default()
|
||||
.extend(content_ranges);
|
||||
} else {
|
||||
queue.push(ParseStep {
|
||||
|
|
Loading…
Reference in a new issue