Commit Graph

15 Commits

Author SHA1 Message Date
Janic Duplessis 0cd69e8a02 Run eslint --fix
Summary:
CI is currently failing because of a lint issue, this fixes it and a bunch of other warnings that are auto-fixable.

**Test plan**
Quick manual test, cosmetic changes only.
Closes https://github.com/facebook/react-native/pull/16229

Differential Revision: D6009748

Pulled By: TheSavior

fbshipit-source-id: cabd44fed99dd90bd0b35626492719c139c89f34
2017-10-09 17:46:44 -07:00
esbenvb 43d394cb4b Updated support for WebStorm
Summary:
Added the executable path to the `COMMON_EDITORS`
Added the executable name to the arguments selections

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Need to be able to jump to specific files and line numbers in WebStorm and autodetect WebStorm as editor, without setting up any environment vars.

Start a new RN project in WebStorm, make some JS errors and click the errors to confirm that it will jump to the right file and line number in WebStorm.

Make sure that none of the other `COMMON_EDITORS` are running, unless you set the `REACT_EDITOR` environment variable.
Closes https://github.com/facebook/react-native/pull/15984

Differential Revision: D5911698

Pulled By: shergin

fbshipit-source-id: 54fced7539520553dd2a93bf7ca7e4f457b0bfc3
2017-09-26 15:03:52 -07:00
Sokovikov 99341315c4 open in editor fix, show tip instead of error
Summary:
if REACT_EDITOR not set we need to show a pro tip. For now error is shown

now:

<img width="967" alt="screen shot 2017-04-11 at 14 48 06" src="https://cloud.githubusercontent.com/assets/1488195/24905942/da7ae876-1ec6-11e7-8f4d-a2505ee1958f.png">

after fix:

<img width="641" alt="screen shot 2017-04-11 at 14 49 38" src="https://cloud.githubusercontent.com/assets/1488195/24905957/e60637d6-1ec6-11e7-92ad-ba03dbf3ebff.png">

1) REACT_EDITOR is not set
2) use unknown or terminal editor (I use neovim)
3) make a red box in UIExplorer
4) click on stacktrace line
Closes https://github.com/facebook/react-native/pull/13443

Differential Revision: D4963762

Pulled By: hramos

