microsoft / microsoft/vscode-js-debug
Completions fail when the completed name matches a variable in the enumeration template
@connor4312 is already working on this.
Since Aug 25, 2026.
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 373
- Avg merge
- 1d 9m
- Merged PRs (30d)
- 6
Description
Problem
Completing properties on a primitive (target., 'abc'., 42.) while paused evaluates enumerateProperties as a string on the call frame using template. Code that will be evaluated is constructed on line 351.
The template binds the user expression to its own parameters:
(() => {
let target = (target);
let prefix = "";
let isGlobal = false;
// ... enumerate properties of `target`
})()
If the name being completed is also a parameter or local in that template (target, prefix, isGlobal, or a minified name like n), the inner target refers to the template binding instead of the user variable. Evaluation throws and completions are empty.
This does not affect objects: they are enumerated with Runtime.callFunctionOn on an objectId, so the helper never runs as source in the call frame.
In the currently released version, the following completion won't work because of described error (minified extension sources contain variable named n):
let n = 1
debugger
// n.
Proposed fix
The first evaluate already returned the primitive. Interpolate that value into the template (let target = 1) and run it with Runtime.evaluate (no call frame). The template no longer reads locals, so names cannot clash.
VS Code Version: 1.134.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.