Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: cannot set falsey options for gopls in emacs configuration #35927

Closed
nevetS opened this issue Dec 2, 2019 · 4 comments
Closed

x/tools/gopls: cannot set falsey options for gopls in emacs configuration #35927

nevetS opened this issue Dec 2, 2019 · 4 comments
Labels
Milestone

Comments

@nevetS
Copy link

@nevetS nevetS commented Dec 2, 2019

What version of Go are you using (go version)?

go version go1.13.3 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/steve/.cache/go-build"
GOENV="/home/steve/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/steve/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build937410234=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I'm using golang with emacs, per the instructions here: https://github.com/golang/tools/blob/master/gopls/doc/emacs.md

The instructions spell out:

Experimental settings can be configured via lsp-register-custom-settings:

(lsp-register-custom-settings
 '(("gopls.completeUnimported" t t)
  ("gopls.staticcheck" t t)))

emacs-lisp does not provide a "false" for boolean. It is typically represented as nil.

With the following in my config, I receive a warning:

("gopls.completeUnimported" nil nil)

The warning is: LSP :: Invalid type for bool option "completeUnimported"

What did you expect to see?

I expect to see no warning.

What did you see instead?

LSP :: Invalid type for bool option "completeUnimported"

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Dec 2, 2019

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@gopherbot gopherbot added the gopls label Dec 2, 2019
@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Dec 2, 2019

Can you share the gopls logs for this? How does lsp-mode send other requests that contain boolean values?

/cc @muirdm for Emacs expertise

@stamblerre stamblerre changed the title Cannot set falsey options for LSP/gopls in emacs configuration x/tools/gopls: cannot set falsey options for gopls in emacs configuration Dec 2, 2019
@gopherbot gopherbot added this to the Unreleased milestone Dec 2, 2019
@gopherbot gopherbot added the Tools label Dec 2, 2019
@muirdm

This comment has been minimized.

Copy link

@muirdm muirdm commented Dec 2, 2019

I think you want ("gopls.completeUnimported" nil t)

The third element should be t for all boolean options.

(lsp-register-custom-settings PROPS)

Register PROPS.
PROPS is list of triple (path value boolean?) where PATH is the
path to the property, VALUE is either a literal value or symbol
used to retrieve the value, and BOOLEAN? is an optional flag that
should be non-nil for boolean settings.
@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Dec 2, 2019

Thanks for clarifying, @muirdm! Closing this issue.

@stamblerre stamblerre closed this Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.