在VS Code中呈现多个标尺


VS Code标尺的默认配置如下所示。

  "editor.ruler": 80

我的问题与默认的VS Code配置(如上所示)是它只呈现一个标尺。在Sublime文本编辑器中,我可以使用以下Sublime配置渲染任意多的标尺。

  "rulers": [72, 80, 100, 120]

有可能在V.S.代码中渲染多个标尺吗?如果可能的话,在VS Code中多标尺配置看起来像什么?


当前回答

Visual Studio Code 0.10.10引入了这个特性。要配置它,请转到菜单文件→首选项→设置,并将其添加到您的用户或工作区设置:

"editor.rulers": [80,120]

尺子的颜色可以这样定制:

"workbench.colorCustomizations": {
    "editorRuler.foreground": "#ff4081"
}

其他回答

结合kiamlaluno和Mark的答案,以及formatOnSave到Python的自动意图代码:

{
    "editor.formatOnSave": true,
    "editor.autoIndent": "advanced",
    "editor.detectIndentation": true,
    "files.insertFinalNewline": true,
    "files.trimTrailingWhitespace": true,
    "editor.formatOnPaste": true,
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.snippetSuggestions": "top",
    "editor.rulers": [
        {
            "column": 79,
            "color": "#424142"
        },
        100, // <- a ruler in the default color or as customized at column 0
        {
            "column": 120,
            "color": "#ff0000"
        },
    ],

}

Visual Studio Code 0.10.10引入了这个特性。要配置它,请转到菜单文件→首选项→设置,并将其添加到您的用户或工作区设置:

"editor.rulers": [80,120]

尺子的颜色可以这样定制:

"workbench.colorCustomizations": {
    "editorRuler.foreground": "#ff4081"
}

如果你正在使用Flutter,那么你需要编辑dart的标尺,你将从RUN命令导航到文件: % APPDATA % \ \用户\ settings.json代码

把标尺设为0

就像图片。settings。json

进入菜单文件->首选项->设置并添加

"editor.rulers": [preferred-value, preferred-value]

颜色可定制

workbench.colorCustomizations

使用Visual Studio Code 1.27.2:

当我转到文件>首选项>设置,我得到以下选项卡 我在搜索设置中输入标尺,得到以下设置列表 单击设置中的第一个Edit。json,我可以编辑用户设置 点击默认用户设置中出现在设置左侧的钢笔图标,我可以在用户设置中复制它并编辑它

在Visual Studio Code 1.38.1中,第三点显示的截图变成了下面的截图。

不再显示用于选择默认用户设置值的面板。