{"id":17807505,"url":"https://github.com/mblode/vscode-twig-language-2","last_synced_at":"2025-03-17T13:31:29.830Z","repository":{"id":28841197,"uuid":"118214859","full_name":"mblode/vscode-twig-language-2","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:50.000Z","size":394,"stargazers_count":59,"open_issues_count":57,"forks_count":27,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-28T00:36:26.590Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://marketplace.visualstudio.com/items?itemName=mblode.twig-language-2","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":"2018-01-20T06:11:52.000Z","updated_at":"2025-01-30T21:23:43.000Z","dependencies_parsed_at":"2023-11-03T23:45:13.695Z","dependency_job_id":null,"html_url":"https://github.com/mblode/vscode-twig-language-2","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-2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblode%2Fvscode-twig-language-2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblode%2Fvscode-twig-language-2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblode%2Fvscode-twig-language-2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mblode","download_url":"https://codeload.github.com/mblode/vscode-twig-language-2/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":[],"created_at":"2024-10-27T14:22:15.428Z","updated_at":"2025-03-17T13:31:29.429Z","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-2\"\u003e\n  \u003cimg src=\"https://github.com/mblode/vscode-twig-language-2/blob/master/images/icon.png?raw=true\" alt=\"\" width=100 height=100\u003e\n\u003c/a\u003e\n\n\u003ch1\u003eVS Code Twig Language 2 👋\u003c/h1\u003e\n\n\u003cp\u003e\n  \u003cimg src=\"https://img.shields.io/badge/version-0.8.8-blue.svg?cacheSeconds=2592000\" /\u003e\n  \u003ca href=\"https://github.com/mblode/vscode-twig-language-2/graphs/commit-activity\"\u003e\n    \u003cimg alt=\"Maintenance\" src=\"https://img.shields.io/badge/Maintained%3F-yes-green.svg\" target=\"_blank\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/mblode/vscode-twig-language-2/blob/master/LICENSE.md\"\u003e\n    \u003cimg alt=\"License: MIT\" src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" target=\"_blank\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n- Syntax highlighting\n- Snippets\n- Emmet\n- Pretty Diff 3 Formatting\n- Hover\n\n## What has changed since version 1?\n\nThis extension does **not** have HTML Intellisense. If you need HTML Intellisense (which can be quite useful), please download my other Twig Language extension: https://github.com/mblode/vscode-twig-language.\n\nI have created a new extension to fix the issues that I (and all of you) were having with file association, commenting and VS Code UI issues.\n\nSimply add these lines to your VS Code settings to get emmet working and also to associate HTML files as twig syntax.\n\n```\n\"files.associations\": {\n    \"*.html\": \"twig\"\n},\n\"emmet.includeLanguages\": {\n    \"twig\": \"html\"\n},\n```\n\n## Installation\n\nInstall through Visual Studio Code extensions. Search for `Twig Language 2`\n\n[Visual Studio Code Market Place: Twig Language 2](https://marketplace.visualstudio.com/items?itemName=mblode.twig-language-2)\n\n## Configuration\n\nRestart VS Code after making changes to Twig Language 2 extension settings.\n\n## Documentation\n\nTwig Language 2 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 VS Code.\n\n### Information about Twig code on hover\n\nVS Code Twig language 2 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\n## Author\n\n👤 **Matthew Blode**\n\n* Github: [@mblode](https://github.com/mblode)\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome !\u003cbr /\u003eFeel free to check [issues page](https://github.com/mblode/vscode-twig-language-2/issues).\n\n## Show your support\n\nGive a ⭐️ if this project helped you !\n\n## 📝 License\n\nCopyright © 2019 [Matthew Blode](https://github.com/mblode).\u003cbr /\u003e\nThis project is [MIT](https://github.com/mblode/vscode-twig-language-2/blob/master/LICENSE.md) licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblode%2Fvscode-twig-language-2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmblode%2Fvscode-twig-language-2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblode%2Fvscode-twig-language-2/lists"}