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

syntax error highlighting not working #3473

Closed
sding3 opened this issue Dec 12, 2022 · 2 comments
Closed

syntax error highlighting not working #3473

sding3 opened this issue Dec 12, 2022 · 2 comments

Comments

@sding3
Copy link

sding3 commented Dec 12, 2022

What did you do? (required: The issue will be closed when not provided)

Introduce syntax error:

package main

func main() {
    syntaxerror = 123 
}

What did you expect to happen?

Syntax error get highlighted.

What happened instead?

Syntax error did not get highlighted.

Debug output:

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/test.go","version":24,"diagnostics":[{"range":{"start":{"line":2,"character":5},"end":{"line":2,"character":9}},"severity":1,"code":"DuplicateDecl","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#DuplicateDecl"},"source":"compiler","message":"main redeclared in this block","relatedInformation":[{"location":{"uri":"file:///tmp/foo.go","range":{"start":{"line":4,"character":5},"end":{"line":4,"character":9}}},"message":"other declaration of main"}]},{"range":{"start":{"line":3,"character":1},"end":{"line":3,"character":12}},"severity":1,"code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredName"},"source":"compiler","message":"undeclared name: syntaxerror"}]}}

Also I get errors when trying to GoUpdateBinaries. I don't know if this is related. The error is:

vim-go: Error installing golang.org/x/tools/gopls@latest: golang.org/x/exp/constraints
vim-go: golang.org/x/exp/maps
vim-go: # golang.org/x/exp/constraints
vim-go: /home/shang/go/pkg/mod/golang.org/x/[email protected]/constraints/constraints.go:13:2: embedding interface 
element ~int|~int8|~int16|~int32|~int64 requires go1.18 or later (-lang was set to go1.16; check go.mod)
vim-go: /home/shang/go/pkg/mod/golang.org/x/[email protected]/constraints/constraints.go:20:2: embedding interface 
<...truncated...>

Configuration (MUST fill this out):

Default

vim-go version:

v1.26

vimrc you used to reproduce:

vimrc
let g:go_fmt_command = "goimports"
let g:go_debug=['lsp']

Vim version (first three lines from :version):

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar 30 2022 23:54:07)
Included patches: 1-4651
Compiled by Arch Linux

Go version (go version):

go version go1.19.3 linux/amd64

Go environment

go env Output:
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/shang/.cache/go-build"
GOENV="/home/shang/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/shang/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/shang/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"
GOVCS=""
GOVERSION="go1.19.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build109430886=/tmp/go-build -gno-record-gcc-switches"

gopls version

gopls version Output:
golang.org/x/tools/gopls v0.10.1
    golang.org/x/tools/[email protected] h1:JoHe17pdZ8Vsa24/GUO8iTVTKPh0EOBiWpPop7XJybI=

@bhcleek
Copy link
Collaborator

bhcleek commented Dec 12, 2022

See :help g:go_diagnostics_level.

The error you're seeing on : GoUpdateBinaries is unrelated. To deal with that, see #3446 and #3449. If you'll update to the latest master revision of vim-go, you will be able to update the tools.

@sding3
Copy link
Author

sding3 commented Dec 12, 2022

Great - thanks for the help!

@sding3 sding3 closed this as completed Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants