diff --git a/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs b/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs index ee2fba4ce5..ff30504794 100644 --- a/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs +++ b/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs @@ -200,14 +200,17 @@ public static async Task TranslateAsync(this CompletionRespo { foreach (var item in response.Items) { - if (item.AdditionalTextEdits is null) + if (item.TextEdit is null) { continue; } + var (_, textEdit) = await item.TextEdit.TranslateAsync(workspace, request.FileName); + item.TextEdit = textEdit; + List additionalTextEdits = null; - foreach (var additionalTextEdit in item.AdditionalTextEdits) + foreach (var additionalTextEdit in item.AdditionalTextEdits ?? Enumerable.Empty()) { var (_, change) = await additionalTextEdit.TranslateAsync(workspace, request.FileName); diff --git a/src/OmniSharp.Cake/Services/CakeScriptService.cs b/src/OmniSharp.Cake/Services/CakeScriptService.cs index 558200f2e7..c60455e58b 100644 --- a/src/OmniSharp.Cake/Services/CakeScriptService.cs +++ b/src/OmniSharp.Cake/Services/CakeScriptService.cs @@ -55,6 +55,14 @@ public CakeScript Generate(FileChange fileChange) throw new InvalidOperationException("Service not initialized."); } + if (!fileChange.FromDisk && fileChange.Buffer is null && fileChange.LineChanges.Count == 0) + { + return new CakeScript + { + Source = null + }; + } + var cakeScript = _generationService.Generate(fileChange); // Set line processor for generated aliases. TODO: Move to Cake.Bakery