Exemplo n.º 1
0
def CompletionStartColumn():
    """Returns the 0-based index where the completion string should start. So if
  the user enters:
    foo.bar^
  with the cursor being at the location of the caret, then the starting column
  would be the index of the letter 'b'.
  """

    line = vim.current.line
    start_column = vimsupport.CurrentColumn()

    while start_column > 0 and utils.IsIdentifierChar(line[start_column - 1]):
        start_column -= 1
    return start_column
Exemplo n.º 2
0
def CurrentIdentifierFinished():
    current_column = vimsupport.CurrentColumn()
    previous_char_index = current_column - 1
    if previous_char_index < 0:
        return True
    line = vim.current.line
    try:
        previous_char = line[previous_char_index]
    except IndexError:
        return False

    if utils.IsIdentifierChar(previous_char):
        return False

    if (not utils.IsIdentifierChar(previous_char) and previous_char_index > 0
            and utils.IsIdentifierChar(line[previous_char_index - 1])):
        return True
    else:
        return line[:current_column].isspace()
Exemplo n.º 3
0
 def QueryLengthAboveMinThreshold(self, start_column):
     query_length = vimsupport.CurrentColumn() - start_column
     return query_length >= MIN_NUM_CHARS
Exemplo n.º 4
0
 def ShouldUseNow(self, start_column):
     query_length = vimsupport.CurrentColumn() - start_column
     return query_length >= MIN_NUM_CHARS