rust/crates
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
..
base-db minor: Simplify 2022-05-20 16:52:10 +02:00
cfg
flycheck internal: Show more project building errors to the user 2022-04-14 11:31:01 +02:00
hir Teach Callable about closures properly 2022-05-19 18:53:08 +02:00
hir-def Auto merge of #12328 - Veykril:simplify, r=Veykril 2022-05-20 15:03:59 +00:00
hir-expand minor: Simplify 2022-05-20 16:52:10 +02:00
hir-ty Increase defalt chalk overflow depth to match max solver size 2022-05-22 18:10:38 +03:00
ide Auto merge of #12345 - bvanjoi:escape_format_spcifier, r=Veykril 2022-05-22 10:41:31 +00:00
ide-assists Pull text creation into the closure 2022-05-22 18:38:14 +02:00
ide-completion fix: Fix incorrect expected type in completions for match arms 2022-05-19 12:33:25 +02:00
ide-db feat: escape format specifier(close: #12258) 2022-05-22 15:32:24 +08:00
ide-diagnostics Auto merge of #12010 - Veykril:r-a-config, r=Veykril 2022-05-10 12:07:24 +00:00
ide-ssr internal: Remove unqualified_path completions module 2022-05-05 22:21:42 +02:00
limit
mbe Revert "Auto merge of #12149 - jonas-schievink:literally-just-a-literal, r=jonas-schievink" 2022-05-13 15:08:14 +02:00
parser Revert "Auto merge of #12149 - jonas-schievink:literally-just-a-literal, r=jonas-schievink" 2022-05-13 15:08:14 +02:00
paths
proc-macro-api style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
proc-macro-srv style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
proc-macro-test delete a generated swap file 2022-05-01 10:48:58 +00:00
profile internal: vendor lsp-server 2022-05-14 21:15:43 +01:00
project-model Don't swallow build script errors 2022-05-20 17:28:39 +02:00
rust-analyzer feat: Add on-typing handler for left angle 2022-05-22 10:40:37 +02:00
sourcegen
stdx
syntax feat: Add binding mode inlay hints 2022-05-14 14:58:35 +02:00
test-utils style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
text-edit style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
toolchain
tt
vfs
vfs-notify