Commit Graph

14095 Commits

Author SHA1 Message Date
bors[bot]
0dec77abe7
Merge #7018
7018: Cleanup handle_code_action r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-23 10:51:56 +00:00
Aleksey Kladov
2ec92b3dc3 Make code more direct
* Push control flow outwards, as per
  https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/style.md#preconditions

* Don't re-do the work, pass-in the arguments
2020-12-23 13:51:30 +03:00
bors[bot]
fd1fcf2c2e
Merge #7010
7010: Update ungrammar for const block patterns r=matklad a=Veykril

Fixes #6848

Adds const blocks and const block patterns to the AST and parses them.

Blocked on https://github.com/rust-analyzer/ungrammar/pull/17/, will merge that PR there once this one gets the OK so I can remove the local ungrammar dependency path and fix the Cargo.lock.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-23 10:37:30 +00:00
Lukas Wirth
bdd8c0b68f Remove local ungrammar dependency 2020-12-23 11:22:36 +01:00
Aleksey Kladov
3ced546033 Make code more understandable
Avoid mutation of snapshot's config -- that's spooky action at a
distance. Instead, copy it over to a local variable.

This points out a minor architecture problem, which we won't fix right
away.

Various `ide`-level config structs, like `AssistConfig`, are geared
towards one-shot use when calling a specific methods. On the other
hand, the large `Config` struct in `rust-analyzer` is a long-term
config store.

The fact that `Config` stores `AssistConfig` is accidental -- a better
design would probably be to just store `ConfigData` inside `Config`
and create various `Config`s on the fly out of it.
2020-12-23 13:16:24 +03:00
Aleksey Kladov
e1aca75974 Rename for clarity 2020-12-23 13:14:05 +03:00
bors[bot]
b0d81d98db
Merge #7017
7017: Document `make` module design r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-23 10:02:11 +00:00
Aleksey Kladov
f00f75a078 Document make module design 2020-12-23 13:01:31 +03:00
bors[bot]
ee06096b0c
Merge #6960
6960: Show enum variant on Self qualified paths r=matklad a=Veykril

Fixes first part of #6549
Fixes #6550

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-23 09:48:04 +00:00
Laurențiu Nicola
18a7b98b2e Bump rustc_lexer 2020-12-23 11:24:52 +02:00
bors[bot]
85a2875161
Merge #7015
7015: Disable the unaligned feature of the object crate r=lnicola a=lnicola

We `mmap` the files so they should be reasonably aligned.

Let's see what https://github.com/rust-analyzer/rust-analyzer/pull/6817#issuecomment-744866239 is about.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-23 08:49:36 +00:00
Laurențiu Nicola
56deb240b2 Disable unaligned feature for the object crate 2020-12-23 10:40:12 +02:00
bors[bot]
8aa2eb76dc
Merge #7014
7014: Set RA_TARGET at job level r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-23 08:38:29 +00:00
Laurențiu Nicola
2707dc384d Set RA_TARGET at job level 2020-12-23 10:13:19 +02:00
bors[bot]
5e005cd91e
Merge #7013
7013: Don't think that /submod.rs is /mod.rs r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-23 08:04:35 +00:00
Aleksey Kladov
2c84c2d07a Don't think that /submod.rs is /mod.rs 2020-12-23 11:02:42 +03:00
bors[bot]
58b6763f20
Merge #7012
7012: Document, how to view config in effect r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-23 07:47:40 +00:00
Aleksey Kladov
7c07bb6381 Document, how to view config in effect 2020-12-23 10:47:05 +03:00
bors[bot]
f7f85cdd8d
Merge #7011
7011: Don't release uncompressed binaries under the new naming scheme r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-23 07:03:43 +00:00
Laurențiu Nicola
25a987703c Don't release uncompressed binaries under the new naming scheme 2020-12-23 08:46:38 +02:00
bors[bot]
493e29d713
Merge #7000
7000: Store invocation site for eager macros r=edwin0cheng a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6992

