Repository navigation
Description
This is more of a quality of life enchancement request. I believe the current Intellisense suggestions during python import statements could be improved.
Basically, my problem is during import ... as ... statements and similar. Taking specifically:
import numpy as np
The suggestions are understandably not helpful since Intellisense can't predict I will call it np or whatever I want to call it. However, it gives me suggestions such as NotImplementedError, presumeably because it contains an N and p. This happens with other packages too (i.e import pandas as pd).
The problem is that right after I type np, I want to click Return, which instead of going to the next line accepts the IntelliSense suggestion. I have to do something like click on the right arrow or first do a space to get out of IntelliSense if I want to go to the next line.
Unfortunately, suggestions to prevent that seem very broad. On StackOverflow the answer was to turn of snippet suggestions, but I think that was just for a specific question and wouldn't solve everything, since their import tensorflow as tf was getting IntelliSensed as a try/except block.
So I was wondering if it's possible for the autocomplete to be modified to not make those suggestions anymore. It seems unlikely that IntelliSense will be able to predict what a module reference will be called by a particular user.
Environment data
- VS Code version: 1.24.0
- Extension version (available under the Extensions sidebar): 2108.5.0
- OS and version: Ubuntu 14.04 and 16.10
- Python version (& distribution if applicable, e.g. Anaconda): 3.6.4
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
- Relevant/affected Python packages and their versions: XXX
Actual behavior
import numpy as np
just after typing it suggests replacing np with NotImplementedError (this is just a specific example), not letting me Enter to the next line.
Expected behavior
On the import module as ... statement, I think IntelliSense shouldn't try to predict what the module will be renamed as.
Steps to reproduce:
Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
XXX
Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)
XXX
Activity
MikhailArkhipov commentedon Jun 20, 2018
M S (@mar-ses) - is this Jedi or Python language server?
brettcannon commentedon Jun 20, 2018
Mikhail Arkhipov (@MikhailArkhipov) I tried it with the language server and it still had some completion attempts, but not as extensive as Jedi.
MikhailArkhipov commentedon Jun 20, 2018
May relate to microsoft/PTVS#4359
jkyeung commentedon Jul 27, 2018
M S (@mar-ses) - The more general problem you are describing is that (by default) autocomplete doesn't let you just press Enter without accepting the highlighted suggestion. Which means any time you are trying to create ANY new name that has some letter in common with some existing name, you can't do it cleanly (you have to hit stupid other keys to make the suggestions go away). In my opinion, this is ridiculously intrusive, to the point of being unacceptable.
Fortunately, it really is just a setting. Use
"editor.acceptSuggestionOnEnter": "off"to let Enter be just-plain-Enter again. Of course, if you do this, you must accept that actually accepting any suggestion requires you to press Tab, which I think is much better anyway.ahmedhamdy2121 commentedon Aug 1, 2018
brettcannon commentedon Aug 2, 2018
CoreyCole commentedon Sep 11, 2018
jkyeung hitting escape is how I get around this. It's become a habit to hit escape before pressing enter if there are completions suggested. I also hit escape if I want to see the code the suggestion is blocking.
Btw I've rebound escape to caps lock so this is even easier 😄
Also, you can disable Enter as the key bind to select a suggestion: https://stackoverflow.com/questions/48099898/vs-code-how-to-make-intellisense-activate-with-ctrlspace-but-still-allow-quick
luabud commentedon Sep 11, 2019
Since VS Code provides a setting for this, we're closing this issue.