VS Code currently implements the 'Add to Watch' feature by taking the name property of the Variable and trying to combine them together. But this is not necessarily the correct name to evaluate. This is wrong for C# for root items due to our type annotations, and it can be wrong for child items any time that '.' isn't the right way to combine elements together.
Suggested fix
Variable should have a new optional property for the evaluatable name. If that property is provided, Add to Watch should use this value instead. In VS, we call this value the 'full name'. For example, if p is a local pointer in C++, and m_example is a field, the full name for this would be p->m_example.
Description of the problem.
VS Code currently implements the 'Add to Watch' feature by taking the
name
property of theVariable
and trying to combine them together. But this is not necessarily the correct name to evaluate. This is wrong for C# for root items due to our type annotations, and it can be wrong for child items any time that '.' isn't the right way to combine elements together.Suggested fix
Variable
should have a new optional property for the evaluatable name. If that property is provided, Add to Watch should use this value instead. In VS, we call this value the 'full name'. For example, ifp
is a local pointer in C++, andm_example
is a field, the full name for this would bep->m_example
.Steps to Reproduce:
dotnet new
args
and invoke 'Add to Watch'Result: VS Code will add the name of the local (
args [string[]]
) which doesn't evaluate since we needed to add our type annotation.