{"id":17807499,"url":"https://github.com/mblode/vscode-twig-language","last_synced_at":"2025-03-17T13:31:29.906Z","repository":{"id":92406274,"uuid":"109572762","full_name":"mblode/vscode-twig-language","owner":"mblode","description":"VS Code extension with snippets, syntax highlighting, hover, and formatting for Twig.","archived":false,"fork":false,"pushed_at":"2023-11-09T20:37:19.000Z","size":3732,"stargazers_count":42,"open_issues_count":27,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-28T00:36:31.304Z","etag":null,"topics":["twig","vscode-extension"],"latest_commit_sha":null,"homepage":"https://marketplace.visualstudio.com/items?itemName=mblode.twig-language","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mblode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":["mblode"]}},"created_at":"2017-11-05T11:18:27.000Z","updated_at":"2024-06-02T06:50:20.000Z","dependencies_parsed_at":"2023-11-07T03:34:02.735Z","dependency_job_id":null,"html_url":"https://github.com/mblode/vscode-twig-language","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblode%2Fvscode-twig-language","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblode%2Fvscode-twig-language/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblode%2Fvscode-twig-language/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblode%2Fvscode-twig-language/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mblode","download_url":"https://codeload.github.com/mblode/vscode-twig-language/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243864809,"owners_count":20360360,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["twig","vscode-extension"],"created_at":"2024-10-27T14:22:14.057Z","updated_at":"2025-03-17T13:31:29.500Z","avatar_url":"https://github.com/mblode.png","language":"JavaScript","funding_links":["https://github.com/sponsors/mblode"],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://marketplace.visualstudio.com/items?itemName=mblode.twig-language\"\u003e\n  \u003cimg src=\"https://github.com/mblode/vscode-twig-language/blob/master/images/icon.png?raw=true\" alt=\"\" width=100 height=100\u003e\n\u003c/a\u003e\n\n### VSCode Twig Language\n\n- Syntax highlighting\n- Snippets\n- Emmet\n- Pretty Diff Formatting\n- Hover\n- HTML intellisense\n\n## Installation\n\nInstall through Visual Studio Code extensions. Search for `Twig Language`\n\n[Visual Studio Code Market Place: Twig Language](https://marketplace.visualstudio.com/items?itemName=mblode.twig-language)\n\n## Documentation\n\nTwig Language is a Visual Studio Code extension that provides snippets, syntax highlighting, hover, and formatting for the Twig file format.\n\n### Twig syntax highlighting and language support\n\nThis extension provides language support for the Twig syntax.\n\n### Code formatter/beautifier for Twig files\n\nUsing PrettyDiff, this extension implements the only working code formatter for Twig files in VSCode.\n\n### Information about Twig code on hover\n\nVSCode Twig language shows information about the symbol/object that's below the mouse cursor when you hover within Twig files.\n\n### Craft CMS/Twig code snippets\n\nAdds a set of Craft CMS/Twig code snippets to use in your Twig templates.\n\n### Generic Triggers\n\n```twig\n\ndo                {% do ... %}\nextends           {% extends 'template' %}\nfrom              {% from 'template' import 'macro' %}\nimport            {% import 'template' as name %}\nimportself        {% import _self as name %}\ninc, include      {% include 'template' %}\nincp              {% include 'template' with params %}\ninckv             {% include 'template' with { key: value } %}\nuse               {% use 'template' %}\n\nautoescape        {% autoescape 'type' %}...{% endautoescape %}\nblock, blockb     {% block name %} ... {% endblock %}\nblockf            {{ block('...') }}\nembed             {% embed \"template\" %}...{% endembed %}\nfilter, filterb   {% filter name %} ... {% endfilter %}\nmacro             {% macro name(params) %}...{% endmacro %}\nset, setb         {% set var = value %}\nspaceless         {% spaceless %}...{% endspaceless %}\nverbatim          {% verbatim %}...{% endverbatim %}\n\nif, ifb           {% if condition %} ... {% endif %}\nife               {% if condition %} ... {% else %} ... {% endif %}\nfor               {% for item in seq %} ... {% endfor %}\nfore              {% for item in seq %} ... {% else %} ... {% endfor %}\n\nelse              {% else %}\nendif             {% endif %}\nendfor            {% endfor %}\nendset            {% endset %}\nendblock          {% endblock %}\nendfilter         {% endfilter %}\nendautoescape     {% endautoescape %}\nendembed          {% endembed %}\nendfilter         {% endfilter %}\nendmacro          {% endmacro %}\nendspaceless      {% endspaceless %}\nendverbatim       {% endverbatim %}\n\n```\n\n### Craft Triggers\n\n```twig\nasset                    craft.assets.one()\nassets, assetso          craft.assets loop\ncategories, categorieso  craft.categories loop\nentries, entrieso        craft.entries loop\nfeed                     craft.app.feeds.getFeedItems loop\nt                        | t\nreplace                  | replace('search', 'replace')\nreplacex                 | replace('/(search)/i', 'replace')\nsplit                    | split('\\n')\ntags, tagso              craft.tags loop\nusers, userso            craft.users loop\n\ncache                    {% cache %}...{% endcache %}\nchildren                 {% children %}\nexit                     {% exit 404 %}\nifchildren               {% ifchildren %}...{% endifchildren %}\ncss                      {% css %}...{% endcss %}\nregistercssfile          {% do view.registerCssFile(\"/resources/css/global.css\") %}\njs                       {% js %}...{% endjs %}\nregisterjsfile           {% do view.registerJsFile(\"/resources/js/global.js\") %}\nmatrix, matrixif         Basic Matrix field loop using if statements\nmatrixifelse             Basic Matrix field loop using if/elseif\nmatrixswitch             Basic Matrix field loop using switch\nnav                      {% nav item in items %}...{% endnav %}\npaginate                 Outputs example of pagination and prev/next links\nredirect                 {% redirect 'login' %}\nrequirelogin             {% requireLogin %}\nrequirepermission        {% requirePermission \"spendTheNight\" %}\nswitch                   {% switch variable %}...{% endswitch %}\n\ncsrf                     {{ csrfInput() }}\nendbody                  {{ endBody() }}\nhead                     {{ head() }}\n\ngetparam                 craft.app.request.getParam()\ngetbodyparam             craft.app.request.getBodyParam()\ngetqueryparam            craft.app.request.getQueryParam()\ngetsegment               craft.app.request.getSegment()\n\ncase                     {% case \"value\" %}\nendcache                 {% endcache %}\nendifchildren            {% endifchildren %}\nendcss                   {% endcss %}\nendjs                    {% endjs %}\nendnav                   {% endnav %}\n\nceil                     ceil()\nfloor                    floor()\nmax                      max()\nmin                      min()\nshuffle                  shuffle()\nrandom                   random()\nround                    num | round()\nurl, urla                url('path'), url('path', params, 'http', false)\n\nrss                      Example rss feed\n\ndd                       \u003cpre\u003e{{ dump() }}\u003c/pre\u003e{% exit %}\ndump                     \u003cpre\u003e{{ dump() }}\u003c/pre\u003e\n```\n\n### Example Forms\n\n```twig\n\nformlogin                Example login form\nformuserprofile          Example user profile form\nformuserregistration     Example user registration form\nformforgotpassword       Example forgot password form\nformsetpassword          Example set password form\nformsearch               Example search form\nformsearchresults        Example search form results\n\n```\n\n### Reference Hints\n\n```twig\n\ninfo            All craft.assets properties and template tags\ninfo            All craft.crategories properties and template tags\ninfo            All craft.config properties and template tags\ninfo            All craft.entries properties and template tags\ninfo            All craft.feeds properties and template tags\ninfo            All craft.fields properties and template tags\ninfo            All craft.globals properties and template tags\ninfo            All craft.request properties and template tags\ninfo            All craft.sections properties and template tags\ninfo            All craft.session properties and template tags\ninfo            All craft.tags properties and template tags\ninfo            All craft.users properties and template tags\ninfo            All craft globals (site info, date, users, template tags)\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblode%2Fvscode-twig-language","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmblode%2Fvscode-twig-language","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblode%2Fvscode-twig-language/lists"}