Skip to content

Commit dd6c2df

Browse files
stephanjclaude
andcommitted
fix: restore ExternalPromptService.setPromptText lost in dead-code refactor
Commit 36da0c2 (2026-02-20) removed setPromptText(String):boolean from ExternalPromptService, treating it as dead code. It is not dead — it is the public reflection-based API that SonarLint calls to power the "Fix with DevoxxGenie" button. Its removal caused a silent NoSuchMethodException, making the button appear to do nothing. Restored: - `project` field stored in constructor (needed to open tool window) - `promptInputArea` field in setPromptInputArea (needed for immediate text setting) - `setPromptText(String):boolean` — opens tool window, sets text or buffers as pendingText Also added prominent Javadoc on both ExternalPromptService.setPromptText and ExternalTaskService.createBacklogTask marking them NOT DEAD CODE and referencing their SonarLint callers (DevoxxGenieBridge, CreateDevoxxGenieTasksFromNodeAction). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f0a25c8 commit dd6c2df

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

src/main/java/com/devoxx/genie/service/ExternalPromptService.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.devoxx.genie.ui.component.input.PromptInputArea;
44
import com.intellij.openapi.project.Project;
5+
import com.intellij.openapi.wm.ToolWindowManager;
56
import org.jetbrains.annotations.NotNull;
67
import org.jetbrains.annotations.Nullable;
78

@@ -11,21 +12,45 @@
1112
*/
1213
public class ExternalPromptService {
1314

15+
private final @NotNull Project project;
16+
private @Nullable PromptInputArea promptInputArea;
1417
private @Nullable String pendingText;
1518

1619
public ExternalPromptService(@NotNull Project project) {
20+
this.project = project;
1721
}
1822

1923
public static ExternalPromptService getInstance(@NotNull Project project) {
2024
return project.getService(ExternalPromptService.class);
2125
}
2226

2327
public void setPromptInputArea(@Nullable PromptInputArea promptInputArea) {
28+
this.promptInputArea = promptInputArea;
2429
if (promptInputArea != null && pendingText != null) {
2530
String text = pendingText;
2631
pendingText = null;
2732
promptInputArea.setText(text);
2833
promptInputArea.requestInputFocus();
2934
}
3035
}
36+
37+
/**
38+
* Sets prompt text in the DevoxxGenie chat input and opens the tool window.
39+
*
40+
* THIS METHOD IS NOT DEAD CODE. It is the public integration API called by
41+
* external plugins (e.g. SonarLint) via runtime reflection. Removing it
42+
* silently breaks the "Fix with DevoxxGenie" button.
43+
*
44+
* @see org.sonarlint.intellij.integration.DevoxxGenieBridge (SonarLint plugin caller)
45+
*/
46+
public boolean setPromptText(@NotNull String text) {
47+
ToolWindowManager.getInstance(project).getToolWindow("DevoxxGenie").show(null);
48+
if (promptInputArea != null) {
49+
promptInputArea.setText(text);
50+
promptInputArea.requestInputFocus();
51+
} else {
52+
pendingText = text;
53+
}
54+
return true;
55+
}
3156
}

src/main/java/com/devoxx/genie/service/ExternalTaskService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ public static ExternalTaskService getInstance(@NotNull Project project) {
3131
/**
3232
* Creates a backlog task. Initializes the backlog if needed.
3333
* Returns the created task ID (e.g., "TASK-5").
34+
*
35+
* THIS METHOD IS NOT DEAD CODE. It is the public integration API called by
36+
* external plugins (e.g. SonarLint) via runtime reflection. Removing it
37+
* silently breaks the "Create DevoxxGenie Tasks" action.
38+
*
39+
* @see org.sonarlint.intellij.actions.CreateDevoxxGenieTasksFromNodeAction (SonarLint plugin caller)
3440
*/
3541
public String createBacklogTask(String title, String description,
3642
String priority, List<String> labels) throws IOException {

0 commit comments

Comments
 (0)