There is already a functionality that tracks opened F# documents: https://github.com/fsprojects/VisualFSharpPowerTools/blob/master/src/FSharpVSPowerTools.Logic/OpenDocumentsTracker.fs - it will be better to use it instead of enumerating all DTE documents every time