Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsp: show messages to users #3058

Merged
merged 2 commits into from
Jun 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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