Skip to content

Conversation

@shoplando
Copy link
Contributor

@shoplando shoplando commented Oct 8, 2025

What are you adding in this PR?

Solves #827
Added completion support for inline snippets in the render tag. Now when using the {% render %} tag, the language server will suggest both file-based snippets and inline snippets defined within the same file. Inline snippets are displayed with a helpful documentation note indicating they are "defined in this file".

What's next? Any followup issues?

  • I included a minor bump changeset
  • My feature is backward compatible

@shoplando shoplando mentioned this pull request Oct 8, 2025
2 tasks
Copy link
Contributor Author

shoplando commented Oct 8, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@shoplando shoplando marked this pull request as ready for review October 8, 2025 13:42
@shoplando shoplando requested a review from a team as a code owner October 8, 2025 13:42
@shoplando shoplando force-pushed the render-autocomplete-inline-snippet branch 4 times, most recently from 1cabd73 to bcee95e Compare October 8, 2025 20:34
@shoplando shoplando force-pushed the introduce-doc-tag-inside-snippet-tag branch from a47fc50 to 391578c Compare October 8, 2025 20:34
@shoplando shoplando force-pushed the render-autocomplete-inline-snippet branch from bcee95e to 692492c Compare October 9, 2025 15:36
@shoplando shoplando changed the base branch from introduce-doc-tag-inside-snippet-tag to graphite-base/1068 October 9, 2025 15:52
@shoplando shoplando changed the base branch from graphite-base/1068 to add-doc-tag-snippet-support October 9, 2025 15:52
@shoplando shoplando changed the base branch from add-doc-tag-snippet-support to graphite-base/1068 October 9, 2025 17:52
@shoplando shoplando force-pushed the render-autocomplete-inline-snippet branch from 692492c to 3e5b8a1 Compare October 9, 2025 17:55
@shoplando shoplando changed the base branch from graphite-base/1068 to add-doc-tag-snippet-support October 9, 2025 17:55
@shoplando shoplando force-pushed the render-autocomplete-inline-snippet branch from 3e5b8a1 to 599e439 Compare October 9, 2025 17:57
@shoplando shoplando force-pushed the add-doc-tag-snippet-support branch 2 times, most recently from 2b6b68c to 984c187 Compare October 9, 2025 18:32
@shoplando shoplando force-pushed the render-autocomplete-inline-snippet branch from 599e439 to 1da6cbe Compare October 9, 2025 18:32
@shoplando shoplando force-pushed the add-doc-tag-snippet-support branch from 984c187 to 80f1e20 Compare October 14, 2025 14:03
@shoplando shoplando force-pushed the render-autocomplete-inline-snippet branch from 1da6cbe to 122e6f8 Compare October 14, 2025 14:03
Copy link
Contributor

@aswamy aswamy left a comment

Choose a reason for hiding this comment

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

Minor comments, but overall looks great! 🥳

@shoplando shoplando force-pushed the render-autocomplete-inline-snippet branch 2 times, most recently from 1751d79 to 4467ee0 Compare October 14, 2025 20:06
@shoplando shoplando force-pushed the add-doc-tag-snippet-support branch from 80f1e20 to 61e1110 Compare October 14, 2025 22:43
@shoplando shoplando force-pushed the render-autocomplete-inline-snippet branch 2 times, most recently from 5b21535 to e008de5 Compare October 15, 2025 14:36
@shoplando shoplando force-pushed the add-doc-tag-snippet-support branch from 61e1110 to 61afe9c Compare October 15, 2025 14:36
@shoplando shoplando force-pushed the render-autocomplete-inline-snippet branch 2 times, most recently from 5f6220f to cef145f Compare October 16, 2025 15:38
@shoplando shoplando force-pushed the add-doc-tag-snippet-support branch 2 times, most recently from 24dbcf0 to 6465a20 Compare October 16, 2025 17:53
@shoplando shoplando force-pushed the render-autocomplete-inline-snippet branch 2 times, most recently from 50eaabe to aa24f09 Compare October 16, 2025 18:42
@shoplando shoplando force-pushed the add-doc-tag-snippet-support branch from 6465a20 to 0263556 Compare October 16, 2025 18:42
Copy link
Contributor

@dejmedus dejmedus left a comment

Choose a reason for hiding this comment

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

Looks great to me! I left you a question about nested snippets but its not blocking

🎩 Image

}
}

function getInlineSnippetsNames(ast: LiquidHtmlNode): string[] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Another scope/nesting question: do we want to limit the options to "current level" snippets? For example, should the below only offer header_inner?

example Image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oooh yeah you're right! Thanks for catching that 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now I'm wondering if we should include it in other snippets? ie:

image.png

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah this is tricky, hi-snip could be passed in via render to hi-snip-2, but should tooling expect that? Maybe we could just limit completion to prevent a snippet being offered inside itself and leave the rest as is?

@aswamy do you think that would make sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could just limit completion to prevent a snippet being offered inside itself and leave the rest as is?

I think you're right. For simplicity, we should only offer code completion to things that are explicitly defined within the snippet.

This includes ALL variables. The reason is that we aren't sure how the snippet is rendered, which can get very confusing.

@shoplando shoplando force-pushed the add-doc-tag-snippet-support branch from 0263556 to 9366de6 Compare October 21, 2025 20:24
@shoplando shoplando force-pushed the render-autocomplete-inline-snippet branch 2 times, most recently from 85ae0e5 to ba844e6 Compare October 22, 2025 16:34
@shoplando shoplando force-pushed the add-doc-tag-snippet-support branch from 9366de6 to b4049b2 Compare October 22, 2025 16:34
@shoplando shoplando force-pushed the render-autocomplete-inline-snippet branch 2 times, most recently from 3886acb to 59eb787 Compare October 22, 2025 20:15
@shoplando shoplando force-pushed the render-autocomplete-inline-snippet branch from 59eb787 to 791ddf5 Compare October 22, 2025 20:32
@shoplando shoplando added the #gsd: 48097 Inline Snippets label Oct 29, 2025 — with Graphite App
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd: 48097 Inline Snippets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants