Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import '../../shared/framework/routing.dart';
import '../../shared/globals.dart';
import '../../shared/managers/notifications.dart';
import '../../shared/primitives/history_manager.dart';
import '../../shared/primitives/utils.dart';
import '../../shared/ui/search.dart';
import '../../shared/utils/utils.dart';
import '../vm_developer/vm_service_private_extensions.dart';
Expand Down Expand Up @@ -419,12 +420,11 @@ class CodeViewController extends DisposableController
return [];
}
final matches = <SourceToken>[];
final caseInsensitiveSearch = search.toLowerCase();

final currentScript = parsedScript.value!;
for (int i = 0; i < currentScript.lines.length; i++) {
final line = currentScript.lines[i].toLowerCase();
final matchesForLine = caseInsensitiveSearch.allMatches(line);
final line = currentScript.lines[i];
final matchesForLine = search.caseInsensitiveAllMatches(line);
if (matchesForLine.isNotEmpty) {
matches.addAll(
matchesForLine.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ class TracedClass with PinnableListEntry, Serializable {
'${clazz.name} instances: $instances trace: $traceAllocations';
}

// TODO(kenz): include the selected class in the toJson and fromJson methods.
@visibleForTesting
enum TracingIsolateStateJson { isolate, classes, profiles }
enum TracingIsolateStateJson { isolate, classes, profiles, selectedClass }

/// Contains allocation tracing state for a single isolate.
///
Expand All @@ -107,6 +106,9 @@ class TracingIsolateState with Serializable {
this.classes = classes ?? [];
classesById = {for (final e in this.classes) e.clazz.id!: e};
this.profiles = profiles ?? {};
if (selectedClass != null) {
this.selectedClass.value = classesById[selectedClass];
}
}

TracingIsolateState.empty() : this(isolate: IsolateRef());
Expand All @@ -125,6 +127,8 @@ class TracingIsolateState with Serializable {
classes: (json[TracingIsolateStateJson.classes.name] as List)
.map((e) => deserialize<TracedClass>(e, TracedClass.fromJson))
.toList(),
selectedClass:
json[TracingIsolateStateJson.selectedClass.name] as String?,
);
}

Expand All @@ -134,6 +138,9 @@ class TracingIsolateState with Serializable {
TracingIsolateStateJson.isolate.name: isolate,
TracingIsolateStateJson.classes.name: classesById.values.toList(),
TracingIsolateStateJson.profiles.name: profiles,
if (selectedClass.value != null)
TracingIsolateStateJson.selectedClass.name:
selectedClass.value!.clazz.id!,
};
}

Expand Down
2 changes: 0 additions & 2 deletions packages/devtools_app/lib/src/shared/primitives/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -945,8 +945,6 @@ extension NullableStringExtension on String? {
}

// TODO(kenz): consider moving other String helpers into this extension.
// TODO(kenz): replace other uses of toLowerCase() for string matching with
// this extension method.
extension StringExtension on String {
bool caseInsensitiveContains(Pattern? pattern) {
if (pattern is RegExp) {
Expand Down
3 changes: 1 addition & 2 deletions packages/devtools_app/lib/src/shared/ui/search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1248,10 +1248,9 @@ class _AutoCompleteSearchFieldState extends State<AutoCompleteSearchField>
String? foundExact;

// What the user has typed in so far.
final searchToMatch = widget.controller.search.toLowerCase();
// Find exact match in autocomplete list - use that as our search value.
for (final autoEntry in widget.controller.searchAutoComplete.value) {
if (searchToMatch == autoEntry.text.toLowerCase()) {
if (autoEntry.text.caseInsensitiveEquals(widget.controller.search)) {
foundExact = autoEntry.text;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,13 @@ class _VMFlagsDialogState extends State<VMFlagsDialog> with AutoDisposeMixin {
}

void _refilter() {
final filter = filterController.text.trim().toLowerCase();
final filter = filterController.text.trim();

filteredFlags = filter.isEmpty
? flags
: flags.where((flag) => flag.filterText.contains(filter)).toList();
: flags
.where((flag) => flag.filterText.caseInsensitiveContains(filter))
.toList();
}

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ class _SimulatedApi extends StatelessWidget {
label: 'FORCE RELOAD',
onPressed: simController.forceReload,
),
// TODO(kenz): add buttons for other simulated events as the extension
// API expands.
],
),
const SizedBox(height: defaultSpacing),
Expand Down
2 changes: 0 additions & 2 deletions packages/devtools_shared/lib/src/server/server_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import 'devtools_store.dart';
import 'file_system.dart';
import 'flutter_store.dart';

// TODO(kenz): consider using Dart augmentation libraries instead of part files
// if there is a clear benefit.
part 'handlers/_app_size.dart';
part 'handlers/_deeplink.dart';
part 'handlers/_devtools_extensions.dart';
Expand Down
Loading