Livtoff VSCode Extension
This VSCode extension provides powerful navigation features for Livtoff projects, enabling seamless navigation between Vue/TypeScript files and PHP controllers in Laravel applications.
Features
1. Controller Navigation from Vue/TypeScript Files
- Detects PHP controller method calls in Vue and TypeScript files
- Provides CodeLens links above controller references to jump directly to PHP controller methods
- Supports both simple and namespaced controller patterns
- Shows both controller navigation and route navigation links when available
2. PHP Route Attribute Navigation
- Detects PHP 8 route attributes in controller files (e.g.,
#[Get(uri: '/')]
)
- Provides CodeLens links to navigate to route definitions
- Supports all HTTP methods (GET, POST, PUT, PATCH, DELETE)
3. Route Definition Navigation
- Navigate from controller references to their route definitions
- Searches for routes by name in
route-maker.php
- Falls back to path-based search if name search fails
Supported Patterns
The extension recognizes these controller patterns in Vue/TypeScript files:
Controllers.HomeController.show()
- Simple controller references
Controllers.Auth.RegisterController.show()
- Namespaced controllers
Controllers.Admin.Users.UserController.index()
- Multi-level namespaces
Controllers.Settings.ProfileController.update({ ... })
- With parameters
How It Works
Controller Resolution
The extension supports two project structures:
1. Modern Structure (Auto-generated Controllers)
- Controllers located in
resources/js/actions/App/Http/Controllers/
- Namespaces map directly to subdirectories
- Example:
Controllers.Auth.RegisterController
→ Auth/RegisterController.ts
2. Legacy Structure (Manual Index Files)
- Controllers in
resources/js/controllers/
- Uses
index.ts
files for imports and exports
- Supports nested namespaces with their own
index.ts
files
Controller Mapping
TypeScript controller files contain JSDoc annotations that map to PHP controllers:
/**
* @see \App\Http\Controllers\Auth\RegisterController::show
* @see app/Http/Controllers/Auth/RegisterController.php:25
* @route '/register'
*/
export const show = (options?: { query?: QueryParams }) => ({
url: show.url(options),
method: 'get',
})
Path Aliases
The extension automatically loads path aliases from your project's tsconfig.json
:
@
→ resources/js
@/actions
→ resources/js/actions
@actions
→ resources/js/actions
Configuration
Access these settings through VSCode's settings (search for "livtoff"):
livtoff.enableCodeLens
(default: true
)
Enable or disable CodeLens features for controller navigation
livtoff.debug
(default: false
)
Enable debug logging to troubleshoot issues. When enabled, check the "Livtoff" output channel for detailed logs
Usage
In Vue/TypeScript files: Look for CodeLens links above controller method calls
- Click "Go to {Controller}@{method}()" to navigate to the PHP controller
- Click "Go to route: {path}" to navigate to the route definition
In PHP controller files: Look for CodeLens links on route attributes
- Click to navigate to the route definition in
route-maker.php
Requirements
- A Livtoff Laravel project with TypeScript controllers
- Proper JSDoc annotations in TypeScript controller files
- PHP 8+ for route attribute support
- A
tsconfig.json
file with path aliases configured (optional but recommended)
Troubleshooting
Controller navigation not working?
- Enable debug mode: Set
livtoff.debug
to true
in settings
- Check the output: Open the Output panel and select "Livtoff" from the dropdown
- Verify file structure:
- For modern structure: Check if controllers exist in
resources/js/actions/App/Http/Controllers/
- For legacy structure: Check if
resources/js/controllers/index.ts
exists
- Check JSDoc annotations: Ensure TypeScript files have proper
@see
annotations
- Verify namespaces: For namespaced controllers, ensure the directory structure matches
Common Issues
- "Could not find export for {Controller}": The controller isn't exported in the index.ts file or doesn't exist in the expected location
- "Could not find import for {Namespace}": The namespace directory or import is missing
- No CodeLens appearing: Check if
livtoff.enableCodeLens
is enabled in settings
Development
To contribute or debug the extension:
- Clone the repository
- Run
npm install
to install dependencies
- Open in VSCode and press F5 to launch a debug instance
- Enable
livtoff.debug
setting to see detailed logs
- Check the "Livtoff" output channel for debug information
License
[License information here]
Contributing
[Contributing guidelines here]