wat_service 0.10.1

WebAssembly Text Format language service.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::Diagnostic;
use wat_syntax::{AmberNode, SyntaxKind};

const DIAGNOSTIC_CODE: &str = "multiple-starts";

pub fn check(diagnostics: &mut Vec<Diagnostic>, module: AmberNode) {
    diagnostics.extend(
        module
            .children_by_kind(SyntaxKind::MODULE_FIELD_START)
            .skip(1)
            .map(|start| Diagnostic {
                range: start.text_range(),
                code: DIAGNOSTIC_CODE.into(),
                message: "only one start section is allowed".into(),
                ..Default::default()
            }),
    );
}