anchor.diff:              | policyBag -> policyBag  :> PolicyContainer
   
           let mimeTypeChain = DesktopService.GetMimeTypeInheritanceChain (FSharpFormatter.MimeType)
  -        let input = doc.Editor.Text
  +        let input = editor.Text
           if fromOffset = 0 && toOffset = String.length input then 
               LoggingService.LogInfo("**Fantomas**: OnTheFly Formatting document")
  -            formatText (Some doc) policyParent mimeTypeChain input Document
  +            formatText (Some editor) policyParent mimeTypeChain input Document
               |> ignore
           else 
               LoggingService.LogInfo("**Fantomas**: OnTheFly Formatting selection")
  -            formatText (Some doc) policyParent mimeTypeChain input (Selection(fromOffset, toOffset))
  +            formatText (Some editor) policyParent mimeTypeChain input (Selection(fromOffset, toOffset))
               |> ignore
   
       override x.FormatText(policyParent, mimeTypeChain, input, fromOffset, toOffset) = 
  
positive.code:                     let result =
                          trimIfNeeded input (CodeFormatter.formatSourceString isFsiFile input config)
                      //If onTheFly do the replacements in the document
                      doc |> Option.iter (fun d -> d.Editor.Document.Replace(0, input.Length, result))
                      result
                  with exn -> 
                      LoggingService.LogError("Error occured: {0}", exn.Message)
  
negative.code:                     let! result = 
                          try 
                              let selection = input.Substring(fromOffset, toOffset - fromOffset)
                              let result = trimIfNeeded selection (CodeFormatter.formatSelectionOnly isFsiFile range input config)
  
                              match editor with
                              | Some editor -> 
                                  //If onTheFly do the replacements in the document
                                  editor.ReplaceText(fromOffset, selection.Length, result)
                                  None
                              | None -> Some(result)
                           with exn -> 
                               LoggingService.LogError("**Fantomas Error occured: {0}", exn.Message)
                               None
  