From 15046fcb00dc106e64bc5c677661d866b0ff7a53 Mon Sep 17 00:00:00 2001 From: Tobias Krabel Date: Mon, 23 Oct 2023 23:10:36 +0200 Subject: [PATCH] support deactivating individual features --- pylsp/plugins/rope_autoimport.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pylsp/plugins/rope_autoimport.py b/pylsp/plugins/rope_autoimport.py index 535b1dc1..2c4f8a41 100644 --- a/pylsp/plugins/rope_autoimport.py +++ b/pylsp/plugins/rope_autoimport.py @@ -187,6 +187,8 @@ def pylsp_completions( ignored_names: Union[Set[str], None], ): """Get autoimport suggestions.""" + if not config.plugin_settings("rope_autoimport").get("completions", {}).get("enabled", False): + return [] line = document.lines[position["line"]] expr = parso.parse(line) word_node = expr.get_leaf_for_position((1, position["character"])) @@ -271,6 +273,8 @@ def pylsp_code_actions( ------- List of dicts containing the code actions. """ + if not config.plugin_settings("rope_autoimport").get("code_actions", {}).get("enabled", False): + return [] log.debug(f"textDocument/codeAction: {document} {range} {context}") code_actions = [] for diagnostic in context.get("diagnostics", []):