Unverified Commit 60af4ed7 authored by Devon Carew's avatar Devon Carew Committed by GitHub

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
parent f993cc36
...@@ -372,6 +372,7 @@ class AppDomain extends Domain { ...@@ -372,6 +372,7 @@ class AppDomain extends Domain {
projectRootPath: projectRootPath, projectRootPath: projectRootPath,
packagesFilePath: packagesFilePath, packagesFilePath: packagesFilePath,
projectAssets: projectAssets, projectAssets: projectAssets,
hostIsIde: true,
); );
} else { } else {
runner = new ColdRunner( runner = new ColdRunner(
......
...@@ -824,7 +824,7 @@ abstract class ResidentRunner { ...@@ -824,7 +824,7 @@ abstract class ResidentRunner {
} }
class OperationResult { class OperationResult {
OperationResult(this.code, this.message, [this.hint]); OperationResult(this.code, this.message, { this.hint });
final int code; final int code;
final String message; final String message;
......
...@@ -40,6 +40,7 @@ class HotRunner extends ResidentRunner { ...@@ -40,6 +40,7 @@ class HotRunner extends ResidentRunner {
this.benchmarkMode: false, this.benchmarkMode: false,
this.applicationBinary, this.applicationBinary,
this.previewDart2: false, this.previewDart2: false,
this.hostIsIde: false,
String projectRootPath, String projectRootPath,
String packagesFilePath, String packagesFilePath,
String projectAssets, String projectAssets,
...@@ -54,6 +55,7 @@ class HotRunner extends ResidentRunner { ...@@ -54,6 +55,7 @@ class HotRunner extends ResidentRunner {
stayResident: stayResident); stayResident: stayResident);
final String applicationBinary; final String applicationBinary;
final bool hostIsIde;
Set<String> _dartDependencies; Set<String> _dartDependencies;
final bool benchmarkMode; final bool benchmarkMode;
...@@ -452,7 +454,7 @@ class HotRunner extends ResidentRunner { ...@@ -452,7 +454,7 @@ class HotRunner extends ResidentRunner {
if (result.isOk) if (result.isOk)
printStatus('${result.message} in ${getElapsedAsMilliseconds(timer.elapsed)}.'); printStatus('${result.message} in ${getElapsedAsMilliseconds(timer.elapsed)}.');
if (result.hint != null) if (result.hint != null)
printStatus(result.hint); printStatus('\n${result.hint}');
return result; return result;
} catch (error) { } catch (error) {
status.cancel(); status.cancel();
...@@ -649,28 +651,24 @@ class HotRunner extends ResidentRunner { ...@@ -649,28 +651,24 @@ class HotRunner extends ResidentRunner {
unusedElements.addAll(await unusedReport); unusedElements.addAll(await unusedReport);
if (unusedElements.isNotEmpty) { if (unusedElements.isNotEmpty) {
final String restartCommand = hostIsIde ? '' : ' (by pressing "R")';
unusedElementMessage = unusedElementMessage =
'\nThe following program elements were changed by the reload, ' 'Some program elements were changed during reload but did not run when the view was reassembled;\n'
'but did not run when the view was reassembled. If this code ' 'you may need to restart the app$restartCommand for the changes to have an effect.';
'only runs at start-up, you will need to restart ("R") for '
'the changes to have an effect.';
for (ProgramElement unusedElement in unusedElements) { for (ProgramElement unusedElement in unusedElements) {
final String name = unusedElement.qualifiedName; final String name = unusedElement.qualifiedName;
final String path = _uriToRelativePath(unusedElement.uri); final String path = _uriToRelativePath(unusedElement.uri);
final int line = unusedElement.line; final int line = unusedElement.line;
String elementDescription; final String description = line == null ? '$name ($path)' : '$name ($path:$line)';
if (line == null) unusedElementMessage += '\n$description';
elementDescription = '$name ($path)';
else
elementDescription = '$name ($path:$line)';
unusedElementMessage += '\n - $elementDescription';
} }
} }
} }
return new OperationResult( return new OperationResult(
reassembleAndScheduleErrors ? 1 : OperationResult.ok.code, reassembleAndScheduleErrors ? 1 : OperationResult.ok.code,
reloadMessage, unusedElementMessage reloadMessage,
hint: unusedElementMessage,
); );
} }
......
...@@ -906,9 +906,9 @@ class HeapSpace extends ServiceObject { ...@@ -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 { class ProgramElement {
ProgramElement(this.qualifiedName, this.uri, this.line, this.column); ProgramElement(this.qualifiedName, this.uri, [this.line, this.column]);
final String qualifiedName; final String qualifiedName;
final Uri uri; final Uri uri;
...@@ -1091,7 +1091,7 @@ class Isolate extends ServiceObjectOwner { ...@@ -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 // Lists program elements changed in the most recent reload that have not
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment