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

VSCode not to associate itself with any file type unless the user chooses so during installation #8687

Closed
darkred opened this Issue Jul 3, 2016 · 20 comments

Comments

Projects
None yet
@darkred
Copy link

darkred commented Jul 3, 2016

  • VSCode Version: 1.2.1
  • OS Version: win10 x64

Steps to Reproduce:

  1. Install VSCode
  2. Open Control Panel > Control Panel Home > Default Programs > Assosiate a file type or protocol with a specific program:
    you'll notice that a hundred file types (in fact 101 !) are now associated with VSCode (screenshot 1).
    There was no such option to opt in during the installation (screenshot 2)
    neither there's a way to remove the file associations inside the program preferences.
    The only way remove the file associations is to uninstall VSCode altogether.

For reference, all other editors that I have installed: Sublime Text, Atom, Notepad++, gVim, UltraEdit
don't associate themselves with any file type.


So, my suggestion:
VSCode not to associate itself with any file extension unless the user chooses so during installation.
Even better, to be able to configure file type associations with VSCode (enable/disable each one) , inside the program's preferences.

@Tyriar

This comment has been minimized.

Copy link
Member

Tyriar commented Jul 3, 2016

I think there's already a checkbox on the installer for this. It's checked by default though, it should probably be opt-in.

@darkred

This comment has been minimized.

Copy link
Author

darkred commented Jul 3, 2016

No, there's no such checkbox. Please check screenshot 2 from my 1st post, and the attached video capture of the install procedure: Video_2016-07-03_235157.zip.

@joaomoreno joaomoreno added this to the July 2016 milestone Jul 4, 2016

@joaomoreno joaomoreno added the bug label Jul 4, 2016

@joaomoreno

This comment has been minimized.

Copy link
Member

joaomoreno commented Jul 4, 2016

My belief is that Code doesn't associate itself automatically, but simply registers as a possible editor for such files. Will investigate this in July, since many people complain.

@darkred

This comment has been minimized.

Copy link
Author

darkred commented Jul 5, 2016

No, that's not the case.
Installer doesn't just add Code as an extra entry in windows explorer's rightclick|Open with menu for these file extensions:
2016-07-04_183804

I created various empty files with random extensions from my screenshot 1
and all are associated with Code :
2016-07-04_184313
In other words, doubleclicking any of these files, opens them in Code.

@joaomoreno

This comment has been minimized.

Copy link
Member

joaomoreno commented Jul 5, 2016

Yes, but did you have any other application that was able to open those files before you installed Code? It makes sense that Windows picked Code to be the default if Code is the only one.

@darkred darkred closed this Jul 5, 2016

@darkred

This comment has been minimized.

Copy link
Author

darkred commented Jul 5, 2016

(sorry, accidentally closed the issue)

