ホームページ  >  記事  >  開発ツール  >  Gosublime が sublime text でコードを自動補完できない問題の解決方法3

Gosublime が sublime text でコードを自動補完できない問題の解決方法3

藏色散人
藏色散人転載
2019-11-25 13:36:225305ブラウズ

次のコラム sublime チュートリアル では、Gosublime がコードを自動的に完成できないという問題を、sublime text3 がどのように解決するかを紹介します。

Gosublime が sublime text でコードを自動補完できない問題の解決方法3

sublime text3 は、Gosublime がコードを自動的に完成できないという問題を解決します

version

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

Gosublime をインストール

環境設定を開き、パッケージを参照…、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 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" }]
},

以上がGosublime が sublime text でコードを自動補完できない問題の解決方法3の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事はcsdn.netで複製されています。侵害がある場合は、admin@php.cn までご連絡ください。