-
Notifications
You must be signed in to change notification settings - Fork 767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Less aggressive filtering of code completions - class methods #608
Comments
I think we do this mainly so we can limit the number of matches when auto-imports are involved; maybe we should always return full results for "definitely known" members, and then apply the 2 character minimum to auto-imports. |
The 2-character minimum applies only to the auto-import path already. The other code paths use fuzzy matching, but the fuzzy-matching algorithm takes into account how many characters match and don't match. As you type more characters, that ratio changes, and the algorithm will give it a higher matching score. Here's the code for the algorithm if you're interested. I'm in no way wedded to the current algorithm. It was just some heuristics I threw together that seemed to work pretty well. I'm sure we can do better if we play with it. |
It does make sense to enable fuzzy matching only after the first two chars. Otherwise you probably wouldn't filter at all in some cases. However after these two all matching results could be visible, even if only down the list. |
@erictraut I just looked at the algorithm again and you were probably right. It might be that it doesn't calculate the |
This issue has been fixed in version 2020.12.0, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#2020120-2-december-2020 |
When using code completions, I often wonder if it would be possible to use less aggressive filtering for class / instance methods and attributes. At the moment Pylance requires the first two chars to match before it starts fuzzy matching. Since it would be quite limited, I don't think there would be any noticeable performance issues.
Say for example
mock.assert_called_once()
. I often think aboutcalled
and start writing that only to then notice that it doesn't match since I missedas
forassert
. Enabling fuzzy matching for all chars in that case would make it easier to find what I'm looking for without thinking too much about it.The text was updated successfully, but these errors were encountered: