A lightweight VS Code extension that provides Go to Definition functionality for PHP files. Navigate to definitions of PHP variables, functions, classes, constants, and WordPress template files using Cmd+click (Mac) or Ctrl+click (Windows).
- Go to definition for PHP functions, classes, methods, variables, and constants
- WordPress template support - Cmd+click on
get_template_part()paths to open template files - Include/require resolution - Navigate to files in
include,require,include_once,require_oncestatements - Arrow method calls - Jump to method definitions from
$object->method()calls - WordPress functions - Support for
get_header(),get_footer(),get_sidebar(),locate_template()
Hold down Cmd (Mac) or Ctrl (Windows) and click on:
| Element | Example | Action |
|---|---|---|
| Template path | get_template_part('components/header/nav') |
Opens components/header/nav.php |
| Include path | include('includes/functions.php') |
Opens includes/functions.php |
| Function | my_function() |
Jumps to function definition |
| Class | new MyClass() |
Jumps to class definition |
| Method | $this->getData() |
Jumps to method definition |
| Variable | $myVariable |
Jumps to variable assignment |
Configure via Settings > Extensions > Jump to PHP Definition:
| Setting | Default | Description |
|---|---|---|
jumpToPhpDefinition.maxFileSize |
2 |
Maximum file size to search (in MB). Larger files are skipped for performance. |
jumpToPhpDefinition.excludePattern |
{**/vendor/**,...} |
Glob pattern for directories to exclude from search. |
The following directories are excluded by default:
vendor/node_modules/.git/cache/tmp/
- VS Code 1.74.0 or higher
- Added WordPress
get_template_part()support - Added
include/requirepath resolution - Added arrow method call (
->) support - Added
get_header(),get_footer(),get_sidebar()support - Added
locate_template()support - Added user-configurable settings for max file size and exclusions
- Fixed variable detection (now properly handles
$prefix) - Improved performance with async file reading
- Added cancellation support for long searches
- Removed unused code
- Initial release
- Clone the repository
- Run
npm install - Press F5 to start debugging the extension in a new VS Code window
npm run packageThis creates a .vsix file that can be installed in VS Code.