日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

sublime?text3解決Gosublime無法自動補全代碼的問題_Golang

作者:CodyGuo ? 更新時間: 2022-03-24 編程語言

版本

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" }]
?? ?},

原文鏈接:https://blog.csdn.net/CodyGuo/article/details/89199597

欄目分類
最近更新