Is there a way to get Jedi to perform completion for Cython? One can simply use normal jedi completion; however, it does not work on Cython keywords such as cdef or when importing Cython modules (e.g. "import partial_module_name|").

If there's no reasonable way to get Jedi to do this, is there some other package that does this? I'm already combining another method of completion with Jedi's completion by writing a completion-at-point function that calls jedi:ac-direct-matches, so it would be easy to add another for Cython.

  • Does Jedi provide completions for Cython outside of Emacs? If not, this is probably not something we can solve here – purple_arrows Feb 10 '18 at 16:35
  • @purple_arrows It does not. – Qudit Feb 10 '18 at 17:58
  • Gotcha. I doubt the Emacs Jedi library can get completions that the Python Jedi library doesn’t provide, for obvious reasons. I don’t know if / how the python interactive repl completes that text, but if it can you’ll probably have better luck looking for a front end to that. Alternatively, you might ask on the Python Jedi project if they have any ideas – purple_arrows Feb 10 '18 at 18:01
  • @purple_arrows The REPL doesn't provide this completion either (which makes sense as the REPL does not support Cython code at all). I suspected the answer to this was negative when I posted it, but for example if there was a way to tell Jedi to use a different set of keywords, that would at least provide a partial solution. Another idea would be to hack a C static analysis framework and choose between that and Jedi depending on the context since Cython is basically a Python syntax for C plus normal Python in one file. – Qudit Feb 10 '18 at 18:14
  • 1
    Cython itself has a parser, (and I think it's written in pure Python). You could try to exploit this fact by writing some Python code that will call to that parser and ask for completions... To the best of my knowledge, you will be the first to do this. Meaning, there's no existing completion engines for Cython. – wvxvw Feb 11 '18 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.