r? @edwin0cheng 

I'm not sure if this is totally correct, it looks like we create **two** `EagerCallLoc`s per macro invocation, one for the arguments (?), and one for the actual macro call. I gave both the same `AstId`, hopefully that's correct.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-12-23 06:22:28 +00:00
Lukas Wirth
2c94c4964a Parse const effect block 2020-12-23 02:15:44 +01:00
Lukas Wirth
03a9bbacf2 Parse ConstBlockPat 2020-12-23 01:49:43 +01:00
Lukas Wirth
be7260485e Update ungrammar for const block patterns 2020-12-23 01:26:31 +01:00
bors[bot]
4a2f60cb7b
Merge #6964
6964: Add full pattern completions for Struct and Variant patterns r=matklad a=Veykril


Just gonna call it full pattern completion as pattern completion is already implemented in a sense by showing idents in pattern position. What this does is basically complete struct and variant patterns where applicable(function params, let statements and refutable pattern locations).

This does not replace just completing the corresponding idents of the structs and variants, instead two completions are shown for these, a completion for the ident itself and a completion for the pattern(if the pattern make sense to be used that is). I figured in some cases one would rather type out the pattern manually if it has a lot of fields but you only care about one since this completion would cause one more work in the end since you would have to delete all the extra matched fields again.

These completions are tagged as `CompletionKind::Snippet`, not sure if that is the right one here.
<details>
  <summary>some gifs</summary>

