microsoft / python-language-server

Microsoft Language Server for Python
Apache License 2.0
912 stars 131 forks source link

Tooltip shows setter docstring instead of GETTER docstring #2142

Closed gsutra closed 3 years ago

gsutra commented 3 years ago

Environment data

Expected behaviour

When mouse is over a property, tooltip should display the docstring of the property's GETTER.

Actual behaviour

Tooltip show the property's SETTER.

Steps to reproduce:

  1. Write basic class with property name
class Person:
    """ Represents a person. """

    def __init__(self, name=''):
        self.name = name

    @property
    def name(self) -> str:
        """ GETTER. """
        return self._name

    @name.setter
    def name(self, value: str) -> None:
        """ SETTER. """
        self._name: str = value

if __name__ == '__main__':
    p1 = Person(name='john')
    p1.name
  1. Mouse over the property name. issue

Logs

NA

karthiknadig commented 3 years ago

Thanks for your feedback! We have recently released a new and more performant language server called Pylance which likely solves these issues you are reporting.  You can download Pylance from the marketplace and install it alongside the core Python extension. Because our team's development efforts have shifted to support the new language server, we'd encourage you to try it out.

In the meantime, I'll transfer this issue over to the Microsoft Python Language Server repo for tracking. If you try out Pylance and this issue persists, you can open an issue on the pylance-release repo.

gsutra commented 3 years ago

Indeed, Pylance fixes this issue. Thank you.