Commit Graph

1824 Commits

Author SHA1 Message Date
Ryo Yoshida
a1a408367e
Add regression test 2022-12-25 23:29:33 +09:00
Yuri Astrakhan
e341e996f7 Clippy-fix explicit auto-deref
Seems like these can be safely fixed. With one, I was particularly
surprised -- `Some(pats) => &**pats,` in body.rs?

```
cargo clippy --fix -- -A clippy::all -D clippy::explicit_auto_deref
```
2022-12-23 02:52:14 -05:00
Yuri Astrakhan
1d59c7b667 Remove non-needed clones
I am not certain if this will improve performance,
but it seems having a .clone() without any need should be removed.

This was done with clippy, and manually reviewed:

```
cargo clippy --fix -- -A clippy::all -D clippy::redundant_clone
```
2022-12-23 02:20:03 -05:00
bors
a06525517b Auto merge of #13820 - Veykril:or-pat-bm-fix, r=Veykril
Fix binding mode hints always adding parentheses to or-patterns
2022-12-22 23:02:19 +00:00
Maybe Waffle
ef4c8167e8 Pass FamousDefs around in inlay hints 2022-12-22 11:00:25 +00:00
bors
eb3963b22e Auto merge of #13817 - WaffleLapkin:hide_adjustment_hints_outside_of_unsafe, r=Veykril
feat: Add an option to hide adjustment hints outside of `unsafe` blocks and functions

As the title suggests: this PR adds an option (namely `rust-analyzer.inlayHints.expressionAdjustmentHints.hideOutsideUnsafe`) that allows to hide adjustment hints outside of `unsafe` blocks and functions:

