python-lsp/python-lsp-server

Autocomplete does not insert imports

sblask opened this issue · 0 comments

I think I have autocomplete set up in Neovim so it should work:

lspconfig["pylsp"].setup({
    on_attach = function(_client, buffer)
        setup_format_on_save(buffer)
    end,
    settings = {
        pylsp = {
            plugins = {
                jedi_completion = {
                    enabled = false,
                },
                rope_completion = {
                    enabled = true,
                },
                rope_autoimport = {
                    enabled = true,
                    completions = {
                        enabled = true,
                    },
                    code_actions = {
                        enabled = true,
                    },
                },
            },
        },
    },
})

and rope is installed alongside python-lsp-server:

$ ~/.opt/pylsp/bin/pip freeze
docstring-to-markdown==0.15
jedi==0.19.1
packaging==24.0
parso==0.8.3
platformdirs==4.2.1
pluggy==1.4.0
python-lsp-jsonrpc==1.1.2
python-lsp-server==1.11.0
pytoolconfig==1.3.1
rope==1.13.0
ujson==5.9.0

If I for example type typ followed by ctrl-x ctrl-o I get a completion menu:

Screenshot 2024-05-10 at 1 40 37 AM

Choosing types from the menu does complete the word, but I don't get an import for types. I couldn't find anything in the logs. Is there anything I am missing? Code actions are not available either, but that's another story.