Open cangkuai opened 6 months ago
i can reproduce it, but only sometimes. seems to be an upstream pyright issue:
its not just import ... as
statements tho, these nonsense suggestions show up all over the place, for example:
all 3 of these suggestions would insert a syntax error
I think disabling code completion for "as" is a good temporary solution
Because this problem greatly affects the user experience
This is just normal functionality of vscode, when you trigger auto complete at any position, it will suggest random words
The identical behavior can be observed in javascript:
Can I ask, why you find the auto completions here to be unexpected and detrimental to the user experience?
I personally don't use import aliases, but it would seem reasonable to me that the IDE would provide suggestions for alias names.
Can I ask, why you find the auto completions here to be unexpected and detrimental to the user experience?
i find them extremely annoying, especially in cases where they would insert obvious syntax errors.
even if it also happens for other languages, if these stupid nonsense suggestions are coming from the language server or the vscode extension (rather than vscode itself), then i can and will get rid of them.
The identical behavior can be observed in javascript:
Can I ask, why you find the auto completions here to be unexpected and detrimental to the user experience?
I personally don't use import aliases, but it would seem reasonable to me that the IDE would provide suggestions for alias names.
Because python has many commonly used nicknames, such as numpy is called np, pandas is called pd, and matplotlib.pyplot is called plt.
Now if I want to use these nicknames, I need to complete the code automatically, delete the automatically completed characters, and then enter these nicknames
Can just type the nickname without activating the auto-complete?
After 10 minutes of trying, I found that only the space key can not trigger automatic code completion, but it will leave an extra space after the "import" line.
Even the Enter key will trigger code auto-completion
I found that if I press the right arrow/escape it will dismiss the suggestion box.
Now if I want to use these nicknames, I need to complete the code automatically, delete the automatically completed characters, and then enter these nicknames
VSCode has a command 'hideSuggestWidget' that, by default is bound to esc
. read more here: https://stackoverflow.com/a/53136645
Disable this setting and random words will not be injected into your suggestions
Additionally, all suggestions can be set to "inline" mode so that they are less intrusive:
re-opening this as there are actually plenty of invalid completions in pyright, these still appear when editor.suggest.showWords
is disabled:
related: #663