Skip to content

Commit 2ab65a5

Browse files
committed
Merge branch 'release/0.35.2'
2 parents 8430303 + 685c6e0 commit 2ab65a5

28 files changed

+817
-189
lines changed

Core/Sources/HostApp/FeatureSettings/Chat/ChatSettingsGeneralSectionView.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,19 @@ struct ChatSettingsGeneralSectionView: View {
252252
Text("7 Messages").tag(7)
253253
Text("9 Messages").tag(9)
254254
Text("11 Messages").tag(11)
255+
Text("21 Messages").tag(21)
256+
Text("31 Messages").tag(31)
257+
Text("41 Messages").tag(41)
258+
Text("51 Messages").tag(51)
259+
Text("71 Messages").tag(71)
260+
Text("91 Messages").tag(91)
261+
Text("111 Messages").tag(111)
262+
Text("151 Messages").tag(151)
263+
Text("201 Messages").tag(201)
255264
}
256265

257266
VStack(alignment: .leading, spacing: 4) {
258-
Text("Default system prompt")
267+
Text("Additional system prompt")
259268
EditableText(text: $settings.defaultChatSystemPrompt)
260269
.lineLimit(6)
261270
}

Core/Sources/SuggestionWidget/FeatureReducers/PromptToCodePanel.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public struct PromptToCodePanel {
8484
case cancelButtonTapped
8585
case acceptButtonTapped
8686
case acceptAndContinueButtonTapped
87+
case statusUpdated([String])
8788
case snippetPanel(IdentifiedActionOf<PromptToCodeSnippetPanel>)
8889
}
8990

