claude-code - 💡(How to fix) Fix [BUG] VS Code extension: active file context not injected when submitting a slash command [1 comments, 2 participants]

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…
GitHub stats
anthropics/claude-code#51839Fetched 2026-04-23 07:43:34
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Error Message

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

The active file context (ide_opened_file) is not injected into the conversation when a message is a slash command (e.g. /code-review), even after switching to a file in the editor. Claude has no way to know which file is open.

What Should Happen?

The currently open file should be passed as context regardless of whether the message is a slash command or regular typed text.

Error Messages/Logs

Steps to Reproduce

  1. Open a file in VS Code
  2. In the Claude Code panel, submit a slash command without any additional text
  3. Claude does not receive the active file context

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

VS Code extension v2.1.116

Platform

Other

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

File context is correctly injected when the same message includes typed text alongside the slash command. The issue is specific to messages that are slash commands only.

extent analysis

TL;DR

The issue can be addressed by modifying the code to inject the active file context into the conversation for slash commands without additional text.

Guidance

  • Verify that the ide_opened_file context is being updated correctly when a file is opened in the editor.
  • Check the code that handles slash commands to ensure it is not overriding the file context.
  • Investigate the difference in behavior between slash commands with and without additional text to identify the root cause.
  • Consider adding a conditional statement to inject the file context for slash commands without text.

Example

No code example is provided as the issue does not include specific code snippets.

Notes

The issue seems to be specific to the VS Code extension and the Sonnet model. The fact that file context is correctly injected when typed text is included alongside the slash command suggests that the issue is related to the handling of slash commands without text.

Recommendation

Apply a workaround to modify the code to handle slash commands without text, as the root cause is likely related to the specific implementation of the VS Code extension.

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

claude-code - 💡(How to fix) Fix [BUG] VS Code extension: active file context not injected when submitting a slash command [1 comments, 2 participants]