Commit Graph

23756 Commits

Author SHA1 Message Date
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
bors
2d9ed4fd48 Auto merge of #13641 - DesmondWillowbrook:fix-move-format-string, r=Veykril
fix: format expression parsing edge-cases

- Handle positional arguments with formatting options (i.e. `{:b}`). Previously copied `:b` as an argument, producing broken code.

- Handle indexed positional arguments (`{0}`) ([reference](https://doc.rust-lang.org/std/fmt/#positional-parameters)). Previously copied over `0` as an argument.

Note: the assist also breaks when named arguments are used (`"{name}$0", name = 2 + 2` is converted to `"{}"$0, name`. I'm working on fix for that as well.
2022-11-19 12:46:29 +00:00
bors
8050fdb9c7 Auto merge of #13642 - bvanjoi:fix-13292, r=Veykril
fix(assists): remove `item_const` which had default value when implement missing members

Fixed https://github.com/rust-lang/rust-analyzer/issues/13292
2022-11-19 12:33:40 +00:00
bvanjoi
a4f071afd5 fix(assists): remove item_const which had default value when implement missing members` 2022-11-19 19:38:53 +08:00
Kartavya Vashishtha
6d4b2b4b17
run cargo fmt 2022-11-19 15:08:32 +05:30
bors
ac60077ee5 Auto merge of #13639 - Veykril:macro-diags, r=Veykril
fix: Fix proc-macro-srv search paths for Arch Linux

Fixes https://github.com/rust-lang/rust-analyzer/issues/13616
2022-11-19 09:33:10 +00:00
Lukas Wirth
dc8254c6ab fix: Fix nested macro diagnostics pointing at macro expansion files 2022-11-19 10:32:32 +01:00
Kartavya Vashishtha
a3f8fd71df
fix: format expression parsing edge-cases
handle positional arg with formatting

handle indexed positional args
2022-11-19 15:00:25 +05:30
Kartavya Vashishtha
8b17681058
fix formatting
and remove unnecessary check
2022-11-19 11:34:49 +05:30
Kartavya Vashishtha
a778203db9
simplify ancestor climbing to not consider macros 2022-11-19 11:17:43 +05:30
Kartavya Vashishtha
0ffb361eb9
feat: adds hover hint to ".." in record pattern
currently only works with struct pattern
2022-11-19 11:10:47 +05:30
Lukas Wirth
52bc15fc1f fix: Fix proc-macro-srv search paths for Arch Linux 2022-11-18 23:32:26 +01:00
bors
791cb87cdf Auto merge of #13633 - Veykril:vscode-full-diagnostics, r=Veykril
feat: Allow viewing the full compiler diagnostic in a readonly textview

![Code_y1qrash9gg](https://user-images.githubusercontent.com/3757771/202780459-f751f65d-2b1b-4dc3-9685-100d65ebf6a0.gif)

Also adds a VSCode only config that replaces the split diagnostic message with the first relevant part of the diagnostic output

![Code_7k4qsMkx5e](https://user-images.githubusercontent.com/3757771/202780346-cf9137d9-eb77-46b7-aed6-c73a2e41e1c7.png)

This only affects diagnostics generated by primary spans and has no effect on other clients than VSCode.

Fixes https://github.com/rust-lang/rust-analyzer/issues/13574
2022-11-18 19:33:38 +00:00
Lukas Wirth
8452844c26 Fix tests checking the data value 2022-11-18 20:15:49 +01:00
Lukas Wirth
073a63b93e feat: Allow viewing the full compiler diagnostic in a readonly textview 2022-11-18 19:56:08 +01:00
bors
bee27eb471 Auto merge of #13632 - Veykril:scip, r=Veykril
Make it more obvious which SCIP features we do not yet emit in code
2022-11-18 10:31:41 +00:00
Lukas Wirth
656d886ca8 Make it more obvious which SCIP features we do not yet emit in code 2022-11-18 11:31:12 +01:00
bors
e162d5800a Auto merge of #13629 - jonas-schievink:remove-dbg-selection, r=jonas-schievink
feat: Make "Remove dbg!()" assist work on selections

Fixes https://github.com/rust-lang/rust-analyzer/issues/12114
2022-11-17 16:41:51 +00:00
Jonas Schievink
cd6459e7b3 Make "Remove dbg!()" assist work on selections 2022-11-17 17:39:31 +01:00
bors
9cf5c2230d Auto merge of #13625 - lowr:fix/proc-macro-src-test, r=lnicola
internal: Update proc-macro-srv tests

Should have been included in #13548, but I didn't notice as those tests aren't run in our CI.

cc rust-lang/rust#104454
2022-11-16 17:10:59 +00:00
Ryo Yoshida
7577c44c65
Update proc-macro-srv tests 2022-11-17 01:42:56 +09:00
bors
92e393cc40 Auto merge of #13624 - lowr:fix/unsize-array-inference-variable, r=lnicola
fix: resolve inference variable before applying adjustments

Fixes #13619
2022-11-16 11:07:18 +00:00
Ryo Yoshida
1ad11b5366
fix: resolve inference variable before applying adjustments 2022-11-16 20:01:55 +09:00
bors
0dd0dfb7df Auto merge of #13615 - mati865:miow-update, r=jonas-schievink
Update several crates to bring support for the new Tier 3 Windows tar…

`cargo t` has passed on Windows 11 with both `x86_64-pc-windows-gnu` and `x86_64-pc-windows-gnullvm` targets.
2022-11-15 11:59:27 +00:00
bors
8292dd8026 Auto merge of #13623 - jonas-schievink:strip-trait-item-completions, r=jonas-schievink
fix: Strip comments and attributes off of all trait item completions

Previously, this was done in several places redundantly, but not for all items. It was also untested. This PR fixes that.
2022-11-15 11:45:02 +00:00
Jonas Schievink
7e77d4e310 Strip comments and attributes off of all trait item completions 2022-11-15 12:41:39 +01:00
bors
a516b90dee Auto merge of #13622 - jonas-schievink:fix-gat-completions, r=jonas-schievink
fix: include generic parameter in GAT completions

Fixes https://github.com/rust-lang/rust-analyzer/issues/13586
2022-11-15 11:10:34 +00:00
Jonas Schievink
15dfeabb96 Fix GAT completion not including generic parameters 2022-11-15 12:05:11 +01:00
Mateusz Mikuła
46417add8d Update several crates to bring support for the new Tier 3 Windows targets 2022-11-13 22:45:09 +01:00
yue4u
f26d5484d8 fix: filter unnecessary completions after colon 2022-11-12 22:33:40 +09:00
bors
45ec315e01 Auto merge of #13607 - Veykril:proc-macro-error, r=Veykril
internal: Add version info to unsupported proc macro abi error

cc https://github.com/rust-lang/rust-analyzer/issues/13589#issuecomment-1311824473
2022-11-11 15:57:30 +00:00
Lukas Wirth
6b4b7d81e4 internal: Add version info to unsupported proc macro abi error 2022-11-11 16:57:05 +01:00
bors
2656303c83 Auto merge of #13606 - Veykril:trait-alias, r=Veykril
fix: Add trait alias grammar to rust.ungram

We already parse them, but the grammar was never updated to reflect that
2022-11-11 14:26:15 +00:00
Lukas Wirth
6674bd898e fix: Add trait alias grammar to rust.ungram 2022-11-11 15:25:15 +01:00
bors
d3531e8ce6 Auto merge of #13605 - Veykril:empty-ws-error, r=Veykril
fix: Fix r-a eagerly showing no discovered workspace errors
2022-11-11 13:37:27 +00:00
Lukas Wirth
a143ff0248 fix: Fix r-a eagerly showing no discovered workspace errors 2022-11-11 14:36:27 +01:00
Alexis (Poliorcetics) Bourget
0d4737adb6 feat: Support passing multiple targets to cargo (for Rust 1.64.0+) 2022-11-11 14:36:07 +01:00
Alexis (Poliorcetics) Bourget
c6c932d3f3 chore: Align config property 2022-11-11 14:36:07 +01:00
bors
add85397ae Auto merge of #13604 - Veykril:hover-attr, r=Veykril
fix: Fix hover in attributed items not preferring similar kinded tokens
2022-11-11 12:48:48 +00:00
Lukas Wirth
e50712cf2c fix: Fix hover in attributed items not preferring similar kinded tokens 2022-11-11 13:38:07 +01:00
bors
57cc2a6e27 Auto merge of #13602 - lowr:fix/nameres-transitive-visibility, r=Veykril
fix: check visibility of each path segment

Upon path resolution, we have not been checking if every def pointed to by each segment of the path is visible from the original module. This leads to incorrect import resolutions, in particular when one uses glob imports and names collide.

There is decent amount of changes in this PR because:
- some of our tests were not correct in terms of visibility
  - I left several basic nameres tests as-is (with expect test updated) since I thought it would be nice to ensure we don't resolve defs that are not visible.
- `fix_visibility` assist relied on `Semantics::resolve_path()`, which uses the name resolution procedure I'm fixing and wouldn't be able to "see through" the items with strict visibility with this patch

The first commit is the gist of the fix itself.

Fixes #10991
Fixes #11473
Fixes #13252
2022-11-11 12:32:21 +00:00