Repository: CodeEditApp/CodeEdit
File: CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFileManager+FileManagement.swift (Swift)

Code before:
        let deleteConfirmation = NSAlert()
        deleteConfirmation.messageText = "Do you want to delete “\(fileName)”?"
        deleteConfirmation.informativeText = "This item will be deleted immediately. You can't undo this action."
        deleteConfirmation.alertStyle = .critical
        deleteConfirmation.addButton(withTitle: "Delete")
        deleteConfirmation.buttons.last?.hasDestructiveAction = true
        deleteConfirmation.addButton(withTitle: "Cancel")
        if !confirmDelete || deleteConfirmation.runModal() == .alertFirstButtonReturn { // "Delete" button
            if fileManager.fileExists(atPath: file.url.path) {
                do {
                    try fileManager.removeItem(at: file.url)
                } catch {
                    fatalError(error.localizedDescription)
                }
            }
        }
    }

    /// This function deletes multiple files or folders from the current project by erasing immediately.
    /// - Parameters:
    ///   - files: The files to delete
    ///   - confirmDelete: True to present an alert to confirm the delete.
    public func batchDelete(files: Set<CEWorkspaceFile>, confirmDelete: Bool = true) {
        let deleteConfirmation = NSAlert()
        deleteConfirmation.messageText = "Do you want to delete \(files.count) items?"
        deleteConfirmation.informativeText = "These items will be deleted immediately. You can't undo this action."
        deleteConfirmation.alertStyle = .critical
        deleteConfirmation.addButton(withTitle: "Delete")
        deleteConfirmation.buttons.last?.hasDestructiveAction = true
        deleteConfirmation.addButton(withTitle: "Cancel")
        if !confirmDelete || deleteConfirmation.runModal() == .alertFirstButtonReturn {
            for file in files where fileManager.fileExists(atPath: file.url.path) {
                do {
                    try fileManager.removeItem(at: file.url)
                } catch {
                    fatalError(error.localizedDescription)
                }
            }
        }
    }

    /// This function duplicates the item or folder
    /// - Parameter file: The file to duplicate
    /// - Authors: Mattijs Eikelenboom, KaiTheRedNinja. *Moved from 7c27b1e*
    public func duplicate(file: CEWorkspaceFile) {
        // If a file/folder with the same name exists, add "copy" to the end
        var fileUrl = file.url
        while fileManager.fileExists(atPath: fileUrl.path) {
            let previousName = fileUrl.lastPathComponent
            let fileExtension = fileUrl.pathExtension.isEmpty ? "" : ".\(fileUrl.pathExtension)"
            let fileName = fileExtension.isEmpty ? previousName :

Review comment (suggestion):
This is what Finder says when you try to delete multiple items immediately (I couldn't figure out how to delete files immediately in Xocde).
```suggestion
        deleteConfirmation.messageText = "Are you sure you want to delete the \(files.count) selected items?"
        deleteConfirmation.informativeText = "\(files.count) items will be deleted immediately. You cannot undo this action."
```

Code after:
        let deleteConfirmation = NSAlert()
        deleteConfirmation.messageText = "Do you want to delete “\(fileName)”?"
        deleteConfirmation.informativeText = "This item will be deleted immediately. You can't undo this action."
        deleteConfirmation.alertStyle = .critical
        deleteConfirmation.addButton(withTitle: "Delete")
        deleteConfirmation.buttons.last?.hasDestructiveAction = true
        deleteConfirmation.addButton(withTitle: "Cancel")
        if !confirmDelete || deleteConfirmation.runModal() == .alertFirstButtonReturn { // "Delete" button
            if fileManager.fileExists(atPath: file.url.path) {
                do {
                    try fileManager.removeItem(at: file.url)
                } catch {
                    fatalError(error.localizedDescription)
                }
            }
        }
    }

    /// This function deletes multiple files or folders from the current project by erasing immediately.
    /// - Parameters:
    ///   - files: The files to delete
    ///   - confirmDelete: True to present an alert to confirm the delete.
    public func batchDelete(files: Set<CEWorkspaceFile>, confirmDelete: Bool = true) {
        let deleteConfirmation = NSAlert()
        deleteConfirmation.messageText = "Are you sure you want to delete the \(files.count) selected items?"
        // swiftlint:disable:next line_length
        deleteConfirmation.informativeText = "\(files.count) items will be deleted immediately. You cannot undo this action."
        deleteConfirmation.alertStyle = .critical
        deleteConfirmation.addButton(withTitle: "Delete")
        deleteConfirmation.buttons.last?.hasDestructiveAction = true
        deleteConfirmation.addButton(withTitle: "Cancel")
        if !confirmDelete || deleteConfirmation.runModal() == .alertFirstButtonReturn {
            for file in files where fileManager.fileExists(atPath: file.url.path) {
                do {
                    try fileManager.removeItem(at: file.url)
                } catch {
                    print(error.localizedDescription)
                }
            }
        }
    }

    /// This function duplicates the item or folder
    /// - Parameter file: The file to duplicate
    /// - Authors: Mattijs Eikelenboom, KaiTheRedNinja. *Moved from 7c27b1e*
    public func duplicate(file: CEWorkspaceFile) {
        // If a file/folder with the same name exists, add "copy" to the end
        var fileUrl = file.url
        while fileManager.fileExists(atPath: fileUrl.path) {
            let previousName = fileUrl.lastPathComponent
            let fileExtension = fileUrl.pathExtension.isEmpty ? "" : ".\(fileUrl.pathExtension)"