Skip to content

Commit

Permalink
Merge pull request #3058 from bhcleek/lsp/show-message
Browse files Browse the repository at this point in the history
lsp: show messages to users
  • Loading branch information
bhcleek authored Jun 27, 2021
2 parents 353d60e + 05b1cfd commit 18bf81c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 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,19 @@ 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 for Log messages
endif
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 18bf81c

Please sign in to comment.