5327: Mark fixes from check as preferred r=matklad a=kjeremy

This allows us to run the auto fix command from vscode to automatically fix diagnostics in the file.

They are also distinguished in the UI.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
This commit is contained in:
bors[bot] 2020-07-17 11:12:40 +00:00 committed by GitHub
commit 2ca0e9e00e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 20 additions and 0 deletions

View file

@ -118,6 +118,7 @@ fn map_rust_child_diagnostic(
changes: Some(edit_map),
document_changes: None,
}),
is_preferred: Some(true),
})
}
}

View file

@ -770,6 +770,7 @@ fn handle_fixes(
group: None,
kind: Some(CodeActionKind::QUICKFIX),
edit: Some(edit),
is_preferred: Some(false),
};
res.push(action);
}

View file

@ -243,6 +243,7 @@ impl Request for CodeActionRequest {
}
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CodeAction {
pub title: String,
#[serde(skip_serializing_if = "Option::is_none")]
@ -256,6 +257,8 @@ pub struct CodeAction {
// pub command: Option<lsp_types::Command>,
#[serde(skip_serializing_if = "Option::is_none")]
pub edit: Option<SnippetWorkspaceEdit>,
#[serde(skip_serializing_if = "Option::is_none")]
pub is_preferred: Option<bool>,
}
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]

View file

@ -689,6 +689,7 @@ pub(crate) fn unresolved_code_action(
group: assist.group.filter(|_| snap.config.client_caps.code_action_group).map(|gr| gr.0),
kind: Some(code_action_kind(assist.id.1)),
edit: None,
is_preferred: None,
};
Ok(res)
}

View file

@ -65,6 +65,9 @@
document_changes: None,
},
),
is_preferred: Some(
true,
),
},
],
},

View file

@ -65,6 +65,9 @@
document_changes: None,
},
),
is_preferred: Some(
true,
),
},
],
},

View file

@ -65,6 +65,9 @@
document_changes: None,
},
),
is_preferred: Some(
true,
),
},
],
},

View file

@ -93,6 +93,9 @@
document_changes: None,
},
),
is_preferred: Some(
true,
),
},
],
},

View file

@ -284,6 +284,7 @@ fn main() {}
}
]
},
"isPreferred": false,
"kind": "quickfix",
"title": "Create module"
}]),
@ -355,6 +356,7 @@ fn main() {{}}
}
]
},
"isPreferred": false,
"kind": "quickfix",
"title": "Create module"
}]),