diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-03 11:27:31 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-03 11:27:31 +0000 |
commit | d400fde66c7139aad04e5c5c9875a1d41ef5eae8 (patch) | |
tree | f86b6711bc6fb006d99b0be09bf17f0a9a79b3ec /crates/ra_cargo_watch/src/conv | |
parent | 5b1b2cac39d88e730d594f951ab6613eab5ee498 (diff) | |
parent | 9f70f443a35bc12caf37e2548abf7987926c3875 (diff) |
Merge #2959
2959: Rework how we send diagnostics to client r=matklad a=kiljacken
The previous way of sending from the thread pool suffered from stale diagnostics due to being canceled before we could clear the old ones.
The key change is moving to sending diagnostics from the main loop thread, but doing all the hard work in the thread pool. This should provide the best of both worlds, with little to no of the downsides.
This should hopefully fix a lot of issues, but we'll need testing in each individual issue to be sure.
Co-authored-by: Emil Lauridsen <[email protected]>
Diffstat (limited to 'crates/ra_cargo_watch/src/conv')
7 files changed, 67 insertions, 39 deletions
diff --git a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_clippy_pass_by_ref.snap b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_clippy_pass_by_ref.snap index cb0920914..95ca163dc 100644 --- a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_clippy_pass_by_ref.snap +++ b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_clippy_pass_by_ref.snap | |||
@@ -61,25 +61,39 @@ MappedRustDiagnostic { | |||
61 | ), | 61 | ), |
62 | tags: None, | 62 | tags: None, |
63 | }, | 63 | }, |
64 | suggested_fixes: [ | 64 | fixes: [ |
65 | SuggestedFix { | 65 | CodeAction { |
66 | title: "consider passing by value instead: \'self\'", | 66 | title: "consider passing by value instead: \'self\'", |
67 | location: Location { | 67 | kind: Some( |
68 | uri: "file:///test/compiler/mir/tagset.rs", | 68 | "quickfix", |
69 | range: Range { | 69 | ), |
70 | start: Position { | 70 | diagnostics: None, |
71 | line: 41, | 71 | edit: Some( |
72 | character: 23, | 72 | WorkspaceEdit { |
73 | }, | 73 | changes: Some( |
74 | end: Position { | 74 | { |
75 | line: 41, | 75 | "file:///test/compiler/mir/tagset.rs": [ |
76 | character: 28, | 76 | TextEdit { |
77 | }, | 77 | range: Range { |
78 | start: Position { | ||
79 | line: 41, | ||
80 | character: 23, | ||
81 | }, | ||
82 | end: Position { | ||
83 | line: 41, | ||
84 | character: 28, | ||
85 | }, | ||
86 | }, | ||
87 | new_text: "self", | ||
88 | }, | ||
89 | ], | ||
90 | }, | ||
91 | ), | ||
92 | document_changes: None, | ||
78 | }, | 93 | }, |
79 | }, | 94 | ), |
80 | replacement: "self", | 95 | command: None, |
81 | applicability: Unspecified, | 96 | is_preferred: None, |
82 | diagnostics: [], | ||
83 | }, | 97 | }, |
84 | ], | 98 | ], |
85 | } | 99 | } |
diff --git a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_handles_macro_location.snap b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_handles_macro_location.snap index 19510ecc1..12eb32df4 100644 --- a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_handles_macro_location.snap +++ b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_handles_macro_location.snap | |||
@@ -42,5 +42,5 @@ MappedRustDiagnostic { | |||
42 | related_information: None, | 42 | related_information: None, |
43 | tags: None, | 43 | tags: None, |
44 | }, | 44 | }, |
45 | suggested_fixes: [], | 45 | fixes: [], |
46 | } | 46 | } |
diff --git a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_macro_compiler_error.snap b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_macro_compiler_error.snap index 92f7eec05..7b83a7cd0 100644 --- a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_macro_compiler_error.snap +++ b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_macro_compiler_error.snap | |||
@@ -57,5 +57,5 @@ MappedRustDiagnostic { | |||
57 | ), | 57 | ), |
58 | tags: None, | 58 | tags: None, |
59 | }, | 59 | }, |
60 | suggested_fixes: [], | 60 | fixes: [], |
61 | } | 61 | } |
diff --git a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_incompatible_type_for_trait.snap b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_incompatible_type_for_trait.snap index cf683e4b6..54679c5db 100644 --- a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_incompatible_type_for_trait.snap +++ b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_incompatible_type_for_trait.snap | |||
@@ -42,5 +42,5 @@ MappedRustDiagnostic { | |||
42 | related_information: None, | 42 | related_information: None, |
43 | tags: None, | 43 | tags: None, |
44 | }, | 44 | }, |
45 | suggested_fixes: [], | 45 | fixes: [], |
46 | } | 46 | } |
diff --git a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_mismatched_type.snap b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_mismatched_type.snap index 8c1483c74..57df4ceaf 100644 --- a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_mismatched_type.snap +++ b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_mismatched_type.snap | |||
@@ -42,5 +42,5 @@ MappedRustDiagnostic { | |||
42 | related_information: None, | 42 | related_information: None, |
43 | tags: None, | 43 | tags: None, |
44 | }, | 44 | }, |
45 | suggested_fixes: [], | 45 | fixes: [], |
46 | } | 46 | } |
diff --git a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_unused_variable.snap b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_unused_variable.snap index eb5a2247b..3e1fe736c 100644 --- a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_unused_variable.snap +++ b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_unused_variable.snap | |||
@@ -46,25 +46,39 @@ MappedRustDiagnostic { | |||
46 | ], | 46 | ], |
47 | ), | 47 | ), |
48 | }, | 48 | }, |
49 | suggested_fixes: [ | 49 | fixes: [ |
50 | SuggestedFix { | 50 | CodeAction { |
51 | title: "consider prefixing with an underscore: \'_foo\'", | 51 | title: "consider prefixing with an underscore: \'_foo\'", |
52 | location: Location { | 52 | kind: Some( |
53 | uri: "file:///test/driver/subcommand/repl.rs", | 53 | "quickfix", |
54 | range: Range { | 54 | ), |
55 | start: Position { | 55 | diagnostics: None, |
56 | line: 290, | 56 | edit: Some( |
57 | character: 8, | 57 | WorkspaceEdit { |
58 | }, | 58 | changes: Some( |
59 | end: Position { | 59 | { |
60 | line: 290, | 60 | "file:///test/driver/subcommand/repl.rs": [ |
61 | character: 11, | 61 | TextEdit { |
62 | }, | 62 | range: Range { |
63 | start: Position { | ||
64 | line: 290, | ||
65 | character: 8, | ||
66 | }, | ||
67 | end: Position { | ||
68 | line: 290, | ||
69 | character: 11, | ||
70 | }, | ||
71 | }, | ||
72 | new_text: "_foo", | ||
73 | }, | ||
74 | ], | ||
75 | }, | ||
76 | ), | ||
77 | document_changes: None, | ||
63 | }, | 78 | }, |
64 | }, | 79 | ), |
65 | replacement: "_foo", | 80 | command: None, |
66 | applicability: MachineApplicable, | 81 | is_preferred: None, |
67 | diagnostics: [], | ||
68 | }, | 82 | }, |
69 | ], | 83 | ], |
70 | } | 84 | } |
diff --git a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_wrong_number_of_parameters.snap b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_wrong_number_of_parameters.snap index 2f4518931..69301078d 100644 --- a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_wrong_number_of_parameters.snap +++ b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_wrong_number_of_parameters.snap | |||
@@ -61,5 +61,5 @@ MappedRustDiagnostic { | |||
61 | ), | 61 | ), |
62 | tags: None, | 62 | tags: None, |
63 | }, | 63 | }, |
64 | suggested_fixes: [], | 64 | fixes: [], |
65 | } | 65 | } |