From 60af4ed7258f6cb2c7c7a464d929f61661fe0dea Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Fri, 10 Nov 2017 11:34:34 -0800 Subject: [PATCH] tweak the text for the "elements didn't reload" message (#12826) * tweak the text for the 'elements didnt reload' message * review comments * prefix items with a list char * add a hostIsIde param instead of the isDaemonMode top-level function * add a trailing comma --- .../lib/src/commands/daemon.dart | 1 + .../lib/src/resident_runner.dart | 2 +- packages/flutter_tools/lib/src/run_hot.dart | 22 +++++++++---------- packages/flutter_tools/lib/src/vmservice.dart | 6 ++--- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart index c47779845d..1996595e88 100644 --- a/packages/flutter_tools/lib/src/commands/daemon.dart +++ b/packages/flutter_tools/lib/src/commands/daemon.dart @@ -372,6 +372,7 @@ class AppDomain extends Domain { projectRootPath: projectRootPath, packagesFilePath: packagesFilePath, projectAssets: projectAssets, + hostIsIde: true, ); } else { runner = new ColdRunner( diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart index 1c7008e48b..6e6a8679fe 100644 --- a/packages/flutter_tools/lib/src/resident_runner.dart +++ b/packages/flutter_tools/lib/src/resident_runner.dart @@ -824,7 +824,7 @@ abstract class ResidentRunner { } class OperationResult { - OperationResult(this.code, this.message, [this.hint]); + OperationResult(this.code, this.message, { this.hint }); final int code; final String message; diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart index 79b93a7df2..9986ef670b 100644 --- a/packages/flutter_tools/lib/src/run_hot.dart +++ b/packages/flutter_tools/lib/src/run_hot.dart @@ -40,6 +40,7 @@ class HotRunner extends ResidentRunner { this.benchmarkMode: false, this.applicationBinary, this.previewDart2: false, + this.hostIsIde: false, String projectRootPath, String packagesFilePath, String projectAssets, @@ -54,6 +55,7 @@ class HotRunner extends ResidentRunner { stayResident: stayResident); final String applicationBinary; + final bool hostIsIde; Set _dartDependencies; final bool benchmarkMode; @@ -452,7 +454,7 @@ class HotRunner extends ResidentRunner { if (result.isOk) printStatus('${result.message} in ${getElapsedAsMilliseconds(timer.elapsed)}.'); if (result.hint != null) - printStatus(result.hint); + printStatus('\n${result.hint}'); return result; } catch (error) { status.cancel(); @@ -649,28 +651,24 @@ class HotRunner extends ResidentRunner { unusedElements.addAll(await unusedReport); if (unusedElements.isNotEmpty) { + final String restartCommand = hostIsIde ? '' : ' (by pressing "R")'; unusedElementMessage = - '\nThe following program elements were changed by the reload, ' - 'but did not run when the view was reassembled. If this code ' - 'only runs at start-up, you will need to restart ("R") for ' - 'the changes to have an effect.'; + 'Some program elements were changed during reload but did not run when the view was reassembled;\n' + 'you may need to restart the app$restartCommand for the changes to have an effect.'; for (ProgramElement unusedElement in unusedElements) { final String name = unusedElement.qualifiedName; final String path = _uriToRelativePath(unusedElement.uri); final int line = unusedElement.line; - String elementDescription; - if (line == null) - elementDescription = '$name ($path)'; - else - elementDescription = '$name ($path:$line)'; - unusedElementMessage += '\n - $elementDescription'; + final String description = line == null ? '$name ($path)' : '$name ($path:$line)'; + unusedElementMessage += '\n • $description'; } } } return new OperationResult( reassembleAndScheduleErrors ? 1 : OperationResult.ok.code, - reloadMessage, unusedElementMessage + reloadMessage, + hint: unusedElementMessage, ); } diff --git a/packages/flutter_tools/lib/src/vmservice.dart b/packages/flutter_tools/lib/src/vmservice.dart index 3227cc454f..703caf3a93 100644 --- a/packages/flutter_tools/lib/src/vmservice.dart +++ b/packages/flutter_tools/lib/src/vmservice.dart @@ -906,9 +906,9 @@ class HeapSpace extends ServiceObject { } } -// A function, field or class along with its source location. +/// A function, field or class along with its source location. class ProgramElement { - ProgramElement(this.qualifiedName, this.uri, this.line, this.column); + ProgramElement(this.qualifiedName, this.uri, [this.line, this.column]); final String qualifiedName; final Uri uri; @@ -1091,7 +1091,7 @@ class Isolate extends ServiceObjectOwner { } } } - return new ProgramElement(name, uri, null, null); + return new ProgramElement(name, uri); } // Lists program elements changed in the most recent reload that have not