Skip to content

Any way to customize the log level of schemaValidation? #86

@your-diary

Description

@your-diary

In :CocConfig, I set "diagnostic.level": "error" because I'm only interested in really important diagnostics.

However, in this case, coc-json doesn't complain about a JSON file which violates the corresponding schema.
(By the way, on the contrary, coc-yaml does complain about invalid files.)

I'd be glad if coc-json exposed a config option to customize the log level of such diagnostics.

Perhaps the upstream (i.e. vscode-json-languageservice) already implements the config?

let schemaValidation =
    documentSettings?.schemaValidation
    ? toDiagnosticSeverity(documentSettings.schemaValidation)
    : DiagnosticSeverity.Warning;

My Current Workaround

In ~/.config/coc/extensions/node_modules/coc-json/lib/server.js, I rewrite

P =
    _.languageId === "jsonc"
    ? {comments: "ignore", trailingCommas: "warning"}
    : {comments: "error", trailingCommas: "error"};

to

P = 
    _.languageId === "jsonc"
    ? {comments: "ignore", trailingCommas: "warning", schemaValidation: "error"}
    : {comments: "error", trailingCommas: "error", schemaValidation: "error"};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions