panoply / vscode-liquid

💧Liquid language support for VS Code
https://marketplace.visualstudio.com/items?itemName=sissel.shopify-liquid
Other
171 stars 23 forks source link

Translate filter autocompletions #164

Closed davidwarrington closed 11 months ago

davidwarrington commented 11 months ago

I may have raised it privately before, but it would be cool if on adding the t filter it would automatically populate tabstops for variables in that translation. For example if in my locales I have:

{
  "pagination": {
    "page_current_of_total": "Page {{ current }} of {{ total }}"
  }
}

When rendering the t/translate filter through intellisense it would render this, and there'd be tab stops for the variables

{{ 'pagination.page_current_of_total' | t: current: , total: }} 

Alternatively, after adding the colon after t if it automatically suggested variables parsed from the locale that would be cool

panoply commented 11 months ago

Still needs some work as only supporting single translation variable. I'll finish the rest tomorrow brother! I've updated the nightly. Report back if you find anything drastic and I'll patch when finalising and supporting multiple argument arguments.

This also includes the automatic | t insertion logic. Sorry it took me so long to apply.

https://github.com/panoply/vscode-liquid/assets/7041324/85fec55f-4797-4dc2-b342-f65d138e3ad1

panoply commented 11 months ago

🚢 in the nightly VSIX - Enjoy:

https://github.com/panoply/vscode-liquid/assets/7041324/84314a69-179c-41be-b4eb-ccfff1e9fd05