-
Notifications
You must be signed in to change notification settings - Fork 283
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
feat(editor): folder drag and drop #2155
Conversation
@@ -183,7 +183,7 @@ type t = | |||
| Pane(Feature_Pane.msg) | |||
| PaneTabClicked(Feature_Pane.pane) | |||
| PaneCloseButtonClicked | |||
| VimDirectoryChanged(string) | |||
| DirectoryChanged(string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I debated whether or not I should add a duplicate variant to distinguish the vim :cd
from other possible directory changes, but looking where this is used, it doesn't seem super specific to vim. Let me know if you think I should change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable - it is more general than Vim!
src/Store/Features.re
Outdated
Noop; | ||
switch (stats.st_kind) { | ||
| S_REG => OpenFileByPath(path, None, None) | ||
| S_DIR => DirectoryChanged(path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I'd expect in this case is that we'd chdir
to change the working directory of the process, too. Dispatching the DirectoryChanged
event tells our internal state the directory is changed, but doesn't actually change the working directory of the process.
We'd probably want to use Luv.Path.chdir
to change the work directory, and then - /~https://github.com/aantron/luv/blob/bb11498de65a2acb56a7269801c1d2ba41672179/src/path.mli#L18 - if that is successful, dispatch the DirectoryChanged
event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the working directory isn't in sync - our file explorer and stuff will show the 'correct' directory, but when running vim commands like :e some/file
it would be relative to the previous directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great point, I hadnt thought of that. Thanks! Will fix now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just fixed in fe2985c!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Thanks for setting up the chdir
👍
/azp run |
As of right now, we only support dropping files onto the editor. This adds the behavior that if you drop a folder/directory onto the editor, it will change the directory in the same way that
:cd x/y/z
changes the directory.