VSCode 自动完成功能 * 和方法 * 括号 (js/ts) [英] VSCode autocomplete function *and method* parentheses (js/ts)
问题描述
这是VSCode 在自动完成函数时添加括号的超集>
VSCode 中有一个设置 javascript: complete function calls
当您接受 javascript 函数的自动完成建议时,它会自动添加括号和签名.(Typescript 存在等效设置.)
例如,如果您有函数 function test(a,b) {return a+b;},
并且您键入 tes
并接受建议,您将完成完整的 test(a,b)
,而不仅仅是 test
.
但是(有关演示,请参阅底部的 gif),
- 它似乎在
标签中不起作用
- 它似乎不适用于方法,例如
document.getElementById()
- 它似乎不适用于内置函数,例如
new Date()
从而限制了它的实用性.
我想知道是否有人知道扩展自动完成功能以包含这些场景的方法.
我已经打开了一个 Github 问题,以防这是一个错误,但也有可能我只是误解了一些东西.https://github.com/microsoft/vscode/issues/119035
最后,这是演示上述案例的 gif:https://gfycat.com/carefulvibrantblackbuck
这都是运行最新的 VSCode,没有扩展.
** 'Ctrl + Shift + P' =>Settings.json:**
typescript.suggest.completeFunctionCalls":真,javascript.suggest.completeFunctionCalls":真,
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),
- it appears not to work in
<script>
tags - it appears not to work for methods, e.g.
document.getElementById()
- 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.
** 'Ctrl + Shift + P' => Settings.json:**
"typescript.suggest.completeFunctionCalls": true,
"javascript.suggest.completeFunctionCalls": true,
这篇关于VSCode 自动完成功能 * 和方法 * 括号 (js/ts)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!