Semantic highlighting spike
Very simple approach: For each identifier, set the hash of the range where it's defined as its 'id' and use it in the VSCode extension to generate unique colors. Thus, the generated colors are per-file. They are also quite fragile, and I'm not entirely sure why. Looks like we need to make sure the same ranges aren't overwritten by a later request?
This commit is contained in:
@@ -523,6 +523,10 @@ impl<'a> SyntaxElement<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_ast_node<T: AstNode>(&self) -> Option<&T> {
|
||||
self.as_node().and_then(|x| <T as AstNode>::cast(x))
|
||||
}
|
||||
|
||||
pub fn as_token(&self) -> Option<SyntaxToken<'a>> {
|
||||
match self {
|
||||
SyntaxElement::Node(_) => None,
|
||||
|
||||
Reference in New Issue
Block a user