parol-ls 4.4.0

Language server for parol parser generator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use lsp_types::{FormattingOptions, Range, TextEdit};

use crate::{parol_ls_grammar_trait::ParolLs, rng::Rng};

use super::super::comments::Comments;
use super::traits::{Fmt, Format};

impl Format for &ParolLs {
    fn format(&self, options: &FormattingOptions, comments: Comments) -> Vec<TextEdit> {
        let range = Rng::new(Range::default()).extend_to_end().0;
        let fmt_options = options.into();
        let (new_text, comments) = self.txt(&fmt_options, comments);
        debug_assert!(comments.is_empty());
        vec![TextEdit { range, new_text }]
    }
}