I am currently implementing the new Events for file operations in my language server, which have been introduced in LSP protocol version 3.16. My server shall be able to react on didRename, didDelete etc., but so far I am unable to get these notifications from VSCode.
First of all, in my server's capabilities, I list the file operations, to tell the client that I am interested in these events:
"capabilities": {
...
"workspace": {
"fileOperations": {
"didDelete": {
"filters": [
{
"pattern": {
"glob": "**/*.{rs,rd}"
}
}
]
},
"didRename": {
"filters": [
{
"pattern": {
"glob": "**/*.{rs,rd}"
}
}
]
}
}
}
}
Additionally, after initialization has been completed, the server sends a registerCapability
request to the client, which gets confirmed by VSCode. I register these capabilities separately, because within the init message, VSCode says that dynamicRegistration for file operations shall be used.
{
"id": "register_caps",
"jsonrpc": "2.0",
"method": "client/registerCapability",
"params": {
"registrations": [
{
"id": "dhjas88-asdhjkahsd89as-dhas89",
"method": "workspace/didRenameFiles",
"registerOptions": {
"filters": [
{
"pattern": {
"glob": "**/*.{rs,rd}"
}
}
]
}
},
{
"id": "dhjas88-asdhjkahsd89as-dhas90",
"method": "workspace/didDeleteFiles",
"registerOptions": {
"filters": [
{
"pattern": {
"glob": "**/*.{rs,rd}"
}
}
]
}
}
]
}
}
Confirmation:
{"jsonrpc":"2.0","id":"register_caps","result":null}
According to the specification of LSP, I would now expect that VSCode sends the e.g. didRename notification, as soon as a file that matches with the glob is renamed within VSCode. Unfortunately, I never receive it. The notification is not sent by VSCode.
Any ideas or clues, what is still missing here? Which part of the protocol did I miss, which prevents VSCode to send the file operation notifications?