问题
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