Always resolve code action if needed (#8904)
Follow-up of https://github.com/zed-industries/zed/pull/8874 and https://github.com/zed-industries/zed/pull/7635 Closes https://github.com/zed-industries/zed/issues/7609 * mentions all `lsp::CodeActions` properties in the Zed client resolve capabilities to remove more json out of general actions request potentially * removes odd `CodeActions.data` field checks, as that field is opaque and is intended to store data, needed by the langserver to resolve this code action * if any `CodeAction` lacks either `command` or `edits` fields, tries to resolve the action This all effectively causes Zed to always fire an action resolve request, since we update actions list (replacing the resolved actions with the new, unresolved ones) via `refresh_code_actions` https://github.com/zed-industries/zed/blob/9e66d48ccd3bb87ee97aec4e63484dc8b78e45ac/crates/editor/src/editor.rs#L3650 that is being called on selections change and the actions menu open. Yet, we do not query the resolve until the action is either applied (selected in the list), or called for formatting, so it seems to be fine to resolve them always, as it's not a frequent operation such as reacting to every keystroke. Release Notes: - Fixed certain code actions not being resolved properly ([7609](https://github.com/zed-industries/zed/issues/7609)) --------- Co-authored-by: Derrick Laird <swampdonk@gmail.com>
This commit is contained in:
co-authored by
Derrick Laird
parent
addfcdea8d
commit
703c9655a0
@@ -1834,6 +1834,19 @@ impl LspCommand for GetCodeActions {
|
||||
}
|
||||
}
|
||||
|
||||
impl GetCodeActions {
|
||||
pub fn can_resolve_actions(capabilities: &ServerCapabilities) -> bool {
|
||||
capabilities
|
||||
.code_action_provider
|
||||
.as_ref()
|
||||
.and_then(|options| match options {
|
||||
lsp::CodeActionProviderCapability::Simple(_is_supported) => None,
|
||||
lsp::CodeActionProviderCapability::Options(options) => options.resolve_provider,
|
||||
})
|
||||
.unwrap_or(false)
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait(?Send)]
|
||||
impl LspCommand for OnTypeFormatting {
|
||||
type Response = Option<Transaction>;
|
||||
|
||||
Reference in New Issue
Block a user