Commit graph

22032 commits

Author SHA1 Message Date
Lukas Wirth
7274a48657 minor: log build script invocations 2022-05-24 22:56:49 +02:00
bors
db9930b986 Auto merge of #12357 - Veykril:find-ref-macro, r=Veykril
fix: When reference searching macro inputs, don't search everything that was downmapped

Fixes https://github.com/rust-lang/rust-analyzer/issues/11668
2022-05-23 14:12:35 +00:00
Lukas Wirth
377c9247e6 fix: When hovering macro inputs, don't show everything that was downmapped 2022-05-23 16:11:36 +02:00
Lukas Wirth
ad537be194 fix: When reference searching macro inputs, don't search everything that was downmapped 2022-05-23 16:09:56 +02:00
bors
238253c22d Auto merge of #12355 - ruabmbua:fix-inference-pattern-wildcards, r=flodiebold
Fix inference when pattern matching a tuple field with a wildcard

This should fix the following issue:  https://github.com/rust-lang/rust-analyzer/issues/12331

* Replaced the `err_ty` in `infer_pat()` with a new type variable.
* Had to change the iterator code a bit, to get around multiple mutable borrows of `self` in `infer_pat()`.
Also added a test
* Also added a test
2022-05-23 10:38:19 +00:00
Roland Ruckerbauer
86bb27f1a4 Fix inference when pattern matching a tuple field with a wildcard. 2022-05-23 12:24:54 +02:00
bors
c626034f11 Auto merge of #12354 - domenicquirl:reload-docs-typo, r=domenicquirl
Fix typo in new `reload.rs` docs

Just skimmed today's changelog and came across the repetition
2022-05-23 08:33:32 +00:00
DQ
f3a5475082
Keep the other is in reload.rs docs 2022-05-23 10:29:03 +02:00
DQ
914ff6a395
Fix typo in new reload.rs docs
Just skimmed today's changelog and came across the repetition
2022-05-23 09:35:32 +02:00
bors
e68c9f83d8 Auto merge of #12350 - umanwizard:fix_bsd, r=lnicola
Fix build on OpenBSD (and probably other BSDs too)

notify-5.0.0-pre.14 does not build on these systems; this was fixed in
41a74f0e98 , which landed in pre.15.
2022-05-23 06:16:56 +00:00
Brennan Vincent
364dd5ff89 Fix build on OpenBSD (and probably other BSDs too)
notify-5.0.0-pre.14 does not build on these systems; this was fixed in
41a74f0e98 , which landed in pre.15.
2022-05-22 17:04:57 -04:00
bors
84be2eaf99 Auto merge of #12349 - lnicola:universal-vsix, r=lnicola
internal: Publish universal VSIX to make VS happy
2022-05-22 18:16:57 +00:00
Laurențiu Nicola
f50afe1b39 Publish universal VSIX to make VS happy 2022-05-22 21:13:14 +03:00
bors
4b0f9c588d Auto merge of #12334 - fasterthanlime:gh-11635, r=Veykril
Generate enum variant assist

So, this is kind of a weird PR!

I'm a complete newcomer to the `rust-analyzer` codebase, and so I browsed the "good first issue" tag, and found #11635. Then I found two separate folks had taken stabs at it, most recently `@maartenflippo` — and there had been a review 3 days ago, but no activity in a little while, and the PR needed to be rebased since the crates were renamed from `snake_case` to `kebab-case`.

So to get acquainted with the codebase I typed this PR by hand, looking at the diff in #11995, and I also added a doc-test (that passes).

I haven't taken into account the comments `@Veykril` left in #11995, but I don't want to steal any of `@maartenflippo's` thunder! Closing this PR is perfectly fine. Or Maarten could use it as a "restart point"? Or I could finish it up, whichever feels best to everyone.

I think what remains to be done in this PR, at least, is:

  * [x] Only disable the "generate function" assist if the name is `PascalCase`
  * [x] Only enable the "generate variant" assistant if the name is `PascalCase`
  * [x] Simplify with `adt.source()` as mentioned here: https://github.com/rust-lang/rust-analyzer/pull/11995#discussion_r875134175
  * [ ] Add more tests for edge cases? Are there cases where simply adding one more indent level than the enum's indent level is not good enough? Some nested trickery I'm not thinking of right now?

