bmewburn / vscode-intelephense

PHP intellisense for Visual Studio Code
https://intelephense.com
Other
1.57k stars 93 forks source link

`',' expected` in javascript embedded in PHP #2834

Open leonardolara opened 3 months ago

leonardolara commented 3 months ago

Describe the bug Intelephense's javascript analyzer is showing a ',' expected in opening brackets after PHP code in line 8 of the code below.

To Reproduce

<?php
header('Content-Type:text/html; charset=UTF-8');
$fruits = [1 => 'apples', 2 => 'oranges', 3 => 'lemons'];
?>
<script>
var x = [
    <?php foreach ($fruits as $key => $name) { ?>
    {
        "key": "<?php echo $key ?>",
        "name": "<?php echo $name ?>"
    },
    <?php } ?>
];
</script>

Expected behavior There should be no syntax error detected in this code at line 8.

Screenshots N/A

Platform and version Windows 10, Intelephense v1.10.4.

bmewburn commented 3 months ago

I can't reproduce this with the given code. Could it be coming from a different extension?

leonardolara commented 3 months ago

I tried to isolate the extension by disabling/enabling each one. The syntax highlight was gone when I disabled intelephense.

Em sáb., 30 de mar. de 2024, 01:01, Ben Mewburn @.***> escreveu:

I can't reproduce this with the given code. Could it be coming from a different extension?

— Reply to this email directly, view it on GitHub https://github.com/bmewburn/vscode-intelephense/issues/2834#issuecomment-2027904400, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC7PC3EJJIH46BVPVGMZOBLY2Y2H3AVCNFSM6AAAAABFMXLDNWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRXHEYDINBQGA . You are receiving this because you authored the thread.Message ID: @.***>