简体   繁体   中英

How do I properly highlight type hints for python in Visual Studio Code?

I'm using visual studio Code w/ Python 3.6 and was wondering how to properly highlight type hints.

For example built in types (such as str or bool) get highlighted correctly. But my custom classes or imports such as datetime remain white. (Both for variable declarations and function returns).

How do I get them also to highlight a different color?

示例python代码

  1. Put your cursor over the text whose come you want to change.

  2. In the command palette, type inspect and choose 'inspect tokens'.

  3. In the pop up that appears, note the technical name of the time you're on. (Often the topmost scope)

  4. In settings.json, set the color and font of the associated text mate rule. See more in that in the official docs: https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM