Skip to content

Update netlist search to include scope path parameter#178

Open
DGGua wants to merge 5 commits intoLramseyer:mainfrom
DGGua:main
Open

Update netlist search to include scope path parameter#178
DGGua wants to merge 5 commits intoLramseyer:mainfrom
DGGua:main

Conversation

@DGGua
Copy link
Copy Markdown
Contributor

@DGGua DGGua commented Apr 9, 2026

As mentioned in #177, Modify the search logic:

  • When the search target is set to module, a new search box will be opened to perform further searches under the selected module until a signal is selected.

  • The search results are modified to display all signals/modules (default: global scope) that contain the search string within the current module. The search is performed using a breadth‑first approach.

  • Shorten the path displayed in search results by removing the prefix of the module where the search occurred.

image

Note: I am not a Rust programmer. The Rust code was written with the assistance of AI. I have reviewed the code to the best of my ability, a double‑check would be appreciated.

Any feedback or ideas regarding the search logic or related areas are welcome.

Copilot AI review requested due to automatic review settings April 9, 2026 14:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the netlist search API and UI to support scoped (module-relative) searching, enabling multi-step drill-down into modules and shortening displayed paths in results (per #177).

Changes:

  • Extend the WASM/WIT searchnetlist export to accept a scopepath parameter in addition to the query.
  • Rework Rust-side netlist searching to support scoped breadth-first traversal and scope navigation.
  • Update the VS Code QuickPick flow to support multi-step searches (module selection → search within module) and display relative instance paths.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
wit/filehandler.wit Changes searchnetlist signature to include scopepath.
src/lib.rs Implements scoped/BFS netlist search and updates WASM guest export signature.
src/extension_core/wasm_handler.ts Passes scopePath through to the WASM search API.
src/extension_core/surfer_handler.ts Passes scopePath through to the WASM search API.
src/extension_core/fsdb_handler.ts Updates interface signature (still stubbed).
src/extension_core/document.ts Adds scoped multi-step QuickPick search UI and relative-path display.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +947 to +952
let lower_path = scopepath.to_lowercase();
let path_segments: Vec<&str> = lower_path.split(".").collect();

let mut current_scopes: Vec<&Scope> = hierarchy.iter_scopes()
.filter(|s| s.name(hierarchy).to_string().to_lowercase() == path_segments[0])
.collect();
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

path_segments[0] is used to seed scope navigation without guarding against an empty first segment (e.g. scopePath like ".foo" or just "."). That won't panic, but it will silently return empty results because it searches for scopes with an empty name. Consider validating scopepath by trimming leading/trailing dots and filtering out empty segments before traversal, returning empty_result for invalid paths.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants