Skip to content

Commit 1d4d67c

Browse files
committed
Use lsp-types DECORATOR token type
1 parent 76bfcca commit 1d4d67c

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/rust-analyzer/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ anyhow = "1.0.57"
2222
crossbeam-channel = "0.5.5"
2323
dissimilar = "1.0.4"
2424
itertools = "0.10.3"
25-
lsp-types = { version = "0.93.0", features = ["proposed"] }
25+
lsp-types = { version = "0.93.1", features = ["proposed"] }
2626
parking_lot = "0.12.1"
2727
xflags = "0.2.4"
2828
oorandom = "11.1.3"
@@ -88,5 +88,5 @@ in-rust-tree = [
8888
"proc-macro-srv/sysroot-abi",
8989
"sourcegen/in-rust-tree",
9090
"ide/in-rust-tree",
91-
"syntax/in-rust-tree"
91+
"syntax/in-rust-tree",
9292
]

crates/rust-analyzer/src/semantic_tokens.rs

+13-15
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ macro_rules! define_semantic_token_types {
1212
$(pub(crate) const $ident: SemanticTokenType = SemanticTokenType::new($string);)*
1313

1414
pub(crate) const SUPPORTED_TYPES: &[SemanticTokenType] = &[
15+
SemanticTokenType::CLASS,
1516
SemanticTokenType::COMMENT,
17+
SemanticTokenType::ENUM_MEMBER,
18+
SemanticTokenType::ENUM,
19+
SemanticTokenType::FUNCTION,
20+
SemanticTokenType::INTERFACE,
1621
SemanticTokenType::KEYWORD,
17-
SemanticTokenType::STRING,
22+
SemanticTokenType::MACRO,
23+
SemanticTokenType::METHOD,
24+
SemanticTokenType::NAMESPACE,
1825
SemanticTokenType::NUMBER,
19-
SemanticTokenType::REGEXP,
2026
SemanticTokenType::OPERATOR,
21-
SemanticTokenType::NAMESPACE,
22-
SemanticTokenType::TYPE,
27+
SemanticTokenType::PARAMETER,
28+
SemanticTokenType::PROPERTY,
29+
SemanticTokenType::REGEXP,
30+
SemanticTokenType::STRING,
2331
SemanticTokenType::STRUCT,
24-
SemanticTokenType::CLASS,
25-
SemanticTokenType::INTERFACE,
26-
SemanticTokenType::ENUM,
27-
SemanticTokenType::ENUM_MEMBER,
2832
SemanticTokenType::TYPE_PARAMETER,
29-
SemanticTokenType::FUNCTION,
30-
SemanticTokenType::METHOD,
31-
SemanticTokenType::PROPERTY,
32-
SemanticTokenType::MACRO,
33+
SemanticTokenType::TYPE,
3334
SemanticTokenType::VARIABLE,
34-
SemanticTokenType::PARAMETER,
3535
$($ident),*
3636
];
3737
};
@@ -52,8 +52,6 @@ define_semantic_token_types![
5252
(COMMA, "comma"),
5353
(COMPARISON, "comparison"),
5454
(CONST_PARAMETER, "constParameter"),
55-
// FIXME: to be replaced once lsp-types has the upstream version
56-
(DECORATOR, "decorator"),
5755
(DERIVE, "derive"),
5856
(DERIVE_HELPER, "deriveHelper"),
5957
(DOT, "dot"),

crates/rust-analyzer/src/to_proto.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ fn semantic_token_type_and_modifiers(
558558
let mut mods = semantic_tokens::ModifierSet::default();
559559
let type_ = match highlight.tag {
560560
HlTag::Symbol(symbol) => match symbol {
561-
SymbolKind::Attribute => semantic_tokens::DECORATOR,
561+
SymbolKind::Attribute => lsp_types::SemanticTokenType::DECORATOR,
562562
SymbolKind::Derive => semantic_tokens::DERIVE,
563563
SymbolKind::DeriveHelper => semantic_tokens::DERIVE_HELPER,
564564
SymbolKind::Module => lsp_types::SemanticTokenType::NAMESPACE,

0 commit comments

Comments
 (0)