Skip to content

Commit 1822b1f

Browse files
committed
Format files
1 parent e29df87 commit 1822b1f

File tree

10 files changed

+38
-24
lines changed

10 files changed

+38
-24
lines changed

Copilot for Xcode/CopilotView.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,12 @@ struct CopilotView_Previews: PreviewProvider {
169169
VStack(alignment: .leading, spacing: 8) {
170170
CopilotView(copilotStatus: .notSignedIn, version: "1.0.0", xpcServiceVersion: "0.0.0")
171171

172-
CopilotView(copilotStatus: .alreadySignedIn, message: "Error", xpcServiceVersion: Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "")
172+
CopilotView(
173+
copilotStatus: .alreadySignedIn,
174+
message: "Error",
175+
xpcServiceVersion: Bundle.main
176+
.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
177+
)
173178

174179
CopilotView(copilotStatus: .alreadySignedIn, isRunningAction: true)
175180
}

Copilot for Xcode/InstructionView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Text("""
2020
6. Go to `System Settings.app > Privacy & Security > Extensions > Xcode Source Editor` , check the **Copilot** checkbox to enable the extension.
2121
7. Restart Xcode, the Copilot commands should be available in the menu bar.
2222
""")
23-
23+
2424
Text("Granting Permissions")
2525
.font(.title3)
2626
Text("""

Core/Sources/Client/AsyncXPCService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public struct AsyncXPCService {
2525
}
2626
}
2727
}
28-
28+
2929
public func getXPCServiceVersion() async throws -> (version: String, build: String) {
3030
try await withXPCServiceConnected(connection: connection) {
3131
service, continuation in

Core/Sources/Client/XPCService.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public func getService() throws -> AsyncXPCService {
1515
class XPCService {
1616
private var isInvalidated = false
1717
private lazy var _connection: NSXPCConnection = buildConnection()
18-
18+
1919
var connection: NSXPCConnection {
2020
if isInvalidated {
2121
_connection.invalidationHandler = {}
@@ -26,11 +26,12 @@ class XPCService {
2626
}
2727
return _connection
2828
}
29-
29+
3030
private func buildConnection() -> NSXPCConnection {
3131
let connection = NSXPCConnection(
3232
machServiceName: Bundle(for: XPCService.self)
33-
.object(forInfoDictionaryKey: "BUNDLE_IDENTIFIER_BASE") as! String + ".ExtensionService"
33+
.object(forInfoDictionaryKey: "BUNDLE_IDENTIFIER_BASE") as! String +
34+
".ExtensionService"
3435
)
3536
connection.remoteObjectInterface =
3637
NSXPCInterface(with: XPCServiceProtocol.self)
@@ -45,7 +46,7 @@ class XPCService {
4546
connection.resume()
4647
return connection
4748
}
48-
49+
4950
func rebuildConnection() {
5051
_connection = buildConnection()
5152
}

Core/Sources/CopilotService/CopilotService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class CopilotBaseService {
7171
}()
7272
let localServer = CopilotLocalProcessServer(executionParameters: executionParams)
7373
localServer.logMessages = false
74-
localServer.notificationHandler = { notification, respond in
74+
localServer.notificationHandler = { _, respond in
7575
respond(.timeout)
7676
}
7777
let server = InitializingServer(server: localServer)
@@ -141,7 +141,7 @@ public final class CopilotSuggestionService: CopilotBaseService, CopilotSuggesti
141141
override public init(projectRootURL: URL = URL(fileURLWithPath: "/")) {
142142
super.init(projectRootURL: projectRootURL)
143143
}
144-
144+
145145
override init(designatedServer: CopilotLSP) {
146146
super.init(designatedServer: designatedServer)
147147
}

Core/Sources/Service/Environment.swift

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ enum Environment {
4343
}
4444
return !activeXcodes.isEmpty
4545
}
46-
46+
4747
static var frontmostXcodeWindowIsEditor: () async -> Bool = {
4848
let appleScript = """
4949
tell application "Xcode"
@@ -53,8 +53,7 @@ enum Environment {
5353
do {
5454
let result = try await runAppleScript(appleScript)
5555
return !result.isEmpty
56-
}
57-
catch {
56+
} catch {
5857
return false
5958
}
6059
}
@@ -204,10 +203,19 @@ extension AXUIElement {
204203
}
205204
throw error
206205
}
207-
208-
func copyParameterizedValue<T>(key: String, parameters: AnyObject, ofType _: T.Type = T.self) throws -> T {
206+
207+
func copyParameterizedValue<T>(
208+
key: String,
209+
parameters: AnyObject,
210+
ofType _: T.Type = T.self
211+
) throws -> T {
209212
var value: AnyObject?
210-
let error = AXUIElementCopyParameterizedAttributeValue(self, key as CFString, parameters as CFTypeRef, &value)
213+
let error = AXUIElementCopyParameterizedAttributeValue(
214+
self,
215+
key as CFString,
216+
parameters as CFTypeRef,
217+
&value
218+
)
211219
if error == .success, let value = value as? T {
212220
return value
213221
}

Core/Sources/Service/RealtimeSuggestionController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ public actor RealtimeSuggestionController {
103103
if isEditing, code == escape {
104104
return true
105105
}
106-
106+
107107
// escape and arrows to cancel
108108

109109
if code == escape {
110110
return false
111111
}
112-
112+
113113
if arrowKeys.contains(code) {
114114
return false
115115
}

ExtensionService/AppDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
1818
private let userDefaultsObserver = UserDefaultsObserver()
1919
private var statusBarItem: NSStatusItem!
2020
private var xpcListener: (NSXPCListener, ServiceDelegate)?
21-
21+
2222
func applicationDidFinishLaunching(_: Notification) {
2323
// setup real-time suggestion controller
2424
_ = RealtimeSuggestionController.shared
@@ -166,7 +166,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
166166
}
167167
}
168168
}
169-
169+
170170
func setupXPCListener() -> (NSXPCListener, ServiceDelegate) {
171171
let listener = NSXPCListener(machServiceName: serviceIdentifier)
172172
let delegate = ServiceDelegate()

Helper/ReloadLaunchAgent.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ struct ReloadLaunchAgent: ParsableCommand {
55
static var configuration = CommandConfiguration(
66
abstract: "Reload the launch agent"
77
)
8-
8+
99
@Option(name: .long, help: "The service identifier of the service.")
1010
var serviceIdentifier: String
11-
11+
1212
var launchAgentDirURL: URL {
1313
FileManager.default.homeDirectoryForCurrentUser
1414
.appendingPathComponent("Library/LaunchAgents")
1515
}
16-
16+
1717
var launchAgentPath: String {
1818
launchAgentDirURL.appendingPathComponent("\(serviceIdentifier).plist").path
1919
}
20-
20+
2121
func run() throws {
2222
try? launchctl("unload", launchAgentPath)
2323
try launchctl("load", launchAgentPath)

Helper/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct Helper: ParsableCommand {
66
commandName: "helper",
77
abstract: "Helper CLI for Copilot for Xcode",
88
subcommands: [
9-
ReloadLaunchAgent.self
9+
ReloadLaunchAgent.self,
1010
]
1111
)
1212
}

0 commit comments

Comments
 (0)