Commit Graph

22162 Commits

Author SHA1 Message Date
iDawer 461c0cc07a Correct wording 2022-06-30 17:19:03 +05:00
iDawer fb6278e750 Reduce intermediate allocations while printing witnesses 2022-06-25 20:08:00 +05:00
iDawer 4ff9bedbed Display witnesses of non-exhaustive match
Reporting format follows rustc and shows at most three witnesses.
2022-06-20 15:48:09 +05:00
bors ad6810e90b Auto merge of #12475 - Veykril:trait-impl-completion, r=Veykril
fix: Fix trait impl completions using wrong insert position

Fixes https://github.com/rust-lang/rust-analyzer/issues/12474
2022-06-05 18:29:59 +00:00
Lukas Wirth 0be31d945e fix: Fix trait impl completions using wrong insert position 2022-06-05 20:29:36 +02:00
bors 995a17fbd9 Auto merge of #12472 - Veykril:output-ch, r=Veykril
internal: Keep output channels across restarts

cc https://github.com/rust-lang/rust-analyzer/pull/12470
2022-06-05 12:20:21 +00:00
Lukas Wirth 1127d2508f internal: Keep output channels across restarts 2022-06-05 14:20:06 +02:00
bors d471d92259 Auto merge of #12471 - Veykril:reload-restart, r=Veykril
fix: Restart the server instead of reloading the window when config changes

 cc https://github.com/rust-lang/rust-analyzer/issues/12469#event-6743447147
2022-06-05 11:35:09 +00:00
Lukas Wirth 2a8ea089bf fix: Restart the server instead of reloading the window when config changes 2022-06-05 13:29:08 +02:00
bors 6667061841 Auto merge of #12470 - Veykril:output-ch, r=Veykril
fix: Cleanup output channels when restarting server

Fixes https://github.com/rust-lang/rust-analyzer/issues/12469
2022-06-05 11:25:02 +00:00
Lukas Wirth fd298b3994 fix: Cleanup output channels when restarting server 2022-06-05 13:24:39 +02:00
bors 6d3396a492 Auto merge of #12466 - lnicola:worker-thread-stack, r=lnicola
Increase worker thread stack and name them

CC #11370
2022-06-05 07:59:42 +00:00
bors 815b43429d Auto merge of #12468 - Veykril:cancelled-diags, r=Veykril
minor: Don't log cancelled diagnostics

Since we retry requests now we can actually hit this legitimately
2022-06-04 23:40:05 +00:00
Lukas Wirth d38b7b88c6 minor: Don't log cancelled diagnostics 2022-06-05 01:38:46 +02:00
bors 02c6c19152 Auto merge of #12467 - Veykril:assist-fix, r=Veykril
fix: Fix match to if let assist for wildcard pats
2022-06-04 23:02:50 +00:00
Lukas Wirth fbffe73612 fix: Fix match to if let assist for wildcard pats 2022-06-05 01:02:24 +02:00
Laurențiu Nicola 0b9cd8a468 Increase worker thread stack and name them 2022-06-04 20:48:51 +03:00
bors 044b6ddca9 Auto merge of #12465 - Veykril:buildscripts, r=Veykril
internal: Only record build script outputs when the output has been changed

Follow up to https://github.com/rust-lang/rust-analyzer/pull/12457
2022-06-04 13:05:36 +00:00
Lukas Wirth 62fede212a Only record build script outputs when the output has been changed 2022-06-04 15:04:56 +02:00
bors 312913a640 Auto merge of #12461 - Veykril:completions, r=Veykril
Move trait_impl completion analysis into CompletionContext
2022-06-03 18:49:37 +00:00
Lukas Wirth a2a74bf278 Remove some of the unnecessary helpfer functions from CompletionContext 2022-06-03 20:49:25 +02:00
Lukas Wirth a0c1816e3a Simplify 2022-06-03 19:55:30 +02:00
Lukas Wirth 98c0578f15 Move trait_impl completion analysis into CompletionContext 2022-06-03 19:49:02 +02:00
bors d06d0f8774 Auto merge of #12459 - Veykril:completions, r=Veykril
internal: Clean up keyword completion handling

https://github.com/rust-lang/rust-analyzer/issues/12144
2022-06-03 15:20:30 +00:00
bors d0a7ad4a7f Auto merge of #12457 - Veykril:logging, r=Veykril
internal: Don't log default build script outputs
2022-06-03 15:11:02 +00:00
bors 43d9c3f649 Auto merge of #12460 - Veykril:move-guard, r=Veykril
minor: Reduce move-guard trigger range
2022-06-03 15:00:26 +00:00
Lukas Wirth b34e27d25e minor: Reduce move-guard trigger range 2022-06-03 17:00:03 +02:00
Lukas Wirth d0e3114441 internal: Don't log default build script outputs 2022-06-03 16:46:16 +02:00
Lukas Wirth 2a60b8452e Deduplicate 2022-06-03 16:33:37 +02:00
Lukas Wirth 522f66545f Remove prev-sibling completion machinery 2022-06-03 16:25:37 +02:00
Lukas Wirth 6550a241fb More precise where keyword completions 2022-06-03 16:11:26 +02:00
Lukas Wirth c522669f00 Remove dead code 2022-06-03 15:46:17 +02:00
Lukas Wirth c5dcc77b40 Fix visibility mods not being completed for field defs 2022-06-03 15:42:28 +02:00
Lukas Wirth 519ac81b57 internal: Move most remaining keyword completions to item list completions 2022-06-03 15:15:21 +02:00
bors 58b6d46d5a Auto merge of #12333 - nolanderc:order-import-assist, r=Veykril
Order auto-imports by relevance

Fixes #10337.

