Extension Version
1.6.8
PHP Binary
Docker
Operating System
Linux
What happened?
Pre-conditions:
Our Laravel project is located in /app folder.
The full path of a controller will be, for example, /app/app/Http/Controllers/LoginController.php.
Behavior:
When follow the link of route('login') function:
- Actual: it opened the controller file at
Http/Controllers/LoginController.php
- Expected: it opens the controller file at
app/Http/Controllers/LoginController.php
Reason:
Because base_path() === /app, the function LaravelVsCode::relativePath() replace all occurrences of /app in file path.
|
return ltrim(str_replace(base_path(), '', realpath($path) ?: $path), DIRECTORY_SEPARATOR); |
Solution:
Only replace the first occurrence of base_path().
Mimimal Code Sample
Extension Version
1.6.8
PHP Binary
Docker
Operating System
Linux
What happened?
Pre-conditions:
Our Laravel project is located in
/appfolder.The full path of a controller will be, for example,
/app/app/Http/Controllers/LoginController.php.Behavior:
When follow the link of
route('login')function:Http/Controllers/LoginController.phpapp/Http/Controllers/LoginController.phpReason:
Because
base_path() === /app, the functionLaravelVsCode::relativePath()replace all occurrences of/appin file path.vs-code-extension/php-templates/bootstrap-laravel.php
Line 17 in 8665812
Solution:
Only replace the first occurrence of
base_path().Mimimal Code Sample