Repository: CodeEditApp/CodeEdit
File: CodeEdit/Features/WindowCommands/FileCommands.swift (Swift)

Code before:
    var body: some Commands {
        CommandGroup(replacing: .newItem) {
            Group {
                Button("New") {
                    NSDocumentController.shared.newDocument(nil)
                }
                .keyboardShortcut("n")

                Button("Open...") {
                    NSDocumentController.shared.openDocument(nil)
                }
                .keyboardShortcut("o")

                // Leave this empty, is done through a hidden API in WindowCommands/Utils/CommandsFixes.swift
                // This can't be done in SwiftUI Commands yet, as they don't support images in menu items.
                Menu("Open Recent") {}

                Button("Open Quickly") {
                    NSApp.sendAction(#selector(CodeEditWindowController.openQuickly(_:)), to: nil, from: nil)
                }
                .keyboardShortcut("o", modifiers: [.command, .shift])
            }
        }

        CommandGroup(replacing: .saveItem) {
            Button("Close Editor") {
                NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
            }
            .keyboardShortcut("w", modifiers: [.control, .shift, .command])

            Button("Close Window") {

            }
            .keyboardShortcut("w", modifiers: [.shift, .command])

            Button("Close Workspace") {

            }
            .keyboardShortcut("w", modifiers: [.control, .option, .command])

            if let debugAreaViewModel {
                Button("Close Terminal") {
                    debugAreaViewModel.removeTerminals(debugAreaViewModel.selectedTerminals)
                }
                .keyboardShortcut(.delete)
            }

            Divider()

            Button("Save") {
                NSApp.sendAction(#selector(CodeEditWindowController.saveDocument(_:)), to: nil, from: nil)

Review comment (suggestion):
We should keep this item in the menu. Instead of putting the button in TabBarItemView, leave it here. We should be able to call a function that closes the active tab that is in the editor split that is currently in focus.

Code after:
    var body: some Commands {
        CommandGroup(replacing: .newItem) {
            Group {
                Button("New") {
                    NSDocumentController.shared.newDocument(nil)
                }
                .keyboardShortcut("n")

                Button("Open...") {
                    NSDocumentController.shared.openDocument(nil)
                }
                .keyboardShortcut("o")

                // Leave this empty, is done through a hidden API in WindowCommands/Utils/CommandsFixes.swift
                // This can't be done in SwiftUI Commands yet, as they don't support images in menu items.
                Menu("Open Recent") {}

                Button("Open Quickly") {
                    NSApp.sendAction(#selector(CodeEditWindowController.openQuickly(_:)), to: nil, from: nil)
                }
                .keyboardShortcut("o", modifiers: [.command, .shift])
            }
        }

        CommandGroup(replacing: .saveItem) {
            Button("Close Tab") {
                NSApp.sendAction(#selector(CodeEditWindowController.closeCurrentTab(_:)), to: nil, from: nil)
            }
            .keyboardShortcut("w")

            Button("Close Editor") {
                NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
            }
            .keyboardShortcut("w", modifiers: [.control, .shift, .command])

            Button("Close Window") {

            }
            .keyboardShortcut("w", modifiers: [.shift, .command])

            Button("Close Workspace") {

            }
            .keyboardShortcut("w", modifiers: [.control, .option, .command])

            if let debugAreaViewModel {
                Button("Close Terminal") {
                    debugAreaViewModel.removeTerminals(debugAreaViewModel.selectedTerminals)
                }
                .keyboardShortcut(.delete)
            }