anchor.diff:                      let fullrangeTry = Range.startToStart tryRange withRange
                       let collapseWith = Range.endToEnd withRange wholeRange
                       let fullrangeWith = Range.startToEnd withRange wholeRange
  -                    yield! rcheck Scope.TryWith Collapse.Below fullrange collapse
  -                    yield! rcheck Scope.TryInTryWith Collapse.Below fullrangeTry collapseTry
  -                    yield! rcheck Scope.WithInTryWith Collapse.Below fullrangeWith collapseWith
  +                    rcheck Scope.TryWith Collapse.Below fullrange collapse
  +                    rcheck Scope.TryInTryWith Collapse.Below fullrangeTry collapseTry
  +                    rcheck Scope.WithInTryWith Collapse.Below fullrangeWith collapseWith
                   | _ -> ()
  -                yield! parseExpr e
  -                yield! parseMatchClauses matchClauses
  -            | SynExpr.TryFinally (tryExpr,finallyExpr,r,tryPoint,finallyPoint) as _tryFinally ->
  +                parseExpr e
  +                List.iter parseMatchClause matchClauses
  +            | SynExpr.TryFinally (tryExpr,finallyExpr,r,tryPoint,finallyPoint) ->
                   match tryPoint, finallyPoint with
                   | SequencePointAtTry tryRange, SequencePointAtFinally finallyRange ->
                       let collapse = Range.endToEnd tryRange finallyExpr.Range
                       let fullrange = Range.startToEnd tryRange finallyExpr.Range
                       let collapseFinally = Range.endToEnd finallyRange r
                       let fullrangeFinally = Range.startToEnd finallyRange r
  -                    yield! rcheck Scope.TryFinally Collapse.Below fullrange collapse
  -                    yield! rcheck  Scope.FinallyInTryFinally Collapse.Below fullrangeFinally collapseFinally
  +                    rcheck Scope.TryFinally Collapse.Below fullrange collapse
  +                    rcheck  Scope.FinallyInTryFinally Collapse.Below fullrangeFinally collapseFinally
                   | _ -> ()
  -                yield! parseExpr tryExpr
  -                yield! parseExpr finallyExpr
  -            | SynExpr.IfThenElse (ifExpr,thenExpr,elseExprOpt,spIfToThen,_,ifToThenRange,r) as _ifThenElse->
  +                parseExpr tryExpr
  +                parseExpr finallyExpr
  +            | SynExpr.IfThenElse (ifExpr,thenExpr,elseExprOpt,spIfToThen,_,ifToThenRange,r) ->
                   match spIfToThen with
                   | SequencePointAtBinding rt ->
                       // Outline the entire IfThenElse
                       let fullrange = Range.startToEnd rt r
                       let collapse = Range.endToEnd  ifExpr.Range r
  -                    yield! rcheck Scope.IfThenElse Collapse.Below fullrange collapse
  +                    rcheck Scope.IfThenElse Collapse.Below fullrange collapse
                       // Outline the `then` scope
                       let thenRange = Range.endToEnd (Range.modEnd -4  ifToThenRange)   thenExpr.Range
                       let thenCollapse = Range.endToEnd ifToThenRange thenExpr.Range
  -                    yield! rcheck Scope.ThenInIfThenElse Collapse.Below thenRange thenCollapse
  +                    rcheck Scope.ThenInIfThenElse Collapse.Below thenRange thenCollapse
                   | _ -> ()
  -                yield! parseExpr ifExpr
  -                yield! parseExpr thenExpr
  +                parseExpr ifExpr
  +                parseExpr thenExpr
                   match elseExprOpt with
                   | Some elseExpr ->
                       match elseExpr with // prevent double collapsing on elifs
  -                    | SynExpr. IfThenElse (_,_,_,_,_,_,_) ->
  -                        yield! parseExpr elseExpr
  +                    | SynExpr.IfThenElse _ ->
  +                        parseExpr elseExpr
                       | _ ->
                           // This is not the best way to establish the position of `else`
                           // the AST doesn't provide an easy way to find the position of the keyword
                           // as such `else` will be left out of block structuring and outlining until a
                           // a suitable approach is determined
  -                        yield! parseExpr elseExpr
  +                        parseExpr elseExpr
                   | None -> ()
               | SynExpr.While (_,_,e,r) ->
  -                yield! rcheck Scope.While Collapse.Below r r
  -                yield! parseExpr e
  +                rcheck Scope.While Collapse.Below r r
  +                parseExpr e
               | SynExpr.Lambda (_,_,pats,e,r) ->
                   match pats with
                   | SynSimplePats.SimplePats (_,pr)
                   | SynSimplePats.Typed (_,_,pr) ->
  -                    yield! rcheck Scope.Lambda Collapse.Below r <| Range.endToEnd pr r
  -                yield! parseExpr e
  +                    rcheck Scope.Lambda Collapse.Below r (Range.endToEnd pr r)
  +                parseExpr e
               | SynExpr.Lazy (e,r) ->
  -                yield! rcheck Scope.SpecialFunc Collapse.Below r r
  -                yield! parseExpr e
  +                rcheck Scope.SpecialFunc Collapse.Below r r
  +                parseExpr e
               | SynExpr.Quote (_,isRaw,e,_,r) ->
                   // subtract columns so the @@> or @> is not collapsed
  -                yield! rcheck Scope.Quote Collapse.Same r <| Range.modBoth (if isRaw then 3 else 2) (if isRaw then 3 else 2) r
  -                yield! parseExpr e
  +                rcheck Scope.Quote Collapse.Same r (Range.modBoth (if isRaw then 3 else 2) (if isRaw then 3 else 2) r)
  +                parseExpr e
               | SynExpr.Tuple (es,_,r)
               | SynExpr.StructTuple(es,_,r) ->
  -                yield! rcheck Scope.Tuple Collapse.Same r r
  -                yield! Seq.collect parseExpr es
  +                rcheck Scope.Tuple Collapse.Same r r
  +                List.iter parseExpr es
               | SynExpr.Paren (e,_,_,_) ->
  -                yield! parseExpr e
  +                parseExpr e
               | SynExpr.Record (recCtor,recCopy,recordFields,r) ->
                   match recCtor with
  -                | Some (_,ctorArgs,_,_,_) -> yield! parseExpr ctorArgs
  +                | Some (_,ctorArgs,_,_,_) -> parseExpr ctorArgs
                   | _ -> ()
                   match recCopy with
  -                | Some (e,_) -> yield! parseExpr e
  +                | Some (e,_) -> parseExpr e
                   | _ -> ()
  -                yield! recordFields |> (Seq.choose (fun (_,e,_) -> e) >> Seq.collect parseExpr)
  +                recordFields |> List.choose (fun (_,e,_) -> e) |> List.iter parseExpr
                   // exclude the opening `{` and closing `}` of the record from collapsing
  -                yield! rcheck Scope.Record Collapse.Same r <| Range.modBoth 1 1 r
  +                rcheck Scope.Record Collapse.Same r <| Range.modBoth 1 1 r
               | _ -> ()
  -        }
  -
  -    and parseMatchClause (SynMatchClause.Clause(synPat,_,e,_r,_) as clause) =
  -        let rec getLastPat = function
  -            | SynPat.Or(_, pat, _) -> getLastPat pat
  -            | x -> x
  -
  -        seq {
  +
  +        and parseMatchClause (SynMatchClause.Clause(synPat,_,e,_r,_) as clause) =
  +            let rec getLastPat = function
  +                | SynPat.Or(_, pat, _) -> getLastPat pat
  +                | x -> x
  +
               let synPat = getLastPat synPat
               let collapse  = Range.endToEnd synPat.Range clause.Range // Collapse the scope starting with `->`
  -            yield! rcheck Scope.MatchClause Collapse.Same e.Range collapse
  -            yield! parseExpr e
  -        }
  -
  -    and parseMatchClauses = Seq.collect parseMatchClause
  -
  -    and parseAttributes (attrs: SynAttributes) =
  -        seq {
  -            let attrListRange =
  -                if List.isEmpty attrs then Seq.empty else
  -                let range = Range.startToEnd (attrs.[0].Range) (attrs.[attrs.Length-1].ArgExpr.Range)
  -                rcheck Scope.Attribute Collapse.Same  range range
  +            rcheck Scope.MatchClause Collapse.Same e.Range collapse
  +            parseExpr e
  +
  +        and parseAttributes (attrs: SynAttributes) =
  +            let attrListRange() =
  +                if not (List.isEmpty attrs) then
  +                    let range = Range.startToEnd (attrs.[0].Range) (attrs.[attrs.Length-1].ArgExpr.Range)
  +                    rcheck Scope.Attribute Collapse.Same range range
  +
               match  attrs with
               | [] -> ()
  -            | [_] -> yield! attrListRange
  -            | hd::tl ->
  -                yield! attrListRange
  -                yield! parseExpr hd.ArgExpr
  +            | [_] -> attrListRange()
  +            | head :: tail ->
  +                attrListRange()
  +                parseExpr head.ArgExpr
                   // If there are more than 2 attributes only add tags to the 2nd and beyond, to avoid double collapsing on the first attribute
  -                yield! tl |> Seq.collect (fun attr ->
  +                for attr in tail do
                       let range = Range.startToEnd attr.Range attr.ArgExpr.Range
                       rcheck Scope.Attribute Collapse.Same range range
  -                )
  +                
                   // visit the expressions inside each attribute
  -                yield! attrs |> Seq.collect (fun attr -> parseExpr attr.ArgExpr)
  -        }
  -
  -    and parseBinding (SynBinding.Binding (_,kind,_,_,attrs,_,SynValData(memberFlags,_,_),_,_,expr,br,_) as binding) =
  -        seq {
  +                for attr in attrs do
  +                    parseExpr attr.ArgExpr
  +
  +        and parseBinding (SynBinding.Binding (_,kind,_,_,attrs,_,SynValData(memberFlags,_,_),_,_,expr,br,_) as binding) =
               match kind with
               | NormalBinding ->
                   let collapse = Range.endToEnd binding.RangeOfBindingSansRhs binding.RangeOfBindingAndRhs
                   match memberFlags with
                   | Some ({MemberKind=MemberKind.Constructor}) ->
                       let collapse = Range.startToEnd expr.Range br
  -                    yield! rcheck Scope.New Collapse.Below br collapse
  +                    rcheck Scope.New Collapse.Below br collapse
                   | Some _ ->
  -                    yield! rcheck Scope.Member Collapse.Below binding.RangeOfBindingAndRhs collapse
  +                    rcheck Scope.Member Collapse.Below binding.RangeOfBindingAndRhs collapse
                   | None ->
  -                    yield! rcheck Scope.LetOrUse Collapse.Below binding.RangeOfBindingAndRhs collapse
  +                    rcheck Scope.LetOrUse Collapse.Below binding.RangeOfBindingAndRhs collapse
               | DoBinding ->
                   let r = Range.modStart 2 br
  -                yield! rcheck Scope.Do Collapse.Below br r
  +                rcheck Scope.Do Collapse.Below br r
               | _ -> ()
  -            yield! parseAttributes attrs
  -            yield! parseExpr expr
  -        }
  -
  -    and parseBindings sqs = sqs |> Seq.collect parseBinding
  -
  -    and parseExprInterface (InterfaceImpl(synType,bindings,range)) = seq{
  -        let collapse = Range.endToEnd synType.Range range |> Range.modEnd -1
  -        yield! rcheck Scope.Interface Collapse.Below range collapse
  -        yield! parseBindings bindings
  -     }
  -
  -    and parseExprInterfaces (intfs:SynInterfaceImpl list) = Seq.collect parseExprInterface intfs
  -
  -    and parseSynMemberDefn (objectModelRange: range) d =
  -        seq {
  +            parseAttributes attrs
  +            parseExpr expr
  +
  +        and parseBindings sqs = for bind in sqs do parseBinding bind
  +
  +        and parseExprInterface (InterfaceImpl(synType,bindings,range)) =
  +            let collapse = Range.endToEnd synType.Range range |> Range.modEnd -1
  +            rcheck Scope.Interface Collapse.Below range collapse
  +            parseBindings bindings
  +
  +        and parseExprInterfaces (intfs: SynInterfaceImpl list) = List.iter parseExprInterface intfs
  +
  +        and parseSynMemberDefn (objectModelRange: range) d =
               match d with
               | SynMemberDefn.Member(SynBinding.Binding (attrs=attrs; valData=valData; headPat=synPat; range=bindingRange) as binding,_) ->
                  match valData with
                  | SynValData (Some { MemberKind=MemberKind.Constructor },_,_) ->
                     let collapse = Range.endToEnd synPat.Range d.Range
  -                  yield! rcheck Scope.New Collapse.Below d.Range collapse
  +                  rcheck Scope.New Collapse.Below d.Range collapse
                  | SynValData (Some { MemberKind=MemberKind.PropertyGet | MemberKind.PropertySet },_,_) ->
                     let range = 
                       mkRange 
                           d.Range.FileName 
                           (mkPos d.Range.StartLine objectModelRange.StartColumn)
                           d.Range.End
  -                  
  +              
                     let collapse =
                       match synPat with
                       | SynPat.LongIdent(longDotId=longIdent) ->
                          Range.endToEnd longIdent.Range d.Range
                       | _ -> Range.endToEnd bindingRange d.Range
   
  -                  yield! rcheck Scope.Member Collapse.Below range collapse
  +                  rcheck Scope.Member Collapse.Below range collapse
                  | _ ->
                     let collapse = Range.endToEnd bindingRange d.Range
  -                  yield! rcheck Scope.Member Collapse.Below d.Range collapse
  -               yield! parseAttributes attrs
  -               yield! parseBinding binding
  +                  rcheck Scope.Member Collapse.Below d.Range collapse
  +               parseAttributes attrs
  +               parseBinding binding
               | SynMemberDefn.LetBindings (bindings,_,_,_) ->
  -                yield! parseBindings bindings
  +                parseBindings bindings
               | SynMemberDefn.Interface (tp, iMembers, r) ->
  -                yield! rcheck Scope.Interface Collapse.Below d.Range <| Range.endToEnd tp.Range d.Range
  +                rcheck Scope.Interface Collapse.Below d.Range (Range.endToEnd tp.Range d.Range)
                   match iMembers with
  -                | Some members ->
  -                    yield! Seq.collect (parseSynMemberDefn r) members
  +                | Some members -> List.iter (parseSynMemberDefn r) members
                   | None -> ()
               | SynMemberDefn.NestedType (td, _, _) ->
  -                yield! parseTypeDefn td 
  +                parseTypeDefn td 
               | SynMemberDefn.AbstractSlot (ValSpfn(synType=synt), _, r) ->
  -                yield! rcheck Scope.Member Collapse.Below d.Range (Range.startToEnd synt.Range r)
  +                rcheck Scope.Member Collapse.Below d.Range (Range.startToEnd synt.Range r)
               | SynMemberDefn.AutoProperty (synExpr=e; range=r) ->
  -                yield! rcheck Scope.Member Collapse.Below d.Range r
  -                yield! parseExpr e
  +                rcheck Scope.Member Collapse.Below d.Range r
  +                parseExpr e
               | _ -> ()
  -        }
  -
  -    (*  For Cases like
  -        --------------
  -            type JsonDocument =
  -                private {   Json : string
  -                            Path : string   }
  -        Or
  -             type JsonDocument =
  -                internal |  Json of string
  -                         |  Path of string
  -    *)
  -    and parseSimpleRepr simple =
  -        seq {
  +
  +        (*  For Cases like
  +            --------------
  +                type JsonDocument =
  +                    private {   Json : string
  +                                Path : string   }
  +            Or
  +                 type JsonDocument =
  +                    internal |  Json of string
  +                             |  Path of string
  +        *)
  +        and parseSimpleRepr simple =
               match simple with
               | SynTypeDefnSimpleRepr.Enum (cases,_er) ->
                   for EnumCase (attrs, _, _, _, cr) in cases do
  -                    yield! rcheck Scope.EnumCase Collapse.Below cr cr
  -                    yield! parseAttributes attrs
  +                    rcheck Scope.EnumCase Collapse.Below cr cr
  +                    parseAttributes attrs
               | SynTypeDefnSimpleRepr.Record (_,fields,rr) ->
  -                yield! rcheck Scope.RecordDefn Collapse.Same rr rr 
  +                rcheck Scope.RecordDefn Collapse.Same rr rr 
                   for Field (attrs,_,_,_,_,_,_,fr) in fields do
  -                    yield! rcheck Scope.RecordField Collapse.Below fr fr
  -                    yield! parseAttributes attrs
  +                    rcheck Scope.RecordField Collapse.Below fr fr
  +                    parseAttributes attrs
               | SynTypeDefnSimpleRepr.Union (_,cases,ur) ->
  -                yield! rcheck Scope.UnionDefn Collapse.Same ur ur
  +                rcheck Scope.UnionDefn Collapse.Same ur ur
                   for UnionCase (attrs,_,_,_,_,cr) in cases do
  -                    yield! rcheck Scope.UnionCase Collapse.Below cr cr
  -                    yield! parseAttributes attrs
  +                    rcheck Scope.UnionCase Collapse.Below cr cr
  +                    parseAttributes attrs
               | _ -> ()
  -        }
  -
  -    and parseTypeDefn (TypeDefn(ComponentInfo(_,typeArgs,_,_,_,_,_,r), objectModel, members, fullrange)) = 
  -        seq {
  +
  +        and parseTypeDefn (TypeDefn(ComponentInfo(_,typeArgs,_,_,_,_,_,r), objectModel, members, fullrange)) = 
              let typeArgsRange = rangeOfTypeArgsElse r typeArgs
              let collapse = Range.endToEnd (Range.modEnd 1 typeArgsRange) fullrange
              match objectModel with
              | SynTypeDefnRepr.ObjectModel (defnKind, objMembers, r) ->
                  match defnKind with
                  | TyconAugmentation ->
  -                   yield! rcheck Scope.TypeExtension Collapse.Below fullrange collapse
  +                   rcheck Scope.TypeExtension Collapse.Below fullrange collapse
                  | _ ->
  -                   yield! rcheck Scope.Type Collapse.Below fullrange collapse
  -               yield! Seq.collect (parseSynMemberDefn r) objMembers
  +                   rcheck Scope.Type Collapse.Below fullrange collapse
  +               List.iter (parseSynMemberDefn r) objMembers
                  // visit the members of a type extension
  -               yield! Seq.collect (parseSynMemberDefn r) members
  +               List.iter (parseSynMemberDefn r) members
              | SynTypeDefnRepr.Simple (simpleRepr, r) ->
  -               yield! rcheck Scope.Type Collapse.Below fullrange collapse
  -               yield! parseSimpleRepr simpleRepr
  -               yield! Seq.collect (parseSynMemberDefn r) members
  +               rcheck Scope.Type Collapse.Below fullrange collapse
  +               parseSimpleRepr simpleRepr
  +               List.iter (parseSynMemberDefn r) members
              | SynTypeDefnRepr.Exception _ -> ()
  -        }
  -
  -    let getConsecutiveModuleDecls (predicate: SynModuleDecl -> range option) (scope: Scope) (decls: SynModuleDecls) =
  -        let groupConsecutiveDecls input =
  -            let rec loop (input: range list) (res: range list list) currentBulk =
  -                match input, currentBulk with
  -                | [], [] -> List.rev res
  -                | [], _ -> List.rev (currentBulk::res)
  -                | r :: rest, [] -> loop rest res [r]
  -                | r :: rest, last :: _ when r.StartLine = last.EndLine + 1 ->
  -                    loop rest res (r::currentBulk)
  -                | r :: rest, _ -> loop rest (currentBulk::res) [r]
  -            loop input [] []
  -
  -        let selectRanges (ranges: range list) =
  -            match ranges with
  -            | [] -> None
  -            | [r] when r.StartLine = r.EndLine -> None
  -            | [r] ->
  -                let range = mkRange "" r.Start r.End
  -                Some { Scope = scope; Collapse = Collapse.Same; Range = range ; CollapseRange = range }
  -            | lastRange :: rest ->
  -                let firstRange = Seq.last rest
  -                let range = mkRange "" firstRange.Start lastRange.End
  -                Some { Scope = scope; Collapse = Collapse.Same; Range = range; CollapseRange = range }
  -
  -        decls |> (List.choose predicate >> groupConsecutiveDecls >> List.choose selectRanges)
  -
  -    let collectOpens = getConsecutiveModuleDecls (function SynModuleDecl.Open (_, r) -> Some r | _ -> None) Scope.Open
  -
  -    let collectHashDirectives =
  -         getConsecutiveModuleDecls(
  -            function
  -            | SynModuleDecl.HashDirective (ParsedHashDirective (directive, _, _),r) ->
  -                let prefixLength = "#".Length + directive.Length + " ".Length
  -                Some (mkRange "" (mkPos r.StartLine prefixLength) r.End)
  -            | _ -> None) Scope.HashDirective
  -
  -    let rec parseDeclaration (decl: SynModuleDecl) =
  -        seq {
  +
  +        let getConsecutiveModuleDecls (predicate: SynModuleDecl -> range option) (scope: Scope) (decls: SynModuleDecls) =
  +            let groupConsecutiveDecls input =
  +                let rec loop (input: range list) (res: range list list) currentBulk =
  +                    match input, currentBulk with
  +                    | [], [] -> List.rev res
  +                    | [], _ -> List.rev (currentBulk::res)
  +                    | r :: rest, [] -> loop rest res [r]
  +                    | r :: rest, last :: _ when r.StartLine = last.EndLine + 1 ->
  +                        loop rest res (r::currentBulk)
  +                    | r :: rest, _ -> loop rest (currentBulk::res) [r]
  +                loop input [] []
  +
  +            let selectRanges (ranges: range list) =
  +                match ranges with
  +                | [] -> None
  +                | [r] when r.StartLine = r.EndLine -> None
  +                | [r] ->
  +                    let range = mkRange "" r.Start r.End
  +                    Some { Scope = scope; Collapse = Collapse.Same; Range = range ; CollapseRange = range }
  +                | lastRange :: rest ->
  +                    let firstRange = Seq.last rest
  +                    let range = mkRange "" firstRange.Start lastRange.End
  +                    Some { Scope = scope; Collapse = Collapse.Same; Range = range; CollapseRange = range }
  +
  +            decls 
  +            |> List.choose predicate 
  +            |> groupConsecutiveDecls 
  +            |> List.choose selectRanges
  +            |> acc.AddRange
  +
  +        let collectOpens = getConsecutiveModuleDecls (function SynModuleDecl.Open (_, r) -> Some r | _ -> None) Scope.Open
  +
  +        let collectHashDirectives =
  +             getConsecutiveModuleDecls(
  +                function
  +                | SynModuleDecl.HashDirective (ParsedHashDirective (directive, _, _),r) ->
  +                    let prefixLength = "#".Length + directive.Length + " ".Length
  +                    Some (mkRange "" (mkPos r.StartLine prefixLength) r.End)
  +                | _ -> None) Scope.HashDirective
  +
  +        let rec parseDeclaration (decl: SynModuleDecl) =
               match decl with
               | SynModuleDecl.Let (_,bindings,r) ->
                   for binding in bindings do
                       let collapse = Range.endToEnd binding.RangeOfBindingSansRhs r
  -                    yield! rcheck Scope.LetOrUse Collapse.Below r collapse
  -                yield! parseBindings bindings
  +                    rcheck Scope.LetOrUse Collapse.Below r collapse
  +                parseBindings bindings
               | SynModuleDecl.Types (types,_r) ->
                   for t in types do
  -                    yield! parseTypeDefn t
  +                    parseTypeDefn t
               // Fold the attributes above a module
               | SynModuleDecl.NestedModule (ComponentInfo (attrs,_,_,_,_,_,_,cmpRange),_, decls,_,_) ->                
                   // Outline the full scope of the module
                   let r = Range.endToEnd cmpRange decl.Range
  -                yield! rcheck Scope.Module Collapse.Below decl.Range r
  +                rcheck Scope.Module Collapse.Below decl.Range r
                   // A module's component info stores the ranges of its attributes
  -                yield! parseAttributes attrs
  -                yield! collectOpens decls
  -                yield! Seq.collect parseDeclaration decls
  +                parseAttributes attrs
  +                collectOpens decls
  +                List.iter parseDeclaration decls
               | SynModuleDecl.DoExpr (_,e,_) ->
  -                yield! parseExpr e
  +                parseExpr e
               | SynModuleDecl.Attributes (attrs,_) ->
  -                yield! parseAttributes attrs
  +                parseAttributes attrs
               | _ -> ()
  -        }
  -
  -    let parseModuleOrNamespace isScript (SynModuleOrNamespace (longId,_,isModule,decls,_,attribs,_,r)) =
  -        seq {
  -            yield! parseAttributes attribs
  +
  +        let parseModuleOrNamespace isScript (SynModuleOrNamespace (longId,_,isModule,decls,_,attribs,_,r)) =
  +            parseAttributes attribs
               let idRange = longIdentRange longId
               let fullrange = Range.startToEnd idRange r  
               let collapse = Range.endToEnd idRange r 
  -            
  +        
               // do not return range for top level implicit module in scripts
               if isModule && not isScript then
  -                yield! rcheck Scope.Module Collapse.Below fullrange collapse
  -
  -            yield! collectHashDirectives decls
  -            yield! collectOpens decls
  -            yield! Seq.collect parseDeclaration decls
  -        }
  -
  -    type LineNum = int
  -    type LineStr = string
  -    type CommentType = SingleLine | XmlDoc
  -
  -    [<NoComparison>]
  -    type CommentList =
  -        { Lines: ResizeArray<LineNum * LineStr>
  -          Type: CommentType }
  -        static member New ty lineStr =
  -            { Type = ty; Lines = ResizeArray [| lineStr |] }
  -
  -    /// Determine if a line is a single line or xml docummentation comment
  -    let (|Comment|_|) (line: string) =
  -        if line.StartsWith "///" then Some XmlDoc
  -        elif line.StartsWith "//" then Some SingleLine
  -        else None
  -
  -    let getCommentRanges (lines: string[]) =
  -        let rec loop ((lastLineNum, currentComment: CommentList option, result) as state) (lines: string list) lineNum =
  -            match lines with
  -            | [] -> state
  -            | lineStr :: rest ->
  -                match lineStr.TrimStart(), currentComment with
  -                | Comment commentType, Some comment ->
  -                    loop(
  -                        if comment.Type = commentType && lineNum = lastLineNum + 1 then
  -                            comment.Lines.Add (lineNum, lineStr)
  -                            lineNum, currentComment, result
  -                        else lineNum, Some (CommentList.New commentType (lineNum, lineStr)), comment :: result) rest (lineNum + 1)
  -                | Comment commentType, None ->
  -                    loop(lineNum, Some (CommentList.New commentType (lineNum, lineStr)), result) rest (lineNum + 1)
  -                | _, Some comment ->
  -                    loop(lineNum, None, comment :: result) rest (lineNum + 1)
  -                | _ -> loop(lineNum, None, result) rest (lineNum + 1)
  -
  -        let comments: CommentList list =
  -            loop (-1, None, []) (List.ofArray lines) 0
  -            |> fun (_, lastComment, comments) ->
  -                match lastComment with
  -                | Some comment ->
  -                    comment :: comments
  -                | _ -> comments
  -                |> List.rev
  -
  -        comments
  -        |> List.filter (fun comment -> comment.Lines.Count > 1)
  -        |> List.map (fun comment ->
  -            let lines = comment.Lines
  -            let startLine, startStr = lines.[0]
  -            let endLine, endStr = lines.[lines.Count - 1]
  -            let startCol = startStr.IndexOf '/'
  -            let endCol = endStr.TrimEnd().Length
  -
  -            let scopeType =
  -                match comment.Type with
  -                | SingleLine -> Scope.Comment
  -                | XmlDoc -> Scope.XmlDocComment
  -
  -            let range = mkRange "" (mkPos (startLine + 1) startCol) (mkPos (endLine + 1) endCol)
  -
  -            { Scope = scopeType
  -              Collapse = Collapse.Same
  -              Range = range
  -              CollapseRange = range })
  -
  -
  -      //=======================================//
  -     //     Signature File AST Traversal      //
  -    //=======================================//
  -
  -    (*
  -        The following helper functions are necessary due to a bug in the Parsed UAST within a 
  -        signature file that causes the scopes to extend past the end of the construct and overlap
  -        with the following construct. This necessitates inspecting the children of the construct and
  -        finding the end of the last child's range to use instead.
  -
  -        Detailed further in - https://github.com/Microsoft/visualfsharp/issues/2094
  -    *)
  -
  -    let lastMemberSigRangeElse r memberSigs =
  -        match memberSigs with
  -        | [] -> r
  -        | ls ->
  -            match List.last ls with
  -            | SynMemberSig.Inherit (range=r)
  -            | SynMemberSig.Interface (range=r)
  -            | SynMemberSig.Member (range=r)
  -            | SynMemberSig.NestedType (range=r)
  -            | SynMemberSig.ValField (range=r) -> r
  -
  -    let lastTypeDefnSigRangeElse range (typeSigs:SynTypeDefnSig list) =
  -        match typeSigs with
  -        | [] -> range
  -        | ls ->
  -            let (TypeDefnSig(_,_,memberSigs,r)) = List.last ls
  -            lastMemberSigRangeElse r memberSigs
  -
  -    let lastModuleSigDeclRangeElse range (sigDecls:SynModuleSigDecls) =
  -        match sigDecls with
  -        | [] -> range
  -        | ls -> match List.last ls with
  +                rcheck Scope.Module Collapse.Below fullrange collapse
  +
  +            collectHashDirectives decls
  +            collectOpens decls
  +            List.iter parseDeclaration decls
  +
  +        /// Determine if a line is a single line or xml docummentation comment
  +        let (|Comment|_|) (line: string) =
  +            if line.StartsWith "///" then Some XmlDoc
  +            elif line.StartsWith "//" then Some SingleLine
  +            else None
  +
  +        let getCommentRanges (lines: string[]) =
  +            let rec loop ((lastLineNum, currentComment: CommentList option, result) as state) (lines: string list) lineNum =
  +                match lines with
  +                | [] -> state
  +                | lineStr :: rest ->
  +                    match lineStr.TrimStart(), currentComment with
  +                    | Comment commentType, Some comment ->
  +                        loop(
  +                            if comment.Type = commentType && lineNum = lastLineNum + 1 then
  +                                comment.Lines.Add (lineNum, lineStr)
  +                                lineNum, currentComment, result
  +                            else lineNum, Some (CommentList.New commentType (lineNum, lineStr)), comment :: result) rest (lineNum + 1)
  +                    | Comment commentType, None ->
  +                        loop(lineNum, Some (CommentList.New commentType (lineNum, lineStr)), result) rest (lineNum + 1)
  +                    | _, Some comment ->
  +                        loop(lineNum, None, comment :: result) rest (lineNum + 1)
  +                    | _ -> loop(lineNum, None, result) rest (lineNum + 1)
  +
  +            let comments: CommentList list =
  +                loop (-1, None, []) (List.ofArray lines) 0
  +                |> fun (_, lastComment, comments) ->
  +                    match lastComment with
  +                    | Some comment ->
  +                        comment :: comments
  +                    | _ -> comments
  +                    |> List.rev
  +
  +            comments
  +            |> List.filter (fun comment -> comment.Lines.Count > 1)
  +            |> List.map (fun comment ->
  +                let lines = comment.Lines
  +                let startLine, startStr = lines.[0]
  +                let endLine, endStr = lines.[lines.Count - 1]
  +                let startCol = startStr.IndexOf '/'
  +                let endCol = endStr.TrimEnd().Length
  +
  +                let scopeType =
  +                    match comment.Type with
  +                    | SingleLine -> Scope.Comment
  +                    | XmlDoc -> Scope.XmlDocComment
  +
  +                let range = mkRange "" (mkPos (startLine + 1) startCol) (mkPos (endLine + 1) endCol)
  +
  +                { Scope = scopeType
  +                  Collapse = Collapse.Same
  +                  Range = range
  +                  CollapseRange = range })
  +            |> acc.AddRange
  +
  +
  +          //=======================================//
  +         //     Signature File AST Traversal      //
  +        //=======================================//
  +
  +        (*
  +            The following helper functions are necessary due to a bug in the Parsed UAST within a 
  +            signature file that causes the scopes to extend past the end of the construct and overlap
  +            with the following construct. This necessitates inspecting the children of the construct and
  +            finding the end of the last child's range to use instead.
  +
  +            Detailed further in - https://github.com/Microsoft/visualfsharp/issues/2094
  +        *)
  +
  +        let lastMemberSigRangeElse r memberSigs =
  +            match memberSigs with
  +            | [] -> r
  +            | ls ->
  +                match List.last ls with
  +                | SynMemberSig.Inherit (range=r)
  +                | SynMemberSig.Interface (range=r)
  +                | SynMemberSig.Member (range=r)
  +                | SynMemberSig.NestedType (range=r)
  +                | SynMemberSig.ValField (range=r) -> r
  +
  +        let lastTypeDefnSigRangeElse range (typeSigs:SynTypeDefnSig list) =
  +            match typeSigs with
  +            | [] -> range
  +            | ls ->
  +                let (TypeDefnSig(_,_,memberSigs,r)) = List.last ls
  +                lastMemberSigRangeElse r memberSigs
  +
  +        let lastModuleSigDeclRangeElse range (sigDecls:SynModuleSigDecls) =
  +            match sigDecls with
  +            | [] -> range
  +            | ls -> 
  +                match List.last ls with
                   | SynModuleSigDecl.Types (typeSigs,r) -> lastTypeDefnSigRangeElse r typeSigs
                   | SynModuleSigDecl.Val (ValSpfn(range=r),_) -> r
                   | SynModuleSigDecl.Exception(_,r) -> r
  -                | SynModuleSigDecl.Open(_,r)-> r
  -                | SynModuleSigDecl.ModuleAbbrev(_,_,r)-> r
  +                | SynModuleSigDecl.Open(_,r) -> r
  +                | SynModuleSigDecl.ModuleAbbrev(_,_,r) -> r
                   | _ -> range
   
  -
  -    let rec parseSynMemberDefnSig (dsig:SynMemberSig) =
  -        seq {
  -            match dsig with
  -            | SynMemberSig.Member(valSigs,_flags,r) ->
  +        let rec parseSynMemberDefnSig = function
  +            | SynMemberSig.Member(valSigs,_,r) ->
                   let collapse = Range.endToEnd valSigs.RangeOfId r
  -                yield! rcheck Scope.Member Collapse.Below r collapse
  -            | SynMemberSig.ValField(Field(attrs,_a,_b,_c,_d,_e,_,fr),fullrange) ->
  +                rcheck Scope.Member Collapse.Below r collapse
  +            | SynMemberSig.ValField(Field(attrs,_,_,_,_,_,_,fr),fullrange) ->
                   let collapse = Range.endToEnd fr fullrange
  -                yield! rcheck Scope.Val Collapse.Below fullrange collapse
  -                yield! parseAttributes attrs
  +                rcheck Scope.Val Collapse.Below fullrange collapse
  +                parseAttributes attrs
               | SynMemberSig.Interface(tp,r) ->
  -                yield! rcheck Scope.Interface Collapse.Below r <| Range.endToEnd tp.Range r
  +                rcheck Scope.Interface Collapse.Below r (Range.endToEnd tp.Range r)
               | SynMemberSig.NestedType (typeDefSig, _r) ->
  -                yield! parseTypeDefnSig typeDefSig
  +                parseTypeDefnSig typeDefSig
               | _ -> ()
  -        }
  -
  -    and parseTypeDefnSig
  -      (TypeDefnSig (ComponentInfo(attribs,typeArgs,_constraints,longId,_doc,_b,_access,r)
  -                as _componentInfo, objectModel,  memberSigs, _)) = seq {
  -            yield! parseAttributes attribs
  +
  +        and parseTypeDefnSig (TypeDefnSig (ComponentInfo(attribs,typeArgs,_,longId,_,_,_,r) as __, objectModel, memberSigs, _)) = 
  +            parseAttributes attribs
   
               let makeRanges memberSigs =
                   let typeArgsRange = rangeOfTypeArgsElse r typeArgs
  
positive.code:         | ls ->
              ls 
              |> List.map (fun x ->
                      match x with
                      | SynSimplePat.Attrib(range = r)
                      | SynSimplePat.Id(range = r)
                      | SynSimplePat.Typed(range = r) -> r)
              |> List.reduce Range.unionRanges
  
  
      /// Collapse indicates the way a range/snapshot should be collapsed. `Same` is for a scope inside
      /// some kind of scope delimiter, e.g. `[| ... |]`, `[ ... ]`, `{ ... }`, etc.  `Below` is for expressions
  
negative.code:         | UnionDefn
          | Comment
          | XmlDocComment
          override self.ToString() = 
              match self with
              | Open                -> "Open"
              | Namespace           -> "Namespace"
              | Module              -> "Module"
              | Type                -> "Type"
              | Member              -> "Member"
              | LetOrUse            -> "LetOrUse"
              | Val                 -> "Val"
              | CompExpr            -> "CompExpr"
              | IfThenElse          -> "IfThenElse"
              | ThenInIfThenElse    -> "ThenInIfThenElse"
              | ElseInIfThenElse    -> "ElseInIfThenElse"
              | TryWith             -> "TryWith"
              | TryInTryWith        -> "TryInTryWith"
              | WithInTryWith       -> "WithInTryWith"
              | TryFinally          -> "TryFinally"
              | TryInTryFinally     -> "TryInTryFinally"
              | FinallyInTryFinally -> "FinallyInTryFinally"
              | ArrayOrList         -> "ArrayOrList"
              | ObjExpr             -> "ObjExpr"
              | For                 -> "For"
              | While               -> "While"
              | Match               -> "Match"
              | MatchLambda         -> "MatchLambda"
              | MatchClause         -> "MatchClause"
              | Lambda              -> "Lambda"
              | CompExprInternal    -> "CompExprInternal"
              | Quote               -> "Quote"
              | Record              -> "Record"
              | SpecialFunc         -> "SpecialFunc"
              | Do                  -> "Do"
              | New                 -> "New"
              | Attribute           -> "Attribute"
              | Interface           -> "Interface"
              | HashDirective       -> "HashDirective"
              | LetOrUseBang        -> "LetOrUseBang"
              | TypeExtension       -> "TypeExtension"
              | YieldOrReturn       -> "YieldOrReturn"
              | YieldOrReturnBang   -> "YieldOrReturnBang"
              | Tuple               -> "Tuple"
              | UnionCase           -> "UnionCase"
              | EnumCase            -> "EnumCase"
              | RecordField         -> "RecordField"
              | RecordDefn          -> "RecordDefn"
              | UnionDefn           -> "UnionDefn"
              | Comment             -> "Comment"
              | XmlDocComment       -> "XmlDocComment"
  
      /// Stores the range for a construct, the sub-range that should be collapsed for outlinging,
      /// a tag for the construct type, and a tag for the collapse style
      [<NoComparison>]
      type ScopeRange = 
          { Scope: Scope
            Collapse: Collapse
            /// HintSpan in BlockSpan
            Range: range
            /// TextSpan in BlockSpan
            CollapseRange: range }
  
      type LineNumber = int
      type LineStr = string
      type CommentType = SingleLine | XmlDoc
  
      [<NoComparison>]
      type CommentList =
          { Lines: ResizeArray<LineNumber * LineStr>
            Type: CommentType }
          static member New ty lineStr =
              { Type = ty
                Lines = ResizeArray [lineStr] }
  
      /// Returns outlining ranges for given parsed input.                
      let getOutliningRanges (sourceLines: string[]) (parsedInput: ParsedInput) =
          let acc = ResizeArray()
  
          /// Validation function to ensure that ranges yielded for outlinging span 2 or more lines
          let inline rcheck scope collapse (fullRange: range) (collapseRange: range) = 
              if fullRange.StartLine <> fullRange.EndLine then 
                  acc.Add { Scope = scope
                            Collapse = collapse
                            Range = fullRange
                            CollapseRange = collapseRange }
  
            //============================================//
           //     Implementation File AST Traversal      //
          //============================================//
  
          let rec parseExpr expression =
              match expression with
              | SynExpr.Upcast (e,_,_)
              | SynExpr.Downcast (e,_,_)
  