codex - 💡(How to fix) Fix CodeLens "Implement with Codex" link disappears in PowerShell

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

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: #
RAW_BUFFERClick to expand / collapse

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?

  1. Create a new PowerShell file codelens-repro.ps1.
  2. Paste the snippet above and save.
  3. Observe CodeLens appears above the first "# TODO".
  4. Observe CodeLens DOES NOT appear above the second "# TODO".
  5. Comment either A or B, not both, problem remains.
  6. Comment both A and B, problem resolves.
  7. 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 (').

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix CodeLens "Implement with Codex" link disappears in PowerShell