检查文件中的注释多长时间

checking how long are comments in a file

我刚完成一个评估,根据说明,我的代码行或注释不能超过 120 个字符。有没有快速的方法来检查? 我在 windows 10 上使用 VSCODE。我在某处看到我可以在编辑器中制作一条垂直线以查看一行是否太长,但我现在找不到它。

例如: // return stack->size since stack->size holds the number of values that can be stored inside the array at a given time.

这条评论是 119 个字符,所以还可以,但是任何更大的字符都会让我失去分数。

我知道我可以保留句子中的最后一个字符并在 VSCODE 中看到 'col' 数字,我希望有更好的结果。

谢谢

"editor.rulers": [120]

查看Editor: Rulers设置:

Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty.

您可以像这样更改其颜色或不透明度(在您的 settings.json 中):

"workbench.colorCustomizations": {
  "editorRuler.foreground": "#ff0000ff",
}

将颜色更改为红色,最后两位十六进制数字为不透明度。 ff 是 100% 不透明的。因此,例如,您可以尝试使用 #ff000080 来提高透明度。颜色和透明度是您可以对标尺进行的仅有的两项修改。