claude-code - 💡(How to fix) Fix [BUG] VS Code extension doesn't render outputs from user-prompt-submit-hook

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…

Error Message

Error Messages/Logs

Root Cause

For the contrast/control:

  • Compare against a PostToolUse hook that prints <ide_diagnostics>...</ide_diagnostics> — that one renders, because webview/index.js has an explicit <post-tool-use-hook> handler.

Code Example

- <ide_selection>, <ide_opened_file>
 - <terminal name="…">
 - <browser tabGroupId="…">, <browser_instruction>
 - <local-command-stdout>, <local-command-stderr>
 - <post-tool-use-hook> → renders extracted <ide_diagnostics> as an "ideDiagnostics" chip
 - <command-name> / <command-args>

---

Suggest that a `<user-prompt-submit-hook>` case is added to the classifier in webview/index.js mirroring the existing <post-tool-use-hook> handler

---

### What Should Happen?

The VS Code extension should render the output in the same way that the CLI does

### Error Messages/Logs

---

### Steps to Reproduce

Here's a minimal way to reproduce

 1. Add to ~/.claude/settings.json (or project .claude/settings.json):
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?

VS Code seems to ignore outputs from UserPromptSubmit hooks meaning the user is never informed if the prompt fails to pass the hook's logic.

After looking through the output codebase I can see...

The webview at webview/index.js has an explicit classifier fW (around char offset 4519700) that inspects each user-message text segment and maps it to a renderable type. It has cases for:

 - <ide_selection>, <ide_opened_file>
 - <terminal name="…">
 - <browser tabGroupId="…">, <browser_instruction>
 - <local-command-stdout>, <local-command-stderr>
 - <post-tool-use-hook> → renders extracted <ide_diagnostics> as an "ideDiagnostics" chip
 - <command-name> / <command-args>

But it doesn't have a case for

<user-prompt-submit-hook>

Suggest that a <user-prompt-submit-hook> case is added to the classifier in webview/index.js mirroring the existing <post-tool-use-hook> handler

if (Z.includes("<user-prompt-submit-hook>")) {                                                                                                                                          
  const m = Z.match(/<user-prompt-submit-hook>([\s\S]*?)<\/user-prompt-submit-hook>/);                                                                                                          if (m) return { type: "text", text: m[1].trim(), originalText: Z };
}

What Should Happen?

The VS Code extension should render the output in the same way that the CLI does

Error Messages/Logs

Steps to Reproduce

Here's a minimal way to reproduce

  1. Add to ~/.claude/settings.json (or project .claude/settings.json):
  {
    "hooks": {
      "UserPromptSubmit": [
        {
          "hooks": [
            { "type": "command", "command": "echo 'HOOK STDOUT: this should appear in chat'; echo \"fired $(date)\" >> /tmp/hook-debug.log" }
          ]
        }
      ]
    }
  }
  1. Reload the VS Code window so the extension picks up the new settings.
  2. Open the Claude Code panel and submit any prompt, e.g. say hi.
  3. Observe: - /tmp/hook-debug.log gets a new line → hook ran. - Claude's reply will acknowledge "HOOK STDOUT: ..." if you ask it to repeat what it saw → output reached the model as context. - The chat panel shows your prompt and Claude's response, but no rendering of the hook's stdout. That's the bug.

For the contrast/control:

  • Compare against a PostToolUse hook that prints <ide_diagnostics>...</ide_diagnostics> — that one renders, because webview/index.js has an explicit <post-tool-use-hook> handler.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.139

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

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 doesn't render outputs from user-prompt-submit-hook