![dx2lxgzhj3](https://user-images.githubusercontent.com/3757771/102719967-6987ef80-42f1-11eb-8ae0-8aff53777860.gif)
![EP2E7sJLkB](https://user-images.githubusercontent.com/3757771/102785777-c7264580-439e-11eb-8a64-f142e19fb65b.gif)
![JMNHHWknr9](https://user-images.githubusercontent.com/3757771/102785796-d1e0da80-439e-11eb-934b-218ada31b51c.gif)
</details>

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-22 18:03:51 +00:00
Lukas Wirth
83121efcd5 Reduce some more code duplication 2020-12-22 19:00:38 +01:00
bors[bot]
94f661c62a
Merge #7001
7001: Add support for downloading aarch64-apple-darwin binaries r=matklad a=lnicola

There's also a slight behavior change here: we no longer download our 64-binaries on 32-bit Darwin and Linux. We still do that on Windows, as I don't know how to detect 32-bit Node on 64 Windows.

But some people install the 32-bit Code by mistake, I doubt 32-bit Windows is that popular in the Rust crowd.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-22 16:38:12 +00:00
bors[bot]
b28322eed6
Merge #7005
7005: Improve extract_module_to_file assist r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-22 16:15:20 +00:00
Aleksey Kladov
41bc32368e Improve extract_module_to_file assist
* simplify code
* correctly handle crate roots and mod.rs files (nested inline modules
  are still mishandled)
* make sure that new text contains a trailing newline
2020-12-22 19:13:53 +03:00
bors[bot]
5506933a93
Merge #7002
7002: Extension conflict check detects more combinations r=extremegf a=extremegf

This will also detect conflicts with kalitaalexey.vscode-rust and work correctly after RA is integrated with rust-lang.rust extension.

Co-authored-by: Przemyslaw Horban <p.horban@invinets.com>
Co-authored-by: P. Horban <extremegf@gmail.com>
2020-12-22 15:23:36 +00:00
P. Horban
92b13d2fab
Fix grammar nit
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-12-22 16:22:33 +01:00
bors[bot]
013739c73d
Merge #6993
6993: Clean up descriptions for settings r=matklad a=rherrmann

Use two consecutive newlines (`\n\n`) to actually continue text on a
new line.

Use proper markup to reference related settings.

Consistently format references to files, command line arguments, etc.
as `code`. Format mentions of UI elements in _italic_.

Fix typos, add missing full-stops, add missing default values.

Co-authored-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
2020-12-22 15:07:36 +00:00
Przemyslaw Horban
a8b60afc2a Extension conflict check detests more combinations 2020-12-22 15:53:00 +01:00
Laurențiu Nicola
5ff576f503 Add support for downloading aarch64-apple-darwin binaries, change naming convention 2020-12-22 16:48:49 +02:00
Jonas Schievink
26f604b907 Store invocation site for eager macros 2020-12-22 15:02:03 +01:00
Rüdiger Herrmann
9f070531a6 Clean up descriptions for settings
Use two consecutive newlines (`\n\n`) to actually continue text on a
new line.

Use proper markup to reference related settings.

Consistently format references to files, editor commands, command line
arguments, files, etc. as `code`.

Fix typos, add missing full-stops, add missing default values.
2020-12-22 14:51:17 +01:00
bors[bot]
e1acb0ca5c
Merge #6999
6999: Build aarch64-apple-darwin binaries on CI (take 2) r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-22 13:19:27 +00:00
Laurențiu Nicola
c06efa380d Build aarch64-apple-darwin binaries on CI 2020-12-22 15:13:34 +02:00
bors[bot]
1f22eca3d4
Merge #6989
6989: Build aarch64-apple-darwin binaries on CI r=matklad a=lnicola

This splits the `dist` matrix job into four and tries to make `xtask dist` more principled about target and artifact naming.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-22 13:12:22 +00:00
Laurențiu Nicola
e881815115 Build aarch64-apple-darwin binaries on CI 2020-12-22 13:18:00 +02:00
bors[bot]
b98ee075ee
Merge #6746
6746: Feature/add assist extract module to file r=matklad a=sasurau4

Fix #6522 

## Screenshot

<img src="https://user-images.githubusercontent.com/13580199/102748269-33a44300-43a5-11eb-9e37-f5fcb8e62f73.gif" width=600 />


## TODO

- [x] Remove all TODO comment
- [x] Pass the doc test



Co-authored-by: Daiki Ihara <sasurau4@gmail.com>
2020-12-22 10:04:24 +00:00
bors[bot]
61711d9757
Merge #6984
6984: Remove TextMate grammar r=dustypomerleau a=lnicola

Closes #6267

This is now included upstream in VS Code.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-22 04:02:28 +00:00
bors[bot]
ba71685343
Merge #6991
6991: Don't download x64 binaries on non-Mac arm64 r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-21 19:40:38 +00:00
Laurențiu Nicola
211551646f Don't download x64 binaries on non-Mac arm64 2020-12-21 21:40:01 +02:00
bors[bot]
4c8a641f72
Merge #6990
6990: Allow code extension to download binary in apple arm r=lnicola a=phungleson

Apple chip has a new `arch`. It subsequently downloads Intel version of `rust-analyzer` but it works regardless.

Co-authored-by: Son <leson.phung@gmail.com>
2020-12-21 19:28:37 +00:00
Son
6089c6b1ea Allow code extension to download binary in apple arm 2020-12-22 06:23:50 +11:00
bors[bot]
e86344745e
Merge #6988
6988: Remove outdated FIXME r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-21 18:37:37 +00:00
Laurențiu Nicola
1da99a79d9 Remove outdated FIXME 2020-12-21 20:36:58 +02:00
bors[bot]
e4f922a74d
Merge #6985
6985: Use /etc/os-release to check for NixOS r=matklad a=lnicola

Closes #5641

The motivation in #5641 isn't too strong, but /etc/os-release exists on pretty much every Linux distro, while /etc/nixos sounds like an implementation detail.


Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-21 18:21:49 +00:00
bors[bot]
87762874ef
Merge #6987
6987: Delete related whitespace when removing unused param r=matklad a=rherrmann

Include adjacent whitespace in the text edits to remove the
parameter declaration and its occurences in calling code.

https://github.com/rust-analyzer/rust-analyzer/issues/6663

Co-authored-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
2020-12-21 18:15:17 +00:00