Basically we sort the imports according to how "far away" the imported item is from where we want to import it to. This change makes it so that imports from the current crate are sorted before any third-party crates. Additionally, we make an exception for builtin crates (`std`, `core`, etc.) so that they are sorted before any third-party crates.

There are probably other heuristics that should be added to improve the experience (such as preferring imports that are common elsewhere in the same crate, and ranking crates depending on the dependency graph). However, I think this is a first good step.

PS. This is my first time contributing here, so please be gentle if I have missed something obvious :-)
2022-06-03 07:49:59 +00:00
bors ea15e1000f Auto merge of #12452 - iDawer:assist.merge_selected_imports, r=Veykril
feature: `Merge imports` assist can merge multiple selected imports.

The selected imports have to have a common prefix in paths.

Select imports or use trees to merge:
```rust
$0use std::fmt::Display;
use std::fmt::Debug;
use std::fmt::Write;$0
```
Apply `Merge imports`:
```rust
use std::fmt::{Display, Debug, Write};
```

Closes #12426
2022-06-03 07:40:34 +00:00
bors 29fae10345 Auto merge of #12451 - TimNN:double-dollar, r=Veykril
feat: Support `$$` in macros.

The implementation mirrors what `rustc` currently does [1]. Part of #11952.

\[1]: https://github.com/rust-lang/rust/blob/0595ea1d12cf745e0a672d05341429ecb0917e66/compiler/rustc_expand/src/mbe/quoted.rs#L230-L241
2022-06-03 07:23:48 +00:00
bors d1968a38b9 Auto merge of #12456 - lnicola:thread-names, r=lnicola
internal: Shorten main thread names

Linux effectively has a 15 byte limit, which resulted in `rust-analyzer s` and `rust-analyzer p`. That's still unambiguous, but probably not obvious.
2022-06-03 04:28:07 +00:00
Laurențiu Nicola 7066b8e0ca Shorten main thread name 2022-06-03 07:27:48 +03:00
Tim Neumann 40bfb29e50 feat: Support $$ in macros.
The implementation mirrors what `rustc` currently does [1]. Part of #11952.

[1]: https://github.com/rust-lang/rust/blob/0595ea1d12cf745e0a672d05341429ecb0917e66/compiler/rustc_expand/src/mbe/quoted.rs#L230-L241
2022-06-02 21:48:28 +02:00
iDawer ea8899a445 Allow merging of multiple selected imports.
The selected imports have to have a common prefix in paths.

Before
```rust
$0use std::fmt::Display;
use std::fmt::Debug;$0
```
After
```rust
use std::fmt::{Display, Debug};
```
2022-06-02 23:15:55 +05:00
bors 88024c7ec2 Auto merge of #12444 - XFFXFF:fix_12442, r=Veykril
fix: parsing of `?` opt-out trait bounds

fixes #12442
2022-06-02 14:02:36 +00:00
XFFXFF df67bbdcb3 fix: parsing of ? opt-out trait bounds
thanks to Veykril
2022-06-02 21:30:18 +08:00
bors 2f0814ea35 Auto merge of #12347 - feniljain:fix_extract_module, r=Veykril
fix(extract_module) resolving import panics and improve import resolution

- Should solve #11766
- While adding a test case for this issue, I observed another issue:
For this test case:
```rust
            mod x {
                pub struct Foo;
                pub struct Bar;
            }

            use x::{Bar, Foo};

            $0type A = (Foo, Bar);$0
```
extract module should yield this:

```rust
            mod x {
                pub struct Foo;
                pub struct Bar;
            }

            use x::{};

            mod modname {
                use super::x::Bar;

                use super::x::Foo;

                pub(crate) type A = (Foo, Bar);
            }
```

instead it gave:

```rust
            mod x {
                pub struct Foo;
                pub struct Bar;
            }

            use x::{};

            mod modname {
                use x::Bar;

                use x::Foo;

                pub(crate) type A = (Foo, Bar);
            }
```

So fixed this problem with second commit
2022-06-02 12:37:17 +00:00
bors 6f7c5589ab Auto merge of #12443 - Veykril:fmtfix, r=Veykril
minor: Fix rustfmt failing on main_loop.rs
2022-06-01 19:23:22 +00:00
Lukas Wirth 343562c54d minor: Fix rustfmt failing on main_loop.rs 2022-06-01 21:20:54 +02:00
bors cf10a1ee3e Auto merge of #12440 - Maan2003:empty-msg-diag, r=jonas-schievink
fix(diagnostic): Don't remove diagnostic with empty message

Use " " as message if it is empty

[discussion on zulip](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/empty.20diagnostic.20message)

![image](https://user-images.githubusercontent.com/49202620/171412661-9b9575e9-e71b-4b84-a5c0-00271548d50c.png)
2022-06-01 14:31:14 +00:00
Maan2003 bad931116e fix(diagnostic): Don't remove diagnostic with empty message
Use " " as message if it is empty
2022-06-01 18:38:53 +05:30
bors 4f5c7aafff Auto merge of #12431 - Veykril:request-retry, r=Veykril
fix: Fix completions disappearing when typing two keys in quick succession

With this PR we now retry requests if they get cancelled due to document changes.

This fixes the completions problem we have where completions seem to randomly disappear, see https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Completions.20not.20always.20appearing

Fixes https://github.com/rust-lang/rust-analyzer/issues/10187
Fixes https://github.com/rust-lang/rust-analyzer/issues/7560
Fixes https://github.com/rust-lang/rust-analyzer/issues/12153
2022-06-01 10:18:50 +00:00
Lukas Wirth d88ae66ed9 Sync handlers cannot be cancelled 2022-06-01 12:18:15 +02:00