Home > Development Tools > sublime > 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

藏色散人
Release: 2019-11-25 13:37:12
forward
5400 people have browsed it

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
Copy after login

Install Gosublime

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

git clone https://github.com/DisposaBoy/GoSublime.git
Copy after login

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

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

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template