CodeLens "Implement with Codex" link disappears in PowerShell
Open 💬 0 comments Opened May 26, 2026 by 7ranceaddic7
What version of the IDE extension are you using?
Version 26.5519.32039
What subscription do you have?
none
Which IDE are you using?
VS Code 1.121.0 f6cfa2ea2403534de03f069bdf160d06451ed282 x64
What platform is your computer?
Microsoft Windows NT 10.0.26300.0 x64
What issue are you seeing?
The "Implement with Codex" link disappears in PowerShell when a line contains a string ending with \. Usually, in a .ps1 file, the Codex CodeLens ("Implement with Codex") link appears above # TODO comments as expected until the code line contains a backslash (\) towards the end of the line.
The offending backslash (\) seems to poison the scanner causing links which should occur to fail to render for all subsequent TODOs.
ln10: # commented text goes here
Implement with Codex ( link rendered "between" codelines )
ln11: # TODO <= this should show a "Implement with Codex" CodeLens link
ln12: #
A) presence of the trailing `\` in string line breaks CodeLens
$pattern = $pattern.Replace('/', '\')
B) again presence of `\` breaks CodeLens link
foreach ($name in @('node_modules')) { "\$name\" | Out-Null }
C) does NOT break Codelens link
ForEach-Object { "\\" + $_.Replace('/', '\\') }
ln10: # commented text goes here
Implement with Codex ( link rendered "between" codelines )
ln11: # TODO <= this should show a "Implement with Codex" CodeLens link
ln12: #
What steps can reproduce the bug?
- Create a new PowerShell file codelens-repro.ps1.
- Paste the snippet above and save.
- Observe CodeLens appears above the first "# TODO".
- Observe CodeLens DOES NOT appear above the second "# TODO".
- Comment either A or B, not both, problem remains.
- Comment both A and B, problem resolves.
- State of C has no effect.
What is the expected behavior?
The "Implement with Codex" CodeLens link should continue to render above TODO comments regardless any given character sequence of code.
Additional information
- editor.codeLens is enabled (true).
- No PowerShell language override disabling CodeLens.
- This appears to be triggered specifically by a back-slash (
\) at the end of a quoted string literal and before the closing quote (').