语法突出显示类型提示的VSCODE
我正在使用Dark ++主题,但个性化了很多颜色。 一切都很好,只有一件小事:只有基本类型才适当突出显示。 例如,这
"editor.tokenColorCustomizations": {
"comments": "#707070",
"keywords": "#adc5ee",
"types": "#bbbbbb",
"strings": "#bdceb7"
}
我希望函数声明中的类型提示为灰色+斜体,因为它适用于类型的“ str”。我知道这对npt.ndarray并不简单,因为它来自打字模块,但是为什么这甚至对“列表”和“ dict”都不起作用呢? 您知道我可以使用的解决方法吗? 据我所知,这些类型没有特殊的令牌,因此除了自定义一般令牌“类型”之外,无法访问它们。 我尝试使用“突出显示”扩展名的正则表达式,但这并不是最佳的,因为我也想保持功能,如果我将部分评论出现在该文本中,则应将其弄清楚(使用“突出显示” )。
I am using the Dark++ theme but personalising a lot of colours.
Everything works fine but one small thing: only the basic types are properly highlighted.
For example this
"editor.tokenColorCustomizations": {
"comments": "#707070",
"keywords": "#adc5ee",
"types": "#bbbbbb",
"strings": "#bdceb7"
}
gives me the following picture:
I would like the type hints in the function declaration to be grey+italic, as it happens correctly for the type "str". I understand it is not straightforward for npt.NDArray as that comes from the typing module, but why is this not working even for "list" and "dict"?
And do you know of a workaround I could use?
There are not special tokens for these types as far as I know, so no way to access them other than just customising the general token "types".
I tried using regex expressions with the "Highlight" extension but that is not optimal, because I also want to keep the functionality that if I comment out part of that text, it should be greyed-out (using "Highlight" it doesn't).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了结束这个主题并供将来参考,这就是我解决问题的方法:我最终按照 rioV8 的建议使用语义突出显示类型提示。
这是通过将以下内容添加到我的 Vscode 设置 JSON 文件来完成的:
To close this topic and for future reference, this is how I solved my issue: I ended up using semantic highlighting for type hints as rioV8 suggested.
This is done by adding the following to my Vscode settings JSON file: