Commit Graph

24753 Commits

Author SHA1 Message Date
Lukas Wirth
ed3a5eac3c internal: Put Attrs behind a query instead of AttsWithOwner 2023-04-14 12:47:33 +02:00
bors
10e0aaf284 Auto merge of #14570 - Veykril:code-lens-fix, r=Veykril
fix: Fix inverted code lens resolve file version check

Fixes https://github.com/rust-lang/rust-analyzer/issues/14568
2023-04-14 06:42:45 +00:00
Lukas Wirth
3c7b6716d1 fix: Fix inverted code lens resolve file version check 2023-04-14 08:41:53 +02:00
bors
2c251a7e2b Auto merge of #14565 - Veykril:view-crate-graph, r=Veykril
minor: Allow copying the graphviz source from the view crategraph webview
2023-04-13 20:03:44 +00:00
Lukas Wirth
34177d8552 minor: Allow copying the graphviz source from the view crategraph webview 2023-04-13 22:01:57 +02:00
bors
08ce44e7d5 Auto merge of #14561 - jonas-schievink:goto-included-file, r=Veykril
feat: Map tokens from `include!` expansion to the included file

Fixes https://github.com/rust-lang/rust-analyzer/issues/3767
2023-04-13 16:04:00 +00:00
bors
16059112c4 Auto merge of #14560 - Veykril:view-crate-graph, r=Veykril
fix: Fix view crate graph being broken due to webworker usage

Fixes https://github.com/rust-lang/rust-analyzer/issues/14457
2023-04-13 15:50:01 +00:00
Jonas Schievink
901c8a4259 Map tokens from include! expansion to the included file 2023-04-13 17:41:24 +02:00
Lukas Wirth
7a6d5c680c fix: Fix view crate graph being broken due to webworker usage 2023-04-13 17:38:12 +02:00
bors
05a6286fb2 Auto merge of #14446 - Veykril:ci, r=Veykril
internal: Only run typescript CI when VSCode files change
2023-04-13 09:11:50 +00:00
bors
41ee5ca79d Auto merge of #14559 - Veykril:version-code-lens, r=Veykril
internal: Skip code lens resolution for mismatched document versions

Closes https://github.com/rust-lang/rust-analyzer/issues/12718
2023-04-13 08:55:40 +00:00
Lukas Wirth
0286e46e5f internal: Skip code lens resolution for mismatched document versions 2023-04-13 10:55:28 +02:00
Lukas Wirth
40adedcb96 internal: Only run typescript CI when VSCode files change 2023-04-13 10:52:40 +02:00
bors
2b62016448 Auto merge of #14558 - lnicola:bump-crossbeam, r=lnicola
minor: Bump crossbeam-channel

0.5.7 is yanked because of https://github.com/crossbeam-rs/crossbeam/issues/971, let's upgrade to 0.5.8.
2023-04-13 08:08:53 +00:00
Laurențiu Nicola
ec8f47b44f Bump crossbeam-channel 2023-04-13 11:07:18 +03:00
bors
b093423d12 Auto merge of #14556 - Veykril:sysroot-no-core-warn, r=Veykril
internal: Warn when loading sysroot fails to find the core library

Should help a bit more with user experience, before we only logged this now we show it in the status
Closes https://github.com/rust-lang/rust-analyzer/issues/11606
2023-04-13 06:41:06 +00:00
Lukas Wirth
dd5c3c30b6 internal: Warn when loading sysroot fails to find the core library 2023-04-13 08:40:14 +02:00
bors
1ee88db412 Auto merge of #14533 - lowr:feat/text-edits-for-inlay-hints, r=Veykril
feat: make inlay hints insertable

Part of #13812

This PR implements text edit for inlay hints. When an inlay hint contain text edit, user can "accept" it (e.g. by double-clicking in VS Code) to make the hint actual code (effectively deprecating the hint itself).

This PR does not implement auto import despite the original request; text edits only insert qualified types along with necessary punctuation. I feel there are some missing pieces to implement efficient auto import (in particular, type traversal function with early exit) so left it for future work. Even without it, user can use `replace_qualified_name_with_use` assist after accepting the edit to achieve the same result.

