Support tokenization tooltips in the C# mod

This commit is contained in:
2025-12-02 00:00:42 -07:00
parent 8aadb95f36
commit 0f1613d521
3 changed files with 14 additions and 2 deletions

View File

@@ -88,6 +88,15 @@ pub enum TokenType {
EOF,
}
impl Documentation for TokenType {
fn docs(&self) -> String {
match self {
Self::Keyword(k) => k.docs(),
_ => "".into(),
}
}
}
impl From<TokenType> for u32 {
fn from(value: TokenType) -> Self {
use TokenType::*;

View File

@@ -1,4 +1,5 @@
use compiler::Compiler;
use helpers::Documentation;
use parser::Parser;
use safer_ffi::prelude::*;
use std::io::BufWriter;
@@ -151,8 +152,8 @@ pub fn tokenize_line(input: safer_ffi::slice::Ref<'_, u16>) -> safer_ffi::Vec<Ff
column: column as i32,
error: "".into(),
length: (original_string.unwrap_or_default().len()) as i32,
tooltip: token_type.docs().into(),
token_kind: token_type.into(),
tooltip: "".into(),
}),
}
}