Permalink
Browse files

Red Box should open PyCharm at line number of error

Summary:
This is a simple one line change.  When a red box is launching the editor, if `launchEditor.js` is aware of your editor it can also add a line number to open the file at.  So if the stacktrace shows an error on like 56 in `ako.js` then it'll try`wstorm /Users/somelady/src/project/ako.js:56` instead of `wstorm /Users/somelady/src/project/ako.js`.

This adds PyCharm's command line launcher, which is named `charm`.  There is existing logic to handle other JetBrains editors, so I just did a simple one line addition.

**Test plan (required)**

* Install PyCharm (if needed)
* Set environment variable `REACT_EDITOR` to `charm`
* Open PyCharm
* Add/replace the current `charm` command via `Tools -> Create Command-line launcher...` in PyCharm.
* Run a React Native project with an error in the source code.
* In the generated red box, click on one of the entries in the stack trace
* File should open in PyCharm at the correct line number.
Closes #11275

Differential Revision: D4295724

Pulled By: javache

fbshipit-source-id: 29dec525f76c2f0a3ee203cac67408eecc8ac6b6
  • Loading branch information...
bigsassy authored and mkonicek committed Dec 8, 2016
1 parent 4a216f6 commit be169075d90e318bcef57b0491f421d0e0800d03
Showing with 1 addition and 0 deletions.
  1. +1 −0 local-cli/server/util/launchEditor.js
@@ -56,6 +56,7 @@ function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) {
case 'sublime':
case 'wstorm':
case 'appcode':
case 'charm':
case 'idea':
return [fileName + ':' + lineNumber];
case 'joe':

1 comment on commit be16907

@markspolakovs

This comment has been minimized.

Show comment
Hide comment
@markspolakovs

markspolakovs Feb 4, 2017

@bigsassy Tools -> Create Command-line launcher... doesn't appear to be a thing on Windows (https://twitter.com/markspolakovs/status/827931581268496385). Is there an alternative for Windows?

markspolakovs commented on be16907 Feb 4, 2017

@bigsassy Tools -> Create Command-line launcher... doesn't appear to be a thing on Windows (https://twitter.com/markspolakovs/status/827931581268496385). Is there an alternative for Windows?

Please sign in to comment.