Update build#dir() to configure coc-clangd
This commit is contained in:
		
							parent
							
								
									ff20ba6bd2
								
							
						
					
					
						commit
						61b877286b
					
				@ -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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user