Support tokenization tooltips in the C# mod
This commit is contained in:
@@ -63,7 +63,9 @@ public static unsafe class SlangExtensions
|
||||
colIndex,
|
||||
token.length,
|
||||
color,
|
||||
token.token_kind
|
||||
token.token_kind,
|
||||
0,
|
||||
token.tooltip.AsString()
|
||||
);
|
||||
|
||||
string errMsg = token.error.AsString();
|
||||
|
||||
@@ -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::*;
|
||||
|
||||
@@ -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(),
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user