Skip to content

Commit f54910d

Browse files
committed
filter results based on minScore parameter
1 parent 5175028 commit f54910d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pyls/plugins/importmagic_lint.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def pyls_code_actions(config, document, context):
108108
"""
109109
# Update the style configuration
110110
conf = config.plugin_settings('importmagic_lint')
111+
min_score = conf.get('minScore', 1)
111112
log.debug("Got importmagic settings: %s", conf)
112113
importmagic.Imports.set_style(**{_utils.camel_to_underscore(k): v for k, v in conf.items()})
113114

@@ -125,8 +126,8 @@ def pyls_code_actions(config, document, context):
125126
index = _get_index(sys.path)
126127

127128
for score, module, variable in sorted(index.symbol_scores(unres)[:MAX_COMMANDS], reverse=True):
128-
if score < 1:
129-
# These tend to be terrible
129+
if score < min_score:
130+
# Skip low score results
130131
continue
131132

132133
actions.append(generate_add_action(document, index, module, variable))

vscode-client/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
},
3636
"uniqueItems": true
3737
},
38+
"pyls.plugins.importmagic_lint.minScore": {
39+
"type": "number",
40+
"default": 1,
41+
"description": "The minimum score used to filter module import suggestions."
42+
},
3843
"pyls.plugins.jedi_completion.enabled": {
3944
"type": "boolean",
4045
"default": true,

0 commit comments

Comments
 (0)