Skip to content

Commit 9829fa6

Browse files
Refactors
1 parent 20f768b commit 9829fa6

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

CodeEdit/Features/Documents/WorkspaceDocument/WorkspaceDocument.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ final class WorkspaceDocument: NSDocument, ObservableObject, NSToolbarDelegate {
3333
var editorManager: EditorManager? = EditorManager()
3434
var statusBarViewModel: StatusBarViewModel? = StatusBarViewModel()
3535
var utilityAreaModel: UtilityAreaViewModel? = UtilityAreaViewModel()
36-
// TODO: GRAB PROJECT NAME FROM ROOT FOLDER
37-
var issueNavigatorViewModel: IssueNavigatorViewModel? = IssueNavigatorViewModel(
38-
projectName: "Test"
39-
)
36+
var issueNavigatorViewModel: IssueNavigatorViewModel? = IssueNavigatorViewModel()
4037
var searchState: SearchState?
4138
var openQuicklyViewModel: OpenQuicklyViewModel?
4239
var commandsPaletteState: QuickActionsViewModel?
@@ -166,6 +163,8 @@ final class WorkspaceDocument: NSDocument, ObservableObject, NSToolbarDelegate {
166163

167164
editorManager?.restoreFromState(self)
168165
utilityAreaModel?.restoreFromState(self)
166+
167+
issueNavigatorViewModel?.initialize(projectName: displayName)
169168
}
170169

171170
override func read(from url: URL, ofType typeName: String) throws {

CodeEdit/Features/NavigatorArea/ViewModels/IssueNavigatorViewModel.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import Foundation
1010
import LanguageServerProtocol
1111

1212
class IssueNavigatorViewModel: ObservableObject {
13-
@Published var rootNode: ProjectIssueNode
13+
@Published var rootNode: ProjectIssueNode?
1414
@Published var filterOptions = IssueFilterOptions()
15-
@Published private(set) var filteredRootNode: ProjectIssueNode
15+
@Published private(set) var filteredRootNode: ProjectIssueNode?
1616

1717
private var diagnosticsByFile: [DocumentUri: [Diagnostic]] = [:]
1818

19-
init(projectName: String) {
19+
func initialize(projectName: String) {
2020
self.rootNode = ProjectIssueNode(name: projectName)
2121
self.filteredRootNode = ProjectIssueNode(name: projectName)
2222
}
@@ -50,6 +50,7 @@ class IssueNavigatorViewModel: ObservableObject {
5050
}
5151

5252
private func applyFilter() {
53+
guard let rootNode else { return }
5354
let filteredRoot = ProjectIssueNode(name: rootNode.name)
5455

5556
// Filter files and diagnostics
@@ -75,6 +76,7 @@ class IssueNavigatorViewModel: ObservableObject {
7576

7677
/// Rebuilds the tree structure based on current diagnostics
7778
private func rebuildTree() {
79+
guard let rootNode else { return }
7880
// Keep track of expanded states for files
7981
let expandedFileUris = Set(rootNode.files
8082
.filter { $0.isExpanded }

CodeEdit/Features/Settings/Pages/GeneralSettings/GeneralSettingsView.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,12 @@ private extension GeneralSettingsView {
215215
}
216216
}
217217

218-
// TODO: Implement reflecting Issue Navigator Detail preference and remove disabled modifier
219218
var issueNavigatorDetail: some View {
220219
Picker("Issue Navigator Detail", selection: $settings.issueNavigatorDetail) {
221220
ForEach(SettingsData.NavigatorDetail.allCases, id: \.self) { tag in
222221
Text(tag.label).tag(tag)
223222
}
224223
}
225-
.disabled(true)
226224
}
227225

228226
// TODO: Implement reset for Don't Ask Me warnings Button and remove disabled modifier

0 commit comments

Comments
 (0)