Shopify / Shopify/theme-tools

Typing `/` after a `<` when we know the tag isn't closed should close the open tag.

Open
#505 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
234
Forks
92
Avg merge
1d 3h
Merged PRs (30d)
6

Description

Is your feature request related to a problem? Please describe.
This is a followup of https://github.com/Shopify/theme-tools/pull/501#discussion_r1777602887

It seems like the HTML Language Server also does html/autoInsert when typing / after a <.

Describe the solution you'd like

  • If the user types / after a < and we know that it's safe to close a tag that currently is opened without child, then we should complete it.
  • We shouldn't close tags that are already opened, don't want duplicate close tags (no <div></div></div> pls)

We might be smart and do a "smart edit of the file", pass it through the parser and verify for a LiquidHTMLASTParsing error like we do for the > case.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the discussion in pull request 501 and the existing HTML Language Server handling for html/autoInsert when typing / after <. Trace the parser validation used for the > case, including LiquidHTMLASTParsing errors. Done means safely completing an unclosed tag without adding duplicate closing tags.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.