lyuts / vim-rtags

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

using rtags#ExecuteRCAsync print error when the symbol not indexed #105

Open pangchol opened 6 years ago

pangchol commented 6 years ago

I am using vim8 when 'job' and 'channel' feature work, so the vim-rtags will use rtags#ExecuteRCAsync when call rtags#JumpTo. but I find it print error when the jump symbol is not indexed. after test I find it is beacuse rtags#JumpToHandler function do not right handle when the async job return ["Not indexed"]. after I change the "elseif len(results) == 1" condition to elseif len(results) == 1 && results[0] != "Not indexed" the error print disappear. I think it is needed to fixed this little problam.

mckellyln commented 6 years ago

Thanks. I have added similar things to my fork such as:

 function! rtags#DisplayLocations(locations)
     let num_of_locations = len(a:locations)
+    if num_of_locations == 0
+        echohl | echomsg "[vim-rtags] No info returned" | echohl None
+        return
+    endif

 function! rtags#FindSymbols(pattern)
+    if empty(a:pattern)
+        echo "<empty input>"
+        return
+    endif

And also when starting funcs such as FindSymbols, I echo a msg about the cmd started and then clear it when the cmd completes so I can tell it is running still and waiting for results.