LSP
LSP copied to clipboard
Investigate why didSave notification is not sent if view closed immediately after saving
When a file is saved, a textDocument/didSave notifications should be sent to the server if it opts-in via TextDocumentSyncOptions.
But if the file gets closed immediately after saving, the notification is not sent (at least here on Windows, and apparently also on CI on all OS, but according to https://github.com/sublimelsp/LSP/pull/2438#issuecomment-2054138492 it seems to work in practice on Linux).
Key binding example:
{
"keys": ["f1"],
"command": "chain",
"args": {
"commands": [
["save", {"async": false}],
["close", {}]
]
}
},
I expect to see textDocument/didSave in the LSP server log panel before textDocument/didClose, but it's missing.
If this gets fixed, this line in the tests could be uncommented: https://github.com/sublimelsp/LSP/blob/4c8da7820cff68901be808ea8bf2fcf14138d249/tests/test_single_document.py#L394