Skip to content

Commit e39fdc0

Browse files
committed
Merge branch 'feature/realtime-suggestion-indicator' into develop
2 parents 3286f31 + e18e53c commit e39fdc0

File tree

9 files changed

+342
-167
lines changed

9 files changed

+342
-167
lines changed

Copilot for Xcode.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
C882175A294187E100A22FD3 /* Client in Frameworks */ = {isa = PBXBuildFile; productRef = C8821759294187E100A22FD3 /* Client */; };
4646
C882175C294187EF00A22FD3 /* Client in Frameworks */ = {isa = PBXBuildFile; productRef = C882175B294187EF00A22FD3 /* Client */; };
4747
C882175E294187F900A22FD3 /* Service in Frameworks */ = {isa = PBXBuildFile; productRef = C882175D294187F900A22FD3 /* Service */; };
48+
C8FFC1D329939F7F002F4CA4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8FFC1D229939F7F002F4CA4 /* AppDelegate.swift */; };
4849
/* End PBXBuildFile section */
4950

5051
/* Begin PBXContainerItemProxy section */
@@ -193,6 +194,7 @@
193194
C87F3E5F293DC600008523E8 /* Section.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Section.swift; sourceTree = "<group>"; };
194195
C87F3E61293DD004008523E8 /* Styles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Styles.swift; sourceTree = "<group>"; };
195196
C887BC832965D96000931567 /* DEVELOPMENT.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = DEVELOPMENT.md; sourceTree = "<group>"; };
197+
C8FFC1D229939F7F002F4CA4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
196198
/* End PBXFileReference section */
197199

198200
/* Begin PBXFrameworksBuildPhase section */
@@ -268,6 +270,7 @@
268270
C848181C293A017300966BB2 /* XPCService.entitlements */,
269271
C81458BC293A016100135263 /* Info.plist */,
270272
C81458B7293A015C00135263 /* main.swift */,
273+
C8FFC1D229939F7F002F4CA4 /* AppDelegate.swift */,
271274
C87B03B3293B393100C77EAE /* ServiceDelegate.swift */,
272275
);
273276
path = XPCService;
@@ -521,6 +524,7 @@
521524
isa = PBXSourcesBuildPhase;
522525
buildActionMask = 2147483647;
523526
files = (
527+
C8FFC1D329939F7F002F4CA4 /* AppDelegate.swift in Sources */,
524528
C81458B8293A015C00135263 /* main.swift in Sources */,
525529
C87B03B4293B393100C77EAE /* ServiceDelegate.swift in Sources */,
526530
);

Core/Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ let package = Package(
2020
.package(url: "https://github.com/ChimeHQ/LanguageClient", from: "0.3.1"),
2121
],
2222
targets: [
23+
.target(name: "CGEventObserver"),
2324
.target(
2425
name: "CopilotService",
2526
dependencies: ["LanguageClient", "CopilotModel", "XPCShared"]
@@ -50,7 +51,7 @@ let package = Package(
5051
),
5152
.target(
5253
name: "Service",
53-
dependencies: ["CopilotModel", "CopilotService", "XPCShared"]
54+
dependencies: ["CopilotModel", "CopilotService", "XPCShared", "CGEventObserver"]
5455
),
5556
.target(
5657
name: "XPCShared",

Core/Sources/Service/CGEventObserver.swift renamed to Core/Sources/CGEventObserver/CGEventObserver.swift

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,13 @@ public protocol CGEventObserverType {
1010
var isEnabled: Bool { get }
1111
}
1212

13-
final class CGEventObserver: CGEventObserverType {
14-
let stream: AsyncStream<CGEvent>
15-
var isEnabled: Bool { port != nil }
13+
public final class CGEventObserver: CGEventObserverType {
14+
public let stream: AsyncStream<CGEvent>
15+
public var isEnabled: Bool { port != nil }
1616

1717
private var continuation: AsyncStream<CGEvent>.Continuation
1818
private var port: CFMachPort?
19-
private let eventsOfInterest: Set<CGEventType> = [
20-
.keyUp,
21-
.keyDown,
22-
.rightMouseDown,
23-
.leftMouseDown,
24-
]
19+
private let eventsOfInterest: Set<CGEventType>
2520
private let tapLocation: CGEventTapLocation = .cghidEventTap
2621
private let tapPlacement: CGEventTapPlacement = .tailAppendEventTap
2722
private let tapOptions: CGEventTapOptions = .listenOnly
@@ -32,7 +27,8 @@ final class CGEventObserver: CGEventObserverType {
3227
CFMachPortInvalidate(port)
3328
}
3429

35-
init() {
30+
public init(eventsOfInterest: Set<CGEventType>) {
31+
self.eventsOfInterest = eventsOfInterest
3632
var continuation: AsyncStream<CGEvent>.Continuation!
3733
stream = AsyncStream { c in
3834
continuation = c

Core/Sources/Service/AutoTrigger.swift

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

Core/Sources/Service/Helpers.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ func runAppleScript(_ appleScript: String) async throws -> String {
1616
task.arguments = ["-e", appleScript]
1717
let outpipe = Pipe()
1818
task.standardOutput = outpipe
19-
#if DEBUG
20-
#else
2119
task.standardError = Pipe()
22-
#endif
2320

2421
return try await withUnsafeThrowingContinuation { continuation in
2522
do {

0 commit comments

Comments
 (0)