{"id":15378655,"url":"https://github.com/andy-blum/drupal-smart-snippets","last_synced_at":"2025-12-11T22:06:12.880Z","repository":{"id":56608042,"uuid":"301043296","full_name":"andy-blum/drupal-smart-snippets","owner":"andy-blum","description":"This extension adds rich language support for Drupal Hooks, Services, and Render Elements to VS Code.","archived":false,"fork":false,"pushed_at":"2025-02-28T16:42:06.000Z","size":6417,"stargazers_count":21,"open_issues_count":5,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T13:44:28.719Z","etag":null,"topics":["drupal","hacktoberfest","snippets","vscode-extension"],"latest_commit_sha":null,"homepage":"https://marketplace.visualstudio.com/items?itemName=andrewdavidblum.drupal-smart-snippets","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/andy-blum.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-04T05:02:05.000Z","updated_at":"2024-10-25T01:08:54.000Z","dependencies_parsed_at":"2023-01-29T15:31:15.296Z","dependency_job_id":"b83ab980-efdf-4613-b26e-51ad96e04547","html_url":"https://github.com/andy-blum/drupal-smart-snippets","commit_stats":{"total_commits":70,"total_committers":3,"mean_commits":"23.333333333333332","dds":0.4,"last_synced_commit":"67ab1ae98b7224093418ff44616084dd973cc091"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andy-blum%2Fdrupal-smart-snippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andy-blum%2Fdrupal-smart-snippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andy-blum%2Fdrupal-smart-snippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andy-blum%2Fdrupal-smart-snippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andy-blum","download_url":"https://codeload.github.com/andy-blum/drupal-smart-snippets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248991516,"owners_count":21194893,"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":["drupal","hacktoberfest","snippets","vscode-extension"],"created_at":"2024-10-01T14:16:25.473Z","updated_at":"2025-12-11T22:06:12.870Z","avatar_url":"https://github.com/andy-blum.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Visual Studio Code Smart Drupal Snippets\n\nThis extension adds rich language support for the\n[Drupal Hooks API](https://api.drupal.org/api/drupal/core%21core.api.php/group/hooks) and [Drupal Form and render elements](https://api.drupal.org/api/drupal/elements)\nto VS Code. This extension is intended as a successor to\n[Drupal 8 Snippets](https://marketplace.visualstudio.com/items?itemName=dssiqueira.drupal-8-snippets).\n\n# Usage \u0026 Features\nType part of a snippet, press enter and/Or tab, and the snippet unfolds.\n\n## Built from Drupal Core\nHooks gathered by scraping the codebase of the latest minor versions of Drupal 9. This includes those that are marked as deprecated.\n\n## Smart hook replacement\nSnippets will automatically replace the leading `hook` with the current file's name.\n\n![Gif showing usage of hook_views_data snippet](https://raw.githubusercontent.com/andy-blum/smart-drupal-snippets/main/images/views_data.gif)\n\n## Smart element replacement\nSnippets will automatically render the element array base on RenderElement or FormElement. Start by typing `@RenderElement`, `@FormElement`, `@Element` or the `[type_name]` itself.\n\nFormElement will have `#title`, `#title_display`, `#description` and `#required` properties by default. Additional properties listed on docblock is generated automatically.\n\n### @FormElement\n![Gif showing usage of form element snippet](images/form_element_snippet.gif)\n\n### @RenderElement\n![Gif showing usage of render element snippet](images/render_element_snippet.gif)\n\n### @Element\n![Gif showing usage of form/render element snippet](images/element_prefix.gif)\n\n### Typing [type_name]\n![Gif showing usage of element type snippet](images/element_type.gif)\n\n## Smart service snippet\nWhile services with global methods allow IDEs to suggest methods and properties, those retrieved using the \\Drupal::service() method do not. Service snippets provide a easy access to all core services in a datatyped variable allowing intellisense suggestions.\n\n### Services without datatyping\n![Gif showing intellisense results to un-typed variables](images/services_without_snippets.gif)\n\n### Services with datatyping\n![Gif showing intellisense results to typed variables](images/services_with_snippets.gif)\n\n### Deprecated services\n![Gif showing deprecation of a service](images/services_deprecated.gif)\n\n## Tab Stops\nSnippets are formatted to have tab stops on values that need replaced like `HOOK`,\n`ENTITY_TYPE`, `BASE_FORM_ID`, etc.\n\n### Hook Replacement\n![Gif showing usage of hook_preprocess_HOOK snippet](https://raw.githubusercontent.com/andy-blum/smart-drupal-snippets/main/images/preprocess.gif )\n\n### Element Replacement\nFormElement have `#title`, `#title_display` ([providing default options](https://www.drupal.org/docs/drupal-apis/form-api/form-render-elements)), `#description`, `#required` (*TRUE* or *FALSE*) and final ending option of comma `','` or semi-colon `';'` as deafult tab stops.\n![Gif showing usage of element snippet tab stops](images/element_tabstop_options.gif)\n\n### Services\nServices snippets provide a snake-cased, tab-stopped variable matching the service's name. On snippet insertion, the variable can be overwritten easily.\n\n# Installation\n\n1. Open VS Code\n2. From the command palette `Ctrl-Shift-P` (Windows, Linux) or `Cmd-Shift-P` (OSX)\n3. Select Install Extension\n4. Search by `Drupal Smart Snippets`\n5. Click install\n6. Reload Visual Studio Code\n\n# Contributions\nThis project is maintained on\n[Github](https://github.com/andy-blum/smart-drupal-snippets).\n\nYour bugs, feature requests, and pull requests are welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandy-blum%2Fdrupal-smart-snippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandy-blum%2Fdrupal-smart-snippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandy-blum%2Fdrupal-smart-snippets/lists"}