![2022-12-21_23-11](https://user-images.githubusercontent.com/38225716/208986376-d607de62-8290-4e16-b7fe-15b762dc5f60.png)

Requested by `@BoxyUwU` <3
2022-12-22 09:37:00 +00:00
Lukas Wirth
b9341e2fe6 Fix binding mode hints always adding parentheses to or-patterns 2022-12-22 10:35:35 +01:00
Waffle Maybe
1038db5f1d Apply suggestions from code review
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-12-21 23:00:12 +00:00
bors
271f7b44d3 Auto merge of #13699 - HKalbasi:inlaylink, r=Veykril
Implement location link for type inlay hints

fix #11701

This actually doesn't work due a problem in vscode: https://github.com/microsoft/vscode/issues/167564
2022-12-21 21:43:38 +00:00
Maybe Waffle
608dc492ea Move is_inside_unsafe to Semantics impl 2022-12-21 20:36:05 +00:00
bors
c2840c809a Auto merge of #13814 - Veykril:layout, r=Veykril
Calculate the TargetDataLayout correctly for the selected target

This fails the tests still since those don't call into rustc yet
2022-12-21 19:38:51 +00:00
Maybe Waffle
3bfe7040e8 Add an option to hide adjustment hints outside of unsafe blocks 2022-12-21 19:20:42 +00:00
hkalbasi
e1aa73ef40 Disable inlay hint location links on vscode < 1.76 2022-12-21 18:54:49 +03:30
Lukas Wirth
33591cd3f4 Calculate the TargetDataLayout correctly for the selected target 2022-12-21 15:11:24 +01:00
hkalbasi
801a2231bf Implement location link for type inlay hints 2022-12-21 02:18:02 +03:30
Maybe Waffle
874ff2bc9d Skip adjustment hints if the adjustment doesn't adjust 2022-12-20 20:04:10 +00:00
Maybe Waffle
91a89efcf2 Save source & target types in hir's expr_adjustments 2022-12-20 19:33:27 +00:00
Maybe Waffle
046a5679e3 Add docs to make tidy tests happy :') 2022-12-20 13:30:53 +00:00
Maybe Waffle
1c8bcf0d4e Move inlay hints tests into implementation modules 2022-12-20 13:05:18 +00:00
Maybe Waffle
191cfba9d2 Split inlay hints into modules 2022-12-20 12:58:57 +00:00
bors
19c2ede549 Auto merge of #13784 - Veykril:bm-hints, r=Veykril
Deduplicate inserted parentheses in binding mode hints
2022-12-16 20:51:20 +00:00
Lukas Wirth
ba3e3282da Deduplicate inserted parentheses in binding mode hints 2022-12-16 21:17:10 +01:00
bors
8f6d0cd1b0 Auto merge of #13783 - Veykril:bm-hints, r=Veykril
Add parentheses for binding mode hints when they attach to an Or-pattern
2022-12-16 19:53:06 +00:00
Lukas Wirth
b6c2bb21ab Add parentheses for binding mode hints when they attach to an Or-pattern 2022-12-16 20:52:31 +01:00
Ryo Yoshida
bb99d2a6fb
fix: resolve all inference vars in InferenceResult::assoc_resolutions 2022-12-14 23:07:43 +09:00
bors
a3ea20a142 Auto merge of #13725 - bvanjoi:resolve-const-triat-impls, r=flodiebold
feat: resolve const for trait impls

Fixed #13694
2022-12-10 13:58:28 +00:00
bvanjoi
7012b50db5 feat: resolve const for trait impls(close #13694) 2022-12-10 20:06:25 +08:00
bors
14492043db Auto merge of #13749 - WaffleLapkin:remove_some_redudant_adjustment_hints, r=Veykril
fix: Don't show duplicated adjustment hints for blocks, ifs and matches

Before:
![2022-12-09_21-10](https://user-images.githubusercontent.com/38225716/206761100-5511d91b-2543-4166-aa2c-abdb8bad3613.png)
After:
![2022-12-09_21-22](https://user-images.githubusercontent.com/38225716/206761113-c58dbb5a-8616-4287-a3b4-69c13703294d.png)

----

I want to improve adjustment hints, this is the first step :)
2022-12-09 19:36:05 +00:00
Maybe Waffle
7c9a85bc43 fix: Don't show duplicated adjustment hints for blocks, ifs and matches 2022-12-09 18:45:01 +00:00
Lukas Wirth
e80674e6b3 Show type info on hover of enum variant fields 2022-12-09 10:09:55 +01:00
hkalbasi
05906da0ec use rustc crates instead of copy paste 2022-12-07 01:59:38 +03:30
hkalbasi
86b5b609f1 Compute data layout of types 2022-12-04 00:29:34 +03:30
Allan Brondum Rasmussen
30736b54c9 fmt 2022-12-03 01:20:27 +01:00
Allan Brondum Rasmussen
cc4f9db086 remove unneeded test 2022-12-03 00:53:56 +01:00
Allan Brondum Rasmussen
bce3b63700 check reference is a NameRef (and not Name) 2022-12-02 23:50:39 +01:00
Jonas Schievink
b65b02fd97 Fix signature help not showing up when cursor is between )) or >> 2022-11-29 18:50:21 +01:00
bors
99daf23e11 Auto merge of #13671 - Veykril:goto-decl, r=Veykril
Improve goto declaration

Closes https://github.com/rust-lang/rust-analyzer/issues/13599

- goto decl now goes to assoc items of trait declarations over the items of trait implementations
- goto decl now goes to the field declaration (opposed to goto def which shows both the field decl and binding created/local being used)
- also adds back the goto definition fallback that seems to have been dropped at some point.
2022-11-25 09:28:39 +00:00
Lukas Wirth
ae0bdffcc9 Go to declaration goes to field declaration in pattern and expression shorthands 2022-11-25 10:27:54 +01:00
Lukas Wirth
3c794a34da Go to declaration goes to assoc items of trait declarations 2022-11-25 10:27:49 +01:00
Kartavya Vashishtha
a26aef9055
fix formatting 2022-11-25 12:22:06 +05:30
Kartavya Vashishtha
91e7624de0
add hover tests 2022-11-25 12:20:38 +05:30
Kartavya Vashishtha
e86d451484
fix token method call 2022-11-25 12:20:34 +05:30
Kartavya Vashishtha
132d5ffc7d
add back [] in hover documentation 2022-11-25 12:04:14 +05:30
Kartavya Vashishtha
f64feeb11a
Correct node traversal to look at parent instead
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-11-24 22:32:15 -08: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
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
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