Skip to content

JSON Schema “oneOf”: autocompletion of property name doesn’t insert a colon #84

@LehmannSa

Description

@LehmannSa

monaco-editor version: 0.21.2
Browser: Any
OS: Windows 10

Steps reproducing the issue:

Run the following snippet within the Monaco Editor Playground:

var jsonCode = [
    '{','}'
].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: {
                enum : { enum: ["a","b"]},
                object : {
                            type: "object",
                            properties : {
                                q: {
                                    enum: ["c","d"]
                                }
                            }
                        },
                oneOf: {
                    oneOf: [
                        { enum: ["a","b"]},
                        {
                            type: "object",
                            properties : {
                                q: {
                                    enum: ["c","d"]
                                }
                            }
                        }
                    ] 
                }
            }
        }
    }
    ]
});

monaco.editor.create(document.getElementById("container"), {
    model: model
});

Typing "estrg+space tab between the curly brackets leads to:
"enum":

Typing "obstrg+space tab between the curly brackets leads to:
"object":{}

Whereas typing "onstrg+space tab between the curly brackets leads to:
"oneOf"
instead of:
"oneOf":

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bughelp wantedIssues identified as good community contribution opportunities

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions