-
Couldn't load subscription status.
- Fork 2.4k
Description
Description
Hi there,
I stumbled upon a weird issue with gopls and how it handles / registers files outside of the configured root dir.
If a file resides outside of the root_dir (commonly files in mod cache or the standard library files found in GOROOT) using vanilla lsp configuration, I can see a started client for each directory of my current project, mod cache and GOROOT. This results in weird behavior how diagnostics are shown, false-positive messages where variables could not be found and so on:
Using the configuration at https://github.com/neovim/nvim-lspconfig/blob/7fac9025a967a4d0846660f751cd392fac6bb788/lsp/gopls.lua this is solved partially as the get_root function checks for mod cache files if there already is a client for gopls, otherwise it creates one. What is missing is the same check for std lib files. I have implemented a fix in my own configuration.
Question: does it make sense to open a PR to upstream this?