     editor.bufferRangeForBufferRow(row, includeNewline: true)
   rangeStart.union(rangeEnd)
 
-getScopesForBufferRow = (editor, row) ->
-  tokenizedLines = editor.displayBuffer.getTokenizedLines()
+getTokenizedLines = (editor) ->
+  editor.displayBuffer.getTokenizedLines()
+
+getScopesForTokenizedLine = (line) ->
+  for tag in line.tags when tag < 0 and (tag % 2 is -1)
+    atom.grammars.scopeForId(tag)
+
+isIncludeFunctionScopeForRow = (editor, row) ->
   # [FIXME] Bug of upstream?
   # Sometime tokenizedLines length is less than last buffer row.
   # So tokenizedLine is not accessible even if valid row.
   # In that case I simply return empty Array.
-  return [] unless tokenizedLine = tokenizedLines[row]
-
-  for tag in tokenizedLine.tags when tag < 0 and (tag % 2 is -1)
-    atom.grammars.scopeForId(tag)
+  if tokenizedLine = getTokenizedLines(editor)[row]
+    getScopesForTokenizedLine(tokenizedLine).some (scope) ->
+      isFunctionScope(editor, scope)
+  else
+    false
 
 # [FIXME] very rough state, need improvement.
 isFunctionScope = (editor, scope) ->

  getBufferRangeForRowRange
  getFirstCharacterColumForBufferRow
  cursorIsAtFirstCharacter
  getScopesForBufferRow
  isFunctionScope
  isIncludeFunctionScopeForRow


      /^entity\.name\.function/.test(scope)
    else
      /^meta\.function\./.test(scope)

# Debugging purpose
# -------------------------
