From 6b2b47a8e6718456410036e42fe4b3728387a2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Karlas=CC=8C?= Date: Tue, 13 Mar 2018 17:25:35 +0100 Subject: [PATCH] [VSfM] Fix code completion disappearing/reseting because C# part of .cshtml in regenerated Razor AddIn generation of C# projection content inside .cshtml depends on code completion being visible hence it needs to know state. Since we are using Roslyn code completion API which doesn't have method to check if code completion is visible and also it's internal, only other way would be to make some public static field inside CSharpBinding which indicates visibility of code completion, hence it's better to just store this value inside textView.Properties. We should be able to remove this in 15.8 when we switch to new VSEditor code completion API. --- .../Editor/DefaultVisualStudioCompletionBroker.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs index ff34982f1c..aebdd7e2cc 100644 --- a/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs +++ b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs @@ -19,7 +19,9 @@ namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.Editor if (textView.HasAggregateFocus) { - return CompletionWindowManager.IsVisible; + return CompletionWindowManager.IsVisible || + (textView.Properties.TryGetProperty("RoslynCompletionPresenterSession.IsCompletionActive", out var visible) + && visible); } // Text view does not have focus, if the completion window is visible it's for a different text view.