Anyway. This PR can go in any direction. You can tell me "no, tackle your own issue!" And I'll go do that and still be happy I got to take a look at rust-analyzer some by doing this. Or you can tell me "okay, now _you_ finish it", and I guess I'll try and finish it :)

Closes #11635
2022-05-22 17:01:26 +00:00
Amos Wenger
ae2c0db67f Pull text creation into the closure 2022-05-22 18:38:14 +02:00
Amos Wenger
796c4d8a10 Better lowercase/uppercase checks 2022-05-22 18:31:12 +02:00
bors
65a213c9fa Auto merge of #12281 - lnicola:increase-overflow-depth, r=lnicola
Increase defalt chalk overflow depth to match max solver size

TBC:

 - #12279: ok above 480
 - ~~#12182~~
 - ~~#12095~~
 - #11902: ok above 350
 - ~~#11668~~
 - #11370: ok above 450
 - #9754: probably ok above 250 (!), and the code in cause and branch are gone

Closes #12279
Closes #11902
Closes #11370
Closes #9754
2022-05-22 15:14:26 +00:00
Laurențiu Nicola
8b56d42db9 Increase defalt chalk overflow depth to match max solver size 2022-05-22 18:10:38 +03:00
bors
038a71a201 Auto merge of #12345 - bvanjoi:escape_format_spcifier, r=Veykril
feat: escape format specifier(close: #12258)

solve https://github.com/rust-lang/rust-analyzer/issues/12258
2022-05-22 10:41:31 +00:00
bors
3535a052ce Auto merge of #12346 - rainy-me:fix/builtin-type-docs-links, r=Veykril
fix: special case base url of `BuiltinType` to core

fix #12250
2022-05-22 10:33:43 +00:00
rainy-me
3a380d4b3a fix: special case base url of BuiltinType to core 2022-05-22 18:50:40 +09:00
bors
90236dd77a Auto merge of #11830 - nemethf:on-type-formatting, r=nemethf
On typing handler for angle brackets(<) with snippets

I implemented my idea in #11398 in "cargo cult programming"-style without actually know what I'm doing, so feedback is welcome.  The PR is split into two commits to ease the review.  I used `@unexge's` original prototype, which forms the basis of the PR.
2022-05-22 08:59:04 +00:00
Felicián Németh
f7c963c0f2 onTypeFormatting: don't insert > if another > is there 2022-05-22 10:40:53 +02:00
Felicián Németh
3bb02f2329 feat: Add on-typing handler for left angle
Only advertise this feature in the server capabilities when the client
supports SnippetTextEdit.

Close #11398.

Co-authored-by: unexge <unexge@gmail.com>
2022-05-22 10:40:37 +02:00
Felicián Németh
636d4880c4 internal: Allow OnTypeFormatting to send SnippetTextEdit
But continue to send TextEdit only.
2022-05-22 10:39:18 +02:00
bvanjoi
f6b8525b1d feat: escape format specifier(close: #12258) 2022-05-22 15:32:24 +08:00
bors
3de03d4c61 Auto merge of #12342 - lnicola:fix-join-lines, r=lnicola
fix: Fix broken async callback in join lines

Fixes #12338.
2022-05-21 15:39:16 +00:00
Laurențiu Nicola
1e617f4fc6 Fix broken async callback in join lines 2022-05-21 18:38:10 +03:00
bors
01d412f4d7 Auto merge of #12339 - matklad:dead, r=matklad
dead code
2022-05-21 12:40:29 +00:00
Aleksey Kladov
7734a8b72f dead code 2022-05-21 13:39:59 +01:00
bors
49ffde4a65 Auto merge of #12337 - matklad:docz, r=matklad
internal: document overall approach to reload
2022-05-21 12:12:23 +00:00
Aleksey Kladov
cbdab0e647 internal: document overall approach to reload 2022-05-21 13:11:05 +01:00
Amos Wenger
707a5683b1 Still suggest generating enum methods if the name ref starts with a lowercase letter 2022-05-21 01:43:05 +02:00
Amos Wenger
0ed85beb15 Don't suggest enum variant if name_ref start with ASCII lowercase letter 2022-05-21 01:36:26 +02:00
Amos Wenger
7d716cbeb9 Simplify with adt.source() 2022-05-21 01:32:25 +02:00
Amos Wenger
2347da8c8d Generate enum variant assist
This also disables "generate function" when what we clearly want is to
generate an enum variant.

Co-authored-by: Maarten Flippo <maartenflippo@outlook.com>
2022-05-21 01:18:35 +02:00
bors
1182387224 Auto merge of #12329 - jonas-schievink:build-script-errors, r=jonas-schievink
fix: Don't swallow build script errors
2022-05-20 15:29:12 +00:00
Jonas Schievink
33939a3db1 Don't swallow build script errors 2022-05-20 17:28:39 +02:00
bors
2a978e1404 Auto merge of #12328 - Veykril:simplify, r=Veykril
minor: Simplify
2022-05-20 15:03:59 +00:00
Lukas Wirth
88e297e47d minor: Simplify 2022-05-20 16:52:10 +02:00
bors
c8d9a2dbdb Auto merge of #12327 - jonas-schievink:lambda-to-closure, r=jonas-schievink
internal: Rename `Expr::Lambda` to `Expr::Closure`

They're never really called "Lambda"s in Rust, so let's call them "Closures" consistently.
2022-05-20 13:45:21 +00:00
Jonas Schievink
60a2ab4c67 Rename Expr::Lambda to Expr::Closure 2022-05-20 15:40:32 +02:00
bors
1b65e00aea Auto merge of #12326 - jonas-schievink:add-clippy-task-preset, r=jonas-schievink
feat: Add "cargo clippy" task preset

We've had a couple of common presets in `Tasks: Run Task -> cargo -> cargo [check,build,test,...]` before. This PR adds `cargo clippy` to that list, which makes for a convenient way of occasionally running Clippy on your code without having to reconfigure the Check on Save command to clippy.

These presets all use the `cargo` task type that we provide, so diagnostics will show up in the editor. However, they don't go through the server-side parsing logic, so it's not possible to apply suggestions, and diagnostics are fairly "low-fidelity". It would be cool if we could somehow pass Cargo's JSON output through the LSP server and render it properly, for arbitrary tasks.

cc https://github.com/rust-lang/rust-analyzer/issues/12323
2022-05-20 13:36:59 +00:00
Jonas Schievink
c99a5ae312 Add "cargo clippy" task preset 2022-05-20 15:25:37 +02:00
bors
c73513f211 Auto merge of #12325 - jonas-schievink:clear-check-diags, r=jonas-schievink
fix: Clear `cargo check` diagnostics when flycheck is turned off

Previously stale diagnostics were left over indefinitely when turning off "Check on Save" while diagnostics are present.
2022-05-20 13:10:49 +00:00
Jonas Schievink
3e356c1fd3 Clear cargo check diagnostics when flycheck is turned off 2022-05-20 15:07:55 +02:00
bors
7f226fc912 Auto merge of #12324 - jonas-schievink:rm-attribute, r=jonas-schievink
feat: Revert the "Add attribute" assist

Reverts https://github.com/rust-lang/rust-analyzer/pull/12296, as the added indirection and "assist noise" (the assist has to trigger inside the body of an item to match what the "Add `#[derive]`" does) makes this not really pull its weight over just using attribute completions.

Keeps the changes to "Add getter". `#[must_use]` can be applied using the attribute completions.
2022-05-20 12:57:08 +00:00
bors
4bad1956a0 Auto merge of #12315 - matklad:update, r=Veykril
⬆️ deps
2022-05-20 12:44:15 +00:00
Jonas Schievink
e52d463524 Revert the "Add attribute" assist 2022-05-20 14:39:22 +02:00
bors
41388bf81a Auto merge of #12263 - andylizi:hide-type-hint-closure, r=Veykril
feat: hide type inlay hints for initializations of closures

![hide_closure_initialization](https://user-images.githubusercontent.com/12008103/168470158-6cb77b18-068e-4431-a8b5-e2b22d50d263.gif)

This PR adds an option to hide the inlay hints for `let IDENT_PAT = CLOSURE_EXPR;`, which is a somewhat common coding pattern. Currently the inlay hints for the assigned variable and the closure expression itself are both displayed, making it rather repetitive.

In order to be consistent with closure return type hints, only closures with block bodies will be hid by this option.

Personally I'd feel comfortable making it always enabled (or at least when closure return type hints are enabled), but considering the precedent set in #10761, I introduced an off-by-default option for this.

changelog feature: option to hide type inlay hints for initializations of closures
2022-05-20 12:35:36 +00:00