I implemented for the following inlay hints:
- top-level identifier pattern in let statements
- top-level identifier pattern in closure parameters
- closure return type when its has block body

One somewhat strange interaction can be observed when top-level identifier pattern has subpattern: text edit inserts type annotation in different place than the inlay hint. Do we want to allow it or should we not provide text edits for these cases at all?

```rust
let a /* inlay hint shown here */ @ (b, c) = foo();
let a @ (b, c) /* text edit inserts types here */ = foo();
```
2023-04-12 14:11:20 +00:00
Ryo Yoshida
c978d4bf0c
Implement text edits for inlay hints 2023-04-12 19:03:57 +09:00
Ryo Yoshida
fcbc250723
Add field for text edits to InlayHint 2023-04-12 19:03:55 +09:00
Ryo Yoshida
ac03de773f
Add flag to disallow opaque types for DisplayTarget::SourceCode 2023-04-12 19:03:48 +09:00
bors
7501d3b721 Auto merge of #14551 - lowr:patch/no-unstable-item-compl-on-stable, r=Veykril
Fix faulty variable extraction

Followup to #14549

Fixes https://github.com/rust-lang/rust-analyzer/pull/14549#discussion_r1163128814 and https://github.com/rust-lang/rust-analyzer/pull/14549#discussion_r1163132104
2023-04-11 17:43:15 +00:00
Ryo Yoshida
0a638676d1
Fix faulty variable extraction 2023-04-12 02:35:43 +09:00
bors
a1af8bb141 Auto merge of #14548 - Veykril:smol-str, r=Veykril
minor: Bump smol-str
2023-04-11 15:03:24 +00:00
bors
7afd2048f0 Auto merge of #14544 - HKalbasi:dev, r=Veykril
Infer types of nested RPITs

fix https://github.com/rust-lang/rust-analyzer/issues/14474#issuecomment-1501235394
2023-04-11 14:49:04 +00:00
bors
fd276218ec Auto merge of #14549 - lowr:patch/no-unstable-item-compl-on-stable, r=Veykril
Don't suggest unstable items on stable toolchain

Closes #3020

This PR implements stability check in `ide-completion` so that unstable items are only suggested if you're on nightly toolchain.

It's a bit unfortunate `CompletionContext::check_stability()` is spammed all over the crate, but we should call it before building `CompletionItem` as you cannot get attributes on the item it's completing from that struct. I looked up every callsite of `Builder::add_to()`, `Completions::add[_opt]()`, and`Completions::add_all()` and inserted the check wherever necessary.

The tests are admittedly incomplete in that I didn't add tests for every kind of item as I thought that would be too big and not worthwhile. I copy-pasted some existing basic tests in every test module and adjusted them.
2023-04-11 14:34:47 +00:00
bors
600283f2de Auto merge of #14550 - HKalbasi:mir, r=HKalbasi
Fix inference in nested closures

fix https://github.com/rust-lang/rust-analyzer/pull/14470#issuecomment-1503084796
2023-04-11 13:34:49 +00:00
hkalbasi
85f9235de8 fix inference in nested closure 2023-04-11 17:02:00 +03:30
Lukas Wirth
1456b53051 Bump smol-str 2023-04-11 14:39:19 +02:00
Ryo Yoshida
e6e48728da
Add tests for stability check in completion 2023-04-11 21:21:15 +09:00
Ryo Yoshida
0ce71dd76f
completion: check stability 2023-04-11 21:21:13 +09:00
Ryo Yoshida
584d2697cc
Add toolchain meta for tests 2023-04-11 21:21:10 +09:00
bors
5d41affc77 Auto merge of #14547 - Veykril:extract_adjust, r=Veykril
fix: Fix receiver adjustments for extract_variable assist
2023-04-11 12:01:47 +00:00
Lukas Wirth
72d47144e8 fix: Fix receiver adjustments for extract_variable assist 2023-04-11 14:01:23 +02:00
bors
f9f443076a Auto merge of #14540 - AmrDeveloper:disallow_extract_fun_single_brace, r=Veykril
Fix allow extracting function from single brace of block expression

Fix allow extracting function when selecting either `{` or `}`

