Skip to content

Commit

Permalink
Add settings field
Browse files Browse the repository at this point in the history
  • Loading branch information
intitni committed Mar 27, 2024
1 parent 5dd8ee0 commit c339de7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
20 changes: 10 additions & 10 deletions Core/Sources/HostApp/FeatureSettings/PromptToCodeSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import ProHostApp

struct PromptToCodeSettingsView: View {
final class Settings: ObservableObject {
@AppStorage(\.hideCommonPrecedingSpacesInSuggestion)
var hideCommonPrecedingSpacesInSuggestion
@AppStorage(\.suggestionCodeFontSize)
var suggestionCodeFontSize
@AppStorage(\.hideCommonPrecedingSpacesInPromptToCode)
var hideCommonPrecedingSpaces
@AppStorage(\.promptToCodeCodeFontSize)
var fontSize
@AppStorage(\.promptToCodeGenerateDescription)
var promptToCodeGenerateDescription
@AppStorage(\.promptToCodeGenerateDescriptionInUserPreferredLanguage)
Expand Down Expand Up @@ -84,25 +84,25 @@ struct PromptToCodeSettingsView: View {
}
}

SettingsDivider("Mirroring Settings of Suggestion Feature")
SettingsDivider("UI")

Form {
Toggle(isOn: $settings.hideCommonPrecedingSpacesInSuggestion) {
Toggle(isOn: $settings.hideCommonPrecedingSpaces) {
Text("Hide Common Preceding Spaces")
}.disabled(true)
}

HStack {
TextField(text: .init(get: {
"\(Int(settings.suggestionCodeFontSize))"
"\(Int(settings.fontSize))"
}, set: {
settings.suggestionCodeFontSize = Double(Int($0) ?? 0)
settings.fontSize = Double(Int($0) ?? 0)
})) {
Text("Font size of suggestion code")
}
.textFieldStyle(.roundedBorder)

Text("pt")
}.disabled(true)
}
}

ScopeForm()
Expand Down
10 changes: 0 additions & 10 deletions Core/Sources/SuggestionWidget/WidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ struct WidgetAnimatedCircle: View {
struct WidgetContextMenu: View {
@AppStorage(\.useGlobalChat) var useGlobalChat
@AppStorage(\.realtimeSuggestionToggle) var realtimeSuggestionToggle
@AppStorage(\.hideCommonPrecedingSpacesInSuggestion) var hideCommonPrecedingSpacesInSuggestion
@AppStorage(\.disableSuggestionFeatureGlobally) var disableSuggestionFeatureGlobally
@AppStorage(\.suggestionFeatureEnabledProjectList) var suggestionFeatureEnabledProjectList
@AppStorage(\.suggestionFeatureDisabledLanguageList) var suggestionFeatureDisabledLanguageList
Expand Down Expand Up @@ -198,15 +197,6 @@ struct WidgetContextMenu: View {
Image(systemName: "checkmark")
}
}

Button(action: {
hideCommonPrecedingSpacesInSuggestion.toggle()
}, label: {
Text("Hide Common Preceding Spaces in Suggestion")
if hideCommonPrecedingSpacesInSuggestion {
Image(systemName: "checkmark")
}
})
}

Divider()
Expand Down

0 comments on commit c339de7

Please sign in to comment.