Skip to content

Commit

Permalink
Fixes #763: Full ref/cite completion in subfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
lervag committed Aug 15, 2017
1 parent 1803df9 commit d752ba4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions autoload/vimtex/complete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -294,20 +294,20 @@ function! s:completer_ref.get_matches(regex) dict " {{{2
endfunction

function! s:completer_ref.parse_aux_files() dict " {{{2
let l:files = [[b:vimtex.aux(), '']]

" Handle local file editing (e.g. subfiles package)
let l:id = get(get(b:, 'vimtex_local', {'main_id' : b:vimtex_id}), 'main_id')
let l:aux = vimtex#state#get(l:id).aux()
if empty(l:aux)
let l:aux = b:vimtex.aux()
if exists('b:vimtex_local') && b:vimtex_local.active
let l:files += [[vimtex#state#get(b:vimtex_local.main_id).aux(), '']]
endif
if empty(l:aux) | return [] | endif

let self.labels = []
for [l:file, l:prefix] in [[l:aux, '']]
\ + filter(map(vimtex#parser#get_externalfiles(),
\ '[v:val.aux, v:val.opt]'),
\ 'filereadable(v:val[0])')
" Add externaldocuments (from \externaldocument in preamble)
let l:files += map(
\ vimtex#parser#get_externalfiles(),
\ '[v:val.aux, v:val.opt]')

let self.labels = []
for [l:file, l:prefix] in filter(l:files, 'filereadable(v:val[0])')
let l:cached = get(self.cache, l:file, {})
if get(l:cached, 'ftime', 0) != getftime(l:file)
let l:cached.ftime = getftime(l:file)
Expand Down

0 comments on commit d752ba4

Please sign in to comment.