在使用 Visual Studio Code 時,我注意到當我從 autocomlete 編寫函數時,它永遠不會使用括號自動完成。例如:fmt. //now select a function Print(a ...interface{}) from autocomplete
fmt.Print //why the parenthesehas have not been inserted automaticaly?它在 VS 代碼中總是如此,還是與 VS 代碼的 golang 設置有某種關系?有沒有辦法解決這個問題?
1 回答

GCT1015
TA貢獻1827條經驗 獲得超4個贊
在您的 VSCode 設置 (JSON) 中添加以下行;
"go.useCodeSnippetsOnFunctionSuggest": true
或者,如果您正在查看您的首選項/設置作為 UI 版本,請搜索useCodeSnippetsOnFunctionSuggest
并將其設置為 true。這會
在函數名稱的尾部添加括號。
帶有參數簽名的完整函數建議,包括變量類型。
還有go.useCodeSnippetsOnFunctionSuggestWithoutType
which的設置也是一樣的,只是省略了變量類型。
您需要安裝 Visual Studio Code(Google Go 團隊維護)Go 擴展
- 1 回答
- 0 關注
- 192 瀏覽
添加回答
舉報
0/150
提交
取消