summaryrefslogtreecommitdiff
path: root/cli/lsp
diff options
context:
space:
mode:
Diffstat (limited to 'cli/lsp')
-rw-r--r--cli/lsp/config.rs8
-rw-r--r--cli/lsp/language_server.rs13
2 files changed, 17 insertions, 4 deletions
diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs
index a58a8d1ae..ff3d73f0f 100644
--- a/cli/lsp/config.rs
+++ b/cli/lsp/config.rs
@@ -24,10 +24,11 @@ pub const SETTINGS_SECTION: &str = "deno";
#[derive(Debug, Clone, Default)]
pub struct ClientCapabilities {
+ pub code_action_disabled_support: bool,
+ pub line_folding_only: bool,
pub status_notification: bool,
pub workspace_configuration: bool,
pub workspace_did_change_watched_files: bool,
- pub line_folding_only: bool,
}
fn is_true() -> bool {
@@ -395,6 +396,11 @@ impl Config {
.as_ref()
.and_then(|it| it.line_folding_only)
.unwrap_or(false);
+ self.client_capabilities.code_action_disabled_support = text_document
+ .code_action
+ .as_ref()
+ .and_then(|it| it.disabled_support)
+ .unwrap_or(false);
}
}
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs
index 8d672e251..9fbe6be5d 100644
--- a/cli/lsp/language_server.rs
+++ b/cli/lsp/language_server.rs
@@ -1298,11 +1298,18 @@ impl Inner {
.map(CodeActionOrCommand::CodeAction),
);
- let response = if !all_actions.is_empty() {
- Some(all_actions)
- } else {
+ let code_action_disabled_support =
+ self.config.client_capabilities.code_action_disabled_support;
+ let actions: Vec<CodeActionOrCommand> = all_actions.into_iter().filter(|ca| {
+ code_action_disabled_support
+ || matches!(ca, CodeActionOrCommand::CodeAction(ca) if ca.disabled.is_none())
+ }).collect();
+ let response = if actions.is_empty() {
None
+ } else {
+ Some(actions)
};
+
self.performance.measure(mark);
Ok(response)
}