Hello.
Is there a way of querying gopls to see the configs it is using currently? I can read the defaults on the docs, but I want to see what my editor LSP is using.
From Gemini, I got this:
Open a Go file.
:checkhealth vim.lsp
From that command, take the ID of the LSP client.
:lua local file = io.open("/tmp/gopls_client_config.txt", "w"); if file then file:write(vim.inspect(vim.lsp.get_client_by_id(YOUR_GOPLS_ID))); file:close() end
But there it only shows my custom config, if any.
Or is there a repo somebody made where they test each of the items on
https://go.dev/gopls/settings
I do not mind a guide from another editor.
Here is a little test I made to demonstrate what I mean with the default nvim-lspconfig
package main
import "fmt"
func bar(name string) string {
if name == "error" {
return "the name is error"
}
return name
}
func foo(name string) error {
if name == "error" {
return fmt.Errorf(name)
}
return nil
}
func fooBar(name string) (string, error) {
if name == "error" {
return "", fmt.Errorf(name)
}
return name, nil
}
func main() {
// All good here
name := "Chris"
fmt.Printf("bar(%s): '%s'\n", name, bar(name))
name = "Johnny"
fmt.Printf("foo(%s): '%v'\n", name, foo(name))
name = "error"
r1, err := fooBar(name)
fmt.Printf("fooBar(%s): '%s', '%v'\n", name, r1, err)
// I expect warning from the following, but got nothing
bar(name)
foo(name)
fooBar(name)
// The LSP gives a warning "unusedresult" on the following
fmt.Errorf(name)
}
Thank you for the help.