private async Task UpdateDescription() { if (descriptionWindow != null) { descriptionWindow.Destroy(); descriptionWindow = null; } descriptionCts.Cancel(); if (SelectedItemIndex == -1) { return; } var completionItem = SelectedItem; descriptionCts = new CancellationTokenSource(); var token = descriptionCts.Token; TooltipInformation description = null; try { var document = _subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChangesSafe(); description = await RoslynCompletionData.CreateTooltipInformation(document, completionItem, false, token); } catch { } if (token.IsCancellationRequested) { return; } if (descriptionWindow != null) { descriptionWindow.Destroy(); descriptionWindow = null; } if (description == null) { return; } var window = new TooltipInformationWindow(); window.AddOverload(description); descriptionWindow = window; ShowDescription(); }
void HideDescription() { Runtime.CheckMainThread(); descriptionCts.Cancel(); descriptionCts = new CancellationTokenSource(); if (descriptionWindow != null) { descriptionWindow.Destroy(); descriptionWindow = null; } }