Auto-detect more common editors
Created by: gaearon
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.