[gnome-builder/gnome-builder-43] plugins/eslint: port to run contexts
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-43] plugins/eslint: port to run contexts
- Date: Thu, 22 Sep 2022 07:32:38 +0000 (UTC)
commit 11ff80cf435fc184fbb016c9c53230efb29724f4
Author: Christian Hergert <chergert redhat com>
Date: Thu Sep 22 00:06:33 2022 -0700
plugins/eslint: port to run contexts
.../eslint/gbp-eslint-diagnostic-provider.c | 41 +++++++++++++---------
1 file changed, 24 insertions(+), 17 deletions(-)
---
diff --git a/src/plugins/eslint/gbp-eslint-diagnostic-provider.c
b/src/plugins/eslint/gbp-eslint-diagnostic-provider.c
index 073d71c1d..2aa15509b 100644
--- a/src/plugins/eslint/gbp-eslint-diagnostic-provider.c
+++ b/src/plugins/eslint/gbp-eslint-diagnostic-provider.c
@@ -39,26 +39,35 @@ struct _GbpEslintDiagnosticProvider
guint is_stdin : 1;
};
-static void
-gbp_eslint_diagnostic_provider_configure_launcher (IdeDiagnosticTool *tool,
- IdeSubprocessLauncher *launcher,
- GFile *file,
- GBytes *contents,
- const char *language_id)
+G_DEFINE_FINAL_TYPE (GbpEslintDiagnosticProvider, gbp_eslint_diagnostic_provider, IDE_TYPE_DIAGNOSTIC_TOOL)
+
+static gboolean
+gbp_eslint_diagnostic_provider_prepare_run_context (IdeDiagnosticTool *tool,
+ IdeRunContext *run_context,
+ GFile *file,
+ GBytes *contents,
+ const char *language_id,
+ GError **error)
{
GbpEslintDiagnosticProvider *self = (GbpEslintDiagnosticProvider *)tool;
g_assert (GBP_IS_ESLINT_DIAGNOSTIC_PROVIDER (self));
- g_assert (IDE_IS_SUBPROCESS_LAUNCHER (launcher));
+ g_assert (IDE_IS_RUN_CONTEXT (run_context));
g_assert (G_IS_FILE (file));
- ide_subprocess_launcher_push_args (launcher,
- IDE_STRV_INIT ("-f", "json",
- "--ignore-pattern", "!node_modules/*",
- "--ignore-pattern", "!bower_components/*"));
- if (contents != NULL)
- ide_subprocess_launcher_push_args (launcher, IDE_STRV_INIT ("--stdin", "--stdin-filename"));
- ide_subprocess_launcher_push_argv (launcher, g_file_peek_path (file));
+ if (IDE_DIAGNOSTIC_TOOL_CLASS (gbp_eslint_diagnostic_provider_parent_class)->prepare_run_context (tool,
run_context, file, contents, language_id, error))
+ {
+ ide_run_context_append_args (run_context,
+ IDE_STRV_INIT ("-f", "json",
+ "--ignore-pattern", "!node_modules/*",
+ "--ignore-pattern", "!bower_components/*"));
+ if (contents != NULL)
+ ide_run_context_append_args (run_context, IDE_STRV_INIT ("--stdin", "--stdin-filename"));
+ ide_run_context_append_argv (run_context, g_file_peek_path (file));
+ return TRUE;
+ }
+
+ return FALSE;
}
static inline IdeDiagnosticSeverity
@@ -166,14 +175,12 @@ gbp_eslint_diagnostic_provider_populate_diagnostics (IdeDiagnosticTool *tool,
}
}
-G_DEFINE_FINAL_TYPE (GbpEslintDiagnosticProvider, gbp_eslint_diagnostic_provider, IDE_TYPE_DIAGNOSTIC_TOOL)
-
static void
gbp_eslint_diagnostic_provider_class_init (GbpEslintDiagnosticProviderClass *klass)
{
IdeDiagnosticToolClass *diagnostic_tool_class = IDE_DIAGNOSTIC_TOOL_CLASS (klass);
- diagnostic_tool_class->configure_launcher = gbp_eslint_diagnostic_provider_configure_launcher;
+ diagnostic_tool_class->prepare_run_context = gbp_eslint_diagnostic_provider_prepare_run_context;
diagnostic_tool_class->populate_diagnostics = gbp_eslint_diagnostic_provider_populate_diagnostics;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]