jalcine / cmake.vim

:hammer: CMake functionality within Vim.
https://jalcine.github.io/cmake.vim
MIT License
74 stars 11 forks source link

Failure to Detect YouCompleteMe #28

Closed bchretien closed 9 years ago

bchretien commented 10 years ago

I removed YCM recently, and I get the following errors when entering a C++ file:

Error detected while processing function cmake#augroup#on_file_type..<SNR>55_render_for_cpp..cm
ake#flags#inject..cmake#flags#inject_to_ycm:
line    1:
E716: Key not present in Dictionary: ycm == 0
E15: Invalid expression: g:cmake_inject_flags.ycm == 0
line   11:
E121: Undefined variable: g:ycm_extra_conf_vim_data
E116: Invalid arguments for function index(g:ycm_extra_conf_vim_data, flag) == -1 && exists(fla
g)
E15: Invalid expression: index(g:ycm_extra_conf_vim_data, flag) == -1 && exists(flag)
E121: Undefined variable: g:ycm_extra_conf_vim_data
E116: Invalid arguments for function index(g:ycm_extra_conf_vim_data, flag) == -1 && exists(fla
g)
E15: Invalid expression: index(g:ycm_extra_conf_vim_data, flag) == -1 && exists(flag)
E121: Undefined variable: g:ycm_extra_conf_vim_data
E116: Invalid arguments for function index(g:ycm_extra_conf_vim_data, flag) == -1 && exists(fla
g)
E15: Invalid expression: index(g:ycm_extra_conf_vim_data, flag) == -1 && exists(flag)
Error detected while processing function cmake#augroup#on_file_type..<SNR>55_render_for_cpp..cm
ake#flags#inject..cmake#flags#inject_to_syntastic:
line    1:
E716: Key not present in Dictionary: syntastic != 1 | return | endif
E15: Invalid expression: g:cmake_inject_flags.syntastic != 1 | return | endif
line    6:
E171: Missing :endif
Error detected while processing function cmake#augroup#on_file_type:
line    5:
-- More --

I guess you could test cmake.vim without YCM installed to track those errors.

jalcine commented 10 years ago

Gotcha, working on this now.

jalcine commented 10 years ago

Very simple fix, imho. Just checking if g:ycm_extra_conf_vim_data exists.

jalcine commented 10 years ago

Lemme know how it works for you.

bchretien commented 10 years ago

Thanks for looking into it ;-)

Now I have:

function cmake#augroup#on_file_type..<SNR>59_render_for_cpp..cmake#flags#inject..cmake#flags#inject_to_syntastic, line 1                                                                       
Vim(if):E716: Key not present in Dictionary: syntastic != 1 | return | endif                                                                                                                   
Error occured while executing "open" action!

Apparently, g:cmake_inject_flags = {}, which could probably explain the previous YCM error as well. I checked some of the other variables that appear in set_options, and some are not the default ones (e.g. gcc/g++ for the compilers, RelWithDebInfo for the build type, which could have been set from a pre-existing build directory I presume).

jalcine commented 10 years ago

Right, those are meant to be redefined with one's preferences. But in the event one would want to reconfigure an existing build directory from scratch, like deleting build then recreating build, I'd see why you'd want something like that.

Running cmake with extra configuration variables is a little broken in the plugin (still working on this for a 0.5.0 release) but it sounds like that would help.

jalcine commented 10 years ago

But g:cmake_inject_flags should never be empty.

jalcine commented 9 years ago

Version 0.5.0 should fix these issues. Re-open if you get more issues, thanks!