DEV Community

Nabil Anam
Nabil Anam

Posted on • Updated on

Laravel ziggy route completion for vscode

I always felt there was a lacking for route completions when I was using tighten/ziggy. It became almost necessity when I decided to use inertia js. Inertia, what not to like!

Anyway, I was searching ziggy in vs code marketplace every now and then and finally decided to build my own extension.

At first this extension loads route names from resources/js/ziggy.js. When it finds route() or $route() in js code it shows matched suggestions from extension's cached list. My main hiccup was importing the route list. I had to transform es6 code on the fly because of ziggy's export not being supported by node js.

Another problem I was facing is artisan ziggy:generate command. I had to run this command every time I made a new route or changed something. This extension solves this problem too. It watches web.php for changes and runs the artisan command automatically. Of course this can be disabled too.

Let me know what do you think :)

Links: Extension, Repository

Top comments (0)