下面由sublime教學專欄給大家分享sublime text3解決Gosublime無法自動補全程式碼的方法,希望對需要的朋友有幫助!
sublime text3解決Gosublime無法自動補全程式碼
版本
Sublime Text3.2.1 go version go1.12.1 darwin/amd64 Gosublime 18.11.28
安裝Gosublime
開啟Perferences–Browse Packages…,進入Gosublime,在命令列輸入:
git clone https://github.com/DisposaBoy/GoSublime.git
自動補全解決方法
在windows和mac上使用sublime text3安裝Gosublime插件後都無法自動補全程式碼,經過多日的研究找到以下解決方法。
開啟Perferences–Browse Packages…,進入Gosublime:
#1、在src目錄下建立margo目錄;
2、拷貝src/margo.sh/extension-example /extension-example.go檔案到margo目錄下;
3、拷貝margo資料夾(所有檔案和目錄)到src/margo.sh/vendor目錄;
4、重新開啟sublime text3,稍等幾分鐘就可以自動補全程式碼了。
Gosublime設定
Perferences–Package Settings–Gosublime–Settings - User { "env": { "GOPATH": "/data", "GOROOT": "/usr/local/go", "PATH": "$GOROOT:$GOPATH:$GOROOT/bin", }, "gscomplete_enabled": true, "fmt_enabled": true, "fmt_tab_indent": false, "fmt_tab_width": 4, "autocomplete_snippets": true, "autocomplete_tests": true, "autocomplete_builtins": true, "autocomplete_closures": true, "autocomplete_suggest_imports": true, "calltips": true, "use_named_imports": true, "autoinst": true, "ipc_timeout": 1, "fmt_cmd": ["goimports"], "on_save": [ {"cmd": "gs_comp_lint"}, {"cmd": "goimports"} ], "lint_enabled": true, "linters": [ {"cmd": ["go", "run"]} ], "comp_lint_enabled": true, "comp_lint_commands": [ {"cmd": ["go", "install"]} ], }
ctrl q顯示說明
Perferences–Package Settings–Gosublime–Key Bindings - Default { "keys": ["ctrl+q"], // "keys": ["super+.", "super+h"], "command": "gs_doc", "args": {"mode": "hint"}, "context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }] },
以上是sublime text3如何解決Gosublime無法自動補全程式碼的詳細內容。更多資訊請關注PHP中文網其他相關文章!