Skip to content

fix(parser): preserve Jinja templates in SQL extraction#445

Merged
teunbrand merged 2 commits into
posit-dev:mainfrom
dataders:fix-jinja-boundary-extraction
May 13, 2026
Merged

fix(parser): preserve Jinja templates in SQL extraction#445
teunbrand merged 2 commits into
posit-dev:mainfrom
dataders:fix-jinja-boundary-extraction

Conversation

@dataders
Copy link
Copy Markdown
Contributor

@dataders dataders commented May 8, 2026

Summary

  • Treat dbt-style Jinja templates as opaque SQL-side parser tokens
  • Preserve {{ ref(...) }} in SQL extraction before VISUALISE splitting
  • Add tree-sitter corpus coverage and a Rust source-tree regression test

Validation

  • npx tree-sitter test
  • cargo test -p ggsql parser::source_tree::tests

dataders and others added 2 commits May 8, 2026 17:21
Treat dbt-style Jinja templates as opaque SQL-side parser tokens so SQL extraction keeps refs intact before VISUALISE splitting.

Tests:

- npx tree-sitter test

- cargo test -p ggsql parser::source_tree::tests

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dataders dataders marked this pull request as ready for review May 9, 2026 00:54
@thomasp85 thomasp85 requested a review from teunbrand May 12, 2026 13:26
Copy link
Copy Markdown
Collaborator

@teunbrand teunbrand left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for the contribution!

A few notes for myself in the future:

  • 'jinja_template' is named after most dominant use of {{-templates
  • the inline piece hides the source_ref from the tree and will display its children directly

@teunbrand teunbrand merged commit 8f608c5 into posit-dev:main May 13, 2026
2 checks passed
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