I really enjoy coc-pyright and use it all the time for everything. But it can't jump to Pytest fixture definitions, and there are no plans to include such a feature.

Pyright doesn't include any knowledge of third-party libraries beyond what is provided to it in type stubs or type annotations, and we don't have any plans to add hard-coded logic that is library-specific.

My vscode-using friends can jump to fixture definitions (including fixtures created in conftest.py) because the feature has been built into Pylance for some years now.

The Jedi language server (and by extension coc-jedi) can do this but, from what little I've seen, is less featureful than coc-pyright in every other respect.

Installing both is not supported (coc-jedi say not to install it at the same time as coc-python which has been superceded by coc-pyright)

Is there a way I can install coc-jedi but only use it for <Plug>(coc-definition) and keep using coc-pyright for everything else?

Here's a snippet to demonstrate Pytest fixtures, and a gif showing how coc-defintion works with coc-jedi:

import pytest

def my_fixture():

def test_my_test(my_fixture):

Using Jedi to jump to Pytest definition

  • Use the plugin's support channels.
    – romainl
    Commented Sep 20, 2023 at 11:01
  • I've created an issue at coc-jedi: github.com/pappasam/coc-jedi/issues/61
    – LondonRob
    Commented Sep 20, 2023 at 13:44
  • Like I wrote in my answer I suspect the difference between coc-pyright and coc-jedi is not that pyright vs. jedi but the way they handle failure. I suspect coc-jedi to rely on a fall back. I'll be glad if you could confirm my understanding in your test. When I'll have the time I'll have a look at the code of coc-jedi to confirm my hypothesis. Commented Jan 16 at 2:23

1 Answer 1


I made some test with Jedi itself and some other LSP integration (jedi-vim) and it seems to me that Jedi itself don't find the implementation itself.

I suspect that coc-jedi as a fall back when Jedi doesn't find the implementation and I suspect that the fall back is [Ctrl i (a.k.a.: [<C-i>).

:help [_CTRL-i

[ CTRL-I    Jump to the first line that contains the keyword
            under the cursor.  The search starts at the beginning
            of the file.  Lines that look like a comment are
            ignored (see 'comments' option).  If a count is given,
            the count'th matching line is jumped to, and comment
            lines are not ignored.

A way to implement this fallback in general for coc.nvim is the following:

" nmap <silent> gd <Plug>(coc-definition)

nmap <silent><expr> gd GoToDef()

function! DelayedGotoDef(timer)
  if g:start_curpos == getcurpos()
    execute "normal! [\<C-i>"

function! GoToDef()
  let g:start_curpos = getcurpos()
  call timer_start(200, 'DelayedGotoDef', {'repeat' : 1})
  return "\<Plug>(coc-definition)"

We replace the proposed mapping:

" nmap <silent> gd <Plug>(coc-definition)

By another mapping that tries the same operation but if it doesn't move the cursor within 200 ms then it perform the fallback operation ([<C-i> in this case).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.