@@ -414,10 +414,29 @@ impl Client {
414414 pub async fn text_document_did_save(
415415 &self,
416416 text_document: lsp::TextDocumentIdentifier,
417+ text: &Rope,
417418 ) -> Result<()> {
419+ let capabilities = self.capabilities.as_ref().unwrap(); // TODO: needs post init
420+
421+ let include_text = match &capabilities.text_document_sync {
422+ Some(lsp::TextDocumentSyncCapability::Options(lsp::TextDocumentSyncOptions {
423+ save: Some(options),
424+ ..
425+ })) => match options {
426+ lsp::TextDocumentSyncSaveOptions::Supported(true) => false,
427+ lsp::TextDocumentSyncSaveOptions::SaveOptions(lsp_types::SaveOptions {
428+ include_text,
429+ }) => include_text.unwrap_or(false),
430+ // Supported(false)
431+ _ => return Ok(()),
432+ },
433+ // unsupported
434+ _ => return Ok(()),
435+ };
436+
418437 self.notify::<lsp::notification::DidSaveTextDocument>(lsp::DidSaveTextDocumentParams {
419438 text_document,
420− text: None, // TODO:
439+ text: include_text.then(|| text.into()),
421440 })
422441 .await
423442 }