在VS Code中调试时如何求值表达式?

问题描述 投票:3回答:1

[enter image description here我正在使用vscode构建我的golang gin项目。

我去调试mod,无法执行表达式。

我想走几行并进行评估,以了解该monent中发生了什么。

像日食ctrl + shift + i或想法ctrl + alt + f8

快速评估表达式。

我也看到这个

Eclipse inspection (Ctrl + Shift + I) equivalent in IntelliJ IDEA (Community Edition)

Watch window or evaluate expressions while debugging in VS Code?

func main(){

router := gin.Default()
router.GET("/user/:name", func(c *gin.Context) {
    name := c.Param("name")
    c.String(http.StatusOK, name, 1, 2, 3, 4)

})

当调试器名称为:= c.Param(“ name”)]时>

我尝试使用vscode窗口的底部,当我在命令中键入此代码时,它将返回

但是如果我输入name,它将为我返回正确的字符串。

无法评估表达式:{“ Expr”:“ c.Param(\” name \“)”,

“范围”:{

“ goroutineID”:34,

“帧”:1},

“ Cfg”:{

“ followPointers”:是,

“ maxVariableRecurse”:1,

“ maxStringLen”:64,

“ maxArrayValues”:64,

“ maxStructFields”:-1}}

Eval错误:不使用'call'不允许进行函数调用>

我正在使用vscode构建我的golang杜松子酒项目。我去调试mod,无法对表达式求值。我想进行一些评估,以查看该monent中发生了什么。就像日食...

go visual-studio-code evaluate
1个回答
0
投票

目前无法实现,因为最近才将更复杂的评估添加到Delve调试器中。您可能需要关注以下两个Github问题:

Add ability to safely call functions #119

© www.soinside.com 2019 - 2024. All rights reserved.