Commit graph

23646 commits

Author SHA1 Message Date
Amos Wenger b355362380 Merge commit '2e9f1204ca01c3e20898d4a67c8b84899d394a88' into HEAD 2022-11-25 13:02:11 +01:00
Amos Wenger dec148e6eb Merge commit '459bbb422' into HEAD 2022-11-25 13:02:06 +01:00
Amos Wenger be2fca97c2 Merge commit '67920f797511c360b25dab4d30730be304848f32' into HEAD 2022-11-25 12:58:20 +01:00
Amos Wenger 318fdacaf8 Merge commit '65e1dc4d9' into HEAD 2022-11-25 12:58:18 +01:00
Amos Wenger ae878f2708 Merge commit 'e8e598f6415461e7fe957eec1bee6afb55927d59' into HEAD 2022-11-25 12:58:02 +01:00
Amos Wenger ff2b468b55 Merge commit '3e358a682' into HEAD 2022-11-25 12:58:00 +01:00
Amos Wenger 8117027de6 Merge commit 'a670ff888437f4b6a3d24cc2996e9f969a87cbae' into HEAD 2022-11-25 12:57:43 +01:00
Amos Wenger 6ac43ecf17 Merge commit '31519bb39' into HEAD 2022-11-25 12:57:38 +01:00
Amos Wenger 797ee293ed Merge commit 'b6d59f2bb4fae0ba4f74e2c967b5e2f777f8c860' into HEAD 2022-11-25 12:55:14 +01:00
Amos Wenger 2374c0b368 Merge commit '8231fee46' into HEAD 2022-11-25 12:55:08 +01:00
Amos Wenger 03a723e6bc Merge commit '634cfe3d72e785c843ca5d412b12be137b2e14fb' into HEAD 2022-11-25 12:54:28 +01:00
Amos Wenger db84a00d03 Merge commit '22c8c9c40' into HEAD 2022-11-25 12:13:34 +01:00
Amos Wenger 2566e06da1 Merge commit '8e38833c3674c1be7d81c6069c62e6ed52b18b27' into HEAD 2022-11-25 12:01:49 +01:00
bors e668eca632 Auto merge of #13647 - nyz93:fix/tuple-to-named-struct, r=Veykril
fix: tuple to named struct inside macros

seems to fix #13634
2022-11-25 09:41:21 +00:00
bors 99daf23e11 Auto merge of #13671 - Veykril:goto-decl, r=Veykril
Improve goto declaration

Closes https://github.com/rust-lang/rust-analyzer/issues/13599

- goto decl now goes to assoc items of trait declarations over the items of trait implementations
- goto decl now goes to the field declaration (opposed to goto def which shows both the field decl and binding created/local being used)
- also adds back the goto definition fallback that seems to have been dropped at some point.
2022-11-25 09:28:39 +00:00
Lukas Wirth ae0bdffcc9 Go to declaration goes to field declaration in pattern and expression shorthands 2022-11-25 10:27:54 +01:00
Lukas Wirth 3c794a34da Go to declaration goes to assoc items of trait declarations 2022-11-25 10:27:49 +01:00
bors 6918009fea Auto merge of #13638 - DesmondWillowbrook:hover-rest-pat-mvp, r=Veykril
feat: adds hover hint to ".." in record pattern

Hovering on the "rest" pattern in struct destructuring,
```rust
struct Baz {
    a: u32,
    b: u32,
    c: u32,
    d: u32
}

let Baz { a, b, ..$0} = Baz { a: 1, b: 2, c: 3, d: 4 };
```
shows:

```
.., c: u32, d: u32
```

Currently only works with struct patterns.

