codota / tabnine-sublime

Tabnine Autocomplete AI: JavaScript, Python, TypeScript, PHP, C/C++, HTML/CSS, Go, Java, Ruby, C#, Rust, SQL, Bash, Kotlin, Julia, Lua, OCaml, Perl, Haskell, React
https://www.tabnine.com/install/sublime
MIT License
195 stars 36 forks source link

Go Semantic Completion installation failed on a Mac #17

Closed indrayam closed 5 years ago

indrayam commented 5 years ago

My machine: MacBook Pro (MacOS Sierra 10.12.6) Editor: Sublime Text (Version 3.1.1 Build 3176) TabNine: Version 1.0.5 Other information: Paid License of TabNine

I tried to run TabNine::sem. It said that the Semantic Completion was enabled. However, when I started to type my Go code, it brought a message in the suggestions drop-down that the installation failed at running this command:

go get -u github.com/sourcegraph/go-langserver

I have manually run this command on my Mac and the thing installed without any errors. Not sure where to go look for errors.

Had to revert back by running TabNine::no_sem

zxqfl commented 5 years ago

Now that the language server is installed, what happens if you type TabNine::sem again?

indrayam commented 5 years ago

This is what happened.

Screenshot 1: Screenshot 1

Screenshot 2: Screenshot 2

Just so that I am clear, while I did install the Golang server by running go get -u github.com/sourcegraph/go-langserver, I am not running this command in the background when I took the screenshot (go-langserver -mode stdio -gocodecompletion). I assumed that will be something TabNine will do behind the scenes.

zxqfl commented 5 years ago

Is go-langserver on your PATH?

indrayam commented 5 years ago

It is! Screenshot 3

zxqfl commented 5 years ago

I'm not sure what the issue is, but this will probably fix it:

  1. Find the absolute path to the language server with which go-langserver.
  2. Create a file ~/Library/Preferences/TabNine/TabNine.toml and paste the following in it:
[language.go]
command = "<the absolute path you found>"
args = ["-mode", "stdio", "-gocodecompletion"]
  1. Type TabNine::restart in your text editor.
indrayam commented 5 years ago

Yes! it works now! Is there a TabNine:: command to get a dump of the runtime configuration in effect.

Anyways, I think I am good for now! Thanks a bunch.

zxqfl commented 5 years ago

Great! There is no command, but the runtime configuration is given by ~/Library/Preferences/TabNine/ExampleTabNine.toml plus whatever changes are in ~/Library/Preferences/TabNine/TabNine.toml.