我对必须在 VScode 上水平滚动感到非常恼火,所以我设置了以下设置以启用自动换行:
"editor.wordWrap": "on",
"editor.wrappingIndent": "indent"
但是,我发现它包装在我不想要的地方很烦人,例如,对于像这样的函数调用:
myLongNameFunc(longNameVarA, longNameVarB);
它是这样包装的,用分号分割:
myLongNameFunc(longNameVarA, longNameVarB)
;
我宁愿看到这样的东西:
myLongNameFunc(longNameVarA,
longNameVarB);
是否可以通过某种方式设置此配置?例如,如果可能,允许它在空格上换行?
谢谢,
最佳答案
已经有一段时间了......但我看到 v1.42 将有一个新的包装策略选项,它为我修复了你的例子:
Editor: Wrapping Strategy
选择高级
Controls the algorithm that computes wrapping points.
simple
: Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width.
advanced
: Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.
正如设置警告,advanced
可能会对大文件产生不利影响,但它确实正确地包装了您的示例。
关于visual-studio-code - Visual Studio Code 上的 "Intelligent"自动换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47534848/