Skip to content

Auto-closing for Liquid delimiters {{, {%, {{-, {%- #42

@RomainDW

Description

@RomainDW

Description

Typing Liquid delimiters does not auto-close them properly. Currently, typing {{ produces {{} with the cursor between the second { and the }, which is incorrect. The extension should auto-close all Liquid delimiters with their proper closing counterparts and position the cursor conveniently.

Expected behavior

Typed Result Cursor position (shown as )
{{ {{ ▌ }} Centered with spaces
{{- {{- ▌ -}} Centered with spaces
{% {% ▌ %} Centered with spaces
{%- {%- ▌ -%} Centered with spaces

The cursor should be placed in the middle with a space on each side, ready for the user to type the expression or tag name.

Actual behavior

Typing {{ produces {{} — it appears the editor treats { as a bracket that should be auto-closed with }, but it doesn't recognize {{ as a Liquid delimiter pair. The result is a malformed output with the cursor in the wrong position.

Steps to reproduce

  1. Open any .liquid file in Zed
  2. Type {{
  3. Observe the result is {{} instead of {{ ▌ }}
  4. Same issue occurs with {%

Additional context

This is a very common quality-of-life feature in other editors with Liquid support (e.g., VS Code with the Shopify Liquid extension). Proper auto-closing of Liquid delimiters significantly improves the development experience, as these are typed hundreds of times per day during theme development.

Suggested implementation

Zed supports bracket pair configuration in language extensions. The following pairs should be configured:

  • {{ / }}
  • {% / %}
  • {{- / -}}
  • {%- / -%}

With auto-inserted spaces around the cursor position for each pair.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions