python-lsp / python-lsp-server

Fork of the python-language-server project, maintained by the Spyder IDE team and the community
MIT License
1.76k stars 186 forks source link

rope_autoimport doesn't initialize after `workspace/didChangeConfiguration` message #460

Closed tkrabel-db closed 9 months ago

tkrabel-db commented 9 months ago

It seems the supported way to change configurations as per the LSP is to send workspace/didChangeConfiguration, and that is what python-lsp-server supports (source).

The problem

rope_autoimport needs to create an index of the python modules, and it only does so when enabled at server startup. When enabling it dynamically at runtime, it doesn't do so. This is especially is an issue when using the memory = True setting.

One solution

I propose extending the hookspecs to add a hook pylsp_workspace_configuration_changed and to implement that hook in rope_autoimport, like this one.

ccordoba12 commented 9 months ago

Fixed by #461.