Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>DrupalNew to Visual Studio Code? Get it now.

Drupal

Stanislav Romanov

|
549 installs
| (1) | Free
A Drupal extension for VS Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

VSCode Drupal

This extension supports only Drupal projects which use composer template drupal/recommended-project.

Features

  • syntax highlighting
  • hook completion
  • twig completion
  • service completion
  • global variables completion
  • code checking Drupal coding standards (used phpcs, coder)
  • document formatting by standards (used phpcbf)
  • searching in Drupal API Documentation
  • translation autocomplete (php, twig, yml, js)
  • validation and autocomplete for YAML files

Experimental features

  • PHPStan analysis (used PHPStan, phpstan-drupal)

The experimental features turned off by default. But you can turn them on in the extension settings.

Install

Code checking and formatting require the following packages:

composer require --dev squizlabs/php_codesniffer drupal/coder

PHPStan analysis requires the following packages:

composer require --dev phpstan/phpstan phpstan/extension-installer phpstan/phpstan-deprecation-rules mglaman/phpstan-drupal

Package paths can be specified in the extension settings.

For YAML files, the YAML extension must be installed.

Demo

Hook completion

hook

Code checking and formatting

phpcs

Translation autocomplete

translates

Drupal Search API

search

TODO

  • Autogeneration PO files
  • Twig local variable completion
  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft