pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

Pylance is incorrectly assigning my class's setter/getter properties as variable tokens instead of function tokens and its breaking syntax highlighting

Open 0xStarcat opened this issue 1 year ago • 0 comments

Environment data

  • Pylance version: v2024.07.1
  • OS and version: Apple M2 Pro Sequoia 15.0 (24A335)
  • Python version: Python 3.11

Code Snippet

class MyClass:
    def __init__(self):
        self._x = None

    @property
    def x(self):
        return self._x

    @x.setter
    def x(self, value):
        self._x = value

Repro

  • "python.languageServer": "Pylance"
  • "editor.semanticHighlighting.enabled": true,
  • "workbench.colorTheme": "Default Dark+",

Expected behavior

Function x under @property should be yellow

Function x under @x.setter should be yellow

Decorator x within x.setter should be green

Actual behavior

Image

Logs

Function and decorator x are being tokenized the same as a variable

Image

Other extensions

Tested with no other extensions, only Python + Pylance

0xStarcat avatar Oct 18 '24 13:10 0xStarcat