rust-analyzer/crates
bors[bot] f0db648cb6
Merge #9558
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>
2021-07-26 14:53:05 +00:00
..
base_db Complete editable private items 2021-07-23 19:57:16 +02:00
cfg internal: add simple smoke test for project model 2021-07-20 16:23:57 +03:00
flycheck internal: a bit more of cwd safety for flycheck 2021-07-17 18:13:35 +03:00
hir Respect #[doc(hidden)] in dot-completion 2021-07-23 15:36:43 +02:00
hir_def Fix formatting and use Iterator::any 2021-07-23 16:45:14 +02:00
hir_expand Add Limit struct. 2021-07-19 13:26:11 +01:00
hir_ty Resolve tuple variants in value namespace 2021-07-22 13:40:18 +02:00
ide Resolve derive attribute input macro paths in ide layer 2021-07-24 20:35:43 +02:00
ide_assists Merge #9593 2021-07-26 10:36:31 +00:00
ide_completion Fix typo 2021-07-24 11:20:40 +03:00
ide_db Resolve derive attribute input macro paths in ide layer 2021-07-24 20:35:43 +02:00
ide_diagnostics Fix some grammar / spelling mistakes 2021-07-26 10:12:41 +02:00
ide_ssr minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
limit Add Limit struct. 2021-07-19 13:26:11 +01:00
mbe minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
parser Fix generic_arg not parsing opt_generic_arg_list properly in arg lists 2021-07-26 15:21:19 +02:00
paths Fix AbsPath::ends_with 2021-07-18 10:25:14 +03:00
proc_macro_api internal: a bit more of cwd safety for flycheck 2021-07-17 18:13:35 +03:00
proc_macro_srv internal: a bit more of cwd safety for flycheck 2021-07-17 18:13:35 +03:00
proc_macro_test cargo_metadata 0.14 2021-07-09 11:01:55 -04:00
profile minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
project_model internal: add simple smoke test for project model 2021-07-20 16:23:57 +03:00
rust-analyzer Merge #9558 2021-07-26 14:53:05 +00:00
sourcegen minor: make sure that project_root works correctly 2021-07-13 15:02:29 +03:00
stdx Remove proc macro management thread 2021-07-08 16:43:39 +02:00
syntax Fix generic_arg not parsing opt_generic_arg_list properly in arg lists 2021-07-26 15:21:19 +02:00
test_utils Complete editable private items 2021-07-23 19:57:16 +02:00
text_edit minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
toolchain minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
tt minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
vfs internal: make it easier to isolate IO 2021-07-17 17:55:16 +03:00
vfs-notify Bump deps 2021-07-24 11:16:32 +03:00