@valtzu/codemirror-lang-el 0.6.0 → 0.6.1
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 +1 -2
- package/dist/complete.cjs +5 -1
- package/dist/complete.js +5 -1
- package/dist/index.cjs +5 -1
- package/dist/index.js +5 -1
- package/dist/linter.cjs +4 -0
- package/dist/linter.js +4 -0
- package/dist/tooltip.cjs +4 -0
- package/dist/tooltip.js +4 -0
- package/package.json +1 -1
- package/.editorconfig +0 -3
- package/.github/workflows/publish.yml +0 -32
- package/.github/workflows/test.yml +0 -16
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ yarn add @valtzu/codemirror-lang-el
|
|
|
46
46
|
|
|
47
47
|
### Example
|
|
48
48
|
|
|
49
|
-
[Live demo](https://jsfiddle.net/
|
|
49
|
+
[Live demo](https://jsfiddle.net/turse2xq/)
|
|
50
50
|
|
|
51
51
|
```html
|
|
52
52
|
<div id="editor"></div>
|
|
@@ -78,7 +78,6 @@ yarn add @valtzu/codemirror-lang-el
|
|
|
78
78
|
import { expressionlanguage } from "@valtzu/codemirror-lang-el";
|
|
79
79
|
import { defaultKeymap } from "@codemirror/commands";
|
|
80
80
|
|
|
81
|
-
|
|
82
81
|
let editor = new EditorView({
|
|
83
82
|
extensions: [
|
|
84
83
|
basicSetup,
|
package/dist/complete.cjs
CHANGED
|
@@ -61,6 +61,10 @@ function resolveTypes(state, node, config, matchExact) {
|
|
|
61
61
|
else if (node.name === 'Application' && node.firstChild) {
|
|
62
62
|
resolveTypes(state, node.firstChild, config).forEach(x => types.add(x));
|
|
63
63
|
}
|
|
64
|
+
else if (node.name === 'TernaryExpression' && node.firstChild && node.firstChild.nextSibling && node.firstChild.nextSibling.nextSibling) {
|
|
65
|
+
resolveTypes(state, node.firstChild.nextSibling, config).forEach(x => types.add(x));
|
|
66
|
+
resolveTypes(state, node.firstChild.nextSibling.nextSibling, config).forEach(x => types.add(x));
|
|
67
|
+
}
|
|
64
68
|
if (types.size === 0) {
|
|
65
69
|
types.add('any');
|
|
66
70
|
}
|
|
@@ -157,7 +161,7 @@ function expressionLanguageCompletion(context) {
|
|
|
157
161
|
if (prevNode.name == 'String') {
|
|
158
162
|
return null;
|
|
159
163
|
}
|
|
160
|
-
if (((_a = prevNode.parent) === null || _a === void 0 ? void 0 : _a.name) == 'ObjectAccess' && ['ObjectAccess', 'ArrayAccess', 'Variable', 'Call'].includes(((_b = prevNode.parent.firstChild) === null || _b === void 0 ? void 0 : _b.name) || '')) {
|
|
164
|
+
if (((_a = prevNode.parent) === null || _a === void 0 ? void 0 : _a.name) == 'ObjectAccess' && ['ObjectAccess', 'ArrayAccess', 'Variable', 'Call', 'Application'].includes(((_b = prevNode.parent.firstChild) === null || _b === void 0 ? void 0 : _b.name) || '')) {
|
|
161
165
|
return completeMember(state, config, prevNode, isIdentifier(prevNode) || isMember(prevNode) ? prevNode.from : pos, pos);
|
|
162
166
|
}
|
|
163
167
|
if (['Expression', 'UnaryExpression', 'BinaryExpression', 'TernaryExpression'].includes(prevNode.name) && prevNode.lastChild && !((_c = prevNode.lastChild) === null || _c === void 0 ? void 0 : _c.type.isError)
|
package/dist/complete.js
CHANGED
|
@@ -57,6 +57,10 @@ function resolveTypes(state, node, config, matchExact) {
|
|
|
57
57
|
else if (node.name === 'Application' && node.firstChild) {
|
|
58
58
|
resolveTypes(state, node.firstChild, config).forEach(x => types.add(x));
|
|
59
59
|
}
|
|
60
|
+
else if (node.name === 'TernaryExpression' && node.firstChild && node.firstChild.nextSibling && node.firstChild.nextSibling.nextSibling) {
|
|
61
|
+
resolveTypes(state, node.firstChild.nextSibling, config).forEach(x => types.add(x));
|
|
62
|
+
resolveTypes(state, node.firstChild.nextSibling.nextSibling, config).forEach(x => types.add(x));
|
|
63
|
+
}
|
|
60
64
|
if (types.size === 0) {
|
|
61
65
|
types.add('any');
|
|
62
66
|
}
|
|
@@ -153,7 +157,7 @@ function expressionLanguageCompletion(context) {
|
|
|
153
157
|
if (prevNode.name == 'String') {
|
|
154
158
|
return null;
|
|
155
159
|
}
|
|
156
|
-
if (((_a = prevNode.parent) === null || _a === void 0 ? void 0 : _a.name) == 'ObjectAccess' && ['ObjectAccess', 'ArrayAccess', 'Variable', 'Call'].includes(((_b = prevNode.parent.firstChild) === null || _b === void 0 ? void 0 : _b.name) || '')) {
|
|
160
|
+
if (((_a = prevNode.parent) === null || _a === void 0 ? void 0 : _a.name) == 'ObjectAccess' && ['ObjectAccess', 'ArrayAccess', 'Variable', 'Call', 'Application'].includes(((_b = prevNode.parent.firstChild) === null || _b === void 0 ? void 0 : _b.name) || '')) {
|
|
157
161
|
return completeMember(state, config, prevNode, isIdentifier(prevNode) || isMember(prevNode) ? prevNode.from : pos, pos);
|
|
158
162
|
}
|
|
159
163
|
if (['Expression', 'UnaryExpression', 'BinaryExpression', 'TernaryExpression'].includes(prevNode.name) && prevNode.lastChild && !((_c = prevNode.lastChild) === null || _c === void 0 ? void 0 : _c.type.isError)
|
package/dist/index.cjs
CHANGED
|
@@ -102,6 +102,10 @@ function resolveTypes(state, node, config, matchExact) {
|
|
|
102
102
|
else if (node.name === 'Application' && node.firstChild) {
|
|
103
103
|
resolveTypes(state, node.firstChild, config).forEach(x => types.add(x));
|
|
104
104
|
}
|
|
105
|
+
else if (node.name === 'TernaryExpression' && node.firstChild && node.firstChild.nextSibling && node.firstChild.nextSibling.nextSibling) {
|
|
106
|
+
resolveTypes(state, node.firstChild.nextSibling, config).forEach(x => types.add(x));
|
|
107
|
+
resolveTypes(state, node.firstChild.nextSibling.nextSibling, config).forEach(x => types.add(x));
|
|
108
|
+
}
|
|
105
109
|
if (types.size === 0) {
|
|
106
110
|
types.add('any');
|
|
107
111
|
}
|
|
@@ -262,7 +266,7 @@ function expressionLanguageCompletion(context) {
|
|
|
262
266
|
if (prevNode.name == 'String') {
|
|
263
267
|
return null;
|
|
264
268
|
}
|
|
265
|
-
if (((_a = prevNode.parent) === null || _a === void 0 ? void 0 : _a.name) == 'ObjectAccess' && ['ObjectAccess', 'ArrayAccess', 'Variable', 'Call'].includes(((_b = prevNode.parent.firstChild) === null || _b === void 0 ? void 0 : _b.name) || '')) {
|
|
269
|
+
if (((_a = prevNode.parent) === null || _a === void 0 ? void 0 : _a.name) == 'ObjectAccess' && ['ObjectAccess', 'ArrayAccess', 'Variable', 'Call', 'Application'].includes(((_b = prevNode.parent.firstChild) === null || _b === void 0 ? void 0 : _b.name) || '')) {
|
|
266
270
|
return completeMember(state, config, prevNode, isIdentifier(prevNode) || isMember(prevNode) ? prevNode.from : pos, pos);
|
|
267
271
|
}
|
|
268
272
|
if (['Expression', 'UnaryExpression', 'BinaryExpression', 'TernaryExpression'].includes(prevNode.name) && prevNode.lastChild && !((_c = prevNode.lastChild) === null || _c === void 0 ? void 0 : _c.type.isError)
|
package/dist/index.js
CHANGED
|
@@ -98,6 +98,10 @@ function resolveTypes(state, node, config, matchExact) {
|
|
|
98
98
|
else if (node.name === 'Application' && node.firstChild) {
|
|
99
99
|
resolveTypes(state, node.firstChild, config).forEach(x => types.add(x));
|
|
100
100
|
}
|
|
101
|
+
else if (node.name === 'TernaryExpression' && node.firstChild && node.firstChild.nextSibling && node.firstChild.nextSibling.nextSibling) {
|
|
102
|
+
resolveTypes(state, node.firstChild.nextSibling, config).forEach(x => types.add(x));
|
|
103
|
+
resolveTypes(state, node.firstChild.nextSibling.nextSibling, config).forEach(x => types.add(x));
|
|
104
|
+
}
|
|
101
105
|
if (types.size === 0) {
|
|
102
106
|
types.add('any');
|
|
103
107
|
}
|
|
@@ -258,7 +262,7 @@ function expressionLanguageCompletion(context) {
|
|
|
258
262
|
if (prevNode.name == 'String') {
|
|
259
263
|
return null;
|
|
260
264
|
}
|
|
261
|
-
if (((_a = prevNode.parent) === null || _a === void 0 ? void 0 : _a.name) == 'ObjectAccess' && ['ObjectAccess', 'ArrayAccess', 'Variable', 'Call'].includes(((_b = prevNode.parent.firstChild) === null || _b === void 0 ? void 0 : _b.name) || '')) {
|
|
265
|
+
if (((_a = prevNode.parent) === null || _a === void 0 ? void 0 : _a.name) == 'ObjectAccess' && ['ObjectAccess', 'ArrayAccess', 'Variable', 'Call', 'Application'].includes(((_b = prevNode.parent.firstChild) === null || _b === void 0 ? void 0 : _b.name) || '')) {
|
|
262
266
|
return completeMember(state, config, prevNode, isIdentifier(prevNode) || isMember(prevNode) ? prevNode.from : pos, pos);
|
|
263
267
|
}
|
|
264
268
|
if (['Expression', 'UnaryExpression', 'BinaryExpression', 'TernaryExpression'].includes(prevNode.name) && prevNode.lastChild && !((_c = prevNode.lastChild) === null || _c === void 0 ? void 0 : _c.type.isError)
|
package/dist/linter.cjs
CHANGED
|
@@ -72,6 +72,10 @@ function resolveTypes(state, node, config, matchExact) {
|
|
|
72
72
|
else if (node.name === 'Application' && node.firstChild) {
|
|
73
73
|
resolveTypes(state, node.firstChild, config).forEach(x => types.add(x));
|
|
74
74
|
}
|
|
75
|
+
else if (node.name === 'TernaryExpression' && node.firstChild && node.firstChild.nextSibling && node.firstChild.nextSibling.nextSibling) {
|
|
76
|
+
resolveTypes(state, node.firstChild.nextSibling, config).forEach(x => types.add(x));
|
|
77
|
+
resolveTypes(state, node.firstChild.nextSibling.nextSibling, config).forEach(x => types.add(x));
|
|
78
|
+
}
|
|
75
79
|
if (types.size === 0) {
|
|
76
80
|
types.add('any');
|
|
77
81
|
}
|
package/dist/linter.js
CHANGED
|
@@ -68,6 +68,10 @@ function resolveTypes(state, node, config, matchExact) {
|
|
|
68
68
|
else if (node.name === 'Application' && node.firstChild) {
|
|
69
69
|
resolveTypes(state, node.firstChild, config).forEach(x => types.add(x));
|
|
70
70
|
}
|
|
71
|
+
else if (node.name === 'TernaryExpression' && node.firstChild && node.firstChild.nextSibling && node.firstChild.nextSibling.nextSibling) {
|
|
72
|
+
resolveTypes(state, node.firstChild.nextSibling, config).forEach(x => types.add(x));
|
|
73
|
+
resolveTypes(state, node.firstChild.nextSibling.nextSibling, config).forEach(x => types.add(x));
|
|
74
|
+
}
|
|
71
75
|
if (types.size === 0) {
|
|
72
76
|
types.add('any');
|
|
73
77
|
}
|
package/dist/tooltip.cjs
CHANGED
|
@@ -79,6 +79,10 @@ function resolveTypes(state, node, config, matchExact) {
|
|
|
79
79
|
else if (node.name === 'Application' && node.firstChild) {
|
|
80
80
|
resolveTypes(state, node.firstChild, config).forEach(x => types.add(x));
|
|
81
81
|
}
|
|
82
|
+
else if (node.name === 'TernaryExpression' && node.firstChild && node.firstChild.nextSibling && node.firstChild.nextSibling.nextSibling) {
|
|
83
|
+
resolveTypes(state, node.firstChild.nextSibling, config).forEach(x => types.add(x));
|
|
84
|
+
resolveTypes(state, node.firstChild.nextSibling.nextSibling, config).forEach(x => types.add(x));
|
|
85
|
+
}
|
|
82
86
|
if (types.size === 0) {
|
|
83
87
|
types.add('any');
|
|
84
88
|
}
|
package/dist/tooltip.js
CHANGED
|
@@ -75,6 +75,10 @@ function resolveTypes(state, node, config, matchExact) {
|
|
|
75
75
|
else if (node.name === 'Application' && node.firstChild) {
|
|
76
76
|
resolveTypes(state, node.firstChild, config).forEach(x => types.add(x));
|
|
77
77
|
}
|
|
78
|
+
else if (node.name === 'TernaryExpression' && node.firstChild && node.firstChild.nextSibling && node.firstChild.nextSibling.nextSibling) {
|
|
79
|
+
resolveTypes(state, node.firstChild.nextSibling, config).forEach(x => types.add(x));
|
|
80
|
+
resolveTypes(state, node.firstChild.nextSibling.nextSibling, config).forEach(x => types.add(x));
|
|
81
|
+
}
|
|
78
82
|
if (types.size === 0) {
|
|
79
83
|
types.add('any');
|
|
80
84
|
}
|
package/package.json
CHANGED
package/.editorconfig
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
name: Publish package to npm
|
|
2
|
-
on:
|
|
3
|
-
release:
|
|
4
|
-
types: [published]
|
|
5
|
-
jobs:
|
|
6
|
-
build:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
environment: npm
|
|
9
|
-
permissions:
|
|
10
|
-
contents: write
|
|
11
|
-
packages: write
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v3
|
|
14
|
-
# Setup .npmrc file to publish to GitHub Packages
|
|
15
|
-
- uses: actions/setup-node@v3
|
|
16
|
-
with:
|
|
17
|
-
node-version: '20.x'
|
|
18
|
-
registry-url: 'https://registry.npmjs.org'
|
|
19
|
-
- run: npm install
|
|
20
|
-
- run: npm run test
|
|
21
|
-
- name: Upload binaries to release
|
|
22
|
-
uses: svenstaro/upload-release-action@v2
|
|
23
|
-
with:
|
|
24
|
-
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
25
|
-
file: dist/index.*
|
|
26
|
-
tag: ${{ github.ref_name }}
|
|
27
|
-
overwrite: true
|
|
28
|
-
file_glob: true
|
|
29
|
-
- run: npm --no-git-tag-version version from-git
|
|
30
|
-
- run: npm publish
|
|
31
|
-
env:
|
|
32
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
name: Run tests
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches: [main]
|
|
5
|
-
pull_request:
|
|
6
|
-
types: [opened, synchronize, reopened]
|
|
7
|
-
jobs:
|
|
8
|
-
build:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v3
|
|
12
|
-
- uses: actions/setup-node@v3
|
|
13
|
-
with:
|
|
14
|
-
node-version: '20.x'
|
|
15
|
-
- run: npm install
|
|
16
|
-
- run: npm run test
|