Skip to content

Commit 59b7bf4

Browse files
Merge branch 'main' into feat/tahoe-navigator
2 parents b6acef6 + e298776 commit 59b7bf4

File tree

47 files changed

+2124
-1225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2124
-1225
lines changed

CodeEdit/Features/ActivityViewer/Notifications/TaskNotificationHandler.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ final class TaskNotificationHandler: ObservableObject {
132132
/// - toWorkspace: The workspace to restrict the task to. Defaults to `nil`, which is received by all workspaces.
133133
/// - action: The action being taken on the task.
134134
/// - model: The task contents.
135+
@MainActor
135136
static func postTask(toWorkspace: URL? = nil, action: Action, model: TaskNotificationModel) {
136137
NotificationCenter.default.post(name: .taskNotification, object: nil, userInfo: [
137138
"id": model.id,
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// ErrorDescriptionLabel.swift
3+
// CodeEdit
4+
//
5+
// Created by Khan Winter on 8/14/25.
6+
//
7+
8+
import SwiftUI
9+
10+
struct ErrorDescriptionLabel: View {
11+
let error: Error
12+
13+
var body: some View {
14+
VStack(alignment: .leading) {
15+
if let error = error as? LocalizedError {
16+
if let description = error.errorDescription {
17+
Text(description)
18+
}
19+
20+
if let reason = error.failureReason {
21+
Text(reason)
22+
}
23+
24+
if let recoverySuggestion = error.recoverySuggestion {
25+
Text(recoverySuggestion)
26+
}
27+
} else {
28+
Text(error.localizedDescription)
29+
}
30+
}
31+
}
32+
}
33+
34+
#Preview {
35+
ErrorDescriptionLabel(error: CancellationError())
36+
}

CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ final class CodeEditSplitViewController: NSSplitViewController {
139139
.inspectorCollapsed
140140
) as? Bool ?? true
141141
}
142+
143+
workspace.notificationPanel.updateToolbarItem()
142144
}
143145

144146
// MARK: - NSSplitViewDelegate

CodeEdit/Features/Documents/Controllers/CodeEditWindowController+Toolbar.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ extension CodeEditWindowController {
5959
items += [
6060
.activityViewer,
6161
.notificationItem,
62+
.flexibleSpace,
6263
]
6364
}
6465

CodeEdit/Features/Editor/TabBar/Tabs/Tab/EditorTabView.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ struct EditorTabView: View {
4646
/// By default, this value is `false`. When the root view is appeared, it turns `true`.
4747
@State private var isAppeared: Bool = false
4848

49+
@State private var keyMonitor: Any?
50+
4951
/// The id associating with the tab that is currently being dragged.
5052
///
5153
/// When `nil`, then there is no tab being dragged.
@@ -193,6 +195,22 @@ struct EditorTabView: View {
193195
}
194196
}
195197
}
198+
.onAppear {
199+
keyMonitor = NSEvent.addLocalMonitorForEvents(matching: .otherMouseDown) { event in
200+
if self.isHovering && event.type == .otherMouseDown && event.buttonNumber == 2 {
201+
DispatchQueue.main.async {
202+
editor.closeTab(file: tabFile)
203+
}
204+
}
205+
return event
206+
}
207+
}
208+
.onDisappear {
209+
if let keyMonitor = keyMonitor {
210+
NSEvent.removeMonitor(keyMonitor)
211+
self.keyMonitor = nil
212+
}
213+
}
196214
}
197215

198216
var body: some View {
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//
2+
// PackageManagerError.swift
3+
// CodeEdit
4+
//
5+
// Created by Abe Malla on 5/12/25.
6+
//
7+
8+
import Foundation
9+
10+
enum PackageManagerError: Error, LocalizedError {
11+
case unknown
12+
case packageManagerNotInstalled
13+
case initializationFailed(String)
14+
case installationFailed(String)
15+
case invalidConfiguration
16+
17+
var errorDescription: String? {
18+
switch self {
19+
case .unknown:
20+
"Unknown error occurred"
21+
case .packageManagerNotInstalled:
22+
"The required package manager is not installed."
23+
case .initializationFailed:
24+
"Installation directory initialization failed."
25+
case .installationFailed:
26+
"Package installation failed."
27+
case .invalidConfiguration:
28+
"The package registry contained an invalid installation configuration."
29+
}
30+
}
31+
32+
var failureReason: String? {
33+
switch self {
34+
case .unknown:
35+
nil
36+
case .packageManagerNotInstalled:
37+
nil
38+
case .initializationFailed(let string):
39+
string
40+
case .installationFailed(let string):
41+
string
42+
case .invalidConfiguration:
43+
nil
44+
}
45+
}
46+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//
2+
// RegistryManagerError.swift
3+
// CodeEdit
4+
//
5+
// Created by Abe Malla on 5/12/25.
6+
//
7+
8+
import Foundation
9+
10+
enum RegistryManagerError: Error, LocalizedError {
11+
case installationRunning
12+
case invalidResponse(statusCode: Int)
13+
case downloadFailed(url: URL, error: Error)
14+
case maxRetriesExceeded(url: URL, lastError: Error)
15+
case writeFailed(error: Error)
16+
case failedToSaveRegistryCache
17+
18+
var errorDescription: String? {
19+
switch self {
20+
case .installationRunning:
21+
"A package is already being installed."
22+
case .invalidResponse(let statusCode):
23+
"Invalid response received: \(statusCode)"
24+
case .downloadFailed(let url, _):
25+
"Download for \(url) error."
26+
case .maxRetriesExceeded(let url, _):
27+
"Maximum retries exceeded for url: \(url)"
28+
case .writeFailed:
29+
"Failed to write to file."
30+
case .failedToSaveRegistryCache:
31+
"Failed to write to registry cache."
32+
}
33+
}
34+
35+
var failureReason: String? {
36+
switch self {
37+
case .installationRunning, .invalidResponse, .failedToSaveRegistryCache:
38+
return nil
39+
case .downloadFailed(_, let error), .maxRetriesExceeded(_, let error), .writeFailed(let error):
40+
return if let error = error as? LocalizedError {
41+
error.errorDescription
42+
} else {
43+
error.localizedDescription
44+
}
45+
}
46+
}
47+
}

CodeEdit/Features/LSP/Registry/InstallationQueueManager.swift

Lines changed: 0 additions & 185 deletions
This file was deleted.

0 commit comments

Comments
 (0)