I noticed two cases:

  • The .js files would open with Microsoft Windows Based Script Host (a windows component, it's by default).
    After installing Code they become assosiated with Code.
  • On the other hand, .sh files would open with Git for Windows.
    After installing Code they remain associated with Git.

@darkred darkred reopened this Jul 5, 2016

@joaomoreno

This comment has been minimized.

Copy link
Member

joaomoreno commented Jul 5, 2016

Got it, thanks for the info! I will attempt to reproduce on a brand new Windows box, see what we can do.

@joaomoreno

This comment has been minimized.

Copy link
Member

joaomoreno commented Jul 21, 2016

Investigation

VSCode simply registers itself as an application suitable to open a variety of file types, through the use of the HKEY_CLASSES_ROOT registry subtree. Every time an application adds itself as one able to handle a file type, Windows will do the following:

  • If the file type itself doesn't have an application association set by the user, it will pick VS Code since it is the only alternative available.
  • Otherwise, it will not overwrite the association.

The exception to the rule seems to be files like *.js which seem to respect some strange magic which I don't understand: they seem to be inherently associated with the Microsoft Windows Based Script Host through some other mechanism. As no one in their sane mind would actually expect to double click a .js file to run it in 2016, I'll let this slip. There may be others, but so far this is the one.

In conclusion, Code is doing the right thing, no change there.

The Rabbit Hole goes deeper

I've decided to experiment a bit more to find out how this works.

In a brand new VM, I installed Notepad++, created the following 4 files and associated *.config files to open with Notepad++.

image

Note that:

  • *.txt files are associated with Notepad.
  • *.sh files are not associated with any application, since there is no suitable application that can handle them.
  • *.js files are associated with the pesky Microsoft Windows Based Script Host.
  • *.config files are associated with Notepad++.

After, I installed the latest Insiders setup:

image

Everything is the same. Wait, what..? But Code did get registered to a few file extensions. Why?

image

After investigating why that is, it happens to be the PersistentHandler registry key. That seems to be the difference between *.sh and *.aspx files for example:

image

image

All the file extensions that were correctly associated with Code have this PersistentHandler set to some GUID, which was already there before Code's installation. I failed to understand where PersistentHandler comes from, and what its value actually means.

I stopped at this point, since I can think of more productive ways to spend my time.

Conclusion

I've added a checkbox during setup which will let users skip file associations: Register Code as an editor for supported file types.

@dbaeumer This is a new string that needs to be localised. The key is AssociateWithFiles, in build\win32\i18n\messages.en.isl.

@joaomoreno joaomoreno assigned dbaeumer and unassigned joaomoreno Jul 21, 2016

@chrmarti chrmarti added the verified label Jul 28, 2016

@DarkNami

This comment has been minimized.

Copy link

DarkNami commented Aug 19, 2016

VSCode Version: 1.4.0
OS Version: Win7 x64

After installing Visual Code, I don't know which file is .gitattributes, and which file is .gitignore ...
filename

although I added 'AlwaysShowExt' in filetype, but not working...
regedit

@dbaeumer dbaeumer assigned joaomoreno and unassigned dbaeumer Aug 19, 2016

@dbaeumer

This comment has been minimized.

Copy link
Member

dbaeumer commented Aug 19, 2016

Assigning back to @joaomoreno to react to comments.

@joaomoreno

This comment has been minimized.

Copy link
Member

joaomoreno commented Aug 19, 2016

@DarkNami

This comment has been minimized.

Copy link

DarkNami commented Aug 19, 2016

I uninstall and re-install again, uncheck "Register Code as an editor supported file types", it is ok now.
2016-8-19 16-44-29

If I update from previous version (1.2.x), installer will associate filetypes.

Thanks.

@joaomoreno

This comment has been minimized.

Copy link
Member

joaomoreno commented Aug 19, 2016

Thank you!

@laggingreflex

This comment has been minimized.

Copy link

laggingreflex commented Oct 14, 2016

Please add more options to set VSCode as default code editor, specially when switching from Sublime Text.

Like in Control Panel\Programs\Default Programs\Set Default Programs

@cretace

This comment has been minimized.

Copy link

cretace commented Apr 27, 2017

That box needs to spell out what it is going to do and it should show every association so we can untick ones we don't want. It is worded too vaguely.
The install removed my previously set up editor associations - they no longer appear under "open with". Very annoying.

@trueneu

This comment has been minimized.

Copy link

trueneu commented Aug 10, 2017

...and it associates itself automatically with each and every file type it knows how to open on macOS. I love how VS Code thinks it is the only editor on my computer, but that's not the case.

@billinghamj

This comment has been minimized.

Copy link

billinghamj commented Nov 6, 2017

How do I undo VSCode's damage on my Mac?

@rymcol

This comment has been minimized.

Copy link

rymcol commented Nov 15, 2017

I still have this issue with macOS as well

@mifi

This comment has been minimized.

Copy link

mifi commented Nov 16, 2017

Solution: Delete VSCode or move it away from /Applications

@billinghamj

This comment has been minimized.

Copy link

billinghamj commented Nov 16, 2017

Yeah in the end I just deleted it and switched back to Sublime Text

@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.
You can’t perform that action at this time.