3

I'm using neovim with coc.nvim and have been using vim-go and coc-go, and everything was working fine.

I have the habit of updating everything every couple of days, and I do that using the following commands:

:PlugUpgrade
:PlugUpdate
:GoUpdateBinaries
:CocUpdateSync

Recently after I did the update, the auto-completion for go files has stopped working.

Things I tried:

  • I thought there might be a conflict with coc-go, so I tried uninstalling it, but it didn't solve the issue
  • On my other computer, I opened a go file before and after running the update (without changing anything else), and auto-completion stopped working after the update
  • I tried cleaning up mod and bin directories in my GOPATH, and reinstalling everything, but still, it's not working.

When I open a go file, I see the message vim-go: initialized gopls, but I also see the following message

[coc.nvim]: Unhandled rejection: TypeError: Cannot read property 'workspaceFolders' of undefined

I thought this message is responsible for things being broken, but that's not the case: after digging a bit on the message, that message is coming from coc-go, but even when I uninstall coc-go, my auto-completion is still not working

Farzad
  • 1,770
  • 4
  • 26
  • 48

1 Answers1

2

This change helped me to fix the error -> https://github.com/josa42/coc-go/pull/89/commits/046eb6f8d2686b2317e15d58535435592b1eaa76

Find the extension.js file in coc's config folder. In my case, it is located in "$HOME/config/coc/extensions/node_modules/coc-go/lib" and replace these lines:

disableWorkspaceFolders: config.disable.workspaceFolders,
disableDiagnostics: config.disable.diagnostics,
disableCompletion: config.disable.completion,

with:

disableWorkspaceFolders: config.disableWorkspaceFolders,
disableDiagnostics: config.disableDiagnostics,
disableCompletion: config.disableCompletion,
Genjik
  • 320
  • 1
  • 7
  • 20
  • Thank you @Genjik, that seems to do the trick. Although it's confusing for me; I tried taking `coc-go` out of the question by uninstalling it, by I was still facing the issue, so I was sure it's something in `vim-go`. In fact, I was just in the process of creating an issue in there, and I thought: "OK, let me check one last time on SO to see if there's an answer"!!! – Farzad Jul 11 '20 at 03:06
  • @Farzad, that is weird. Did you restart the vim/neovim after :CocUninstall coc-go? – Genjik Jul 11 '20 at 13:23
  • I did @Genjik, and that's, as you mentioned, super confusing. I don't know what was wrong there – Farzad Jul 12 '20 at 00:02