def suggest_type(full_text, text_before_cursor):
 if full_text.startswith('\\i '):
  return (Path(),)
 try:
  stmt = SqlStatement(full_text, text_before_cursor)
 except (TypeError, AttributeError):
  return []
 if stmt.parsed:
  tok1 = stmt.parsed.token_first()
  if (tok1 and (tok1.value == '\\')):
   text = (stmt.text_before_cursor + stmt.word_before_cursor)
   return suggest_special(text)
 return suggest_based_on_last_token(stmt.last_token, stmt)

def suggest_type ( full_text , text_before_cursor ) : if full_text . startswith ( '\\i ' ) : return ( Path ( ) , ) try : stmt = SqlStatement ( full_text , text_before_cursor ) except ( TypeError , AttributeError ) : return [ ] if stmt . parsed : tok1 = stmt . parsed . token_first ( ) if ( tok1 and ( tok1 . value == '\\' ) ) : text = ( stmt . text_before_cursor + stmt . word_before_cursor ) return suggest_special ( text ) return suggest_based_on_last_token ( stmt . last_token , stmt )
takes the full_text that is typed so far and also the text before the cursor to suggest completion type and scope .