Skip to content

Commit

Permalink
lsp: fix how debug port is parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
bhcleek committed Jun 20, 2024
1 parent 665ef24 commit e89e533
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions autoload/go/lsp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,12 @@ function! s:newlsp() abort
endfunction

function! l:lsp.err_cb(ch, msg) dict abort
if a:msg =~ '^\d\{4}/\d\d/\d\d\ \d\d:\d\d:\d\d debug server listening on port \d\+$' && !get(self, 'debugport', 0)
let self.debugport = substitute(a:msg, '\d\{4}/\d\d/\d\d\ \d\d:\d\d:\d\d debug server listening on port \(\d\+\).*$', '\1', '')
if !get(self, 'debugport', 0)
if a:msg =~ '.*debug server listening at http://localhost:\d\+$' " current log for debug server
let self.debugport = substitute(a:msg, '.*debug server listening at http://localhost:\(\d\+\)$', '\1', '')
elseif a:msg =~ '^\d\{4}/\d\d/\d\d\ \d\d:\d\d:\d\d debug server listening on port \d\+$' " old gopls log for debug server
let self.debugport = substitute(a:msg, '\d\{4}/\d\d/\d\d\ \d\d:\d\d:\d\d debug server listening on port \(\d\+\).*$', '\1', '')
endif
endif

call s:debug('stderr', a:msg)
Expand Down

0 comments on commit e89e533

Please sign in to comment.