-
Notifications
You must be signed in to change notification settings - Fork 401
Hide extension button when embedded in an IDE #9956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
johnpryan
wants to merge
10
commits into
flutter:master
Choose a base branch
from
johnpryan:fix-8507
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
810a2f0
Hide the extension settings action when DevTools is running in an IDE.
johnpryan 7e235a2
Ensure that the extensions action is displayed when showing an
johnpryan 2fc3298
Replace https://flutter.dev/ with a data placeholder in
johnpryan 0f4a7f9
Add debugging devtools extensions skill
johnpryan 61fb530
add to release notes
johnpryan cbdb186
format
johnpryan 23674f1
Apply suggestions from code review
johnpryan 5d06a2d
Use OS-based browser opening commands
johnpryan 5dd83be
Refactor HTML into a function
johnpryan 24155f9
remove embedMode information from skill, since it's unrelated
johnpryan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| --- | ||
| name: debugging-devtools-extensions | ||
| description: Guidelines and step-by-step workflow for debugging DevTools extensions locally, including stub mode, fixed-port launching, browser auto-opening, URL query parameters, target app connection, and human-in-the-loop interaction. Use when debugging or testing DevTools extension behavior. | ||
| --- | ||
|
|
||
| # Debugging DevTools Extensions | ||
|
|
||
| Follow this workflow to test and debug DevTools extensions locally. | ||
|
|
||
| ## 1. Local Stub Extensions Mode (No Server Needed) | ||
|
|
||
| When running DevTools in standalone web mode (`flutter run -d chrome`), DevTools does not run the `devtools_server` backend by default. To test extensions without a running server backend: | ||
|
|
||
| 1. Open [`packages/devtools_app/lib/src/shared/development_helpers.dart`](file:///Users/ryjohn/code/github/flutter/devtools/packages/devtools_app/lib/src/shared/development_helpers.dart#L57). | ||
| 2. Set `const _debugDevToolsExtensions = true;`. | ||
|
|
||
| > [!WARNING] | ||
| > Never commit `_debugDevToolsExtensions = true;` to git. A repository unit test (`development_helpers_test.dart`) enforces that this flag remains `false`. | ||
|
|
||
| Activating stub mode registers the following mock extensions: | ||
| - `foo_ext` (`package:foo`) | ||
| - `bar_ext` (`package:bar`) | ||
| - `provider_ext` (`package:provider`) | ||
|
|
||
| ## 2. Automated Launch & Browser Navigation | ||
|
|
||
| The agent can automate running DevTools AND launching the browser directly to the target URL: | ||
|
|
||
| ### Step 2a: Launch DevTools on a Fixed Port | ||
| In `packages/devtools_app`, launch DevTools specifying a fixed `--web-port`: | ||
| ```bash | ||
| flutter run -d chrome --web-port=52941 | ||
| ``` | ||
|
|
||
| ### Step 2b: Open Browser to Target URL Automatically | ||
| Use the system OS open command to launch Chrome/browser directly to the desired test URL: | ||
|
|
||
| - **macOS**: `open "http://localhost:52941/foo_ext?embedMode=one"` | ||
| - **Linux**: `xdg-open "http://localhost:52941/foo_ext?embedMode=one"` | ||
| - **Windows**: `start "http://localhost:52941/foo_ext?embedMode=one"` | ||
|
|
||
| ## 3. Connecting to an End-User Target App | ||
|
|
||
| To test against real pub package extensions: | ||
|
|
||
| 1. Run the sample app in `packages/devtools_extensions/example/app_that_uses_foo`: | ||
| ```bash | ||
| cd packages/devtools_extensions/example/app_that_uses_foo | ||
| flutter run -d chrome | ||
| ``` | ||
| 2. Ask the user to copy/paste the VM Service URI from the terminal output (e.g. `ws://127.0.0.1:8181/xxx=/ws`). | ||
| 3. Open the browser automatically with the `uri` parameter using the appropriate OS command (as described in Step 2b): | ||
| - **macOS**: `open "http://localhost:52941/foo_ext?embedMode=one&uri=<VM_SERVICE_URI>"` | ||
| - **Linux**: `xdg-open "http://localhost:52941/foo_ext?embedMode=one&uri=<VM_SERVICE_URI>"` | ||
| - **Windows**: `start "http://localhost:52941/foo_ext?embedMode=one&uri=<VM_SERVICE_URI>"` | ||
|
|
||
| ## 4. Human Interaction & User Prompting Steps | ||
|
|
||
| When an AI agent is performing this workflow: | ||
|
|
||
| - **Obtaining VM Service URI**: When connecting to a target app, ask the user to provide the VM Service URI printed in the target app's console output (using `ask_question` or a direct prompt). | ||
| - **Automated Browser Opening**: The agent should launch DevTools and execute the appropriate OS command (`open`, `xdg-open`, or `start` as described in Step 2b) to launch the browser automatically. | ||
| - **Manual Visual Verification**: Ask the user to inspect the opened browser window and confirm whether the expected extension UI or behavior is visible. |
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you put this into a named bool variable? The
showExtensionSettingsassignment is hard to parse now with so many conditions