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", []):