Skip to content

Commit 719b7ae

Browse files
committed
Remove toggle
1 parent 964b69b commit 719b7ae

3 files changed

Lines changed: 10 additions & 19 deletions

File tree

Core/Sources/HostApp/AccountSettings/GitHubCopilotView.swift

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ struct GitHubCopilotView: View {
2020
@AppStorage(\.gitHubCopilotProxyPassword) var gitHubCopilotProxyPassword
2121
@AppStorage(\.gitHubCopilotUseStrictSSL) var gitHubCopilotUseStrictSSL
2222
@AppStorage(\.gitHubCopilotEnterpriseURI) var gitHubCopilotEnterpriseURI
23-
@AppStorage(\.gitHubCopilotIgnoreTrailingNewLines)
24-
var gitHubCopilotIgnoreTrailingNewLines
2523
@AppStorage(\.disableGitHubCopilotSettingsAutoRefreshOnAppear)
2624
var disableGitHubCopilotSettingsAutoRefreshOnAppear
2725
init() {}
@@ -267,17 +265,6 @@ struct GitHubCopilotView: View {
267265
SettingsDivider("Advanced")
268266

269267
Form {
270-
Toggle(
271-
"Remove Extra New Lines Generated by GitHub Copilot",
272-
isOn: $settings.gitHubCopilotIgnoreTrailingNewLines
273-
)
274-
Text(
275-
"Sometimes GitHub Copilot may generate extra unwanted new lines at the end of a suggestion. If you don't like that, you can turn this toggle on."
276-
)
277-
.lineLimit(10)
278-
.foregroundColor(.secondary)
279-
.font(.callout)
280-
.dynamicHeightTextInFormWorkaround()
281268
Toggle("Verbose Log", isOn: $settings.gitHubCopilotVerboseLog)
282269
}
283270

Tool/Sources/Preferences/Keys.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,6 @@ public extension UserDefaultPreferenceKeys {
187187
var runNodeWith: PreferenceKey<NodeRunner> {
188188
.init(defaultValue: .env, key: "RunNodeWith")
189189
}
190-
191-
var gitHubCopilotIgnoreTrailingNewLines: PreferenceKey<Bool> {
192-
.init(defaultValue: true, key: "GitHubCopilotIgnoreTrailingNewLines")
193-
}
194190
}
195191

196192
// MARK: - Codeium Settings

Tool/Sources/SuggestionProvider/PostProcessingSuggestionServiceMiddleware.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,28 @@ public struct PostProcessingSuggestionServiceMiddleware: SuggestionServiceMiddle
1010
next: Next
1111
) async throws -> [CodeSuggestion] {
1212
let suggestions = try await next(request)
13-
13+
1414
return suggestions.compactMap {
1515
var suggestion = $0
1616
Self.removeTrailingWhitespacesAndNewlines(&suggestion)
1717
if suggestion.text.isEmpty { return nil }
1818
return suggestion
1919
}
2020
}
21-
21+
2222
static func removeTrailingWhitespacesAndNewlines(_ suggestion: inout CodeSuggestion) {
2323
var text = suggestion.text[...]
2424
while let last = text.last, last.isNewline || last.isWhitespace {
2525
text = text.dropLast(1)
2626
}
2727
suggestion.text = String(text)
2828
}
29+
30+
static func checkIfSuggestionHasNoEffect(
31+
_ suggestion: CodeSuggestion,
32+
request: SuggestionRequest
33+
) -> Bool {
34+
suggestion.text.isEmpty
35+
}
2936
}
37+

0 commit comments

Comments
 (0)