[gnome-builder] libide/foundry: include language-id when configuring launcher
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/foundry: include language-id when configuring launcher
- Date: Tue, 26 Apr 2022 01:24:24 +0000 (UTC)
commit eb3ddc1f5c2acb432b55ffd63032e800d07c8511
Author: Christian Hergert <chergert redhat com>
Date: Mon Apr 25 18:13:28 2022 -0700
libide/foundry: include language-id when configuring launcher
This might make a difference in how the launcher is spawned.
src/libide/foundry/ide-diagnostic-tool.c | 21 ++++++++++++---------
src/libide/foundry/ide-diagnostic-tool.h | 4 +++-
src/plugins/eslint/eslint_plugin.py | 2 +-
src/plugins/rstcheck/rstcheck_plugin.py | 2 +-
src/plugins/rubocop/rubocop_plugin.py | 2 +-
src/plugins/stylelint/stylelint_plugin.py | 2 +-
6 files changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/src/libide/foundry/ide-diagnostic-tool.c b/src/libide/foundry/ide-diagnostic-tool.c
index e3b78243a..996e69c5a 100644
--- a/src/libide/foundry/ide-diagnostic-tool.c
+++ b/src/libide/foundry/ide-diagnostic-tool.c
@@ -96,7 +96,8 @@ static void
ide_diagnostic_tool_real_configure_launcher (IdeDiagnosticTool *self,
IdeSubprocessLauncher *launcher,
GFile *file,
- GBytes *contents)
+ GBytes *contents,
+ const char *language_id)
{
IDE_ENTRY;
@@ -113,6 +114,7 @@ ide_diagnostic_tool_real_create_launcher (IdeDiagnosticTool *self,
const char *program_name,
GFile *file,
GBytes *contents,
+ const char *language_id,
GError **error)
{
g_autoptr(IdeSubprocessLauncher) launcher = NULL;
@@ -217,7 +219,7 @@ setup_launcher:
G_SUBPROCESS_FLAGS_STDOUT_PIPE |
G_SUBPROCESS_FLAGS_STDERR_PIPE));
- IDE_DIAGNOSTIC_TOOL_GET_CLASS (self)->configure_launcher (self, launcher, file, contents);
+ IDE_DIAGNOSTIC_TOOL_GET_CLASS (self)->configure_launcher (self, launcher, file, contents, language_id);
g_assert (IDE_IS_SUBPROCESS_LAUNCHER (launcher));
@@ -368,6 +370,7 @@ ide_diagnostic_tool_create_launcher (IdeDiagnosticTool *self,
const char *program_name,
GFile *file,
GBytes *contents,
+ const char *language_id,
GError **error)
{
IdeSubprocessLauncher *ret;
@@ -378,7 +381,7 @@ ide_diagnostic_tool_create_launcher (IdeDiagnosticTool *self,
g_assert (program_name != NULL);
g_assert (!file || G_IS_FILE (file));
- ret = IDE_DIAGNOSTIC_TOOL_GET_CLASS (self)->create_launcher (self, program_name, file, contents, error);
+ ret = IDE_DIAGNOSTIC_TOOL_GET_CLASS (self)->create_launcher (self, program_name, file, contents,
language_id, error);
g_assert (!ret || IDE_IS_SUBPROCESS_LAUNCHER (ret));
@@ -457,15 +460,15 @@ ide_diagnostic_tool_diagnose_async (IdeDiagnosticProvider *provider,
g_assert (!file || G_IS_FILE (file));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
- IDE_TRACE_MSG ("Diagnosing %s...",
- G_OBJECT_TYPE_NAME (provider));
+ IDE_TRACE_MSG ("Diagnosing %s...", G_OBJECT_TYPE_NAME (provider));
+
+ task = ide_task_new (self, cancellable, callback, user_data);
+ ide_task_set_source_tag (task, ide_diagnostic_tool_diagnose_async);
+
state = g_slice_new0 (DiagnoseState);
state->file = file ? g_object_ref (file) : NULL;
state->stdin_bytes = IDE_DIAGNOSTIC_TOOL_GET_CLASS (self)->get_stdin_bytes (self, file, contents, lang_id);
-
- task = ide_task_new (self, cancellable, callback, user_data);
- ide_task_set_source_tag (task, ide_diagnostic_tool_diagnose_async);
ide_task_set_task_data (task, state, diagnose_state_free);
if (priv->program_name == NULL)
@@ -477,7 +480,7 @@ ide_diagnostic_tool_diagnose_async (IdeDiagnosticProvider *provider,
IDE_EXIT;
}
- if (!(launcher = ide_diagnostic_tool_create_launcher (self, priv->program_name, file, contents, &error)))
+ if (!(launcher = ide_diagnostic_tool_create_launcher (self, priv->program_name, file, contents, lang_id,
&error)))
{
ide_task_return_error (task, g_steal_pointer (&error));
IDE_EXIT;
diff --git a/src/libide/foundry/ide-diagnostic-tool.h b/src/libide/foundry/ide-diagnostic-tool.h
index ad8813313..b2891edc2 100644
--- a/src/libide/foundry/ide-diagnostic-tool.h
+++ b/src/libide/foundry/ide-diagnostic-tool.h
@@ -39,11 +39,13 @@ struct _IdeDiagnosticToolClass
const char *program_name,
GFile *file,
GBytes *contents,
+ const char *language_id,
GError **error);
void (*configure_launcher) (IdeDiagnosticTool *self,
IdeSubprocessLauncher *launcher,
GFile *file,
- GBytes *contents);
+ GBytes *contents,
+ const char *language_id);
GBytes *(*get_stdin_bytes) (IdeDiagnosticTool *self,
GFile *file,
GBytes *contents,
diff --git a/src/plugins/eslint/eslint_plugin.py b/src/plugins/eslint/eslint_plugin.py
index 073ba784c..84147815f 100644
--- a/src/plugins/eslint/eslint_plugin.py
+++ b/src/plugins/eslint/eslint_plugin.py
@@ -45,7 +45,7 @@ class ESLintDiagnosticProvider(Ide.DiagnosticTool):
self.set_bundled_program_path(BUNDLED_ESLINT)
self.set_local_program_path(os.path.join('node_modules', '.bin', 'eslint'))
- def do_configure_launcher(self, launcher, file, contents):
+ def do_configure_launcher(self, launcher, file, contents, language_id):
launcher.push_args(('-f', 'json',
'--ignore-pattern', '!node_modules/*',
'--ignore-pattern', '!bower_components/*'))
diff --git a/src/plugins/rstcheck/rstcheck_plugin.py b/src/plugins/rstcheck/rstcheck_plugin.py
index 4d016bcd6..44584d56b 100644
--- a/src/plugins/rstcheck/rstcheck_plugin.py
+++ b/src/plugins/rstcheck/rstcheck_plugin.py
@@ -18,7 +18,7 @@ class RstcheckDiagnosticProvider(Ide.DiagnosticTool):
super().__init__(*args, **kwargs)
self.set_program_name('rstcheck')
- def do_configure_launcher(self, launcher, file, contents):
+ def do_configure_launcher(self, launcher, file, contents, language_id):
# rstcheck - signifies that stdin will be used
launcher.push_argv('-')
diff --git a/src/plugins/rubocop/rubocop_plugin.py b/src/plugins/rubocop/rubocop_plugin.py
index d6df0779c..47dd2ed00 100644
--- a/src/plugins/rubocop/rubocop_plugin.py
+++ b/src/plugins/rubocop/rubocop_plugin.py
@@ -43,7 +43,7 @@ class RubocopDiagnosticProvider(Ide.DiagnosticTool):
super().__init__(*args, **kwargs)
self.set_program_name('rubocop')
- def do_configure_launcher(self, launcher, file, contents):
+ def do_configure_launcher(self, launcher, file, contents, language_id):
launcher.push_args(('--format', 'json'))
if contents is not None:
self.is_stdin = True
diff --git a/src/plugins/stylelint/stylelint_plugin.py b/src/plugins/stylelint/stylelint_plugin.py
index fdcbeef17..6e0967ff5 100644
--- a/src/plugins/stylelint/stylelint_plugin.py
+++ b/src/plugins/stylelint/stylelint_plugin.py
@@ -42,7 +42,7 @@ class StylelintDiagnosticProvider(Ide.DiagnosticTool):
self.set_program_name('stylelint')
self.set_local_program_path(os.path.join('node_modules', '.bin', 'stylelint'))
- def do_configure_launcher(self, launcher, file, contents):
+ def do_configure_launcher(self, launcher, file, contents, language_id):
launcher.push_args(('--formatter', 'json'))
if contents is not None:
launcher.push_args(('--stdin', '--stdin-filename=' + file.get_path()))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]