Skip to content

Commit f683b6b

Browse files
File Icon Type setting reflects immediately #1765 (#1773)
* File Icon Type setting reflects immediately #1765 --------- Co-authored-by: Tom Ludwig <tommludwig@icloud.com>
1 parent 0f9924e commit f683b6b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ final class ProjectNavigatorViewController: NSViewController {
2828

2929
var workspace: WorkspaceDocument?
3030

31-
var iconColor: SettingsData.FileIconStyle = .color
31+
var iconColor: SettingsData.FileIconStyle = .color {
32+
willSet {
33+
if newValue != iconColor {
34+
outlineView.reloadData()
35+
}
36+
}
37+
}
3238

3339
var fileExtensionsVisibility: SettingsData.FileExtensionsVisibility = .showAll
3440
var shownFileExtensions: SettingsData.FileExtensions = .default
@@ -275,9 +281,7 @@ extension ProjectNavigatorViewController: NSOutlineViewDelegate {
275281
}
276282

277283
func outlineViewSelectionDidChange(_ notification: Notification) {
278-
guard let outlineView = notification.object as? NSOutlineView else {
279-
return
280-
}
284+
guard let outlineView = notification.object as? NSOutlineView else { return }
281285

282286
let selectedIndex = outlineView.selectedRow
283287

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

0 commit comments

Comments
 (0)