Skip to content

YcmCompleter FixIt, Move function body out-of-line ErrorΒ #4305

@djmallum

Description

@djmallum

Calling YcmCompleter FixIt on a function with a definition in a header file fails with the error below is there isn't space at the end of the .cpp file does not have space. If I open the .cpp file and add two blank lines and try again, it is successful. It doesn't work with only one blank line.

I've edited the error to be more or less anonymous, since it included file paths. I use Plugged even though the main instructions say to use vundle (only because I was previously using Plugged).

Error:

1: Move function body to out-of-line
Type number and <Enter> or click with the mouse (q or empty cancels): Error detected while processing function <SNR>68_CompleterCommand:
line    1:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/path-to-file/plugged/YouCompleteMe/python/ycm/youcompleteme.py", line 472, in SendCommandRequest
    return SendCommandRequest(
      final_arguments,
      modifiers,
      self._user_options[ 'goto_buffer_command' ],
      extra_data )
  File "/path-to-file/plugged/YouCompleteMe/python/ycm/client/command_request.py", line 241, in SendCommandRequest
    request.RunPostCommandActionsIfNeeded( modifiers, buffer_command )
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path-to-file/plugged/YouCompleteMe/python/ycm/client/command_request.py", line 99, in RunPostCommandActionsIfNeeded
    return self._HandleFixitResponse()
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/path-to-file/plugged/YouCompleteMe/python/ycm/client/command_request.py", line 198, in _HandleFixitResponse
    vimsupport.ReplaceChunks(
    ~~~~~~~~~~~~~~~~~~~~~~~~^
      chosen_fixit[ 'chunks' ],
      ^^^^^^^^^^^^^^^^^^^^^^^^^
      silent = self._command == 'Format' )
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path-to-file/plugged/YouCompleteMe/python/ycm/vimsupport.py", line 1042, in ReplaceChunks
    locations.extend( ReplaceChunksInBuffer( chunks_by_file[ filepath ],
                      ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                             vim.buffers[ buffer_num ] ) )
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path-to-file/plugged/YouCompleteMe/python/ycm/vimsupport.py", line 1087, in ReplaceChunksInBuffer
    return reversed( [ ReplaceChunk( chunk[ 'range' ][ 'start' ],
                       ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                     chunk[ 'range' ][ 'end' ],
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
                                     chunk[ 'replacement_text' ],
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                     vim_buffer )
                                     ^^^^^^^^^^^^
  File "/path-to-file/plugged/YouCompleteMe/python/ycm/vimsupport.py", line 1144, in ReplaceChunk
    start_existing_text = ToBytes( vim_buffer[ start_line ] )[ : start_column ]
                                   ~~~~~~~~~~^^^^^^^^^^^^^^
IndexError: line number out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions