From b6183263bacc6df755d8c41d95ab45e519600369 Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Fri, 2 Jun 2023 13:11:22 +0630 Subject: [PATCH 01/13] feat: exclude file extension when renaming filename --- .../OutlineView/StandardTableViewCell.swift | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/CodeEdit/Features/NavigatorSidebar/OutlineView/StandardTableViewCell.swift b/CodeEdit/Features/NavigatorSidebar/OutlineView/StandardTableViewCell.swift index df9d6c4f6..243871e1d 100644 --- a/CodeEdit/Features/NavigatorSidebar/OutlineView/StandardTableViewCell.swift +++ b/CodeEdit/Features/NavigatorSidebar/OutlineView/StandardTableViewCell.swift @@ -187,12 +187,18 @@ class StandardTableViewCell: NSTableCellView { } class SpecialSelectTextField: NSTextField { -// override func becomeFirstResponder() -> Bool { - // TODO: Set text range - // this is the code to get the text range, however I cannot find a way to select it :( -// NSRange(location: 0, length: stringValue.distance(from: stringValue.startIndex, -// to: stringValue.lastIndex(of: ".") ?? stringValue.endIndex)) -// return true -// } + override func becomeFirstResponder() -> Bool { + let range = NSRange( + location: 0, + length: stringValue.distance( + from: stringValue.startIndex, + to: stringValue.lastIndex(of: ".") ?? stringValue.endIndex + ) + ) + selectText(nil) + let editor = currentEditor() + editor?.selectedRange = range + return true + } } } From b4eb01cc9e7504721374d542bcd6546562ff8a63 Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Fri, 2 Jun 2023 15:13:36 +0630 Subject: [PATCH 02/13] feat: add background layer while editing --- .../OutlineView/StandardTableViewCell.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/CodeEdit/Features/NavigatorSidebar/OutlineView/StandardTableViewCell.swift b/CodeEdit/Features/NavigatorSidebar/OutlineView/StandardTableViewCell.swift index 243871e1d..3ebe7a295 100644 --- a/CodeEdit/Features/NavigatorSidebar/OutlineView/StandardTableViewCell.swift +++ b/CodeEdit/Features/NavigatorSidebar/OutlineView/StandardTableViewCell.swift @@ -195,10 +195,22 @@ class StandardTableViewCell: NSTableCellView { to: stringValue.lastIndex(of: ".") ?? stringValue.endIndex ) ) - selectText(nil) + selectText(self) let editor = currentEditor() editor?.selectedRange = range return true } + + override func textDidBeginEditing(_ notification: Notification) { + super.textDidBeginEditing(notification) + wantsLayer = true + layer?.backgroundColor = NSColor.textBackgroundColor.cgColor + } + + override func textDidEndEditing(_ notification: Notification) { + super.textDidEndEditing(notification) + wantsLayer = false + layer?.backgroundColor = nil + } } } From 77405e8886d912acdf242fa5a98b0319663ce3d6 Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Sat, 3 Jun 2023 18:15:14 +0630 Subject: [PATCH 03/13] fix: sync file highlight in outline view with active tab group --- .../CEWorkspace/Models/CEWorkspaceFile.swift | 14 ++++++++++ .../ProjectNavigatorOutlineView.swift | 28 +++++++++++-------- .../ProjectNavigatorViewController.swift | 11 +++----- .../ProjectNavigatorView.swift | 6 +--- .../Features/Tabs/Models/TabManager.swift | 19 ++++++++++++- CodeEdit/WorkspaceView.swift | 3 +- 6 files changed, 55 insertions(+), 26 deletions(-) diff --git a/CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFile.swift b/CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFile.swift index 39789637a..d7942c1c7 100644 --- a/CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFile.swift +++ b/CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFile.swift @@ -361,3 +361,17 @@ final class CEWorkspaceFile: Codable, Comparable, Hashable, Identifiable, TabBar } } + +extension Array where Element == CEWorkspaceFile { + func find(by tabID: TabBarItemID) -> CEWorkspaceFile? { + guard let item = first(where: { $0.tabID == tabID }) else { + for element in self { + if let item = element.children?.find(by: tabID) { + return item + } + } + return nil + } + return item + } +} diff --git a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift index 1151e6484..b02b893f3 100644 --- a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift +++ b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift @@ -17,10 +17,6 @@ struct ProjectNavigatorOutlineView: NSViewControllerRepresentable { @StateObject var prefs: Settings = .shared - // This is mainly just used to trigger a view update. - @Binding - var selection: CEWorkspaceFile? - typealias NSViewControllerType = ProjectNavigatorViewController func makeNSViewController(context: Context) -> ProjectNavigatorViewController { @@ -42,7 +38,8 @@ struct ProjectNavigatorOutlineView: NSViewControllerRepresentable { nsViewController.fileExtensionsVisibility = prefs.preferences.general.fileExtensionsVisibility nsViewController.shownFileExtensions = prefs.preferences.general.shownFileExtensions nsViewController.hiddenFileExtensions = prefs.preferences.general.hiddenFileExtensions - nsViewController.updateSelection() + /// if the window becomes active from background, it will restores the selection to outline view. + nsViewController.updateSelection(itemID: workspace.tabManager.activeTabGroup.selected?.id) return } @@ -55,21 +52,28 @@ struct ProjectNavigatorOutlineView: NSViewControllerRepresentable { self.workspace = workspace super.init() - listener = workspace.listenerModel.$highlightedFileItem + workspace.listenerModel.$highlightedFileItem .sink(receiveValue: { [weak self] fileItem in - guard let fileItem else { - return + guard let fileItem else { + return + } + self?.controller?.reveal(fileItem) + }) + .store(in: &cancellables) + workspace.tabManager.tabBarItemIdSubject + .sink { [weak self] itemID in + self?.controller?.updateSelection(itemID: itemID) } - self?.controller?.reveal(fileItem) - }) + .store(in: &cancellables) } - var listener: AnyCancellable? + var cancellables: Set = [] var workspace: WorkspaceDocument var controller: ProjectNavigatorViewController? deinit { - listener?.cancel() + cancellables.forEach { $0.cancel() } + cancellables.removeAll() } } } diff --git a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift index f71743036..175686c0d 100644 --- a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift +++ b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift @@ -89,8 +89,9 @@ final class ProjectNavigatorViewController: NSViewController { /// Updates the selection of the ``outlineView`` whenever it changes. /// /// Most importantly when the `id` changes from an external view. - func updateSelection() { - guard let itemID = workspace?.tabManager.activeTabGroup.selected?.id else { + /// - Parameter itemID: The id of the file or folder. + func updateSelection(itemID: String?) { + guard let itemID else { outlineView.deselectRow(outlineView.selectedRow) return } @@ -310,11 +311,7 @@ extension ProjectNavigatorViewController: NSOutlineViewDelegate { reveal(fileItem) } } - - guard let item = collection.first(where: { $0.tabID == id }) else { - for item in collection { - select(by: id, from: item.children ?? []) - } + guard let item = collection.find(by: id) else { return } let row = outlineView.row(forItem: item) diff --git a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/ProjectNavigatorView.swift b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/ProjectNavigatorView.swift index 3e7fc61eb..23536c06e 100644 --- a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/ProjectNavigatorView.swift +++ b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/ProjectNavigatorView.swift @@ -15,14 +15,10 @@ import SwiftUI /// When selecting a file it will open in the editor. /// struct ProjectNavigatorView: View { - - @EnvironmentObject var tabManager: TabManager - var body: some View { - ProjectNavigatorOutlineView(selection: $tabManager.activeTabGroup.selected) + ProjectNavigatorOutlineView() .safeAreaInset(edge: .bottom, spacing: 0) { ProjectNavigatorToolbarBottom() } } - } diff --git a/CodeEdit/Features/Tabs/Models/TabManager.swift b/CodeEdit/Features/Tabs/Models/TabManager.swift index 964b4ed6e..6e474bb1c 100644 --- a/CodeEdit/Features/Tabs/Models/TabManager.swift +++ b/CodeEdit/Features/Tabs/Models/TabManager.swift @@ -5,9 +5,10 @@ // Created by Wouter Hennen on 03/03/2023. // +import Combine import Foundation -import OrderedCollections import DequeModule +import OrderedCollections class TabManager: ObservableObject { /// Collection of all the tabgroups. @@ -19,6 +20,7 @@ class TabManager: ObservableObject { var activeTabGroup: TabGroupData { didSet { activeTabGroupHistory.prepend { [weak oldValue] in oldValue } + switchToActiveTabGroup() } } @@ -27,11 +29,16 @@ class TabManager: ObservableObject { var fileDocuments: [CEWorkspaceFile: CodeFileDocument] = [:] + /// notify listeners whenever tab selection changes on the active tab group. + var tabBarItemIdSubject = PassthroughSubject() + var cancellable: AnyCancellable? + init() { let tab = TabGroupData() self.activeTabGroup = tab self.activeTabGroupHistory.prepend { [weak tab] in tab } self.tabGroups = .horizontal(.init(.horizontal, tabgroups: [.one(tab)])) + switchToActiveTabGroup() } /// Flattens the splitviews. @@ -49,4 +56,14 @@ class TabManager: ObservableObject { let tabgroup = tabgroup ?? activeTabGroup tabgroup.openTab(item: item) } + + /// bind active tap group to listen to file selection changes. + func switchToActiveTabGroup() { + cancellable?.cancel() + cancellable = nil + cancellable = activeTabGroup.$selected + .sink { [weak self] tab in + self?.tabBarItemIdSubject.send(tab?.id) + } + } } diff --git a/CodeEdit/WorkspaceView.swift b/CodeEdit/WorkspaceView.swift index 7d55ca632..81fe951dc 100644 --- a/CodeEdit/WorkspaceView.swift +++ b/CodeEdit/WorkspaceView.swift @@ -59,7 +59,8 @@ struct WorkspaceView: View { .environmentObject(workspace.statusBarModel) .frame(maxWidth: .infinity, maxHeight: .infinity) .onChange(of: focusedEditor) { newValue in - if let newValue { + /// update active tab group only if the new one is not the same with it. + if let newValue, tabManager.activeTabGroup != newValue { tabManager.activeTabGroup = newValue } } From cde17262c9a2cf725b0fc5491e71a8a35fafbe5c Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Sun, 4 Jun 2023 11:17:39 +0630 Subject: [PATCH 04/13] feat: select active file when expanding folder --- .../OutlineView/ProjectNavigatorViewController.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift index 175686c0d..e2f513fa3 100644 --- a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift +++ b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift @@ -283,7 +283,10 @@ extension ProjectNavigatorViewController: NSOutlineViewDelegate { rowHeight // This can be changed to 20 to match Xcode's row height. } - func outlineViewItemDidExpand(_ notification: Notification) {} + func outlineViewItemDidExpand(_ notification: Notification) { + /// select active file under collapsed folder + updateSelection(itemID: workspace?.tabManager.activeTabGroup.selected?.id) + } func outlineViewItemDidCollapse(_ notification: Notification) {} From 14485e46a30a8b68190d5cf8a0bec1b543248599 Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Sun, 4 Jun 2023 13:37:44 +0630 Subject: [PATCH 05/13] feat: remove duplicate events from publisher --- .../OutlineView/ProjectNavigatorOutlineView.swift | 1 + .../OutlineView/ProjectNavigatorViewController.swift | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift index b02b893f3..10cae7e34 100644 --- a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift +++ b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift @@ -61,6 +61,7 @@ struct ProjectNavigatorOutlineView: NSViewControllerRepresentable { }) .store(in: &cancellables) workspace.tabManager.tabBarItemIdSubject + .removeDuplicates() .sink { [weak self] itemID in self?.controller?.updateSelection(itemID: itemID) } diff --git a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift index e2f513fa3..aa99d004c 100644 --- a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift +++ b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift @@ -306,6 +306,10 @@ extension ProjectNavigatorViewController: NSOutlineViewDelegate { /// - id: the id of the item item /// - collection: the array to search for private func select(by id: TabBarItemID, from collection: [CEWorkspaceFile]) { + print("[DEBUG] - \(id.id)") + guard let item = collection.find(by: id) else { + return + } // If the user has set "Reveal file on selection change" to on, we need to reveal the item before // selecting the row. if Settings.shared.preferences.general.revealFileOnFocusChange { From 5a602300bc76fdc75b4d097d57bd4979e0765e1a Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Sun, 4 Jun 2023 13:59:38 +0630 Subject: [PATCH 06/13] feat: use item from from collection --- .../OutlineView/ProjectNavigatorViewController.swift | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift index aa99d004c..710c7688a 100644 --- a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift +++ b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift @@ -313,13 +313,7 @@ extension ProjectNavigatorViewController: NSOutlineViewDelegate { // If the user has set "Reveal file on selection change" to on, we need to reveal the item before // selecting the row. if Settings.shared.preferences.general.revealFileOnFocusChange { - if case let .codeEditor(id) = id, - let fileItem = try? workspace?.workspaceFileManager?.getFile(id as CEWorkspaceFile.ID) { - reveal(fileItem) - } - } - guard let item = collection.find(by: id) else { - return + reveal(item) } let row = outlineView.row(forItem: item) if row == -1 { From 5d915e37d672268a28eeeae936e3f1980b5abe7c Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Sun, 4 Jun 2023 14:09:47 +0630 Subject: [PATCH 07/13] chore: remove debug print --- .../OutlineView/ProjectNavigatorViewController.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift index 710c7688a..0db9abd40 100644 --- a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift +++ b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift @@ -306,7 +306,6 @@ extension ProjectNavigatorViewController: NSOutlineViewDelegate { /// - id: the id of the item item /// - collection: the array to search for private func select(by id: TabBarItemID, from collection: [CEWorkspaceFile]) { - print("[DEBUG] - \(id.id)") guard let item = collection.find(by: id) else { return } From dd5526d541608832daf3046f28b6b0541bacfcd5 Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Sun, 4 Jun 2023 14:17:03 +0630 Subject: [PATCH 08/13] feat: restore file selection if folder is expanded --- .../OutlineView/ProjectNavigatorOutlineView.swift | 1 - .../OutlineView/ProjectNavigatorViewController.swift | 12 ++++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift index 10cae7e34..b02b893f3 100644 --- a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift +++ b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift @@ -61,7 +61,6 @@ struct ProjectNavigatorOutlineView: NSViewControllerRepresentable { }) .store(in: &cancellables) workspace.tabManager.tabBarItemIdSubject - .removeDuplicates() .sink { [weak self] itemID in self?.controller?.updateSelection(itemID: itemID) } diff --git a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift index 0db9abd40..a39d403ea 100644 --- a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift +++ b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift @@ -284,8 +284,16 @@ extension ProjectNavigatorViewController: NSOutlineViewDelegate { } func outlineViewItemDidExpand(_ notification: Notification) { - /// select active file under collapsed folder - updateSelection(itemID: workspace?.tabManager.activeTabGroup.selected?.id) + guard + let id = workspace?.tabManager.activeTabGroup.selected?.id, + let item = content.find(by: .codeEditor(id)) + else { + return + } + /// select active file under collapsed folder only if its parent is expanding + if outlineView.isItemExpanded(item.parent) { + updateSelection(itemID: item.id) + } } func outlineViewItemDidCollapse(_ notification: Notification) {} From fd9712a7d03f8e37a0caa214260540ff8065c4a6 Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Sat, 10 Jun 2023 16:05:05 +0630 Subject: [PATCH 09/13] chore: update selection after reloading outline datasource --- .../OutlineView/ProjectNavigatorOutlineView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift index b02b893f3..7536c20db 100644 --- a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift +++ b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift @@ -25,6 +25,7 @@ struct ProjectNavigatorOutlineView: NSViewControllerRepresentable { controller.iconColor = prefs.preferences.general.fileIconStyle workspace.workspaceFileManager?.onRefresh = { controller.outlineView.reloadData() + controller.updateSelection(itemID: workspace.tabManager.activeTabGroup.selected?.id) } context.coordinator.controller = controller From ce9579bd30bd1bcfaa1f056ea83802a0104f8ec1 Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Wed, 14 Jun 2023 14:17:26 +0630 Subject: [PATCH 10/13] chore: move array extension under util extension folder --- .../CEWorkspace/Models/CEWorkspaceFile.swift | 14 -------------- .../Extensions/Array/Array+CEWorkspaceFile.swift | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFile.swift b/CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFile.swift index d7942c1c7..39789637a 100644 --- a/CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFile.swift +++ b/CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFile.swift @@ -361,17 +361,3 @@ final class CEWorkspaceFile: Codable, Comparable, Hashable, Identifiable, TabBar } } - -extension Array where Element == CEWorkspaceFile { - func find(by tabID: TabBarItemID) -> CEWorkspaceFile? { - guard let item = first(where: { $0.tabID == tabID }) else { - for element in self { - if let item = element.children?.find(by: tabID) { - return item - } - } - return nil - } - return item - } -} diff --git a/CodeEdit/Utils/Extensions/Array/Array+CEWorkspaceFile.swift b/CodeEdit/Utils/Extensions/Array/Array+CEWorkspaceFile.swift index 5bd9a2e20..af85343d3 100644 --- a/CodeEdit/Utils/Extensions/Array/Array+CEWorkspaceFile.swift +++ b/CodeEdit/Utils/Extensions/Array/Array+CEWorkspaceFile.swift @@ -27,6 +27,20 @@ extension Array where Element == CEWorkspaceFile { } } + /// Search for the `CEWorkspaceFile` element that matches the specified `tabID`. + /// - Parameter tabID: A `tabID` to search for. + /// - Returns: The `CEWorkspaceFile` element with a matching `tabID` if available. + func find(by tabID: TabBarItemID) -> CEWorkspaceFile? { + guard let item = first(where: { $0.tabID == tabID }) else { + for element in self { + if let item = element.children?.find(by: tabID) { + return item + } + } + return nil + } + return item + } } extension Array where Element: Hashable { From 211499eed11d17553c9fc029070f56c43e0fdaf0 Mon Sep 17 00:00:00 2001 From: Austin Condiff Date: Wed, 14 Jun 2023 14:45:15 -0500 Subject: [PATCH 11/13] Update CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift --- .../OutlineView/ProjectNavigatorOutlineView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift index 7536c20db..6b18aed96 100644 --- a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift +++ b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift @@ -39,7 +39,7 @@ struct ProjectNavigatorOutlineView: NSViewControllerRepresentable { nsViewController.fileExtensionsVisibility = prefs.preferences.general.fileExtensionsVisibility nsViewController.shownFileExtensions = prefs.preferences.general.shownFileExtensions nsViewController.hiddenFileExtensions = prefs.preferences.general.hiddenFileExtensions - /// if the window becomes active from background, it will restores the selection to outline view. + /// if the window becomes active from background, it will restore the selection to outline view. nsViewController.updateSelection(itemID: workspace.tabManager.activeTabGroup.selected?.id) return } From 35036c0326b6c611954fc50862058b335ac04da7 Mon Sep 17 00:00:00 2001 From: Austin Condiff Date: Wed, 14 Jun 2023 14:53:01 -0500 Subject: [PATCH 12/13] Update CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift --- .../OutlineView/ProjectNavigatorOutlineView.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift index 6b18aed96..4cfcfe1f2 100644 --- a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift +++ b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift @@ -72,7 +72,6 @@ struct ProjectNavigatorOutlineView: NSViewControllerRepresentable { var workspace: WorkspaceDocument var controller: ProjectNavigatorViewController? - deinit { cancellables.forEach { $0.cancel() } cancellables.removeAll() } From 71d11f9cc75513ef6a7b83cd0a3e6a0e7dbd1741 Mon Sep 17 00:00:00 2001 From: Austin Condiff Date: Wed, 14 Jun 2023 14:53:07 -0500 Subject: [PATCH 13/13] Update CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift --- .../OutlineView/ProjectNavigatorOutlineView.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift index 4cfcfe1f2..57421c563 100644 --- a/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift +++ b/CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift @@ -72,8 +72,5 @@ struct ProjectNavigatorOutlineView: NSViewControllerRepresentable { var workspace: WorkspaceDocument var controller: ProjectNavigatorViewController? - cancellables.forEach { $0.cancel() } - cancellables.removeAll() - } } }