20

I am using type hints in my Python 3 code. It seems VS Code cannot parse type hints correctly, because syntax highlighting gets messed up (docstrings not highlighted correctly, comments not recognized anymore).

I have all necessary extensions installed (Python and MagicPython plus Python for VSCode). Is there anything else I miss?

Aran-Fey
  • 39,665
  • 11
  • 104
  • 149
Ugur
  • 1,914
  • 2
  • 25
  • 46

2 Answers2

60

Brett's solution mentioned in a comment above worked for me:

You might have too many extensions installed. ;) Having Python and Python for VSCode could be interfering with each other.

When I removed Python for VSCode, syntax highlighting began to work correctly.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Thomas Eckert
  • 41
  • 4
  • 7
4

I had this problem too... I changed my linter to mypy and that seemed to fix it.

idryer
  • 129
  • 3
  • 2
    I changed my linter to mypy and that alone was not enough, I had to uninstall some old python extensions – Duilio Jul 21 '20 at 20:40