5935: Rewrite import insertion r=matklad a=Veykril
This is my attempt at refactoring the import insertion #3947. I hope what I created here is somewhat in line with what was requested, it wouldn't surprise me .
`common_prefix` is a copy from `merge_imports.rs` so those should be unified somewhere, `try_merge_trees` is also copied from there but slighly modified to take the `MergeBehaviour` enum into account.
`MergeBehaviour` should in the end become a configuration option, and the order if `ImportGroup` probably as well?
I'm not too familiar with the assist stuff and the like which is why I dont know what i have to do with `insert_use_statement` and `find_insert_use_container` for now.
I will most likely add more test cases in the end as well as I currently only tried to hit every path in `find_insert_position`.
Some of the merge tests also fail atm due to them not sorting what they insert. There is also this test case I'm not sure if we want to support it. I would assume we want to? https://github.com/rust-analyzer/rust-analyzer/pull/5935/files#diff-6923916dd8bdd2f1ab4b984adacd265fR540-R547
The entire module was rewritten so looking at the the file itself is probably better than looking at the diff.
Regarding the sub issues of #3947:
- #3301: This is fixed with the rewrite, what this implementation does is that it scans through the first occurence of groupings and picks the appropriate one out. This means the user can actually rearrange the groupings on a per file basis to their liking. If a group isnt being found it is inserted according to the `ImportGroup` variant order(Would be nice if this was configurable I imagine).
- #3831: This should be fixed with the introduced `MergeBehaviour` enum and it's `Last` variant.
- #3946: This should also be [fixed](https://github.com/rust-analyzer/rust-analyzer/pull/5935/files#diff-6923916dd8bdd2f1ab4b984adacd265fR87)
- #5795: This is fixed in the sense that the grouping search picks the first group that is of the same kind as the import that is being added. So if there is a random import in the middle of the program it should only be considered if there is no group of the same kind in the file already present.
- the last point in the list I havent checked yet, tho I got the feeling that it's not gonna be too simple as that will require knowledge of whether in this example `ast` is a crate or the module that is already imported.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
5930: Migrate to the latest Semantic Tokens Proposal for LSP 3.16 r=matklad a=kjeremy
This stabilizes call hierarchy and semantic tokens features on the client side and changes the server-side semantic tokens protocol to match the latest proposal for 3.16.
The server-side change will break clients depending on the earlier semantic tokens draft.
Fixes#4942
Co-authored-by: kjeremy <kjeremy@gmail.com>
5921: Don't publish every day and do it only for release r=matklad a=pksunkara
I think this is a good balance.
Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
5910: Fix some typos r=matklad a=SomeoneToIgnore
5912: Remove fixme from inlay_hints.ts r=matklad a=Veetaha
I have reevaluated the fixme and it doesn't seem necessary to pass an array of files
to the inlay hints request.
This will (a) make the request more compilcated (b), make us wait for
inlay hints for `all` active editors resolve at once before rendering and (c)
doesn't seem required because 99% of the time there is a single active editor
in the IDE
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Veetaha <veetaha2@gmail.com>
5909: Add rust-analyzer.checkOnSave.target to package.json r=matklad a=lnicola
This was already implemented, but it's missing from the manifest.
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
I have reevaluated the fixme and it doesn't seem necessary to pass an array of files
to the inlay hints request.
This will (a) make the request more compilcated (b), make us wait for
inlay hints for `all` active editors resolve at once before rendering and (c)
doesn't seem required because 99% of the time there is a single active editor
in the IDE