Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Third-party syntaxes, "source.php" scope not working #21

Closed
anlutro opened this issue Jul 8, 2015 · 4 comments
Closed

Third-party syntaxes, "source.php" scope not working #21

anlutro opened this issue Jul 8, 2015 · 4 comments

Comments

@anlutro
Copy link
Contributor

anlutro commented Jul 8, 2015

A package I'm using for laravel blade template syntax highlighting uses - include: 'scope:source.php' to achieve PHP syntax highlighting where appropriate. This works fine with the default PHP syntax definition, not so much with this package.

I see that the default PHP syntax is split into two files - one for the "embedding.php" scope, and one for the "source.php" scope. The embedding one is the one actually used for files, and it includes the "source.php" one, but also allows other syntax definitions to include the "source.php" scope without importing the full embedded HTML syntax.

Is this approach something this package could adopt? It would fix compatibility with the blade package and possibly others that build on top of the "source.php" scope.

https://github.com/sublimehq/Packages/blob/master/PHP/PHP.sublime-syntax
https://github.com/sublimehq/Packages/blob/master/PHP/PHP%20Source.sublime-syntax

@gerardroche
Copy link
Owner

Makes sense. I'll patch it later today.

@gerardroche
Copy link
Owner

Taking a look this now.

When I add a PHP Source file like teh default package then the html in blade templates doesn't highlight correctly does it?

Example

<!-- Stored in app/views/layouts/master.blade.php -->

<html>
    <body>
        @section('sidebar')
            This is the master sidebar.
        @show

        <div class="container">
            @yield('content')
        </div>
        <?php
        echo 'hello';
        ?>
    </body>
</html>

In monokai extended color scheme:

screenshot from 2015-07-08 18 22 35

The html is not being highlighted becase source.php doesn't parse it, embedding.php does.

@anlutro
Copy link
Contributor Author

anlutro commented Jul 8, 2015

The blade package pushes the HTML scope at the beginning:

contexts:
  main:
    - match: ''
      push: 'scope:text.html.basic'

So it shouldn't matter what this package does, as long as the source.php scope is present.

Make sure you use the recent version of the blade package - the syntax definition was only just updated to support recent builds of ST3.

@gerardroche
Copy link
Owner

I needed the latest version of the blade package. Thanks. 👍

gerardroche added a commit that referenced this issue Jul 8, 2015
* release/0.13.0:
  Prepare release; Bump version and update changelog
  Move all tests from test/ to tests/
  git ignore test runner
  Add package-control.json template
  Update changelog
  Split syntax into embedding.php and source.php scope files; Resolves #21
  refactor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants