为什么在VSCode中对文档字符串描述和注释的处理方式不同?

问题描述 投票:1回答:1

示例代码。

"""
Something.
"""

# Something.

它们在我的VSCode中被格式化为这样。

enter image description here

到目前为止,我所知道的,都被用作评论和多行评论。具有相同功能但具有不同颜色的代码让我感到困惑。这种行为是有意的吗?有没有什么办法可以让文档字符串和评论以相同的颜色和方式设置?

我正在使用最新的VSCode(1.61.1)。一些相关的VSCode插件是Python和Django Template。

python visual-studio-code
1个回答
0
投票

我不能回答“为什么”的问题。但这里是如何改变颜色:

(我在这里回答:https://stackoverflow.com/a/47935166/5122657

将其添加到您的设置文件中:

<!-- language: json -->
"editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope":"string.quoted.docstring.multi.python",
                "settings": {
                    "foreground": "#69676c" //change to your preference
                }
            }
        ]
    }

附加信息:要查找其他元素的范围,请使用命令Developer: Inspect TM Scopes,如此处所述https://github.com/Microsoft/vscode/pull/29393

更多细节:https://code.visualstudio.com/docs/getstarted/themes#_customize-a-color-theme

© www.soinside.com 2019 - 2024. All rights reserved.