小编Rom*_*om1的帖子

Monaco 编辑器默认 json uri 模式

我正在使用摩纳哥编辑器来编辑 JSON,我想设置自定义诊断选项。我正在尝试https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-configure-json-defaults

// Configures two JSON schemas, with references.

var jsonCode = [
    '{',
    '    "p1": "v3",',
    '    "p2": false',
    "}"
].join('\n');
var modelUri = monaco.Uri.parse("a://b/foo.json"); // a made up unique URI for our model
var model = monaco.editor.createModel(jsonCode, "json", modelUri);

// configure the JSON language support with schemas and schema associations
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
    validate: true,
    schemas: [{
        uri: "http://myserver/foo-schema.json", // id of the first schema
        fileMatch: [modelUri.toString()], // associate with our model
        schema: {
            type: "object",
            properties: {
                p1: …
Run Code Online (Sandbox Code Playgroud)

json monaco-editor angular ngx-monaco-editor

6
推荐指数
1
解决办法
3278
查看次数

Windows Batch:如何为/ f保留带有循环的空行

当我用for循环浏览文件时,我正在搜索如何保持空行.

for /f "tokens=1* delims=[" %%i in ('type "test1.txt" ^| find /v /n ""') do (
SET tmp=%%i
echo !tmp! >> test2.txt
)
Run Code Online (Sandbox Code Playgroud)

实际上它适用于所有人,但就我而言,它不起作用.例如,如果test1.txt内容是:

Hello I come from France
I live in Paris

I'm sorry I don't know english, could we speak french please ?
If it doesn't bother you

Thank you
Run Code Online (Sandbox Code Playgroud)

test2.txt中的结果将是:

[1 
[2 
[3 
[4 
[5 
[6 
[7 
Run Code Online (Sandbox Code Playgroud)

如果我在"*"附近放下"1",结果是:

[1]Hello I come from France 
[2]I live in Paris 
[3] 
[4]I'm sorry I don't know english, could we speak …
Run Code Online (Sandbox Code Playgroud)

batch-file delimiter blank-line

4
推荐指数
1
解决办法
2722
查看次数