Skip to content

Commit 8795481

Browse files
committed
Don't sort CodeActions
Returned code actions are often sorted in a predetermined, preferred order. For instance, when proposing actions to handle error propagation on a throwing function the option to handle the error with `try` should appear before the more dangerous option to disable error propagation with `try!`. Fixes #1696
1 parent d09caf5 commit 8795481

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/SourceKitLSP/Swift/SwiftLanguageService.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,8 @@ extension SwiftLanguageService {
844844
// Ignore any providers that failed to provide refactoring actions.
845845
return []
846846
}
847-
}.flatMap { $0 }.sorted { $0.title < $1.title }
847+
}
848+
.flatMap { $0 }
848849
}
849850

850851
func retrieveSyntaxCodeActions(_ request: CodeActionRequest) async throws -> [CodeAction] {

0 commit comments

Comments
 (0)