Skip to content

Add option to launch DevTools in the same Chrome window #1481

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

Merged
merged 4 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Remove dead code for reading `'dart.developer.registerExtension'` and
`'dart.developer.postEvent'` events from the chrome console. These messages
haven't been written to the console since dwds v11.1.0 and Dart SDK v2.14.0.
- Add an option to launch Dart DevTools in the same window as the connected Dart app.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is a breaking change, could you please move it to the section below and describe it as an additional parameter to dwds.start?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved it to the section below and updated the comment!


**Breaking changes:**

Expand Down
5 changes: 5 additions & 0 deletions dwds/lib/dwds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ class Dwds {
bool useSseForInjectedClient,
UrlEncoder urlEncoder,
bool spawnDds,
// TODO(elliette): DevTools is inconsistently capitalized throughout this
// file. Change all occurances of devtools/Devtools to devTools/DevTools.
bool enableDevtoolsLaunch,
DevtoolsLauncher devtoolsLauncher,
bool launchDevToolsInNewWindow,
Uri sdkDir,
Uri librariesPath,
bool emitDebugEvents,
Expand All @@ -123,6 +126,7 @@ class Dwds {
useSseForDebugBackend ??= true;
useSseForInjectedClient ??= true;
enableDevtoolsLaunch ??= true;
launchDevToolsInNewWindow ??= true;
spawnDds ??= true;
globalLoadStrategy = loadStrategy;
emitDebugEvents ??= true;
Expand Down Expand Up @@ -183,6 +187,7 @@ class Dwds {
expressionCompiler,
injected,
spawnDds,
launchDevToolsInNewWindow,
);

return Dwds._(
Expand Down
6 changes: 4 additions & 2 deletions dwds/lib/src/handlers/dev_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class DevHandler {
final bool _useSseForInjectedClient;
final bool _serveDevTools;
final bool _spawnDds;
final bool _launchDevToolsInNewWindow;
final ExpressionCompiler _expressionCompiler;
final DwdsInjector _injected;

Expand All @@ -87,7 +88,8 @@ class DevHandler {
this._serveDevTools,
this._expressionCompiler,
this._injected,
this._spawnDds) {
this._spawnDds,
this._launchDevToolsInNewWindow) {
_subs.add(buildResults.listen(_emitBuildResults));
_listen();
if (_extensionBackend != null) {
Expand Down Expand Up @@ -525,7 +527,7 @@ class DevHandler {
if (!_serveDevTools) return;
emitEvent(DwdsEvent.devtoolsLaunch());
await remoteDebugger.sendCommand('Target.createTarget', params: {
'newWindow': true,
'newWindow': _launchDevToolsInNewWindow,
'url': Uri(
scheme: 'http',
host: _devTools.hostname,
Expand Down