Skip to content

Commit

Permalink
Merge pull request #145 from spcl/tbennun-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
tbennun authored May 8, 2024
2 parents 8941e11 + c51b060 commit 8a5d446
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
11 changes: 11 additions & 0 deletions src/renderer/renderer_elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<TaskletCodeToken> = new Set();
public readonly outputTokens: Set<TaskletCodeToken> = new Set();
Expand Down
6 changes: 3 additions & 3 deletions src/sdfv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 + '"');
Expand Down

0 comments on commit 8a5d446

Please sign in to comment.