Support tokenization tooltips in the C# mod
This commit is contained in:
@@ -63,7 +63,9 @@ public static unsafe class SlangExtensions
|
|||||||
colIndex,
|
colIndex,
|
||||||
token.length,
|
token.length,
|
||||||
color,
|
color,
|
||||||
token.token_kind
|
token.token_kind,
|
||||||
|
0,
|
||||||
|
token.tooltip.AsString()
|
||||||
);
|
);
|
||||||
|
|
||||||
string errMsg = token.error.AsString();
|
string errMsg = token.error.AsString();
|
||||||
|
|||||||
@@ -88,6 +88,15 @@ pub enum TokenType {
|
|||||||
EOF,
|
EOF,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Documentation for TokenType {
|
||||||
|
fn docs(&self) -> String {
|
||||||
|
match self {
|
||||||
|
Self::Keyword(k) => k.docs(),
|
||||||
|
_ => "".into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<TokenType> for u32 {
|
impl From<TokenType> for u32 {
|
||||||
fn from(value: TokenType) -> Self {
|
fn from(value: TokenType) -> Self {
|
||||||
use TokenType::*;
|
use TokenType::*;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use compiler::Compiler;
|
use compiler::Compiler;
|
||||||
|
use helpers::Documentation;
|
||||||
use parser::Parser;
|
use parser::Parser;
|
||||||
use safer_ffi::prelude::*;
|
use safer_ffi::prelude::*;
|
||||||
use std::io::BufWriter;
|
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,
|
column: column as i32,
|
||||||
error: "".into(),
|
error: "".into(),
|
||||||
length: (original_string.unwrap_or_default().len()) as i32,
|
length: (original_string.unwrap_or_default().len()) as i32,
|
||||||
|
tooltip: token_type.docs().into(),
|
||||||
token_kind: token_type.into(),
|
token_kind: token_type.into(),
|
||||||
tooltip: "".into(),
|
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user