fix(ide-db): correct single-file module rename
Fixes a bug where rust-analyzer would emit `WorkspaceEdit`s with paths to dirs instead of files for the following project layout.
lib.rs
```rust
mod foo;
```
foo.rs
```rust
mod bar {
struct Bar;
}
```
Also fixes emitted paths for modules with mod.rs.
The bug resulted in panic in helix editor when attempting to rename a module.
fix: Retrigger visibility completion after parentheses
close#12390
This PR add `(` to trigger_characters as discussed in original issue.
Some questions:
1. Is lsp's `ctx.trigger_character` from `params.context` is the same as `ctx.original_token` inside actually completions?
1. If not what's the difference?
2. if they are the same, it's unnecessary to pass it down from handler at all.
3. if they are the same, maybe we could parse it from fixture directly instead of using the `check_with_trigger_character` I added.
2. Some completion fixtures written as `($0)` ( https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-completion/src/tests/fn_param.rs#L105 as an example), If I understand correctly they are not invoked outside tests at all?
1. using `ctx.original_token` directly would break these tests as well as parsing trigger_character from fixture for now.
2. I think it make sense to allow `(` triggering these cases?
3. I hope this line up with #12144
make `files.excludeDirs` work
There's a small issue because if all projects are excluded, this: 01d412f4d7/crates/rust-analyzer/src/main_loop.rs (L114) will be shown.
I thought about not showing it if `files.excludeDirs` is set, but that is not necessarily correct.
Fixes#7755
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
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
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#12279Closes#11902Closes#11370Closes#9754
Only advertise this feature in the server capabilities when the client
supports SnippetTextEdit.
Close#11398.
Co-authored-by: unexge <unexge@gmail.com>