fbshipit-source-id: 8425d6e7c6f786e8ac51ebc9b7d721bb69dd7313
2017-04-28 06:18:30 -07:00
Jhen d38644eee5 Add Atom Beta to launchEditor
Summary:
Support [the pre-release of Atom](https://github.com/atom/atom/releases/tag/v1.16.0-beta0) for launchEditor in RN packager.

Open the pre-release of Atom and use the following code: (use the built-in [openFileInEditor](292cc82d0e/Libraries/Core/Devtools/openFileInEditor.js) module)

```js
import openFileInEditor from 'openFileInEditor'

openFileInEditor(file, lineNumber)
```
Closes https://github.com/facebook/react-native/pull/13255

Differential Revision: D4819130

Pulled By: ericvicenti

fbshipit-source-id: eb542295ee9489dad0fe9084e51c4141d33f1fbf
2017-04-03 09:15:29 -07:00
Steve Kellock f49093f397 Fixes launching Visual Studio Code due to args being a nested array.
Summary:
**Motivation**

Visual Studio Code appears to have been accidentally borked in RN 38 & 39.

[Here you see](a643784144 (diff-9ad1aafc931637a94d74b60c06b46871R153)) args become an array to support the new `shell-quote` support.

Problem is, `getArgumentsForLineNumber` also returns an array.

[And because we](a643784144 (diff-9ad1aafc931637a94d74b60c06b46871R161)) `push` instead of `concat`, we get hawt array-on-array action.

Surprisingly Atom works.  But Code doesn't like this at all.

**Test plan (required)**

On RN 0.38 and 0.39, what's happening when I click on the simulator stack frame, Code opens with the array as a string...

![image](https://cloud.githubusercontent.com/assets/68273/20971724/83a3d7c4-bc60-11e6-8170-a1c2a4adee60.png)

I've tested Vim, Code and Atom (all on 10.11.6) as well as all combinations of `REACT_EDITOR` both set
Closes https://github.com/facebook/react-native/pull/11345

Differential Revision: D4339963

Pulled By: lacker

fbshipit-source-id: 030cb9e3d84fd6861f28e3652bebfe2eef28dd62
2016-12-16 10:28:35 -08:00
Eric Palakovich Carr 38d275f8b5 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 https://github.com/facebook/react-native/pull/11275

Differential Revision: D4295724

Pulled By: javache

fbshipit-source-id: 29dec525f76c2f0a3ee203cac67408eecc8ac6b6
2016-12-07 17:13:42 -08:00
Matthew Dapena-Tretter a643784144 Allow arguments in the editor env var
Reviewed By: frantic

Differential Revision: D4129207

fbshipit-source-id: a92fbbbe917db9c9afc0d970e3ac546e2a14bced
2016-11-04 12:59:17 -07:00
Rob Hogan c3e8c825af Open to correct line on Webstorm, IntelliJ and AppCode
Summary:
A tiny PR to add support for launching IDEA editors with the cursor at the correct line. The argument syntax is the same as sublime.

The base names `wstorm`, `idea` and `appcode` are the default names when CLI launchers are created through 'Tools'->'Create Command-Line launcher' in the respective editor's gui.

Tested through a fork of RN on Webstorm, IntelliJ and AppCode for OSX and by manual invocation from CLI on IntelliJ for windows.
Closes https://github.com/facebook/react-native/pull/9042

Differential Revision: D3627680

fbshipit-source-id: dfb0db92f9ca8b464471c3dc9e92196d87d2e244
2016-07-27 04:43:47 -07:00
Patricio Beltran d1690a8f9e Support vscode as a React Editor
Summary:
When opening a text editor from react native there are a list of editors being supported. This PR adds `VSCode` to that.

As a difference with the current supported editors, `VSCode` has a notion of `workspace` (a directory that contains all of the project's files). The `workspace` can be passed to `VSCode` as a parameter so that if the workspace is already open we don't get new instances of `VSCode` every time a new file is open. The `workspace` is gotten by comparing the file location with the different `project roots`.

This code relies on `VSCode`'s `code` command, which it's documentation can be found at: https://code.visualstudio.com/Docs/editor/codebasics#_launching-from-the-command-line
Closes https://github.com/facebook/react-native/pull/7757

Differential Revision: D3463761

fbshipit-source-id: ee9ec999747ad6d16d95ec8317f551f3535286c9
2016-06-21 11:09:24 -07:00
Shayne Sweeney ab61a1fbac Sanitize lineNumber in launchEditor
Summary:Shelling out on win32 does not properly escape the command due to c3bb4b1aa5/lib/child_

This patch ensures a proper lineNumber before continuing, similar to how we check that the fileName passed exists.

**Test plan**

On platform `win32` or given appropriate testing changes to `launchEditor.js`...

With the following `request-bad` file:
```
GET /open-stack-frame HTTP/1.1
Host: 127.0.0.1:8081
Proxy-Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Content-Length: 64

{"file":"C:\\Windows\\system.ini","lineNumber":"123\" && calc"}
```

`$ nc localhost 8081 < request-bad`

Observe that before this patch `calc` would launch and afte
Closes https://github.com/facebook/react-native/pull/6299

Differential Revision: D3012074

Pulled By: davidaurelio

fb-gh-sync-id: cbc7b6e5c60529a289c0989a95593a322333ba5d
shipit-source-id: cbc7b6e5c60529a289c0989a95593a322333ba5d
2016-03-04 12:07:02 -08:00
Janic Duplessis e08a7f3587 Fix launching text editor from a redbox stacktrace on windows
Summary:
Launch the editor with cmd on windows.
Closes https://github.com/facebook/react-native/pull/5238

Reviewed By: svcscm

Differential Revision: D2819943

Pulled By: pcottle

fb-gh-sync-id: a38f88bb9be72871cc3a37367973371176799d9e
2016-01-11 13:27:31 -08:00
Alex Kotliarskyi a710eb3292 Try to guess user's editor
Summary: public

Currently works only on OSX and supports Sublime (2/3) and Atom.

The idea is to get the list of running processes and try to find some well-known
editors there.

Reviewed By: vjeux

Differential Revision: D2642865

fb-gh-sync-id: d346902662354b2f633651a9bc54368146133651
2015-11-11 13:47:34 -08:00
Kai Wood 635edd9ccc Support line number arguments for RubyMine
Summary: RubyMine's command line launcher `mine` supports the same syntax as `mate` for jumping to line numbers. This patch adds it to the list.
Closes https://github.com/facebook/react-native/pull/3883

Reviewed By: svcscm

Differential Revision: D2615422

Pulled By: pcottle

fb-gh-sync-id: 79a70f524f852ba8eb4803e6abc6970abbf02b61
2015-11-04 07:56:27 -08:00
Chris Geirman b752d79838 update pro tip to clarify how to configure zsh shell
Summary: Thanks to alex_frantic for helping me solve this problem...
https://twitter.com/alex_frantic/status/657276624220659712
Closes https://github.com/facebook/react-native/pull/3853

Reviewed By: svcscm

Differential Revision: D2609728

Pulled By: pcottle

fb-gh-sync-id: edb20fcbaff0289a2363eedebd84d20c2d3b39aa
2015-11-02 21:33:31 -08:00
Martín Bigio bcf762af60 Move files from `packager/` to `local-cli`
Summary: public

This is not only to put the files on a place where it makes more sense but also to allow to use ES6 features on them as `/packager` is not whitelisted on `babel`.

Reviewed By: mkonicek

Differential Revision: D2577267

fb-gh-sync-id: b69a17c0aad349a3eda987e33d1778d97a8e1549
2015-10-26 15:38:14 -07:00