这篇文章主要介绍了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无法自动补全代码的问题内容对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,遇到问题就找亿速云,详细的解决方法等着你来学习!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。