最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - VSCode autocomplete function *and method* parentheses (jsts) - Stack Overflow

programmeradmin0浏览0评论

This is a superset of VSCode add parentheses when autompleting functions

There is a setting in VSCode javascript: plete function calls that automatically adds in the parentheses and signature when you accept the autoplete 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) pleted, 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 autoplete 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.

Finally, here's a gif to demo the cases above:

This is all running latest VSCode with no extensions.

This is a superset of VSCode add parentheses when autompleting functions

There is a setting in VSCode javascript: plete function calls that automatically adds in the parentheses and signature when you accept the autoplete 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) pleted, 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 autoplete 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./microsoft/vscode/issues/119035

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

This is all running latest VSCode with no extensions.

Share Improve this question edited Mar 17, 2021 at 17:02 ultraGentle asked Mar 17, 2021 at 16:13 ultraGentleultraGentle 6,3472 gold badges26 silver badges58 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

Ctrl + Shift + P => Settings.json:

"typescript.suggest.pleteFunctionCalls": true,
"javascript.suggest.pleteFunctionCalls": true,

I added these to .vscode/settings.json and it worked for me:

{
  // ...
  "typescript.suggest.pleteFunctionCalls": true,
  "javascript.suggest.pleteFunctionCalls": true
  // ...
}

Type this: await page.getByText('Form Layouts'). And then press Enter at the hint. DO NOT CLICK on the hints.

发布评论

评论列表(0)

  1. 暂无评论