Changing file EOL with vscode extension API

痞子三分冷 提交于 2020-06-11 21:26:13

问题


Can I silently change end of line sequence in VSCode?
Something like this:

vscode.commands.executeCommand("workbench.action.editor.changeEOL", "LF");

回答1:


You can add this line to your user preferences settings (CTRL + ,):

"files.eol": "\n"



回答2:


On the bottom right of vs code it will say lf or crlf. Click there and it will give an option to change.see pic of vs code




回答3:


The solution is:

editor.edit(builder => {
    builder.setEndOfLine(vscode.EndOfLine.LF);
})


来源:https://stackoverflow.com/questions/52404044/changing-file-eol-with-vscode-extension-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!