Commit graph

525 commits

Author SHA1 Message Date
Benjamin Coenen
1c3a1385a5 Improve autocompletion by looking on the type and name
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-21 14:31:57 +02:00
Benjamin Coenen
af3c19e85f Merge branch 'master' of github.com:rust-analyzer/rust-analyzer 2020-04-18 17:14:24 +02:00
bors[bot]
0948932145
Merge #4026
4026: Omit more parameter hints in the presence of underscores r=matklad a=lnicola

Fixes #4017.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-04-18 09:01:41 +00:00
Laurențiu Nicola
8a51a74556 Omit more parameter hints in the presence of underscores 2020-04-18 10:53:48 +03:00
Leander Tentrup
2e2c03ee2d Fix incorrect order of syntax highlight ranges 2020-04-17 22:50:30 +02:00
Aleksey Kladov
028f1e2e3a Don\t suggest import itself as a completion for import 2020-04-17 14:28:20 +02:00
bors[bot]
0262c9b9c0
Merge #4010
4010: Fix handling of ranges in diagnostics r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-17 11:57:29 +00:00
Aleksey Kladov
a8196ffe84 Correctly highlight ranges of diagnostics from macros
closes #2799
2020-04-17 13:56:38 +02:00
Aleksey Kladov
3b75bc154f Better snippet when completing trait method 2020-04-17 12:05:35 +02:00
Benjamin Coenen
379787858b feat: improve dot completions with scoring
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-17 10:59:04 +02:00
Benjamin Coenen
0a1585075c Merge branch 'master' of github.com:rust-analyzer/rust-analyzer 2020-04-17 10:30:39 +02:00
Benjamin Coenen
071ef268b5 feat: improve dot completions with scoring
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-17 10:29:32 +02:00
Aleksey Kladov
cae2498513 Don't expose SyntaxNodePtr impl details 2020-04-16 21:01:04 +02:00
Benjamin Coenen
6ebc8bbeb0 feat: improve dot completions with scoring
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-16 18:30:08 +02:00
Benjamin Coenen
06076f95a7 feat: improve dot completions in a struct literal expression
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-15 22:10:57 +02:00
kjeremy
eedab116ab insta 0.16 2020-04-14 13:57:02 -04:00
Benjamin Coenen
b092bbc83d Merge branch 'master' of github.com:rust-analyzer/rust-analyzer 2020-04-14 19:20:30 +02:00
Benjamin Coenen
0640957429 Improve autocompletion by looking on the type and name, change implementation, include sort in Completions struct
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-12 17:58:06 +02:00
bors[bot]
a8e032820f
Merge #3955
3955: Align grammar for record patterns and literals r=matklad a=matklad

The grammar now looks like this

   [name_ref :] pat



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-11 22:01:22 +00:00
Aleksey Kladov
5e5eb6a108 Align grammar for record patterns and literals
The grammar now looks like this

   [name_ref :] pat
2020-04-12 00:00:15 +02:00
Benjamin Coenen
93bfc2d05d Improve autocompletion by looking on the type and name
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-11 23:45:09 +02:00
Benjamin Coenen
d42346fed6 Improve autocompletion by looking on the type and name
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-11 22:54:18 +02:00
Jeremy Kolb
0f5d6766fd Remove #[should_panic] from call_info tests 2020-04-11 15:47:09 -04:00
Aleksey Kladov
7a39bc3ba2 Make records grammar more orthogonal
We used

  name [: expr]

grammar before, now it is

  [name :] expr

