def PreviousIdentifierOnLine(line, column, filetype):
     nearest_ident = ''
     for match in identifier_utils.IdentifierRegexForFiletype(
             filetype).finditer(line):
         if match.end() <= column:
             nearest_ident = match.group()
     return nearest_ident
Esempio n. 2
0
def CurrentIdentifierFinished():
    line, current_column = vimsupport.CurrentLineContentsAndCodepointColumn()
    previous_char_index = current_column - 1
    if previous_char_index < 0:
        return True
    filetype = vimsupport.CurrentFiletypes()[0]
    regex = identifier_utils.IdentifierRegexForFiletype(filetype)

    for match in regex.finditer(line):
        if match.end() == previous_char_index:
            return True
    # If the whole line is whitespace, that means the user probably finished an
    # identifier on the previous line.
    return line[:current_column].isspace()