blob: 4492a0532d5dc9d4306759020a21f2e7af591e1a (
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
|
mod bibtex_internal;
mod latexindent;
use cancellation::CancellationToken;
use lsp_types::{DocumentFormattingParams, TextEdit};
use crate::BibtexFormatter;
use self::{bibtex_internal::format_bibtex_internal, latexindent::format_with_latexindent};
use super::FeatureRequest;
pub fn format_source_code(
request: FeatureRequest<DocumentFormattingParams>,
cancellation_token: &CancellationToken,
) -> Option<Vec<TextEdit>> {
let mut edits = None;
if request.context.options.read().unwrap().bibtex_formatter == BibtexFormatter::Texlab {
edits = edits.or_else(|| format_bibtex_internal(&request, cancellation_token));
}
edits = edits.or_else(|| format_with_latexindent(&request, cancellation_token));
edits
}
|