Skip to content

Multiline block comments are rendered improperly in hover documentation #3881

@angrinord

Description

@angrinord

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    • go version go1.23.3 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.

Tools Configuration

Environment

GOBIN: undefined
toolsGopath:
gopath: [PRIVATE PATH]
GOROOT: [PRIVATE PATH]
PATH: [PRIVATE PATH]
PATH (vscode launched with): [PRIVATE PATH]

Tools

go: [PRIVATE PATH]: go version go1.23.3 linux/amd64

gopls: [PRIVATE PATH]/go/bin/gopls (version: v0.20.0 built with go: go1.24.6)
gotests: not installed
impl: not installed
goplay: not installed
dlv: [PRIVATE PATH]/go/bin/dlv (version: v1.25.0 built with go: go1.23.3)
staticcheck: [PRIVATE PATH]/go/bin/staticcheck (version: v0.6.1 built with go: go1.23.3)

Go env

Workspace Folder ([USER]): [PRIVATE PATH]

GO111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE=[PRIVATE PATH]
GOENV=[PRIVATE PATH]
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE=[PRIVATE PATH]
GONOPROXY='[PRIVATE GITLAB]'
GONOSUMDB='[PRIVATE GITLAB]'
GOOS='linux'
GOPATH=[PRIVATE PATH]
GOPRIVATE='[PRIVATE GITLAB]'
GOPROXY='https://proxy.golang.org,direct'
GOROOT=[PRIVATE PATH]
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR=[PRIVATE PATH]
GOVCS=''
GOVERSION='go1.23.3'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR=[PRIVATE PATH]
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD=[PRIVATE PATH]
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=[PRIVATE PATH] -gno-record-gcc-switches'

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

Describe the bug

When hovering over functions, params, etc. annotated with multiline block comments, the tabs inserted by gofmt are incorrectly displayed as part of the comment. If the initial space after '/*' is removed, the tabs seem to be ignored correctly, but then the first line of the comment has a different font and color than the rest of the comment in the hover documentation.

Steps to reproduce the behavior:

  1. Create a function or variable within an indented block of code.
  2. Add a block comment containing at least 2 non-empty lines.
  3. Hover over variable/function name in vs-code.

Screenshots or recordings

Image Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions