Skip to content

Commit 94ff89c

Browse files
committed
Merge branch 'release/0.33.4'
2 parents 4d83f2b + 10285bd commit 94ff89c

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

Tool/Sources/SharedUIComponents/AsyncCodeBlock.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public struct AsyncCodeBlock: View {
1313
)
1414

1515
var dimmedCharacterCount: Int = 0
16+
var code: String?
1617
private var highlightedCode = [NSAttributedString]()
1718
private var foregroundColor: Color = .primary
1819
private(set) var commonPrecedingSpaceCount = 0
@@ -69,19 +70,23 @@ public struct AsyncCodeBlock: View {
6970
@PerceptionIgnored private var debounceFunction: DebounceFunction<AsyncCodeBlock>?
7071
@PerceptionIgnored private var highlightTask: Task<Void, Error>?
7172

72-
init() {}
73+
init() {
74+
debounceFunction = .init(duration: 0.1, block: { view in
75+
self.highlight(for: view)
76+
})
77+
}
7378

7479
func highlight(debounce: Bool, for view: AsyncCodeBlock) {
7580
if debounce {
76-
Task { await debounceFunction?(view) }
81+
Task { @MainActor in await debounceFunction?(view) }
7782
} else {
7883
highlight(for: view)
7984
}
8085
}
8186

8287
private func highlight(for view: AsyncCodeBlock) {
8388
highlightTask?.cancel()
84-
let code = view.code
89+
let code = self.code ?? view.code
8590
let language = view.language
8691
let scenario = view.scenario
8792
let brightMode = view.colorScheme != .dark
@@ -197,7 +202,8 @@ public struct AsyncCodeBlock: View {
197202
storage.dimmedCharacterCount = dimmedCharacterCount
198203
storage.highlight(debounce: false, for: self)
199204
}
200-
.onChange(of: code) { _ in
205+
.onChange(of: code) { code in
206+
storage.code = code // But why do we need this? Time to learn some SwiftUI!
201207
storage.highlight(debounce: true, for: self)
202208
}
203209
.onChange(of: colorScheme) { _ in

Version.xcconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
APP_VERSION = 0.33.3
2-
APP_BUILD = 388
1+
APP_VERSION = 0.33.4
2+
APP_BUILD = 390
33

appcast.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
<rss xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" version="2.0">
33
<channel>
44
<title>Copilot for Xcode</title>
5+
<item>
6+
<title>0.33.4</title>
7+
<pubDate>Tue, 18 Jun 2024 14:55:47 +0800</pubDate>
8+
<sparkle:version>390</sparkle:version>
9+
<sparkle:shortVersionString>0.33.4</sparkle:shortVersionString>
10+
<sparkle:minimumSystemVersion>12.0</sparkle:minimumSystemVersion>
11+
<sparkle:releaseNotesLink>https://github.com/intitni/CopilotForXcode/releases/tag/0.33.4</sparkle:releaseNotesLink>
12+
<enclosure url="https://github.com/intitni/CopilotForXcode/releases/download/0.33.4/Copilot.for.Xcode.app.zip" length="50149383" type="application/octet-stream" sparkle:edSignature="8jdvlcOPkWyYkXZGtExfvhtQY2/Huij6ukOKuuHbK+nc6U+RT6DepV3JIS7ETcfJ+2TohS79Eq6D3/9c4V/aAA=="/>
13+
</item>
514
<item>
615
<title>0.33.3</title>
716
<pubDate>Tue, 18 Jun 2024 00:03:29 +0800</pubDate>
@@ -20,15 +29,6 @@
2029
<sparkle:releaseNotesLink>https://github.com/intitni/CopilotForXcode/releases/tag/0.33.2</sparkle:releaseNotesLink>
2130
<enclosure url="https://github.com/intitni/CopilotForXcode/releases/download/0.33.2/Copilot.for.Xcode.app.zip" length="50260794" type="application/octet-stream" sparkle:edSignature="l9n9W78mnkHbkUIAl+a9q11f9zvG1EF0UAqnbTnCl5xfoKaZpquA12evzOa6dypM1ra+IyWCM7VJ97uKf+DeAg=="/>
2231
</item>
23-
<item>
24-
<title>0.33.1</title>
25-
<pubDate>Mon, 27 May 2024 16:28:20 +0800</pubDate>
26-
<sparkle:version>382</sparkle:version>
27-
<sparkle:shortVersionString>0.33.1</sparkle:shortVersionString>
28-
<sparkle:minimumSystemVersion>12.0</sparkle:minimumSystemVersion>
29-
<sparkle:releaseNotesLink>https://github.com/intitni/CopilotForXcode/releases/tag/0.33.1</sparkle:releaseNotesLink>
30-
<enclosure url="https://github.com/intitni/CopilotForXcode/releases/download/0.33.1/Copilot.for.Xcode.app.zip" length="50218079" type="application/octet-stream" sparkle:edSignature="UGIbKuMMIWyIShfPVvdePkw8PU6IVPls8cjSbz8tien0nGxKGGhtJf4X3w+AmcfyZb666HEe+Kf4fJiUIOIqBw=="/>
31-
</item>
3232
<item>
3333
<title>0.33.1</title>
3434
<pubDate>Sat, 25 May 2024 03:24:57 +0800</pubDate>

0 commit comments

Comments
 (0)