使用Visual Studio Code时我注意到当我从autocomlete编写函数时,它从不用括号自动调用。例如:
FMT。 //现在选择一个函数Print(a … interface {})…
在您的VSCode设置(JSON)中添加以下行;
"go.useCodeSnippetsOnFunctionSuggest": true
或者,如果您将首选项/设置视为UI版本,请搜索 useCodeSnippetsOnFunctionSuggest 并将其设置为true。这将
useCodeSnippetsOnFunctionSuggest
还有设置 go.useCodeSnippetsOnFunctionSuggestWithoutType 它做同样的事情,但省略了变量类型。
go.useCodeSnippetsOnFunctionSuggestWithoutType
您需要安装Visual Studio代码(Microsoft维护)Go扩展 可以在这里找到。