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 all 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
2 changes: 2 additions & 0 deletions dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
- Add `emitDebugEvents` argument to `Dwds.start` to suppress emitting debug
events from the injected client.
- Replace `sdkRoot` parameter by `sdkDir` in `ExpressionCompilerService`.
- Adds an additional parameter to launch Dart DevTools in the same window as
the connected Dart app.

## 11.5.1

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