Skip to content

Commit

Permalink
support deactivating individual features
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrabel-db committed Oct 23, 2023
1 parent 203a8de commit 15046fc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pylsp/plugins/rope_autoimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]))
Expand Down Expand Up @@ -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", []):
Expand Down

0 comments on commit 15046fc

Please sign in to comment.