patricksamson / laravel-5-snippets

Laravel 5 Snippets for Sublime Text
MIT License
111 stars 29 forks source link

Snippets only shows up in .php files #22

Closed blueminded closed 7 years ago

blueminded commented 7 years ago

Hi, there.

First of all thank you for developing this package, I'm having some issues though. Time ago I used this package in Blade templates as normal, however after some time I can't use it anymore, I don't know if is because of an update of the plugin or something related to Sublime 3. Anyone with the same problem. The way to make work is when editing a .php file.

here an example in a .PHP file image

here in .blade.php file image

Any help would be appreciated.

patricksamson commented 7 years ago

Hello!

Yes, a few people have reported this already, see issue #3, especially my Feb 4, 2016 comment.

Sublime Text supports multiple language blocks in the same file, for example, a PHP file can contain HTML, which in turn contains CSS. If you install the Laravel Blade Highlighter package, it simply allows for PHP code blocks in an HTML file, inside the Blade tags.

So when you type Blade::, you're typing in a HTML code block. But unfortunately, HTML is a text scope, not a source code scope, and text scopes do not have autocompletion enabled by default.

Here's the quick fix; in your Sublime settings there is one named "auto_complete_selector", simply add , text.html at the end. The final result should be :

"auto_complete_selector": "meta.tag - punctuation.definition.tag.begin, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc, text.html",

I will do some more testing with a recent ST3 release to see if anything changed since...