Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An issue on workspace/didChangeWorkspaceFolders event #951

Open
KKosukeee opened this issue May 1, 2022 · 1 comment
Open

An issue on workspace/didChangeWorkspaceFolders event #951

KKosukeee opened this issue May 1, 2022 · 1 comment

Comments

@KKosukeee
Copy link

Hi team, thanks for the great project on python language server.

I just realized that m_workspace__did_change_workspace_folders doesn't migrate documents in root workspace in case both root_workspace_removed and workspace_added are true. This is because root workspace (I assume this is self.workspace ) is updated here with newly created workspace above with empty docs, then looped here. This causes new root workspace with empty docs (previous docs are missing) and causes subsequent request to have a KeyError as the screenshot below.
image

This happens, because for certain language client, it sends an initial workspace/didChangeWorkspaceFolders event, like the most famous language client vscode-languageserver at this line. The request that causes an error is below:

{
    "jsonrpc": "2.0",
    "method": "workspace/didChangeWorkspaceFolders",
    "params": {
        "event": {
            "added": [
                {
                    "uri": "file:///Users/kkosuke/Dropbox/playground/project/lsp/python",
                    "name": "file:///Users/kkosuke/Dropbox/playground/project/lsp/python"
                }
            ],
            "removed": [
                {
                    "uri": "file:///Users/kkosuke/Dropbox/playground/project/lsp/python",
                    "name": "file:///Users/kkosuke/Dropbox/playground/project/lsp/python"
                }
            ]
        }
    }
}

If my understanding is correct, I think I can create a PR to fix this quickly, so please let me know if it's a bug to be fixed (otherwise, please let me know the intention behind the current logic!). Thanks!

@lieryan
Copy link

lieryan commented Sep 25, 2022

This repository is no longer maintained. The project now lives in python-lsp-server (pylsp), which is a maintained fork of python-language-server (pyls).

If you have projects still using pyls, you should update it to use pylsp instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants