Update netlist search to include scope path parameter#178
Update netlist search to include scope path parameter#178DGGua wants to merge 5 commits intoLramseyer:mainfrom
Conversation
There was a problem hiding this comment.
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
searchnetlistexport to accept ascopepathparameter 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.
| 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(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.
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.