Show Run window during run mode in 2026.1#8985
Open
helin24 wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the launch process to support background hot reload and hot restart in Run mode by establishing a VM service connection while rendering a standard Run console instead of the debug UI. The reviewer provided valuable feedback, including a correction to ensure debugger panels are properly suppressed in non-DEBUG and non-RUN modes (like PROFILE or COVERAGE), a performance optimization to cache the named tab support check, and a logic improvement to only add reload/restart actions if the launch mode supports them.
This change cleanly routes the Flutter app console to the native Run tool window when running in "Run" mode (not debugging), while still starting a headless debug session in the background to support Hot Reload. We achieve this by: 1. Muting the debug tab in the Debug window via XDebugSessionBuilder.showTab(false) in Run mode. 2. Returning a standard run descriptor via RunContentBuilder in LaunchState.launch() for Run mode. 3. Manually injecting the Reload and Restart actions directly into this Run console toolbar. 4. Overriding XDebugProcess.createConsole() to return a dummy console in Run mode, completely avoiding a Swing parent hierarchy conflict (which previously caused a blank console). 5. Skipping deprecated suppressDebugViews calls in sessionInitialized() when the new reflective hooks are active to avoid platform warnings. TAG=agy CONV=fccd665d-3066-4b89-92ff-553454d58b2f
…stant access Since the validation of the experimental builder hooks is computed once during class load, we expose the cached USE_NAMED_TAB boolean directly as a public static final constant and remove the redundant useNamedTab() getter method. TAG=agy CONV=fccd665d-3066-4b89-92ff-553454d58b2f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8890
This change routes the Flutter app console to the native Run tool window when running in "Run" mode (not debugging), while still starting a headless debug session in the background to support Hot Reload.
We achieve this by:
I'm pasting a description of the run and debug lifecycle below, in case this is helpful context for any future changes.
Step-by-Step Lifecycle Description
1. Shared Startup Phase
No matter which button the user clicks, the plugin first prepares the environment:
FlutterApp.start()is invoked. It creates theMostlySilentColoredProcessHandlerwhich wraps the nativefluttercommand line.DaemonApi.listen(process, listener)is called. This registers the JSON parser to handle the stdin/stdout streams of the process. Crucially,process.startNotify()is not called yet.setUpConsoleAndActions(app)creates theDaemonConsoleViewand attaches it to the process. It also prepares the toolbar actions (like DevTools).2. Debug Workflow Lifecycle
If the user clicked "Debug":
XDebugSessionBuilder.showTab(true)on the session builder.XDebuggerManager.startSessionis called.showTabistrue, the platform createsXDebugSessionTaband automatically registers it with the Debug Tool Window (ToolWindowId.DEBUG). This opens the Debug window and shows the debugger panels (Variables, Frames, Threads) alongside the Console.XDebuggerManagerImplcallsprocessHandler.startNotify(). This boots the OS process.scheduleConnect()) detects the VM Service URI printed by the process and connects the debugger.3. Run Workflow Lifecycle
If the user clicked "Run" (which still needs a headless debug connection for Hot Reload):
XDebugSessionBuilder.showTab(false)on the builder.XDebuggerManager.startSessionis called.showTabisfalse, the platform enters a headless path.XDebugSessionTabUI and does not open the Debug tool window.processHandler.startNotify()insideXDebuggerManager.LaunchState.launch(), the plugin discards the headless debug descriptor. Instead, it passes the consoleExecutionResulttoRunContentBuilder(result, env).showRunContent()."Run"executor, it registers the console tab with the Run Tool Window (ToolWindowId.RUN).LaunchState.launch()returns this native Run descriptor to the platformExecutionManager.startNotify: The platformExecutionManagerrenders the tab in the Run tool window and callsprocessHandler.startNotify(). This boots the OS process exactly once.scheduleConnect()) connects the debugger silently in the background. The user gets their console and Hot Reload buttons in the Run window, while the Debug window remains completely closed.