Sha256: a876f873f9e4fc83bd69a67d05e28a4f847dc2ad9a1ce4bfdba7a7f5d5650072

Contents?: true

Size: 930 Bytes

Versions: 40

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

40 entries across 40 versions & 1 rubygems

Version Path
satis-2.1.26 vendor/javascript/@codemirror--lang-json.js
satis-2.1.24 vendor/javascript/@codemirror--lang-json.js
satis-2.1.23 vendor/javascript/@codemirror--lang-json.js
satis-2.1.22 vendor/javascript/@codemirror--lang-json.js
satis-2.1.21 vendor/javascript/@codemirror--lang-json.js
satis-2.1.20 vendor/javascript/@codemirror--lang-json.js
satis-2.1.19 vendor/javascript/@codemirror--lang-json.js
satis-2.1.18 vendor/javascript/@codemirror--lang-json.js
satis-2.1.11 vendor/javascript/@codemirror--lang-json.js
satis-2.1.10 vendor/javascript/@codemirror--lang-json.js
satis-2.1.9 vendor/javascript/@codemirror--lang-json.js
satis-2.1.8 vendor/javascript/@codemirror--lang-json.js
satis-2.1.6 vendor/javascript/@codemirror--lang-json.js
satis-2.1.5 vendor/javascript/@codemirror--lang-json.js
satis-2.1.4 vendor/javascript/@codemirror--lang-json.js
satis-2.1.3 vendor/javascript/@codemirror--lang-json.js
satis-2.1.1 vendor/javascript/@codemirror--lang-json.js
satis-2.1.0 vendor/javascript/@codemirror--lang-json.js
satis-2.0.9 vendor/javascript/@codemirror--lang-json.js
satis-2.0.8 vendor/javascript/@codemirror--lang-json.js