Strictly suppress file_matcher in attribute completions#15081
Conversation
COPYING.rst IPython LICENSE MANIFEST.in README.rst SECURITY.md __pycache__ _build_meta.py codecov.yml docs examples ipython.egg-info long_description.rst pyproject.toml scripts setup.cfg setup.py setupbase.py tests tools case
|
Oops, I didn't realize backticks inside double quotes get executed. My git commit -m "fix |
We should not introduce regressions in this PR. Let's take a step back and think about it differently. I think there is only a limited set of commands which can be auto-evaluated without
|
| file_matcher_id = _get_matcher_id(self.file_matcher) | ||
| python_matcher_id = _get_matcher_id(self.python_matcher) | ||
| jedi_matcher_id = _get_matcher_id(self._jedi_matcher) | ||
| # If this is attribute completion and it explicitly | ||
| # recommends suppressing the file matcher, do so. | ||
| if ( | ||
| (matcher_id == python_matcher_id or matcher_id == jedi_matcher_id) | ||
| and isinstance(suppression_recommended, set) | ||
| and file_matcher_id in suppression_recommended | ||
| ): | ||
| should_suppress = True | ||
| else: | ||
| should_suppress = ( | ||
| (suppression_config is True) | ||
| or ( | ||
| suppression_recommended | ||
| and (suppression_config is not False) | ||
| ) | ||
| ) and has_any_completions(result) |
There was a problem hiding this comment.
Looking at how this requires hard-coding matcher-specific behaviour (or breaking backward compatibility) I now think it would be better to go with your initial idea of short-circuiting in file_matcher itself.
There was a problem hiding this comment.
That makes sense!


Fixes #15031
Description
The current logic only suppresses matchers if they are in the suppress set and there are matching results. As a result,
file_matchercan still display file matches when attribute completion fails. This PR updates the logic to always suppressfile_matcherduring attribute completion, regardless of whether any attributes were successfully matched.