vim-laravel
vim-laravel copied to clipboard
gf for routes
It would be awesome if gf
while inside route('route.name')
would take the user to the route handler. I figure maybe this feature could leverage artisan route:list
behind the scenes. This might be tough for closure routes since we'd likely have to parse out the various route files manually, which might be named differently. The router has a base_path()
option, so we could look into seeing if it stores that state anywhere, but even then, I was on a project that looped over a set of files in a directory and did a plain ol' require
in the RouteServiceProvider
.
I think this would also be cool for url()
but I'm not sure how hard it would be to compare url("foo/bar/{$user->id}")
to Route::get('foo/bar/{user}')
.
It would be awesome if gf would take the user to the route handler.
gf
on what, though?
Oh, good point. I meant route('route.name')
. I'll edit the original post to include this. I thought about the url()
helper as well, but I'm not sure how easy it would be to compare the route definition with the {foo}
style variables with url("/users/{$user->id}")
.
I meant
route('route.name')
.
I feel it would be more intuitive for this to jump to the respective routes file, although either way, we would really be stretching the semantics of gf
quite a bit. Then again, I've already set a precedent with the go-to translation/config stuff. Ugh.
I thought about the
url()
helper as well, but I'm not sure...
Yeah, I'm going to take a pass on trying to get that working. 😄
I'm not entirely sure how we'd get to the routes file, especially if there was some custom routes handling. If you're up for pairing - I'd totally be down to pair on this! I've got some free time right now since you seem active!
I've got a little time. What do you have in mind?
Yeah, I think the routes file idea is maybe not feasible, short of doing some ugly scraping with regexes.
I figured screensharing if you were down, I wouldn't be much use other than maybe helping figure out how Laravel's router works, though. Vimscript and I do not get along :P
Shoot me an email at [email protected].