Skip to content

Conversation

sergiou87
Copy link
Member

@sergiou87 sergiou87 commented Jul 11, 2024

Closes #5083
Closes https://github.com/github/desktop/issues/830

Description

This PR adds support for custom editors and shells. This feature allows users to select a custom editor or shell to open repositories in. The user can choose from a list of predefined editors and shells or specify a custom editor or shell. The user can also specify command line arguments to pass to the custom editor or shell when opening a repository.

In order to parse command line arguments following Windows rules, this PR includes a new internal/private node addon which uses the Windows CommandLineToArgvW API, while the addon string-to-argv is used for the same purpose on UNIX-based systems.

In an upcoming PR, we will revisit how and when changes in preferences are validated: both when switching to a different section in preferences and when clicking on the Save button.

Until then, these changes are feature flagged to development builds only.

Screenshots

image

image

image

image

image

Release notes

Notes: [New] Add support for custom editors and shells

@sergiou87
Copy link
Member Author

@tsvetilian-ty it seems I made a mistake with string-to-argv: I looked at several options, but it still took a few weeks until I actually added the dependency to the project and confused string-argv with string-to-argv 🤦‍♂️

I will fix it, thank you again, nice catch! 🙏

sergiou87 and others added 4 commits July 29, 2024 11:54
Co-Authored-By: Tsvetilian Yankov <9341546+tsvetilian-ty@users.noreply.github.com>
Co-Authored-By: Tsvetilian Yankov <9341546+tsvetilian-ty@users.noreply.github.com>
@sergiou87 sergiou87 requested a review from tidy-dev July 29, 2024 11:11
Copy link
Contributor

@tidy-dev tidy-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ This is amazing work!

Since you already added the suggested next editor bit ✨, my only thought while using it was that the menu items that say "Open in External Editor" or "Open in Shell" should say "Open in Custom Editor" and "Open in Custom Shell" for a higher signal that I am using what I set up or just so I know what I am going to open. Even better let users provide a reference name like we do for provided editors (I know.. that form is already too crowded.. :/ but I think it would make the experience a bit nicer). If you think this is worth exploring, it would just make a nice iteration (not a must have for this PR)

@sergiou87
Copy link
Member Author

I will take a look in a different PR, but it sounds good, thank you!!

@Cedric-Ab
Copy link

How would one know what variables are available?

@steveward
Copy link
Contributor

How would one know what variables are available?

That would depend on the editor, but you would want to look at their documentation. For instance, Unity has a list of arguments available:

https://docs.unity3d.com/Manual/EditorCommandLineArguments.html

@Cedric-Ab
Copy link

How would one know what variables are available?

That would depend on the editor, but you would want to look at their documentation. For instance, Unity has a list of arguments available:

https://docs.unity3d.com/Manual/EditorCommandLineArguments.html

My question is more if GitHub Desktop got the ability to Hove more variables than the path?

skclabs

This comment was marked as spam.

@Coinsintegrity
Copy link

Closes #5083 Closes https://github.com/github/desktop/issues/830

Description

This PR adds support for custom editors and shells. This feature allows users to select a custom editor or shell to open repositories in. The user can choose from a list of predefined editors and shells or specify a custom editor or shell. The user can also specify command line arguments to pass to the custom editor or shell when opening a repository.

In order to parse command line arguments following Windows rules, this PR includes a new internal/private node addon which uses the Windows CommandLineToArgvW API, while the addon string-to-argv is used for the same purpose on UNIX-based systems.

In an upcoming PR, we will revisit how and when changes in preferences are validated: both when switching to a different section in preferences and when clicking on the Save button.

Until then, these changes are feature flagged to development builds only.

Screenshots

image

image

image

image

image

Release notes

Notes: [New] Add support for custom editors and shells

https://github.com/desktop/desktop/pull/18954#issue-2402771183/mairo1504@gmail.com

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.

Allow adding custom editor commands as "External Editor" option
8 participants