Fix OpenFiles action not respecting use_system_path_prompts setting#47027
Conversation
OpenFiles action not respecting use_system_path_prompts setting
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
Great idea, but why keep the other action handler at all, with this approach?
Also, it seems prompt_and_open_paths is used on CloseWindow — this is also a wrong place to keep the native prompt.
Maybe, the answer is to alter fn prompt_and_open_paths entirely (or remove it and use whatever one works instead)?
02963f1 to
7c0b777
Compare
True, it seems like that global handler isn't ever called with this approach, at least on Linux, I'm not sure about other OS's or if OS would affect that. The same is true for the
Hm, I'm not seeing where this is. I'm only seeing this: zed/crates/workspace/src/workspace.rs Line 621 in 9ef825d
Done. So these two handlers below were removed, since I didn't see how they could be hit since they both now have workspace level handlers and they ignored the users settings. Then just cleaned up the unused zed/crates/workspace/src/workspace.rs Lines 623 to 657 in 9ef825d Let me know if I can do anything more on this, thanks! |
eba094d to
f669ee3
Compare
bfd11fb to
5b47d50
Compare
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
Hm, I'm not seeing where this is.
Right, that part is either gone or I was wrong, sorry — either way it's nothing to worry about now.
Really sorry for confusing you here: the global handler is actually very important for macOs as there, the app can be alive without any UI present onscreen, hence certain commands like "open a file" are expected to work there.
With .register_action only we cannot achieve that, as this way the listener is registered on a particular workspace which is a Window at the same time in Zed, which won't exist at the moment described above.
So, we need a global listener, after all — for that, it should be simple to move the register_action code there.
That presumably now will invoke the code with the modal, right?
The next question is whether that's enough — you mention that the global is not called on Linux at all and that makes sense as on that OS the app exists after its last window is closed.
But, that global handler was shadowed by the local one before — hence, when we remove the local and leave the global only, it presumably should start running?
Otherwise, looks good, we're seem to be close.
|
Gotcha, I think in that case the original approach of having two handlers should work best right? The Thank you for your guidance! |
|
Well, I wish you can think on something yourself instead of forcing me to — this is the whole point of contributions I have thought 🙂 My words are not what you have stated: I think that it's enough to have a global handler only. |
The OpenFiles action was always using the system file picker dialog, ignoring the use_system_path_prompts setting. This adds a workspace-level handler that calls prompt_for_open_path, which respects the setting, instead of falling through to the global handler.
|
After playing around with implementing the single global handler - I do believe the two handler approach to be the correct one and most consistent with how the other ( The two global handlers will never be called on Linux or Windows though AFAIK, so it's essentially macOS only (at least until Zed can run in the background on Linux or Windows). I messed around with wrapping that in I rebased and dropped the last few commits and am sticking with just the initial commit I made for this. |
5b47d50 to
e49e43b
Compare
…stem-prompts-settings
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
I have deduplicated the logic as asked in #47027 (review) and tested on mac (both with and without the window) and Linux — both cases seem to work.
Thank you for spotting, and congrats with the first contribution.
The OpenFiles action was always using the system file picker dialog, ignoring the use_system_path_prompts setting. This adds a workspace-level handler that calls prompt_for_open_path, which respects the setting, instead of falling through to the global handler.
Closes #46386
Release Notes: