 
   getRange: (selection) ->
     pattern = @getPattern(selection)
+    return unless pattern
+
     from = swrap(selection).getNormalizedBufferPosition()
     options = containedOnly: true
     start = getStartPositionForPattern(@editor, from, pattern, options)


class InnerSmartWord extends SmartWord
  @description: "Currently No diff from `a-smart-word`"
  @extend()

# -------------------------

class AFunctionOrInnerParagraph extends UnionTextObject
  @extend()
  member: ['AFunction', 'InnerParagraph']

class SomeTextObject extends TextObject
  @extend(false)
  member: []
  memberOptoins: {}

  getRangeBy: (klass, selection) ->
    @new(klass, @memberOptoins).getRange(selection)

  getRanges: (selection) ->
    (range for klass in @member when (range = @getRangeBy(klass, selection)))

  getNearestRange: (selection) ->
    ranges = @getRanges(selection)
    _.last(sortRanges(ranges)) if ranges.length

  selectTextObject: (selection) ->
    swrap(selection).setBufferRangeSafely @getNearestRange(selection)

class InnerNonEmptySmartWordOrInnerParenthesis extends SomeTextObject
  @extend()
  member: [
    "InnerNonEmptySmartWord"
    "InnerParenthesis"
  ]
