public void Recalculate() { if (IsDismissed) { throw new InvalidOperationException(); } IsStarted = true; DisposeQuickInfoSources(); quickInfoSources = CreateQuickInfoSources(); var newContent = new List <object>(); ITrackingSpan applicableToSpan = null; foreach (var source in quickInfoSources) { ITrackingSpan applicableToSpanTmp; source.AugmentQuickInfoSession(this, newContent, out applicableToSpanTmp); if (IsDismissed) { return; } if (applicableToSpan == null) { applicableToSpan = applicableToSpanTmp; } } if (newContent.Count == 0 || applicableToSpan == null) { Dismiss(); } else { QuickInfoContent.BeginBulkOperation(); QuickInfoContent.Clear(); QuickInfoContent.AddRange(newContent); QuickInfoContent.EndBulkOperation(); HasInteractiveContent = CalculateHasInteractiveContent(); ApplicableToSpan = applicableToSpan; if (quickInfoPresenter == null) { quickInfoPresenter = intellisensePresenterFactoryService.TryCreateIntellisensePresenter(this); if (quickInfoPresenter == null) { Dismiss(); return; } PresenterChanged?.Invoke(this, EventArgs.Empty); } } Recalculated?.Invoke(this, EventArgs.Empty); }
public void Recalculate() { if (IsDismissed) { throw new InvalidOperationException(); } IsStarted = true; DisposeQuickInfoSources(); quickInfoSources = CreateQuickInfoSources(); QuickInfoContent.Clear(); ITrackingSpan applicableToSpan = null; foreach (var source in quickInfoSources) { ITrackingSpan applicableToSpanTmp; source.AugmentQuickInfoSession(this, QuickInfoContent, out applicableToSpanTmp); if (applicableToSpan == null) { applicableToSpan = applicableToSpanTmp; } } if (QuickInfoContent.Count == 0 || applicableToSpan == null) { Dismiss(); } else { HasInteractiveContent = CalculateHasInteractiveContent(); ApplicableToSpan = applicableToSpan; if (quickInfoPresenter == null) { quickInfoPresenter = quickInfoPresenterProvider.Create(this); Debug.Assert(quickInfoPresenter != null); PresenterChanged?.Invoke(this, EventArgs.Empty); } } Recalculated?.Invoke(this, EventArgs.Empty); }
private IDeferredQuickInfoContent CreateDeferredContent(QuickInfoContent content) { switch (content) { case QuickInfoDisplayContent c: var taggedTextMappingService = PrimaryWorkspace.Workspace.Services.GetLanguageServices(c.Language).GetService <ITaggedTextMappingService>(); return(new QuickInfoDisplayDeferredContent( new SymbolGlyphDeferredContent(c.Glyph, _glyphService), null, new ClassifiableDeferredContent(c.MainDescription, _classificationTypeMap, taggedTextMappingService), new ClassifiableDeferredContent(c.Documentation, _classificationTypeMap, taggedTextMappingService), new ClassifiableDeferredContent(SpecializedCollections.EmptyList <TaggedText>(), _classificationTypeMap, taggedTextMappingService), new ClassifiableDeferredContent(SpecializedCollections.EmptyList <TaggedText>(), _classificationTypeMap, taggedTextMappingService), new ClassifiableDeferredContent(SpecializedCollections.EmptyList <TaggedText>(), _classificationTypeMap, taggedTextMappingService), new ClassifiableDeferredContent(SpecializedCollections.EmptyList <TaggedText>(), _classificationTypeMap, taggedTextMappingService))); default: throw new ArgumentOutOfRangeException(); } }
internal async Task RequestQuickInfo(ITextView textView, ITrackingPoint triggerPoint) { JavaEditor javaEditor = null; if (TextBuffer.Properties.TryGetProperty <JavaEditor>(typeof(JavaEditor), out javaEditor) && javaEditor.TypeRootIdentifier != null) { var textReader = new TextSnapshotToTextReader(TextBuffer.CurrentSnapshot) as TextReader; var position = triggerPoint.GetPosition(TextBuffer.CurrentSnapshot); var quickInfoRequest = ProtocolHandlers.CreateQuickInfoRequest(textReader, javaEditor.TypeRootIdentifier, position); var quickInfoResponse = await javaEditor.JavaPkgServer.Send(javaEditor, quickInfoRequest); if (quickInfoResponse.responseType == Protocol.Response.ResponseType.QuickInfo && quickInfoResponse.quickInfoResponse != null) { foreach (var element in quickInfoResponse.quickInfoResponse.elements) { QuickInfoContent.Add(element.definition); // TODO: Better javadoc rendering + "\n\n" + element.javaDoc; } } } }
public FrameworkElement CreateFrameworkElement(QuickInfoContent content) { return(CreateDeferredContent(content).Create()); }