claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Phpstorm plugin 0.1.13 - ClaudeFilePathFilter crashes on Windows due to invalid path characters and breaks terminal selection highlight

Open spreagit opened this issue 2 months ago • 3 comments

Preflight Checklist

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

What's Wrong?

[Bug] ClaudeFilePathFilter crashes on Windows and breaks terminal selection highlight

Plugin version: 0.1.13-beta
IDE: PhpStorm 2025.2.5 (also affects other JetBrains IDEs)
OS: Windows 10/11


What's Wrong?

There are two issues in ClaudeFilePathFilter:

Issue 1: Plugin crashes on Windows

The ClaudeFilePathFilter crashes when terminal output contains characters that are illegal for Windows file paths (:, >, <, |, ", ?, *). This happens because Path.resolve(filePath) is called in findMatches$lambda$2() without validating that the matched string contains only valid path characters.

Common triggers:

  • URLs in terminal output (e.g., PowerShell upgrade notice containing https://aka.ms/PSWindows)
  • Claude Code autocomplete suggestions prefixed with > (e.g., > @filename.php)

Issue 2: Selection highlight broken on file autocomplete

When using the @ file completion feature, suggested file paths are rendered as hyperlinks by ClaudeFilePathFilter. This hyperlink styling (blue, underlined) overrides the terminal's native selection highlight, making it impossible to see which file is currently selected when navigating with arrow keys.

Folders highlight correctly because they don't match the FILE_PATH_PATTERN regex, but files with extensions do match and lose their selection visibility.


What Should Happen?

What Should Happen?

Issue 1:

The plugin should gracefully handle strings containing invalid path characters instead of crashing. Either:

  • Validate the string before calling Path.resolve() and skip invalid paths
  • Wrap Path.resolve() in a try-catch block for InvalidPathException

Issue 2:

Autocomplete suggestions (indented lines starting with spaces) should not be converted to hyperlinks. This would preserve the terminal's native selection highlight while still providing clickable hyperlinks for actual Claude Code output like Read(file.php).


Error Messages/Logs

.## Error Messages/Logs

### Issue 1 - Crash with URL:

com.intellij.execution.filters.CompositeFilter$ApplyFilterException: Error while applying 
com.anthropic.code.plugin.terminal.ClaudeFilePathFilter@7c859c0b to 
'Installa la versione più recente di PowerShell per nuove funzionalità e miglioramenti. https://aka.ms/PSWindows'

Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 5: https://aka.ms/PSWindows
    at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:199)
    at java.base/java.nio.file.Path.resolve(Path.java:516)
    at com.anthropic.code.plugin.terminal.ClaudeFilePathFilter.findMatches$lambda$2(ClaudeConsoleFilterProvider.kt:118)

Steps to Reproduce

Steps to Reproduce

Issue 1 - Crash:

  1. Install Claude Code JetBrains plugin 0.1.13-beta on Windows
  2. Open Claude Code in the JetBrains terminal
  3. Trigger any terminal output containing :, >, <, |, ", ?, or * characters
    • Example: Use PowerShell 5.1 which displays upgrade notice with URL https://aka.ms/PSWindows
    • Example: Type @ to trigger file autocomplete, suggestions may include > prefix
  4. Result: Plugin throws InvalidPathException and crashes

Issue 2 - Selection highlight:

  1. Open Claude Code in JetBrains terminal
  2. Type @ followed by part of a filename (e.g., @insolv)
  3. File suggestions appear as blue hyperlinks
  4. Press arrow keys (↑↓) to navigate the suggestions
  5. Result: No visible selection highlight on file suggestions; user cannot see which item is selected
  6. Note: Folder suggestions highlight correctly; only files with extensions are affected

Claude Model

Not sure / Multiple models

Is this a regression?

Yes, this worked in a previous version

Last Working Version

0.1.12

Claude Code Version

2.0.58

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Suggested Fix

For Issue 1:

In findMatches$lambda$2(), add validation before Path.resolve():

val filePath = pathGroup.value

// Skip strings with invalid Windows path characters
if (filePath.contains(":") || filePath.contains(">") || filePath.contains("<") ||
    filePath.contains("|") || filePath.contains("\"") || filePath.contains("?") ||
    filePath.contains("*")) {
    return null
}

For Issue 2:

In applyFilter(), skip indented lines:

// Don't create hyperlinks for autocomplete suggestions (indented lines)
if (line.startsWith(" ") || line.startsWith("\t")) {
    return null
}

spreagit avatar Dec 04 '25 05:12 spreagit

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/13016
  2. https://github.com/anthropics/claude-code/issues/12900

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Dec 04 '25 05:12 github-actions[bot]

I am experiencing the same issue.

burtonrhodes avatar Dec 04 '25 17:12 burtonrhodes

I am experiencing the same issue.

if u want fixed plugin contact me on telegram @cayambu87 otherwise use previous version :-)

spreagit avatar Dec 04 '25 17:12 spreagit