SC Symfony Plugin
A VS Code extension that speeds up Symfony development with code navigation, autocompletion and a unified search across routes, PHP classes, Twig templates and filters, translations, configuration and services.
Features
Unified Search
Ctrl+Shift+Alt+S (Cmd+Shift+Alt+S on macOS) opens a single fuzzy search panel over everything the extension indexes:
| Icon |
Item |
Opens |
| 🔗 |
Routes (name, URL, controller) |
the controller method |
| ◇ |
PHP classes, test classes flagged with a test icon |
the class file (including vendor/) |
| ▤ |
Twig templates |
the template |
| 🌐 |
Translation keys |
the translation file, at the key |
| ⚙ |
Configuration keys (framework.cache.prefix…) |
the YAML file, at the key |
| ✓ |
Services (class or alias target, tags) |
services.yaml, at the definition |
Route Navigation & Autocompletion
Ctrl+Click on route names in PHP and Twig files to jump directly to the controller method:
// PHP — works with redirectToRoute(), generate(), generateUrl()
return $this->redirectToRoute('app_user_show', ['id' => $user->getId()]);
{# Twig — works with path() and url() #}
<a href="{{ path('app_user_show', { id: user.id }) }}">Profile</a>
Route name autocompletion while typing — suggestions include the route path and the controller method.
Twig Filter & Function Navigation
Ctrl+Click on any filter or function in a Twig file to jump to its PHP source:
{{ value | snake_case }} {# Ctrl+Click on snake_case → opens extension class #}
{{ asset(path) }} {# Ctrl+Click on asset → opens Twig extension #}
Autocompletion for filters and functions while typing after | or inside {{ }}.
Twig Templates
Ctrl+Click on template paths to open the template:
return $this->render('user/profile.html.twig');
// ^^^^^^^^^^^^^^^^^^^^^^^^ Ctrl+Click → opens the file
{% extends 'base.html.twig' %} {# Ctrl+Click → opens base.html.twig #}
{% include 'partials/header.html.twig' %} {# also works with use and embed #}
Autocompletion for template paths in ->render() calls, #[Template(...)] attributes and Twig inheritance tags.
Translations
Autocompletion for translation keys in Twig ('key'|trans) and PHP (->trans('key')), and Ctrl+Click on a key to open the translation file at that key. Keys are read from translations/*.yaml, by domain and locale.
Configuration
Autocompletion of configuration keys in config/**/*.yaml: the extension infers the current section from indentation and suggests the keys already used in your other config files (e.g. framework: → secret, cache, …).
YAML files using Symfony tags (!tagged_iterator, !php/const, !service…) are supported.
PHPUnit Mock Method Navigation & Autocompletion
Ctrl+Click on method names inside ->method() in tests to jump to the actual method definition:
$mock = $this->createMock(UserRepository::class);
$mock->method('findById') // Ctrl+Click → jumps to UserRepository::findById()
->willReturn($user);
Autocompletion for method names based on the mocked class, including inherited methods from parent classes and interfaces.
Requirements
- VS Code 1.110+
- A Symfony project: the extension activates when the workspace contains
bin/console or symfony.lock
- Multi-root workspaces are supported: every folder containing
bin/console or symfony.lock is indexed separately, navigation uses the project of the current file, and the unified search shows all projects
- Routes are read from Symfony's compiled cache (
var/cache/*/url_matching_routes.php): load the app once or run bin/console cache:warmup so the file exists
Commands & Shortcuts
| Shortcut |
Command |
Action |
Ctrl+Shift+Alt+S / Cmd+Shift+Alt+S |
Symfony: Search Routes/Classes/Twig |
Open the unified search |
| — |
Symfony: Refresh Index |
Re-index the project |
Ctrl+Shift+Alt+R / Cmd+Shift+Alt+R |
Symfony: Force Reload (clear cache) |
Clear caches and re-index |
| — |
Symfony: Show Logs |
Open the extension logs (Output panel) |
Ctrl+Click |
— |
Go to definition (routes, filters, templates, translations, mock methods) |
Shortcuts can be changed in Preferences › Keyboard Shortcuts (search for scsymfonyplugin).
How It Works
The project is indexed in the background right after activation — navigation and search are available immediately and fill in as indexing progresses. A notification shows the progress of each step.
- Routes — parsed from Symfony's compiled route cache; controller files are resolved through Composer's PSR-4 mapping (
autoload and autoload-dev).
- PHP classes — Composer classmap, Symfony preload file, and every class declared in
src/ and tests/.
- Twig filters & functions — PHP files in directories whose name contains "twig". Vendor results are cached and only rebuilt when
composer.lock changes.
- Templates, translations, configuration, services —
templates/, translations/, config/**/*.yaml and config/services*.yaml.
Indexes are kept up to date automatically: creating, saving or deleting a file only updates that file in the index, and rebuilding the Symfony cache triggers a full re-index. Indexing details and timings are logged in Output › Symfony Plugin.
Development
git clone https://codeberg.org/sullyvancosta/sc_symfony_plugin.git
cd sc_symfony_plugin
npm install
Press F5 in VS Code to launch the extension in a development host window.
| Command |
Purpose |
npm run watch |
Rebuild on change |
npm run compile |
Type check, lint and build |
npm test |
Run the test suites in a VS Code test instance (single folder, then multi-root) |
npm run bench |
Benchmark indexing — BENCH_WORKSPACE=/path/to/symfony-project npm run bench |
npm run package |
Production build (npx @vscode/vsce package to produce the .vsix) |
Project Structure
src/
├── extension.ts # Entry point — wires everything together
├── logger.ts # Output panel logger
├── projects.ts # One project (indexes, indexing, watchers) per Symfony folder
├── managers.ts # Creates the index managers of a project
├── providers.ts # Registers definition & completion providers
├── indexing/ # Background indexing service and file watchers
├── search/ # Unified search panel
├── manager/ # In-memory indexes (routes, classes, templates…) + file access
├── parser/ # Pure parsers (PHP, YAML, Symfony cache)
├── provider/ # VS Code definition & completion providers
├── test/ # Test suites, one file per domain
├── test-multiroot/ # Tests run in a multi-root workspace
└── bench/ # Indexing benchmark
Changelog
See CHANGELOG.md.
License
MIT