trAn
trAn

Reputation: 13

python extension for vs code

I have a problem with python autocomplete in visual studio code. The only way I can trigger the autocomplete function is with the Tab or Enter key. Brackets and dot does not have any effect (or better it just hides the suggestion box and puts the bracket in place on the unfinished word e.g. -> typing pr in the editor would display the suggestion box with print as the first choice, if i then press bracket i end up with pr() instead of print()) I presume there should be some settings so autocomplete would act "normally" but I can't find it.

Upvotes: 1

Views: 170

Answers (3)

JialeDu
JialeDu

Reputation: 9737

This is set by the shortcut key. Open the Default Keyboard Shortcuts (File > Preferences > Keyboard Shortcuts) and search for "acceptSelectedSuggestion". You will see that there are only two settings by default, the Tab and Enter keys.

enter image description here

If you want to add other buttons to trigger typing intellisense, right-click on one of the settings and select Add Keybinding,

enter image description here

then press the button you want to set, and press Enter to save.

Upvotes: 1

OneCricketeer
OneCricketeer

Reputation: 191743

Tab or enter is required to actually make a selection. Otherwise, you could have custom function printStuff, and typing pr( would not necessarily pick the right one.

From what I can tell, PyCharm works the exact same way, so unclear what "acts normal" means in this context.

Upvotes: 0

Metalgear
Metalgear

Reputation: 3457

I think you don't need to use the python autocomplete extension. You can just use the Python extension.

Upvotes: 0

Related Questions