Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Golang Autocompletion #538

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion plugins/c9.ide.language.go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ for an overview of the APIs and techniques used in this plugin.
This plugin is still marked "experimental". To use it in Cloud9,
please go to Cloud9 > Preferences > Experimental > Go Code Completion.

Make sure that go and gocode are installed on your path
- sudo apt install go
- sudo apt install gocode

## License

MIT
MIT

10 changes: 5 additions & 5 deletions plugins/c9.ide.language.go/worker/go_completer.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ handler.complete = function(doc, fullAst, pos, options, callback) {

var start = Date.now();
workerUtil.execAnalysis(
"bash", // TODO: don't use bash here, better GOPATH handling
"bash", // TODO: don't use bash here
{
args: [
"-c",
"GOPATH=$HOME/.c9/gocode:$GOPATH ~/.c9/gocode/bin/gocode -f=json autocomplete " + getOffset(doc, pos)
"gocode -f=json autocomplete " + getOffset(doc, pos)
],
mode: "stdin",
json: true,
Expand Down Expand Up @@ -158,8 +158,8 @@ function ensureDaemon(callback) {
"bash",
{
args: [
// TODO: cleanup install procedure
"-c", "mkdir -p ~/.c9/gocode; GOPATH=$HOME/.c9/gocode go get -u github.com/nsf/gocode && ~/.c9/gocode/bin/gocode"
// TODO: install procedure
"-c", "gocode"
]
},
function(err, child) {
Expand All @@ -185,7 +185,7 @@ function ensureDaemon(callback) {
if (err) {
daemon.err = err;
if (err.code !== "ELOADING")
workerUtil.showError("Could not setup or start Go completion daemon. Please reload to try again.");
workerUtil.showError("Could not setup or start Go completion daemon. Make sure go and gocode are installed on your path, and reload to try again.");
return callback(err);
}
callback();
Expand Down