zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
47.94k stars 2.83k forks source link

Collapse folder in file explorer discoverability #6880

Open balaji-sivasakthi opened 8 months ago

balaji-sivasakthi commented 8 months ago

Check for existing issues

Describe the feature

When I've big file tree, I need to close the all the opened child directories, this feature really helps when it comes to handy.

If applicable, add mockups / screenshots to help present your vision of the feature

Screenshot 2024-01-27 at 9 51 02 PM
d1y commented 8 months ago

Is this what you're talking about?

{
  "context": "ProjectPanel && not_editing",
  "bindings": {
    "m": "project_panel::CollapseAllEntries"
  }
}

hhh

balaji-sivasakthi commented 8 months ago

Yes, @d1y

itsmewes commented 8 months ago

This is great, would be nice to have an option to only close the children of the folder that is currently active. So if we have the below file structure where all folders are open and Folder 1 is selected in the side panel, running a collapse command on it would only collapse Folder 1 and Folder 1.2 but would leave Folder 2 and it's children open.

Project

project_panel::CollapseAllEntries fixes 99% of my use cases but it is nice to have the above functionality as well if possible one day 😊

TheGlorySaint commented 8 months ago

I'd love to see not only having a Key bind to close the Folders, but also to have a Icon to do it.

orbiteleven commented 8 months ago

Yeah, it's like there needs to be an option like project_panel::CollapseAllEntries but only for the selected folder and down, so like project_panel::CollapseAllEntriesBelowSelection or something.

gh0stonio commented 7 months ago

Yeah, it's like there needs to be an option like project_panel::CollapseAllEntries but only for the selected folder and down, so like project_panel::CollapseAllEntriesBelowSelection or something.

Agree with this. Having an option to be able to collapse a section using a Cmd+click like on VsCode could be really useful.

edtorba commented 7 months ago

I'd love to see not only having a Key bind to close the Folders, but also to have a Icon to do it.

+1

segersniels commented 7 months ago

Yeah definitely would love to have a button to collapse my entire directory tree. Especially helpful in big monorepos where you need to navigate between workspaces frequently.

tomatau commented 6 months ago

Is it possible to trigger this action from inside the editor pane? Right now I need to be focused in the LeftDock for this command to work

AdamSchinzel commented 6 months ago

That would be very nice, I use it every day.

cabaucom376 commented 5 months ago

Im not sure if there's a better issue to comment on, but support for option + clicking folders in the explorer to toggle nested folders expansion state would be an amazing quality of life improvement.

https://github.com/zed-industries/zed/assets/104145051/936d0a2b-e1fc-4687-b56d-4389ce4e9400

JosephTLyons commented 4 months ago

Are we able to close this issue @balaji-sivasakthi? It seems like @d1y gave you a snippet that works for you? Or is there something else we need to do here? As for the follow-up requests - let's open new issues for those so that we can track interest on those items individually.

edtorba commented 4 months ago

Are we able to close this issue @balaji-sivasakthi? It seems like @d1y gave you a snippet that works for you? Or is there something else we need to do here? As for the follow-up requests - let's open new issues for those so that we can track interest on those items individually.

Adding the actual icon as shown in the screenshot would be nice. To be honest, many people won't find this issue and won't know about the key binding, imo.

balaji-sivasakthi commented 4 months ago

@JosephTLyons Yeah, key binding will work, but how will a new user realize that? Whether they search for this issue again or not, I think some people raise this issue often. So, my point of view is to bring that icon back, which will be more appropriate.

JosephTLyons commented 4 months ago

@JosephTLyons Yeah, key binding will work, but how will a new user realize that? Whether they search for this issue again or not, I think some people raise this issue often. So, my point of view is to bring that icon back, which will be more appropriate.

Point noted - I rebranded this issue to be a discoverability issue and will leave it open.

sant123 commented 2 months ago

I have created this keymap but only works when focusing the project panel.

{
    "context": "ProjectPanel",
    "bindings": {
      "ctrl-alt-m": "project_panel::CollapseAllEntries"
    }
  }

Can this work anywhere?

Edit:

I have tried this but does not work either:

{
    "context": "Workspace",
    "bindings": {
      "ctrl-alt-m": "project_panel::CollapseAllEntries"
    }
  }
jerryjappinen commented 2 months ago

Some common patterns from other apps (I've synced this behavior across design apps and code editors):

The former is, in my opinion, a no-brainer addition that doesn't come in the way anywhere else, and common behavior across apps. The latter, I guess, is already possible in key bindings - but I wasn't able to get it working.

onx2 commented 2 months ago

Closing folders within the folder you close is the default behavior IIRC in JetBrains Rider. I really like that behavior and +1 the option to have it in Zed since I'm trying to make it my primary IDE. 😄

Close folder1

Open folder1

^^ closing folder1 would also close subfolder1, so when opening folder1 back up the subfolder1 remains closed.

A settings option would be great:

"project_panel": {
    // ... others
    "auto_close_subdirs": false // boolean - false by default for backward compat
}