@@ -189,6 +189,24 @@ namespace rec Microsoft.VisualStudio.FSharp.ProjectSystem
189189
190190// FSI-LINKAGE-POINT: unsited init
191191do Microsoft.VisualStudio.FSharp.Interactive.Hooks.fsiConsoleWindowPackageCtorUnsited( this:> Package)
192+
193+ let mutable mgr : IOleComponentManager = null
194+ let mutable componentID = 0 u
195+
196+ member this.RegisterForIdleTime () =
197+ mgr<- this.GetService( typeof< SOleComponentManager>) :?> IOleComponentManager
198+ if componentID= 0 u&& not ( isNull mgr) then
199+ let crinfo = Array.zeroCreate< OLECRINFO>( 1 )
200+ let mutable crinfo0 = crinfo.[ 0 ]
201+ crinfo0.cbSize<- Marshal.SizeOf( typeof< OLECRINFO>) |> uint32
202+ crinfo0.grfcrf<- uint32(_ OLECRF.olecrfNeedIdleTime||| _ OLECRF.olecrfNeedPeriodicIdleTime)
203+ crinfo0.grfcadvf<- uint32(_ OLECADVF.olecadvfModal||| _ OLECADVF.olecadvfRedrawOff||| _ OLECADVF.olecadvfWarningsOff)
204+ crinfo0.uIdleTimeInterval<- 1000 u
205+ crinfo.[ 0 ] <- crinfo0
206+ let componentID_out = ref componentID
207+ let _hr = mgr.FRegisterComponent( this, crinfo, componentID_ out)
208+ componentID<- componentID_ out.Value
209+ ()
192210
193211/// This method loads a localized string based on the specified resource.
194212
@@ -289,6 +307,8 @@ namespace rec Microsoft.VisualStudio.FSharp.ProjectSystem
289307 Microsoft.VisualStudio.FSharp.Interactive.Hooks.fsiConsoleWindowPackageInitalizeSited( this:> Package) commandService
290308// FSI-LINKAGE-POINT: private method GetDialogPage forces fsi options to be loaded
291309let _fsiPropertyPage = this.GetDialogPage( typeof< Microsoft.VisualStudio.FSharp.Interactive.FsiPropertyPage>)
310+
311+ this.RegisterForIdleTime()
292312()
293313
294314/// This method is called during Devenv /Setup to get the bitmap to
@@ -340,7 +360,37 @@ namespace rec Microsoft.VisualStudio.FSharp.ProjectSystem
340360 GetToolWindowAsITestVFSI() .SendTextInteraction( s)
341361member this.GetMostRecentLines ( n : int ) : string [] =
342362 GetToolWindowAsITestVFSI() .GetMostRecentLines( n)
363+
364+ interface IOleComponentwith
365+ override this.FContinueMessageLoop ( _uReason : uint32 , _pvLoopData : IntPtr , _pMsgPeeked : MSG []) =
366+ 1
367+
368+ override this.FDoIdle ( grfidlef : uint32 ) =
369+ // see e.g "C:\Program Files\Microsoft Visual Studio 2008 SDK\VisualStudioIntegration\Common\IDL\olecm.idl" for details
370+ //Trace.Print("CurrentDirectoryDebug", (fun () -> sprintf "curdir='%s'\n" (System.IO.Directory.GetCurrentDirectory()))) // can be useful for watching how GetCurrentDirectory changes
371+ let periodic = ( grfidlef&&& ( uint32_ OLEIDLEF.oleidlefPeriodic)) <> 0 u
372+ if periodic&& not ( isNull mgr) && mgr.FContinueIdle() <> 0 then
373+ TaskReporterIdleRegistration.DoIdle( mgr)
374+ else
375+ 0
376+
377+ override this.FPreTranslateMessage ( _pMsg ) = 0
378+
379+ override this.FQueryTerminate ( _fPromptUser ) = 1
380+
381+ override this.FReserved1 ( _dwReserved , _message , _wParam , _lParam ) = 1
382+
383+ override this.HwndGetWindow ( _dwWhich , _dwReserved ) = 0 n
384+
385+ override this.OnActivationChange ( _pic , _fSameComponent , _pcrinfo , _fHostIsActivating , _pchostinfo , _dwReserved ) = ()
386+
387+ override this.OnAppActivate ( _fActive , _dwOtherThreadID ) = ()
388+
389+ override this.OnEnterState ( _uStateID , _fEnter ) = ()
390+
391+ override this.OnLoseActivation () = ()
343392
393+ override this.Terminate () = ()
344394
345395/// Factory for creating our editor, creates FSharp Projects
346396[<Guid( GuidList.guidFSharpProjectFactoryString) >]