Closed heejaechang closed 1 month ago
Yeah that seems like a case we should skip adding the parens.
Briefly looked at this issue, @heejaechang are we suggesting to disable parentheses for all decorators? There're decorators with parameters that would need the parentheses to be there.
I think doing less is better than doing wrong. because doing wrong will require users to fix things up. especially if it is done without user explicit asking such as this case.
so in my opinion, the simplest way to fix will be just not adding ()
for all decorators. but that said, if we want to make it a bit smarter, then we can check whether the decorator
is a regular decorator
(one that doesn't have arguments), or decorator factory
(one that has arguments) and only add ()
if we are sure the decorator is a decorator factory.
I didn't see the code to see whether there is already existing info on whether decorator is factory
or not. but if not, we could use some heuristic to check.
just NOTE, any additional semantic check can impact typing perf. so, we should make sure perf cost is not that high otherwise, I think no feature is worth to sacrificing typing perf.
type
@override
or@overload
in
if
autoParan
ison
, pylance will insert()
afterdecorator
interfering typing.