Skip to content

Auto-detect more common editors #2636

Closed
@gaearon

Description

@gaearon
Contributor

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.

Activity

jantimon

jantimon commented on Jun 27, 2017

@jantimon

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

gaearon

gaearon commented on Jun 27, 2017

@gaearon
ContributorAuthor

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

ntucker commented on Jun 27, 2017

@ntucker

why no linux? :(

gaearon

gaearon commented on Jun 27, 2017

@gaearon
ContributorAuthor

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

miraage

miraage commented on Jun 28, 2017

@miraage

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

gaearon commented on Jun 28, 2017

@gaearon
ContributorAuthor

Happy to take PRs!

bunshar

bunshar commented on Jun 28, 2017

@bunshar
Contributor

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

gaearon

gaearon commented on Jun 28, 2017

@gaearon
ContributorAuthor

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

reznord

reznord commented on Jul 3, 2017

@reznord

@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

gaearon commented on Jul 3, 2017

@gaearon
ContributorAuthor

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

reznord

reznord commented on Jul 3, 2017

@reznord

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

Sent from my OnePlus ONEPLUS A3003 using FastHub

gaearon

gaearon commented on Jul 3, 2017

@gaearon
ContributorAuthor

Sure.

36 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Grsmto@Timer@gaearon@ntucker@miraage

        Issue actions

          Auto-detect more common editors · Issue #2636 · facebook/create-react-app