The message "unexpected token '['' appears in decorator.
thruc opened this issue · 3 comments
thruc commented
Environment data
- Language Server version: 0.5.59
- OS and version: Windows 10 19042.685
- Python version 3.9.1
Expected behaviour
Do not display the message "unexpected token '['.
Code Snippet
The following code reproduces the issue:
def make_decorators():
def decorator0(func):
def inner_func0(*args):
print('decorator 0')
return func(*args)
return inner_func0
def decorator1(func):
def inner_func1(*args):
print('decorator 1')
return func(*args)
return inner_func1
return [decorator0, decorator1]
decorators = make_decorators()
@decorators[0]
def hello():
print('hello')
@decorators[1]
def goodbye():
print('goodbye')
hello()
goodbye()
gvanrossum commented
(Note that this is a new feature in Python 3.9, see PEP 614.)
jakebailey commented
The parser for MPLS would need to be updated for 3.9, something I don't know if we have the time to do. Pylance at least supports everything new in 3.9, if you haven't yet tried it.
thruc commented
@jakebailey Thank you for your reply. I have switched the language server to Pylance and confirmed that it does not happen .