Can I silently change end of line sequence in VSCode?
Something like this:
vscode.commands.executeCommand("workbench.action.editor.changeEOL", "LF");
Can I silently change end of line sequence in VSCode?
Something like this:
vscode.commands.executeCommand("workbench.action.editor.changeEOL", "LF");
The solution is to call edit
method of active TextEditor
. For example:
vscode.window.activeTextEditor.edit(builder => {
builder.setEndOfLine(vscode.EndOfLine.LF);
})
UPD
Or if you want TexEdit
result you can use this one:
vscode.TextEdit.setEndOfLine(vscode.EndOfLine.LF)
"vscode" here is vscode module: require('vscode')
edit
method of TextEditor
object. For example: require('vscode').window.activeTextEditor.edit(builder => { builder.setEndOfLine(vscode.EndOfLine.LF); })
–
Hefter You can add this line to your user preferences settings (CTRL + ,
):
"files.eol": "\n"
On the bottom right of vs code it will say lf or crlf. Click there and it will give an option to change.
The solution is to call edit
method of active TextEditor
. For example:
vscode.window.activeTextEditor.edit(builder => {
builder.setEndOfLine(vscode.EndOfLine.LF);
})
UPD
Or if you want TexEdit
result you can use this one:
vscode.TextEdit.setEndOfLine(vscode.EndOfLine.LF)
"vscode" here is vscode module: require('vscode')
edit
method of TextEditor
object. For example: require('vscode').window.activeTextEditor.edit(builder => { builder.setEndOfLine(vscode.EndOfLine.LF); })
–
Hefter © 2022 - 2024 — McMap. All rights reserved.