Commit Graph

15629 Commits

Author SHA1 Message Date
ivan770
71a97a2d8c
Provide regions in file structure 2021-03-14 18:53:37 +02:00
bors[bot]
af8440b848
Merge #8014
8014: increase completion relevance for items in local scope r=matklad a=JoshMcguigan

This PR provides a small completion relevance score bonus for items in local scope. The changes here are relatively minimal, since `coc` by default pre-sorts by position in file. But as we move toward fully server side sorting #7935 I think we'll want some relevance score bump for items in local scope. 

### Before

Note `let~` and `syntax` are both ahead of locals. Ultimately we may decide that `let~` is a high relevance completion given my cursor position here, but that should be done with some explicit scoring on the server side, rather than being caused by (I think) `coc` preferring shorter completions. 

![pre-local-score](https://user-images.githubusercontent.com/22216761/111073414-c97ad600-849b-11eb-84e7-fcee130536f0.png)

### After

![post-local-score](https://user-images.githubusercontent.com/22216761/111073422-d0094d80-849b-11eb-92ec-7ae5ec3b190d.png)


Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2021-03-14 15:56:29 +00:00
bors[bot]
406e4be04c
Merge #8016
8016: More Chalk adaptations r=flodiebold a=flodiebold

 - rename a bunch of fields
 - use `chalk_ir::FnSig`

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-14 15:34:37 +00:00
Florian Diebold
1954147834 More renaming 2021-03-14 16:33:27 +01:00
Florian Diebold
eea777c714 Use chalk_ir::FnSig 2021-03-14 16:30:43 +01:00
Florian Diebold
3411fe3e84 Rename some fields to their Chalk names 2021-03-14 16:30:43 +01:00
Josh Mcguigan
ba924d04b3 increase completion relevance for items in local scope 2021-03-14 08:00:47 -07:00
bors[bot]
f57e2f5598
Merge #7993
7993: Use auto-deref in completion scoring r=JoshMcguigan a=ivan770

Closes #7982 

Co-authored-by: ivan770 <leshenko.ivan770@gmail.com>
2021-03-14 14:27:53 +00:00
bors[bot]
a32ca8ef79
Merge #8013
8013: Fix `cargo xtask lint` references r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-03-14 14:19:31 +00:00
Laurențiu Nicola
dd9974c59d Fix cargo xtask lint references 2021-03-14 15:24:34 +02:00
bors[bot]
0c2f570151
Merge #8012
8012: xtask: replace "lint" command by a simply cargo alias r=matklad a=matthiaskrgr

This strips the run_clippy implementation out of xtask and replaces it by
a simple "cargo lint" alias which runs clippy with the corresponding flags.

Unfortunately  I could not name the alias "clippy" because that would lead to infinite recursion. 😅 

Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2021-03-14 13:10:06 +00:00
Matthias Krüger
5008e56821 xtask: replace "lint" command by a simply cargo alias
This strips the run_clippy implementation out of xtask and replaces it by
a simple "cargo lint" alias which runs clippy with the corresponding flags.

Unfortunately  I could not name the alias "clippy" because that would lead to infinite recursion.
2021-03-14 13:36:45 +01:00
bors[bot]
a8a7fa8347
Merge #8011
8011: Add no-sysroot flag for analysis-stats r=edwin0cheng a=edwin0cheng

Add `no-sysroot` flag for `rust-analyzer analysis-stats`. It is very useful for debugging propose. 

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-03-14 10:50:59 +00:00
Edwin Cheng
8cc0c7f420 Add no-sysroot flag for analysis-stats 2021-03-14 18:31:14 +08:00
ivan770
8a9ebe62a1
Skip ref_match on same types, remove sorting in tests 2021-03-14 12:25:37 +02:00
bors[bot]
48adf6b697
Merge #8010
8010: Attach trivia to ast::Union nodes r=Veykril a=Veykril

Closes #8007
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-14 10:13:38 +00:00
Lukas Wirth
6e6d75bbdc Attach trivia to ast::Union nodes 2021-03-14 11:11:01 +01:00
bors[bot]
ab3f584299
Merge #8006
8006: Simpify mbe bindings builder r=edwin0cheng a=edwin0cheng

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-03-14 03:57:58 +00:00
Edwin Cheng
7279749bbb Simpify mbe bindings builder 2021-03-14 11:54:19 +08:00
bors[bot]
7808982952
Merge #8005
8005: Make sure ill-form macro handle propely r=edwin0cheng a=edwin0cheng

Fix #7987

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-03-14 03:26:32 +00:00
Edwin Cheng
b3b91046dd Make sure ill-form macro handle propely 2021-03-14 11:24:55 +08:00
bors[bot]
f80e1080d3
Merge #8003
8003: Move type lowering methods to TyLoweringContext r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-13 21:45:30 +00:00
Florian Diebold
3743ede404 Move type lowering methods to TyLoweringContext 2021-03-13 22:44:36 +01:00
bors[bot]
d3ca2ab959
Merge #8002
8002: Create TraitEnvironment through a query r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-13 19:39:54 +00:00
Florian Diebold
c82d1823a1 Create TraitEnvironment through a query 2021-03-13 20:38:45 +01:00
bors[bot]
17eeb2a6d2
Merge #8001
8001: More Chalk IDs r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-13 19:08:29 +00:00
Florian Diebold
b035c314b4 Use chalk_ir::OpaqueTyId 2021-03-13 20:05:47 +01:00
Florian Diebold
1bf6b7360c Use chalk_ir::PlaceholderIndex 2021-03-13 19:47:34 +01:00
Florian Diebold
2d69eb131f Use chalk_ir::ClosureId 2021-03-13 19:27:09 +01:00
bors[bot]
be7a31fbd6
Merge #7999
7999: Handle `cfg_attr` gating multiple attributes r=jonas-schievink a=jonas-schievink

Apparently `#[cfg_attr(cfg_expr, attr1, attr2)]` is valid, so let's add support for that.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-13 17:20:16 +00:00
Jonas Schievink
1848bd0fa0 Handle cfg_attr gating multiple attributes 2021-03-13 18:18:42 +01:00
Jonas Schievink
72785fb94d Extend cfg_attr test 2021-03-13 18:18:05 +01:00
bors[bot]
6ab405f2e9
Merge #7998
7998: Use more Chalk IDs r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-13 16:58:04 +00:00
Florian Diebold
9719ce9fc7 Use chalk_ir::FnDefId 2021-03-13 17:56:48 +01:00
Florian Diebold
19664e276a Use chalk_ir::AssocTypeId 2021-03-13 17:56:48 +01:00
Florian Diebold
dfafcd926a Use chalk_ir::ForeignDefId 2021-03-13 17:56:48 +01:00
ivan770
661cc7f0c8
Added both references and original matches to tests 2021-03-13 18:31:52 +02:00
bors[bot]
d453378569
Merge #7997
7997: fix folding range kind r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-13 16:25:02 +00:00
Aleksey Kladov
a9c3e70443 fix folding range kind 2021-03-13 19:24:28 +03:00
ivan770
32ad929b82
Fix incorrect DerefMut test reference type 2021-03-13 17:28:05 +02:00
ivan770
3bc5d81a33
Make relevance tests display references, suggest derefs only when needed 2021-03-13 17:25:41 +02:00
bors[bot]
bcf2169e7d
Merge #7996
7996: Separate `Ty` and `TyKind` like in Chalk r=flodiebold a=flodiebold

Currently `Ty` just wraps `TyKind`, but this allows us to change most
places to already use `intern` / `interned`.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-13 15:18:38 +00:00
Florian Diebold
6c32bbf3ca Separate Ty and TyKind like in Chalk
Currently `Ty` just wraps `TyKind`, but this allows us to change most
places to already use `intern` / `interned`.
2021-03-13 16:17:15 +01:00
bors[bot]
7accf6bc37
Merge #7799
7799: Related tests r=matklad a=vsrs

![tests](https://user-images.githubusercontent.com/62505555/109397453-a9013680-7947-11eb-8b11-ac03079f7645.gif)
This adds an ability to look for tests for the item under the cursor: function, constant, data type, etc

The LSP part is bound to change. But the feature itself already works and I'm looking for a feedback :)



Co-authored-by: vsrs <vit@conrlab.com>
2021-03-13 13:50:35 +00:00
ivan770
75cb441fba
Simplify call site and deref completion test 2021-03-13 15:32:37 +02:00
bors[bot]
9674490b45
Merge #7981
7981: Allow applying De Morgan's law to multiple terms at once r=matklad a=shepmaster



Co-authored-by: Jake Goulding <jake.goulding@gmail.com>
2021-03-13 13:31:55 +00:00
bors[bot]
ceffcf8a11
Merge #7984
7984: Improve version display r=matklad a=lnicola

Maybe closes #7854

The version string for unreleased builds looks like this now:

```
$ rust-analyzer --version
rust-analyzer 2021-03-08-159-gc0459c535
```

Release builds should only have the tag name (`2021-03-15`).

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-03-13 13:22:25 +00:00
bors[bot]
fe4a94fff3
Merge #7994
7994: Speed up mbe matching in heavy recursive cases r=edwin0cheng a=edwin0cheng

In some cases (e.g.  #4186), mbe matching is very slow due to a lot of copy and allocation for bindings, this PR try to solve this problem by introduce a semi "link-list" approach for bindings building.

I used this [test case](https://github.com/weiznich/minimal_example_for_rust_81262) (for `features(32-column-tables)`) to run following command to benchmark:
```
time rust-analyzer analysis-stats  --load-output-dirs ./ 
```

Before this PR : 2 mins
After this PR: 3 seconds.

However, for 64-column-tables cases, we still need 4 mins to complete. 

I will try to investigate in the following weeks.

bors r+




Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-03-13 13:04:45 +00:00
Edwin Cheng
9117148f42 Add bindings builder for speed up matching 2021-03-13 20:52:36 +08:00
ivan770
d064ed5f63
Count derefs as matched types if possible 2021-03-13 14:34:11 +02:00