diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-15 11:00:10 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-15 11:00:10 +0100 |
commit | 6f3c8dc11d477a6d680ce018e93f007c31499bd5 (patch) | |
tree | ca759aa18be3bb4d30e42ae6e11e14dd673bfe1f /crates/ra_ide/src/syntax_highlighting | |
parent | b8b41c5f41a0cf8bf9c15a3bbcdd8d626eb41772 (diff) | |
parent | 91b35d882776d7ae8891b3aecf9879164ef183b5 (diff) |
Merge #5345
5345: Semantic Highlighting: Emit mutable modifier for 'self' when applicable r=matklad a=Veykril
This PR implements emitting the mutable modifier for the self keyword when applicable for semantic highlighting as mentioned in #5041. The rendered highlighting test html file:
![firefox_5lbsFNBqsT](https://user-images.githubusercontent.com/3757771/87346245-a5a07280-c551-11ea-9051-e5901255f8c9.png)
As you can see it does not emit the modifier when `self` is not used in a mutable context even if it is declared mutably in the enclosing function. I'm not sure if this is actually something wanted or not.
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting')
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/tests.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs index aa7c887d6..87a6e2523 100644 --- a/crates/ra_ide/src/syntax_highlighting/tests.rs +++ b/crates/ra_ide/src/syntax_highlighting/tests.rs | |||
@@ -25,6 +25,16 @@ impl Bar for Foo { | |||
25 | } | 25 | } |
26 | } | 26 | } |
27 | 27 | ||
28 | impl Foo { | ||
29 | fn baz(mut self) -> i32 { | ||
30 | self.x | ||
31 | } | ||
32 | |||
33 | fn qux(&mut self) { | ||
34 | self.x = 0; | ||
35 | } | ||
36 | } | ||
37 | |||
28 | static mut STATIC_MUT: i32 = 0; | 38 | static mut STATIC_MUT: i32 = 0; |
29 | 39 | ||
30 | fn foo<'a, T>() -> T { | 40 | fn foo<'a, T>() -> T { |