11886: add test for postfix completion relevance r=matklad a=matklad
Follow up to #11857, add a test and cov-marks
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
11879: Suggest infered type in auto complete r=HKalbasi a=HKalbasi
fix#11855
It doesn't work for return types and consts (so their tests are failing) because I can't find their body node in the original file. (Are these original and fake file documented somewhere?)
Also it currently needs to type first character of the type (or manual ctrl+space) to open the auto complete panel, is it possible to open it automatically on typing `:` and `->`?
Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
11877: fix: splitting path of a glob import wrongly adds `self` r=Veykril a=iDawer
Close #11703
`ast::UseTree::split_prefix` handles globs now.
Removed an extra branch for globs in `ide_db::imports::merge_imports::recursive_merge` (superseeded by split_prefix).
Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
11881: fix: Don't rely on lang items to find primitive impls r=flodiebold a=flodiebold
rustc has removed the use of lang items to mark the primitive impls, so just look through the crate graph for them (this should be fine performance-wise since we cache the crates that contain these impls).
Fixes#11876.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
rustc has removed the use of lang items to mark the primitive impls, so
just look through the crate graph for them (this should be fine
performance-wise since we cache the crates that contain these impls).
Fixes#11876.
11878: fix: Paper over GAT panic r=flodiebold a=flodiebold
TIL that Chalk expects the arguments to a generic associated type to come *before* the ones for the parent trait, not *after* as we have been doing with all other nested generics. Fixing this requires a larger refactoring, so for now this just papers over the problem by completely ignoring parameters of associated types.
Fixes#11769.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
TIL that Chalk expects the arguments to a generic associated type to
come *before* the ones for the parent trait, not *after* as we have been
doing with all other nested generics. Fixing this requires a larger
refactoring, so for now this just papers over the problem by completely
ignoring parameters of associated types.
Fixes#11769.
11857: Lower postfix suggestions in completions list r=Veykril a=avrong
Fixes#11850
Adds a parameter for postfix suggestions in `CompletionRelevance`, and basing on it, decreases relevance score of such items in completion list
Co-authored-by: Aleksei Trifonov <avrong@avrong.me>
11870: Recover from missing type annotation r=Veykril a=HKalbasi
We were missing the init expression in case of `let x: = 2`, which breaks type inference of that variable (previously x were `{unknown}`, now it is `i32`).
Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
11871: internal: Move `rust.ungram` into `rust-analyzer/crates/syntax` r=Veykril a=Veykril
This makes updating the grammar a lot simpler for us. Though removing it from ungrammar can't be done without bumping it to 2.0 so I'll leave it in there for the time being.
cc https://github.com/rust-analyzer/ungrammar/pull/47
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
`ast::UseTree::split_prefix` handles globs now.
Removed an extra branch for globs in `ide_db::imports::merge_imports::recursive_merge` (superseeded by split_prefix).
11867: create generate is, as, try_into group r=Veykril a=jakevossen5
Fixes#11636
In `generate_enum_projection_method.rs`, the changes to the function are from `cargo fmt`, I made the same change as I did in `generate_enum_is_method.rs`.
Co-authored-by: Jake Vossen <jake@vossen.dev>
Previously, when line numbers of Rust spans were converted to LSP
ranges, they could underflow resulting in very large line numbers. As
an underflow is always wrong, prevent it and use 0 instead.
The logic for importing with and without `group_imports` differed
significantly when no previous group existed. This lead to the problem
of using the wrong position when importing inside a module (#11585) or
when inner attributes are involved.
The existing code for grouped imports is better and takes these things
into account.
This PR changes the flow to use the pre-existing code for adding a new
import group even for the non-grouped import settings.
Some coverage markers are updated and the `group` is removed, since they
are now invoked in both cases (grouping and no grouping).
Tests are updated and two tests (empty module and inner attribute) are
added.
Fixes#11585
11863: fix: allow varargs in any param position r=jonas-schievink a=jonas-schievink
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/3578 and aligns us with the Rust reference.
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11861: internal: Add "view file text" command to debug sync issues r=jonas-schievink a=jonas-schievink
I saw a file sync bug the other day but didn't know how to further debug it. This command might give a clue as to what's wrong and help debug issues like https://github.com/rust-analyzer/rust-analyzer/issues/4829.
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11852: Type mismatch when last expression is noreturn asm r=lnicola a=weirdsmiley
When last expression in a function body is noreturn asm, then analyzer
complains about the type mismatch by highlighting entire body. This
fixes it by introducing loop {} in the expanded code.
Fixes: [#11820](https://github.com/rust-analyzer/rust-analyzer/issues/11820)
Co-authored-by: Manas <manas18244@iiitd.ac.in>
When last expression in a function body is noreturn asm, then analyzer
complains about the type mismatch by highlighting entire body. This
fixes it by introducing loop {} in the expanded code.
11849: docs(auto_import): change by_self -> self and by_crate -> crate r=Veykril a=gibfahn
---
#### Commits _(oldest to newest)_
6b38c2d75 docs(auto_import): change by_self -> self and by_crate -> crate
Keep things consistent with the package.json , which uses `self` and
`crate` instead of `by_self` and `by_crate`. Both names are in fact
allowed as aliases, but we should be consistent so that people reading
the docs and using a schema do not see red squiggles.
<br/>
Co-authored-by: Gibson Fahnestock <gibfahn@gmail.com>
Keep things consistent with the package.json , which uses `self` and
`crate` instead of `by_self` and `by_crate`. Both names are in fact
allowed as aliases, but we should be consistent so that people reading
the docs and using a schema do not see red squiggles.
11844: Fix divergence detection for bare match arms r=flodiebold a=flodiebold
Fixes#11814 and #11837.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>