Commit graph

20329 commits

Author SHA1 Message Date
Wang Ruochen
be5205170c
Update comment 2021-12-22 14:17:43 -08:00
Wang Ruochen
44edf63edd
Add pattern when there's no else branch 2021-12-22 10:18:37 -08:00
Wang Ruochen
2bd2960fda
Don't support if-let branches 2021-12-21 16:51:26 -08:00
Wang Ruochen
d0986cd96b
Move variables into the closure 2021-12-21 16:48:02 -08:00
Wang Ruochen
71676ae89d
Support "move if to guard" for if else chains 2021-12-19 09:26:52 -08:00
bors[bot]
638cc3e59f
Merge #11054
11054: fix #11049 by removing double trimming r=Veykril a=Heinenen

The `unwrap_trivial_block()` removes the braces around trivial blocks (as the name suggests). This violates the precondition of `update_expr_string()` which removes the first and the last non-whitespace character and thus expects braces to still exist around all blocks.

Co-authored-by: ucrhh <ucrrh@sutdent.kit.edu>
2021-12-19 00:17:01 +00:00
ucrhh
b289f13c75 fix unwrap_block by removing double trimming 2021-12-18 23:19:53 +01:00
bors[bot]
b65d9c3e62
Merge #11053
11053: feat: Publish platform-specific Code VSIXes r=me a=lnicola

Closes #10483
CC #10371

