use crate::{lsp_types::SemanticTokenType, prelude::TripleTarget};
pub fn head() -> crate::lsp_types::Range {
let start = crate::lsp_types::Position {
line: 0,
character: 0,
};
crate::lsp_types::Range {
end: start.clone(),
start,
}
}
pub trait Lang: 'static {
type Element: Send + Sync;
type ElementError: Into<crate::feature::diagnostics::SimpleDiagnostic>
+ Send
+ Sync
+ std::fmt::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>;
fn semantic_token_type(_kind: rowan::SyntaxKind) -> Option<SemanticTokenType> {
None
}
fn semantic_token_spans(
kind: rowan::SyntaxKind,
span: std::ops::Range<usize>,
_text: &str,
) -> Vec<(SemanticTokenType, std::ops::Range<usize>)> {
Self::semantic_token_type(kind)
.map(|t| vec![(t, span)])
.unwrap_or_default()
}
}
pub trait LangHelper: std::fmt::Debug {
fn keyword(&self) -> &[&'static str];
fn default_position(&self) -> TripleTarget {
TripleTarget::Subject
}
fn unquote<'a>(&self, inp: &'a str) -> &'a str {
inp
}
fn quote(&self, inp: &str) -> String {
format!("{}", inp)
}
fn handles_prefix_completion(&self) -> bool {
false
}
}