Commit graph

15232 commits

Author SHA1 Message Date
Lukas Wirth
9153f17382 internal: Simplify hir_ty::utils 2022-06-12 16:07:08 +02:00
Lukas Wirth
7a0ab1358c internal: Remove Generics::type_iter in favor of Generics::iter 2022-06-12 14:40:37 +02:00
Lukas Wirth
ad109f7f0a fix: Don't respond to cancelled requests when retrying them 2022-06-12 02:56:19 +02:00
bors
f58c26e0ba Auto merge of #12501 - Veykril:dashmap, r=Veykril
internal: Update dashmap and freeze its version
2022-06-10 14:20:46 +00:00
Lukas Wirth
0cf677ab42 internal: Update dashmap and freeze its version 2022-06-10 16:19:52 +02:00
bors
79a4a464b0 Auto merge of #12487 - lukechu10:master, r=lnicola
minor: hide param inlay hint when argument is fn-like macro with similar name

Closes #12486
2022-06-08 14:55:17 +00:00
bors
b967f1797c Auto merge of #12493 - bjorn3:fix_warnings, r=lnicola
Fix a couple of weak warnings found by rust-analyzer itself
2022-06-08 14:46:40 +00:00
Luke Chu
6079eeb1bf Hide param inlay hint when argument is fn-like macro with similar name 2022-06-08 14:37:57 +00:00
bjorn3
c81608c6d2 Fix a couple of weak warnings found by rust-analyzer itself 2022-06-08 14:35:11 +00:00
bjorn3
f9e1ff6846 Add doc comment 2022-06-08 14:31:36 +00:00
bjorn3
c6827e2f47 Rustfmt 2022-06-08 14:22:17 +00:00
bjorn3
a07b3103b1 Add proc macro ABI for rustc 1.63 2022-06-08 13:41:10 +00:00
KOLANICH
b3d2012659 Remove the unneeded destructuring assignment in run in project-model/src/build_scripts.rs 2022-06-06 14:02:34 +03:00
Lukas Wirth
0be31d945e fix: Fix trait impl completions using wrong insert position 2022-06-05 20:29:36 +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
Lukas Wirth
d38b7b88c6 minor: Don't log cancelled diagnostics 2022-06-05 01:38:46 +02: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
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]: 0595ea1d12/compiler/rustc_expand/src/mbe/quoted.rs (L230-L241)
2022-06-03 07:23:48 +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]: 0595ea1d12/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
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::Bar;

                use super::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
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
Lukas Wirth
e2da967578 fix: Fix completions disappearing when typing two keys in quick succession 2022-06-01 00:20:47 +02:00
bors
e25cbf8584 Auto merge of #12430 - Veykril:completions, r=Veykril
minor: Remove unused code
2022-05-31 18:22:41 +00:00
Lukas Wirth
1234d8647f minor: Remove unused code 2022-05-31 20:21:50 +02:00