Skip to content

Add support for EmEditor external editor - #5406

Closed
killerwife wants to merge 1 commit into
desktop:masterfrom
killerwife:feature/EmEditor
Closed

killerwife wants to merge 1 commit into
desktop:masterfrom
killerwife:feature/EmEditor

Conversation

@killerwife

Copy link
Copy Markdown

Solving issue #4753
Done through instructions on https://github.com/desktop/desktop/blob/master/docs/technical/editor-integration.md
Missing part: Registry for 32-bit emeditor since I do not know it.
Should there be need for assistance with merging, happy to do anything so that this is merged asap.

subKey:
'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{D03753CD-7F12-4281-9709-DDE30EFF8D6D}',
},
// 32-bit version of EmEditor - TODO: Find registry

This comment was marked as spam.

This comment was marked as spam.

@shiftkey

Copy link
Copy Markdown
Member

@killerwife there's a limitation with EmEditor that means it's not suitable for use in GitHub Desktop currently:

  • the editors we use in the "Open in External Editor" list support opening the directory containing the repository
  • this means we can launch the editor as a simple way for users to work with the whole repository
  • not all editors have this experience - for example, Add Notepad++ External Editor for Windows #4120 wanted to add support Notepad++ but we closed that out because it didn't have the right command line flags (and instead would open all the files)
  • the only relevant one I could find for EmEditor was /cd which "set the current directory as the default folder in the Open dialog box." [docs]
  • this would open to the directory, but then ask me which files I wanted to open

Unless I've missed something here, I don't think I can take in this PR because of the mismatch between our "Open in External Editor" and what EmEditor currently supports.

@killerwife

killerwife commented Aug 15, 2018 •

Copy link
Copy Markdown
Author

@shiftkey how about this: "/rr *.*"

@killerwife

Copy link
Copy Markdown
Author

Also I would like to express the frustration for the propably most used editor not being supported (Notepad++) due to that limitation. All of this editor stuff considerably hampers usability. Can't there be a switch that open in external editor would only show up for select files, instead of whole repository? I personally do not see the usecase, since I use development tools for that. Maybe I am missing the big picture though.

@shiftkey

Copy link
Copy Markdown
Member

how about this: "/rr ."

This will open all the files, which was the Notepad++ behaviour we realised wasn't desirable.

Can't there be a switch that open in external editor would only show up for select files, instead of whole repository?

Historically we've been focused on two flows:

  • open a file in an external program
  • opening a folder in an external program

For the "open a file in an external program" flow we defer to your OS choice here because you may configure different editors for different file extensions, and it didn't seem worth reimplementing that in Desktop (and not covering all potential scenarios).

For the "open a folder in an external program" flow we felt this was better to address within Desktop because there isn't equivalent functionality in your OS already setup.

Maybe I am missing the big picture though.

Remember my comment from a while ago?

So while EmEditor does declare itself as an editor for text files, Electron is only leveraging programs that support opening a given extension.

I think this is the core of your issue with how "Open in external program" is currently working in Desktop. I went through these steps and it seems to work for me:

  1. For some file extension you're interested in, choose Open with | Choose another app

  1. Ensure EmEditor is set always set for opening this extension

  1. Then try and open a file of that same extension in Desktop:

If you're satisfied with that behaviour and able to see the same thing on your end, we can revisit #4753 and figure out what's left to do.

@killerwife

killerwife commented Aug 15, 2018 •

Copy link
Copy Markdown
Author

On my end, Open with Default Program does not work. I have almost all text based files set to emeditor, and it doesnt use it, and instead opens it in notepad. Any way I can troubleshoot that?

@killerwife

Copy link
Copy Markdown
Author

@shiftkey

Copy link
Copy Markdown
Member

@killerwife

I have almost all text based files set to emeditor, and it doesnt use it, and instead opens it in notepad. Any way I can troubleshoot that?

Thanks for the extra context. I poked at .sql to set it to EmEditor:

And when I right-click on a .sql file I get these two context menu entries:

Note that Edit is emphasised as the default behaviour. This means when I double-click or choose Edit it'll choose EmEditor, but when I click Open it will launch Notepad. That's the core of the issue here, and Desktop is continuing to try and Open the file, which I don't seem to be able to workaround completely.

@killerwife

Copy link
Copy Markdown
Author

Okay and how is "Open" changable in windows 10. I can't seem to be able to find a solution for that.

@shiftkey

Copy link
Copy Markdown
Member

Okay and how is "Open" changable in windows 10. I can't seem to be able to find a solution for that.

I had to do this in the registry, and I was fine with ruining my machine, so some warnings:

  • The registry is annoyingly fiddly, and I have broken myself before in here
  • This only worked for .sql extensions.
  • This works on my machine
  1. I found the entry for .sql at Computer\HKEY_CURRENT_USER\Software\Classes\.sql. It points to an entry named sql_auto_file

screen shot 2018-08-15 at 11 58 23 am

  1. I went to the entry for sql_auto_file at Computer\HKEY_CURRENT_USER\Software\Classes\sql_auto_file. It had the shell\edit\command registry key which pointed to EmEditor

  2. I created the shell\open\command registry key alongside, and set "C:\Users\shiftkey\AppData\Local\Programs\EmEditor\EMEDITOR.EXE" "%1" to the default value.

screen shot 2018-08-15 at 11 55 59 am

  1. Back on my .sql file, the context menu now defaults to Open

  1. Now Desktop launches EmEditor when using Open in External Program

@shiftkey

Copy link
Copy Markdown
Member

I'm going to close this out because we can't merge in EmEditor external editor support in it's current form, and we have #4753 which is tracking the related issue about Open in External Program and core.editor.

@shiftkey shiftkey closed this Aug 15, 2018
@killerwife

Copy link
Copy Markdown
Author

Thx for the thorough explanations, sadly the regedit did not work for me. It seems to have smth to do with mysql though.

@shiftkey

Copy link
Copy Markdown
Member

It seems to have smth to do with mysql though.

Yep, and at this point I'm going to have to stop trying to debug an unknown configuration and registry setup for fear of breaking things.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants