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

1 Answer 1

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,
Sign up to request clarification or add additional context in comments.

3 Comments

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, that is weird. Did you restart the vim/neovim after :CocUninstall coc-go?
I did @Genjik, and that's, as you mentioned, super confusing. I don't know what was wrong there

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.