anchor.diff:          if trimLinefeed then output.TrimEnd('\n') 
           else output
                       
  -    let format (doc : Gui.Document option) style formatting input options =
  +    let format (editor : Editor.TextEditor option) style formatting input options =
           let isFsiFile = 
  -            match doc with 
  +            match editor with 
               | Some d -> d.FileName.Extension.Equals(".fsi", StringComparison.OrdinalIgnoreCase)
               | _ -> false
   
  
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
  