import { CssBlockError , errorHasRange } from "@css-blocks/core" ; import { Diagnostic , DiagnosticSeverity } from "vscode-languageserver" ; export function convertErrorsToDiagnostics ( errors ) { let diagnostics = [ ] ; errors . forEach ( error => { let range = error . location ! ; if ( ! errorHasRange ( range ) ) { return ; } const diagnostic = { severity : DiagnosticSeverity . Error , range : { start : { line : range . start . line - 1 , character : range . start . column - 1 , } , end : { line : range . end . line - 1 , character : range . end . column , } , } , message : error . origMessage , } ; diagnostics . push ( diagnostic ) ; } ) ; return diagnostics ; }