@@ -97,6 +97,7 @@ struct SuggestionSettingsGeneralSectionView: View {
9797 @StateObject var settings = Settings ( )
9898 @State var isSuggestionFeatureEnabledListPickerOpen = false
9999 @State var isSuggestionFeatureDisabledLanguageListViewOpen = false
100+ @State var isTabToAcceptSuggestionModifierViewOpen = false
100101
101102 var body : some View {
102103 Form {
@@ -174,7 +175,18 @@ struct SuggestionSettingsGeneralSectionView: View {
174175 #if canImport(ProHostApp)
175176 WithFeatureEnabled ( \. tabToAcceptSuggestion) {
176177 Toggle ( isOn: $settings. acceptSuggestionWithTab) {
177- Text ( " Accept suggestion with Tab " )
178+ HStack {
179+ Text ( " Accept suggestion with Tab " )
180+
181+ Button ( action: {
182+ isTabToAcceptSuggestionModifierViewOpen = true
183+ } ) {
184+ Image ( systemName: " gearshape.fill " )
185+ }
186+ . buttonStyle ( . plain)
187+ }
188+ } . sheet ( isPresented: $isTabToAcceptSuggestionModifierViewOpen) {
189+ TabToAcceptSuggestionModifierView ( )
178190 }
179191 }
180192
@@ -248,10 +260,70 @@ struct SuggestionSettingsGeneralSectionView: View {
248260 }
249261 }
250262 }
263+
264+ struct TabToAcceptSuggestionModifierView : View {
265+ final class Settings : ObservableObject {
266+ @AppStorage ( \. acceptSuggestionWithModifierCommand)
267+ var needCommand
268+ @AppStorage ( \. acceptSuggestionWithModifierOption)
269+ var needOption
270+ @AppStorage ( \. acceptSuggestionWithModifierShift)
271+ var needShift
272+ @AppStorage ( \. acceptSuggestionWithModifierControl)
273+ var needControl
274+ @AppStorage ( \. acceptSuggestionWithModifierOnlyForSwift)
275+ var onlyForSwift
276+ }
277+
278+ @StateObject var settings = Settings ( )
279+ @Environment ( \. dismiss) var dismiss
280+
281+ var body : some View {
282+ VStack ( spacing: 0 ) {
283+ Form {
284+ Text ( " Accept suggestion with modifier " )
285+ . font ( . headline)
286+ HStack {
287+ Toggle ( isOn: $settings. needCommand) {
288+ Text ( " Command " )
289+ }
290+ Toggle ( isOn: $settings. needOption) {
291+ Text ( " Option " )
292+ }
293+ Toggle ( isOn: $settings. needShift) {
294+ Text ( " Shift " )
295+ }
296+ Toggle ( isOn: $settings. needControl) {
297+ Text ( " Control " )
298+ }
299+ }
300+ Toggle ( isOn: $settings. onlyForSwift) {
301+ Text ( " Only require modifiers for Swift " )
302+ }
303+ }
304+ . padding ( )
305+
306+ Divider ( )
307+
308+ HStack {
309+ Spacer ( )
310+ Button ( action: { dismiss ( ) } ) {
311+ Text ( " Done " )
312+ }
313+ . keyboardShortcut ( . defaultAction)
314+ }
315+ . padding ( )
316+ }
317+ }
318+ }
251319}
252320
253321#Preview {
254322 SuggestionSettingsGeneralSectionView ( )
255323 . padding ( )
256324}
257325
326+ #Preview {
327+ SuggestionSettingsGeneralSectionView . TabToAcceptSuggestionModifierView ( )
328+ }
329+
0 commit comments