-
Notifications
You must be signed in to change notification settings - Fork 219
Closed
astral-sh/ruff
#22999Labels
bugSomething isn't workingSomething isn't workingserverRelated to the LSP serverRelated to the LSP server
Milestone
Description
Summary
For this class:
class Foo:
@property
def bar(self) -> str:
return "baz"
@bar.setter
def bar(self, value: str) -> None:
pass
@bar.deleter
def bar(self) -> None:
passIf you have Pylance disabled in VSCode and the ty-vscode extension installed, right-clicking on the first bar function and renaming it to spam will apply this diff to your code:
class Foo:
@property
- def bar(self) -> str:
+ def spam(self) -> str:
return "baz"
- @bar.setter
+ @spam.setter
def bar(self, value: str) -> None:
pass
- @bar.deleter
+ @spam.deleter
def bar(self) -> None:
passBut if you enable Pylance and do the rename, then this edit is applied instead from the same operation:
class Foo:
@property
- def bar(self) -> str:
+ def spam(self) -> str:
return "baz"
- @bar.setter
- def bar(self, value: str) -> None:
+ @spam.setter
+ def spam(self, value: str) -> None:
pass
- @bar.deleter
- def bar(self) -> None:
+ @spam.deleter
+ def spam(self) -> None:
passThe Pylance behaviour is how I would want a property rename to work; the ty behaviour should match that.
Failing tests for this were added in astral-sh/ruff#21810; a fix for this issue should aim to resolve the TODOs added in that PR.
Version
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingserverRelated to the LSP serverRelated to the LSP server