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

Support HTML attribute auto-completion

Open aswamy opened this issue 1 year ago • 0 comments

What are you adding in this PR?

  • Support HTML attribute auto-completion
  • Override entire attribute even if the cursor is in the middle of the attribute
  • Add ="" at the end of an attribute with a value
  • Allow attribute completion when cursor is not on any character
  • NOTE: Does NOT replace Liquid Code when auto-completing HTML attribute
    • Why? This seems like one of those trade-offs where we could try to parse the string and assume the whole attribute (including any liquid code) is part of the tag, but we'd be overriding code which i assume isn't what the developer wants. If they really wish to remove the liquid code, they must do so manually.

What we support

before code completion after code completion (once you select it from dropdown)
<a hr█ <a href=""
<button disab█ <button disabled
<a █ <a href=""
<button s█tyle="" <button spellcheck=""
<button d█ata--{{ echo "demo" }}="" <button dir{{ echo "demo" }}=""

What did you learn?

  • Edges and tradeoffs on what to support and what to ignore 🤕

Before you deploy

  • [x] I included a minor bump changeset

aswamy avatar Oct 03 '24 22:10 aswamy