diff --git a/autoload/build.vim b/autoload/build.vim index cbc4ff6..afb97ee 100644 --- a/autoload/build.vim +++ b/autoload/build.vim @@ -37,8 +37,11 @@ function! build#dir(...) abort if exists('l:dir') " Set build directory and restart YouCompleteMe. let $BUILD_DIR = getcwd().'/'.substitute(l:dir, '\/$', '', '') - let g:ycm_clangd_args = ['--compile-commands-dir='.$BUILD_DIR] - YcmRestartServer + " TODO: Check .vim/coc-settings.json exists, create it if not + let l:coc_settings = json_decode(join(readfile('.vim/coc-settings.json'), '')) + let l:coc_settings['clangd.compilationDatabasePath'] = $BUILD_DIR + call writefile([json_encode(l:coc_settings)], '.vim/coc-settings.json') + CocRestart endif endfunction