Sha256: a876f873f9e4fc83bd69a67d05e28a4f847dc2ad9a1ce4bfdba7a7f5d5650072

Contents?: true

Size: 930 Bytes

Versions: 39

Compression:

Stored size: 930 Bytes

Contents

import{parser as e}from"@lezer/json";import{LRLanguage as t,indentNodeProp as r,continuedIndent as n,foldNodeProp as o,foldInside as s,LanguageSupport as a}from"@codemirror/language";const jsonParseLinter=()=>e=>{try{JSON.parse(e.state.doc.toString())}catch(t){if(!(t instanceof SyntaxError))throw t;const r=getErrorPosition(t,e.state.doc);return[{from:r,message:t.message,severity:"error",to:r}]}return[]};function getErrorPosition(e,t){let r;return(r=e.message.match(/at position (\d+)/))?Math.min(+r[1],t.length):(r=e.message.match(/at line (\d+) column (\d+)/))?Math.min(t.line(+r[1]).from+ +r[2]-1,t.length):0}const c=t.define({name:"json",parser:e.configure({props:[r.add({Object:n({except:/^\s*\}/}),Array:n({except:/^\s*\]/})}),o.add({"Object Array":s})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function json(){return new a(c)}export{json,c as jsonLanguage,jsonParseLinter};

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
satis-2.1.47 vendor/javascript/@codemirror--lang-json.js
satis-2.1.46 vendor/javascript/@codemirror--lang-json.js
satis-2.1.45 vendor/javascript/@codemirror--lang-json.js
satis-2.1.44 vendor/javascript/@codemirror--lang-json.js
satis-2.1.43 vendor/javascript/@codemirror--lang-json.js
satis-2.1.42 vendor/javascript/@codemirror--lang-json.js
satis-2.1.41 vendor/javascript/@codemirror--lang-json.js
satis-2.1.40 vendor/javascript/@codemirror--lang-json.js
satis-2.1.39 vendor/javascript/@codemirror--lang-json.js
satis-2.1.38 vendor/javascript/@codemirror--lang-json.js
satis-2.1.37 vendor/javascript/@codemirror--lang-json.js
satis-2.1.36 vendor/javascript/@codemirror--lang-json.js
satis-2.1.35 vendor/javascript/@codemirror--lang-json.js
satis-2.1.33 vendor/javascript/@codemirror--lang-json.js
satis-2.1.31 vendor/javascript/@codemirror--lang-json.js
satis-2.1.30 vendor/javascript/@codemirror--lang-json.js
satis-2.1.29 vendor/javascript/@codemirror--lang-json.js
satis-2.1.28 vendor/javascript/@codemirror--lang-json.js
satis-2.1.27 vendor/javascript/@codemirror--lang-json.js
satis-2.1.26 vendor/javascript/@codemirror--lang-json.js