vscode-antlers-language-server icon indicating copy to clipboard operation
vscode-antlers-language-server copied to clipboard

FR: Add @param comment syntax in template IDE hints

Open mikemartin opened this issue 3 years ago • 3 comments

I've been experimenting with a convention for props in Antlers partials using the view frontmatter. It would be useful to extend templates IDE hints with a comment syntax like the example below.

{{ partial:button type="primary" size="large" }}

{{#
   @name Button
   @param bool someBool This is just a normal parameter that'd show up in auto-complete.
   @param @from view:types type The button type.
   @param @from view:sizes size The button size.
#}}
---
classes: 'flex w-full sm:inline-flex items-center justify-center py-2 px-4 rounded-full border border-transparent text-base font-medium focus:outline-none focus:ring-4 focus:ring-opacity-50'
sizes:
  large: 'sm:text-lg sm:py-3 sm:px-5'
types:
  primary: 'text-white bg-primary-500 hover:bg-primary-400 focus:ring-primary-600'
  secondary: 'text-secondary-900 bg-secondary-100 hover:bg-secondary-50 focus:ring-secondary-200 dark:text-white dark:bg-secondary-800 dark:hover:bg-secondary-700 dark:focus:ring-secondary-900'
  disabled: 'text-gray-400 bg-gray-200 dark:text-white dark:bg-secondary-800 dark:opacity-75 cursor-not-allowed'
---

<button type=submit"
class="{{ view }}{{ classes }} {{ sizes[size] }} {{ types[type] }}{{/view}}">...</button>

mikemartin avatar May 20 '21 12:05 mikemartin