[gnome-builder] langserv: include text and languageId with textDocument diagnostics
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] langserv: include text and languageId with textDocument diagnostics
- Date: Thu, 30 Mar 2017 02:30:15 +0000 (UTC)
commit efbf8180c8a01ab1a9208fba8d7f7aceaebb57b7
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 29 19:55:33 2017 -0600
langserv: include text and languageId with textDocument diagnostics
libide/langserv/ide-langserv-client.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/libide/langserv/ide-langserv-client.c b/libide/langserv/ide-langserv-client.c
index 8637b73..900e252 100644
--- a/libide/langserv/ide-langserv-client.c
+++ b/libide/langserv/ide-langserv-client.c
@@ -281,6 +281,11 @@ ide_langserv_client_buffer_loaded (IdeLangservClient *self,
{
g_autoptr(GVariant) params = NULL;
g_autofree gchar *uri = NULL;
+ g_autofree gchar *text = NULL;
+ GtkSourceLanguage *language;
+ const gchar *language_id;
+ GtkTextIter begin;
+ GtkTextIter end;
IDE_ENTRY;
@@ -305,9 +310,20 @@ ide_langserv_client_buffer_loaded (IdeLangservClient *self,
uri = ide_buffer_get_uri (buffer);
+ gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (buffer), &begin, &end);
+ text = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (buffer), &begin, &end, TRUE);
+
+ language = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (buffer));
+ if (language != NULL)
+ language_id = gtk_source_language_get_id (language);
+ else
+ language_id = "text/plain";
+
params = JSONRPC_MESSAGE_NEW (
"textDocument", "{",
"uri", JSONRPC_MESSAGE_PUT_STRING (uri),
+ "languageId", JSONRPC_MESSAGE_PUT_STRING (language_id),
+ "text", JSONRPC_MESSAGE_PUT_STRING (text),
"}"
);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]