Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omnicompletion raises error when typing text in parenthesis if preceded by citation #417

Open
carldelfin opened this issue Sep 20, 2021 · 0 comments

Comments

@carldelfin
Copy link

If a line looks like this:

This is some text @examplecitation2021. This is more text (text in parenthesis).

Then I get the following error when using omnicompletion within the parrenthesis:

Error detected while processing function CompleteR[20]..RmdNonRCompletion[25]..pandoc#completion#Complete[12]..pandoc#bibliographies#GetSuggestions[2]..provider#python3#Call:                 
line   18:                                                                                                                                                                                     
Error invoking 'python_eval' on channel 3 (python3-script-host):                                                                                                                               
error caught in request handler 'python_eval ['vim_pandoc.bib.vim_completer.VimCompleter().get_suggestions(vim.eval("a:partkey"))']':                                                          
Traceback (most recent call last):                                                                                                                                                             
  File "/home/cmd/.local/lib/python3.9/site-packages/pynvim/plugin/script_host.py", line 167, in python_eval                                                                                   
    return eval(expr, self.module.__dict__)                                                                                                                                                    
  File "<string>", line 1, in <module>                                                                                                                                                         
  File "/home/cmd/.vim/plugged/vim-pandoc/python3/vim_pandoc/bib/vim_completer.py", line 53, in get_suggestions                                                                                
    return collator.collate()                                                                                                                                                                  
  File "/home/cmd/.vim/plugged/vim-pandoc/python3/vim_pandoc/bib/fallback.py", line 161, in collate                                                                                            
    ids = get_bibtex_suggestions(text, self.query)                                                                                                                                             
  File "/home/cmd/.vim/plugged/vim-pandoc/python3/vim_pandoc/bib/fallback.py", line 44, in get_bibtex_suggestions                                                                              
    bibtex_id_search = re.compile(".*{\s*(?P<id>" + query + ".*),")                                                                                                                            
  File "/usr/lib/python3.9/re.py", line 252, in compile                                                                                                                                        
    return _compile(pattern, flags)                                                                                                                                                            
  File "/usr/lib/python3.9/re.py", line 304, in _compile                                                                                                                                       
    p = sre_compile.compile(pattern, flags)                                                                                                                                                    
  File "/usr/lib/python3.9/sre_compile.py", line 764, in compile                                                                                                                               
    p = sre_parse.parse(p, flags)                                                                                                                                                              
  File "/usr/lib/python3.9/sre_parse.py", line 948, in parse                                                                                                                                   
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)                                                                                                                                 
  File "/usr/lib/python3.9/sre_parse.py", line 443, in _parse_sub                                                                                                                              
    itemsappend(_parse(source, state, verbose, nested + 1,                                                                                                                                     
  File "/usr/lib/python3.9/sre_parse.py", line 836, in _parse                                                                                                                                  
    raise source.error("missing ), unterminated subpattern",                                                                                                                                   
re.error: missing ), unterminated subpattern at position 6

Note that this only happens if there is a citation key on the same line. If a line looks like this, instead:

This is some text without a citation. This is more text (text in parenthesis).

Then autocompletion within the parenthesis works fine.

I'm using Neovim nightly (with Nvim-R to edit RMarkdown files):

NVIM v0.6.0-dev+210-g6751d6254                                                                                                                                                                 
Build type: RelWithDebInfo                                                                                                                                                                     
LuaJIT 2.1.0-beta3                                                                                                                                                                             
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Ws
hadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGP
ACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/in
clude -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include                                                                     
Compiled by runner@fv-az139-262                                                                                                                                                                
                                                                                                                                                                                               
Features: +acl +iconv +tui                                                                                                                                                                     
See ":help feature-compile"                                                                                                                                                                    
                                                                                                                                                                                               
system vimrc file: "$VIM/sysinit.vim"                                                                                                                                                       
fall-back for $VIM: "/home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"     
``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant