Skip to content

Commit 59b9090

Browse files
committed
Add settings for font size
1 parent 6b5675b commit 59b9090

File tree

1 file changed

+50
-3
lines changed

1 file changed

+50
-3
lines changed

Copilot for Xcode/SettingsView.swift

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ struct SettingsView: View {
2828
var preferWidgetToStayInsideEditorWhenWidthGreaterThan: Double
2929
@AppStorage(\.hideCommonPrecedingSpacesInSuggestion)
3030
var hideCommonPrecedingSpacesInSuggestion: Bool
31+
@AppStorage(\.suggestionCodeFontSize) var suggestionCodeFontSize
32+
@AppStorage(\.chatFontSize) var chatFontSize
33+
@AppStorage(\.chatCodeFontSize) var chatCodeFontSize
3134
init() {}
3235
}
3336

@@ -49,7 +52,7 @@ struct SettingsView: View {
4952
isOpen: $isCustomCommandEditorOpen
5053
)
5154
}
52-
55+
5356
Form {
5457
Toggle(isOn: $settings.quitXPCServiceOnXcodeAndAppQuit) {
5558
Text("Quit service when Xcode and host app are terminated")
@@ -165,7 +168,10 @@ struct SettingsView: View {
165168
case .openAI:
166169
Text("OpenAI").tag($0)
167170
case .githubCopilot:
168-
Text("GitHub Copilot (Implement for experiment, barely works, don't use.)").tag($0)
171+
Text(
172+
"GitHub Copilot (Implement for experiment, barely works, don't use.)"
173+
)
174+
.tag($0)
169175
}
170176
}
171177
} label: {
@@ -184,7 +190,48 @@ struct SettingsView: View {
184190
}
185191
.textFieldStyle(.roundedBorder)
186192

187-
Text("px")
193+
Text("pt")
194+
}
195+
196+
Group { // UI
197+
HStack {
198+
TextField(text: .init(get: {
199+
"\(Int(settings.chatFontSize))"
200+
}, set: {
201+
settings.chatFontSize = Double(Int($0) ?? 1)
202+
})) {
203+
Text("Font size of chat message")
204+
}
205+
.textFieldStyle(.roundedBorder)
206+
207+
Text("pt")
208+
}
209+
210+
HStack {
211+
TextField(text: .init(get: {
212+
"\(Int(settings.chatCodeFontSize))"
213+
}, set: {
214+
settings.chatCodeFontSize = Double(Int($0) ?? 1)
215+
})) {
216+
Text("Font size of code block in chat")
217+
}
218+
.textFieldStyle(.roundedBorder)
219+
220+
Text("pt")
221+
}
222+
223+
HStack {
224+
TextField(text: .init(get: {
225+
"\(Int(settings.suggestionCodeFontSize))"
226+
}, set: {
227+
settings.suggestionCodeFontSize = Double(Int($0) ?? 1)
228+
})) {
229+
Text("Font size of suggestion code")
230+
}
231+
.textFieldStyle(.roundedBorder)
232+
233+
Text("pt")
234+
}
188235
}
189236
}
190237
}.buttonStyle(.copilot)

0 commit comments

Comments
 (0)