4

This is a superset of VSCode add parentheses when automcompleting functions

There is a setting in VSCode javascript: complete function calls that automatically adds in the parentheses and signature when you accept the autocomplete suggestion for a javascript function. (The equivalent setting exists for Typescript.)

For example, if you have the function function test(a,b) {return a+b;}, and you type tes and accept the suggestion, you'll get the full test(a,b) completed, not just test.

However (see gif at bottom for demos),

  1. it appears not to work in <script> tags
  2. it appears not to work for methods, e.g. document.getElementById()
  3. it appears not to work for built-ins, like new Date()

thus restricting its usefulness.

I'm wondering if anyone is aware of a way to extend the autocomplete functionality to include these scenarios.

I've opened a Github issue, in case this is a bug, but it's also possible I'm just misunderstand something. https://github.com/microsoft/vscode/issues/119035

Finally, here's a gif to demo the cases above: https://gfycat.com/carefulvibrantblackbuck

This is all running latest VSCode with no extensions.

ultraGentle
  • 5,084
  • 1
  • 19
  • 45

1 Answers1

8

** 'Ctrl + Shift + P' => Settings.json:**

"typescript.suggest.completeFunctionCalls": true,
"javascript.suggest.completeFunctionCalls": true,
HungNM2
  • 3,101
  • 1
  • 30
  • 21