mirror of
https://github.com/latex-lsp/texlab.git
synced 2025-12-23 09:19:21 +00:00
Add macro to combine features with optional values
This commit is contained in:
parent
2ead53b00c
commit
a0f2aba67a
1 changed files with 17 additions and 0 deletions
|
|
@ -32,6 +32,23 @@ macro_rules! concat_feature {
|
|||
}};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! choice_feature {
|
||||
($request:expr) => {
|
||||
None
|
||||
};
|
||||
($request:expr, $provider:tt, $($providers:tt),*) => {{
|
||||
$(
|
||||
let value = await!($provider::execute($request));
|
||||
if value.is_some() {
|
||||
value
|
||||
} else {
|
||||
choice_feature!($request, $(providers),*)
|
||||
}
|
||||
)+
|
||||
}};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
use lsp_types::*;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue