mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Merge #5643
5643: Add new consuming modifier, apply consuming and mutable to methods r=matklad a=Nashenas88 This adds a new `consuming` semantic modifier for syntax highlighters. This also emits `mutable` and `consuming` in two cases: - When a method takes `&mut self`, then it now has `function.mutable` emitted. - When a method takes `self`, and the type of `Self` is not `Copy`, then `function.consuming` is emitted. CC @flodiebold Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
This commit is contained in:
commit
529ca7e5e0
9 changed files with 220 additions and 49 deletions
|
@ -75,6 +75,7 @@ define_semantic_token_modifiers![
|
|||
(CONTROL_FLOW, "controlFlow"),
|
||||
(INJECTED, "injected"),
|
||||
(MUTABLE, "mutable"),
|
||||
(CONSUMING, "consuming"),
|
||||
(UNSAFE, "unsafe"),
|
||||
(ATTRIBUTE_MODIFIER, "attribute"),
|
||||
];
|
||||
|
|
|
@ -400,6 +400,7 @@ fn semantic_token_type_and_modifiers(
|
|||
HighlightModifier::Injected => semantic_tokens::INJECTED,
|
||||
HighlightModifier::ControlFlow => semantic_tokens::CONTROL_FLOW,
|
||||
HighlightModifier::Mutable => semantic_tokens::MUTABLE,
|
||||
HighlightModifier::Consuming => semantic_tokens::CONSUMING,
|
||||
HighlightModifier::Unsafe => semantic_tokens::UNSAFE,
|
||||
};
|
||||
mods |= modifier;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue