redhat-developer / lsp4ij

LSP Client for IntelliJ
Eclipse Public License 2.0
48 stars 9 forks source link

Use registration id to update workspace/didChangeWatchedFiles cache #342

Closed angelozerr closed 2 weeks ago

angelozerr commented 3 weeks ago

By playing with https://pypi.org/project/basedpyright/ LS (cc @DetachHead), I have noticed that notification 'workspace/didChangeWatchedFiles' are never sent.

It is because there are 2 registrations and one unregsitration at the end:

[Trace - 7:09:49 PM] Received request 'client/registerCapability - (0)'.
Params: {
    "registrations": [
        {
            "id": "9b9d4fd7-61c0-4c11-b9fd-3a06610060e9",
            "method": "workspace/didChangeWatchedFiles",
            "registerOptions": {
                "watchers": [
                    {
                        "globPattern": "**/pyrightconfig.json",
                        "kind": 7
                    },
                    {
                        "globPattern": "**",
                        "kind": 7
                    }
                ]
            }
        }
    ]
}
[Trace - 7:09:51 PM] Received request 'client/registerCapability - (4)'.
Params: {
    "registrations": [
        {
            "id": "723c8357-20c6-4f55-8976-198eade3db56",
            "method": "workspace/didChangeWatchedFiles",
            "registerOptions": {
                "watchers": [
                    {
                        "globPattern": "**/pyrightconfig.json",
                        "kind": 7
                    },
                    {
                        "globPattern": "**",
                        "kind": 7
                    },
                    {
                        "globPattern": {
                            "baseUri": "file:///c%3A/Python310/Lib",
                            "pattern": "**"
                        },
                        "kind": 7
                    },
                    {
                        "globPattern": {
                            "baseUri": "file:///c%3A/Python310",
                            "pattern": "**"
                        },
                        "kind": 7
                    }
                ]
            }
        }
    ]
}
[Trace - 7:09:53 PM] Received request 'client/unregisterCapability - (5)'.
Params: {
    "unregisterations": [
        {
            "id": "9b9d4fd7-61c0-4c11-b9fd-3a06610060e9",
            "method": "workspace/didChangeWatchedFiles"
        }
    ]
}

The last unregisterCapability invalidate all file system watcher list although it should just remove the first by using id 9b9d4fd7-61c0-4c11-b9fd-3a06610060e9