简体   繁体   中英

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 eg -> 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.

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.

在此处输入图像描述

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

在此处输入图像描述

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM