microsoft / python-language-server

Microsoft Language Server for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The message "unexpected token '['' appears in decorator.

thruc opened this issue · comments

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()

issue

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.

commented

@jakebailey Thank you for your reply. I have switched the language server to Pylance and confirmed that it does not happen .