theme-tools icon indicating copy to clipboard operation
theme-tools copied to clipboard

`Unknown object` warnings for global Liquid objects in editor when using `{% doc %}` tag

Open royvn opened this issue 8 months ago • 3 comments

Description:

When using the Liquid {% doc %} tag in a .liquid snippet, a warning is generated for global objects. For example the section object.

Warning: Unknown object ‘section’ used.

Steps to Reproduce:

  1. Use the {% doc %} tag syntax in a .liquid snippet file.
  2. Observe the warning message in Cursor / Visual Studio Code.

Expected Behavior:

The {% doc %} tag should not give warnings for global available liquid objects.

Actual Behavior:

A warning is shown for section, predictive_search and more.

Warning: Unknown object ‘section’ used.

Additional Context:

This may indicate that the {% doc %} tag does not correctly recognize global objects when used inside snippet files.

Image

I tried adding and passing the global object to the doc declaration and snippet, but that doesn’t solve the issue because the parameter name conflicts with a built-in Liquid tag. That error is good and makes sense.

The parameter 'section' shares the same name with a liquid tag.

Image

royvn avatar May 14 '25 08:05 royvn

Could this be prioritized? We're having a lot of pollution warnings due to this.

bakura10 avatar Jul 11 '25 01:07 bakura10

My workaround for now is using something like this @bakura10

{%- doc -%}
  @description Example

  @param {section} section_object
{%- enddoc -%}

{{ section_object }}

royvn avatar Jul 11 '25 11:07 royvn

Same goes for "form" and "paginate"

MarkRijkelijkhuizen avatar Aug 05 '25 13:08 MarkRijkelijkhuizen