Some notes:

 - we still build a plain VSIX, just in case
 - we build the extension on every platform to make the release workflow arguably cleaner
 - the Windows VSIX includes the PDB (but let's leave  #10371 open until we change the Windows stand-alone release to a ZIP file)
 - `npm` doesn't run if started from `xtask`, possibly something related to path mapping; I moved the `npm` calls outside, but..
 - the `Patch` thingy doesn't work any more, so you'll end up with a dirty `package.json` of you run `cargo xtask --client-patch-version`; I don't think we should block on this
 - there's an untested Alpine build; for better or worse, we special-case `musl` distros as `alpine`
 - I tested this as much as I could, but not the publishing and nightly updates
 - you can find some sample artifacts under https://github.com/lnicola/rust-analyzer/releases
 - we can now run the server from the install location (is Code planning to switch to compressed extensions?), except on NixOS
 - Code lets you install a VSIX for the wrong platform (with the results one would expect)
 - I don't know what happens if we try to publish a VSIX without a target

This is a relatively risky, but we'll probably have to take our chances with it.

r? `@rust-analyzer/review`

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-18 21:16:19 +00:00
Laurențiu Nicola
9c74f646f4 Publish platform-specific Code VSIXes 2021-12-18 22:49:11 +02:00
bors[bot]
0dbbf14bd6
Merge #11042
11042: minor: clarify RA_LOG env var troubleshooting r=lnicola a=Veykril

cc https://github.com/rust-analyzer/rust-analyzer/pull/10261

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-18 20:21:29 +00:00
Lukas Wirth
dc9257682c
Fix typo 2021-12-18 21:02:03 +01:00
bors[bot]
4c686721c0
Merge #11047
11047: internal: Prepare Code extension for bundling r=lnicola a=lnicola

CC #10483

This is slightly ugly, but we'll be able to clean it up after ripping the download parts (unless we decide to temporarily drop support for the nightlies).

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-18 18:32:20 +00:00
bors[bot]
81d0096000
Merge #11035
11035: Include clippy lint groups in autocomplete r=Veykril a=k-nasa

## Why

close: https://github.com/rust-analyzer/rust-analyzer/issues/11027

## Proof

I confirmed that complement candidates are coming out.

https://user-images.githubusercontent.com/23740172/146465758-bc7d5cdd-e2fb-48d6-abf7-804ba859c9b1.mov


Co-authored-by: k-nasa <htilcs1115@gmail.com>
2021-12-18 17:59:29 +00:00
bors[bot]
0914f24fc1
Merge #11050
11050: feat: treat fn keyword inside function pointer type as primitive r=Veykril a=rainy-me

close #11036

Co-authored-by: rainy-me <github@yue.coffee>
2021-12-18 17:03:28 +00:00
rainy-me
67cc6c1e16 feat: treat fn keyword inside function pointer type as primitive 2021-12-19 01:51:51 +09:00
Laurențiu Nicola
262a698875 Prepare Code extension for bundling 2021-12-18 17:44:16 +02:00
bors[bot]
9f1a3ae5ab
Merge #11046
11046: internal: move all the lexing to the parser crate r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-12-18 14:37:58 +00:00
Aleksey Kladov
92dad471bc
Update crates/parser/src/lexed_str.rs
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-12-18 17:34:55 +03:00
Aleksey Kladov
a022ad68c9 internal: move all the lexing to the parser crate 2021-12-18 17:20:38 +03:00
k-nasa
71ac246bd4 refactor: chain iter 2021-12-18 23:19:29 +09:00
Aleksey Kladov
78926027e3 converting lexed str to tokens 2021-12-18 15:36:21 +03:00
Aleksey Kladov
8b9d145dea soa all the things 2021-12-18 15:31:50 +03:00
Aleksey Kladov
799941e05e move tests 2021-12-18 14:55:20 +03:00
Aleksey Kladov
7e99864dbf move lexing to the parser crate 2021-12-18 14:55:20 +03:00
Aleksey Kladov
958f20ff84 minor: dead code 2021-12-18 14:55:20 +03:00
bors[bot]
7f28b49759
Merge #11043
11043: fix: fix incorrect mismatched argument count diagnostic with `std::arch` functions r=jonas-schievink a=jonas-schievink

Adds basic support for `#[rustc_legacy_const_generics]`.

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

Full support would involve actually checking call arguments against the right expected types.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2021-12-17 17:46:42 +00:00
Jonas Schievink
fcc76e93a0 Initial support for #[rustc_legacy_const_generics] 2021-12-17 18:45:56 +01:00
Lukas Wirth
1cd40a408a minor: clarify RA_LOG env var troubleshooting 2021-12-17 18:08:40 +01:00
bors[bot]
6674756c07
Merge #11041
11041: minor: Fix some clippy lints r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-17 15:52:53 +00:00
Laurențiu Nicola
6c799dac1e Fix some clippy lints 2021-12-17 17:46:20 +02:00
bors[bot]
04b0b19cdb
Merge #10527
10527: internal: Remove a few snippet completions, replace them with user snippets definitions in VSCode r=Veykril a=Veykril

Closes https://github.com/rust-analyzer/rust-analyzer/issues/9636
cc https://github.com/rust-analyzer/rust-analyzer/issues/7033#issuecomment-939959905

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-17 15:44:48 +00:00
Lukas Wirth
2a88b76041 Update tests 2021-12-17 16:39:21 +01:00
Laurențiu Nicola
8ad7c0439c Remove needless clones 2021-12-17 17:35:10 +02:00
Laurențiu Nicola
fb9529626d Spelling nits 2021-12-17 17:26:35 +02:00
Lukas Wirth
9fe0f0d1d9 Add a few default snippets for VSCode 2021-12-17 16:24:29 +01:00
bors[bot]
f4d65c1d20
Merge #11040
11040: fix: Don't duplicate attribute completions r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11012
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-17 14:23:45 +00:00
Lukas Wirth
d3e538638a fix: Don't duplicate attribute completions 2021-12-17 15:22:53 +01:00
k-nasa
0e9095e42c manual run sourcegen_lint_completions 2021-12-17 08:46:17 +09:00
k-nasa
7643e08962 Add clippy lint group to attribute auto compleme 2021-12-17 08:34:08 +09:00
k-nasa
4e6e65dd71 List struct to clonable 2021-12-17 08:33:46 +09:00
bors[bot]
f79f3db7b7
Merge #11030
11030: Add comma for "move if to guard" r=Veykril a=weirane

As I mentioned in #11017, there is a little issue in the implementation for if branch. This code
```rust
let y = match 92 {
    x => {
        if x == 0 {$0
            false
        }
    }
    _ => true,
};
```
will be transformed to
```rust
let y = match 92 {
    x if x == 0 => false
    _ => true,
};
```
a comma is missing after the false. I moved the fix from the code handling else branch to above.

Co-authored-by: Wang Ruochen <wrc@ruo-chen.wang>
2021-12-16 13:26:16 +00:00
bors[bot]
098b1f2486
Merge #11031
11031: minor: Set `MACOSX_DEPLOYMENT_TARGET` to 10.15 to improve compat r=lnicola a=lnicola

Since GitHub (and also us, explicitly) switched the `macos-latest` runners to 11, let's try to bring back support for 10.15.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-16 06:36:10 +00:00
Laurențiu Nicola
ff6081e629 Set MACOSX_DEPLOYMENT_TARGET to 10.15 to improve compat 2021-12-16 08:02:09 +02:00
Wang Ruochen
ee079561b1
Add comma for "move if to guard" 2021-12-15 15:26:24 -08:00
bors[bot]
4ec6bd6206
Merge #11017
11017: Support "move if to guard" with an else branch r=Veykril a=weirane

Support the assist `move_arm_cond_to_match_guard` when there is an else branch.

I have two questions:
1. How to indent the first line of a match arm? `matcharm.indent()` doesn't seem to work. so I hard coded four spaces here:
95a0de85d5/crates/ide_assists/src/handlers/move_guard.rs (L162-L163)

2. I find a little issue in the original implementation, this code
```rust
let y = match 92 {
    x => {
        if x == 0 {$0
            false
        }
    }
    _ => true,
};
```
will be transformed to
```rust
let y = match 92 {
    x if x == 0 => false
    _ => true,
};
```
a comma is missing after the `false`. Should I also fix that? Or this can go in a separate PR.

Closes #10997.

Co-authored-by: Wang Ruochen <wrc@ruo-chen.wang>
2021-12-15 23:04:51 +00:00
Wang Ruochen
e8d0742997
Add coverage marks 2021-12-15 14:44:47 -08:00
bors[bot]
661e3f933a
Merge #11029
11029: internal: Refactor release workflow to reduce duplication r=lnicola a=lnicola

This reduces duplication by using `matrix` and paves the way for https://github.com/rust-analyzer/rust-analyzer/issues/10483. The `musl` builder is unchanged because it uses a container.

~~We also get rid of the MacOS 11 SDK thing, which is from when most MacOS builders were on 10.~~ Or not, the default is still 10.15.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-15 22:00:51 +00:00
Laurențiu Nicola
f694d7fa65 Refactor release workflow 2021-12-15 23:32:05 +02:00
bors[bot]
b75d4d3dbe
Merge #11023
11023: minor: Really switch XCode version r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-15 12:45:13 +00:00
Laurențiu Nicola
c6a8cc1cee Really switch XCode version 2021-12-15 14:44:45 +02:00