-
Notifications
You must be signed in to change notification settings - Fork 30k
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
a quick implementation, adding "Open with Code" option to Windows 11 explorer's context menu #139640
Conversation
@joaomoreno can you approve the CI workflow please? |
@sbatten @deepak1556 I wonder if all of this is really necessary. |
@joaomoreno seeing as noone else has stepped up to add the functionality, so windows 11 users have lost the ability to right click "open with code" without dropping to the classic menu, then yes, it is. |
@joaomoreno Unfortunately sparse packages really are "insanely complicated". It might help to get someone from the Windows team (@andrewleader, @AdamBraden?) to review the PR and confirm the best way to implement this. |
@strear thank you for this PR. While we acknowledge that this fixes the issue it would introduce a dependency on native code which we would like to avoid. The Windows team has confirmed to us that native code is required here and that adding "Open with Code" is no longer supported using the registry keys. Though we are exploring alternative approaches to this which could potentially reduce the complexity. We will have more details in the next couple of weeks. I will keep you posted here. Thank you! |
any updates @isidorn ? |
Can you record short video? |
strear, thank you for the time and effort you put into finding this solution. Great work! Here are a set of more detailed instructions. Hope this helps.
In my case, I had to copy the entire
To do that, just double-click the
As long as you're not seeing any errors in console, you're probably good -- restart Windows. NOTE: You should probably disable VS Code auto-updating if you want to use this customization. You can disable auto-updating in the settings menu -- find and disable |
Why is this not being merged, it seems to have passed all checks... |
because:
basically, that means: VSCode uses OS functionality and does/will not implement these with a lot of dependencies. But you can implement the PR by yourself the way @phuze has it described or you have to wait for the win11 team. |
@isidorn Thank you for your time looking into this, as some time went by, were you able to find more information on the subject? |
Sorry for the delayed response in this thread, highlights below. Firstly, @strear thanks for your initial work on this issue, it was helpful with leading the explorations and discussions to search for alternates that does not involve a sparse package. On the good news, there is a hint for a less complicated solution that might come from the windows team but there is no concrete timeline. This iteration I have spent some time adopting the sparse package solution accommodating our different release flavors and architectures. Sparse package creation is now delegated to https://github.com/microsoft/vscode-explorer-command since this rarely requires changes and it is unnecessary to be part of every vscode CI run. On the other hand, this repository will be responsible for signing the package and installing it as part of our custom installer. We will finish up the iteration with testing the feature E2E and if testing goes well, it will then be made available with insiders next iteration. I am going to close this PR as part of the above effort, and will ensure it is captured by the release notes. |
This PR fixes #127365
The added code follows the
IExplorerCommand + app identity
method recommended by Windows Blog, which is the minimal code necessary to implement this feature, and has not been integrated into the Inno Setup script. I hope that these codes can be used as an inspiration, and the VS Code developers would find out a sensible way to achieve this feature.The added codes are located at
/build/win32/shell-extension-win11
, including an action handler, a minimal sparse package manifest, build script and setup script.Because these are not integrated into Inno Setup, a manual build process is needed:
Assume that VS2019 with desktop development workload is installed in the working environment.
build.cmd
can make the sparse package and.dll
library file for handling menu actions, which are needed by Windows. It also self-issues a test certificate to sign the sparse package. (This maybe needs to be implemented in a more formal way.)By executing
build.cmd
3 files will be put in the/build/...-win11/Release
directory, namelymenuhandler.dll
,Key.cer
andcode-sparse.appx
. The certificate issuance and signature process will prompt to enter a password for 3 times, just enter the same password.Copy these 3 files with
setup.ps1
to anywhere inside an VS Code installation, and executesetup.ps1
with administrator privileges. After restarting explorer.exe, you can see the option of "Open by Code" in context menus of files and directories.The menu action is handled by C++ code implementing the COM interface, while currently for older versions of Windows this is achieved by the installer to directly write into registry. So the COM implemention directly reads the keys from registry to present the icon and determine the executable file path, to keep it simple and stupid. Perhaps this approach needs further improvement.
Localization has not been implemented yet, but by reading the registry, it should be easy.