@@ -128,7 +129,9 @@ public struct PromptToCodePanel {
128129

129130
return .run { send in
130131
do {
131-
let context = await contextInputController.resolveContext()
132+
let context = await contextInputController.resolveContext(onStatusChange: {
133+
await send(.statusUpdated($0))
134+
})
132135
let agentFactory = context.agent ?? { SimpleModificationAgent() }
133136
_ = try await withThrowingTaskGroup(of: Void.self) { group in
134137
for (index, snippet) in snippets.enumerated() {
@@ -216,11 +219,13 @@ public struct PromptToCodePanel {
216219

217220
case .stopRespondingButtonTapped:
218221
state.promptToCodeState.isGenerating = false
222+
state.promptToCodeState.status = []
219223
return .cancel(id: CancellationKey.modifyCode(state.id))
220224

221225
case .modifyCodeFinished:
222226
state.contextInputController.instruction = .init("")
223227
state.promptToCodeState.isGenerating = false
228+
state.promptToCodeState.status = []
224229

225230
if state.promptToCodeState.snippets.allSatisfy({ snippet in
226231
snippet.modifiedCode.isEmpty && snippet.description.isEmpty && snippet
@@ -252,6 +257,10 @@ public struct PromptToCodePanel {
252257
await commandHandler.acceptModification()
253258
activateThisApp()
254259
}
260+
261+
case let .statusUpdated(status):
262+
state.promptToCodeState.status = status
263+
return .none
255264
}
256265
}
257266

Core/Sources/SuggestionWidget/SuggestionPanelContent/PromptToCodePanelView.swift

Lines changed: 163 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,17 @@ struct PromptToCodePanelView: View {
2323
TopBar(store: store)
2424

2525
Content(store: store)
26-
.overlay(alignment: .bottom) {
27-
ActionBar(store: store)
28-
}
2926
.safeAreaInset(edge: .bottom) {
30-
if let inputField = customizedViews.contextInputField {
31-
inputField
32-
} else {
33-
Toolbar(store: store)
27+
VStack {
28+
StatusBar(store: store)
29+
30+
ActionBar(store: store)
31+
32+
if let inputField = customizedViews.contextInputField {
33+
inputField
34+
} else {
35+
Toolbar(store: store)
36+
}
3437
}
3538
}
3639
}
@@ -143,6 +146,70 @@ extension PromptToCodePanelView {
143146
}
144147
}
145148

149+
struct StatusBar: View {
150+
let store: StoreOf<PromptToCodePanel>
151+
@State var isAllStatusesPresented = false
152+
var body: some View {
153+
WithPerceptionTracking {
154+
if store.promptToCodeState.isGenerating, !store.promptToCodeState.status.isEmpty {
155+
if let firstStatus = store.promptToCodeState.status.first {
156+
let count = store.promptToCodeState.status.count
157+
Button(action: {
158+
isAllStatusesPresented = true
159+
}) {
160+
HStack {
161+
Text(firstStatus)
162+
.lineLimit(1)
163+
.font(.caption)
164+
165+
Text("\(count)")
166+
.lineLimit(1)
167+
.font(.caption)
168+
.background(
169+
Circle()
170+
.fill(Color.secondary.opacity(0.3))
171+
.frame(width: 12, height: 12)
172+
)
173+
}
174+
.padding(8)
175+
.background(
176+
.regularMaterial,
177+
in: RoundedRectangle(cornerRadius: 6, style: .continuous)
178+
)
179+
.overlay {
180+
RoundedRectangle(cornerRadius: 6, style: .continuous)
181+
.stroke(Color(nsColor: .separatorColor), lineWidth: 1)
182+
}
183+
.contentShape(Rectangle())
184+
}
185+
.buttonStyle(.plain)
186+
.frame(maxWidth: 400)
187+
.popover(isPresented: $isAllStatusesPresented, arrowEdge: .top) {
188+
WithPerceptionTracking {
189+
VStack(alignment: .leading, spacing: 16) {
190+
ForEach(store.promptToCodeState.status, id: \.self) { status in
191+
HStack {
192+
ProgressView()
193+
.progressViewStyle(CircularProgressViewStyle())
194+
.controlSize(.small)
195+
Text(status)
196+
}
197+
}
198+
}
199+
.padding()
200+
}
201+
}
202+
.onChange(of: store.promptToCodeState.isGenerating) { isGenerating in
203+
if !isGenerating {
204+
isAllStatusesPresented = false
205+
}
206+
}
207+
}
208+
}
209+
}
210+
}
211+
}
212+
146213
struct ActionBar: View {
147214
let store: StoreOf<PromptToCodePanel>
148215

@@ -433,7 +500,7 @@ extension PromptToCodePanelView {
433500
}
434501
}
435502
}
436-
503+
437504
Spacer(minLength: 56)
438505
}
439506
}
@@ -575,7 +642,7 @@ extension PromptToCodePanelView {
575642
presentAllContent: !isGenerating
576643
)
577644
} else {
578-
ScrollView(.horizontal) {
645+
MinScrollView {
579646
CodeBlockInContent(
580647
store: store,
581648
language: language,
@@ -607,6 +674,37 @@ extension PromptToCodePanelView {
607674
}
608675
}
609676

677+
struct MinWidthPreferenceKey: PreferenceKey {
678+
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {
679+
value = nextValue()
680+
}
681+
682+
static var defaultValue: CGFloat = 0
683+
}
684+
685+
struct MinScrollView<Content: View>: View {
686+
@ViewBuilder let content: Content
687+
@State var minWidth: CGFloat = 0
688+
689+
var body: some View {
690+
ScrollView(.horizontal) {
691+
content
692+
.frame(minWidth: minWidth)
693+
}
694+
.overlay {
695+
GeometryReader { proxy in
696+
Color.clear.preference(
697+
key: MinWidthPreferenceKey.self,
698+
value: proxy.size.width
699+
)
700+
}
701+
}
702+
.onPreferenceChange(MinWidthPreferenceKey.self) {
703+
minWidth = $0
704+
}
705+
}
706+
}
707+
610708
struct CodeBlockInContent: View {
611709
let store: StoreOf<PromptToCodeSnippetPanel>
612710
let language: CodeLanguage
@@ -857,3 +955,59 @@ extension PromptToCodePanelView {
857955
.frame(width: 500, height: 500, alignment: .center)
858956
}
859957

958+
#Preview("Generating") {
959+
PromptToCodePanelView(store: .init(initialState: .init(
960+
promptToCodeState: Shared(ModificationState(
961+
source: .init(
962+
language: CodeLanguage.builtIn(.swift),
963+
documentURL: URL(
964+
fileURLWithPath: "path/to/file-name-is-super-long-what-should-we-do-with-it-hah.txt"
965+
),
966+
projectRootURL: URL(fileURLWithPath: "path/to/file.txt"),
967+
content: "",
968+
lines: []
969+
),
970+
snippets: [
971+
.init(
972+
startLineIndex: 8,
973+
originalCode: "print(foo)",
974+
modifiedCode: "print(bar)",
975+
description: "",
976+
error: "Error",
977+
attachedRange: CursorRange(
978+
start: .init(line: 8, character: 0),
979+
end: .init(line: 12, character: 2)
980+
)
981+
),
982+
.init(
983+
startLineIndex: 13,
984+
originalCode: """
985+
struct Bar {
986+
var foo: Int
987+
}
988+
""",
989+
modifiedCode: """
990+
struct Bar {
991+
var foo: String
992+
}
993+
""",
994+
description: "Cool",
995+
error: nil,
996+
attachedRange: CursorRange(
997+
start: .init(line: 13, character: 0),
998+
end: .init(line: 12, character: 2)
999+
)
1000+
),
1001+
],
1002+
extraSystemPrompt: "",
1003+
isAttachedToTarget: true,
1004+
isGenerating: true,
1005+
status: ["Status 1", "Status 2"]
1006+
)),
1007+
instruction: nil,
1008+
commandName: "Generate Code"
1009+
), reducer: { PromptToCodePanel() }))
1010+
.frame(maxWidth: 450, maxHeight: Style.panelHeight)
1011+
.fixedSize(horizontal: false, vertical: true)
1012+
.frame(width: 500, height: 500, alignment: .center)
1013+
}

Core/Sources/SuggestionWidget/WidgetWindowsController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ public final class WidgetWindows {
789789
@MainActor
790790
lazy var toastWindow = {
791791
let it = WidgetWindow(
792-
contentRect: .zero,
792+
contentRect: .init(x: 0, y: 0, width: Style.panelWidth, height: Style.panelHeight),
793793
styleMask: [.borderless],
794794
backing: .buffered,
795795
defer: false

ExtensionService/AppDelegate.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import FileChangeChecker
22
import LaunchAgentManager
33
import Logger
4+
import Perception
45
import Preferences
56
import Service
67
import ServiceManagement
@@ -29,6 +30,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
2930
)
3031

3132
func applicationDidFinishLaunching(_: Notification) {
33+
// isPerceptionCheckingEnabled = false
3234
if ProcessInfo.processInfo.environment["IS_UNIT_TEST"] == "YES" { return }
3335
_ = XcodeInspector.shared
3436
updateChecker.updateCheckerDelegate = self

Screenshot.png

868 KB
Loading

Tool/Sources/AIModel/ChatModel.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ public struct ChatModel: Codable, Equatable, Identifiable {
9494
public var maxTokens: Int
9595
@FallbackDecoding<EmptyBool>
9696
public var supportsFunctionCalling: Bool
97+
@FallbackDecoding<EmptyBool>
98+
public var supportsImage: Bool
99+
@FallbackDecoding<EmptyBool>
100+
public var supportsAudio: Bool
97101
@FallbackDecoding<EmptyString>
98102
public var modelName: String
99103

@@ -114,6 +118,8 @@ public struct ChatModel: Codable, Equatable, Identifiable {
114118
isFullURL: Bool = false,
115119
maxTokens: Int = 4000,
116120
supportsFunctionCalling: Bool = true,
121+
supportsImage: Bool = false,
122+
supportsAudio: Bool = false,
117123
modelName: String = "",
118124
openAIInfo: OpenAIInfo = OpenAIInfo(),
119125
ollamaInfo: OllamaInfo = OllamaInfo(),
@@ -126,6 +132,8 @@ public struct ChatModel: Codable, Equatable, Identifiable {
126132
self.isFullURL = isFullURL
127133
self.maxTokens = maxTokens
128134
self.supportsFunctionCalling = supportsFunctionCalling
135+
self.supportsImage = supportsImage
136+
self.supportsAudio = supportsAudio
129137
self.modelName = modelName
130138
self.openAIInfo = openAIInfo
131139
self.ollamaInfo = ollamaInfo

Tool/Sources/CodeiumService/LanguageServer/CodeiumInstallationManager.swift

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Terminal
33

44
public struct CodeiumInstallationManager {
55
private static var isInstalling = false
6-
static let latestSupportedVersion = "1.20.9"
6+
static let latestSupportedVersion = "1.28.3"
77
static let minimumSupportedVersion = "1.20.0"
88

99
public init() {}
@@ -90,11 +90,23 @@ public struct CodeiumInstallationManager {
9090
case .orderedAscending:
9191
switch version.compare(Self.minimumSupportedVersion) {
9292
case .orderedAscending:
93-
return .outdated(current: version, latest: Self.latestSupportedVersion, mandatory: true)
93+
return .outdated(
94+
current: version,
95+
latest: Self.latestSupportedVersion,
96+
mandatory: true
97+
)
9498
case .orderedSame:
95-
return .outdated(current: version, latest: Self.latestSupportedVersion, mandatory: false)
99+
return .outdated(
100+
current: version,
101+
latest: Self.latestSupportedVersion,
102+
mandatory: false
103+
)
96104
case .orderedDescending:
97-
return .outdated(current: version, latest: Self.latestSupportedVersion, mandatory: false)
105+
return .outdated(
106+
current: version,
107+
latest: Self.latestSupportedVersion,
108+
mandatory: false
109+
)
98110
}
99111
case .orderedSame:
100112
return .installed(version)

0 commit comments

Comments
 (0)