Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-detect more common editors #2636

Closed
gaearon opened this issue Jun 27, 2017 · 15 comments
Closed

Auto-detect more common editors #2636

gaearon opened this issue Jun 27, 2017 · 15 comments

Comments

@gaearon
Copy link
Contributor

gaearon commented Jun 27, 2017

Let's send PRs for autodetecting more common editors for the error overlay!
The feature already works both on macOS and Windows (thanks @levrik).

Currently detected editors are here:

const COMMON_EDITORS_OSX = {
  '/Applications/Atom.app/Contents/MacOS/Atom': 'atom',
  '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta': '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta',
  '/Applications/Sublime Text.app/Contents/MacOS/Sublime Text': '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl',
  '/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2': '/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl',
  '/Applications/Visual Studio Code.app/Contents/MacOS/Electron': 'code',
};

const COMMON_EDITORS_WIN = [
  'Code.exe',
  'atom.exe',
  'sublime_text.exe',
  'notepad++.exe',
];

If your favorite editor isn't in the list, but supports running from the command line with a line number, send a PR to launchEditor.js adding it to the list, and specifying its argument format.

To verify your change works, edit node_modules/react-dev-utils/launchEditor.js in your project, add a throw new Error('hi') to a component, and then verify that clicking on the error overlay takes you to the right place.

@jantimon
Copy link

This feature is really cool - you should create an independent npm package out of that! 👍

@gaearon
Copy link
Contributor Author

gaearon commented Jun 27, 2017

Agree, we should extract it at some point! It's originally forked from React Native but we added more features and might eventually make RN depend on it.

@ntucker
Copy link

ntucker commented Jun 27, 2017

