in vsintegration/src/FSharp.LanguageService.Base/LanguageService.cs [348:398]
internal virtual int OnIdle(bool periodic, IOleComponentManager mgr)
{
if (!this.IsActive)
return 0;
// here's our chance to synchronize combo's and so on,
// first we see if the caret has moved.
IVsTextView view = this.lastActiveView;
if (view == null) return 0;
ISource s = this.GetSource(view);
if (s == null) return 0;
int line = -1, col = -1;
var hr = view.GetCaretPos(out line, out col);
if (NativeMethods.Failed(hr))
return 0;
if (line != this.lastLine || col != this.lastCol || this.lastFileName == null)
{
this.lastLine = line;
this.lastCol = col;
this.lastFileName = s.GetFilePath();
CodeWindowManager cwm = this.GetCodeWindowManagerForView(view);
if (cwm != null)
{
this.OnCaretMoved(cwm, view, line, col);
}
}
s.OnIdle(periodic); // do idle processing for currently-focused file
bool moreToDo = false;
#if CHECK_ALL_DIRTY_FILES_ON_PERIODIC_IDLE
if (periodic && mgr.FContinueIdle() != 0)
{
// while there is spare idle time, pick a dirty file (if there is one) and do idle processing for it
for (int i = 0; i < this.sources.Count; ++i)
{
Source so = this.sources[i] as Source;
if (so != null && so.IsDirty)
{
so.OnIdle(periodic);
if (mgr.FContinueIdle() == 0)
{
moreToDo = true;
break;
}
}
}
}
#endif
return moreToDo ? 1 : 0;
}