remcohaszing / monaco-yaml

YAML support for Monaco Editor
https://monaco-yaml.js.org
MIT License
268 stars 72 forks source link

Default diagnostic severity on schema validation #251

Open kelvien opened 1 month ago

kelvien commented 1 month ago

I notice that monaco-yaml shows errors as hints (shown orange/yellow) on the playground. When I check the severity level using monaco.editor.getModelMarkers({}), it's showing that the severity is 4 image And looking at the enums of DiagnosticSeverity, 4 is hint image Is it possible to change it to error so that it's underlined with red to make the error more apparent?

remcohaszing commented 1 month ago

You’re confusing the Monaco editor types with the LSP types. The severity you’re seeing is indeed 4, but that matches MarkerSeverity.Warning, not Hint. This is indeed displayed as a yellow squiggly line.

The goal of this project is to bring the YAML language service to Monaco editor, not to add custom logic on top of that. So in that sense I wouldn’t want to implement that in monaco-yaml. However, I do notice that VSCode does use an error severity for JSON schema violations. I’m not sure what’s going on.

I’m currently very busy myself, but I welcome an investigation on this.