-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Open in External Editor, But Simpler™ #2407
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
Conversation
d4f680a to
bd5c93c
Compare
|
It might be good to use something like |
We don't do this for any of our current preferences, so I'm going to defer this to another discussion. |
| createWindow() | ||
|
|
||
| const menu = buildDefaultMenu() | ||
| let menu = buildDefaultMenu() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| { | ||
| label: `Open in ${editorLabel}`, | ||
| id: 'open-external-editor', | ||
| accelerator: 'CmdOrCtrl+Shift+A', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CmdOrCtrl+Shift+A? Is that really the conventional keystroke shortcut for that command? I seem to remember that command using an E in other apps where I've seen it (though I don't recall the modifier keys).
app/src/lib/editors/darwin.ts
Outdated
|
|
||
| try { | ||
| // invoked without assigning the result so we verify the app is installed | ||
| await appPath('com.github.atom') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
app/src/lib/editors/darwin.ts
Outdated
| 'Contents', | ||
| 'SharedSupport', | ||
| 'bin', | ||
| 'subl' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
app/src/lib/editors/win32.ts
Outdated
| const regKey = new Registry({ | ||
| hive: Registry.HKLM, | ||
| key: | ||
| '\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F8A2A208-72B3-4D61-95FC-8A65D340689B}_is1', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
While I go through and tidy up the UX corner cases, this is likely ready for some early 👀 |
app/src/lib/editors/shared.ts
Outdated
| */ | ||
| export function pathExists(path: string): Promise<boolean> { | ||
| return new Promise<boolean>((resolve, reject) => { | ||
| Fs.exists(path, exists => { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
app/src/lib/editors/darwin.ts
Outdated
| async function findCodeApplication(): Promise<LookupResult> { | ||
| const name = VisualStudioCodeLabel | ||
| try { | ||
| const installPath = await appPath('com.github.atom') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
This seems reasonable so far 👍 I was a little unsure of using the apps' command line launchers, vs. launching the app itself, but after thinking about it I suppose that's probably the better supported launching method anyways. |
As in "launching the
Yeah, these are full-fledged interfaces that are copied over to And as Atom points out, the handling of "open a new window" versus "focus existing window" should be handled by the app through these interfaces. |
|
Some notes after profiling this PR: WindowsNo longer using
macOS
|
bfec7aa to
c8cad9b
Compare
|
Done in cf4514a |
Tweak styles for no editors found message
…e has a 64-bit build
This should be covered by the repository menu being disabled, but 4b8407e makes this more explicit. |
|
🌔 |
joshaber
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just needs a merge now and this'll be good to go 🔜
Really nice work on this 💖
| case ExternalEditor.SublimeText: | ||
| return 'com.sublimetext.3' | ||
| default: | ||
| return assertNever(editor, `Unknown external editor: ${editor}`) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
🍎 |
|
🕺 |
app/src/lib/editors/darwin.ts
Outdated
| 'app', | ||
| 'atom.sh' | ||
| ) | ||
| const exists = await pathExists(path) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
app/src/lib/editors/registry.ts
Outdated
| value: string | ||
| } | ||
|
|
||
| const regPath = 'C:\\Windows\\System32\\reg.exe' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
👍 |
This is my proposed implementation of #2009, and should be simpler than #2039.
First Pass: Make It Work
This should be enough to confirm we're on the right track.
Second Pass - polishing things
macOSshould invoke shims instead of launching appawaiting to lookup of all editors adds +1s on Windows toAppStore.loadInitialStatewhen it fails - maybe i shouldn't do thisScreens and Visuals
With editors found:
With no editors found:
Open in Atom- should this be 'Open in External Editor' instead?selectAssorted other notes:
app-path[repo] uses a precompiled binary. I'd rather that usenode-gypfrom a purist perspective, but we can PR that later unless we have strong feels.