Skip to content

Commit 04109d5

Browse files
committed
Update to also remove trailing whitespaces
1 parent 343a66f commit 04109d5

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Core/Sources/GitHubCopilotService/GitHubCopilotService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public final class GitHubCopilotSuggestionService: GitHubCopilotBaseService,
316316
if UserDefaults.shared.value(for: \.gitHubCopilotIgnoreTrailingNewLines) {
317317
var updated = $0
318318
var text = updated.text[...]
319-
while text.hasSuffix("\n") {
319+
while let last = text.last, last.isNewline || last.isWhitespace {
320320
text = text.dropLast(1)
321321
}
322322
updated.text = String(text)

Core/Sources/HostApp/AccountSettings/CopilotView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ struct CopilotView: View {
231231

232232
Form {
233233
Toggle(
234-
"Ignore Trailing New Lines",
234+
"Ignore Trailing New Lines and Whitespaces",
235235
isOn: $settings.gitHubCopilotIgnoreTrailingNewLines
236236
)
237237
Toggle("Verbose Log", isOn: $settings.gitHubCopilotVerboseLog)

0 commit comments

Comments
 (0)