 
   findEndTag: (tagName, startPosition) ->
     scanRange = new Range(startPosition, @editor.buffer.getEndPosition())
+    pattern = @patternForTagName(tagName)
     endRange = null
     unpairedCount = 0
-    @editor.scanInBufferRange @getTagPattern(tagName), scanRange, ({match, range, stop}) =>
+    @editor.scanInBufferRange pattern, scanRange, ({match, range, stop}) =>
       return if @isRangeCommented(range)
 
       if match[1]

    @tagSelector = new ScopeSelector('meta.tag | punctuation.definition.tag')
    @commentSelector = new ScopeSelector('comment.*')

  getTagPattern: (tagName) ->
    new RegExp("(<#{tagName}([\\s>]|$))|(</#{tagName}>)", 'gi')

  isRangeCommented: (range) ->


  findStartTag: (tagName, endPosition) ->
    scanRange = new Range([0, 0], endPosition)
    pattern = @patternForTagName(tagName)
    startRange = null
    unpairedCount = 0
    @editor.backwardsScanInBufferRange pattern, scanRange, ({match, range, stop}) =>
      return if @isRangeCommented(range)

      if match[1]
