forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeys.swift
More file actions
254 lines (194 loc) · 7.6 KB
/
Keys.swift
File metadata and controls
254 lines (194 loc) · 7.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
import Foundation
public protocol UserDefaultPreferenceKey {
associatedtype Value
var defaultValue: Value { get }
var key: String { get }
}
public struct PreferenceKey<T>: UserDefaultPreferenceKey {
public let defaultValue: T
public let key: String
}
public struct FeatureFlag: UserDefaultPreferenceKey {
public let defaultValue: Bool
public let key: String
}
public struct UserDefaultPreferenceKeys {
public init() {}
// MARK: Quit XPC Service On Xcode And App Quit
public let quitXPCServiceOnXcodeAndAppQuit = PreferenceKey(
defaultValue: true,
key: "QuitXPCServiceOnXcodeAndAppQuit"
)
// MARK: Automatically Check For Update
public let automaticallyCheckForUpdate = PreferenceKey(
defaultValue: false,
key: "AutomaticallyCheckForUpdate"
)
// MARK: Suggestion Widget Position Mode
public let suggestionWidgetPositionMode = PreferenceKey(
defaultValue: SuggestionWidgetPositionMode.fixedToBottom,
key: "SuggestionWidgetPositionMode"
)
// MARK: Widget Color Scheme
public let widgetColorScheme = PreferenceKey(
defaultValue: WidgetColorScheme.dark,
key: "WidgetColorScheme"
)
// MARK: Force Order Widget to Front
public let forceOrderWidgetToFront = PreferenceKey(
defaultValue: true,
key: "ForceOrderWidgetToFront"
)
// MARK: Prefer Widget to Stay Inside Editor When Width Greater Than
public let preferWidgetToStayInsideEditorWhenWidthGreaterThan = PreferenceKey(
defaultValue: 1400 as Double,
key: "PreferWidgetToStayInsideEditorWhenWidthGreaterThan"
)
}
// MARK: - OpenAI Account Settings
public extension UserDefaultPreferenceKeys {
var openAIAPIKey: PreferenceKey<String> {
.init(defaultValue: "", key: "OpenAIAPIKey")
}
var chatGPTEndpoint: PreferenceKey<String> {
.init(defaultValue: "", key: "ChatGPTEndpoint")
}
var chatGPTModel: PreferenceKey<String> {
.init(defaultValue: Preferences.ChatGPTModel.gpt35Turbo.rawValue, key: "ChatGPTModel")
}
var chatGPTMaxToken: PreferenceKey<Int> {
.init(defaultValue: 4000, key: "ChatGPTMaxToken")
}
var chatGPTLanguage: PreferenceKey<String> {
.init(defaultValue: "", key: "ChatGPTLanguage")
}
var chatGPTMaxMessageCount: PreferenceKey<Int> {
.init(defaultValue: 5, key: "ChatGPTMaxMessageCount")
}
var chatGPTTemperature: PreferenceKey<Double> {
.init(defaultValue: 0.7, key: "ChatGPTTemperature")
}
}
// MARK: - GitHub Copilot Settings
public extension UserDefaultPreferenceKeys {
var gitHubCopilotVerboseLog: PreferenceKey<Bool> {
.init(defaultValue: false, key: "GitHubCopilotVerboseLog")
}
var nodePath: PreferenceKey<String> {
.init(defaultValue: "", key: "NodePath")
}
var runNodeWith: PreferenceKey<NodeRunner> {
.init(defaultValue: .env, key: "RunNodeWith")
}
}
// MARK: - Codeium Settings
public extension UserDefaultPreferenceKeys {
var codeiumVerboseLog: PreferenceKey<Bool> {
.init(defaultValue: false, key: "CodeiumVerboseLog")
}
}
// MARK: - Prompt to Code
public extension UserDefaultPreferenceKeys {
var promptToCodeFeatureProvider: PreferenceKey<PromptToCodeFeatureProvider> {
.init(defaultValue: .openAI, key: "PromptToCodeFeatureProvider")
}
var promptToCodeGenerateDescription: PreferenceKey<Bool> {
.init(defaultValue: true, key: "PromptToCodeGenerateDescription")
}
var promptToCodeGenerateDescriptionInUserPreferredLanguage: PreferenceKey<Bool> {
.init(defaultValue: true, key: "PromptToCodeGenerateDescriptionInUserPreferredLanguage")
}
}
// MARK: - Suggestion
public extension UserDefaultPreferenceKeys {
var suggestionFeatureProvider: PreferenceKey<SuggestionFeatureProvider> {
.init(defaultValue: .gitHubCopilot, key: "SuggestionFeatureProvider")
}
var realtimeSuggestionToggle: PreferenceKey<Bool> {
.init(defaultValue: true, key: "RealtimeSuggestionToggle")
}
var suggestionCodeFontSize: PreferenceKey<Double> {
.init(defaultValue: 13, key: "SuggestionCodeFontSize")
}
var disableSuggestionFeatureGlobally: PreferenceKey<Bool> {
.init(defaultValue: false, key: "DisableSuggestionFeatureGlobally")
}
var suggestionFeatureEnabledProjectList: PreferenceKey<[String]> {
.init(defaultValue: [], key: "SuggestionFeatureEnabledProjectList")
}
var suggestionFeatureDisabledLanguageList: PreferenceKey<[String]> {
.init(defaultValue: [], key: "SuggestionFeatureDisabledLanguageList")
}
var hideCommonPrecedingSpacesInSuggestion: PreferenceKey<Bool> {
.init(defaultValue: true, key: "HideCommonPrecedingSpacesInSuggestion")
}
var acceptSuggestionWithAccessibilityAPI: PreferenceKey<Bool> {
.init(defaultValue: false, key: "AcceptSuggestionWithAccessibilityAPI")
}
var suggestionPresentationMode: PreferenceKey<PresentationMode> {
.init(defaultValue: .floatingWidget, key: "SuggestionPresentationMode")
}
var realtimeSuggestionDebounce: PreferenceKey<Double> {
.init(defaultValue: 1, key: "RealtimeSuggestionDebounce")
}
}
// MARK: - Chat
public extension UserDefaultPreferenceKeys {
var chatFontSize: PreferenceKey<Double> {
.init(defaultValue: 12, key: "ChatFontSize")
}
var chatCodeFontSize: PreferenceKey<Double> {
.init(defaultValue: 12, key: "ChatCodeFontSize")
}
var useGlobalChat: PreferenceKey<Bool> {
.init(defaultValue: true, key: "UseGlobalChat")
}
var embedFileContentInChatContextIfNoSelection: PreferenceKey<Bool> {
.init(defaultValue: true, key: "EmbedFileContentInChatContextIfNoSelection")
}
var maxEmbeddableFileInChatContextLineCount: PreferenceKey<Int> {
.init(defaultValue: 200, key: "MaxEmbeddableFileInChatContextLineCount")
}
}
// MARK: - Custom Commands
public extension UserDefaultPreferenceKeys {
var customCommands: PreferenceKey<[CustomCommand]> {
.init(defaultValue: [
.init(
commandId: "BuiltInCustomCommandExplainSelection",
name: "Explain Selection",
feature: .chatWithSelection(
extraSystemPrompt: nil,
prompt: "Explain the code concisely, do not interpret or translate it."
)
),
.init(
commandId: "BuiltInCustomCommandAddDocumentationToSelection",
name: "Add Documentation to Selection",
feature: .promptToCode(
extraSystemPrompt: nil,
prompt: "Add documentation on top of the code. Use triple slash if the language supports it.",
continuousMode: false
)
),
], key: "CustomCommands")
}
}
// MARK: - Feature Flags
public extension UserDefaultPreferenceKeys {
var disableLazyVStack: FeatureFlag {
.init(defaultValue: false, key: "FeatureFlag-DisableLazyVStack")
}
var preCacheOnFileOpen: FeatureFlag {
.init(defaultValue: true, key: "FeatureFlag-PreCacheOnFileOpen")
}
var runNodeWithInteractiveLoggedInShell: FeatureFlag {
.init(defaultValue: true, key: "FeatureFlag-RunNodeWithInteractiveLoggedInShell")
}
var useCustomScrollViewWorkaround: FeatureFlag {
.init(defaultValue: true, key: "FeatureFlag-UseCustomScrollViewWorkaround")
}
var triggerActionWithAccessibilityAPI: FeatureFlag {
.init(defaultValue: true, key: "FeatureFlag-TriggerActionWithAccessibilityAPI")
}
}