Repository: CodeEditApp/CodeEdit
File: OpenWithCodeEdit/FinderSync.swift (Swift)

Code before:
        }

        // Make values compatible to ArrayLiteralElement
        var files = ""

        for obj in items {
            files.append("\(obj.path);")
        }

        guard let codeEdit = NSWorkspace.shared.urlForApplication(
            withBundleIdentifier: "com.codeedit.CodeEdit"
        ) else { return }

        // Add files to open to openInCEFiles.
        defaults.set(files, forKey: "openInCEFiles")

        NSWorkspace.shared.open(
            [],
            withApplicationAt: codeEdit,
            configuration: NSWorkspace.OpenConfiguration()
        )
    }

    // MARK: - Menu and toolbar item support
    override func menu(for menuKind: FIMenuKind) -> NSMenu {
        guard let defaults = UserDefaults.init(suiteName: "com.codeedit.CodeEdit.shared") else {
            logger.error("Unable to load defaults")
            return NSMenu(title: "")
        }

        // Register enableOpenInCE (enable Open In CodeEdit
        defaults.register(defaults: ["enableOpenInCE": true])

        let menu = NSMenu(title: "")
        let menuItem = NSMenuItem(
            title: "Open in CodeEdit",
            action: #selector(openInCodeEditAction(_:)),
            keyEquivalent: ""
        )
        menuItem.image = NSImage.init(named: "icon")

        let enableOpenInCE = defaults.bool(forKey: "enableOpenInCE")
        logger.info("Enable Open In CodeEdit value is \(enableOpenInCE, privacy: .public)")
        if enableOpenInCE {
            menu.addItem(menuItem)
        }
        return menu
    }
}


Review comment (suggestion):
```suggestion
        guard let defaults = UserDefaults.init(suiteName: "app.codeedit.CodeEdit.shared") else {
```

Code after:
        }

        // Make values compatible to ArrayLiteralElement
        var files = ""

        for obj in items {
            files.append("\(obj.path);")
        }

        guard let codeEdit = NSWorkspace.shared.urlForApplication(
            withBundleIdentifier: "app.codeedit.CodeEdit"
        ) else { return }

        // Add files to open to openInCEFiles.
        defaults.set(files, forKey: "openInCEFiles")

        NSWorkspace.shared.open(
            [],
            withApplicationAt: codeEdit,
            configuration: NSWorkspace.OpenConfiguration()
        )
    }

    // MARK: - Menu and toolbar item support
    override func menu(for menuKind: FIMenuKind) -> NSMenu {
        guard let defaults = UserDefaults.init(suiteName: "app.codeedit.CodeEdit.shared") else {
            logger.error("Unable to load defaults")
            return NSMenu(title: "")
        }

        // Register enableOpenInCE (enable Open In CodeEdit
        defaults.register(defaults: ["enableOpenInCE": true])

        let menu = NSMenu(title: "")
        let menuItem = NSMenuItem(
            title: "Open in CodeEdit",
            action: #selector(openInCodeEditAction(_:)),
            keyEquivalent: ""
        )
        menuItem.image = NSImage.init(named: "icon")

        let enableOpenInCE = defaults.bool(forKey: "enableOpenInCE")
        logger.info("Enable Open In CodeEdit value is \(enableOpenInCE, privacy: .public)")
        if enableOpenInCE {
            menu.addItem(menuItem)
        }
        return menu
    }
}