microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.63k stars 29.04k forks source link

PHP Syntax broken by `@var array(string)` in a comment #31169

Closed neerolyte closed 7 years ago

neerolyte commented 7 years ago
Extension Author (truncated) Version
puppet Bor 0.3.2
vscode-docker Pet 0.0.16
vscode-intelephense-client bme 0.7.2
vscode-phpmd eco 1.0.1
php-debug fel 1.11.1
php-symbols lin 2.1.0
php-docblocker nei 1.2.0
vim vsc 0.9.0
gitblame wad 2.0.1
vscode-open-in-github ziy 1.2.7

Steps to Reproduce:

  1. Create a php file with code like:
<?php
/**
* @var array(string)
*/
$foo = 'bar';
  1. Observe incorrect syntax highlighting:

image

This started in the last few days and the current stable version doesn't do it (it's just in insiders atm):

image

Reproduces without extensions: Yes

roblourens commented 7 years ago

Filed https://github.com/atom/language-php/issues/245

neerolyte commented 7 years ago

The upstream fix in atom/language-php#245 does resolve this issue, but VSCode 1.15.0 came out without this fix, so it's now broken.

neerolyte commented 7 years ago

Note I'm testing by patching the installed copy of VSCode directly:

# diff -Naur /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/extensions/php/syntaxes/php.tmLanguage.json{.bak,}
--- /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/php/syntaxes/php.tmLanguage.json.bak 2017-08-16 11:09:32.000000000 +1000
+++ /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/php/syntaxes/php.tmLanguage.json 2017-08-16 11:10:22.000000000 +1000
@@ -2383,7 +2383,7 @@
                    "name": "punctuation.definition.type.begin.bracket.round.phpdoc.php"
                }
            },
-           "end": "(\\))(\\[\\])",
+           "end": "(\\))(\\[\\])|(?=\\*/)",
            "endCaptures": {
                "1": {
                    "name": "punctuation.definition.type.end.bracket.round.phpdoc.php"
roblourens commented 7 years ago

Yeah, the fix didn't come soon enough, but it should be fixed in Insiders if you want to use that instead.

mattacosta commented 7 years ago

Confirmed, this has been fixed in the mean time.

neerolyte commented 7 years ago

Fixed in Version 1.17.0.