Skip to content

Analysis: Collect what state a template depends on - #2187

Merged
marcoroth merged 1 commit into
language-service-references-providerfrom
analysis-dependency-tracking
Aug 11, 2026
Merged

Analysis: Collect what state a template depends on#2187
marcoroth merged 1 commit into
language-service-references-providerfrom
analysis-dependency-tracking

Conversation

@marcoroth

@marcoroth marcoroth commented Aug 11, 2026

Copy link
Copy Markdown
Owner

This pull request adds the per-template half of dependency tracking, which is reading a template to find out what it depends on.

collectTemplateDependencies answers, for one template, which instance variables and constants it reads, which locals it declares and receives, which templates it renders and with what, and which calls are helpers as opposed to names nobody has accounted for.

collectTemplateDependencies(Herb, "app/views/posts/show.html.erb", source)
// {
//   instanceVariables: ["@post"],
//   constants: ["Current.user"],
//   localsDeclared: [],
//   localsReceived: { title: "@post.title" },
//   renderCalls: [{ partial: "shared/header", locals: { title: "@post.title" } }],
//   helperCalls: ["link_to", "render"],
//   unknownCalls: ["current_user"],
// }

This is the input to working out what a change invalidates. On its own it also answers questions the linter already asks in more roundabout ways.

Follow up on #1667

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

🌿 Interactive Playground and Documentation Preview

A preview deployment has been built for this pull request. Try out the changes live in the interactive playground:


🌱 Grown from commit 2c2f589


✅ Preview deployment has been cleaned up.

@pkg-pr-new

pkg-pr-new Bot commented Aug 11, 2026

Copy link
Copy Markdown
npx https://pkg.pr.new/@herb-tools/formatter@2187
npx https://pkg.pr.new/@herb-tools/language-server@2187
npx https://pkg.pr.new/@herb-tools/linter@2187

commit: 2c2f589

@marcoroth
marcoroth marked this pull request as ready for review August 11, 2026 17:45
@marcoroth
marcoroth merged commit 0f4cc5f into main Aug 11, 2026
23 checks passed
@marcoroth
marcoroth deleted the analysis-dependency-tracking branch August 11, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

analysis typescript TypeScript source across the javascript/ packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant