Skip to content

Commit

Permalink
lsp: show messages to users
Browse files Browse the repository at this point in the history
  • Loading branch information
bhcleek committed Oct 18, 2020
1 parent 8803940 commit ad308e7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions autoload/go/lsp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ function! s:newlsp() abort
" TODO(bc): handle more notifications (e.g. window/showMessage).
if a:req.method == 'textDocument/publishDiagnostics'
call self.handleDiagnostics(a:req.params)
elseif a:req.method == 'window/showMessage'
call self.showMessage(a:req.params)
endif
endfunction

Expand All @@ -231,6 +233,20 @@ function! s:newlsp() abort
call self.updateDiagnostics()
endfunction

function! l:lsp.showMessage(data) dict abort
let l:msg = a:data.message
if a:data.type == 1
call go#util#EchoError(l:msg)
elseif a:data.type == 2
call go#util#EchoWarning(l:msg)
elseif a:data.type == 3
call go#util#EchoInfo(l:msg)
elseif a:data.type == 4
" do nothing
endif
" TODO(bc): check the type and call the correct function
endfunction

" TODO(bc): process the queue asynchronously
function! l:lsp.updateDiagnostics() dict abort
let l:level = go#config#DiagnosticsLevel()
Expand Down

0 comments on commit ad308e7

Please sign in to comment.