Home  >  Article  >  Development Tools  >  How to solve the problem that Gosublime cannot automatically complete the code in sublime text3

How to solve the problem that Gosublime cannot automatically complete the code in sublime text3

藏色散人
藏色散人forward
2019-11-25 13:36:225320browse

The following column sublime tutorial will share with you how sublime text3 solves the problem that Gosublime cannot automatically complete the code. I hope it will be helpful to friends in need!

How to solve the problem that Gosublime cannot automatically complete the code in sublime text3

sublime text3 solves the problem that Gosublime cannot automatically complete the code

version

Sublime Text3.2.1
go version go1.12.1 darwin/amd64
Gosublime 18.11.28

Install Gosublime

Open Perferences–Browse Packages…, enter Gosublime, enter in the command line:

git clone https://github.com/DisposaBoy/GoSublime.git

Auto-complete solution

Using sublime text3 on windows and mac cannot even install the Gosublime plug-in. Automatically complete the code and found the following solution after many days of research.

Open Perferences–Browse Packages… and enter Gosublime:

1. Create the margo directory under the src directory;

2. Copy src/margo.sh/extension-example /extension-example.go file to the margo directory;

3. Copy the margo folder (all files and directories) to the src/margo.sh/vendor directory;

4. Re- Open sublime text3 and wait a few minutes for the code to be automatically completed.

Gosublime configuration

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 qshow help

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

The above is the detailed content of How to solve the problem that Gosublime cannot automatically complete the code in sublime text3. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete