Skip to content

Variable popup on debugging doesn't show value #2873

Open
@nachograffione

Description

@nachograffione

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.19.1 windows/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • golang.org/x/tools/gopls v0.12.4
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.80.1
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.39.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
    • GOROOT: C:\Program Files\Go

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.

{
"go.formatTool": "gofmt",
  "[go]": {
    "editor.insertSpaces": false,
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.organizeImports": true
    },
    "editor.suggest.snippetsPreventQuickSuggestions": false,
    "editor.defaultFormatter": "golang.go"
  },
  "go.toolsManagement.autoUpdate": true,
"emeraldwalk.runonsave": {
    "commands": [
      {
        "match": "\\.go$",
        "cmd": "golines ${file} -w --base-formatter gofmt -m 80 -t 2"
      }
    ]
  }
}

Describe the bug

A clear and concise description of what the bug.
A clear and concise description of what you expected to happen.

When I'm debugging, if I hover over a struct field in my code I expect to see its value (if it has something, of course).
If I've written the dot notation expression in one line, the popup shows the value (OK).
If I've written it in multiple lines, the popup shows the field description (bug).

Steps to reproduce the behavior:

  1. Debug this code with a breakpoint in the 2nd print.
package main

import "fmt"

type StructA struct {
	StructB StructB
}

type StructB struct {
	C int
}

func main() {
	s := StructA{
		StructB: StructB{
			C: 1,
		},
	}
	fmt.Println(s.StructB.C)
	fmt.Println(s.
		StructB.C)
}
  1. Hover on StructB at the 1st print. You'll see the value. (OK)
  2. Hover on StructB at the 2nd print. You'll see the description. (bug)

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem.
image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    DebugIssues related to the debugging functionality of the extension.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.debug/variablesissues related to variables inspection/presentation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions