Skip to content
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

Custom file association breaks VSCode command line registry entry. #13919

Closed
milkergy opened this issue Oct 18, 2016 · 20 comments
Closed

Custom file association breaks VSCode command line registry entry. #13919

milkergy opened this issue Oct 18, 2016 · 20 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded windows VS Code on Windows issues
Milestone

Comments

@milkergy
Copy link

  • VSCode Version: 1.6, 1.6.1
  • OS Version: MS Windows 7 Enterprise SP1

Steps to Reproduce:

  1. Install the latest stable VSCode 1.6.1
  2. Check

HKEY_CLASSES_ROOT\vscode\shell\open\command

registry entry, it should say:

"C:\Program Files (x86)\Microsoft VS Code\Code.exe" "%1"

  1. Add a custom file association that has a VSCode entry in:

HKEY_CLASSES_ROOT\*.custom\OpenWithProgids

  1. Try and open a **.custom* file. It should open fine.
  2. Close VSCode
  3. CheckHKEY_CLASSES_ROOT\vscode\shell\open\command, it now says:

"C:\Program Files (x86)\Microsoft VS Code\Code.exe" --open-url "%1"

--open-url option does not work on Windows, double-clicking your *.custom files opens VSCode, but the file's not opened.

@roblourens roblourens added the windows VS Code on Windows issues label Oct 18, 2016
@joaomoreno joaomoreno added bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority labels Oct 20, 2016
@joaomoreno joaomoreno added this to the October 2016 milestone Oct 20, 2016
@joaomoreno
Copy link
Member

Damn it, nice catch @milkergy!

@bpasero
Copy link
Member

bpasero commented Oct 28, 2016

I verified that for an unknown file extension I can associate VS Code from the "Open With" dialog and that it opens the file with VS Code. I did not follow the exact steps in the description because I think our users will not go into the windows registry and change something there.

@bpasero bpasero added the verified Verification succeeded label Oct 28, 2016
@joaomoreno
Copy link
Member

joaomoreno commented Oct 28, 2016

@bpasero This wasn't about users manually editing the registry. The URL handling feature from Electron broke the registry that our Setup created. The fix was to rename that registry key in our setup. This only reproduces in Stable though, not in Insiders.

@bpasero
Copy link
Member

bpasero commented Oct 28, 2016

Ah ok, then I did not verify correctly.

@bpasero bpasero removed the verified Verification succeeded label Oct 28, 2016
@pmcoz
Copy link

pmcoz commented Dec 3, 2016

Has this really been fixed? In 1.7.2 in Windows 7, I reset the .txt file association (by removing --open-url in the relevant registry entry), and on double-clicking a .txt file it opens correctly—but only once! Having opened the file, VS Code seems to put the --open-url back into the registry, which prevents the .txt file from being opened the same way again. VS Code should either accept the --open-url parameter, or not write it to the registry.

@milkergy
Copy link
Author

milkergy commented Dec 4, 2016

Yeah, I can confirm that the behavior stayed the same in the latest release version.

@joaomoreno
Copy link
Member

@pmcoz @milkergy Try a full uninstall/install, it should be fixed.

@pmcoz
Copy link

pmcoz commented Dec 5, 2016

@joaomoreno Just tried that; no change. Before running VS Code, I set HKEY_CLASSES_ROOT\vscode\shell\open\command to "C:\Program Files (x86)\VS Code\Code.exe" "%1". After running VS Code, VS Code has changed the value to "C:\Program Files (x86)\VS Code\Code.exe" --open-url "%1".

@joaomoreno
Copy link
Member

joaomoreno commented Dec 6, 2016

What's the value of HKEY_CLASSES_ROOT\vscodeSourceFile\shell\open\command? That is the key that should be used in your machine.

@pmcoz
Copy link

pmcoz commented Dec 6, 2016

There is no HKEY_CLASSES_ROOT\vscodeSourceFile key.

There is, however, HKEY_CLASSES_ROOT\vscode\shell\open\command, which is "C:\Program Files (x86)\VS Code\Code.exe" --open-url "%1".

I would have thought that the problem is the insertion of --open-url that VS Code can't subsequently understand (on Windows).

I note that the VS Code uninstallation does not remove its AppData files; maybe it doesn't clean up the registry either. Ergo, perhaps vestiges of the previous behavior can survive uninstallation.

@joaomoreno
Copy link
Member

@pmcoz 1.7.2 should've inserted that key when updated... I verified that myself. If you reinstall the setup, does it come up?

@pmcoz
Copy link

pmcoz commented Dec 7, 2016

I uninstalled, then reinstalled via the setup file. No key. Perhaps the setup is seeing one of the old keys and is then bailing out of updating the registry. I'll try to delete all the old VS Code keys before installing again.

@joaomoreno
Copy link
Member

That's so strange, as I consistently see the keys. This is 1.7.2 right?

@pmcoz
Copy link

pmcoz commented Dec 8, 2016

Yes, 1.7.2. I also installed on a second Windows 7 machine, and that key wasn't created.

Perhaps HKEY_CLASSES_ROOT\vscodeSourceFile is only created if using one or more of the file association options available in the installer. I deselect all of those since I prefer greater control. I'm reticent to see what happens when they're selected because I'm not confident of being able to roll back.

I gather this makes me dependent on HKEY_CLASSES_ROOT\vscode\shell\open\command.

I can probably work around this by associating files with a .BAT that calls code.exe.

@joaomoreno
Copy link
Member

Perhaps HKEY_CLASSES_ROOT\vscodeSourceFile is only created if using one or more of the file association options available in the installer.

Good catch, that's exactly it! I'll push a fix to always add it regardless of that checkbox. 👍

@joaomoreno joaomoreno reopened this Dec 9, 2016
@joaomoreno joaomoreno added this to the November 2016 milestone Dec 9, 2016
@joaomoreno joaomoreno removed this from the October 2016 milestone Dec 9, 2016
@joaomoreno joaomoreno removed the important Issue identified as high-priority label Dec 9, 2016
@chrmarti
Copy link
Contributor

chrmarti commented Dec 9, 2016

Verified that:

  • "C:\Program Files (x86)\Microsoft VS Code Insiders\Code - Insiders.exe" "%1" is added when the checkboxes are unchecked during install
  • I can associate a custom file extension and such files are then opened in VSCode
  • The above registry entry stays the same after opening/closing VSCode

Marking verified.

@chrmarti chrmarti added the verified Verification succeeded label Dec 9, 2016
@pmcoz
Copy link

pmcoz commented Dec 9, 2016

@joaomoreno Outstanding! I'm very pleased to have been able to help.

Thank you for persevering with this issue. :)

@joaomoreno
Copy link
Member

@pmcoz No, thank you for your persistence! 👍

@vineykhera
Copy link

Getting this same issue while installing VS code 1.13 and 1.14 on windows 10

HKEY_classes_root\vscode source file\shell\open\command

how to resolve this?

@gstamac
Copy link

gstamac commented Aug 22, 2017

Same here.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded windows VS Code on Windows issues
Projects
None yet
Development

No branches or pull requests

8 participants