Skip to content

Conversation

@bobicloudvision
Copy link

Summary

Adds "Open in Default IDE/Editor" across the editor, enabling users to open files and project directories in their preferred IDE or the system default editor. Implements detection for VS Code, Cursor, Sublime Text, PhpStorm, WebStorm, and IntelliJ IDEA, trying available options in priority order. Also updates double-click to open files in the default editor.

Changes Made

External Editor Support for Files

  • Added "Open" context menu item in the assets browser to open files with the OS default application
  • Updated double-click behavior to open files in the default editor instead of no action
  • Implemented IPC handler editor:open-with that uses Electron's shell.openPath() to respect OS file associations
  • Moved "Show in Finder/Explorer" below the "Open" option in the context menu

Default IDE Detection and Integration

  • Implemented IDE detection that checks for available command-line tools (VS Code, Cursor, Sublime Text)
  • Added support for JetBrains IDEs (PhpStorm, WebStorm, IntelliJ IDEA) on macOS and Windows
  • Created priority-based IDE selection system that tries IDEs in order: VS Code → Cursor → Sublime Text → PhpStorm → WebStorm → IntelliJ IDEA
  • Implemented fallback to system default application if no IDE is found

UI Integration

  • Added "Open in Default IDE" menu item in the File menu (before "Open in Visual Studio Code")
  • Added "Open in Default IDE" option in the toolbar menu bar
  • Added "Open in Default IDE" option in dashboard project item context and dropdown menus
  • Maintained existing "Open in Visual Studio Code" functionality for explicit VS Code usage

Technical Implementation

  • Created openInIde() function in shell.ts that detects file vs directory and handles each appropriately
  • Added checkCommandAvailable() helper function to verify IDE command-line tools are installed
  • Implemented platform-specific handling for macOS (open -a) and Windows (CLI commands)
  • Added proper error handling and fallback mechanisms

Benefits

  • Improves workflow by allowing users to quickly open files and projects in their preferred editor
  • Reduces friction by automatically detecting and using available IDEs without manual configuration
  • Supports multiple IDEs with smart detection, accommodating different preferences
  • Consistent behavior across context menus, toolbar, and dashboard for predictable usage
  • Better UX for file operations with double-click opening in the default editor
  • Backward compatible: existing "Open in Visual Studio Code" remains available for explicit usage

shell.openPath(item);
});

async function checkCommandAvailable(command: string): Promise<boolean> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to put it in src/tools/process.ts

});
}

async function openInIde(path: string, isDirectory: boolean): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to put it in src/tools/ide.ts which doesn't exist yet.
This one I'll have to test on each platform. Is it an output from Claude?

for (const ide of ideCommands) {
if (await checkCommandAvailable(ide.command)) {
const fullCommand = `${ide.command} "${normalizedPath}"`;
exec(fullCommand, (error) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using exec means the IDE process will be attached to the electron one (or am I wrong?)
If it is attached, I suggest to use node-pty in order to run the command outside of the current process like I did for VSCode so the IDE keeps opened even if the user closes the editor


// On macOS, try JetBrains IDEs (PhpStorm, WebStorm, IntelliJ IDEA)
if (platform() === "darwin") {
exec(`open -a "PhpStorm" "${normalizedPath}"`, (error) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use the same method than the part // Try each IDE in order in line 53

{
type: "separator",
},
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could replace "Open in Visual Studio"


<ContextMenuItem className="flex items-center gap-2" onClick={() => ipcRenderer.send("editor:show-item", this.props.absolutePath)}>
<ImFinder className="w-4 h-4" /> {`Show in ${isDarwin ? "Finder" : "Explorer"}`}
{`Show in ${isDarwin ? "Finder" : "Explorer"}`}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the import of "ImFinder " then to fix the lint issue

@julien-moreau
Copy link
Contributor

@bobicloudvision any news ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants