Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see global variables in Visual Studio Code while debugging?

While debugging Go using delve only the local variables are shown.

I can't see all the global variables.

Are there any settings change to see the list of all variablesenter image description here

Here a is not showing, even when I hover mouse over it its value is not coming.

like image 654
beaver1234 Avatar asked May 20 '26 03:05

beaver1234


1 Answers

There is a (hidden) Delve configuration setting you can add to your settings.json file that should show your Global variables; I've only tested this on a simple project with a single main.go file, I'm not sure how reliable this is for more complex projects.

Add below to your settings.json file:

{
  "go.delveConfig": {
    "showGlobalVariables": true,
  }
}

Answer found from @polinasok from their comment on vscode-go Issue #1683

like image 76
skplunkerin Avatar answered May 23 '26 02:05

skplunkerin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!