This commit is contained in:
Aleksey Kladov 2020-07-09 15:35:52 +02:00
parent b398519011
commit 9d0196a491
12 changed files with 13 additions and 133 deletions

View File

@ -4,19 +4,7 @@ expression: diag
---
[
MappedRustDiagnostic {
location: Location {
uri: "file:///test/compiler/mir/tagset.rs",
range: Range {
start: Position {
line: 41,
character: 23,
},
end: Position {
line: 41,
character: 28,
},
},
},
url: "file:///test/compiler/mir/tagset.rs",
diagnostic: Diagnostic {
range: Range {
start: Position {

View File

@ -4,19 +4,7 @@ expression: diag
---
[
MappedRustDiagnostic {
location: Location {
uri: "file:///test/src/main.rs",
range: Range {
start: Position {
line: 1,
character: 4,
},
end: Position {
line: 1,
character: 26,
},
},
},
url: "file:///test/src/main.rs",
diagnostic: Diagnostic {
range: Range {
start: Position {

View File

@ -4,19 +4,7 @@ expression: diag
---
[
MappedRustDiagnostic {
location: Location {
uri: "file:///test/crates/ra_hir_def/src/data.rs",
range: Range {
start: Position {
line: 79,
character: 15,
},
end: Position {
line: 79,
character: 41,
},
},
},
url: "file:///test/crates/ra_hir_def/src/data.rs",
diagnostic: Diagnostic {
range: Range {
start: Position {

View File

@ -4,19 +4,7 @@ expression: diag
---
[
MappedRustDiagnostic {
location: Location {
uri: "file:///test/src/main.rs",
range: Range {
start: Position {
line: 3,
character: 4,
},
end: Position {
line: 3,
character: 5,
},
},
},
url: "file:///test/src/main.rs",
diagnostic: Diagnostic {
range: Range {
start: Position {

View File

@ -4,19 +4,7 @@ expression: diag
---
[
MappedRustDiagnostic {
location: Location {
uri: "file:///test/compiler/ty/list_iter.rs",
range: Range {
start: Position {
line: 51,
character: 4,
},
end: Position {
line: 51,
character: 47,
},
},
},
url: "file:///test/compiler/ty/list_iter.rs",
diagnostic: Diagnostic {
range: Range {
start: Position {

View File

@ -4,19 +4,7 @@ expression: diag
---
[
MappedRustDiagnostic {
location: Location {
uri: "file:///test/runtime/compiler_support.rs",
range: Range {
start: Position {
line: 47,
character: 64,
},
end: Position {
line: 47,
character: 69,
},
},
},
url: "file:///test/runtime/compiler_support.rs",
diagnostic: Diagnostic {
range: Range {
start: Position {

View File

@ -4,19 +4,7 @@ expression: diag
---
[
MappedRustDiagnostic {
location: Location {
uri: "file:///test/driver/subcommand/repl.rs",
range: Range {
start: Position {
line: 290,
character: 8,
},
end: Position {
line: 290,
character: 11,
},
},
},
url: "file:///test/driver/subcommand/repl.rs",
diagnostic: Diagnostic {
range: Range {
start: Position {

View File

@ -4,19 +4,7 @@ expression: diag
---
[
MappedRustDiagnostic {
location: Location {
uri: "file:///test/driver/subcommand/repl.rs",
range: Range {
start: Position {
line: 290,
character: 8,
},
end: Position {
line: 290,
character: 11,
},
},
},
url: "file:///test/driver/subcommand/repl.rs",
diagnostic: Diagnostic {
range: Range {
start: Position {

View File

@ -4,19 +4,7 @@ expression: diag
---
[
MappedRustDiagnostic {
location: Location {
uri: "file:///test/driver/subcommand/repl.rs",
range: Range {
start: Position {
line: 290,
character: 8,
},
end: Position {
line: 290,
character: 11,
},
},
},
url: "file:///test/driver/subcommand/repl.rs",
diagnostic: Diagnostic {
range: Range {
start: Position {

View File

@ -4,19 +4,7 @@ expression: diag
---
[
MappedRustDiagnostic {
location: Location {
uri: "file:///test/compiler/ty/select.rs",
range: Range {
start: Position {
line: 103,
character: 17,
},
end: Position {
line: 103,
character: 29,
},
},
},
url: "file:///test/compiler/ty/select.rs",
diagnostic: Diagnostic {
range: Range {
start: Position {

View File

@ -125,7 +125,7 @@ fn map_rust_child_diagnostic(
#[derive(Debug)]
pub(crate) struct MappedRustDiagnostic {
pub(crate) location: lsp_types::Location,
pub(crate) url: lsp_types::Url,
pub(crate) diagnostic: lsp_types::Diagnostic,
pub(crate) fixes: Vec<lsp_ext::CodeAction>,
}
@ -246,7 +246,7 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
tags: if tags.is_empty() { None } else { Some(tags.clone()) },
};
MappedRustDiagnostic { location, diagnostic, fixes: fixes.clone() }
MappedRustDiagnostic { url: location.uri, diagnostic, fixes: fixes.clone() }
})
.collect()
}

View File

@ -238,7 +238,7 @@ impl GlobalState {
&workspace_root,
);
for diag in diagnostics {
match url_to_file_id(&self.vfs.read().0, &diag.location.uri) {
match url_to_file_id(&self.vfs.read().0, &diag.url) {
Ok(file_id) => self.diagnostics.add_check_diagnostic(
file_id,
diag.diagnostic,