9703: docs: Fix several typos and grammar mistakes r=matklad a=alexfertel
I took some time to clean up the dev docs a bit since I spent the whole week reading them. I am not a native speaker, so if you find something wrong please tell me and I'll fix it 😁
Co-authored-by: Alexander Gonzalez <alexfertel97@gmail.com>
9701: fix: correctly update diagnostics when files are opened and closed r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
9558: Do not erase Cargo diagnostics from the closed documents r=matklad a=SomeoneToIgnore
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6850
The LSP specification at https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#textDocument_publishDiagnostics states that
> Diagnostics notification are sent from the server to the client to signal results of validation runs.
>
> Diagnostics are “owned” by the server so it is the server’s responsibility to clear them if necessary. The following rule is used for VS Code servers that generate diagnostics:
>
> * if a language is single file only (for example HTML) then diagnostics are cleared by the server when the file is closed.
> * if a language has a project system (for example C#) diagnostics are not cleared when a file closes. When a project is opened all diagnostics for all files are recomputed (or read from a cache).
>
> When a file changes it is the server’s responsibility to re-compute diagnostics and push them to the client. If the computed set is empty it has to push the empty array to clear former diagnostics. Newly pushed diagnostics always replace previously pushed diagnostics. There is no merging that happens on the client side.
So for projects we should not clear any diagnostics from cargo/json projects.
Our "standalone file" mode is in a way a project too, with sysroot attached and a potential support for dynamic standalone files.
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
9593: fix: Adding remove_unused_param for method and fixing same for assoc func r=matklad a=feniljain
Solves #9571
Co-authored-by: vi_mi <fenil.jain2018@vitstudent.ac.in>
9692: Use same cancelled spelling in doc and code. r=matklad a=mattiasgronlund
Right thing might be to update the spelling in the code to
follow American instead of English spelling, that is
using only canceled. But they should at least be aligned.
Co-authored-by: Mattias Grönlund <mattias@gronlund.se>
Right thing might be to update the spelling in the code to
follow American instead of English spelling, that is
using only canceled. But they should at least be aligned.
9691: fix: Keep catch-all arm in fill_match_arms if it has a non-empty expression r=Veykril a=Veykril
Fixes#4165
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
9685: internal: add tests for tuple struct field completion and resolve a FIXME r=jonas-schievink a=jonas-schievink
This removes the last FIXME related to visibility and thus fixes https://github.com/rust-analyzer/rust-analyzer/issues/824
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
9684: Complete editable private items r=jonas-schievink a=jonas-schievink
This checks if a private item's location is editable (local source root), and completes them anyways if that's the case.
In order to test this, the `new_source_root` fixture command has been changed to take a `local` or `library` value, and to apply to all *following* files instead of the preceding ones (which would be hard to understand).
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
9681: Respect `#[doc(hidden)]` in dot-completion r=jonas-schievink a=jonas-schievink
This adds `CompletionContext::is_visible` as a convenience method that checks visibility, presence of `doc(hidden)`, and whether the completed item is in the same crate as the completion site or not. We only complete `doc(hidden)` items from the same crate.
This doesn't yet work for *all* completions: `qualified_path` completions use `Module::scope` and `ScopeDef`, which doesn't work with this.
Part of https://github.com/rust-analyzer/rust-analyzer/issues/7718
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>