@exercism/codemirror-lang-shell 1.0.0 → 1.0.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/CHANGELOG.md +4 -0
- package/README.md +23 -42
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,40 +1,6 @@
|
|
|
1
1
|
# @exercism/codemirror-lang-shell
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[@codincod/codemirror-lang-shell](https://codeberg.org/reeven/codemirror-lang-shell),
|
|
5
|
-
written by CodinCod. Exercism uses it for Bash in the editor on
|
|
6
|
-
[exercism.org](https://exercism.org). Our changes are on the `main` branch.
|
|
7
|
-
|
|
8
|
-
The fork adds completion for the names declared in the file, snippets, and a
|
|
9
|
-
longer list of builtins and common commands. It reads the names after `local`,
|
|
10
|
-
`declare` and `export` as definitions, folds an `if` from its `then`, and parses
|
|
11
|
-
a few more forms found in Exercism's Bash solutions. It also exports `bash()`,
|
|
12
|
-
an alias for `shell()`.
|
|
13
|
-
|
|
14
|
-
## Install
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
npm install @exercism/codemirror-lang-shell
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Exercism's Bash editor calls `bash()`:
|
|
21
|
-
|
|
22
|
-
```javascript
|
|
23
|
-
import {EditorView, basicSetup} from "codemirror"
|
|
24
|
-
import {bash} from "@exercism/codemirror-lang-shell"
|
|
25
|
-
|
|
26
|
-
new EditorView({
|
|
27
|
-
parent: document.body,
|
|
28
|
-
doc: `echo "Hello, World!"\n`,
|
|
29
|
-
extensions: [basicSetup, bash()]
|
|
30
|
-
})
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
The rest of this README is upstream's.
|
|
34
|
-
|
|
35
|
-
## @codincod/codemirror-lang-shell
|
|
36
|
-
|
|
37
|
-
[ [**CHANGELOG**](https://codeberg.org/reeven/codemirror-lang-shell/src/branch/master/CHANGELOG.md) ]
|
|
3
|
+
[ [**CHANGELOG**](CHANGELOG.md) ]
|
|
38
4
|
|
|
39
5
|
This package implements shell language support for the
|
|
40
6
|
[CodeMirror](https://codemirror.net/) code editor, using a
|
|
@@ -48,11 +14,15 @@ wrong in both directions. `echo a=b` comes out as an assignment. The `done` in
|
|
|
48
14
|
`while true; do echo done; done` comes out as a keyword, when it is the word
|
|
49
15
|
the loop prints.
|
|
50
16
|
|
|
51
|
-
|
|
52
|
-
|
|
17
|
+
Exercism uses this package in the Bash editor on [exercism.org](https://exercism.org).
|
|
18
|
+
|
|
19
|
+
This code is released under an [MIT license](LICENSE).
|
|
20
|
+
|
|
21
|
+
## Install
|
|
53
22
|
|
|
54
|
-
|
|
55
|
-
|
|
23
|
+
```
|
|
24
|
+
npm install @exercism/codemirror-lang-shell
|
|
25
|
+
```
|
|
56
26
|
|
|
57
27
|
## Usage
|
|
58
28
|
|
|
@@ -82,6 +52,8 @@ shell({shell: "fish"}) // or "csh", or "tcsh"
|
|
|
82
52
|
answers with the `LRLanguage` for a name if you are assembling the extensions
|
|
83
53
|
yourself.
|
|
84
54
|
|
|
55
|
+
`bash()` is an alias for `shell()`. Exercism's Bash editor calls `bash()`.
|
|
56
|
+
|
|
85
57
|
## Coverage
|
|
86
58
|
|
|
87
59
|
The shell command language of IEEE 1003.1, with the bash extensions that are
|
|
@@ -98,6 +70,8 @@ qualifier in `*.txt(D)`. Somebody reading a shell script does not always know
|
|
|
98
70
|
which shell wrote it, and reading more than one shell writes costs an editor
|
|
99
71
|
nothing.
|
|
100
72
|
|
|
73
|
+
The grammar also reads a few more forms found in Exercism's Bash solutions.
|
|
74
|
+
|
|
101
75
|
ksh93's compound types are read too. `typeset -T Point_t=( ... )` puts commands
|
|
102
76
|
where an array puts words, and which of the two a `=(` opens is decided by
|
|
103
77
|
looking for a `;` inside it, since that is a syntax error in an array and the
|
|
@@ -259,10 +233,12 @@ pattern or a replacement.
|
|
|
259
233
|
Syntax highlighting, folding for groups, subshells, loop bodies, `case`
|
|
260
234
|
statements and command substitutions, indentation that knows `fi`, `done`,
|
|
261
235
|
`esac`, `}` and `;;` close what came before them, and completion for the
|
|
262
|
-
reserved words, the shell builtins and the variables the shell sets.
|
|
236
|
+
reserved words, the shell builtins and the variables the shell sets. An `if`
|
|
237
|
+
folds from its `then`. The grammar reads the names after `local`, `declare`
|
|
238
|
+
and `export` as definitions.
|
|
263
239
|
|
|
264
|
-
|
|
265
|
-
declared in the file. Functions are offered everywhere. A variable set with
|
|
240
|
+
Completion also offers snippets, a long list of builtins and common commands,
|
|
241
|
+
and the names declared in the file. Functions are offered everywhere. A variable set with
|
|
266
242
|
`local` or `declare` inside a function is offered only inside that function,
|
|
267
243
|
and any other variable everywhere. After `$` and `${` only variables and the
|
|
268
244
|
positional parameters are offered, and inside `(( ))` and `$(( ))` only
|
|
@@ -284,3 +260,8 @@ npm install # installs the dependencies and builds the package into dist/
|
|
|
284
260
|
npm run build # regenerates the three parsers, then rebuilds the package
|
|
285
261
|
npm test # builds the package, then runs the tests
|
|
286
262
|
```
|
|
263
|
+
|
|
264
|
+
## Contributing
|
|
265
|
+
|
|
266
|
+
Please read about how to [contribute to Exercism](https://exercism.org/docs/building).
|
|
267
|
+
Be sure to read the Exercism [Code of Conduct](https://exercism.org/docs/using/legal/code-of-conduct).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exercism/codemirror-lang-shell",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Shell language support for the CodeMirror code editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"editor",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"homepage": "https://github.com/exercism/codemirror-lang-shell",
|
|
52
52
|
"repository": {
|
|
53
53
|
"type": "git",
|
|
54
|
-
"url": "https://github.com/exercism/codemirror-lang-shell"
|
|
54
|
+
"url": "git+https://github.com/exercism/codemirror-lang-shell.git"
|
|
55
55
|
},
|
|
56
56
|
"bugs": {
|
|
57
57
|
"url": "https://github.com/exercism/codemirror-lang-shell/issues"
|