CodeEditApp / CodeEdit

📝 CodeEdit App for macOS – Elevate your code editing experience. Open source, free forever.
https://codeedit.app
MIT License
21.12k stars 1.02k forks source link

✨ Setting to hide files and folders from project navigator based on user defined glob patterns #738

Open devmoath opened 2 years ago

devmoath commented 2 years ago

Is your feature request related to a problem? Please describe.

No response

Describe the solution you'd like

Most of the IDEs and code editors hide the .git folder by default, I believe it's a good idea to follow the same behavior in CodeEdit as well.

Describe alternatives you've considered

Well, another way to implement this feature is by categorize the project tree and add ignored folders/hidden folders category which .git folder will be within it.

Additional context

this is what looks like when you open project contains git

CleanShot_2565-09-02_at_13 43 29

Edit by @austincondiff:

As discussed in Discord, we will have something similar to this in VS Code where we can exclude files and folders based on user defined glob patterns.

image

Muhammed9991 commented 2 years ago

Maybe have the folder grayed out? Or have an option which says "Show hidden folders"?

austincondiff commented 2 years ago

@Muhammed9991 I wonder if this should be a separate setting for this like so...

Muhammed9991 commented 2 years ago

I like this idea more. Gives the user more flexibility about which files they want to hide. Especially good for larger projects.

devmoath commented 2 years ago

that's even better, I liked the idea 👍

thecoolwinter commented 2 years ago

Awesome, I said I'd take this on in Discord so I should have a draft PR ready in a couple days 👍

thecoolwinter commented 2 years ago

This is taking me longer than expected, and I'm focusing on editor changes in the text view right now. If anyone wants to take this on DM me on Discord and I can share the resources I have with you on glob patterns, etc.

If no one takes this on by the time I'm done with my other things I'll continue working on this issue.

FastestMolasses commented 1 year ago

Got started working on a component to let the user specify which folders they want to ignore. This is just to get the ball rolling on this issue. Let me know what you guys think, I tried copying the design from the macOS settings menu for lists. (The compression removes the row highlights when the modal is open)

Aug-26-2023 22-30-06

austincondiff commented 11 months ago

@FastestMolasses This looks really good. We are going to need this for #1462 and #1463 as well.

FastestMolasses commented 10 months ago

@austincondiff Hey, just getting back to this! Here's the code written for it. I've placed it in a folder called Components in my branch, not sure where's the best place to put the code.

import SwiftUI

struct ListTableItem: Identifiable {
    let id = UUID()
    var name: String
}

struct ContentView: View {
    @State private var items = [ListTableItem]()
    @State private var showingModal = false
    @State private var selection: ListTableItem.ID?

    var body: some View {
        VStack {
            Table(items, selection: $selection) {
                TableColumn("Items", value: \.name)
            }
        }
        .paneToolbar {
            HStack(spacing: 2) {
                Button {
                    showingModal = true
                } label: {
                    Image(systemName: "plus")
                }

                Divider()
                    .frame(minHeight: 15)

                Button {
                    removeItem()
                } label: {
                    Image(systemName: "minus")
                }
                .disabled(selection == nil)
                .opacity(selection == nil ? 0.5 : 1)
            }
            Spacer()
        }
        .sheet(isPresented: $showingModal) {
            NewListTableItemView { text in
                items.append(ListTableItem(name: text))
                showingModal = false
            }
        }
        .cornerRadius(6)
    }

    private func removeItem() {
        guard let selectedId = selection else { return }
        items.removeAll(where: { $0.id == selectedId })
        selection = nil
    }
}

struct NewListTableItemView: View {
    @State private var text = ""
    var completion: (String) -> Void

    var body: some View {
        VStack {
            Text("Enter new item name")
            TextField("Name", text: $text)
                .textFieldStyle(.roundedBorder)
            Button("Add") {
                if !text.isEmpty {
                    completion(text)
                }
            }
        }
        .padding()
    }
}

struct ListTablePreview: PreviewProvider {
    static var previews: some View {
        ContentView()
            .environmentObject(DebugAreaTabViewModel())
    }
}
austincondiff commented 2 months ago

@FastestMolasses Is this one complete?