How can i make coc.nvim check code's semantics in insert mode?

1.2k views Asked by At

So I'm using neovim(v0.4.3) and Coc.nvim(v0.0.79) and clangd with C++ and C . The problem is that the syntax checking highlights errors only in normal mode. meaning that i have to type my statements in insert mode and then go to normal to see if i have any errors. and i want to be able to see my errors while im in insert mode. So i am wondering if this only happens to me or this is a common thing. and if there are any fixes to this please let me know. here i included some lines of my init.vim

syntax on "to highlight more
set noeb vb t_vb= "to remove the annoying sound
set tabstop=4 softtabstop=4 "make tab 4 spaces instead of 8
set shiftwidth=4 "so when << or >> are pressed it shifts by 4
set smartindent " better indentation
set nowrap "line continues on the screen independant of the width
set nu rnu "line numbers and relative numbers
set noswapfile
set nobackup
set undodir=~/.vim/undodir
set undofile
set incsearch "search when typing
set cursorline "cursor line highlighted
set clipboard=unnamedplus "so yanking goes to the clipboard
"set completeopt-=preview "stops ycm from showing the preview
let mapleader =" "
"opens terminal

call plug#begin('~/.vim/plugged')
Plug 'sirver/ultisnips'
Plug 'mbbill/undotree'
Plug '907th/vim-auto-save'
Plug 'jiangmiao/auto-pairs'
Plug 'preservim/nerdcommenter'
Plug 'preservim/nerdtree'
Plug 'romgrk/winteract.vim'
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
Plug 'vim-airline/vim-airline' "requires installing powerline fonts found in github
Plug 'vim-airline/vim-airline-themes'
Plug 'ryanoasis/vim-devicons'
Plug 'Chiel92/vim-autoformat'
Plug 'hlissner/vim-multiedit'
Plug 'tpope/vim-surround'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'masukomi/vim-markdown-folding'
Plug 'tpope/vim-markdown' "to highlight fenced code in md
Plug 'kalekundert/vim-coiled-snake'
Plug 'Konfekt/FastFold'
call plug#end()

let g:airline#extensions#tabline#enabled = 1
let g:auto_save=1 "autosave

Thank you for reading this, i hope you have a great day

1

There are 1 answers

0
fannheyward On BEST ANSWER

Set diagnostic.refreshOnInsertMode to true in your coc-settings.json.