mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
Merge pull request #646 from ahoppen/ahoppen-5.7/texteditfix
[5.7] Empty TextEdits now return nil
This commit is contained in:
@@ -100,6 +100,12 @@ extension TextEdit {
|
||||
// Snippets are only suppored in code completion.
|
||||
// Remove SourceKit placeholders from Fix-Its because they can't be represented in the editor properly.
|
||||
let replacementWithoutPlaceholders = rewriteSourceKitPlaceholders(inString: replacement, clientSupportsSnippets: false)
|
||||
|
||||
// If both the replacement without placeholders and the fixit are empty, no TextEdit should be created.
|
||||
if (replacementWithoutPlaceholders.isEmpty && length == 0) {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(range: position..<endPosition, newText: replacementWithoutPlaceholders)
|
||||
} else {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user