Jump to Source on RedBox error does not work with IntelliJ on Mac
Environment
System: OS: macOS 13.6.2 CPU: (12) arm64 Apple M2 Max Memory: 73.39 MB / 32.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 19.8.1 path: /usr/local/bin/node Yarn: version: 1.22.19 path: ~/.yarn/bin/yarn npm: version: 9.5.1 path: /usr/local/bin/npm Watchman: Not Found Managers: CocoaPods: version: 1.13.0 path: /Users/h.s/.gem/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 23.0 - iOS 17.0 - macOS 14.0 - tvOS 17.0 - watchOS 10.0 Android SDK: Not Found IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.10811636 Xcode: version: 15.0/15A240d path: /usr/bin/xcodebuild Languages: Java: version: 11.0.18 path: /usr/bin/javac Ruby: version: 2.7.6 path: /Users/h.s/.rbenv/shims/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.7 wanted: 0.72.7 react-native-macos: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false
Description
Jump to source file does not work on Mac with IntelliJ IDEA 2023.1. The idea cli line format that is configured in packages/cli-tools/src/launchEditor.ts it uses: [${fileName}:${lineNumber}] but when clicking on a RedBox error this creates a new file with the name: example.tsx:55 instead of jumping to the source file. When I changed the idea command format to ['--line', String(lineNumber), fileName] it works as it should.
See this commit https://github.com/react-native-community/cli/compare/main...hstorz:cli:main
Maybe this is also the case for other JetBrains IDEs like WebStorm but I don't have them to test. Or maybe this is the right behaviour on Windows and a separate Mac check is required. But I also could not test that.
I temporarily fixed it for my local environment with a git apply patch command in the yarn "prepare" script or in "postinstall", if you don't run it on a build server.
Reproducible Demo
I set following in my .zshrc:
PATH="/Applications/IntelliJ IDEA.app/Contents/MacOS:${PATH}" export PATH export REACT_EDITOR=idea
And clicked on a RedBox error in the iOS simulator on a Mac 13.6.2.
Hey @hstorz 👋 mind creating PR?