Skip to content

VSCode is not set as default editor #1795

Closed
@ungps

Description

@ungps

Hello,

While writing this, I managed to find the problem (check "P.S").

My setup:

$ git --version --build-options
git version 2.18.0.windows.1
cpu: x86_64
built from commit: cd1a74fc9dc8a07626c216940db9a51f25206e03
sizeof-long: 4
cmd.exe /c ver
Microsoft Windows [Version 6.3.9600]
Editor Option: VisualStudioCode
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled

I was trying to add SublimeText and Atom in the list of possible default editors in Git-For-Windows installer. So, I implemented them, made an installer and tried to test it, but it didn't work (by "didn't work" I mean that it installed successfully, both Sublime and Atom could be selected, but neither one of them were added as default editor)... So, I started debugging, although everything seemed alright.

So:

  • I installed Notepad++ and Git-For-Windows (using the official installer) with Notepad++ as default editor. This worked fine.
  • I installed Git-For-Windows (using the official installer) with Nano as default editor. This also worked.
  • I installed Git-For-Windows (using the official installer) with VSCode as default editor. This did not work. By "did not work" I mean that it installed, but VSCode was not the default editor. I looked in the git system configuration file and, indeed, "code.editor" was not set.

P.S: I just looked one more time through registry and observed that:

  • Data of HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\notepad++.exe is:
    C:\Program Files (x86)\Notepad++\notepad++.exe

  • Data of HKLM\SOFTWARE\Classes\Applications\Code.exe\shell\open\command is:
    "C:\Program Files\Microsoft VS Code\Code.exe" "%1"

"%1" is removed from the string at line 1135, but the " at the beginning and at the end of the line are not removed at all. I fixed this, compiled it and now it works. I am going to send a fix for this. I guess that putting your thoughts into words helps debugging. 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions