Skip to main content

Lang

Trait Lang 

Source
pub trait Lang: 'static {
    type ElementError: Into<SimpleDiagnostic> + Send + Sync + Debug;

    const CODE_ACTION: bool;
    const HOVER: bool;
    const LANG: &'static str;
    const TRIGGERS: &'static [&'static str];
    const LEGEND_TYPES: &'static [SemanticTokenType];
    const PATTERN: Option<&'static str>;

    // Provided methods
    fn semantic_token_type(_kind: SyntaxKind) -> Option<SemanticTokenType> { ... }
    fn semantic_token_spans(
        kind: SyntaxKind,
        span: Range<usize>,
        _text: &str,
    ) -> Vec<(SemanticTokenType, Range<usize>)> { ... }
}

Required Associated Constants§

Source

const CODE_ACTION: bool

Source

const HOVER: bool

Source

const LANG: &'static str

Source

const TRIGGERS: &'static [&'static str]

Source

const LEGEND_TYPES: &'static [SemanticTokenType]

Source

const PATTERN: Option<&'static str>

Required Associated Types§

Provided Methods§

Source

fn semantic_token_type(_kind: SyntaxKind) -> Option<SemanticTokenType>

Map a CST syntax kind to a semantic token type for highlighting.

Source

fn semantic_token_spans( kind: SyntaxKind, span: Range<usize>, _text: &str, ) -> Vec<(SemanticTokenType, Range<usize>)>

Map a CST syntax kind + byte span to semantic token spans for highlighting.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§