[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.
This commit is contained in:
David Karlaš 2018-03-13 17:25:35 +01:00 committed by N. Taylor Mullen
parent fcd4484542
commit 6b2b47a8e6
1 changed files with 3 additions and 1 deletions

View File

@ -19,7 +19,9 @@ namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.Editor
if (textView.HasAggregateFocus)
{
return CompletionWindowManager.IsVisible;
return CompletionWindowManager.IsVisible ||
(textView.Properties.TryGetProperty<bool>("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.