textDocument/didSave notification not being sent

I’m struggling to debug an issue where my Elixir language server extension is not updating compilation errors when a file is saved. By logging on the server end I can see that the “textDocument/didSave” notification is not being received by the server which is what is causing the issue. My understanding, based on the documentation, is that the built in Nova LanguageClient will handle sending this notification on its own. Am I missing something? Is there a way to debug which messages are being sent on the client side?

2 Likes

Just to keep this thread updated. I’ve worked around this issue by manually sending the textDocument/didSave notification during the editor.onDidSave() callback. This seems to work fine but suggests that either there is a bug in the Nova LanguageClient or the documentation on supported LanguageClient features is incorrect/misleading.

2 Likes

I’m also seeing this in my language server. I have callbacks to handle textDocument/didOpen, textDocument/didChange, textDocument/didSave and textDocument/didClose, but of those four callbacks, the save callback isn’t called.

The Nova LanguageClient sends the "synchronization":{"didsave":true} client capability and I am returning the "textDocumentSync":{"save":{"includeText":true}} server capability, so I also think this is a bug in the LanguageClient.

1 Like

I’ve just diagnosed this with a couple of language server extensions (TypeScript and Go), and Nova is sending the textDocument/didSave message in those cases from what I can tell.

Could either of you direct me to one of your extensions that I could attempt to diagnose this with?

Hi @Logan, would you mind testing this with https://extensions.panic.com/extensions/genealabs/genealabs.intelephense/, as I have been noticing that new files are not being indexed. Wondering if that is related?

Thanks!
~Mike

I experienced it developing this extension https://extensions.panic.com/extensions/raulchedrese/raulchedrese.elixir-ls/. As I mentioned previously it works now because I am manually sending textDocument/didSave. Without that custom handling it was not being triggered.

I can still reproduce this in my extension WebHare | Nova Extensions.

In the actual language server implementation, I add callbacks for textDocument/didOpen, textDocument/didChange, textDocument/didSave and textDocument/didClose by calling onDidOpenTextDocument, onDidChangeTextDocument, OnDidSaveTextDocument and onDidCloseTextDocument, respectively, on the connection object created by createConnection imported from vscode-languageserver/node. All callbacks are called as expected, except for the didSave callback. This does work in other editors using the same language server implementation.

As pointed out above, manually sending a textDocument/didSave request in the TextEditor.onDidSave callback makes it work, but I don’t think that should be necessary.

Thank you all for the confirmation. I’m hoping to get to this very soon.

1 Like

I haven’t read about this being fixed in the release notes, but it seems to be working now, at least for my extension.