Ejemplo n.º 1
0
def LastEnteredCharIsIdentifierChar():
    current_column = vimsupport.CurrentColumn()
    if current_column - 1 < 0:
        return False
    line = vimsupport.CurrentLineContents()
    filetype = vimsupport.CurrentFiletypes()[0]
    return (identifier_utils.StartOfLongestIdentifierEndingAtIndex(
        line, current_column, filetype) != current_column)
Ejemplo n.º 2
0
def LastEnteredCharIsIdentifierChar():
    current_column = vimsupport.CurrentColumn()
    previous_char_index = current_column - 1
    if previous_char_index < 0:
        return False
    line = vim.current.line
    try:
        previous_char = line[previous_char_index]
    except IndexError:
        return False

    return utils.IsIdentifierChar(previous_char)
Ejemplo n.º 3
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
Ejemplo n.º 4
0
def CurrentIdentifierFinished():
  current_column = vimsupport.CurrentColumn()
  previous_char_index = current_column - 1
  if previous_char_index < 0:
    return True
  line = vimsupport.CurrentLineContents()
  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()
Ejemplo n.º 5
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()
Ejemplo n.º 6
0
 def Omnifunc(findstart, base):
     if findstart:
         return 5
     if vimsupport.CurrentColumn() == 5:
         return ['length']
     return []
Ejemplo n.º 7
0
def CompletionStartColumn():
  return ( request_wrap.CompletionStartColumn(
      vimsupport.CurrentLineContents(),
      vimsupport.CurrentColumn() + 1,
      vimsupport.CurrentFiletypes()[ 0 ] ) - 1 )
Ejemplo n.º 8
0
def CompletionStartColumn():
    return (
        request_wrap.CompletionStartColumn(vim.current.line,
                                           vimsupport.CurrentColumn() + 1) - 1)
Ejemplo n.º 9
0
 def QueryLengthAboveMinThreshold(self, start_column):
     query_length = vimsupport.CurrentColumn() - start_column
     return query_length >= MIN_NUM_CHARS