Verified Solution[microsoft/vscode] "Open with Code" missing from context menu in latest version
Sponsored Content
### ROOT CAUSE
The "Open with Code" context menu entry was missing for folders due to a regression introduced in version 1.110.1. The issue is similar to #260419, which was fixed, but it appears the fix inadvertently broke the folder functionality. The context menu entry for folders relies on a specific condition that was altered or removed, causing the entry to disappear for folders while still appearing for files.
### CODE FIX
To restore the "Open with Code" context menu entry for folders, the condition in the context menu contribution must be corrected to include folders. Here's the fix:
```typescript
// In the file `vs/workbench/contrib/open/browser/open.contribution.ts` or similar location, ensure the condition for the context menu entry includes folders.
// Change the condition from `explorerTreeElementIsFile` to `explorerTreeElementIsFile || explorerTreeElementIsFolder`.
// Example fix (pseudo-code):
const menuEntries = [
// ... other entries ...
{
command: 'vscode.openWithCode',
group: 'navigation',
order: 10,
when: 'explorerTreeElementIsFile || explorerTreeElementIsFolder' // Ensure this condition is used
}
];
```
This change ensures the context menu entry is shown for both files and folders. Apply this fix to the relevant part of the VS Code source code and rebuild the extension host.
Deploy on DigitalOcean ($200 Credit)
Related Fixes
[facebook/react] [Compiler Bug]: false negative, compiler skips memoizing a variable that should be memoized
[StackOverflow/go] golang POST image and text field with multipart/form-data
[StackOverflow/reactjs] Webpack - TypeError: $ is not a function