Skip to content

Commit 3322a1a

Browse files
committed
Update cheatsheet settings view
1 parent a8602f3 commit 3322a1a

File tree

1 file changed

+42
-4
lines changed

1 file changed

+42
-4
lines changed

Core/Sources/HostApp/FeatureSettings/Suggestion/SuggestionSettingsCheatsheetSectionView.swift

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,54 @@ struct SuggestionSettingsCheatsheetSectionView: View {
1212
final class Settings: ObservableObject {
1313
@AppStorage(\.isSuggestionSenseEnabled)
1414
var isSuggestionSenseEnabled
15+
@AppStorage(\.isSuggestionTypeInTheMiddleEnabled)
16+
var isSuggestionTypeInTheMiddleEnabled
1517
}
16-
18+
1719
@StateObject var settings = Settings()
1820

1921
var body: some View {
2022
#if canImport(ProHostApp)
21-
WithFeatureEnabled(\.suggestionSense) {
22-
Toggle(isOn: $settings.isSuggestionSenseEnabled) {
23-
Text("Enable suggestion cheatsheet (experimental)")
23+
SubSection(
24+
title: Text("Suggestion Sense (Experimental)"),
25+
description: Text("""
26+
This cheatsheet will try to improve the suggestion by inserting relevant symbol \
27+
interfaces in the editing scope to the prompt.
28+
29+
Some suggestion services may have their own RAG system with a higher priority.
30+
""")
31+
) {
32+
Form {
33+
WithFeatureEnabled(\.suggestionSense) {
34+
Toggle(isOn: $settings.isSuggestionSenseEnabled) {
35+
Text("Enable suggestion sense")
36+
}
37+
}
38+
}
39+
}
40+
41+
SubSection(
42+
title: Text("Type-in-the-Middle Hack"),
43+
description: Text("""
44+
Suggestion service don't always handle the case where the text cursor is in the middle \
45+
of a line. This cheatsheet will try to trick the suggestion service to also generate \
46+
suggestions in these cases.
47+
48+
It can be useful in the following cases:
49+
- Fixing a typo in the middle of a line.
50+
- Getting suggestions from a line with Xcode placeholders.
51+
- and more...
52+
""")
53+
) {
54+
Form {
55+
Toggle(isOn: $settings.isSuggestionTypeInTheMiddleEnabled) {
56+
Text("Enable type-in-the-middle hack")
57+
}
2458
}
2559
}
60+
61+
#else
62+
Text("Not Available")
2663
#endif
2764
}
2865
}
@@ -31,3 +68,4 @@ struct SuggestionSettingsCheatsheetSectionView: View {
3168
SuggestionSettingsCheatsheetSectionView()
3269
.padding()
3370
}
71+

0 commit comments

Comments
 (0)