Skip to content

Commit 5898b16

Browse files
committed
Merge branch 'release/0.22.3'
2 parents f8e27a8 + fab4d33 commit 5898b16

7 files changed

Lines changed: 91 additions & 20 deletions

File tree

Core/Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ let package = Package(
119119
"LaunchAgentManager",
120120
"PlusFeatureFlag",
121121
.product(name: "Toast", package: "Tool"),
122+
.product(name: "SharedUIComponents", package: "Tool"),
122123
.product(name: "SuggestionModel", package: "Tool"),
123124
.product(name: "MarkdownUI", package: "swift-markdown-ui"),
124125
.product(name: "OpenAIService", package: "Tool"),

Core/Sources/HostApp/AccountSettings/CopilotView.swift

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import AppKit
22
import Client
33
import GitHubCopilotService
44
import Preferences
5+
import SharedUIComponents
56
import SuggestionModel
67
import SwiftUI
78

@@ -32,7 +33,7 @@ struct CopilotView: View {
3233
@Published var installationStep: GitHubCopilotInstallationManager.InstallationStep?
3334

3435
init() {}
35-
36+
3637
init(
3738
installationStatus: GitHubCopilotInstallationManager.InstallationStatus,
3839
installationStep: GitHubCopilotInstallationManager.InstallationStep?
@@ -142,10 +143,23 @@ struct CopilotView: View {
142143
HStack {
143144
VStack(alignment: .leading, spacing: 8) {
144145
Form {
145-
TextField(text: $settings.nodePath, prompt: Text("node")) {
146+
TextField(
147+
text: $settings.nodePath,
148+
prompt: Text(
149+
"node"
150+
)
151+
) {
146152
Text("Path to Node (v17+)")
147153
}
148154

155+
Text(
156+
"Provide the path to the executable if it can't be found by the app, shim executable is not supported"
157+
)
158+
.lineLimit(10)
159+
.foregroundColor(.secondary)
160+
.font(.callout)
161+
.dynamicHeightTextInFormWorkaround()
162+
149163
Picker(selection: $settings.runNodeWith) {
150164
ForEach(NodeRunner.allCases, id: \.rawValue) { runner in
151165
switch runner {
@@ -160,11 +174,28 @@ struct CopilotView: View {
160174
} label: {
161175
Text("Run Node with")
162176
}
177+
178+
Group {
179+
switch settings.runNodeWith {
180+
case .env:
181+
Text(
182+
"PATH: `/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`"
183+
)
184+
case .bash:
185+
Text("PATH inherited from bash configurations.")
186+
case .shell:
187+
Text("PATH inherited from $SHELL configurations.")
188+
}
189+
}
190+
.lineLimit(10)
191+
.foregroundColor(.secondary)
192+
.font(.callout)
193+
.dynamicHeightTextInFormWorkaround()
163194
}
164195

165-
Text(
166-
"You may have to restart the helper app to apply the changes. To do so, simply close the helper app by clicking on the menu bar icon that looks like a steer wheel, it will automatically restart as needed."
167-
)
196+
Text("""
197+
You may have to restart the helper app to apply the changes. To do so, simply close the helper app by clicking on the menu bar icon that looks like a tentacle, it will automatically restart as needed.
198+
""")
168199
.lineLimit(6)
169200
.fixedSize(horizontal: false, vertical: true)
170201
.foregroundColor(.secondary)
@@ -236,9 +267,16 @@ struct CopilotView: View {
236267

237268
Form {
238269
Toggle(
239-
"Ignore Trailing New Lines and Whitespaces",
270+
"Remove Extra New Lines Generated by GitHub Copilot",
240271
isOn: $settings.gitHubCopilotIgnoreTrailingNewLines
241272
)
273+
Text(
274+
"Sometimes GitHub Copilot may generate extra unwanted new lines at the end of a suggestion. If you don't like that, you can turn this toggle on."
275+
)
276+
.lineLimit(10)
277+
.foregroundColor(.secondary)
278+
.font(.callout)
279+
.dynamicHeightTextInFormWorkaround()
242280
Toggle("Verbose Log", isOn: $settings.gitHubCopilotVerboseLog)
243281
}
244282

Core/Sources/Service/RealtimeSuggestionController.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import QuartzCore
1212
import Workspace
1313
import XcodeInspector
1414

15-
public class RealtimeSuggestionController {
15+
public actor RealtimeSuggestionController {
1616
let eventObserver: CGEventObserverType = CGEventObserver(eventsOfInterest: [.keyDown])
1717
private var task: Task<Void, Error>?
1818
private var inflightPrefetchTask: Task<Void, Error>?
@@ -23,12 +23,13 @@ public class RealtimeSuggestionController {
2323
private var sourceEditor: SourceEditor?
2424

2525
init() {}
26-
26+
27+
nonisolated
2728
func start() {
2829
Task { [weak self] in
2930
if let app = ActiveApplicationMonitor.shared.activeXcode {
30-
self?.handleXcodeChanged(app)
31-
self?.startHIDObservation()
31+
await self?.handleXcodeChanged(app)
32+
await self?.startHIDObservation()
3233
}
3334
var previousApp = ActiveApplicationMonitor.shared.activeXcode
3435
for await app in ActiveApplicationMonitor.shared.createStream() {
@@ -37,13 +38,13 @@ public class RealtimeSuggestionController {
3738
defer { previousApp = app }
3839

3940
if let app = ActiveApplicationMonitor.shared.activeXcode, app != previousApp {
40-
self.handleXcodeChanged(app)
41+
await self.handleXcodeChanged(app)
4142
}
4243

4344
if ActiveApplicationMonitor.shared.activeXcode != nil {
44-
startHIDObservation()
45+
await startHIDObservation()
4546
} else {
46-
stopHIDObservation()
47+
await stopHIDObservation()
4748
}
4849
}
4950
}
@@ -85,7 +86,7 @@ public class RealtimeSuggestionController {
8586
for await _ in notifications {
8687
guard let self else { return }
8788
try Task.checkCancellation()
88-
self.handleFocusElementChange()
89+
await self.handleFocusElementChange()
8990
}
9091
}
9192
}
@@ -112,7 +113,7 @@ public class RealtimeSuggestionController {
112113

113114
editorObservationTask = Task { [weak self] in
114115
let fileURL = try await Environment.fetchCurrentFileURL()
115-
if let sourceEditor = self?.sourceEditor {
116+
if let sourceEditor = await self?.sourceEditor {
116117
await PseudoCommandHandler().invalidateRealtimeSuggestionsIfNeeded(
117118
fileURL: fileURL,
118119
sourceEditor: sourceEditor
@@ -132,10 +133,10 @@ public class RealtimeSuggestionController {
132133
switch notification.name {
133134
case kAXValueChangedNotification:
134135
await cancelInFlightTasks()
135-
self.triggerPrefetchDebounced()
136+
await self.triggerPrefetchDebounced()
136137
await self.notifyEditingFileChange(editor: focusElement)
137138
case kAXSelectedTextChangedNotification:
138-
guard let sourceEditor else { continue }
139+
guard let sourceEditor = await sourceEditor else { continue }
139140
let fileURL = XcodeInspector.shared.activeDocumentURL
140141
await PseudoCommandHandler().invalidateRealtimeSuggestionsIfNeeded(
141142
fileURL: fileURL,

Core/Sources/SuggestionWidget/ChatWindowView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,10 @@ struct ChatTabContainer: View {
333333
} else {
334334
ForEach(viewStore.state.tabInfo) { tabInfo in
335335
if let tab = chatTabPool.getTab(of: tabInfo.id) {
336+
let isActive = tab.id == viewStore.state.selectedTabId
336337
tab.body
337-
.opacity(tab.id == viewStore.state.selectedTabId ? 1 : 0)
338+
.opacity(isActive ? 1 : 0)
339+
.disabled(!isActive)
338340
.frame(maxWidth: .infinity, maxHeight: .infinity)
339341
} else {
340342
EmptyView()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import SwiftUI
2+
3+
struct DynamicHeightTextInFormWorkaroundModifier: ViewModifier {
4+
func body(content: Content) -> some View {
5+
HStack(spacing: 0) {
6+
content
7+
Spacer()
8+
}
9+
.fixedSize(horizontal: false, vertical: true)
10+
}
11+
}
12+
13+
public extension View {
14+
func dynamicHeightTextInFormWorkaround() -> some View {
15+
modifier(DynamicHeightTextInFormWorkaroundModifier())
16+
}
17+
}

Version.xcconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
APP_VERSION = 0.22.2
2-
APP_BUILD = 232
1+
APP_VERSION = 0.22.3
2+
APP_BUILD = 233

appcast.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
<channel>
44
<title>Copilot for Xcode</title>
55

6+
<item>
7+
<title>0.22.3</title>
8+
<pubDate>Sat, 02 Sep 2023 15:51:16 +0800</pubDate>
9+
<sparkle:version>233</sparkle:version>
10+
<sparkle:shortVersionString>0.22.3</sparkle:shortVersionString>
11+
<sparkle:minimumSystemVersion>12.0</sparkle:minimumSystemVersion>
12+
<sparkle:releaseNotesLink>
13+
https://github.com/intitni/CopilotForXcode/releases/tag/0.22.3
14+
</sparkle:releaseNotesLink>
15+
<enclosure url="https://github.com/intitni/CopilotForXcode/releases/download/0.22.3/Copilot.for.Xcode.app.zip" length="31397137" type="application/octet-stream" sparkle:edSignature="1wu9QYOxI9TkSY2/+JcRZFv/9WjvRwMZ0j1Hdt3x4hh0QSxP5xELKJZzMkf7yOTz0qyNM/5mbmAmCtO6nP4gAg=="/>
16+
</item>
17+
618
<item>
719
<title>0.22.2</title>
820
<pubDate>Sat, 19 Aug 2023 10:48:38 +0800</pubDate>

0 commit comments

Comments
 (0)