lyuts / vim-rtags

Vim bindings for rtags, llvm/clang based c++ code indexer.
BSD 2-Clause "Simplified" License
282 stars 56 forks source link

Symbol info command works only in sync mode #102

Open marxin opened 6 years ago

marxin commented 6 years ago

With my recent VIM:

vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12)

The symbol info command runs, I can verify that in rdm.log file. I can also verify that rtags#SymbolInfoHandler is called. However the editor blinks and not info is displayed. On the other hand, setting:

s:rtagsAsync = 0

works for me.

marxin commented 6 years ago

First bad revision: c6dcdd4f67484f3e1e94a06a2f56012449fd5528

marxin commented 6 years ago

And it works fine in NeoVim.

bartlibert commented 6 years ago

The same issue is also present when using ProjectList

mckellyln commented 6 years ago

For ProjectList I did this -

function! rtags#ProjectList()
    "call rtags#ExecuteThen({ '-w' : '' }, [function('rtags#ProjectListHandler')])
    let result = rtags#ExecuteRC({ '-w' : '' })
    call rtags#ExecuteHandlers(result, [function('rtags#ProjectListHandler')])
endfunction

until I or someone else can figure out the problem with the channel output

ziegfeld commented 6 years ago

like what mckellyln said, change SymboInfo() in rtags.vim to the below will work

function! rtags#SymbolInfo()
    "call rtags#ExecuteThen({ '-U' : rtags#getCurrentLocation() }, [function('rtags#SymbolInfoHandler')])
    let result = rtags#ExecuteRC({ '-U' : rtags#getCurrentLocation() })
    call rtags#ExecuteHandlers(result, [function('rtags#SymbolInfoHandler')])
endfunction
Barricade commented 4 years ago

Any update on this?

mckellyln commented 4 years ago

Hi. I'll go figure it out. I used the synchronous method long ago and left it that way, but I did make some changes to the async code for other reasons and will re-visit this.

mckellyln commented 4 years ago

I found two issues, 1). the vim job handler did not always get all data, especially if the cmd ended quickly. And 2). the output from the async handler has ^@ (NUL) at the end of each line in the list and the join() then does not echo multiple lines correctly. I fixed these things in my branch, but I also made other changes/improvements. I test with vim thoroughly but not yet with neovim so I need to do that. For now, I would just change the two lines in your copy of the plugin to use sync call for this function as shown above.