Skip to content

Conversation

Copy link

Copilot AI commented Dec 31, 2025

When adding a variable to watch from the hover window context menu, the watch entry displays "hover" as the variable name instead of the actual expression. Adding from the variables window works correctly.

Root Cause

run_hover() passes wrong argument order to variables.createRef():

-- Before (incorrect - evaluateName gets "hover", context gets nil)
local var = variables.createRef(res, "hover")

-- After (correct - evaluateName gets expression, context gets "hover")
local var = variables.createRef(res, expression, "hover")

Function signature is createRef(value, evaluateName, context). The bug caused evaluateName to be hardcoded as "hover" instead of using the actual variable expression.

Changes

  • extension/script/backend/worker/evaluate.lua: Fix parameter order in run_hover() to match working implementations in run_watch() and run_repl()
Original prompt

这个调试器有个bug,在断点后的hover窗口内右键一个字段点击“添加到监视”后,添加上去的变量名的第一个节点名会变成 "hover" 而不是变量自己的名字。但是在变量窗口添加监视是正常的。你能找出并修复这个bug吗?


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@sumneko
Copy link
Collaborator

sumneko commented Dec 31, 2025

@copilot 请使用中文

Fixed the bug where adding a variable to watch from hover window would incorrectly use "hover" as the variable name instead of the actual expression name. The issue was in run_hover() passing parameters in wrong order to variables.createRef().

Changed: variables.createRef(res, "hover")
To: variables.createRef(res, expression, "hover")

This now matches the correct implementation used in run_watch().

Co-authored-by: sumneko <5213431+sumneko@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix bug in hover window during add to watch action Fix "Add to Watch" from hover window using "hover" instead of variable name Dec 31, 2025
Copilot AI requested a review from sumneko December 31, 2025 09:08
Copy link
Author

Copilot AI commented Dec 31, 2025

@copilot 请使用中文

明白了。代码修改已完成(commit cfa228c)。

修复说明:

  • 问题:从悬停窗口添加监视时,变量名显示为"hover"而不是实际的变量名
  • 原因:run_hover()函数向variables.createRef()传递参数顺序错误
  • 修复:将variables.createRef(res, "hover")改为variables.createRef(res, expression, "hover")
  • 结果:现在从悬停窗口添加监视时会正确显示变量名

@sumneko sumneko requested review from actboy168 and removed request for actboy168 December 31, 2025 09:10
@sumneko sumneko marked this pull request as ready for review December 31, 2025 09:40
@sumneko sumneko requested review from actboy168 and Copilot December 31, 2025 09:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where adding a variable to watch from the hover window context menu incorrectly displayed "hover" as the variable name instead of the actual expression.

Key Change:

  • Fixed parameter order in variables.createRef() call within run_hover() to pass expression as the evaluateName parameter instead of the hardcoded string "hover"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Successfully merging this pull request may close these issues.

2 participants