From 42c2d377342266f35d22e8d81ebce2da0b3eeb83 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 6 Jan 2020 16:16:24 +0200 Subject: [PATCH] [nvim] fix coc#status error/warning signs --- nvim/coc-languages/c.vim | 8 ++++---- nvim/coc-languages/css.vim | 2 +- nvim/coc-languages/haskell.vim | 4 ++-- nvim/coc-languages/html.vim | 4 ++-- nvim/coc-languages/javascript.vim | 10 +++++----- nvim/coc-languages/json.vim | 2 +- nvim/coc-languages/python.vim | 8 ++++---- nvim/coc-languages/rust.vim | 4 ++-- nvim/plugin/completion.vim | 9 ++++++--- nvim/plugin/interface.vim | 2 +- 10 files changed, 28 insertions(+), 25 deletions(-) diff --git a/nvim/coc-languages/c.vim b/nvim/coc-languages/c.vim index 50d02bc..dab445e 100644 --- a/nvim/coc-languages/c.vim +++ b/nvim/coc-languages/c.vim @@ -1,7 +1,7 @@ let s:filetypes = ['c', 'cpp', 'objc', 'objcpp'] let g:coc_filetypes += s:filetypes -call coc#config('languageserver.ccls', { +let g:coc_user_config['languageserver.ccls'] = { \ 'filetypes': s:filetypes, \ 'command': 'ccls', \ 'rootPatterns': ['.ccls', 'compile_commands.json', '.vim/', '.git/', '.hg/'], @@ -10,10 +10,10 @@ call coc#config('languageserver.ccls', { \ 'directory': '/tmp/ccls', \ }, \ }, -\ }) +\ } -" call coc#config('languageserver.clangd', { +" let g:coc_user_config['languageserver.clangd'] = { " \ 'filetypes': s:filetypes, " \ 'command': 'clangd', " \ 'rootPatterns': ['compile_flags.txt', 'compile_commands.json', '.vim/', '.git/', '.hg/'], -" \ }) +" \ } diff --git a/nvim/coc-languages/css.vim b/nvim/coc-languages/css.vim index 0b322e5..aedd28e 100644 --- a/nvim/coc-languages/css.vim +++ b/nvim/coc-languages/css.vim @@ -1,2 +1,2 @@ -call coc#add_extension('coc-css') +let g:coc_global_extensions += ['coc-css'] let g:coc_filetypes += ['css', 'scss', 'less'] diff --git a/nvim/coc-languages/haskell.vim b/nvim/coc-languages/haskell.vim index fdafd7f..a80de3e 100644 --- a/nvim/coc-languages/haskell.vim +++ b/nvim/coc-languages/haskell.vim @@ -1,8 +1,8 @@ let s:filetypes = ['haskell', 'lhaskell', 'chaskell'] let g:coc_filetypes += s:filetypes -call coc#config('languageserver.haskell', { +let g:coc_user_config['languageserver.haskell'] = { \ 'filetypes': s:filetypes, \ 'command': 'hie-wrapper', \ 'rootPatterns': ['.stack.yaml', 'cabal.config', 'package.yaml'], \ 'initializationOptions': {}, -\ }) +\ } diff --git a/nvim/coc-languages/html.vim b/nvim/coc-languages/html.vim index 5880168..700fbf4 100644 --- a/nvim/coc-languages/html.vim +++ b/nvim/coc-languages/html.vim @@ -1,4 +1,4 @@ -call coc#add_extension('coc-html', 'coc-emmet') +let g:coc_global_extensions += ['coc-html', 'coc-emmet'] let s:emmet_filetype_mapping = { 'jinja': 'html' } let g:coc_filetypes += ['html'] + keys(s:emmet_filetype_mapping) -call coc#config('emmet.includeLanguages', s:emmet_filetype_mapping) +let g:coc_user_config['emmet.includeLanguages'] = s:emmet_filetype_mapping diff --git a/nvim/coc-languages/javascript.vim b/nvim/coc-languages/javascript.vim index ceed679..f5c88e9 100644 --- a/nvim/coc-languages/javascript.vim +++ b/nvim/coc-languages/javascript.vim @@ -1,13 +1,13 @@ -call coc#add_extension('coc-tsserver', 'coc-eslint', 'coc-prettier') +let g:coc_global_extensions += ['coc-tsserver', 'coc-eslint', 'coc-prettier'] let g:coc_filetypes += ['javascript', 'javascript.jsx', 'typescript', 'typescript.jsx'] -call coc#config('eslint', { +let g:coc_user_config['eslint'] = { \ 'filetypes': ['javascript', 'javascriptreact'], \ 'autoFixOnSave': v:true, -\ }) -call coc#config('prettier', { +\ } +let g:coc_user_config['prettier'] = { \ 'singleQuote': v:true, \ 'trailingComma': 'all', \ 'jsxBracketSameLine': v:true, \ 'eslintIntegration': v:true, \ 'disableSuccessMessage': v:true -\ }) +\ } diff --git a/nvim/coc-languages/json.vim b/nvim/coc-languages/json.vim index 277ca25..d875e3c 100644 --- a/nvim/coc-languages/json.vim +++ b/nvim/coc-languages/json.vim @@ -1,2 +1,2 @@ -call coc#add_extension('coc-json') +let g:coc_global_extensions += ['coc-json'] let g:coc_filetypes += ['json', 'json5'] diff --git a/nvim/coc-languages/python.vim b/nvim/coc-languages/python.vim index 371e1d9..25d9663 100644 --- a/nvim/coc-languages/python.vim +++ b/nvim/coc-languages/python.vim @@ -1,7 +1,7 @@ -call coc#add_extension('coc-python') +let g:coc_global_extensions += ['coc-python'] let g:coc_filetypes += ['python'] -call coc#config('pyls.plugins.pycodestyle.ignore', ['E501']) -call coc#config('python', { +let g:coc_user_config['pyls.plugins.pycodestyle.ignore'] = ['E501'] +let g:coc_user_config['python'] = { \ 'autocomplete': { 'showAdvancedMembers': v:false }, \ 'formatting': { 'provider': 'black' }, \ 'linting': { @@ -9,4 +9,4 @@ call coc#config('python', { \ 'flake8Enabled': v:true, \ 'flake8Args': ['--ignore', 'E501'], \ }, -\ }) +\ } diff --git a/nvim/coc-languages/rust.vim b/nvim/coc-languages/rust.vim index b83c6e5..d934cbf 100644 --- a/nvim/coc-languages/rust.vim +++ b/nvim/coc-languages/rust.vim @@ -1,3 +1,3 @@ -call coc#add_extension('coc-rls') +let g:coc_global_extensions += ['coc-rls'] let g:coc_filetypes += ['rust'] -call coc#config('rust', { 'clippy_preference': 'on' }) +let g:coc_user_config['rust'] = { 'clippy_preference': 'on' } diff --git a/nvim/plugin/completion.vim b/nvim/plugin/completion.vim index 1656f9a..b7f5519 100644 --- a/nvim/plugin/completion.vim +++ b/nvim/plugin/completion.vim @@ -74,13 +74,16 @@ endif command! -nargs=0 -range -bar CocFormat call s:CocFormat(, , ) " }}} - call coc#add_extension('coc-snippets') - call coc#config('diagnostic', { + let g:coc_global_extensions = [] + let g:coc_user_config = {} + + let g:coc_global_extensions += ['coc-snippets'] + let g:coc_user_config['diagnostic'] = { \ 'virtualText': v:true, \ 'enableMessage': 'jump', \ 'errorSign': 'XX', \ 'warningSign': '!!', - \ }) + \ } runtime! coc-languages/*.vim diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 86cf7d4..8a1d3fc 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -135,7 +135,7 @@ endif let g:airline_section_{a:section} = g:airline_section_{a:section} . airline#section#create_left([''] + a:items) endfunction function s:tweak_airline() - if exists('*coc#status') + if g:vim_ide call s:airline_section_prepend('x', ['coc#status']) endif call s:airline_section_append('y', ['filesize'])