title: VS for Mac extension - null Editor in ActiveWindow
body: <p>I'm trying to get into developing an extension for Visual Studio for Mac. I'm using <a href="https://docs.microsoft.com/en-us/visualstudio/mac/extending-visual-studio-mac-walkthrough?view=vsmac-2019" rel="noreferrer">this</a> tutorial. Everything had been going well until I tried to run my extension. In my case "Insert date" in Edit submenu is disabled. While debugging I've noticed that IdeApp.Workbench.ActiveDocument.Editor is null despite I have an open document. Here's my code</p>
  
  <pre><code>using System;
  using MonoDevelop.Components.Commands;
  using MonoDevelop.Ide;
  
  namespace ExampleIDEExtension
  {
      public class InsertDateHandler : CommandHandler
      {
          protected override void Run()
          {
              var editor = IdeApp.Workbench.ActiveDocument.Editor;
              var currentTime = DateTime.Now.ToString();
              editor.InsertAtCaret(currentTime);
          }
  
          protected override void Update(CommandInfo info)
          {
              info.Enabled = IdeApp.Workbench.ActiveDocument.Editor != null;
          }
      }
  }
  </code></pre>
  
  <p>I have no idea why Editor is null despite having an open document.</p>