which makes things simpler
2020-04-11 19:20:41 +02:00
Aleksey Kladov
8bd14a3483
Merge pull request #3910 from lnicola/fn-named-param-hint
Hide parameter hints for single-argument functions with the same name
2020-04-11 14:48:14 +02:00
Aleksey Kladov
5c5bde47fb Rename some tokens 2020-04-10 17:07:09 +02:00
Aleksey Kladov
c8b4c36f81 Semicolon token 2020-04-10 16:10:28 +02:00
Aleksey Kladov
30084a56a5 Simpler acessors for keywords 2020-04-09 23:42:01 +02:00
Aleksey Kladov
0ed27c388a Drop needless trait 2020-04-09 23:02:10 +02:00
Laurențiu Nicola
81aab500c6 Hide parameter hints for single-argument functions with the same name 2020-04-09 21:47:04 +03:00
bors[bot]
9635d8bc44
Merge #3901
3901: Add more heuristics for hiding obvious param hints r=matklad a=IceSentry

This will now hide `value`, `pat`, `rhs` and `other`. These words were selected from the std because they are used in commonly used functions with only a single param and are obvious by their use.

It will also hide the hint if the passed param **starts** or end with the param_name. Maybe we could also split on '_' and check if one of the string is the param_name.

I think it would be good to also hide `bytes` if the type is `[u8; n]` but I'm not sure how to get the param type signature.

Closes #3900 



Co-authored-by: IceSentry <c.giguere42@gmail.com>
2020-04-09 18:07:28 +00:00
Aleksey Kladov
2bfb65db93 Be consistent about token accesors 2020-04-09 18:48:13 +02:00
IceSentry
ebc61709c8 use .expr() to remove ref 2020-04-09 12:26:49 -04:00
IceSentry
ae416f3c6e clean up param hint checking 2020-04-09 10:35:07 -04:00
IceSentry
cba694c602 better &mut and & matching 2020-04-08 19:26:47 -04:00
IceSentry
de6db06322 ignore &mut and & when checking params 2020-04-08 19:07:21 -04:00
IceSentry
a2dc18f71a remove TODO 2020-04-08 18:11:24 -04:00
IceSentry
2a582b78a5 Add more heuristics for hiding obvious param hints
This will now hide "value", "pat", "rhs" and "other"
These words were selected from the std because they are used in common functions with only a single param and are obvious by their use.
I think it would be good to also hide "bytes" if the type is `[u8; n]` but I'm not sure how to get the param type signature

It will also hide the hint if the passed param starts or end with the param_name
2020-04-08 17:48:16 -04:00
bors[bot]
8ea7c9cb62
Merge #3826
3826: Flatten nested highlight ranges during DFS traversal r=matklad a=ltentrup

Implements the flattening of nested highlights from #3447.


There is a caveat: I needed to add `Clone` to `HighlightedRange` to split highlight ranges  ~and the nesting does not appear in the syntax highlighting test (it does appear in the accidental-quadratic test but there it is not checked against a ground-truth)~.

I have added a test case for the example mentioned in #3447.

Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
2020-04-08 12:00:08 +00:00
Aleksey Kladov
4c29214bba Move computation of missing fields into hir 2020-04-07 18:34:17 +02:00
Aleksey Kladov
7819d99d6b Add functional update test 2020-04-07 18:25:47 +02:00
Aleksey Kladov
d8f6013404 Fix names of test modules 2020-04-07 18:23:18 +02:00
bors[bot]
33c364b545
Merge #3878
3878: A more precise panic macro r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-07 14:41:07 +00:00
Aleksey Kladov
3bde2b7423 A more precise panic macro 2020-04-07 16:40:39 +02:00
Aleksey Kladov
5540193fc8 Don't insert !() if there's already some 2020-04-07 16:37:33 +02:00
Aleksey Kladov
73ccf7f495 Reorder imports 2020-04-07 15:07:18 +02:00
Josh Mcguigan
8c378af721 missing match arms diagnostic 2020-04-07 05:12:08 -07:00
Aleksey Kladov
0215560434 Better naming for scope completion 2020-04-07 13:20:41 +02:00
Aleksey Kladov
a5ffe53c9d Better naming for path completion 2020-04-07 13:19:57 +02:00
Aleksey Kladov
baf9fcc38e
Merge pull request #3866 from lnicola/fewer-braces
Fix unnecessary braces warnings
2020-04-07 09:22:33 +02:00