public async void SciMouseDwellStarted(SciCode doc, int pos8, bool isDiag) { var pi = Panels.Info; if (!pi.Visible) { pi = null; } if (isDiag && pi == null) { return; } if (pos8 <= 0) { pi?.ZSetAboutInfo(); return; } //APerf.First(); int pos16 = doc.Pos16(pos8); if (!CodeInfo.GetContextAndDocument(out var cd, pos16)) { pi?.ZSetAboutInfo(cd.metaEnd > 0); return; } //APerf.Next(); var context = new QuickInfoContext(cd.document, pos16, default); //APerf.Next(); var provider = new CSharpSemanticQuickInfoProvider(); //var r = await provider.GetQuickInfoAsync(context); //not async var r = await Task.Run(async() => await provider.GetQuickInfoAsync(context)); //APerf.Next(); if (r == null) { pi?.ZSetAboutInfo(); return; } //AOutput.Write(r.Span, r.RelatedSpans); //AOutput.Write(r.Tags); var b = new StringBuilder("<body><div>"); //image CiUtil.TagsToKindAndAccess(r.Tags, out var kind, out var access); if (kind != CiItemKind.None) { if (access != default) { b.AppendFormat("<img src='@a{0}' style='padding-top: 6px' />", (int)access); } b.AppendFormat("<img src='@k{0}' style='padding-top: 2px' />", (int)kind); } //bool hasDocComm = false; //QuickInfoSection descr = null; POINT excRange = default, retRange = default;
/// <summary> /// Called every 250 ms while editor is visible. /// </summary> public void Timer250msWhenVisibleAndWarm(SciCode doc) { //We use SCLEX_NULL. If SCLEX_CONTANER, Scintilla sends too many notifications, particularly if folding used too. //To detect when need styling and folding we use 'opened' and 'modified' events and 250 ms timer. //When modified, we do styling for the modified line(s). It is faster but unreliable, eg does not update new/deleted identifiers. //The timer does styling and folding for all visible lines. It is slower but updates everything after modified, scrolled, resized, folded, etc. //When opened, we do styling for all visible lines; folding for all lines, because may need to restore saved contracted fold points. if (_cancelTS != null || (_modTimer?.IsRunning ?? false)) { return; } if (doc != _doc || _update) { if (doc != _doc) { _DocChanged(doc, false); } else { _update = false; } _StylingAndFoldingVisibleFrom0(doc); } else { Sci_GetStylingInfo(doc.SciPtr, 8 | 4, out var si); //fast if (si.visibleFromLine < _visibleLines.Start.Value || si.visibleToLine > _visibleLines.End.Value) { _StylingAndFolding(doc); //all visible } else if (_diagCounter > 0 && --_diagCounter == 0) { CodeInfo._diag.Indicators(doc.Pos16(si.visibleFrom), doc.Pos16(si.visibleTo)); } } }