DEV Community


Laravel ziggy route completion for vscode

Nabil Anam
Updated on ・1 min read

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

Discussion (0)