freshbitsweb / laravel-traveller

VS Code extension to travel through your Laravel app by just clicking on links.
5 stars 0 forks source link

Ability to Toggle the feature #1

Closed curtisblackwell closed 4 years ago

curtisblackwell commented 4 years ago

I've been using this extension for navigating from routes to controllers. It doesn't require adding the namespace comments. It would be great if we could get this feature added.

The extra comments required would likely get removed / be misunderstood by teammates.

P.S. Opening the latest log file with a keyboard shortcut was a genius idea. Thanks!

gauravmak commented 4 years ago

Hi,

Namespace comment is required only when the actual Laravel Route group namespace code is not present in the file e.g. Route::namespace('api')->group( function() {...

This is the case in the default routes/api.php file.

curtisblackwell commented 4 years ago

That's inaccurate. The default routes/api.php doesn't specify the namespace, the app/Providers/RouteServiceProvider.php does.

Option + clicking works in routes/web.php, but no routes/api.php.

gauravmak commented 4 years ago

You're right Curtis. RouteServiceProvider specifies the namespace for the api file and our VS Code has no idea about it.

Therefore, I added the feature where we can add a very simple comment // Route::namespace = Api to the routes/api.php file and extension will pick it up. I hope it helps.

curtisblackwell commented 4 years ago

Would you accept a PR that either 1) was context-aware for the core routes files or 2) allowed disabling this navigating from routes to controllers?

This extension confuses the one I was already using to navigate from routes to controllers and the comments necessary to make this work would end up getting removed.

gauravmak commented 4 years ago

1) was context-aware for the core routes files

Statically coding the extension for core routes file would prevent users from making changes in their RouteServiceProvider. I think that should be avoided.

2) allowed disabling this navigating from routes to controllers?

Are you using 2 extensions with similar functionalities? I would suggest using only one of them. If there is any feature that is still not implemented in this extension, Please request it - I am open to adding more features, thanks.

curtisblackwell commented 4 years ago

Statically coding the extension for core routes file would prevent users from making changes in their RouteServiceProvider. I think that should be avoided.

Okay, so would you accept a PR if this feature could be toggled on/off OR it could be accomplished w/o hard coding it?

Are you using 2 extensions with similar functionalities?

Yeah, that's what I was trying to point out in the original post. laravel-goto-controller already handles the route-linked-to-controller feature the way I prefer. I really only installed your extension for opening logs.

gauravmak commented 4 years ago

Alright, I think the ability to toggle the feature would be a good addition. Adding it to the TODO list.

PS - The other extension does not support the controller links when you have namespaces the routes using the route group. That is why I developed this extension.

curtisblackwell commented 4 years ago

Interesting. I haven't encountered that yet. I don't know the last time I used a custom namespace.

Thanks for reconsidering!

gauravmak commented 4 years ago

The new version - v1.5.0 has the configuration options to disable features. Please check and let me know if anything :) Cheers.

curtisblackwell commented 4 years ago

Was off Laravel projects for a bit, but I finally checked. Working great, thanks!