From b74a3858128fe839c0033948fe1f4c5d9b9b00da Mon Sep 17 00:00:00 2001 From: Tal Ben-Nun Date: Wed, 8 May 2024 10:48:48 -0700 Subject: [PATCH 1/3] Include tasklet contents in graph search --- src/renderer/renderer_elements.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) 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(); From 976a2708714f00e9bd7953d080d743210af40164 Mon Sep 17 00:00:00 2001 From: Tal Ben-Nun Date: Wed, 8 May 2024 10:50:56 -0700 Subject: [PATCH 2/3] Update sdfv.ts --- src/sdfv.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 + '"'); From c51b06070725312cc4c7721a7fbfce5c01049414 Mon Sep 17 00:00:00 2001 From: Tal Ben-Nun Date: Wed, 8 May 2024 11:09:26 -0700 Subject: [PATCH 3/3] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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",