Skip to content

Commit 4bfbfd0

Browse files
committed
Warning cleanup
1 parent 779cd0d commit 4bfbfd0

File tree

13 files changed

+33
-31
lines changed

13 files changed

+33
-31
lines changed

ChatPlugins/Sources/TerminalChatPlugin/TerminalChatPlugin.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public final class TerminalChatPlugin: ChatPlugin {
5959
}
6060

6161
do {
62-
let fileURL = await XcodeInspector.shared.realtimeActiveDocumentURL
63-
let projectURL = await XcodeInspector.shared.realtimeActiveProjectURL
62+
let fileURL = XcodeInspector.shared.realtimeActiveDocumentURL
63+
let projectURL = XcodeInspector.shared.realtimeActiveProjectURL
6464

6565
var environment = [String: String]()
6666
if let fileURL {

Core/Sources/LegacyChatPlugin/TerminalChatPlugin.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public actor TerminalChatPlugin: LegacyChatPlugin {
3434
}
3535

3636
do {
37-
let fileURL = await XcodeInspector.shared.realtimeActiveDocumentURL
38-
let projectURL = await XcodeInspector.shared.realtimeActiveProjectURL
37+
let fileURL = XcodeInspector.shared.realtimeActiveDocumentURL
38+
let projectURL = XcodeInspector.shared.realtimeActiveProjectURL
3939

4040
var environment = [String: String]()
4141
if let fileURL {

Core/Sources/Service/RealtimeSuggestionController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public actor RealtimeSuggestionController {
113113

114114
Task { @WorkspaceActor in // Get cache ready for real-time suggestions.
115115
guard UserDefaults.shared.value(for: \.preCacheOnFileOpen) else { return }
116-
guard let fileURL = await XcodeInspector.shared.realtimeActiveDocumentURL
116+
guard let fileURL = XcodeInspector.shared.realtimeActiveDocumentURL
117117
else { return }
118118
let (_, filespace) = try await Service.shared.workspacePool
119119
.fetchOrCreateWorkspaceAndFilespace(fileURL: fileURL)

Core/Sources/Service/Service.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public final class Service {
103103
.notifications(named: .activeDocumentURLDidChange)
104104
var previousURL: URL?
105105
for await _ in notifications {
106-
guard let self else { return }
106+
guard self != nil else { return }
107107
let url = await XcodeInspector.shared.activeDocumentURL
108108
if let url, url != previousURL, url != .init(fileURLWithPath: "/") {
109109
previousURL = url

Core/Sources/Service/SuggestionCommandHandler/PseudoCommandHandler.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ extension PseudoCommandHandler {
670670
}
671671

672672
func getFileURL() async -> URL? {
673-
await XcodeInspector.shared.realtimeActiveDocumentURL
673+
XcodeInspector.shared.realtimeActiveDocumentURL
674674
}
675675

676676
@WorkspaceActor
@@ -713,7 +713,7 @@ extension PseudoCommandHandler {
713713
}
714714

715715
func handleAcceptSuggestionLineCommand(editor: EditorContent) async throws -> CodeSuggestion? {
716-
guard let fileURL = await XcodeInspector.shared.realtimeActiveDocumentURL
716+
guard let _ = XcodeInspector.shared.realtimeActiveDocumentURL
717717
else { return nil }
718718

719719
return try await acceptSuggestionLineInGroup(
@@ -726,7 +726,7 @@ extension PseudoCommandHandler {
726726
atIndex index: Int?,
727727
editor: EditorContent
728728
) async throws -> CodeSuggestion? {
729-
guard let fileURL = await XcodeInspector.shared.realtimeActiveDocumentURL
729+
guard let fileURL = XcodeInspector.shared.realtimeActiveDocumentURL
730730
else { return nil }
731731
let (workspace, _) = try await Service.shared.workspacePool
732732
.fetchOrCreateWorkspaceAndFilespace(fileURL: fileURL)

Core/Sources/Service/SuggestionCommandHandler/WindowBaseCommandHandler.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct WindowBaseCommandHandler: SuggestionCommandHandler {
4242
defer {
4343
presenter.markAsProcessing(false)
4444
}
45-
guard let fileURL = await XcodeInspector.shared.realtimeActiveDocumentURL
45+
guard let fileURL = XcodeInspector.shared.realtimeActiveDocumentURL
4646
else { return }
4747
let (workspace, filespace) = try await Service.shared.workspacePool
4848
.fetchOrCreateWorkspaceAndFilespace(fileURL: fileURL)
@@ -76,7 +76,7 @@ struct WindowBaseCommandHandler: SuggestionCommandHandler {
7676

7777
@WorkspaceActor
7878
private func _presentNextSuggestion(editor: EditorContent) async throws {
79-
guard let fileURL = await XcodeInspector.shared.realtimeActiveDocumentURL
79+
guard let fileURL = XcodeInspector.shared.realtimeActiveDocumentURL
8080
else { return }
8181
let (workspace, filespace) = try await Service.shared.workspacePool
8282
.fetchOrCreateWorkspaceAndFilespace(fileURL: fileURL)
@@ -102,7 +102,7 @@ struct WindowBaseCommandHandler: SuggestionCommandHandler {
102102

103103
@WorkspaceActor
104104
private func _presentPreviousSuggestion(editor: EditorContent) async throws {
105-
guard let fileURL = await XcodeInspector.shared.realtimeActiveDocumentURL
105+
guard let fileURL = XcodeInspector.shared.realtimeActiveDocumentURL
106106
else { return }
107107
let (workspace, filespace) = try await Service.shared.workspacePool
108108
.fetchOrCreateWorkspaceAndFilespace(fileURL: fileURL)
@@ -128,7 +128,7 @@ struct WindowBaseCommandHandler: SuggestionCommandHandler {
128128

129129
@WorkspaceActor
130130
private func _rejectSuggestion(editor: EditorContent) async throws {
131-
guard let fileURL = await XcodeInspector.shared.realtimeActiveDocumentURL
131+
guard let fileURL = XcodeInspector.shared.realtimeActiveDocumentURL
132132
else { return }
133133

134134
let (workspace, _) = try await Service.shared.workspacePool
@@ -139,7 +139,7 @@ struct WindowBaseCommandHandler: SuggestionCommandHandler {
139139

140140
@WorkspaceActor
141141
func acceptSuggestion(editor: EditorContent) async throws -> UpdatedContent? {
142-
guard let fileURL = await XcodeInspector.shared.realtimeActiveDocumentURL
142+
guard let fileURL = XcodeInspector.shared.realtimeActiveDocumentURL
143143
else { return nil }
144144
let (workspace, _) = try await Service.shared.workspacePool
145145
.fetchOrCreateWorkspaceAndFilespace(fileURL: fileURL)
@@ -199,7 +199,7 @@ struct WindowBaseCommandHandler: SuggestionCommandHandler {
199199
}
200200

201201
func acceptPromptToCode(editor: EditorContent) async throws -> UpdatedContent? {
202-
guard let fileURL = await XcodeInspector.shared.realtimeActiveDocumentURL
202+
guard let fileURL = XcodeInspector.shared.realtimeActiveDocumentURL
203203
else { return nil }
204204

205205
let injector = SuggestionInjector()
@@ -286,7 +286,7 @@ struct WindowBaseCommandHandler: SuggestionCommandHandler {
286286

287287
@WorkspaceActor
288288
func prepareCache(editor: EditorContent) async throws -> UpdatedContent? {
289-
guard let fileURL = await XcodeInspector.shared.realtimeActiveDocumentURL
289+
guard let fileURL = XcodeInspector.shared.realtimeActiveDocumentURL
290290
else { return nil }
291291
let (_, filespace) = try await Service.shared.workspacePool
292292
.fetchOrCreateWorkspaceAndFilespace(fileURL: fileURL)
@@ -381,7 +381,7 @@ extension WindowBaseCommandHandler {
381381
generateDescription: Bool?,
382382
name: String?
383383
) async throws {
384-
guard let fileURL = await XcodeInspector.shared.realtimeActiveDocumentURL
384+
guard let fileURL = XcodeInspector.shared.realtimeActiveDocumentURL
385385
else { return }
386386
let (workspace, _) = try await Service.shared.workspacePool
387387
.fetchOrCreateWorkspaceAndFilespace(fileURL: fileURL)

Core/Sources/SuggestionWidget/FeatureReducers/WidgetPanel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public struct WidgetPanel {
101101

102102
case .switchToAnotherEditorAndUpdateContent:
103103
return .run { send in
104-
guard let fileURL = await xcodeInspector.realtimeActiveDocumentURL
104+
guard let fileURL = xcodeInspector.realtimeActiveDocumentURL
105105
else { return }
106106

107107
await send(.sharedPanel(

Tool/Package.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,10 @@ let package = Package(
243243
]
244244
),
245245

246-
.target(name: "AXExtension"),
246+
.target(
247+
name: "AXExtension",
248+
dependencies: ["Logger"]
249+
),
247250

248251
.target(
249252
name: "AXNotificationStream",

Tool/Sources/AXExtension/AXUIElement.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import AppKit
22
import Foundation
33
import Logger
4-
#if DEBUG
5-
import IssueReporting
6-
#endif
74

85
// MARK: - State
96

@@ -188,7 +185,7 @@ public extension AXUIElement {
188185
) -> AXUIElement? {
189186
#if DEBUG
190187
if depth >= 50 {
191-
reportIssue("AXUIElement.child: Exceeding recommended depth.")
188+
fatalError("AXUIElement.child: Exceeding recommended depth.")
192189
}
193190
#endif
194191

@@ -225,7 +222,7 @@ public extension AXUIElement {
225222
func children(depth: Int = 0, where match: (AXUIElement) -> Bool) -> [AXUIElement] {
226223
#if DEBUG
227224
if depth >= 50 {
228-
reportIssue("AXUIElement.children: Exceeding recommended depth.")
225+
fatalError("AXUIElement.children: Exceeding recommended depth.")
229226
}
230227
#endif
231228

@@ -248,7 +245,7 @@ public extension AXUIElement {
248245
func firstChild(depth: Int = 0, where match: (AXUIElement) -> Bool) -> AXUIElement? {
249246
#if DEBUG
250247
if depth >= 50 {
251-
reportIssue("AXUIElement.firstChild: Exceeding recommended depth.")
248+
fatalError("AXUIElement.firstChild: Exceeding recommended depth.")
252249
}
253250
#endif
254251
for child in children {
@@ -352,5 +349,7 @@ public extension AXUIElement {
352349
}
353350
}
354351

352+
extension AXError: @retroactive _BridgedNSError {}
353+
extension AXError: @retroactive _ObjectiveCBridgeableError {}
355354
extension AXError: @retroactive Error {}
356355

Tool/Sources/AppActivator/AppActivator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public extension NSWorkspace {
3434

3535
static func activatePreviousActiveApp(delay: TimeInterval = 0.2) {
3636
Task { @MainActor in
37-
guard let app = await XcodeInspector.shared.previousActiveApplication
37+
guard let app = XcodeInspector.shared.previousActiveApplication
3838
else { return }
3939
try await Task.sleep(nanoseconds: UInt64(delay * 1_000_000_000))
4040
activateApp(app)
@@ -43,7 +43,7 @@ public extension NSWorkspace {
4343

4444
static func activatePreviousActiveXcode(delay: TimeInterval = 0.2) {
4545
Task { @MainActor in
46-
guard let app = await XcodeInspector.shared.latestActiveXcode else { return }
46+
guard let app = XcodeInspector.shared.latestActiveXcode else { return }
4747
try await Task.sleep(nanoseconds: UInt64(delay * 1_000_000_000))
4848
activateApp(app)
4949
}

0 commit comments

Comments
 (0)