atom/language-php

Static keyword not colored correctly on props

Closed this issue · 3 comments

From microsoft/vscode#120042:

  • VS Code Version: 1.54.3
  • OS Version: Ubuntu Desktop 20.04

Steps to Reproduce:

  1. Create a new PHP file
  2. Paste the example code below
<?php
class Authentication
{
    private static $authTag;
    
    public static function setTag($authTag)
    {
        session_start();
        self::$authTag = $authTag;
    }
}

Does this issue occur when all extensions are disabled?: Yes

Explanation

When used with a property, static keyword is setted as support.class.php scope.
When used with a method, static keyword is setted as storage.modifier.php scope.

Print without extensions, default Dark+ theme.
image
image

Suggestion

I don't understand much about syntax highlight, but I was looking in the php.tmLanguage.json file and this bug, apparently, has something with this line.
https://github.com/microsoft/vscode/blob/c0fa3dfd3e252792efbae044c44c3bbb90c5b093/extensions/php/syntaxes/php.tmLanguage.json#L1170

When I change its value to storage.modifier.php, the bug is gone.
image

Please, note that I'm not saying that this is the fix to this bug. I didn't tested anything more than just changing the value of the parameter. I'm just guessing that this line has something to do with the bug.

Thank you!

@roblourens I've already made a pull request for that almost a month ago #417

In that bug static is treated as typed property with class named static, which is not allowed. Change in mentioned line is breaking every class reference

Oh ok, thanks!

This can be closed now