|
| 1 | +import Preferences |
1 | 2 | import SharedUIComponents |
2 | 3 | import SwiftUI |
3 | 4 |
|
| 5 | +#if canImport(ProHostApp) |
| 6 | +import ProHostApp |
| 7 | +#endif |
| 8 | + |
4 | 9 | struct PromptToCodeSettingsView: View { |
5 | 10 | final class Settings: ObservableObject { |
6 | 11 | @AppStorage(\.hideCommonPrecedingSpacesInSuggestion) |
@@ -99,13 +104,49 @@ struct PromptToCodeSettingsView: View { |
99 | 104 | Text("pt") |
100 | 105 | }.disabled(true) |
101 | 106 | } |
| 107 | + |
| 108 | + ScopeForm() |
102 | 109 | } |
103 | 110 | } |
104 | | -} |
| 111 | + |
| 112 | + struct ScopeForm: View { |
| 113 | + class Settings: ObservableObject { |
| 114 | + @AppStorage(\.enableSenseScopeByDefaultInPromptToCode) |
| 115 | + var enableSenseScopeByDefaultInPromptToCode: Bool |
| 116 | + init() {} |
| 117 | + } |
| 118 | + |
| 119 | + @StateObject var settings = Settings() |
| 120 | + |
| 121 | + var body: some View { |
| 122 | + SettingsDivider("Scopes") |
| 123 | + |
| 124 | + VStack { |
| 125 | + #if canImport(ProHostApp) |
| 126 | + |
| 127 | + SubSection( |
| 128 | + title: WithFeatureEnabled(\.senseScopeInChat, alignment: .trailing) { |
| 129 | + Text("Sense Scope (Experimental)") |
| 130 | + }, |
| 131 | + description: "Experimental. Enable the bot to read the relevant code of the editing file in the project, third party packages and the SDK." |
| 132 | + ) { |
| 133 | + WithFeatureEnabled(\.projectScopeInChat, alignment: .hidden) { |
| 134 | + Form { |
| 135 | + Toggle(isOn: $settings.enableSenseScopeByDefaultInPromptToCode) { |
| 136 | + Text("Enable by default") |
| 137 | + } |
| 138 | + } |
| 139 | + } |
| 140 | + } |
105 | 141 |
|
106 | | -struct PromptToCodeSettingsView_Previews: PreviewProvider { |
107 | | - static var previews: some View { |
108 | | - PromptToCodeSettingsView() |
| 142 | + #endif |
| 143 | + } |
| 144 | + } |
109 | 145 | } |
110 | 146 | } |
111 | 147 |
|
| 148 | +#Preview { |
| 149 | + PromptToCodeSettingsView() |
| 150 | + .padding() |
| 151 | +} |
| 152 | + |
0 commit comments