diff options
author | Aleksey Kladov <[email protected]> | 2020-12-19 14:10:47 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-12-19 14:10:47 +0000 |
commit | a13947abe62a44c4ffa802be54e041a3d18e7f2b (patch) | |
tree | 7675fa96ea2df477f30d7e6acb060ed379b86ef1 /crates/rust-analyzer/src/to_proto.rs | |
parent | bd270cbc024f56596c315061d10732ebbe16eef9 (diff) |
Use more Rustic highlighting specifiers
*Method* works for OO languages, but in rust we can also have
associated constants & types, so let's move this to a modifier.
Diffstat (limited to 'crates/rust-analyzer/src/to_proto.rs')
-rw-r--r-- | crates/rust-analyzer/src/to_proto.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 229df47dc..9bea7366b 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -381,7 +381,13 @@ fn semantic_token_type_and_modifiers( | |||
381 | SymbolKind::ValueParam => lsp_types::SemanticTokenType::PARAMETER, | 381 | SymbolKind::ValueParam => lsp_types::SemanticTokenType::PARAMETER, |
382 | SymbolKind::SelfParam => semantic_tokens::SELF_KEYWORD, | 382 | SymbolKind::SelfParam => semantic_tokens::SELF_KEYWORD, |
383 | SymbolKind::Local => lsp_types::SemanticTokenType::VARIABLE, | 383 | SymbolKind::Local => lsp_types::SemanticTokenType::VARIABLE, |
384 | SymbolKind::Function => lsp_types::SemanticTokenType::FUNCTION, | 384 | SymbolKind::Function => { |
385 | if highlight.modifiers.contains(HighlightModifier::Associated) { | ||
386 | lsp_types::SemanticTokenType::METHOD | ||
387 | } else { | ||
388 | lsp_types::SemanticTokenType::FUNCTION | ||
389 | } | ||
390 | } | ||
385 | SymbolKind::Const => { | 391 | SymbolKind::Const => { |
386 | mods |= semantic_tokens::CONSTANT; | 392 | mods |= semantic_tokens::CONSTANT; |
387 | mods |= lsp_types::SemanticTokenModifier::STATIC; | 393 | mods |= lsp_types::SemanticTokenModifier::STATIC; |
@@ -401,7 +407,6 @@ fn semantic_token_type_and_modifiers( | |||
401 | }, | 407 | }, |
402 | HighlightTag::BuiltinType => semantic_tokens::BUILTIN_TYPE, | 408 | HighlightTag::BuiltinType => semantic_tokens::BUILTIN_TYPE, |
403 | HighlightTag::Generic => semantic_tokens::GENERIC, | 409 | HighlightTag::Generic => semantic_tokens::GENERIC, |
404 | HighlightTag::Method => lsp_types::SemanticTokenType::METHOD, | ||
405 | HighlightTag::ByteLiteral | HighlightTag::NumericLiteral => { | 410 | HighlightTag::ByteLiteral | HighlightTag::NumericLiteral => { |
406 | lsp_types::SemanticTokenType::NUMBER | 411 | lsp_types::SemanticTokenType::NUMBER |
407 | } | 412 | } |
@@ -431,6 +436,7 @@ fn semantic_token_type_and_modifiers( | |||
431 | HighlightModifier::Unsafe => semantic_tokens::UNSAFE, | 436 | HighlightModifier::Unsafe => semantic_tokens::UNSAFE, |
432 | HighlightModifier::Callable => semantic_tokens::CALLABLE, | 437 | HighlightModifier::Callable => semantic_tokens::CALLABLE, |
433 | HighlightModifier::Static => lsp_types::SemanticTokenModifier::STATIC, | 438 | HighlightModifier::Static => lsp_types::SemanticTokenModifier::STATIC, |
439 | HighlightModifier::Associated => continue, | ||
434 | }; | 440 | }; |
435 | mods |= modifier; | 441 | mods |= modifier; |
436 | } | 442 | } |