[gnome-builder] python: request pylint be used by gnome-code-assistance.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] python: request pylint be used by gnome-code-assistance.
- Date: Sat, 10 Jan 2015 23:42:26 +0000 (UTC)
commit edbd3e75c4a8ec5164244bbb9c2af3f1844f09f4
Author: Christian Hergert <christian hergert me>
Date: Sat Jan 10 15:42:18 2015 -0800
python: request pylint be used by gnome-code-assistance.
We still need to figure out how to improve the module name, because that
is pretty unsightly.
src/code-assistant/gb-source-code-assistant.c | 26 ++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/src/code-assistant/gb-source-code-assistant.c b/src/code-assistant/gb-source-code-assistant.c
index 98ef467..cc0289b 100644
--- a/src/code-assistant/gb-source-code-assistant.c
+++ b/src/code-assistant/gb-source-code-assistant.c
@@ -375,6 +375,30 @@ failure:
EXIT;
}
+static GVariant *
+gb_source_code_assistant_get_options (GbSourceCodeAssistant *assistant)
+{
+ GbSourceCodeAssistantPrivate *priv;
+ GtkSourceLanguage *language;
+ const gchar *lang_id;
+ GVariant *options = NULL;
+
+ g_return_val_if_fail (GB_IS_SOURCE_CODE_ASSISTANT (assistant), NULL);
+
+ priv = assistant->priv;
+
+ language = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (priv->buffer));
+ lang_id = language ? gtk_source_language_get_id (language) : NULL;
+
+ if ((g_strcmp0 (lang_id, "python") == 0) ||
+ (g_strcmp0 (lang_id, "python3") == 0))
+ options = g_variant_new_parsed ("{'pylint': <true>}");
+ else
+ options = g_variant_new ("a{sv}", 0);
+
+ return options;
+}
+
static gboolean
gb_source_code_assistant_do_parse (gpointer data)
{
@@ -409,7 +433,7 @@ gb_source_code_assistant_do_parse (gpointer data)
line = gtk_text_iter_get_line (&iter);
line_offset = gtk_text_iter_get_line_offset (&iter);
cursor = g_variant_new ("(xx)", line, line_offset);
- options = g_variant_new ("a{sv}", 0);
+ options = gb_source_code_assistant_get_options (assistant);
if (GB_IS_EDITOR_DOCUMENT (priv->buffer))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]