Repository: CodeEditApp/CodeEdit
File: CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorMenuActions.swift (Swift)

Code before:
        }
        reloadData()
        sender.outlineView.expandItem(item.isFolder ? item : item.parent)
    }

    // TODO: allow custom folder names
    /// Action that creates a new untitled folder
    @objc
    func newFolder() {
        guard let item else { return }
        workspace?.workspaceFileManager?.addFolder(folderName: "untitled", toFile: item)
        reloadData()
        sender.outlineView.expandItem(item)
        sender.outlineView.expandItem(item.isFolder ? item : item.parent)
    }

    /// Creates a new folder with the items selected.
    @objc
    func newFolderFromSelection() {
        guard let workspace, let workspaceFileManager = workspace.workspaceFileManager else { return }

        let selectedItems = selectedItems()
        guard let parent = selectedItems.first?.parent else { return }

        /// Get 'New Folder' name.
        var newFolderURL = parent.url.appendingPathComponent("New Folder", conformingTo: .folder)
        var folderNumber = 0
        while workspaceFileManager.fileManager.fileExists(atPath: newFolderURL.path) {
            folderNumber += 1
            newFolderURL = parent.url.appendingPathComponent("New Folder \(folderNumber)")
        }

        for selectedItem in selectedItems where selectedItem.url != newFolderURL {
            workspaceFileManager.move(file: selectedItem, to: newFolderURL.appending(path: selectedItem.name))
        }

        reloadData()
    }

    /// Opens the rename file dialogue on the cell this was presented from.
    @objc
    func renameFile() {
        let row = sender.outlineView.row(forItem: item)
        guard row > 0,
              let cell = sender.outlineView.view(
                atColumn: 0,
                row: row,
                makeIfNecessary: false
              ) as? ProjectNavigatorTableViewCell else {
            return
        }

Review comment (suggestion):
```suggestion
        var newFolderURL = parent.url.appendingPathComponent("New Folder With Items", conformingTo: .folder)
```

Code after:
        }
        reloadData()
        sender.outlineView.expandItem(item.isFolder ? item : item.parent)
    }

    // TODO: allow custom folder names
    /// Action that creates a new untitled folder
    @objc
    func newFolder() {
        guard let item else { return }
        workspace?.workspaceFileManager?.addFolder(folderName: "untitled", toFile: item)
        reloadData()
        sender.outlineView.expandItem(item)
        sender.outlineView.expandItem(item.isFolder ? item : item.parent)
    }

    /// Creates a new folder with the items selected.
    @objc
    func newFolderFromSelection() {
        guard let workspace, let workspaceFileManager = workspace.workspaceFileManager else { return }

        let selectedItems = selectedItems()
        guard let parent = selectedItems.first?.parent else { return }

        /// Get 'New Folder' name.
        var newFolderURL = parent.url.appendingPathComponent("New Folder With Items", conformingTo: .folder)
        var folderNumber = 0
        while workspaceFileManager.fileManager.fileExists(atPath: newFolderURL.path) {
            folderNumber += 1
            newFolderURL = parent.url.appendingPathComponent("New Folder With Items \(folderNumber)")
        }

        for selectedItem in selectedItems where selectedItem.url != newFolderURL {
            workspaceFileManager.move(file: selectedItem, to: newFolderURL.appending(path: selectedItem.name))
        }

        reloadData()
    }

    /// Opens the rename file dialogue on the cell this was presented from.
    @objc
    func renameFile() {
        let row = sender.outlineView.row(forItem: item)
        guard row > 0,
              let cell = sender.outlineView.view(
                atColumn: 0,
                row: row,
                makeIfNecessary: false
              ) as? ProjectNavigatorTableViewCell else {
            return
        }