[gnome-builder] lsp: provide new text content with textDocument/didSave
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] lsp: provide new text content with textDocument/didSave
- Date: Fri, 22 Nov 2019 22:39:21 +0000 (UTC)
commit b97ee66598f565d0878025ab81ccfbbed6a67eb5
Author: Christian Hergert <chergert redhat com>
Date: Fri Nov 22 13:10:18 2019 -0800
lsp: provide new text content with textDocument/didSave
Some LSP servers can take advantage of this to ensure their copy of the
data has not been perturbed by incremental range updates. It at least gives
us a fail-safe in case that happens.
src/libide/lsp/ide-lsp-client.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/lsp/ide-lsp-client.c b/src/libide/lsp/ide-lsp-client.c
index b3578debf..56a2a9a72 100644
--- a/src/libide/lsp/ide-lsp-client.c
+++ b/src/libide/lsp/ide-lsp-client.c
@@ -127,7 +127,9 @@ ide_lsp_client_buffer_saved (IdeLspClient *self,
IdeBufferManager *buffer_manager)
{
g_autoptr(GVariant) params = NULL;
+ g_autoptr(GBytes) content = NULL;
g_autofree gchar *uri = NULL;
+ const gchar *text;
IDE_ENTRY;
@@ -140,14 +142,20 @@ ide_lsp_client_buffer_saved (IdeLspClient *self,
IDE_EXIT;
uri = ide_buffer_dup_uri (buffer);
+ content = ide_buffer_dup_content (buffer);
+ text = (const gchar *)g_bytes_get_data (content, NULL);
params = JSONRPC_MESSAGE_NEW (
"textDocument", "{",
"uri", JSONRPC_MESSAGE_PUT_STRING (uri),
+ "text", JSONRPC_MESSAGE_PUT_STRING (text),
"}"
);
- ide_lsp_client_send_notification_async (self, "textDocument/didSave", params, NULL, NULL, NULL);
+ ide_lsp_client_send_notification_async (self,
+ "textDocument/didSave",
+ params,
+ NULL, NULL, NULL);
IDE_EXIT;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]