@bhsd/lezer-json 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/index.js +4 -4
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
[](https://github.com/bhsd-harry/lezer-json/actions/workflows/codeql.yml)
|
|
5
5
|
[](https://app.codacy.com/gh/bhsd-harry/lezer-json/dashboard)
|
|
6
6
|
|
|
7
|
-
This is a fork of [@lezer/json](https://www.npmjs.com/package/@lezer/json) and
|
|
7
|
+
This is a fork of [@lezer/json](https://www.npmjs.com/package/@lezer/json) and
|
|
8
|
+
[@codemirror/lang-json](https://www.npmjs.com/package/@codemirror/lang-json)
|
|
9
|
+
that adds a dialect for [JSONC](https://jsonc.org/) to provide support for
|
|
10
|
+
comments and trailing commas.
|
|
8
11
|
|
|
9
12
|
## Installation
|
|
10
13
|
|
|
@@ -26,7 +29,8 @@ const jsonLanguageSupport: LanguageSupport = json(),
|
|
|
26
29
|
|
|
27
30
|
## Language
|
|
28
31
|
|
|
29
|
-
You can also import the [LR language](https://codemirror.net/docs/ref/#language.LRLanguage)
|
|
32
|
+
You can also import the [LR language](https://codemirror.net/docs/ref/#language.LRLanguage)
|
|
33
|
+
for JSON or JSONC alone.
|
|
30
34
|
|
|
31
35
|
```ts
|
|
32
36
|
import {jsonLanguage, jsoncLanguage} from '@bhsd/lezer-json';
|
|
@@ -34,7 +38,8 @@ import {jsonLanguage, jsoncLanguage} from '@bhsd/lezer-json';
|
|
|
34
38
|
|
|
35
39
|
## Lint Source
|
|
36
40
|
|
|
37
|
-
This package also provides [lint sources](https://codemirror.net/docs/ref/#lint.LintSource)
|
|
41
|
+
This package also provides [lint sources](https://codemirror.net/docs/ref/#lint.LintSource)
|
|
42
|
+
for JSON or JSONC syntax checking.
|
|
38
43
|
|
|
39
44
|
```ts
|
|
40
45
|
import {linter} from '@codemirror/lint';
|
package/dist/index.js
CHANGED
|
@@ -14,13 +14,13 @@ const props = [
|
|
|
14
14
|
indentOnInput: /^\s*[}\]]$/u,
|
|
15
15
|
};
|
|
16
16
|
/** LR language for JSON. */
|
|
17
|
-
export const jsonLanguage = LRLanguage.define({
|
|
17
|
+
export const jsonLanguage = /* #__PURE__ */ (() => LRLanguage.define({
|
|
18
18
|
name: 'json',
|
|
19
19
|
parser: parser.configure({ props }),
|
|
20
20
|
languageData,
|
|
21
|
-
});
|
|
21
|
+
}))();
|
|
22
22
|
/** LR language for JSONC. */
|
|
23
|
-
export const jsoncLanguage = LRLanguage.define({
|
|
23
|
+
export const jsoncLanguage = /* #__PURE__ */ (() => LRLanguage.define({
|
|
24
24
|
name: 'jsonc',
|
|
25
25
|
parser: parser.configure({ props, dialect: 'jsonc' }),
|
|
26
26
|
languageData: {
|
|
@@ -30,7 +30,7 @@ export const jsoncLanguage = LRLanguage.define({
|
|
|
30
30
|
block: { open: '/*', close: '*/' },
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
|
-
});
|
|
33
|
+
}))();
|
|
34
34
|
/**
|
|
35
35
|
* Get language support for JSON or JSONC.
|
|
36
36
|
* @param dialect The dialect to use, either omitted or `'jsonc'` for JSON with comments.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bhsd/lezer-json",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "Lezer-based JSON/JSONC grammar",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codemirror",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@bhsd/common": "^4.0
|
|
53
|
+
"@bhsd/common": "^4.1.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@bhsd/code-standard": "^4.
|
|
56
|
+
"@bhsd/code-standard": "^4.2.0",
|
|
57
57
|
"@codemirror/language": "^6.12.4",
|
|
58
58
|
"@codemirror/lint": "^6.9.7",
|
|
59
59
|
"@lezer/generator": "^1.8.0",
|
|
60
|
-
"eslint": "^10.
|
|
60
|
+
"eslint": "^10.10.0",
|
|
61
61
|
"markdownlint-cli2": "^0.23.2",
|
|
62
62
|
"typescript": "^6.0.3"
|
|
63
63
|
}
|