Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include tasklet contents in graph search #145

Merged
merged 3 commits into from
May 8, 2024
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
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;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space is probably not necessary

}

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
Loading