Pre-release 0.28.95 · github/CopilotForXcode@33b6371 · GitHub
Skip to content

Commit 33b6371

Browse files
committed
Pre-release 0.28.95
1 parent 8353a90 commit 33b6371

32 files changed

Lines changed: 424 additions & 125 deletions

‎Copilot for Xcode.xcodeproj/project.pbxproj‎

Lines changed: 0 additions & 4 deletions

‎Core/Sources/HostApp/GitHubCopilotViewModel.swift‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import Foundation
12
import GitHubCopilotService
23
import ComposableArchitecture
4+
import Status
35
import SwiftUI
46

57
struct SignInResponse {
@@ -79,6 +81,7 @@ class GitHubCopilotViewModel: ObservableObject {
7981
do {
8082
let service = try getGitHubCopilotAuthService()
8183
status = try await service.signOut()
84+
broadcastStatusChange()
8285
} catch {
8386
toast(error.localizedDescription, .error)
8487
}
@@ -118,6 +121,7 @@ class GitHubCopilotViewModel: ObservableObject {
118121
waitingForSignIn = false
119122
self.username = username
120123
self.status = status
124+
broadcastStatusChange()
121125
} catch let error as GitHubCopilotError {
122126
if case .languageServerError(.timeout) = error {
123127
// TODO figure out how to extend the default timeout on a Chime LSP request
@@ -131,4 +135,11 @@ class GitHubCopilotViewModel: ObservableObject {
131135
}
132136
}
133137
}
138+
139+
func broadcastStatusChange() {
140+
DistributedNotificationCenter.default().post(
141+
name: .authStatusDidChange,
142+
object: nil
143+
)
144+
}
134145
}

‎Core/Sources/Service/Service.swift‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public final class Service {
3232
let globalShortcutManager: GlobalShortcutManager
3333
let keyBindingManager: KeyBindingManager
3434
let xcodeThemeController: XcodeThemeController = .init()
35-
public var markAsProcessing: (Bool) -> Void = { _ in }
3635

3736
@Dependency(\.toast) var toast
3837
var cancellable = Set<AnyCancellable>()

‎Core/Sources/Service/SuggestionPresenter/PresentInWindowSuggestionPresenter.swift‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ struct PresentInWindowSuggestionPresenter {
3030
Task { @MainActor in
3131
let controller = Service.shared.guiController.widgetController
3232
controller.markAsProcessing(isProcessing)
33-
Service.shared.markAsProcessing(isProcessing)
3433
}
3534
}
3635

‎Docs/downloaded-from-internet.png‎

-247 KB
Binary file not shown.

‎ExtensionService/AppDelegate+Menu.swift‎

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ extension AppDelegate {
2727
.init("toggleIgnoreLanguageMenuItem")
2828
}
2929

30-
fileprivate var copilotStatusMenuItemIdentifier: NSUserInterfaceItemIdentifier {
31-
.init("copilotStatusMenuItem")
32-
}
33-
3430
@MainActor
3531
@objc func buildStatusBarMenu() {
3632
let statusBar = NSStatusBar.system
@@ -52,7 +48,7 @@ extension AppDelegate {
5248
keyEquivalent: ""
5349
)
5450

55-
let openCopilotForXcode = NSMenuItem(
51+
let openCopilotForXcodeItem = NSMenuItem(
5652
title: "Open \(hostAppName) Settings",
5753
action: #selector(openCopilotForXcode),
5854
keyEquivalent: ""
@@ -97,12 +93,11 @@ extension AppDelegate {
9793
)
9894
toggleIgnoreLanguage.identifier = toggleIgnoreLanguageMenuItemIdentifier;
9995

100-
let copilotStatus = NSMenuItem(
96+
authMenuItem = NSMenuItem(
10197
title: "Copilot Connection: Checking...",
102-
action: nil,
98+
action: #selector(openCopilotForXcode),
10399
keyEquivalent: ""
104100
)
105-
copilotStatus.identifier = copilotStatusMenuItemIdentifier
106101

107102
let openDocs = NSMenuItem(
108103
title: "View Copilot Documentation...",
@@ -116,13 +111,13 @@ extension AppDelegate {
116111
keyEquivalent: ""
117112
)
118113

119-
statusBarMenu.addItem(openCopilotForXcode)
114+
statusBarMenu.addItem(openCopilotForXcodeItem)
120115
statusBarMenu.addItem(.separator())
121116
statusBarMenu.addItem(checkForUpdate)
122117
statusBarMenu.addItem(toggleCompletions)
123118
statusBarMenu.addItem(toggleIgnoreLanguage)
124119
statusBarMenu.addItem(.separator())
125-
statusBarMenu.addItem(copilotStatus)
120+
statusBarMenu.addItem(authMenuItem)
126121
statusBarMenu.addItem(statusMenuItem)
127122
statusBarMenu.addItem(.separator())
128123
statusBarMenu.addItem(openDocs)
@@ -165,14 +160,6 @@ extension AppDelegate: NSMenuDelegate {
165160
}
166161
}
167162

168-
statusChecker.updateStatusInBackground(notify: { (status: String, isOk: Bool) in
169-
if let statusItem = menu.items.first(where: { item in
170-
item.identifier == self.copilotStatusMenuItemIdentifier
171-
}) {
172-
statusItem.title = "Copilot Connection: \(isOk ? "Connected" : status)"
173-
}
174-
})
175-
176163
case xcodeInspectorDebugMenuIdentifier:
177164
let inspector = XcodeInspector.shared
178165
menu.items.removeAll()

‎ExtensionService/AppDelegate.swift‎

Lines changed: 38 additions & 14 deletions
107 Bytes
Loading
106 Bytes
Loading
-1.19 KB
Loading

0 commit comments

Comments
 (0)