diff --git a/package.json b/package.json index a30931ca..94434e86 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@spcl/sdfv", - "version": "1.2.3", + "version": "1.2.4", "description": "A standalone viewer for SDFGs", "homepage": "https://github.com/spcl/dace-webclient", "main": "out/index.js", diff --git a/src/renderer/renderer_elements.ts b/src/renderer/renderer_elements.ts index b37909db..dde9836f 100644 --- a/src/renderer/renderer_elements.ts +++ b/src/renderer/renderer_elements.ts @@ -213,6 +213,11 @@ export class SDFGElement { return this.data.label; } + // Text used for matching the element during a search + public text_for_find(): string { + return this.label(); + } + // Produces HTML for a hover-tooltip public tooltip(container: HTMLElement): void { container.className = 'sdfvtooltip'; @@ -2182,6 +2187,12 @@ export class Tasklet extends SDFGNode { this.highlightCode(); } + public text_for_find(): string { + // Include code when searching + const code = this.attributes().code.string_data; + return this.label() + " " + code; + } + private highlightedCode: TaskletCodeToken[][] = []; public readonly inputTokens: Set = new Set(); public readonly outputTokens: Set = new Set(); diff --git a/src/sdfv.ts b/src/sdfv.ts index f79411e6..9bba2783 100644 --- a/src/sdfv.ts +++ b/src/sdfv.ts @@ -772,10 +772,10 @@ export function find_in_graph( query = query.toLowerCase(); find_in_graph_predicate( sdfv, renderer, sdfg, (graph: DagreGraph, element: SDFGElement) => { - let label = element.label(); + let text = element.text_for_find(); if (!case_sensitive) - label = label.toLowerCase(); - return label.indexOf(query) !== -1; + text = text.toLowerCase(); + return text.indexOf(query) !== -1; } ); sdfv.sidebar_set_title('Search Results for "' + query + '"');