Skip to content

Commit

Permalink
Use haorenW1025/diagnostic-nvim
Browse files Browse the repository at this point in the history
Got it to work somehow.

See nvim-lua/diagnostic-nvim#29
  • Loading branch information
nhooyr committed Jul 18, 2020
1 parent 42e66ce commit 6b55b3b
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions nvim/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function! s:plugins() abort
Plug 'Shougo/neosnippet-snippets'
Plug 'neovim/nvim-lsp'
Plug 'haorenW1025/completion-nvim'
Plug 'haorenW1025/diagnostic-nvim'
Plug 'hrsh7th/vim-vsnip'
Plug 'hrsh7th/vim-vsnip-integ'
call plug#end()
Expand Down Expand Up @@ -219,20 +220,21 @@ call s:quick()
function! s:lsp() abort
lua << EOF
local lsp = require 'nvim_lsp'
local completion = require 'completion'

lsp.gopls.setup{ on_attach = completion.on_attach }
lsp.tsserver.setup{ on_attach = completion.on_attach }
lsp.vimls.setup{ on_attach = completion.on_attach }

-- Disable diagnostics globally.
vim.lsp.callbacks["textDocument/publishDiagnostics"] = function() end
local on_attach = function(client)
require'diagnostic'.on_attach()
require'completion'.on_attach()
end

lsp.gopls.setup{ on_attach = on_attach }
lsp.tsserver.setup{ on_attach = on_attach }
lsp.vimls.setup{ on_attach = on_attach }
EOF

inoremap <silent> <M-x> <C-x>
set completeopt=menuone,longest,noselect
set pumheight=10

let g:diagnostic_insert_delay = 1
let g:completion_enable_snippet = 'Neosnippet'
imap <C-k> <cmd>lua require'source'.nextCompletion()<CR>
Expand All @@ -252,7 +254,7 @@ EOF
augroup lsp
autocmd!
autocmd FileType go,vim,typescript* call s:b_lsp()
" autocmd CursorHold * lua vim.lsp.util.show_line_diagnostics()
autocmd CursorHold * lua vim.lsp.util.show_line_diagnostics()
autocmd BufEnter * lua require'completion'.on_attach()
augroup END
endfunction
Expand Down

0 comments on commit 6b55b3b

Please sign in to comment.