Skip to content

Always collect templates for indexing, even if not at toplevel#206

Open
JonatanWaern wants to merge 1 commit intomainfrom
always-index-templates
Open

Always collect templates for indexing, even if not at toplevel#206
JonatanWaern wants to merge 1 commit intomainfrom
always-index-templates

Conversation

@JonatanWaern
Copy link
Contributor

Signed-off-by: Jonatan Waern jonatan.waern@intel.com

Copy link

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

This PR aims to ensure template declarations are collected for indexing even when they appear in non-toplevel (invalid) contexts, improving resilience and editor feedback in broken-syntax scenarios.

Changes:

  • Move template tracking into StatementSpec and add recursive gather_templates() to collect templates from nested statement specs.
  • Track templates encountered in invalid contexts during hash-if flattening (while still emitting an error).
  • Rename from_device_and_bases to templates_from_device_and_bases and update changelog.

Reviewed changes

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

File Description
src/analysis/structure/toplevel.rs Adds templates to StatementSpec, tracks templates during flattening, and provides recursive template gathering.
src/analysis/structure/objects.rs Adjusts scope collection to include template scopes from statement lists.
src/analysis/mod.rs Renames and updates template collection helper to use TopLevel::gather_templates().
CHANGELOG.md Documents the improved indexing behavior for templates in invalid contexts.

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

@JonatanWaern JonatanWaern force-pushed the always-index-templates branch from fe0dba3 to 9cca5ab Compare March 6, 2026 16:30
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
@JonatanWaern JonatanWaern force-pushed the always-index-templates branch from 9cca5ab to 165d00b Compare March 6, 2026 16:33
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