diff options
Diffstat (limited to 'crates')
12 files changed, 13 insertions, 133 deletions
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_clippy_pass_by_ref.snap b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_clippy_pass_by_ref.snap index d7f9ec049..578b1e128 100644 --- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_clippy_pass_by_ref.snap +++ b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_clippy_pass_by_ref.snap | |||
@@ -4,19 +4,7 @@ expression: diag | |||
4 | --- | 4 | --- |
5 | [ | 5 | [ |
6 | MappedRustDiagnostic { | 6 | MappedRustDiagnostic { |
7 | location: Location { | 7 | url: "file:///test/compiler/mir/tagset.rs", |
8 | uri: "file:///test/compiler/mir/tagset.rs", | ||
9 | range: Range { | ||
10 | start: Position { | ||
11 | line: 41, | ||
12 | character: 23, | ||
13 | }, | ||
14 | end: Position { | ||
15 | line: 41, | ||
16 | character: 28, | ||
17 | }, | ||
18 | }, | ||
19 | }, | ||
20 | diagnostic: Diagnostic { | 8 | diagnostic: Diagnostic { |
21 | range: Range { | 9 | range: Range { |
22 | start: Position { | 10 | start: Position { |
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_handles_macro_location.snap b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_handles_macro_location.snap index a59faf254..577cf4b2d 100644 --- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_handles_macro_location.snap +++ b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_handles_macro_location.snap | |||
@@ -4,19 +4,7 @@ expression: diag | |||
4 | --- | 4 | --- |
5 | [ | 5 | [ |
6 | MappedRustDiagnostic { | 6 | MappedRustDiagnostic { |
7 | location: Location { | 7 | url: "file:///test/src/main.rs", |
8 | uri: "file:///test/src/main.rs", | ||
9 | range: Range { | ||
10 | start: Position { | ||
11 | line: 1, | ||
12 | character: 4, | ||
13 | }, | ||
14 | end: Position { | ||
15 | line: 1, | ||
16 | character: 26, | ||
17 | }, | ||
18 | }, | ||
19 | }, | ||
20 | diagnostic: Diagnostic { | 8 | diagnostic: Diagnostic { |
21 | range: Range { | 9 | range: Range { |
22 | start: Position { | 10 | start: Position { |
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_macro_compiler_error.snap b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_macro_compiler_error.snap index 3c78e7f36..22bd23a88 100644 --- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_macro_compiler_error.snap +++ b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_macro_compiler_error.snap | |||
@@ -4,19 +4,7 @@ expression: diag | |||
4 | --- | 4 | --- |
5 | [ | 5 | [ |
6 | MappedRustDiagnostic { | 6 | MappedRustDiagnostic { |
7 | location: Location { | 7 | url: "file:///test/crates/ra_hir_def/src/data.rs", |
8 | uri: "file:///test/crates/ra_hir_def/src/data.rs", | ||
9 | range: Range { | ||
10 | start: Position { | ||
11 | line: 79, | ||
12 | character: 15, | ||
13 | }, | ||
14 | end: Position { | ||
15 | line: 79, | ||
16 | character: 41, | ||
17 | }, | ||
18 | }, | ||
19 | }, | ||
20 | diagnostic: Diagnostic { | 8 | diagnostic: Diagnostic { |
21 | range: Range { | 9 | range: Range { |
22 | start: Position { | 10 | start: Position { |
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_multi_line_fix.snap b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_multi_line_fix.snap index 272057b47..1a0ac4f42 100644 --- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_multi_line_fix.snap +++ b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_multi_line_fix.snap | |||
@@ -4,19 +4,7 @@ expression: diag | |||
4 | --- | 4 | --- |
5 | [ | 5 | [ |
6 | MappedRustDiagnostic { | 6 | MappedRustDiagnostic { |
7 | location: Location { | 7 | url: "file:///test/src/main.rs", |
8 | uri: "file:///test/src/main.rs", | ||
9 | range: Range { | ||
10 | start: Position { | ||
11 | line: 3, | ||
12 | character: 4, | ||
13 | }, | ||
14 | end: Position { | ||
15 | line: 3, | ||
16 | character: 5, | ||
17 | }, | ||
18 | }, | ||
19 | }, | ||
20 | diagnostic: Diagnostic { | 8 | diagnostic: Diagnostic { |
21 | range: Range { | 9 | range: Range { |
22 | start: Position { | 10 | start: Position { |
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_incompatible_type_for_trait.snap b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_incompatible_type_for_trait.snap index 46d0c56d2..cc608dafe 100644 --- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_incompatible_type_for_trait.snap +++ b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_incompatible_type_for_trait.snap | |||
@@ -4,19 +4,7 @@ expression: diag | |||
4 | --- | 4 | --- |
5 | [ | 5 | [ |
6 | MappedRustDiagnostic { | 6 | MappedRustDiagnostic { |
7 | location: Location { | 7 | url: "file:///test/compiler/ty/list_iter.rs", |
8 | uri: "file:///test/compiler/ty/list_iter.rs", | ||
9 | range: Range { | ||
10 | start: Position { | ||
11 | line: 51, | ||
12 | character: 4, | ||
13 | }, | ||
14 | end: Position { | ||
15 | line: 51, | ||
16 | character: 47, | ||
17 | }, | ||
18 | }, | ||
19 | }, | ||
20 | diagnostic: Diagnostic { | 8 | diagnostic: Diagnostic { |
21 | range: Range { | 9 | range: Range { |
22 | start: Position { | 10 | start: Position { |
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_mismatched_type.snap b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_mismatched_type.snap index 4182929ba..4d2a8625e 100644 --- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_mismatched_type.snap +++ b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_mismatched_type.snap | |||
@@ -4,19 +4,7 @@ expression: diag | |||
4 | --- | 4 | --- |
5 | [ | 5 | [ |
6 | MappedRustDiagnostic { | 6 | MappedRustDiagnostic { |
7 | location: Location { | 7 | url: "file:///test/runtime/compiler_support.rs", |
8 | uri: "file:///test/runtime/compiler_support.rs", | ||
9 | range: Range { | ||
10 | start: Position { | ||
11 | line: 47, | ||
12 | character: 64, | ||
13 | }, | ||
14 | end: Position { | ||
15 | line: 47, | ||
16 | character: 69, | ||
17 | }, | ||
18 | }, | ||
19 | }, | ||
20 | diagnostic: Diagnostic { | 8 | diagnostic: Diagnostic { |
21 | range: Range { | 9 | range: Range { |
22 | start: Position { | 10 | start: Position { |
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable.snap b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable.snap index 9a7972ff5..e35941c76 100644 --- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable.snap +++ b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable.snap | |||
@@ -4,19 +4,7 @@ expression: diag | |||
4 | --- | 4 | --- |
5 | [ | 5 | [ |
6 | MappedRustDiagnostic { | 6 | MappedRustDiagnostic { |
7 | location: Location { | 7 | url: "file:///test/driver/subcommand/repl.rs", |
8 | uri: "file:///test/driver/subcommand/repl.rs", | ||
9 | range: Range { | ||
10 | start: Position { | ||
11 | line: 290, | ||
12 | character: 8, | ||
13 | }, | ||
14 | end: Position { | ||
15 | line: 290, | ||
16 | character: 11, | ||
17 | }, | ||
18 | }, | ||
19 | }, | ||
20 | diagnostic: Diagnostic { | 8 | diagnostic: Diagnostic { |
21 | range: Range { | 9 | range: Range { |
22 | start: Position { | 10 | start: Position { |
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable_as_hint.snap b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable_as_hint.snap index f0273315e..b6a7bcf60 100644 --- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable_as_hint.snap +++ b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable_as_hint.snap | |||
@@ -4,19 +4,7 @@ expression: diag | |||
4 | --- | 4 | --- |
5 | [ | 5 | [ |
6 | MappedRustDiagnostic { | 6 | MappedRustDiagnostic { |
7 | location: Location { | 7 | url: "file:///test/driver/subcommand/repl.rs", |
8 | uri: "file:///test/driver/subcommand/repl.rs", | ||
9 | range: Range { | ||
10 | start: Position { | ||
11 | line: 290, | ||
12 | character: 8, | ||
13 | }, | ||
14 | end: Position { | ||
15 | line: 290, | ||
16 | character: 11, | ||
17 | }, | ||
18 | }, | ||
19 | }, | ||
20 | diagnostic: Diagnostic { | 8 | diagnostic: Diagnostic { |
21 | range: Range { | 9 | range: Range { |
22 | start: Position { | 10 | start: Position { |
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable_as_info.snap b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable_as_info.snap index 85fd050fd..8c248faf2 100644 --- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable_as_info.snap +++ b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_unused_variable_as_info.snap | |||
@@ -4,19 +4,7 @@ expression: diag | |||
4 | --- | 4 | --- |
5 | [ | 5 | [ |
6 | MappedRustDiagnostic { | 6 | MappedRustDiagnostic { |
7 | location: Location { | 7 | url: "file:///test/driver/subcommand/repl.rs", |
8 | uri: "file:///test/driver/subcommand/repl.rs", | ||
9 | range: Range { | ||
10 | start: Position { | ||
11 | line: 290, | ||
12 | character: 8, | ||
13 | }, | ||
14 | end: Position { | ||
15 | line: 290, | ||
16 | character: 11, | ||
17 | }, | ||
18 | }, | ||
19 | }, | ||
20 | diagnostic: Diagnostic { | 8 | diagnostic: Diagnostic { |
21 | range: Range { | 9 | range: Range { |
22 | start: Position { | 10 | start: Position { |
diff --git a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_wrong_number_of_parameters.snap b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_wrong_number_of_parameters.snap index f6ab05004..3ece40eaf 100644 --- a/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_wrong_number_of_parameters.snap +++ b/crates/rust-analyzer/src/diagnostics/snapshots/rust_analyzer__diagnostics__to_proto__tests__snap_rustc_wrong_number_of_parameters.snap | |||
@@ -4,19 +4,7 @@ expression: diag | |||
4 | --- | 4 | --- |
5 | [ | 5 | [ |
6 | MappedRustDiagnostic { | 6 | MappedRustDiagnostic { |
7 | location: Location { | 7 | url: "file:///test/compiler/ty/select.rs", |
8 | uri: "file:///test/compiler/ty/select.rs", | ||
9 | range: Range { | ||
10 | start: Position { | ||
11 | line: 103, | ||
12 | character: 17, | ||
13 | }, | ||
14 | end: Position { | ||
15 | line: 103, | ||
16 | character: 29, | ||
17 | }, | ||
18 | }, | ||
19 | }, | ||
20 | diagnostic: Diagnostic { | 8 | diagnostic: Diagnostic { |
21 | range: Range { | 9 | range: Range { |
22 | start: Position { | 10 | start: Position { |
diff --git a/crates/rust-analyzer/src/diagnostics/to_proto.rs b/crates/rust-analyzer/src/diagnostics/to_proto.rs index f3a22885e..ded96c58a 100644 --- a/crates/rust-analyzer/src/diagnostics/to_proto.rs +++ b/crates/rust-analyzer/src/diagnostics/to_proto.rs | |||
@@ -125,7 +125,7 @@ fn map_rust_child_diagnostic( | |||
125 | 125 | ||
126 | #[derive(Debug)] | 126 | #[derive(Debug)] |
127 | pub(crate) struct MappedRustDiagnostic { | 127 | pub(crate) struct MappedRustDiagnostic { |
128 | pub(crate) location: lsp_types::Location, | 128 | pub(crate) url: lsp_types::Url, |
129 | pub(crate) diagnostic: lsp_types::Diagnostic, | 129 | pub(crate) diagnostic: lsp_types::Diagnostic, |
130 | pub(crate) fixes: Vec<lsp_ext::CodeAction>, | 130 | pub(crate) fixes: Vec<lsp_ext::CodeAction>, |
131 | } | 131 | } |
@@ -246,7 +246,7 @@ pub(crate) fn map_rust_diagnostic_to_lsp( | |||
246 | tags: if tags.is_empty() { None } else { Some(tags.clone()) }, | 246 | tags: if tags.is_empty() { None } else { Some(tags.clone()) }, |
247 | }; | 247 | }; |
248 | 248 | ||
249 | MappedRustDiagnostic { location, diagnostic, fixes: fixes.clone() } | 249 | MappedRustDiagnostic { url: location.uri, diagnostic, fixes: fixes.clone() } |
250 | }) | 250 | }) |
251 | .collect() | 251 | .collect() |
252 | } | 252 | } |
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 5900886e7..4e556bd50 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -238,7 +238,7 @@ impl GlobalState { | |||
238 | &workspace_root, | 238 | &workspace_root, |
239 | ); | 239 | ); |
240 | for diag in diagnostics { | 240 | for diag in diagnostics { |
241 | match url_to_file_id(&self.vfs.read().0, &diag.location.uri) { | 241 | match url_to_file_id(&self.vfs.read().0, &diag.url) { |
242 | Ok(file_id) => self.diagnostics.add_check_diagnostic( | 242 | Ok(file_id) => self.diagnostics.add_check_diagnostic( |
243 | file_id, | 243 | file_id, |
244 | diag.diagnostic, | 244 | diag.diagnostic, |