问题
Is is possible to tweak VSCode so that when function gets autocompleted it is written with ()
instead of just plain function name?
For example when I type str
and autocomplete to strlen
I would like to get strlen()
, it saves quite some time.
回答1:
It can be solved by ticking javascript.suggest.completeFunctionCalls
property up. Run code snippet to see the gif.
<div style='position:relative; padding-bottom:calc(40.34% + 44px)'><iframe src='https://gfycat.com/ifr/CleverActualHornbill' frameborder='0' scrolling='no' width='100%' height='100%' style='position:absolute;top:0;left:0;' allowfullscreen></iframe></div>
回答2:
Some language extensions allow using (
as a so-called "commit character" to trigger the insertion of a completion item. This works in at least TypeScript, JavaScript and Haxe.
If "editor.autoClosingBrackets"
has not been disabled, this will also auto-insert the closing )
.
If it doesn't work for a particular language extension, perhaps consider opening a feature request on the repository in question.
回答3:
It's possible. You can create your own snippets, and it will be shown in the intellisense: User Defined snippets. You can also use snippet-creator extension for comfort.
回答4:
For Python when using the Python extension the relevant setting is:
python.autocomplete.addBrackets
来源:https://stackoverflow.com/questions/55533379/vscode-add-parentheses-when-automcompleting-functions