why no linux? :(

@gaearon
Copy link
Contributor Author

gaearon commented Jun 27, 2017

@ntucker Because nobody contributed Linux support yet. Would you like to do that?

@miraage
Copy link

miraage commented Jun 28, 2017

In my opninion, WebStorm,PhpStorm and Idea should also be there. Despite the fact that JetBrains IDEs are offering to create a shortcut, still not a lot of people do it.

@gaearon
Copy link
Contributor Author

gaearon commented Jun 28, 2017

Happy to take PRs!

@bunshar
Copy link
Contributor

bunshar commented Jun 28, 2017

@gaearon I would like to contributed Linux support. Should I create another ticket?

@gaearon
Copy link
Contributor Author

gaearon commented Jun 28, 2017

@bunshar This ticket is fine—just send a PR!

@reznord
Copy link

reznord commented Jul 3, 2017

@gaearon in OSX you can launch Atom Beta using atom-beta command.

So,

  '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta': '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta',

can be

  '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta': 'atom-beta',

@gaearon
Copy link
Contributor Author

gaearon commented Jul 3, 2017

Happy to take PRs (although if it works fine, I wouldn't change it).

@reznord
Copy link

reznord commented Jul 3, 2017

Can I take this up and add Linux support as well?

Sent from my OnePlus ONEPLUS A3003 using FastHub

@gaearon
Copy link
Contributor Author

gaearon commented Jul 3, 2017

Sure.

@reznord
Copy link

reznord commented Jul 7, 2017

@gaearon for opening CRA project in Visual Studio Code, we cannot use code as mentioned here unless we go and install the command line tools from the command pallet in VS Code.

Please find the documentation for setting up VS Code here

danrr pushed a commit to danrr/create-react-app that referenced this issue Jul 9, 2017
Autodetect PyCharm (Pro and CE), WebStorm, PhpStorm, IntelliJ IDEA, RubyMine, CLion, and AppCode

Added IntelliJ IDEA, RubyMine, CLion, and AppCode to list of IDEs. It has the same signature as WebStorm and PhpStorm `<editor> <projectPath> --line <number> <filePath>` so it can reuse the logic from those.

Removed older integrations of AppCode, IntelliJ IDEA

https://www.jetbrains.com/help/idea/opening-files-from-command-line.html
https://www.jetbrains.com/help/pycharm/opening-files-from-command-line.html
https://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.html
https://www.jetbrains.com/help/ruby/opening-files-from-command-line.html
https://www.jetbrains.com/help/webstorm/opening-files-from-command-line.html

Tested with Appcode 2017.1.3, CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on MacOS 10.12
Tested with 64-bit CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on a Windows 10 VM

Relates to facebook#2636
gaearon pushed a commit that referenced this issue Jul 9, 2017
Autodetect PyCharm (Pro and CE), WebStorm, PhpStorm, IntelliJ IDEA, RubyMine, CLion, and AppCode

Added IntelliJ IDEA, RubyMine, CLion, and AppCode to list of IDEs. It has the same signature as WebStorm and PhpStorm `<editor> <projectPath> --line <number> <filePath>` so it can reuse the logic from those.

Removed older integrations of AppCode, IntelliJ IDEA

https://www.jetbrains.com/help/idea/opening-files-from-command-line.html
https://www.jetbrains.com/help/pycharm/opening-files-from-command-line.html
https://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.html
https://www.jetbrains.com/help/ruby/opening-files-from-command-line.html
https://www.jetbrains.com/help/webstorm/opening-files-from-command-line.html

Tested with Appcode 2017.1.3, CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on MacOS 10.12
Tested with 64-bit CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on a Windows 10 VM

Relates to #2636
romaindso pushed a commit to romaindso/create-react-app that referenced this issue Jul 10, 2017
Autodetect PyCharm (Pro and CE), WebStorm, PhpStorm, IntelliJ IDEA, RubyMine, CLion, and AppCode

Added IntelliJ IDEA, RubyMine, CLion, and AppCode to list of IDEs. It has the same signature as WebStorm and PhpStorm `<editor> <projectPath> --line <number> <filePath>` so it can reuse the logic from those.

Removed older integrations of AppCode, IntelliJ IDEA

https://www.jetbrains.com/help/idea/opening-files-from-command-line.html
https://www.jetbrains.com/help/pycharm/opening-files-from-command-line.html
https://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.html
https://www.jetbrains.com/help/ruby/opening-files-from-command-line.html
https://www.jetbrains.com/help/webstorm/opening-files-from-command-line.html

Tested with Appcode 2017.1.3, CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on MacOS 10.12
Tested with 64-bit CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on a Windows 10 VM

Relates to facebook#2636
JohnNilsson referenced this issue in JohnNilsson/create-react-app-typescript Aug 9, 2017
Autodetect PyCharm (Pro and CE), WebStorm, PhpStorm, IntelliJ IDEA, RubyMine, CLion, and AppCode

Added IntelliJ IDEA, RubyMine, CLion, and AppCode to list of IDEs. It has the same signature as WebStorm and PhpStorm `<editor> <projectPath> --line <number> <filePath>` so it can reuse the logic from those.

Removed older integrations of AppCode, IntelliJ IDEA

https://www.jetbrains.com/help/idea/opening-files-from-command-line.html
https://www.jetbrains.com/help/pycharm/opening-files-from-command-line.html
https://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.html
https://www.jetbrains.com/help/ruby/opening-files-from-command-line.html
https://www.jetbrains.com/help/webstorm/opening-files-from-command-line.html

Tested with Appcode 2017.1.3, CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on MacOS 10.12
Tested with 64-bit CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on a Windows 10 VM

Relates to #2636
morgs32 pushed a commit to BrickworkSoftware/create-react-app that referenced this issue Sep 1, 2017
Autodetect PyCharm (Pro and CE), WebStorm, PhpStorm, IntelliJ IDEA, RubyMine, CLion, and AppCode

Added IntelliJ IDEA, RubyMine, CLion, and AppCode to list of IDEs. It has the same signature as WebStorm and PhpStorm `<editor> <projectPath> --line <number> <filePath>` so it can reuse the logic from those.

Removed older integrations of AppCode, IntelliJ IDEA

https://www.jetbrains.com/help/idea/opening-files-from-command-line.html
https://www.jetbrains.com/help/pycharm/opening-files-from-command-line.html
https://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.html
https://www.jetbrains.com/help/ruby/opening-files-from-command-line.html
https://www.jetbrains.com/help/webstorm/opening-files-from-command-line.html

Tested with Appcode 2017.1.3, CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on MacOS 10.12
Tested with 64-bit CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on a Windows 10 VM

Relates to facebook#2636
JohnNilsson referenced this issue in JohnNilsson/create-react-app-typescript Sep 9, 2017
Autodetect PyCharm (Pro and CE), WebStorm, PhpStorm, IntelliJ IDEA, RubyMine, CLion, and AppCode

Added IntelliJ IDEA, RubyMine, CLion, and AppCode to list of IDEs. It has the same signature as WebStorm and PhpStorm `<editor> <projectPath> --line <number> <filePath>` so it can reuse the logic from those.

Removed older integrations of AppCode, IntelliJ IDEA

https://www.jetbrains.com/help/idea/opening-files-from-command-line.html
https://www.jetbrains.com/help/pycharm/opening-files-from-command-line.html
https://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.html
https://www.jetbrains.com/help/ruby/opening-files-from-command-line.html
https://www.jetbrains.com/help/webstorm/opening-files-from-command-line.html

Tested with Appcode 2017.1.3, CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on MacOS 10.12
Tested with 64-bit CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on a Windows 10 VM

Relates to #2636
Timer pushed a commit that referenced this issue Sep 11, 2017
* Auto-detect running editor on Linux for error overlay

Basic support of auto detecting running editor for #2636.
Tested on Ubuntu 16.04.
It detects few editors. JetBrains products should start by
wrapper like /usr/local/bin/webstorm. Otherwise it takes a
lot of time to open editor.

* Comments fixed.

* List all processes owned by you

* Comment rewording
thongdong7 pushed a commit to thongdong7/create-react-app that referenced this issue Sep 24, 2017
* Auto-detect running editor on Linux for error overlay

Basic support of auto detecting running editor for facebook#2636.
Tested on Ubuntu 16.04.
It detects few editors. JetBrains products should start by
wrapper like /usr/local/bin/webstorm. Otherwise it takes a
lot of time to open editor.

* Comments fixed.

* List all processes owned by you

* Comment rewording
thongdong7 pushed a commit to thongdong7/create-react-app that referenced this issue Sep 24, 2017
* Auto-detect running editor on Linux for error overlay

Basic support of auto detecting running editor for facebook#2636.
Tested on Ubuntu 16.04.
It detects few editors. JetBrains products should start by
wrapper like /usr/local/bin/webstorm. Otherwise it takes a
lot of time to open editor.

* Comments fixed.

* List all processes owned by you

* Comment rewording
kasperpeulen pushed a commit to kasperpeulen/create-react-app that referenced this issue Sep 24, 2017
Autodetect PyCharm (Pro and CE), WebStorm, PhpStorm, IntelliJ IDEA, RubyMine, CLion, and AppCode

Added IntelliJ IDEA, RubyMine, CLion, and AppCode to list of IDEs. It has the same signature as WebStorm and PhpStorm `<editor> <projectPath> --line <number> <filePath>` so it can reuse the logic from those.

Removed older integrations of AppCode, IntelliJ IDEA

https://www.jetbrains.com/help/idea/opening-files-from-command-line.html
https://www.jetbrains.com/help/pycharm/opening-files-from-command-line.html
https://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.html
https://www.jetbrains.com/help/ruby/opening-files-from-command-line.html
https://www.jetbrains.com/help/webstorm/opening-files-from-command-line.html

Tested with Appcode 2017.1.3, CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on MacOS 10.12
Tested with 64-bit CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on a Windows 10 VM

Relates to facebook#2636
kasperpeulen pushed a commit to kasperpeulen/create-react-app that referenced this issue Sep 24, 2017
* Auto-detect running editor on Linux for error overlay

Basic support of auto detecting running editor for facebook#2636.
Tested on Ubuntu 16.04.
It detects few editors. JetBrains products should start by
wrapper like /usr/local/bin/webstorm. Otherwise it takes a
lot of time to open editor.

* Comments fixed.

* List all processes owned by you

* Comment rewording
swengorschewski referenced this issue in swengorschewski/cra-typescript-electron Oct 16, 2017
Autodetect PyCharm (Pro and CE), WebStorm, PhpStorm, IntelliJ IDEA, RubyMine, CLion, and AppCode

Added IntelliJ IDEA, RubyMine, CLion, and AppCode to list of IDEs. It has the same signature as WebStorm and PhpStorm `<editor> <projectPath> --line <number> <filePath>` so it can reuse the logic from those.

Removed older integrations of AppCode, IntelliJ IDEA

https://www.jetbrains.com/help/idea/opening-files-from-command-line.html
https://www.jetbrains.com/help/pycharm/opening-files-from-command-line.html
https://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.html
https://www.jetbrains.com/help/ruby/opening-files-from-command-line.html
https://www.jetbrains.com/help/webstorm/opening-files-from-command-line.html

Tested with Appcode 2017.1.3, CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on MacOS 10.12
Tested with 64-bit CLion 2017.1.3, Intellij Idea 2017.1.5, PhpStorm 2017.1.4, PyCharm (Pro and CE) 2017.1.4, RubyMine 2017.1.5, and WebStorm 2017.1.4 on a Windows 10 VM

Relates to #2636
gaearon pushed a commit that referenced this issue Jan 8, 2018
Adds support for the error overlay to detect and open the file with the error in MacVim.

Relates to #2636.
@Grsmto
Copy link

Grsmto commented Feb 6, 2018

@reznord thanks, I just spent an hour debugging this and figured out it wasn't working because I didn't have the vscode CLI tool installed. :)
@gaearon are you open to PR to improve the error message? It would be cool if it was telling to VSCode users to install the CLI first if the code command is not found.

Pavek pushed a commit to Pavek/create-react-app that referenced this issue Jul 10, 2018
Adds support for the error overlay to detect and open the file with the error in MacVim.

Relates to facebook#2636.
identor added a commit to identor/create-react-app that referenced this issue Oct 1, 2018
Clicking Error overlay should feed the correct line number for gvim.

Added `gvim` in `COMMON_EDITORS_LINUX`, launches new gvim when it is running.

Tested with gvim 8.0.707 on a Debian 4.9.110-3+deb9u4 (2018-08-21) x86_64 GNU/Linux VM

Relates to facebook#2636.
gaearon pushed a commit that referenced this issue Oct 1, 2018
Clicking Error overlay should feed the correct line number for gvim.

Added `gvim` in `COMMON_EDITORS_LINUX`, launches new gvim when it is running.

Tested with gvim 8.0.707 on a Debian 4.9.110-3+deb9u4 (2018-08-21) x86_64 GNU/Linux VM

Relates to #2636.
@stale
Copy link

stale bot commented Nov 2, 2018

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs.

@stale stale bot added the stale label Nov 2, 2018
@Timer Timer closed this as completed Nov 2, 2018
@lock lock bot locked and limited conversation to collaborators Jan 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants