ncm2 / ncm2-jedi

MIT License
23 stars 11 forks source link

Code completion in Python chunk within R Markdown not working #25

Open oli666 opened 4 years ago

oli666 commented 4 years ago

Posting this issue here as suggested at https://github.com/jalvesaq/Nvim-R/issues/442

I am using 'ncm2/ncm2-jedi' to do completion for py files. This works perfectly well. I do not get completion to work though for python chunks within rmd files (The completion works for R chunks). Having temporarily switched from 'ncm2/ncm2-jedi' to 'davidhalter/jedi' had no effect either.

I have tried after having disabled all plugins except the following:

Plug 'ncm2/ncm2' Plug 'roxma/nvim-yarp' Plug 'gaalcaras/ncm-R' Plug 'jalvesaq/Nvim-R' Plug 'jalvesaq/R-Vim-runtime' Plug 'ncm2/ncm2-bufword' Plug 'ncm2/ncm2-path' Plug 'w0rp/ale' Plug 'ncm2/ncm2-ultisnips' Plug 'ncm2/ncm2-jedi'

Syntax highlighting is working for both, R and Python within chunks. System: NVIM v0.5.0-dev on Ubuntu 18

anoyaro84 commented 4 years ago

Is there any action in this regard? I believe it would be nice if we can manually start ncm2-jedi regardless of the file format.

Similar to the following thread: https://github.com/davidhalter/jedi-vim/issues/784

Would there be a way to manually start the plugin?

Many thanks for any help in advance.

oli666 commented 4 years ago

It seems that adding 'rmd' as a scope to autoload/ncm2_jedi.vim solves the issue:

let g:ncm2_jedi#source = extend(get(g:, 'ncm2_jedi#source', {}), { \ 'name': 'jedi', \ 'ready': 0, \ 'priority': 9, \ 'mark': 'py', \ 'scope': ['python', 'rmd'], \ 'subscope_enable': 1, \ 'complete_pattern': [ \ '^\s(import|from).\s', \ '.', \ '(\s?', \ ',\s?'], \ 'on_complete': 'ncm2_jedi#on_complete', \ 'on_warmup': 'ncm2_jedi#on_warmup', \ }, 'keep')