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

Drag and Drop External Files to Open in Editor #2000

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

austincondiff
Copy link
Collaborator

@austincondiff austincondiff commented Feb 27, 2025

Description

Added support for opening files by dragging and dropping them onto the editor area. Users can now:

  • Drag files from Finder or other apps directly into CodeEdit
  • Drop files onto a specific editor in a split layout to open them in that editor
  • Drop files anywhere in the workspace to open them in the active editor

Implementation Details

  • Added drag & drop handlers to both the workspace view and individual editor areas
  • When dropping on a specific editor:
    • Opens the file in that editor
    • Makes that editor active/focused
    • Brings the window to front
  • Uses NSApp.activate() to ensure proper window focus when dragging from other applications

Related Issues

Checklist

  • Dragging a file onto an empty editor
  • Dragging a file onto an editor that already has files open
  • Dragging multiple files at once
  • Dragging files from Finder while CodeEdit is in the background
  • Dragging files onto different editors in a split layout
  • Dragging files onto the general workspace area
  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

Screen.Recording.2025-02-27.at.11.24.27.AM.mov
Screen.Recording.2025-02-27.at.11.31.23.AM.mov

…tor within any open workspace window to open them in that editor.
Copy link
Member

@tom-ludwig tom-ludwig left a comment

Choose a reason for hiding this comment

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

Not sure why, but dropping a file seems to freeze the tab bar.

@austincondiff
Copy link
Collaborator Author

@tom-ludwig That is not caused by this PR. It is a known issue caused in the latest macOS build.

@tom-ludwig
Copy link
Member

Alright, I’ll take your word for it 😉

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.

✨ Dragging file into a new window should open it
3 participants