Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
rwxguo committed Dec 18, 2023
1 parent 50255c4 commit d6ea803
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 4 additions & 2 deletions autoload/go/def.vim
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ function! go#def#jump_to_declaration(out, mode, bin_name) abort
let out = split(final_out, go#util#LineEnding())[0]
if go#util#IsWin()
let parts = split(out, '\(^[a-zA-Z]\)\@<!:')
elseif (system('uname') =~ 'MINGW' || system('uname') =~ 'CYGWIN')
let l:out = l:out[0:1] . l:out[3:]
elseif system('uname') =~ 'MINGW' || system('uname') =~ 'CYGWIN'
if l:msguri[2:3] is# ':/'
let l:out = l:out[0:1] . l:out[3:]
endif
let parts = split(out, ':')
else
let parts = split(out, ':')
Expand Down
11 changes: 10 additions & 1 deletion autoload/go/lsp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,16 @@ function! s:definitionHandler(next, msg) abort dict
" gopls returns a []Location; just take the first one.
let l:msg = a:msg[0]

let l:line = s:lineinfile(go#path#FromURI(l:msg.uri), l:msg.range.start.line+1)
let l:msguri = go#path#FromURI(l:msg.uri)
" remove the comma in cygwin unix-like windwos path
" e.g. '/c:/path' to '/c/path'
if system('uname') =~ 'MINGW' || system('uname') =~ 'CYGWIN'
if l:msguri[2:3] is# ':/'
let l:msguri = l:msguri[0:1] . l:msguri[3:]
endif
endif

let l:line = s:lineinfile(l:msguri, l:msg.range.start.line+1)
if l:line is -1
call go#util#Warn('could not find definition')
return
Expand Down
2 changes: 1 addition & 1 deletion autoload/go/path.vim
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function! go#path#ToURI(path)
let l:absolute = 1
let l:prefix = '/' . l:path[0:1]
let l:path = l:path[2:]
elseif (system('uname') =~ 'MINGW' || system('uname') =~ 'CYGWIN')
elseif system('uname') =~ 'MINGW' || system('uname') =~ 'CYGWIN'
let l:absolute = 1
let l:prefix = l:path[0:1] . ':'
let l:path = l:path[2:3] is# ':/' ? l:path[3:] : l:path[2:]
Expand Down

0 comments on commit d6ea803

Please sign in to comment.