Tinkerwell background image
Tinkerwell Logo Tinkerwell

Autocompletion#

Tinkerwell 3 provides best-in-class autocompletion for your PHP projects. Therefore Tinkerwell indexes your codebase to quickly find the code that you need – the fuzzy search provides you with a worldclass search logic, no matter if you are searching for classes, methods, constants or simply chain method calls.

Auto code completion works for local projects as well as for projects that you access via SSH. This works by indexing a local version of your remote project to provide the autocompletion features.

Setup

The code completion feature of Tinkerwell runs a PHP based language server locally – this means that you need a working PHP version on your local machine, even if you access your application via SHH, Docker or Laravel Vapor. The language server needs PHP versions 7.4+ and you can configure the local PHP version in the general settings.

Tinkerwell settings

Remote Setup

Code completion on remote projects works by indexing a local version of your remote application. This has the benefit that the indexing does not need to scan your remote project at all. To enable autocompletion for existing projects or add it to new ones, set the path to the local project on your machine in the connection settings.

Tinkerwell SSH settings

Code completion for magic methods (Laravel)

Laravel uses magic methods heavily – for example if you access a model to run Eloquent queries, Eloquent calls are usually done via these magic methods. The language server is not smart enough to detect these methods (yet), but you can make this work as you do in PHPStorm or VS Code. Install the Laravel IDE Helper Generator as a dev dependency and enjoy code completion for even complex scenarios.

You can install the package via:

composer require --dev barryvdh/laravel-ide-helper

After that, you can reindex your project by clicking on the language server status message on the bottom right.

Troubleshooting

Sometimes things don't work as expected and this is why you are looking at this troubleshooting guide. You can fix most problems by checking these steps:

  1. Restart Tinkerwell
  2. Check your local PHP version (the server needs `7.4+`)
  3. Sometimes the language server crashes and corrupts data within its own directory. If 1+2 did not fix the problem, try closing the app, deleting the directories and try again.

Language Server paths

macOS: ~/.cache/phpactor
Linux: ~/.cache/phpactor
Windows: C:\Users\USERNAME\.cache\phpactor