You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Github Desktop and Default text editors + EmEditor #4753
Currently github desktop only supports selective text editors on windows. It does not respect two following key settings:
using default text editor as setup in windows for given file type
using default text editor set in git config
I have both of these set to EmEditor, the old Github desktop client is capable of using them properly, but the new one does not even give the option to change this. Using notepad is insanity when doing cross platform development, and installing an additional editor just because the client does not support setting it in some sane way is no good either.
Reason for using EmEditor: we use extremely huge files and as a result, most of not all software is incapable of handling it well. (talking about 1GB + files here)
I have not seen an EmEditor thread around here yet.
Currently github desktop only supports selective text editors on windows. It does not respect two following key settings:
using default text editor as setup in windows for given file type
using default text editor set in git config
I'm not sure how to help you or answer the first part of the issue, so maybe someone from the core team can answer your questions cc: @shiftkey, @iAmWillShepherd.
Now regarding the integration of EmEditor with the new Github Desktop, there is a doc about it and how external contributors can integrate their favorite editor with the app. The team (myself included) would be more than happy to review your PR and help you with any questions that you may have. Please let me know if you have any other questions.
using default text editor as setup in windows for given file type
GitHub Desktop should respect the default program you have set to open a specific file type when you select Open with default program in the context menu of a file in the Changes view. Is this what you are looking for?
Absolutely. When I associate a given editor with .cpp or .h or .py, I would expect the Github Desktop app to use that associated program. Just to clarify on windows 10 its the menu called "Choose default apps by file type".
When I associate a given editor with .cpp or .h or .py, I would expect the Github Desktop app to use that associated program
GitHub Desktop should respect that default program when you right-click on a file in the Changes view and select Open with default program. Let me know if I'm misunderstanding what you are wanting to do here.
There's some extra context here about the differences between the classic Windows app and the new Electron app, and it requires some understanding of how Windows handles opening files.
if (reinterpret_cast<ULONG_PTR>(ShellExecuteW(NULL, L"open",
escaped_url.c_str(), NULL, NULL,
SW_SHOWNORMAL)) <= 32) {
// We fail to execute the call. We could display a message to the user.// TODO(nsylvain): we should also add a dialog to warn on errors. See// bug 1136923.return false;
}
Notice that L"open",? This is where the first problem comes in: Windows expects a verb to ShellExecute to hint at what the user wants to do with the file, and Electron currently hard-codes open.
So while EmEditor does declare itself as an editor for text files, Electron is only leveraging programs that support opening a given extension. That's the core of the differences between Classic Desktop and Desktop Electron, and why that menu item is currently labelled Open in default program and not Edit in default program.
Putting that aside, I tested out installing EmEditor and Desktop and associating it with opening a file extension (in this case .md). On first usage I got this prompt, which makes sense:
So I chose EmEditor and it opened fine. Second time through, I hit this error:
This is our generic error handler when Electron raises an error inside open-file.ts:
message: `Unable to open file ${fullPath} in an external program. Please check you have a program associated with this file extension`,
}
awaitdispatcher.postError(error)
That probably needs to be investigated here.
It does not respect two following key settings:
...
2. using default text editor set in git config
I believe this was working because we set core.editor to gitpad in your config - GitPad being a tool that we bundled in Git Shell. We don't have plans to bring Git Shell across to Desktop Electron.
It is annoying that "Open in external editor" is not hidden if there is no external editor, cluttering up the context menu. I would think this is easy to check and hide.
@killerwife in reference to this feature that is no longer set by Desktop Electron:
using default text editor set in git config
In Desktop Classic on Windows we set core.editor=gitpad which would launch the default program for editing text files. A while ago the Git for Windows project added the ability to choose the editor from a list of installed tools at install time:
This is great for discoverability, but all it does under the hood is set core.editor to the program and provide the necessary arguments to launch the program and detect when it was closed.
Here's what it adds to my test machine's system config for Notepad++:
Desktop isn't really concerned about this flow in the UI (commits are done in the app, rather than launching the editor) so I'm not sure when we'll get to this.
For the moment I'd see if you can add an entry like this to your ~/.gitconfig to address this gap from the old app:
using default text editor as setup in windows for given file type
using default text editor set in git config
After discussion in #5406 about 1. I've extracted the current details about Desktop's limitations to #5411, and I believe 2. should be covered by a config change, so I'm going to close this out because I don't think there's anything more I can do to support EmEditor currently.
Activity
agisilaos commentedon May 22, 2018
Hello @killerwife,
I'm not sure how to help you or answer the first part of the issue, so maybe someone from the core team can answer your questions cc: @shiftkey, @iAmWillShepherd.
Now regarding the integration of EmEditor with the new Github Desktop, there is a doc about it and how external contributors can integrate their favorite editor with the app. The team (myself included) would be more than happy to review your PR and help you with any questions that you may have. Please let me know if you have any other questions.
steveward commentedon May 22, 2018
Thanks for opening this @killerwife.
GitHub Desktop should respect the default program you have set to open a specific file type when you select
Open with default programin the context menu of a file in theChangesview. Is this what you are looking for?killerwife commentedon May 22, 2018
Absolutely. When I associate a given editor with .cpp or .h or .py, I would expect the Github Desktop app to use that associated program. Just to clarify on windows 10 its the menu called "Choose default apps by file type".
steveward commentedon May 22, 2018
GitHub Desktop should respect that default program when you right-click on a file in the
Changesview and selectOpen with default program. Let me know if I'm misunderstanding what you are wanting to do here.killerwife commentedon May 22, 2018
Yes. When I used https://imgur.com/a/W2n3mAB "Open with default program", notepad was used. When I used "show in explorer" and doubleclicked the file, EmEditor was used.
Edit: also when I use "Open File" on the old Github Desktop, the non portable one which was only for windows i believe, https://imgur.com/a/yz8PbL2 <- this one, the correct EmEditor is used. So on the old client this used to work fine.
shiftkey commentedon May 28, 2018
There's some extra context here about the differences between the classic Windows app and the new Electron app, and it requires some understanding of how Windows handles opening files.
Windows app all end up funnelling through
ShellExecuteto ask the OS how to handle a given file. Electron too has support for opening a file in the user's preferred program -shell.openItem(fullPath)andshell.openExternal(url).How
openExternalworks on Windows is important:Notice that
L"open",? This is where the first problem comes in: Windows expects averbtoShellExecuteto hint at what the user wants to do with the file, and Electron currently hard-codesopen.So while
EmEditordoes declare itself as an editor for text files, Electron is only leveraging programs that support opening a given extension. That's the core of the differences between Classic Desktop and Desktop Electron, and why that menu item is currently labelled Open in default program and not Edit in default program.Putting that aside, I tested out installing EmEditor and Desktop and associating it with opening a file extension (in this case
.md). On first usage I got this prompt, which makes sense:So I chose EmEditor and it opened fine. Second time through, I hit this error:
This is our generic error handler when Electron raises an error inside
open-file.ts:desktop/app/src/lib/open-file.ts
Lines 11 to 15 in 2d2feff
That probably needs to be investigated here.
I believe this was working because we set
core.editortogitpadin your config -GitPadbeing a tool that we bundled in Git Shell. We don't have plans to bring Git Shell across to Desktop Electron.zekrom-vale commentedon Jun 29, 2018
It is annoying that "Open in external editor" is not hidden if there is no external editor, cluttering up the context menu. I would think this is easy to check and hide.
shiftkey commentedon Aug 15, 2018
@killerwife in reference to this feature that is no longer set by Desktop Electron:
In Desktop Classic on Windows we set
core.editor=gitpadwhich would launch the default program for editing text files. A while ago the Git for Windows project added the ability to choose the editor from a list of installed tools at install time:This is great for discoverability, but all it does under the hood is set
core.editorto the program and provide the necessary arguments to launch the program and detect when it was closed.Here's what it adds to my test machine's system config for Notepad++:
Desktop isn't really concerned about this flow in the UI (commits are done in the app, rather than launching the editor) so I'm not sure when we'll get to this.
For the moment I'd see if you can add an entry like this to your
~/.gitconfigto address this gap from the old app:I'm not sure if there are any other arguments to add on the end, based on the options available.
shiftkey commentedon Aug 15, 2018
After discussion in #5406 about
1.I've extracted the current details about Desktop's limitations to #5411, and I believe2.should be covered by a config change, so I'm going to close this out because I don't think there's anything more I can do to support EmEditor currently.KirkH420 commentedon Nov 1, 2021