Skip to content

Proposal: add a document location to the evaluate request for the 'hover' variant. #465

@walter-erquinigo

Description

@walter-erquinigo

Problem:

An existing problem is that the 'hover' variant of the evaluate request doesn't contain enough information to distinguish between shadowed variables. Consider the following example:

std::string x = "foo"                 # line A
if(condition) {
  std::string x = "bar"               # line B
  do_something(x);                    # <- currently stopped here
}

If a hover evaluate request for the x in line B is issued, then the debugger will be able to show its correct value ("bar") because that x corresponds to the current frame. However, if the hover happens for the x in line A, the debugger will return "bar" instead of "foo", just because it doesn't know which x the request is for.

Proposed solution

Include an optional Location attribute, similar to the one used by LSP, in EvaluateArguments for hover.

The debugger might be able to easily distinguish shadowed variables using this information, as it knows the location of the declarations of each variable.

Metadata

Metadata

Labels

feature-requestRequest for new features or functionality

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions