Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Nested PHP scope not detected properly #7665

Closed
Arcanemagus opened this issue Jul 2, 2015 · 3 comments
Closed

Nested PHP scope not detected properly #7665

Arcanemagus opened this issue Jul 2, 2015 · 3 comments
Labels
wrong-repo Issues that are filed to the wrong Atom repository.

Comments

@Arcanemagus
Copy link
Contributor

The scope of a block of PHP code that is enclosed inside of a separate language (ie. within a JS block in a page) is not detected properly if the enclosing PHP tags are both on the same line. If the tags are not separated onto different lines then Atom thinks the code is just part of the enclosing code block.

For example, this bit of code is incorrectly detected as part of the JavaScript block:

<html>
<head>
    <script type="text/javascript">
    <?php echo 'test'; ?>
    </script>
</head>
</html>

screenshot from 2015-07-02 14 22 25

While this code is properly detected as being a PHP block:

<html>
<head>
    <script type="text/javascript">
    <?php
    echo 'test';
    ?>
    </script>
</head>
</html>

screenshot from 2015-07-02 14 23 06


This issue is present on a completely fresh Atom installation, as well as one with a multitude of plugins.
Atom Version: 1.0.0
Operating Systems:

  • Ubuntu 15.04 x64
  • Windows 8.1 x64
@Arcanemagus
Copy link
Contributor Author

Here is the behavior of a few other editors in the condensed block:

Sublime Text 3:
Apparently considers the same block to be both embedded JS and PHP, which means it highlights things correctly, but also displays errors from jslint as an example.

Scope:                         text.html.basic
                               meta.tag.script.html
                               source.js.embedded.html
                               source.php.embedded.block.html

Notepad++:
Syntax highlighting is using PHP as the language, but I can't find anything to show its scope to see if it is also thinking it is JavaScript (if it even uses that concept).

@Arcanemagus
Copy link
Contributor Author

Closing as a duplicate of atom/language-php#138.

@lock
Copy link

lock bot commented Apr 7, 2018

This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

@lock lock bot locked and limited conversation to collaborators Apr 7, 2018
@Arcanemagus Arcanemagus added the wrong-repo Issues that are filed to the wrong Atom repository. label Apr 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wrong-repo Issues that are filed to the wrong Atom repository.
Projects
None yet
Development

No branches or pull requests

1 participant