Пример #1
0
def GetUnsavedAndCurrentBufferData_EncodedUnicodeCharsInBuffers_test( *args ):
  mock_buffer = MagicMock()
  mock_buffer.name = os.path.realpath( 'filename' )
  mock_buffer.number = 1
  mock_buffer.__iter__.return_value = [ u'abc', ToBytes( u'fДa' ) ]

  with patch( 'vim.buffers', [ mock_buffer ] ):
    assert_that( vimsupport.GetUnsavedAndCurrentBufferData(),
                 has_entry( mock_buffer.name,
                            has_entry( u'contents', u'abc\nfДa\n' ) ) )
Пример #2
0
def BuildRequestData(include_buffer_data=True):
    line, column = vimsupport.LastTriggerLineAndColumn()
    filepath = vimsupport.GetCurrentBufferFilepath()
    request_data = {
        'line_num': line + 1,
        'column_num': column + 1,
        'filepath': filepath
    }

    if include_buffer_data:
        request_data['file_data'] = vimsupport.GetUnsavedAndCurrentBufferData()

    return request_data
Пример #3
0
def BuildRequestData(start_column=None, query=None, include_buffer_data=True):
    line, column = vimsupport.CurrentLineAndColumn()
    filepath = vimsupport.GetCurrentBufferFilepath()
    request_data = {
        'filetypes': vimsupport.CurrentFiletypes(),
        'line_num': line,
        'column_num': column,
        'start_column': start_column,
        'line_value': vim.current.line,
        'filepath': filepath
    }

    if include_buffer_data:
        request_data['file_data'] = vimsupport.GetUnsavedAndCurrentBufferData()
    if query:
        request_data['query'] = query

    return request_data