Skip to content

Commit 407a850

Browse files
authored
Add option to launch DevTools in the same Chrome window (#1481)
1 parent 784fc6e commit 407a850

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

dwds/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
- Add `emitDebugEvents` argument to `Dwds.start` to suppress emitting debug
2020
events from the injected client.
2121
- Replace `sdkRoot` parameter by `sdkDir` in `ExpressionCompilerService`.
22+
- Adds an additional parameter to launch Dart DevTools in the same window as
23+
the connected Dart app.
2224

2325
## 11.5.1
2426

dwds/lib/dwds.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,11 @@ class Dwds {
110110
bool useSseForInjectedClient,
111111
UrlEncoder urlEncoder,
112112
bool spawnDds,
113+
// TODO(elliette): DevTools is inconsistently capitalized throughout this
114+
// file. Change all occurances of devtools/Devtools to devTools/DevTools.
113115
bool enableDevtoolsLaunch,
114116
DevtoolsLauncher devtoolsLauncher,
117+
bool launchDevToolsInNewWindow,
115118
Uri sdkDir,
116119
Uri librariesPath,
117120
bool emitDebugEvents,
@@ -123,6 +126,7 @@ class Dwds {
123126
useSseForDebugBackend ??= true;
124127
useSseForInjectedClient ??= true;
125128
enableDevtoolsLaunch ??= true;
129+
launchDevToolsInNewWindow ??= true;
126130
spawnDds ??= true;
127131
globalLoadStrategy = loadStrategy;
128132
emitDebugEvents ??= true;
@@ -183,6 +187,7 @@ class Dwds {
183187
expressionCompiler,
184188
injected,
185189
spawnDds,
190+
launchDevToolsInNewWindow,
186191
);
187192

188193
return Dwds._(

dwds/lib/src/handlers/dev_handler.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class DevHandler {
6363
final bool _useSseForInjectedClient;
6464
final bool _serveDevTools;
6565
final bool _spawnDds;
66+
final bool _launchDevToolsInNewWindow;
6667
final ExpressionCompiler _expressionCompiler;
6768
final DwdsInjector _injected;
6869

@@ -87,7 +88,8 @@ class DevHandler {
8788
this._serveDevTools,
8889
this._expressionCompiler,
8990
this._injected,
90-
this._spawnDds) {
91+
this._spawnDds,
92+
this._launchDevToolsInNewWindow) {
9193
_subs.add(buildResults.listen(_emitBuildResults));
9294
_listen();
9395
if (_extensionBackend != null) {
@@ -525,7 +527,7 @@ class DevHandler {
525527
if (!_serveDevTools) return;
526528
emitEvent(DwdsEvent.devtoolsLaunch());
527529
await remoteDebugger.sendCommand('Target.createTarget', params: {
528-
'newWindow': true,
530+
'newWindow': _launchDevToolsInNewWindow,
529531
'url': Uri(
530532
scheme: 'http',
531533
host: _devTools.hostname,

0 commit comments

Comments
 (0)