gpt4 book ai didi

monaco-editor - 如何将 Windows 的 EOL 设置为 LF,以便 API 使用\n 获得值(value)。不是\r\n

转载 作者:行者123 更新时间:2023-12-04 13:58:33 28 4
gpt4 key购买 nike

我使用 monaco.editor.create 方法来创建模型。问题是 monaco 正在将多行代码解析为 Windows 操作系统中的\r\n 格式。

我试过在 monaco.editor.create() 的 editorOptions 中使用 defaultEOL 作为 'LF'

    let editorOptions = {
value,
quickSuggestions: { other: true, comments: true, strings: true },
language: language,
tabSize: tabSize,

...options
};
this._editor = monaco.editor.create(this._node, editorOptions);

我希望 Monaco Editor 请求我的 API 值\n

最佳答案

我使用以下内容:

let textModel = monaco.editor.createModel("");
textModel.setEOL(0);

文档:

monaco.editor.createModel

ITextModel.setEOL

关于monaco-editor - 如何将 Windows 的 EOL 设置为 LF,以便 API 使用\n 获得值(value)。不是\r\n,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56525822/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com