question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[python] syntax highlighting breaks on function annotations

See original GitHub issue

From @doug-numetric on July 3, 2018 23:7

  • VSCode Version: 1.24.1
  • OS Version: macOS 10.13.5

Steps to Reproduce:

  1. Create a new file: test.py
  2. Paste in the following text:
def test() -> None:
    # Broken comment highlighting
    if True:
        print('The if statement above isn't highlighting either.  Same goes for this string')

Does this issue occur when all extensions are disabled?: Yes

Appears to be a regression of: https://github.com/Microsoft/vscode/issues/1467

Copied from original issue: Microsoft/vscode#53509

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
doug-numetriccommented, Jul 9, 2018

@1st1 Sorry for the noise and thanks for the direction. I tried disabling python related extensions one by one to find what may have exposed the issue. It appears to have been caused by the Python for VSCode 0.2.3 extension. Highlighting worked correctly after I uninstalled that.

I find it strange that I still had the issue when I launched vscode with extensions disabled – but that’s another issue.

1reaction
doug-numetriccommented, Jul 9, 2018

Yep. I referenced the parent Microsoft/vscode issue from a related issue in that extension’s repo: https://github.com/tht13/Python-vscode/issues/21

Read more comments on GitHub >

github_iconTop Results From Across the Web

[python] syntax highlighting breaks on function annotations
At some point recently, Python syntax highlighting went awry: Specifically, it looks like function annotations in Python 3 mess it up.
Read more >
Syntax highlighting not working for Python in VS Code with ...
Has anyone had any success with formatting Python type annotations in Visual Studio Code and what settings are you using? UPDATE: This does...
Read more >
[VSCODE] Broken Syntax Highlighting When Add Func Return ...
When you write a function/method in vscode Python editor, and put arrow to mark that the function returns value -> , the arrow...
Read more >
PEP 8 – Style Guide for Python Code
In Python code, it is permissible to break before or after a binary operator, as long as the convention is consistent locally. For...
Read more >
Semantic Highlight Guide | Visual Studio Code Extension API
A guide to syntax highlighting. ... TextMate grammars work on a single file as input and break it up based on lexical rules...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found