-
Notifications
You must be signed in to change notification settings - Fork 769
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
Autocomplete should be less aggressive about suggesting function definitions #629
Comments
This behavior changed once we stopped offering completions in these contexts (as we can't know what you want to name a new import alias). VS Code has taken over and started offering snippets and word suggestions. These snippets come from the Python extension and are injected directly by VS Code itself. The snippet rules rely on regex matching (at best) to guess as to what context they should be offered in, and IMO don't work so well. Personally I recommend disabling them altogether: "[python]": {
"editor.snippetSuggestions": "none"
} Or just for every language (what I do): "editor.snippetSuggestions": "none" Once these are disabled, you may get word suggestions too, and there's info in #604 for that. I'm going to close this as a dupe of #604 as I believe the fix for that will also fix this issue (offering up a single completion that's what you typed so VS Code stops trying to be clever), but I plan to file a proposal on the Python extension about just not having the snippets anymore. |
Thanks for the quick response. That all makes sense; I didn't realize it was upstream now. I appreciate the help. |
Environment data
Expected behaviour
Code completion should be less aggressive about suggesting function definitions.
Some examples:
from torch.utils.data import Data
should suggest at the top the two items that begin withData
,DataLoader
andDataSet
from torch.utils.data import DataLoad
should suggest at the top the one item that begins with that,DataLoader
from datetime import d
should suggest closer to the top the items that begin withd
,date
anddatetime
from datetime import date
should suggest at the top the items that begin withdate
,date
anddatetime
Actual behaviour
The suggestions from Pylance autocomplete place what I think is way too high of a priority on fuzzy matches. The first few options are usually some combination of
def
,def(class method)
,def(abstract class method)
anddef(static class method)
.These suggestions in particular don't really make any sense in the context of imports—they'd all be syntax errors—but I am not sure if this problem is limited to imports.
Logs
There don't appear to be any here.
Code Snippet / Additional information
Code snippets are above. I don't know if this is a design decision or an actual bug, but it feels apparent to me that the exact matches should be listed at the top. I don't believe this has been filed before; I searched for 'autocomplete', 'completion', and 'suggestions' but didn't see a relevant issue. I apologize if it has.
Thank you for your great work on Pylance. It's incredible how well it works day-to-day. I really appreciate it.
The text was updated successfully, but these errors were encountered: