blob: 52c8149a316d86827bd6edecb4822830b09bea7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
mod bibtex_declaration;
mod latex_environment;
mod latex_section;
use self::bibtex_declaration::BibtexDeclarationFoldingProvider;
use self::latex_environment::LatexEnvironmentFoldingProvider;
use self::latex_section::LatexSectionFoldingProvider;
use crate::workspace::*;
use futures_boxed::boxed;
use lsp_types::{FoldingRange, FoldingRangeParams};
pub struct FoldingProvider {
provider: ConcatProvider<FoldingRangeParams, FoldingRange>,
}
impl FoldingProvider {
pub fn new() -> Self {
Self {
provider: ConcatProvider::new(vec![
Box::new(BibtexDeclarationFoldingProvider),
Box::new(LatexEnvironmentFoldingProvider),
Box::new(LatexSectionFoldingProvider),
]),
}
}
}
impl Default for FoldingProvider {
fn default() -> Self {
Self::new()
}
}
impl FeatureProvider for FoldingProvider {
type Params = FoldingRangeParams;
type Output = Vec<FoldingRange>;
#[boxed]
async fn execute<'a>(
&'a self,
request: &'a FeatureRequest<FoldingRangeParams>,
) -> Vec<FoldingRange> {
self.provider.execute(request).await
}
}
|