I'm using lsp-mode as lsp client and gopls as lsp backend in order to lookup function and variable definitions in go projects.

On a given large repository (kubernetes) that I recently wiped and cloned again, I see that, when I want to lookup a definition (lsp-find-definition), emacs will stall for a few seconds and then fail:

"Timeout while waiting for response. Method: textDocument/references" – 

Is there anything I can do to fix this?

Notice that all the definition lookups worked fine before I deleted the project folder and re-crated it...

2 Answers 2


You can lengthen the timeout using the lsp-response-timeout option: https://emacs-lsp.github.io/lsp-mode/page/settings/mode/#lsp-response-timeout

Of course, what you really want to do is make gopls faster. Probably not much you can configure in Emacs to do that.


A workaround for this is to disable file watchers:

(setq lsp-enable-file-watchers nil)

... and then restart the workspace:


I'm not sure if this effectively disables a useful feature, but I can't get it to work otherwise.

The solution was described here: https://github.com/golang/go/issues/38032

More about file watchers here: https://emacs-lsp.github.io/lsp-mode/page/file-watchers/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.