tasks: Fix runnables retrieval to not bail when a single tag can't be matched (#12113)
This can happen with queries without `@run` indicator. Release Notes: - N/A
This commit is contained in:
parent
e68ef944d9
commit
c440f3a71b
1 changed files with 46 additions and 42 deletions
|
@ -3005,9 +3005,9 @@ impl BufferSnapshot {
|
||||||
.map(|grammar| grammar.runnable_config.as_ref())
|
.map(|grammar| grammar.runnable_config.as_ref())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
iter::from_fn(move || {
|
iter::from_fn(move || loop {
|
||||||
let test_range = syntax_matches.peek().and_then(|mat| {
|
let mat = syntax_matches.peek()?;
|
||||||
test_configs[mat.grammar_index].and_then(|test_configs| {
|
let test_range = test_configs[mat.grammar_index].and_then(|test_configs| {
|
||||||
let mut tags: SmallVec<[(Range<usize>, RunnableTag); 1]> =
|
let mut tags: SmallVec<[(Range<usize>, RunnableTag); 1]> =
|
||||||
SmallVec::from_iter(mat.captures.iter().filter_map(|capture| {
|
SmallVec::from_iter(mat.captures.iter().filter_map(|capture| {
|
||||||
test_configs
|
test_configs
|
||||||
|
@ -3047,10 +3047,14 @@ impl BufferSnapshot {
|
||||||
extra_captures,
|
extra_captures,
|
||||||
buffer_id: self.remote_id(),
|
buffer_id: self.remote_id(),
|
||||||
})
|
})
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
syntax_matches.advance();
|
syntax_matches.advance();
|
||||||
test_range
|
if test_range.is_some() {
|
||||||
|
// It's fine for us to short-circuit on .peek()? returning None. We don't want to return None from this iter if we
|
||||||
|
// had a capture that did not contain a run marker, hence we'll just loop around for the next capture.
|
||||||
|
return test_range;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue