From 7da4060d53e34d9a9f4efe7686cd1809931ca81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Sun, 1 Nov 2020 23:10:15 +0200 Subject: [PATCH 1/2] Fix incremental changes in Cake. Don't handle the null buffer request with no line changes. --- src/OmniSharp.Cake/Services/CakeScriptService.cs | 8 ++++++++ 1 file changed, 8 insertions(+) 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 From 375aa0b11c91ab8d767be559657c5ba172339df8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Sun, 1 Nov 2020 23:11:32 +0200 Subject: [PATCH 2/2] Use TextEdit instead of AdditionalTextEdits for CompletionResponse. Fixes completion once again for Cake. --- src/OmniSharp.Cake/Extensions/ResponseExtensions.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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);