Lukas Wirth
1f87a41989
Add attribute highlight modifier to all tokens inside attributes
2020-11-21 12:51:05 +01:00
bors[bot]
0a715cfbd2
Merge #6472
...
6472: Add `static` modifier for associated functions r=matklad a=p3achyjr
Adds static semantic token modifier to associated functions, resolves #6194
## Info
- Associated functions are more-or-less equivalent to static methods in other languages. This PR checks, for each function, whether that function has a self_param, and whether it's enclosed in a trait/impl.
## Changes
- Added method ```is_associated``` to code_model::Function. This basically gets the source from the ast, and checks whether the enclosing scope is an impl or trait.
- Added `static` to HighlightModifiers
- Added unit test
## Tests
- Ran ```cargo test```
Co-authored-by: Anatol Liu <axlui@anatols-mbp.lan>
2020-11-09 21:13:51 +00:00
Anatol Liu
6b950d24d4
Add static semantic token modifier for associated functions with no &self
...
refactor logic into code_model.rs
address comments
2020-11-09 13:09:20 -08:00
Aleksey Kladov
9634521abd
. is an operator
...
closes #6498
2020-11-09 18:12:28 +01:00
Anatol Liu
90031a267a
Add static semantic token modifier for associated functions with no &self
...
refactor logic into code_model.rs
address comments
2020-11-08 00:01:02 -08:00
Aleksey Kladov
5ba4f949c2
Kill RAW_ literals
...
Syntactically, they are indistinguishable from non-raw versions, so it
doesn't make sense to separate then *at the syntax* level.
2020-11-06 22:23:14 +01:00
Anatol Liu
771c0d8c08
Add static semantic token modifier for associated functions with no &self
...
refactor logic into code_model.rs
2020-11-04 21:55:44 -08:00
Anatol Liu
3baa526fb0
Add static semantic token modifier for associated functions with no &self
2020-11-04 20:08:46 -08:00
Aleksey Kladov
ba8d6d1e4e
Remove more unreachable pubs
2020-11-02 16:58:33 +01:00
Lukas Wirth
269e67312d
Highlight never type as BuiltinType
2020-10-26 22:27:30 +01:00
Lukas Wirth
c9af469b85
Fix unary minus highlighting
2020-10-25 23:05:30 +01:00
GrayJack
a483b5545d
Add Callable modifier for variables that implements Fnonce
2020-10-16 07:52:18 -03:00
GrayJack
83d6bc7113
Add HighlightModifier::Callable and add it for locals
2020-10-16 06:38:32 -03:00
Aleksey Kladov
56e67e3a39
More idiomatic classification API
2020-10-15 17:38:17 +02:00
Aleksey Kladov
f9c1336873
More clarifications
2020-10-15 17:37:55 +02:00
Aleksey Kladov
bc287b8f9b
Unconfuse expression and pattern field init shorthands
2020-10-15 17:37:36 +02:00
Lukas Wirth
bab29e65eb
Default::default the highlighters
2020-10-14 22:50:26 +02:00
Lukas Wirth
8c6dc5f28a
Factor macro_rules! highlighting out
2020-10-14 19:23:59 +02:00
Lukas Wirth
df87be88d8
Factor format string highlighting out
2020-10-14 19:23:45 +02:00
Lukas Wirth
1416413d69
Skip macro matcher fragment name semantic highlighting
2020-10-10 23:21:12 +02:00
Paul Daniel Faria
a1a7b07ad3
Fix handling of consuming self, refactor shared logic into a single function
2020-09-06 14:34:01 -04:00
Paul Daniel Faria
7af947a032
Add consuming modifier to lvalues that are passed by value and not Copy
2020-09-06 12:26:53 -04:00
bors[bot]
e65d48d1fb
Merge #5823
...
5823: Don't underline function definition if self is &mut r=Nashenas88 a=matklad
The self is right there, and is already underlined, so it makes little
sense to emit even more underlines.
before:
![before](https://user-images.githubusercontent.com/1711539/90672843-0d379500-e257-11ea-840f-b0caed4410f1.png )
after:
![after](https://user-images.githubusercontent.com/1711539/90672840-0c9efe80-e257-11ea-9739-23af433841c6.png )
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-22 14:41:17 +00:00
Aleksey Kladov
863b1fb731
⬆️ ungrammar
2020-08-21 19:14:05 +02:00
Aleksey Kladov
8000d1d30d
Don't underline function definition if self is &mut
...
The self is right there, and is already underlined, so it makes little
sense to emit even more underlines.
2020-08-19 20:02:33 +02:00
Aleksey Kladov
eb7bb2cba0
Remove dead code
2020-08-19 19:54:00 +02:00
Aleksey Kladov
b56e020077
Apply couple of rule of thumbs to simplify highlighting code
...
Main one: instead of adding a parameter to function to handle special
case, make the caller handle it.
Second main one: make sure that function does a reasonable thing.
`highlight_def` picks a color for def, *regardless* of the context
the def is use. Feeding an info from the call-site muddies the
responsibilities here.
Minor smells, flagging the function as having space for improvement in
the first place:
* many parameters, some of which are set as constants on most
call-sites (introduce severalfunction instad)
* boolean param (add two functions instead)
2020-08-19 17:53:41 +02:00
Aleksey Kladov
11a1bb1c3e
Inline trivial function
2020-08-19 17:41:56 +02:00
Aleksey Kladov
a9778c6d73
Simplify
2020-08-19 17:37:19 +02:00
Aleksey Kladov
0b62b990ba
Minor
2020-08-19 17:33:25 +02:00
Aleksey Kladov
422ac441c2
Minor cleanups
2020-08-19 17:31:26 +02:00
Aleksey Kladov
5da1dc9a8b
Better name
2020-08-19 17:30:43 +02:00
Aleksey Kladov
61754678fb
Better API factoring around self access modes
2020-08-19 17:02:50 +02:00
Aleksey Kladov
b9b4693ce3
Add SelfParam to code_model
2020-08-19 15:16:24 +02:00
Paul Daniel Faria
3456e2eec7
Add new method to Semantics, method_receiver_kind, which returns the kind of self
...
The options are Shared, Mutable, Consuming, and Copied. Use this to add proper
highlighting to methods based on usage.
2020-08-16 10:26:16 -04:00
Paul Daniel Faria
a044ff0138
Mark mutating functions with mutable
modifier, and owning functions with consuming
.
2020-08-16 10:22:51 -04:00
Aleksey Kladov
1b0c7701cc
Rename ra_ide -> ide
2020-08-13 17:58:27 +02:00