Skip to content

Commit

Permalink
feat: User inputs in console of debug view should be propagated to bu…
Browse files Browse the repository at this point in the history
…ild process
  • Loading branch information
wglanzer committed Mar 29, 2024
1 parent 632a372 commit d3e5b1d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Added

- User inputs in console of debug view should be propagated to build process, in order to enable e.g. "s" or "q" commands to work correctly

## [1.3.1] - 2023-08-04

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import io.conceptive.quarkus.plugin.util.ForwardProcessListener;
import org.jetbrains.annotations.*;

import java.io.OutputStream;
import java.util.*;
import java.util.function.Supplier;

Expand Down Expand Up @@ -43,7 +44,7 @@ public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner)
{
// Create the default ExecutionResult, so we can connect to the remote debug state
ConsoleViewImpl consoleView = new ConsoleViewImpl(project, false);
RemoteDebugProcessHandler process = new RemoteDebugProcessHandler(project, restart);
RemoteDebugProcessHandler process = new QuarkusDebugProcessHandler(project, restart, buildProcessHandler);
consoleView.attachToProcess(process);
ExecutionResult execute = new DefaultExecutionResult(consoleView, process);

Expand Down Expand Up @@ -86,6 +87,28 @@ private void _onProcessHandlerCreated(@NotNull ProcessHandler pBuildProcessHandl
invalidationRunnables.add(() -> pDebugProcessHandler.removeProcessListener(debugProcessListener));
}

/**
* ProcessHandler, that delegates its input to the outter build process handler
*/
private static class QuarkusDebugProcessHandler extends RemoteDebugProcessHandler
{
private final ProcessHandler buildProcHandler;

public QuarkusDebugProcessHandler(@NotNull Project project, boolean autoRestart, @Nullable ProcessHandler pBuildProcessHandler)
{
super(project, autoRestart);
buildProcHandler = pBuildProcessHandler;
}

@Override
public OutputStream getProcessInput()
{
if (buildProcHandler == null)
return super.getProcessInput();
return buildProcHandler.getProcessInput();
}
}

/**
* Listener to hear on readiness of the debug config.
* It first waits for the startNotified() command from the ProcessListener, then for processAttached() on the debugProcess
Expand Down

0 comments on commit d3e5b1d

Please sign in to comment.