Skip to content

Commit

Permalink
File Icon Type setting reflects immediately #1765 (#1773)
Browse files Browse the repository at this point in the history
* File Icon Type setting reflects immediately #1765
---------

Co-authored-by: Tom Ludwig <[email protected]>
  • Loading branch information
hkarmoush and tom-ludwig authored Jun 23, 2024
1 parent 0f9924e commit f683b6b
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ final class ProjectNavigatorViewController: NSViewController {

var workspace: WorkspaceDocument?

var iconColor: SettingsData.FileIconStyle = .color
var iconColor: SettingsData.FileIconStyle = .color {
willSet {
if newValue != iconColor {
outlineView.reloadData()
}
}
}

var fileExtensionsVisibility: SettingsData.FileExtensionsVisibility = .showAll
var shownFileExtensions: SettingsData.FileExtensions = .default
Expand Down Expand Up @@ -275,9 +281,7 @@ extension ProjectNavigatorViewController: NSOutlineViewDelegate {
}

func outlineViewSelectionDidChange(_ notification: Notification) {
guard let outlineView = notification.object as? NSOutlineView else {
return
}
guard let outlineView = notification.object as? NSOutlineView else { return }

let selectedIndex = outlineView.selectedRow

Expand All @@ -298,13 +302,9 @@ extension ProjectNavigatorViewController: NSOutlineViewDelegate {
guard
let id = workspace?.editorManager.activeEditor.selectedTab?.file.id,
let item = workspace?.workspaceFileManager?.getFile(id, createIfNotFound: true)
else {
return
}
else { return }
/// update outline selection only if the parent of selected item match with expanded item
guard item.parent === notification.userInfo?["NSObject"] as? CEWorkspaceFile else {
return
}
guard item.parent === notification.userInfo?["NSObject"] as? CEWorkspaceFile else { return }
/// select active file under collapsed folder only if its parent is expanding
if outlineView.isItemExpanded(item.parent) {
updateSelection(itemID: item.id)
Expand Down

0 comments on commit f683b6b

Please sign in to comment.