Skip to content

Commit

Permalink
add comments to explain offset calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
bhcleek committed Mar 7, 2018
1 parent 8c83eb5 commit 2499155
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions autoload/go/complete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ endfunction
function! s:gocodeAutocomplete() abort
call s:gocodeEnableOptions()

" use the offset as is, because the cursor position is the position for
" which autocomplete candidates are needed.
return s:sync_gocode('autocomplete',
\ [expand('%:p'), go#util#OffsetCursor()],
\ go#util#GetLines())
Expand Down Expand Up @@ -137,6 +139,8 @@ function! s:async_info(auto)
call s:info_complete(self.auto, result)
endfunction

" add 1 to the offset, so that the position at the cursor will be included
" in gocode's search
let offset = go#util#OffsetCursor()+1

" We might hit cache problems, as gocode doesn't handle different GOPATHs
Expand Down Expand Up @@ -172,6 +176,9 @@ endfunction

function! s:sync_info(auto)
" auto is true if we were called by g:go_auto_type_info's autocmd

" add 1 to the offset, so that the position at the cursor will be included
" in gocode's search
let offset = go#util#OffsetCursor()+1

let result = s:sync_gocode('autocomplete',
Expand Down

0 comments on commit 2499155

Please sign in to comment.