![image](https://user-images.githubusercontent.com/51814158/202837115-f424cc26-c2d7-4027-8eea-eeb7749ad146.png)
2022-11-25 07:41:05 +00:00
Kartavya Vashishtha a26aef9055
fix formatting 2022-11-25 12:22:06 +05:30
Kartavya Vashishtha 91e7624de0
add hover tests 2022-11-25 12:20:38 +05:30
Kartavya Vashishtha e86d451484
fix token method call 2022-11-25 12:20:34 +05:30
Kartavya Vashishtha 132d5ffc7d
add back [] in hover documentation 2022-11-25 12:04:14 +05:30
Kartavya Vashishtha f64feeb11a
Correct node traversal to look at parent instead
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-11-24 22:32:15 -08:00
bors 1e6a49a801 Auto merge of #13670 - Veykril:derive-helper, r=Veykril
Add `deriveHelper` to `semanticTokenTypes` section of package.json
2022-11-24 21:27:32 +00:00
Lukas Wirth 9fba39f0c0 Add deriveHelper to semanticTokenTypes section of package.json 2022-11-24 22:26:05 +01:00
bors 76e2e41121 Auto merge of #13652 - jhgg:hir-expand/fix-compile-error-expansion, r=Veykril
hir-expand: fix compile_error! expansion not unquoting strings

expanding `compile_error!` would not properly unquote strings, leading to quite ugly diagnostic messages:

![image](https://user-images.githubusercontent.com/5489149/202893481-2486ede8-c79a-4972-9713-416d6a704064.png)

this fixes it, using the conveniently placed `unquote_str` function, which now makes errors look like:

![image](https://user-images.githubusercontent.com/5489149/202893466-0763efad-9240-4d55-80a6-6c62000d5d2b.png)

additionally, using `unquote_str` has the cool side-effect of *also* handling raw strings, so this fixes a fixme too!
2022-11-24 21:00:48 +00:00
bors 5e3ad5ddf6 Auto merge of #13592 - MihailMihov:trait_impl_assist, r=Veykril
Add assist to generate trait impl's

resolves #13553

This pull request adds a `generate_trait_impl` assist, which generates trait impl's for a type. It is almost the same as the one to generate impl's and I also reduced the trigger range to only outside the `RecordFieldList`. Also moved all the tests into separate test functions. A few of the old tests seemed redundant, so I didn't port them.
2022-11-24 20:44:33 +00:00
bors fbc0f7a771 Auto merge of #13669 - Veykril:jod-child, r=Veykril
Properly implement Drop for JodGroupChild
2022-11-24 20:31:38 +00:00
Lukas Wirth c8b6fef70f Properly implement Drop for JodGroupChild 2022-11-24 21:30:15 +01:00
bors e9f6087965 Auto merge of #13661 - iredelmeier:fix-null-checkonsave-target, r=jonas-schievink
Fix: Handle empty `checkOnSave/target` values

This fixes a regression introduced by #13290, in which failing to set `checkOnSave/target` (or `checkOnSave/targets`) would lead to an invalid config.

[Fixes #13660]
2022-11-24 15:52:27 +00:00
bors 63a676eedf Auto merge of #13576 - Bben01:supress_missing_impl_inside_block, r=jonas-schievink
Suppress "Implement default members" inside contained items

Fixes #13561
2022-11-24 15:16:36 +00:00
bors 81d26e730e Auto merge of #13667 - Veykril:detached-files-sysroot, r=Veykril
Handle sysroot config in detached-files workspaces
2022-11-24 09:21:44 +00:00
Lukas Wirth 2300c9de83 Handle sysroot config in detached-files workspaces 2022-11-24 10:21:19 +01:00
Laurențiu Nicola a2a1d99545 ⬆️ rust-analyzer 2022-11-23 17:24:03 +02:00
Isobel Redelmeier b116fe9be0
Fix: Handle empty checkOnSave/target values
This fixes a regression introduced by #13290, in which failing to set
`checkOnSave/target` (or `checkOnSave/targets`) would lead to an invalid
config.
2022-11-21 16:40:32 -05:00
Mihail Mihov 469f620b06 Combine generate_impl and generate_trait_impl into a single file 2022-11-21 22:58:43 +02:00
Mihail Mihov 0bd11f8171 Reduce trigger range of generate_impl assist and update tests 2022-11-21 22:27:26 +02:00
Mihail Mihov ecb15ca717 Add assist to generate trait impl's 2022-11-21 22:27:26 +02:00
Bben01 95b4a7487b Suppress "Implement default members" inside contained items 2022-11-21 22:17:04 +02:00
bors 26562973b3 Auto merge of #13653 - VannTen:fix/doc-typo-vim-lsp, r=Veykril
Fix typo on 'configuration' anchor

https://rust-analyzer.github.io/manual.html#_configuration lands you at
the start of the page, while
https://rust-analyzer.github.io/manual.html#configuration correctly puts
you at the correct anchor
2022-11-20 19:59:43 +00:00
bors 75e1de88f8 Auto merge of #13649 - ZZzzaaKK:master, r=lnicola
Improve grammar of architecture.md

Corrects a few grammar mistakes I found while reading the documentation 😄
2022-11-20 18:31:50 +00:00
Max Gautier ebbc5492f5 Fix typo on 'configuration' anchor
https://rust-analyzer.github.io/manual.html#_configuration lands you at
the start of the page, while
https://rust-analyzer.github.io/manual.html#configuration correctly puts
you at the correct anchor
2022-11-20 12:47:28 +01:00
Jake Heinz 427b63b676 hir-expand: fix compile_error! expansion not unquoting strings 2022-11-20 08:48:27 +00:00
ZZzzaaKK e39d90a8e6 Improve grammar of architecture.md 2022-11-20 01:58:16 +01:00
Nyikos Zoltán 23cfe0702d fix: tuple to named struct inside macros
seems to fix #13634
2022-11-19 20:08:01 +01:00
yue4u 7a568f7f95 fix: remove insufficient check for coloncolon 2022-11-20 01:29:02 +09:00
yue a6d0e342a3
Update crates/ide-completion/src/context.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-11-20 00:58:59 +09:00
Kartavya Vashishtha 29951f9766
fix formatting 2022-11-19 21:23:33 +05:30
Kartavya Vashishtha 87658c8173
refactor hover
change struct_rest_pat to guarentee a HoverResult

Move token and node matching out of struct_rest_pat into hover
2022-11-19 21:22:10 +05:30
bors 38fa47fd79 Auto merge of #13290 - poliorcetics:multiple-targets, r=Veykril
Support multiple targets for checkOnSave (in conjunction with cargo 1.64.0+)

This PR adds support for the ability to pass multiple `--target` flags when using
`cargo` 1.64.0+.

## Questions

I needed to change the type of two configurations options, but I did not plurialize the names to
avoid too much churn, should I ?

## Zulip thread

https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Issue.2013282.20.28supporting.20multiple.20targets.20with.201.2E64.2B.29

## Example

To see it working, on a macOS machine:

```sh
$ cd /tmp
$ cargo new cargo-multiple-targets-support-ra-test
$ cd !$
$ mkdir .cargo
$ echo '
[build]
target = [
    "aarch64-apple-darwin",
    "x86_64-apple-darwin",
]
' > .cargo/config.toml
$ echo '
fn main() {
    #[cfg(all(target_arch = "aarch64", target_os = "macos"))]
    {
        let a = std::fs::read_to_string("/tmp/test-read");
    }

    #[cfg(all(target_arch = "x86_64", target_os = "macos"))]
    {
        let a = std::fs::read_to_string("/tmp/test-read");
    }

    #[cfg(all(target_arch = "x86_64", target_os = "windows"))]
    {
        let a = std::fs::read_to_string("/tmp/test-read");
    }
}
' > src/main.rs
# launch your favorite editor with the version of RA from this PR
#
# You should see warnings under the first two `let a = ...` but not the third
```

## Screen

![Two panes of a terminal emulator, on the left pane is the main.rs file described above, with warnings for the first two let a = declaration, on the right pane is a display of the .cargo/config.toml, an ls of the current files in the directory and a call to cargo build to show the same warnings as in the editor on the left pane](https://user-images.githubusercontent.com/7951708/192122707-7a00606a-e581-4534-b9d5-b81c92694e8e.png)

Helps with #13282
2022-11-19 13:09:37 +00:00