Skip to content

Latest commit

 

History

History
118 lines (83 loc) · 3.96 KB

File metadata and controls

118 lines (83 loc) · 3.96 KB

Symfony Language Tools Documentation

Symfony Language Tools brings Symfony-specific features to your editor: completion, hover, navigation, references, rename and diagnostics for routes, services, templates, translations and more. It implements the Language Server Protocol, so its Symfony features are independent of any particular editor, and it runs alongside a general PHP language server instead of replacing it.

Setting Up Your Editor

Start with the page for your editor. Each page covers installation, configuration and troubleshooting, and all editors expose the same Symfony language features:

  • VS Code: install the Symfony Language Tools extension from the Marketplace. It bundles the language server, so no separate download is needed;
  • Neovim: install the server with Mason or from a standalone release, then enable it through nvim-lspconfig.

Any other editor with a Language Server Protocol client can run the standalone server: see installing a release below and configure your client to start symfony-lsp.

Features

Symfony Language Tools understands routing, dependency injection, Twig templates, translations, environment variables, bundle configuration, Messenger, events, security, form and validation metadata, AssetMapper, Stimulus and Doctrine. Each integration page documents its supported declarations, references and Language Server Protocol capabilities. See the supported integrations for the complete feature matrix.

Requirements

The language server supports the maintained Symfony versions listed in Symfony's release metadata. Your application must have its Composer dependencies installed and provide a PHP command compatible with its Symfony version.

Installing a Standalone Release

The VS Code extension bundles the language server, so this section only applies to other editors. Download the archive for your platform from the GitHub release:

  • linux-x64 or linux-arm64;
  • macos-x64 or macos-arm64;
  • windows-x64.

Extract the archive and keep symfony-lsp and symfony-lsp-tree-sitter in the same directory. On Windows, both files have an .exe suffix.

The release also contains SHA256SUMS. Verify the archive checksum before running it.

Verify the Unix executable before configuring an editor:

$ ./symfony-lsp --version

The macOS binaries aren't signed or notarized. If macOS quarantines an archive downloaded from the release, remove the quarantine attribute from the extracted directory after verifying where the archive came from:

$ xattr -dr com.apple.quarantine /path/to/symfony-lsp-v0.8.5-macos-arm64

Run ./symfony-lsp without arguments to start the Language Server Protocol connection over standard input and standard output.

Upgrading

Download the new archive for the same platform, stop the editor client and replace both executables together. Verify the installed version, then restart or reload the editor:

$ ./symfony-lsp --version

The first workspace initialization after an upgrade rebuilds the project index.

Installing the Server from Source

Source installations require PHP 8.4.1 or later and Composer 2. Clone this repository outside the Symfony application that you want to edit. Install the server dependencies and build the bundled Twig and YAML parser extension:

$ composer install
$ composer tree-sitter:build

The development executable is bin/symfony-lsp. It automatically loads the locally built parser extension on Unix systems. Verify that it starts:

$ ./bin/symfony-lsp --version