Commit graph

18224 commits

Author SHA1 Message Date
Lukas Wirth
0dbde71159 Simplify 2023-09-26 12:25:59 +02:00
Milo
85ead6ec27 remove other unwraps 2023-09-25 11:48:23 +00:00
Milo
f64eecd2e2 fix one 2023-09-25 11:30:21 +00:00
bors
972a19f4cb Auto merge of #15659 - HKalbasi:unused-var, r=HKalbasi
Add `unused_variables` native diagnostic
2023-09-25 06:38:14 +00:00
DaniPopes
588c7d9182
minor: hover_simple refactor 2023-09-24 22:47:29 +02:00
hkalbasi
ab52ba2de7 Fix unused_variables in tests 2023-09-24 23:45:36 +03:30
hkalbasi
7834b8fadb Add unused_variables native diagnostic 2023-09-24 21:29:15 +03:30
bors
e5e937ae5e Auto merge of #15582 - vxpm:master, r=HKalbasi
add option to show full function signatures in completion docs

implements #15538

with `"rust-analyzer.completion.fullFunctionSignatures.enable": false`:
![image](https://github.com/rust-lang/rust-analyzer/assets/59714841/ff739ad1-9975-461f-a62d-22c7823e7b71)

with `"rust-analyzer.completion.fullFunctionSignatures.enable": true`:
![image](https://github.com/rust-lang/rust-analyzer/assets/59714841/9bc98300-cef6-44ef-a353-dcf35cd36fce)
2023-09-24 07:38:38 +00:00
vxpm
10fae62820 split detail function 2023-09-23 19:43:19 -03:00
vxpm
9f3d627681 add tests for full signatures 2023-09-23 19:39:42 -03:00
bors
2b580a1f3c Auto merge of #15492 - RalfJung:invocation, r=Veykril
extend check.overrideCommand and buildScripts.overrideCommand docs

Extend check.overrideCommand and buildScripts.overrideCommand docs regarding invocation strategy and location.

However something still seems a bit odd -- the docs for `invocationStrategy`/`invocationLocation` talk about "workspaces", but the setting that controls which workspaces are considered is called `linkedProjects`. Is a project the same as a workspace here or is there some subtle difference?
2023-09-22 16:09:01 +00:00
bors
8139e8e072 Auto merge of #15425 - alibektas:deunwrap/convert_comment_block, r=Veykril
minor : Deunwrap convert_comment_block and desugar_doc_comment

Closes subtask 13 of #15398 . I still don't know a more idiomatic way for the for loops I added, any suggestion would make me happy.
2023-09-22 15:47:55 +00:00
bors
59bcbafc95 Auto merge of #15594 - alibektas:deunwrap/add_missing_match_arms, r=Veykril
Deunwrap add_missing_match_arms

Last subtask of #15398
2023-09-22 15:31:30 +00:00
Ali Bektas
622e1a8d88 Add a test case to add_missing_match_arms
Although it doesn't panic now, further changes to how we recover from incomplete syntax
may cause this assist to panic. To mitigate this a test case has been added.
2023-09-22 13:51:19 +02:00
Ali Bektas
0a91a54794 v4 2023-09-22 13:32:20 +02:00
bors
4a8622c8fa Auto merge of #15652 - Veykril:format_to, r=lnicola
minor: Various small fixes
2023-09-22 09:06:06 +00:00
Lukas Wirth
556f0c6704 Various small fixes 2023-09-22 10:13:51 +02:00
bors
5855bd8579 Auto merge of #15587 - dfireBird:fix-15128, r=Veykril
Fix autoimport does nothing when importing trait that is as _ imports

Potentially fixes #15128

There are two cases of imports:
1. With simple path
2. With use tree list (or say complex path).

On deeper inspection, the [`recursive_merge`](994df3d6a3/crates/ide-db/src/imports/merge_imports.rs (L87)) function (called by [`try_merge_trees_mut`)](994df3d6a3/crates/ide-db/src/imports/merge_imports.rs (L69)) is meaningful only in the case of complex path (i.e when the UseTree contains a UseTreeList).

The [`recursive_merge`](994df3d6a3/crates/ide-db/src/imports/merge_imports.rs (L87)) function has [match with `Ok` arm](994df3d6a3/crates/ide-db/src/imports/merge_imports.rs (L106)), that is only executed when both LHS and RHS has `PathSegment` with same `NameRef`. The removal of underscore is implemented in this arm in the case of complex path.

For simple paths, the underscore is removed by checking if both LHS and RHS are simple paths and if their `Path` is same (the check is done [here](994df3d6a3/crates/ide-db/src/imports/merge_imports.rs (L74))) and remove the underscore if one is found (I made an assumption here that RHS will always be what rust-analyzer suggests to import, because at this point I'm not sure how to remove underscore with help of `ted::replace`).
2023-09-22 07:39:11 +00:00
bors
df75809a85 Auto merge of #15484 - rmehri01:14779_bool_to_enum_assist, r=Veykril
feat: Bool to enum assist

This adds the `bool_to_enum` assist, which converts the type of boolean local variables, fields, constants and statics to a new `enum` type, making it easier to distinguish the meaning of `true` and `false` by renaming the variants.

Closes #14779
2023-09-22 07:19:12 +00:00
bors
2ededa2f14 Auto merge of #15432 - alibektas:deunwrap/inline_call, r=Veykril
minor : Deunwrap inline call

#15398 subtask 4. There is still one instance of unwrap, which I found pretty hard to change.
2023-09-22 07:03:02 +00:00
Lukas Wirth
93562dd5bd Use parent + and_then instead of ancestors 2023-09-22 08:53:24 +02:00
bors
11ffcc08a3 Auto merge of #15615 - shogo-nakano-desu:refactor/fix-clippy-lints, r=Veykril
Refactor/fix clippy lints

As title says.
2023-09-22 06:46:29 +00:00
bors
fccae08dd3 Auto merge of #15649 - tomalexander:master, r=Veykril
Documentation: Add parenthesis to the list of on-typing assists.
2023-09-22 06:12:52 +00:00
Ryan Mehri
ea11846490 fix parens when inlining closure in body of function 2023-09-21 21:55:10 -07:00
Ryan Mehri
60f7473c99 fix parens when inlining closure local variables 2023-09-21 21:31:15 -07:00
Tom Alexander
91b012f91d
Documentation: Add parenthesis to the list of on-typing assists. 2023-09-21 14:58:24 -04:00
bors
d6fef2c7e3 Auto merge of #15621 - kpreid:import, r=Veykril
Give `unmerge_use` a label explaining what it will affect.

When I'm trying to clean up `use`s, I often feel uncertain about what exactly the effects of choosing an assist will be. This PR makes a small improvement to that by giving “Unmerge use” a label which names the root of the tree that it's going to move, when one exists.

There is no test because I didn't see, among the test helpers, a way to assert on the assist label (as opposed to filtering on it). However, I did test the change manually.

I looked into making a similar change to “Merge imports”, but that is considerably trickier.
2023-09-20 14:38:08 +00:00
shogo-nakano-desu
dd843060f9 refactor: remove boxing 2023-09-20 23:02:52 +09:00
Wilfred Hughes
3a63255d2a Update chalk version 2023-09-19 16:56:59 -07:00
Kirill Bulatov
f9fac02c57 Use proper editor name 2023-09-19 23:34:43 +03:00
Kirill Bulatov
184119258e Do not resolve inlayHint.textEdit for VSCode client
VSCode behaves strangely, allowing to navigate into label location, but
not allowing to apply hint's text edit, after hint is resolved.
See https://github.com/microsoft/vscode/issues/193124 for details.

For now, stub hint resolution for VSCode specifically.
2023-09-19 21:40:22 +03:00
bors
22b18b9f77 Auto merge of #15616 - HKalbasi:rustc-deps, r=HKalbasi
Switch to in-tree rustc dependencies with a cfg flag

We can use this flag to detect and prevent breakages in rustc CI. (see #14846 and #15569)

~The `IN_RUSTC_REPOSITORY` is just a placeholder. Is there any existing cfg flag that rustc CI sets?~
2023-09-19 17:41:12 +00:00
Emilio Cobos Álvarez
c372431123
scip: Use load_workspace_at.
This honors the build script config, and is also simpler.
2023-09-19 13:48:05 +02:00
Laurențiu Nicola
d39b45a58d Merge branch 'master' into sync-from-rust 2023-09-18 12:04:59 +03:00
jDomantas
a961068504 add layout test 2023-09-17 17:00:57 +03:00
jDomantas
b3aba94cbd use code from bug report for regression test 2023-09-17 16:52:32 +03:00
jDomantas
a0c31b73d8 don't skip the rest of the block after let-else 2023-09-17 12:46:41 +03:00
jDomantas
a77789e7aa regression test 2023-09-17 11:54:42 +03:00
Kevin Reid
cac796acb3 Give unmerge_use a label explaining what it will affect. 2023-09-16 13:29:03 -07:00
bors
9d0ccf01a1 Auto merge of #15597 - rmehri01:fix_promote_local_field_shorthand, r=HKalbasi
Field shorthand overwritten in promote local to const assist

Currently, running `promote_local_to_const` on the following:

```rust
struct Foo {
    bar: usize,
}

fn main() {
    let $0bar = 0;
    let foo = Foo { bar };
}
```

Results in:

```rust
struct Foo {
    bar: usize,
}

fn main() {
    const BAR: usize = 0;
    let foo = Foo { BAR };
}
```

But instead should be something like:

```rust
struct Foo {
    bar: usize,
}

fn main() {
    const BAR: usize = 0;
    let foo = Foo { bar: BAR };
}
```
2023-09-16 16:48:21 +00:00
hkalbasi
f4704bc8ae Switch to in-tree rustc dependencies with a cfg flag 2023-09-15 18:10:11 +03:30
shogo-nakano-desu
96c333262a refactor: fix clippy lint 2023-09-15 16:47:39 +09:00
shogo-nakano-desu
0bb2298ac6 refactor: remove TODO with no explanation 2023-09-15 16:43:31 +09:00
shogo-nakano-desu
ebbbaaa90f refactor: fix clippy lints 2023-09-15 16:43:21 +09:00
bors
12e28c3575 Auto merge of #15611 - Veykril:stability-import, r=Veykril
Prefer stable paths over unstable ones in import path calculation

Fixes https://github.com/rust-lang/rust-analyzer/issues/15610
2023-09-14 09:11:12 +00:00
Lukas Wirth
e63e323823 Prefer stable paths over unstable ones in import path calculation 2023-09-14 11:03:41 +02:00
Maybe Waffle
a219dbda2b Remove most of the duplication from Semantics{,Impl} via deref 2023-09-13 22:02:28 +00:00
bors
089ae47ebe Auto merge of #15606 - Veykril:annotation-above-item-fi, r=Veykril
fix: Fix lens location "above_whole_item" breaking lenses

Fixes https://github.com/rust-lang/rust-analyzer/issues/15602
2023-09-13 20:02:06 +00:00
Lukas Wirth
712e67cf11 fix: Fix lens location "above_whole_item" breaking lenses 2023-09-13 22:01:04 +02:00
bors
15e1356149 Auto merge of #15601 - Veykril:diag-derive, r=Veykril
fix: Temporarily skip decl check in derive expansions

"Fixes https://github.com/rust-lang/rust-analyzer/issues/15344"
2023-09-12 21:11:28 +00:00