Fix --line option rejected on PhpStorm 2026.2+ - #23
Conversation
Since PhpStorm 2026.2 (build 262), the CLI rejects --line unless a project directory is passed as the first positional argument, breaking existing phpstorm:// links (e.g. from Symfony's web debug toolbar or GitHub file links). Resolve the project root from the target file's git repository and pass it before --line.
|
And i wondered why it suddenly broke for me |
|
Confirming the breakage on PS-262.8665.325, and that a first positional argument makes The underlying rule looks broader than "
That is my one reservation about Walking up for the nearest project=""
dir=$(cd "$(dirname "${file}")" 2>/dev/null && pwd)
d="${dir}"
while [ -n "${d}" ] && [ "${d}" != "/" ]; do
if [ -d "${d}/.idea" ]; then
project="${d}"
break
fi
d=$(dirname "${d}")
done
if [ -z "${project}" ] && [ -n "${dir}" ]; then
project=$(cd "${dir}" && git rev-parse --show-toplevel 2>/dev/null)
fi
if [ -n "${project}" ]; then
/usr/bin/env phpstorm "${project}" --line "${line}" "${file}"
else
/usr/bin/env phpstorm "${file}"
fiEverything above is from PS-262.8665.325 on Linux. I have no older build installed, so I cannot say when the parsing changed. Happy to send this as a patch on top if it is useful. |
Summary
--lineis now only accepted when a project directory is passed as the first positional argument; without it, PhpStorm exits withunrecognized option: --linephpstorm://links generated by tools like the Symfony web debug toolbar (phpstorm://open?file=%f&line=%l)--line/--column; falls back to the previous behavior when the file isn't inside a git repoTest plan
phpstorm://open?file=...&line=...URL against a git-tracked file on PhpStorm 2026.2 (PS-262.8665.265) — opens the correct project and jumps to the lineunrecognized option: --lineon this PhpStorm version, reproducing the bug this fixes