pappasam / jedi-language-server

A Python language server exclusively for Jedi. If Jedi supports it well, this language server should too.
MIT License
574 stars 44 forks source link

External pytest fixtures not autocompleted #319

Open stinovlas opened 2 weeks ago

stinovlas commented 2 weeks ago
pytest                8.2.2
jedi                  0.19.1
jedi-language-server  0.41.4

Jedi recognizes fixtures from pytest itself and also my own fixtures defined in the same module or conftest.py. However, external pytest fixtures (such as mocker from pytest-mock or faker from Faker are not autocompleted. I first thought this is an issue with jedi itself, but apparently, it's not:

import jedi

source = """
def test_fixture(faker):
    faker.
"""

script = jedi.Script(source, path="example.py")
completions = script.complete(3, len("    faker."))
print(completions)

This does return expected autocompletions.

However, when I write the same test code in neovim with jedi-language-server attached to neovim LSP, this fixture is not autocompleted. I use default jedi-language-server settings.

I'd be happy to provide more details, if that helps with resolving the problem, but I don't know how to call jedi-language-server's API directly, so I'd need some pointers.