Repository: CodeEditApp/CodeEdit
File: CodeEdit/NavigatorSidebar/ProjectNavigator/OutlineView/OutlineView.swift (Swift)

Code before:

        context.coordinator.controller = controller

        return controller
    }

    func updateNSViewController(_ nsViewController: OutlineViewController, context: Context) {
        nsViewController.iconColor = prefs.preferences.general.fileIconStyle
        nsViewController.rowHeight = rowHeight
        nsViewController.fileExtensionsVisibility = prefs.preferences.general.fileExtensionsVisibility
        nsViewController.shownFileExtensions = prefs.preferences.general.shownFileExtensions
        nsViewController.hiddenFileExtensions = prefs.preferences.general.hiddenFileExtensions
        nsViewController.updateSelection()
        return
    }

    func makeCoordinator() -> Coordinator {
        return Coordinator(workspace)
    }

    class Coordinator: NSObject {
        init(_ workspace: WorkspaceDocument) {
            self.workspace = workspace
            super.init()

            listener = workspace.listenerModel.$highlightedFileItem.sink(receiveValue: { [weak self] fileItem in
                guard let fileItem = fileItem else {
                    return
                }
                self?.controller?.reveal(fileItem)
            })
        }

        var listener: AnyCancellable?
        var workspace: WorkspaceDocument
        var controller: OutlineViewController?

        deinit {
            listener?.cancel()
        }
    }

    /// Returns the row height depending on the `projectNavigatorSize` in `AppPreferences`.
    ///
    /// * `small`: 20
    /// * `medium`: 22
    /// * `large`: 24
    private var rowHeight: Double {
        switch prefs.preferences.general.projectNavigatorSize {
        case .small: return 20
        case .medium: return 22

Review comment (suggestion):
Move `sink` to new line for better readability.

```swift
listener = workspace.listenerModel.$highlightedFileItem
    .sink(receiveValue: { [weak self] fileItem in
        …
    })
```

Code after:

        context.coordinator.controller = controller

        return controller
    }

    func updateNSViewController(_ nsViewController: OutlineViewController, context: Context) {
        nsViewController.iconColor = prefs.preferences.general.fileIconStyle
        nsViewController.rowHeight = rowHeight
        nsViewController.fileExtensionsVisibility = prefs.preferences.general.fileExtensionsVisibility
        nsViewController.shownFileExtensions = prefs.preferences.general.shownFileExtensions
        nsViewController.hiddenFileExtensions = prefs.preferences.general.hiddenFileExtensions
        nsViewController.updateSelection()
        return
    }

    func makeCoordinator() -> Coordinator {
        return Coordinator(workspace)
    }

    class Coordinator: NSObject {
        init(_ workspace: WorkspaceDocument) {
            self.workspace = workspace
            super.init()

            listener = workspace.listenerModel.$highlightedFileItem
                .sink(receiveValue: { [weak self] fileItem in
                guard let fileItem = fileItem else {
                    return
                }
                self?.controller?.reveal(fileItem)
            })
        }

        var listener: AnyCancellable?
        var workspace: WorkspaceDocument
        var controller: OutlineViewController?

        deinit {
            listener?.cancel()
        }
    }

    /// Returns the row height depending on the `projectNavigatorSize` in `AppPreferences`.
    ///
    /// * `small`: 20
    /// * `medium`: 22
    /// * `large`: 24
    private var rowHeight: Double {
        switch prefs.preferences.general.projectNavigatorSize {
        case .small: return 20