Search code examples
pythonvisual-studio-codehighlight

Python VsCode: Green highlight on class not working


I have the following python code:

from typing import List


class User:
    id: str
    name: str

    def __init__(self, id: str, name: str):
        self.id
        self.name = name


UserList = List[User]

User is highlighted in green but not UserList.

Here is a screen shot on VsCode: screen_shot_invalid_highlight

It causes incoherent highlights such as: incoherent_highlights

Is there a way to have UserList highlighted in green by VsCode ?

VsCode Version: 1.65.2 with python and Pylance extension installed


Solution

  • The semantic scope of UserList is :variable.other.readwrite

    The semantic scope of User is: entity.name.type.class


    on the line

    from typing import List, Tuple
    

    List and Tuple have a different color and scope

    This should not be so it validates a bug issue for Pylance