anchor.diff:                                                 serviceProvider: IServiceProvider,
                                                  projectFactory: ProjectFactory) as self =
       let tagsChanged = Event<_, _>()
  -    let mutable currentWord = None
  +    let mutable currentWord: SnapshotSpan option = None
       let mutable unionDefinition = None
   
       let [<Literal>] CommandName = "Generate union pattern match cases"
  
positive.code:     interface ITagger<UnionPatternMatchCaseGeneratorSmartTag> with
          member x.GetTags(_spans: NormalizedSnapshotSpanCollection): ITagSpan<UnionPatternMatchCaseGeneratorSmartTag> seq =
              try
                  [|
                      match unionDefinition with
                      | Some (word, expression, entity, insertionPos) when shouldGenerateUnionPatternMatchCases expression entity ->
                          let span = SnapshotSpan(buffer.CurrentSnapshot, word.Span)
                          yield TagSpan<_>(span, 
                                           UnionPatternMatchCaseGeneratorSmartTag(x.GetSmartTagActions(word.Snapshot, expression, insertionPos, entity)))
                                :> ITagSpan<_>
                      | _ -> ()
                  |]
                  |> Seq.ofArray
              with e ->
                  Logging.logException e
                  Seq.empty
  
negative.code:     let codeGenService: ICodeGenerationService<_, _, _> = upcast CodeGenerationService(vsLanguageService, buffer)
  
      let updateAtCaretPosition() =
          match buffer.GetSnapshotPoint view.Caret.Position, currentWord with
          | Some point, Some word when word.Snapshot = view.TextSnapshot && point.InSpan word -> ()
          | _ ->
              let res =
                  maybe {
                      let! point = buffer.GetSnapshotPoint view.Caret.Position
                      let dte = serviceProvider.GetService<EnvDTE.DTE, SDTE>()
                      let! doc = dte.GetActiveDocument()
                      let! project = projectFactory.CreateForDocument buffer doc
                      let! word, _ = vsLanguageService.GetSymbol(point, project) 
                      return point, doc, project, word
                  }
  
              match res with
              | Some (point, doc, project, newWord) ->
                  let wordChanged = 
                      match currentWord with
                      | None -> true
                      | Some oldWord -> newWord <> oldWord
  
                  if wordChanged then
                      asyncMaybe {
                          let vsDocument = VSDocument(doc, point.Snapshot)
                          let! symbolRange, patMatchExpr, unionTypeDefinition, insertionPos =
                              tryFindUnionDefinitionFromPos codeGenService project point vsDocument
                          let newWord = symbolRange
  
                          // Recheck cursor position to ensure it's still in new word
                          let! point = buffer.GetSnapshotPoint view.Caret.Position |> liftMaybe
                          if point.InSpan newWord then
                              return! Some(patMatchExpr, unionTypeDefinition, insertionPos) |> liftMaybe
                          else
                              return! liftMaybe None
                      }
                      |> Async.map (fun result -> 
                          unionDefinition <- result
                          let span = SnapshotSpan(buffer.CurrentSnapshot, 0, buffer.CurrentSnapshot.Length)
                          tagsChanged.Trigger(self, SnapshotSpanEventArgs(span)))
                      |> Async.StartImmediate
  
                      currentWord <- Some newWord
              | _ -> ()
  
      let _ = DocumentEventsListener ([ViewChange.layoutEvent view; ViewChange.caretEvent view], 
                                      500us, updateAtCaretPosition)
  