Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting issue when @ appears as first character after line continuation when indexing is present #161435

Closed
1 task done
tillahoffmann opened this issue Dec 7, 2021 · 5 comments
Assignees
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream

Comments

@tillahoffmann
Copy link

VS Code version

1.62.3

Extension version

v2021.11.1422169775

OS type

macOS

OS version

11.6

Python distribution

Other

Python version

pyenv (installed with brew) in virtual environment (3.8.10)

Language server

Default

Expected behaviour

I would expect syntax highlighting to be the same irrespective of whether the line is broken before or after the @ operator.

Actual behaviour

image

Steps to reproduce

Enter the following code into a new python file.

# Define variables so pylance doesn't complain.
long_variable_name = other_long_variable_name = 1

long_variable_name \
    @ other_long_variable_name['some_index']

long_variable_name @ \
    other_long_variable_name['some_index']

Logs

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Dec 8, 2021
@erictraut
Copy link

This is a bug in the TextMate grammar included in the Python extension, not in Pylance. I suspect it's related to the fact that the @ operator is used for decorators, and decorators prior to Python 3.9 could not contain index expressions. In any case, this bug should probably be transferred to the Python extension repo.

@tillahoffmann
Copy link
Author

Yes, agreed, @erictraut. Are you able to transfer back to microsoft/vscode-python, @karthiknadig?

@karthiknadig
Copy link
Member

TextMate grammar is in the VS Code repo not in the python extension. We should move this there.

@tillahoffmann
Copy link
Author

Aha, my bad. Thanks for clarifying.

@alexr00
Copy link
Member

alexr00 commented Sep 23, 2022

Copied to the upstream repo that we pull the python grammar from: MagicStack/MagicPython#253

@alexr00 alexr00 closed this as completed Sep 23, 2022
@alexr00 alexr00 added grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream labels Sep 23, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

No branches or pull requests

6 participants