jawee / language-blade

Blade (Laravel) templating support in Atom
https://atom.io/packages/language-blade
Other
51 stars 21 forks source link

Why the move from no spaces to spaces in Blade directives? #56

Open martinbean opened 7 years ago

martinbean commented 7 years ago

Previously, using this package to insert Blade directives added directives without any spaces (i.e. @foreach($foo as $bar), @if($foo) etc. Now, directives contain spaces between the directive name and the opening parenthesis, i.e. @foreach ($foo as $bar), @if ($foo) etc. This means I know have code that is non-uniform.

What was the reason for this change? I preferred the non-space version for consistency, as you write @section('section.name') not @section ('section.name') and @include('path.to.include') not @include ('path.to.include').

Ingramz commented 7 years ago

The uniformity is dependant on the way you look at it. My main argument is going to be that it's the way how it is depicted in Laravel documentation. As a secondary, if you write your PHP adhering to PSR-2, then all control structures have a space between the directive name and opening parenthesis. Rest of directives can be viewed as functions with exceptions such as @section.

I would have no problems with it being configurable in package settings where you can just tick a checkbox to toggle the style you like. I am not sure however if snippets package allows one to do this programmatically.

martinbean commented 7 years ago

@Ingramz Understandable. But my argument re: PSR-2 is that Blade directives aren’t really PHP, so doesn’t really need to adhere to that standard.

I’d definitely be interested in a configuration option. I think some packages allow configuring of HTML- or XHTML-style tags, so would imagine it is possible. I have no idea how it would be achieved off the top of my head, though 😄

Ingramz commented 7 years ago

I think some packages allow configuring of HTML- or XHTML-style tags, so would imagine it is possible.

If you know specific packages that can do that, could you mention them by name/link them so I could look into how they work.