diff options
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/syntax_highlighting.rs | 24 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting/tags.rs | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index cf1a8bad7..7f7f4d38a 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs | |||
@@ -49,6 +49,30 @@ pub struct HlRange { | |||
49 | // The general rule is that a reference to an entity gets colored the same way as the entity itself. | 49 | // The general rule is that a reference to an entity gets colored the same way as the entity itself. |
50 | // We also give special modifier for `mut` and `&mut` local variables. | 50 | // We also give special modifier for `mut` and `&mut` local variables. |
51 | // | 51 | // |
52 | // .Token Modifiers | ||
53 | // | ||
54 | // Token modifiers allow to style some elements in the source code more precisely. | ||
55 | // | ||
56 | // Rust-analyzer currently emits the following token modifiers: | ||
57 | // | ||
58 | // [horizontal] | ||
59 | // associated:: Emitted for associated items. | ||
60 | // async:: Emitted for async functions and the `async` and `await` keywords. | ||
61 | // attribute:: Emitted for tokens inside attributes. | ||
62 | // callable:: Emitted for locals whose types implements one of the `Fn*` traits. | ||
63 | // consuming:: Emitted for locals that are being consumed when use in a function call. | ||
64 | // controlFlow:: Emitted for control-flow related tokens, this includes the `?` operator. | ||
65 | // declaration:: Emitted for names of definitions, like `foo` in `fn foo() {}`. | ||
66 | // documentation:: Emitted for documentation comments. | ||
67 | // injected:: Emitted for doc-string injected highlighting like rust source blocks in documentation. | ||
68 | // intraDocLink:: Emitted for intra doc links in doc-strings. | ||
69 | // library:: Emitted for items that are defined outside of the current crate. | ||
70 | // mutable:: Emitted for mutable locals and statics. | ||
71 | // static:: Emitted for "static" functions, also known as functions that do not take a `self` param. | ||
72 | // trait:: Emitted for associated trait items. | ||
73 | // unsafe:: Emitted for unsafe operations, like unsafe function calls, as well as the `unsafe` token. | ||
74 | // | ||
75 | // | ||
52 | // image::https://user-images.githubusercontent.com/48062697/113164457-06cfb980-9239-11eb-819b-0f93e646acf8.png[] | 76 | // image::https://user-images.githubusercontent.com/48062697/113164457-06cfb980-9239-11eb-819b-0f93e646acf8.png[] |
53 | // image::https://user-images.githubusercontent.com/48062697/113187625-f7f50100-9250-11eb-825e-91c58f236071.png[] | 77 | // image::https://user-images.githubusercontent.com/48062697/113187625-f7f50100-9250-11eb-825e-91c58f236071.png[] |
54 | pub(crate) fn highlight( | 78 | pub(crate) fn highlight( |
diff --git a/crates/ide/src/syntax_highlighting/tags.rs b/crates/ide/src/syntax_highlighting/tags.rs index e94f17cd9..9d481deae 100644 --- a/crates/ide/src/syntax_highlighting/tags.rs +++ b/crates/ide/src/syntax_highlighting/tags.rs | |||
@@ -37,6 +37,8 @@ pub enum HlTag { | |||
37 | None, | 37 | None, |
38 | } | 38 | } |
39 | 39 | ||
40 | // Don't forget to adjust the feature description in crates/ide/src/syntax_highlighting.rs. | ||
41 | // And make sure to use the lsp strings used when converting to the protocol in crates\rust-analyzer\src\semantic_tokens.rs, not the names of the variants here. | ||
40 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] | 42 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] |
41 | #[repr(u8)] | 43 | #[repr(u8)] |
42 | pub enum HlMod { | 44 | pub enum HlMod { |