lervag / vimtex

VimTeX: A modern Vim and neovim filetype plugin for LaTeX files.
MIT License
5.58k stars 393 forks source link

How to use asyncomplete.vim as autocompletion? #2931

Closed jiangtianli91 closed 7 months ago

jiangtianli91 commented 7 months ago

Description

I have been trying to use asyncomplete.nvim to do the autocompletion. I have been playing with their template code, but it doesn't work. I wonder how could I make it work

function s:completor(opt, ctx)
  call mylanguage#get_async_completions({candidates, startcol -> asyncomplete#complete(a:opt['name'], a:ctx, startcol, candidates) })
endfunction

au User asyncomplete_setup call asyncomplete#register_source({
    \ 'name': 'mylanguage',
    \ 'allowlist': ['*'],
    \ 'completor': function('s:completor'),
    \ })

Steps to reproduce

No response

Expected behavior

No response

Actual behavior

No response

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: macOS 13.5 (22G74)
  Vim version: VIM 9.1 ()
  Has clientserver: true
  Servername: undefined (vim started without --servername)

VimTeX project: test
  base: test.tex
  root: /Users/jiangtianli/MyWriting/paper_cogsci_journal_ambiguity_stimuli_analysis
  tex: /Users/jiangtianli/MyWriting/paper_cogsci_journal_ambiguity_stimuli_analysis/test.tex
  main parser: current file verified
  document class: apa7
  packages: adjcalc adjustbox atbegshi atbegshi-ltx atveryend atveryend-ltx auxhook bigintcalc bitset bm booktabs calc caption caption3 collectbox endfloat epstopdf-base etexcmds etoolbox fancyhdr float fontenc geometry gettitlestring graphics graphicx hycolor hyperref ifoddpage iftex ifvtex infwarerr intcalc keyval kvdefinekeys kvoptions kvsetkeys letltxmacro lmodern ltxcmds nameref pdfescape pdftexcmds pgf pgfcomp-version-0-65 pgfcomp-version-1-18 pgfcore pgffor pgfkeys pgfmath pgfrcs pgfsys refcount rerunfilecheck scalerel subcaption threeparttable tikz trig trimclip uniquecounter url varwidth xcolor xkeyval
  compiler: latexmk
    engine: -pdf
    options:
      -shell-escape
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: Skim
  qf method: LaTeX logfile
lervag commented 7 months ago

I have been trying to use asyncomplete.nvim to do the autocompletion. I have been playing with their template code, but it doesn't work. I wonder how could I make it work

  1. It is really not clear how this question is relevant for VimTeX.
  2. So: Why are you asking at the VimTeX repo and not at asyncomplete.vim repo?
  3. Why are you using this autocomplete function? It is really not among the current popular choices. I've listed several autocomplete plugins in the VimTeX docs, please read :help vimtex-complete-auto.

If you want to make asyncomplete.vim work, then of course, feel free. But I don't know that plugin at all and can't be of much help. If you do figure it out, feel free to propose a PR to update the VimTeX docs with a small section on this plugin.