-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Files panel drag and drop support #7386
Comments
We can enable external file drag and drop with diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs
index 413d42255..bdeb2780e 100644
--- a/crates/project_panel/src/project_panel.rs
+++ b/crates/project_panel/src/project_panel.rs
@@ -11,10 +11,10 @@ use anyhow::{anyhow, Result};
use collections::{hash_map, HashMap};
use gpui::{
actions, div, overlay, px, uniform_list, Action, AppContext, AssetSource, AsyncWindowContext,
- ClipboardItem, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, InteractiveElement,
- KeyContext, Model, MouseButton, MouseDownEvent, ParentElement, Pixels, Point, PromptLevel,
- Render, Stateful, Styled, Subscription, Task, UniformListScrollHandle, View, ViewContext,
- VisualContext as _, WeakView, WindowContext,
+ ClipboardItem, DismissEvent, Div, EventEmitter, ExternalPaths, FocusHandle, FocusableView,
+ InteractiveElement, KeyContext, Model, MouseButton, MouseDownEvent, ParentElement, Pixels,
+ Point, PromptLevel, Render, Stateful, Styled, Subscription, Task, UniformListScrollHandle,
+ View, ViewContext, VisualContext as _, WeakView, WindowContext,
};
use menu::{Confirm, SelectNext, SelectPrev};
use project::{
@@ -1556,6 +1556,15 @@ impl ProjectPanel {
let depth = details.depth;
div()
.id(entry_id.to_proto() as usize)
+ .drag_over(|style, _: &ExternalPaths, cx| {
+ style.bg(cx.theme().colors().drop_target_background)
+ })
+ .on_drop(
+ cx.listener(move |project_panel, external_paths: &ExternalPaths, cx| {
+ dbg!("Dropped on entry", external_paths, entry_id);
+ cx.stop_propagation();
+ }),
+ )
.on_drag(entry_id, move |entry_id, cx| {
cx.new_view(|_| DraggedProjectEntryView {
details: details.clone(),
@@ -1748,6 +1757,15 @@ impl Render for ProjectPanel {
})),
)
}
+ .drag_over(|style, _: &ExternalPaths, cx| {
+ style.bg(cx.theme().colors().drop_target_background)
+ })
+ .on_drop(
+ cx.listener(move |project_panel, external_paths: &ExternalPaths, cx| {
+ dbg!("Empty panel space drop", external_paths);
+ }),
+ )
}
}
change, note After that, we have to decide what to do with the file or directory: the code should be similar to We might want to open files dropped this way in the editor. |
This should also enable drag'dropping a file to either the internal or an external terminal to reference the file path there. |
Partially addresses #7386 https://github.com/zed-industries/zed/assets/53836821/fc2e9864-40a8-4ada-ac95-a76a31c44437 Release Notes: - Added support for dropping files from the finder onto the project panel
Partially addresses zed-industries#7386 https://github.com/zed-industries/zed/assets/53836821/fc2e9864-40a8-4ada-ac95-a76a31c44437 Release Notes: - Added support for dropping files from the finder onto the project panel
Bennet just landed a PR to address allow for dragging and dropping into the project panel, which feels like the bigger feature here. Let's close this issue out - if there is interest in dragging out of the project panel and into the system, let's open a new issue for users to vote on. |
Partially addresses zed-industries#7386 https://github.com/zed-industries/zed/assets/53836821/fc2e9864-40a8-4ada-ac95-a76a31c44437 Release Notes: - Added support for dropping files from the finder onto the project panel
Check for existing issues
Describe the feature
Add support to drop a file from Finder to the project's file panel and vice-versa.
If applicable, add mockups / screenshots to help present your vision of the feature
No response
The text was updated successfully, but these errors were encountered: