Oni: Go completion does not appear to be implemented

Created on 26 Mar 2018  ยท  6Comments  ยท  Source: onivim/oni

I ran go get -u github.com/sourcegraph/go-langserver and go-langserver was installed in my $PATH, but Oni doesn't seem to use it. When I edit a Go file and type fmt. somewhere in a function body, no menu of completions comes up. It also doesn't come up if I hit ctrl+space. I also tried adding

    "language.go.languageServer.command": "go/bin/go-langserver",

to the

export const configuration = {

section of the Oni config, but it seems not to have made any different. Is this broken or am I doing it wrong? Also, why can't this functionality just be included in Oni?

Most helpful comment

Some advice for troubleshooting:

  1. Look at the bottom-left. Is there a rotating circle or a lighting bolt? If you see a rotating circle, the langserver isn't started properly.
  2. In case you see a rotating circle, Oni might fail to find the langserver binary indicating in your config. Is your $GOPATH/bin in you $PATH? If not, you may use absolute path
    "language.go.languageServer.command": "/ABSOLUTE/PATH/TO/go-langserver",

Or append $GOPATH/bin to environment.additionalPaths in config to include that path separately for Oni.

  1. A rotating circle can also mean that the langserver exit unexpectedly. You may wish to open devtool (hit Shift-Ctrl/Command-P and type dev enter) and check the console for error message.

Hope these would help.

All 6 comments

Some advice for troubleshooting:

  1. Look at the bottom-left. Is there a rotating circle or a lighting bolt? If you see a rotating circle, the langserver isn't started properly.
  2. In case you see a rotating circle, Oni might fail to find the langserver binary indicating in your config. Is your $GOPATH/bin in you $PATH? If not, you may use absolute path
    "language.go.languageServer.command": "/ABSOLUTE/PATH/TO/go-langserver",

Or append $GOPATH/bin to environment.additionalPaths in config to include that path separately for Oni.

  1. A rotating circle can also mean that the langserver exit unexpectedly. You may wish to open devtool (hit Shift-Ctrl/Command-P and type dev enter) and check the console for error message.

Hope these would help.

@ijt

    // language server configuration
    "language.go.languageServer.rootFiles": [".git"],
    "language.go.languageServer.command": ["go-langserver"],
    "language.go.languageServer.arguments": ["--gocodecompletion", "--freeosmemory", "false"],

You must set the --gocodecompletion parameter to enable the completion function

Added your snippet @saibing to the documentation, thanks ๐Ÿ‘

Thanks for that. I did indeed have a spinning circle before because my path
to the "language.go.languageServer.command" was wrong. So I restarted Oni
and opened a Go file, now seeing a lightning bolt. So far so good. But I
still have no indication of anything like Intellisense working in this
file. For example, I tried typing "os." and "os.E" and didn't
see any menu of completions.

On Mon, Mar 26, 2018 at 11:29 AM, Akin notifications@github.com wrote:

Added your snippet @saibing https://github.com/saibing to the
documentation, thanks ๐Ÿ‘

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/onivim/oni/issues/1928#issuecomment-376265967, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAA8qsIFPiPFvlOrmbs7l4y1M-p6t3Oaks5tiTOkgaJpZM4S6j-M
.

My bad -- I hadn't included these lines:

"language.go.languageServer.rootFiles": [".git"],

"language.go.languageServer.arguments": ["--gocodecompletion",
"--freeosmemory", "false"],

I added them and now completion works fine.

On Tue, Mar 27, 2018 at 7:13 AM, Issac Trotts issac.trotts@gmail.com
wrote:

Thanks for that. I did indeed have a spinning circle before because my
path to the "language.go.languageServer.command" was wrong. So I
restarted Oni and opened a Go file, now seeing a lightning bolt. So far so
good. But I still have no indication of anything like Intellisense working
in this file. For example, I tried typing "os." and "os.E" and
didn't see any menu of completions.

On Mon, Mar 26, 2018 at 11:29 AM, Akin notifications@github.com wrote:

Added your snippet @saibing https://github.com/saibing to the
documentation, thanks ๐Ÿ‘

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/onivim/oni/issues/1928#issuecomment-376265967, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAA8qsIFPiPFvlOrmbs7l4y1M-p6t3Oaks5tiTOkgaJpZM4S6j-M
.

Since @ijt provided the fix and stated it's working, let's close this one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

badosu picture badosu  ยท  20Comments

rektrex picture rektrex  ยท  18Comments

jordwalke picture jordwalke  ยท  25Comments

ghost picture ghost  ยท  23Comments

hkupty picture hkupty  ยท  27Comments