@exercism/codemirror-lang-erlang 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 +32 -30
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,33 +1,9 @@
|
|
|
1
1
|
# @exercism/codemirror-lang-erlang
|
|
2
2
|
|
|
3
|
-
This is Exercism's fork of
|
|
4
|
-
[@codincod/codemirror-lang-erlang](https://codeberg.org/reeven/codemirror-lang-erlang),
|
|
5
|
-
written by CodinCod. Exercism uses it in the Erlang editor on
|
|
6
|
-
[exercism.org](https://exercism.org). Our changes are on the `main` branch.
|
|
7
|
-
|
|
8
|
-
The fork adds three things:
|
|
9
|
-
|
|
10
|
-
- The grammar reads an attribute with spaces after its hyphen, such as
|
|
11
|
-
`- spec f() -> ok.`, which the compiler accepts.
|
|
12
|
-
- Completion offers the names declared in the file. That covers the file's
|
|
13
|
-
functions with their arities (as `add/2` inside `-export([...])` and after
|
|
14
|
-
`fun`), macros after `?`, records after `#`, a record's fields after
|
|
15
|
-
`#point.` and inside its braces, and the variables of the clause around the
|
|
16
|
-
cursor. Completion offers a variable bound inside a `fun` or a comprehension within
|
|
17
|
-
that `fun` or comprehension.
|
|
18
|
-
- Completion offers the functions of `lists`, `maps`, `string`, `io`,
|
|
19
|
-
`io_lib`, `math`, `proplists` and `erlang` after the module name and a colon,
|
|
20
|
-
attribute names after a hyphen at the start of a line, and snippets for
|
|
21
|
-
function clauses, `case`, `if`, `receive`, `fun`, `try`, `begin` and the
|
|
22
|
-
`-module` and `-export` header. Completion is switched off inside
|
|
23
|
-
strings and comments.
|
|
24
|
-
|
|
25
|
-
The rest of this README is upstream's.
|
|
26
|
-
|
|
27
|
-
|
|
28
3
|
Erlang language support for [CodeMirror 6](https://codemirror.net/), built on a
|
|
29
4
|
[Lezer](https://lezer.codemirror.net/) grammar written from scratch. No Lezer
|
|
30
|
-
grammar for Erlang existed before this one.
|
|
5
|
+
grammar for Erlang existed before this one. Exercism uses it in the Erlang
|
|
6
|
+
editor on [exercism.org](https://exercism.org).
|
|
31
7
|
|
|
32
8
|
```bash
|
|
33
9
|
npm install @exercism/codemirror-lang-erlang
|
|
@@ -44,9 +20,27 @@ new EditorView({
|
|
|
44
20
|
})
|
|
45
21
|
```
|
|
46
22
|
|
|
47
|
-
`erlang()` returns the language with completion
|
|
48
|
-
|
|
49
|
-
|
|
23
|
+
`erlang()` returns the language with completion. `erlangLanguage` is the
|
|
24
|
+
language without completion, and `parser` is the Lezer parser that it uses.
|
|
25
|
+
|
|
26
|
+
## Completion
|
|
27
|
+
|
|
28
|
+
Completion offers keywords, guards and the parts of OTP that people use most. It
|
|
29
|
+
also offers:
|
|
30
|
+
|
|
31
|
+
- The names declared in the file. That covers the file's functions with their
|
|
32
|
+
arities (as `add/2` inside `-export([...])` and after `fun`), macros after
|
|
33
|
+
`?`, records after `#`, a record's fields after `#point.` and inside its
|
|
34
|
+
braces, and the variables of the clause around the cursor. Completion offers
|
|
35
|
+
a variable bound inside a `fun` or a comprehension within that `fun` or
|
|
36
|
+
comprehension.
|
|
37
|
+
- The functions of `lists`, `maps`, `string`, `io`, `io_lib`, `math`,
|
|
38
|
+
`proplists` and `erlang` after the module name and a colon.
|
|
39
|
+
- Attribute names after a hyphen at the start of a line.
|
|
40
|
+
- Snippets for function clauses, `case`, `if`, `receive`, `fun`, `try`,
|
|
41
|
+
`begin` and the `-module` and `-export` header.
|
|
42
|
+
|
|
43
|
+
Completion is switched off inside strings and comments.
|
|
50
44
|
|
|
51
45
|
## What it reads
|
|
52
46
|
|
|
@@ -61,6 +55,9 @@ them rather than in a module. A form may be a bare expression, which is what
|
|
|
61
55
|
the shell is handed, and a pasted shell session is read as what was typed at
|
|
62
56
|
each prompt and the term printed under it.
|
|
63
57
|
|
|
58
|
+
The grammar reads an attribute with spaces after its hyphen, such as
|
|
59
|
+
`- spec f() -> ok.`, which the compiler accepts.
|
|
60
|
+
|
|
64
61
|
Measured against 8923 files of OTP, RabbitMQ, EMQX, ejabberd, Cowboy, rebar3
|
|
65
62
|
and thirteen other projects: 98.11% parse with no error node.
|
|
66
63
|
|
|
@@ -80,4 +77,9 @@ npm test # builds, then runs the tests
|
|
|
80
77
|
|
|
81
78
|
## Licence
|
|
82
79
|
|
|
83
|
-
MIT.
|
|
80
|
+
This code is released under an [MIT license](LICENSE).
|
|
81
|
+
|
|
82
|
+
## Contributing
|
|
83
|
+
|
|
84
|
+
Please read about how to [contribute to Exercism](https://exercism.org/docs/building).
|
|
85
|
+
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-erlang",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Erlang language support for the CodeMirror code editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"beam",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"homepage": "https://github.com/exercism/codemirror-lang-erlang",
|
|
48
48
|
"repository": {
|
|
49
49
|
"type": "git",
|
|
50
|
-
"url": "https://github.com/exercism/codemirror-lang-erlang"
|
|
50
|
+
"url": "git+https://github.com/exercism/codemirror-lang-erlang.git"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|