Fix #14514
2023-04-11 10:10:25 +00:00
AmrDeveloper
5ded22065e Make all kind of braces not applicable in function extraction 2023-04-11 11:22:52 +02:00
bors
fa3db447d7 Auto merge of #14536 - ClSlaid:feat/reorder-impl-items/not-applicative-editing-assoc-items, r=Veykril
fix: restrict applicable range of `reorder-impl-trait-items`

This PR should complete the need for restricting the applicable range of `reorder-impl-trait-items`.

When the cursor is in the associated items of the `impl` range, the assist will be disabled.

Fix: #14515

## Showcases
Note: If there is any available `code-action` (`ide-assist`) available, a lightbulb icon from `lspsaga` will show in the left.

- cursor in `impl` headers
![code action available](https://user-images.githubusercontent.com/44747719/230756854-7b236018-cfa8-4005-b589-2996ec42917f.png)
Code action is available. And it is reordering impl items.
![code action detail](https://user-images.githubusercontent.com/44747719/230756971-341c7fbc-f2ba-4715-a1e5-b1add984d4dd.png)

- cursor in `impl` associated items
![code action unavailable](
https://user-images.githubusercontent.com/44747719/230756906-bee7784e-bd9d-49b2-801b-743c94b4af54.png)
2023-04-11 07:36:42 +00:00
bors
208a74ca50 Auto merge of #14535 - davidbarsky:davidbarsky/use-parent-folder-for-discovery-cwd, r=Veykril
fix: when running the "discoverProjectCommand", use the Rust file's parent directory instead of the workspace folder

This is a quick fix to allow the `discoverProjectCommand` to run successfully when the user has a workspace that does not, e.g., have a `.buckconfig` defined.

(It's also probably _more correct_ to set the `pwd` of the command to the parent of the Rust file _anyways_ rather than relying on the workspace folders, which may be entirely unrelated.)
2023-04-11 07:22:40 +00:00
hkalbasi
a584cb998f Infer types of nested RPITs 2023-04-11 04:32:11 +03:30
bors
44cf8ef49a Auto merge of #14470 - HKalbasi:mir, r=HKalbasi
Compute closure captures

This PR:
* Computes closure captures and the trait it implements (Fn, FnMut or FnOnce)
* Computes data layout of closures
* Adds support for closure MIR lowering
* Changes the closure type display from `|arg1: ty1, arg2: ty| -> ret` to `impl FnX(arg1: ty1, arg2: ty2) -> ret`

fix #12297
2023-04-10 19:43:51 +00:00
hkalbasi
59b6f2d9f2 Compute closure captures 2023-04-10 23:04:34 +03:30
David Barsky
b99c129b74 fix: when running the "discoverProjectCommand", use the Rust file's
parent directory instead of the workspace folder.
2023-04-10 09:36:38 -04:00
AmrDeveloper
2afc124cb9 Fix allow extracting function from single brace of block expression 2023-04-09 23:44:31 +02:00
bors
51d5862caf Auto merge of #14538 - Veykril:project-link-fix, r=Veykril
fix: Fix project linking popup appearing for modules that can be linked to a crate

should fix https://github.com/rust-lang/rust-analyzer/issues/14523
2023-04-09 08:18:12 +00:00
Lukas Wirth
98a673c4a8 fix: Fix project linking popup appearing for modules that can be linked to a crate 2023-04-09 10:17:58 +02:00
蔡略
475aa2839f refactor: correct test sample
giving a sorted file is useless

Signed-off-by: 蔡略 <cailue@bupt.edu.cn>
2023-04-09 00:24:25 +08:00
蔡略
e90e1901ef feat: restrict applicable range of reorder-impl-trait-items 2023-04-09 00:14:48 +08:00
bors
01120f1213 Auto merge of #14528 - HKalbasi:revert-14526-revert-14521-dev, r=Veykril
Add bounds for fields in derive macro, second try
2023-04-07 16:19:13 +00:00
hkalbasi
c54cb88950 Add bounds for associated types in derive macro 2023-04-07 19:33:14 +03:30
bors
972f1313eb Auto merge of #14526 - rust-lang:revert-14521-dev, r=Veykril
Revert "Add bounds for fields in derive macro"

Reverts rust-lang/rust-analyzer#14521 as it introduces too many mismatches
2023-04-07 09:02:31 +00:00