@@ -9,96 +9,79 @@ public protocol UserDefaultPreferenceKey {
99public struct UserDefaultPreferenceKeys {
1010 public init ( ) { }
1111
12+ // MARK: - Node Path
13+
1214 public struct NodePath : UserDefaultPreferenceKey {
1315 public let defaultValue : String = " "
1416 public let key = " NodePath "
1517 }
1618
1719 public var nodePath : NodePath { . init( ) }
1820
21+ // MARK: - Realtime Suggestion
22+
1923 public struct RealtimeSuggestionToggle : UserDefaultPreferenceKey {
2024 public let defaultValue : Bool = false
2125 public let key = " RealtimeSuggestionToggle "
2226 }
2327
2428 public var realtimeSuggestionToggle : RealtimeSuggestionToggle { . init( ) }
2529
30+ // MARK: - Realtime Suggestion Debounce
31+
2632 public struct RealtimeSuggestionDebounce : UserDefaultPreferenceKey {
2733 public let defaultValue : Double = 1
2834 public let key = " RealtimeSuggestionDebounce "
2935 }
3036
3137 public var realtimeSuggestionDebounce : RealtimeSuggestionDebounce { . init( ) }
3238
39+ // MARK: - Quit XPC Service On Xcode And App Quit
40+
3341 public struct QuitXPCServiceOnXcodeAndAppQuit : UserDefaultPreferenceKey {
3442 public let defaultValue = true
3543 public let key = " QuitXPCServiceOnXcodeAndAppQuit "
3644 }
3745
3846 public var quitXPCServiceOnXcodeAndAppQuit : QuitXPCServiceOnXcodeAndAppQuit { . init( ) }
3947
48+ // MARK: - Suggestion Presentation Mode
49+
4050 public struct SuggestionPresentationMode : UserDefaultPreferenceKey {
4151 public let defaultValue = PresentationMode . floatingWidget
4252 public let key = " SuggestionPresentationMode "
4353 }
4454
4555 public var suggestionPresentationMode : SuggestionPresentationMode { . init( ) }
4656
57+ // MARK: - Automatically Check For Update
58+
4759 public struct AutomaticallyCheckForUpdate : UserDefaultPreferenceKey {
4860 public let defaultValue = false
4961 public let key = " AutomaticallyCheckForUpdate "
5062 }
5163
5264 public var automaticallyCheckForUpdate : AutomaticallyCheckForUpdate { . init( ) }
5365
66+ // MARK: - Suggestion Widget Position Mode
67+
5468 public struct SuggestionWidgetPositionModeKey : UserDefaultPreferenceKey {
5569 public let defaultValue = SuggestionWidgetPositionMode . fixedToBottom
5670 public let key = " SuggestionWidgetPositionMode "
5771 }
5872
5973 public var suggestionWidgetPositionMode : SuggestionWidgetPositionModeKey { . init( ) }
6074
75+ // MARK: - Widget Color Scheme
76+
6177 public struct WidgetColorSchemeKey : UserDefaultPreferenceKey {
6278 public let defaultValue = WidgetColorScheme . dark
6379 public let key = " WidgetColorScheme "
6480 }
6581
6682 public var widgetColorScheme : WidgetColorSchemeKey { . init( ) }
6783
68- public struct OpenAIAPIKey : UserDefaultPreferenceKey {
69- public let defaultValue = " "
70- public let key = " OpenAIAPIKey "
71- }
72-
73- public var openAIAPIKey : OpenAIAPIKey { . init( ) }
74-
75- public struct ChatGPTEndpoint : UserDefaultPreferenceKey {
76- public let defaultValue = " "
77- public let key = " ChatGPTEndpoint "
78- }
79-
80- public var chatGPTEndpoint : ChatGPTEndpoint { . init( ) }
81-
82- public struct ChatGPTModel : UserDefaultPreferenceKey {
83- public let defaultValue = Preferences . ChatGPTModel. gpt35Turbo. rawValue
84- public let key = " ChatGPTModel "
85- }
86-
87- public var chatGPTModel : ChatGPTModel { . init( ) }
88-
89- public struct ChatGPTMaxToken : UserDefaultPreferenceKey {
90- public let defaultValue = 2048
91- public let key = " ChatGPTMaxToken "
92- }
93-
94- public var chatGPTMaxToken : ChatGPTMaxToken { . init( ) }
95-
96- public struct ChatGPTLanguage : UserDefaultPreferenceKey {
97- public let defaultValue = " "
98- public let key = " ChatGPTLanguage "
99- }
100-
101- public var chatGPTLanguage : ChatGPTLanguage { . init( ) }
84+ // MARK: - Accept Suggestion with Accessibility API
10285
10386 public struct AcceptSuggestionWithAccessibilityAPI : UserDefaultPreferenceKey {
10487 public let defaultValue = false
@@ -109,13 +92,17 @@ public struct UserDefaultPreferenceKeys {
10992 . init( )
11093 }
11194
95+ // MARK: - Use Global Chat
96+
11297 public struct UseGlobalChat : UserDefaultPreferenceKey {
11398 public let defaultValue = false
11499 public let key = " UseGlobalChat "
115100 }
116101
117102 public var useGlobalChat : UseGlobalChat { . init( ) }
118103
104+ // MARK: - Hide Common Preceding Spaces in Suggestion
105+
119106 public struct HideCommonPrecedingSpacesInSuggestion : UserDefaultPreferenceKey {
120107 public let defaultValue = false
121108 public let key = " HideCommonPrecedingSpacesInSuggestion "
@@ -125,6 +112,8 @@ public struct UserDefaultPreferenceKeys {
125112 . init( )
126113 }
127114
115+ // MARK: - Force Order Widget to Front
116+
128117 public struct ForceOrderWidgetToFront : UserDefaultPreferenceKey {
129118 public let defaultValue = true
130119 public let key = " ForceOrderWidgetToFront "
@@ -134,6 +123,8 @@ public struct UserDefaultPreferenceKeys {
134123 . init( )
135124 }
136125
126+ // MARK: - Disable Suggestion Feature Globally
127+
137128 public struct DisableSuggestionFeatureGlobally : UserDefaultPreferenceKey {
138129 public let defaultValue = false
139130 public let key = " DisableSuggestionFeatureGlobally "
@@ -143,6 +134,8 @@ public struct UserDefaultPreferenceKeys {
143134 . init( )
144135 }
145136
137+ // MARK: - Suggestion Feature Enabled Project List
138+
146139 public struct SuggestionFeatureEnabledProjectList : UserDefaultPreferenceKey {
147140 public let defaultValue : [ String ] = [ ]
148141 public let key = " SuggestionFeatureEnabledProjectList "
@@ -152,6 +145,8 @@ public struct UserDefaultPreferenceKeys {
152145 . init( )
153146 }
154147
148+ // MARK: - Prompt to Code Feature Provider
149+
155150 public struct PromptToCodeFeatureProviderKey : UserDefaultPreferenceKey {
156151 public let defaultValue : PromptToCodeFeatureProvider = . openAI
157152 public let key = " PromptToCodeFeatureProvider "
@@ -161,6 +156,8 @@ public struct UserDefaultPreferenceKeys {
161156 . init( )
162157 }
163158
159+ // MARK: - Prefer Widget to Stay Inside Editor When Width Greater Than
160+
164161 public struct PreferWidgetToStayInsideEditorWhenWidthGreaterThan : UserDefaultPreferenceKey {
165162 public let defaultValue = 1400 as Double
166163 public let key = " PreferWidgetToStayInsideEditorWhenWidthGreaterThan "
@@ -169,12 +166,45 @@ public struct UserDefaultPreferenceKeys {
169166 public var preferWidgetToStayInsideEditorWhenWidthGreaterThan : PreferWidgetToStayInsideEditorWhenWidthGreaterThan {
170167 . init( )
171168 }
169+ }
172170
173- public var disableLazyVStack : FeatureFlags . DisableLazyVStack { . init( ) }
174- public var preCacheOnFileOpen : FeatureFlags . PreCacheOnFileOpen { . init( ) }
175- public var runNodeWithInteractiveLoggedInShell : FeatureFlags
176- . RunNodeWithInteractiveLoggedInShell { . init( ) }
177- public var useCustomScrollViewWorkaround : FeatureFlags . UseCustomScrollViewWorkaround { . init( ) }
171+ // MARK: - OpenAI Account Settings
172+
173+ public extension UserDefaultPreferenceKeys {
174+ struct OpenAIAPIKey : UserDefaultPreferenceKey {
175+ public let defaultValue = " "
176+ public let key = " OpenAIAPIKey "
177+ }
178+
179+ var openAIAPIKey : OpenAIAPIKey { . init( ) }
180+
181+ struct ChatGPTEndpoint : UserDefaultPreferenceKey {
182+ public let defaultValue = " "
183+ public let key = " ChatGPTEndpoint "
184+ }
185+
186+ var chatGPTEndpoint : ChatGPTEndpoint { . init( ) }
187+
188+ struct ChatGPTModel : UserDefaultPreferenceKey {
189+ public let defaultValue = Preferences . ChatGPTModel. gpt35Turbo. rawValue
190+ public let key = " ChatGPTModel "
191+ }
192+
193+ var chatGPTModel : ChatGPTModel { . init( ) }
194+
195+ struct ChatGPTMaxToken : UserDefaultPreferenceKey {
196+ public let defaultValue = 2048
197+ public let key = " ChatGPTMaxToken "
198+ }
199+
200+ var chatGPTMaxToken : ChatGPTMaxToken { . init( ) }
201+
202+ struct ChatGPTLanguage : UserDefaultPreferenceKey {
203+ public let defaultValue = " "
204+ public let key = " ChatGPTLanguage "
205+ }
206+
207+ var chatGPTLanguage : ChatGPTLanguage { . init( ) }
178208}
179209
180210public enum FeatureFlags {
@@ -192,9 +222,17 @@ public enum FeatureFlags {
192222 public let defaultValue = true
193223 public let key = " FeatureFlag-RunNodeWithInteractiveLoggedInShell "
194224 }
195-
225+
196226 public struct UseCustomScrollViewWorkaround : UserDefaultPreferenceKey {
197227 public let defaultValue = true
198228 public let key = " FeatureFlag-UseCustomScrollViewWorkaround "
199229 }
200230}
231+
232+ public extension UserDefaultPreferenceKeys {
233+ var disableLazyVStack : FeatureFlags . DisableLazyVStack { . init( ) }
234+ var preCacheOnFileOpen : FeatureFlags . PreCacheOnFileOpen { . init( ) }
235+ var runNodeWithInteractiveLoggedInShell : FeatureFlags
236+ . RunNodeWithInteractiveLoggedInShell { . init( ) }
237+ var useCustomScrollViewWorkaround : FeatureFlags . UseCustomScrollViewWorkaround { . init( ) }
238+ }
0 commit comments