@exercism/codemirror-lang-clojure 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.
Files changed (3) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +38 -12
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.0.1
2
+
3
+ The README is restructured. This release is the first published from GitHub Actions, with npm provenance.
4
+
1
5
  # Changelog
2
6
 
3
7
  ## 1.0.0
package/README.md CHANGED
@@ -1,12 +1,16 @@
1
- # @exercism/codemirror-lang-clojure
1
+ # @nextjournal/lezer-clojure [![NPM version](https://img.shields.io/npm/v/@nextjournal/lezer-clojure.svg)](https://www.npmjs.com/package/@nextjournal/lezer-clojure)
2
2
 
3
- This package gives the [CodeMirror 6](https://codemirror.net/) editor support for Clojure, with a [Lezer](https://lezer.codemirror.net/) grammar, highlighting, indentation, folding and autocompletion. Exercism uses it in the editor on [exercism.org](https://exercism.org).
3
+ ## Exercism's fork
4
4
 
5
- It is a fork of [nextjournal/lezer-clojure](https://github.com/nextjournal/lezer-clojure) by Martin Kavalar and Andrea Amantini at Nextjournal. The grammar comes from that repo, and the highlighting and indentation come from [nextjournal/lang-clojure](https://github.com/nextjournal/lang-clojure) by Andrea Amantini. Both are licensed under the ISC licence, and so is this fork.
5
+ This is Exercism's fork of [nextjournal/lezer-clojure](https://github.com/nextjournal/lezer-clojure), by Martin Kavalar and Andrea Amantini at Nextjournal.
6
+ Exercism uses it in the Clojure editor on [exercism.org](https://exercism.org).
7
+ It is published on npm as `@exercism/codemirror-lang-clojure`.
8
+ Our changes are on the `exercism` branch, and the `main` branch follows upstream.
9
+ Below this section, the README is upstream's.
6
10
 
7
- The `main` branch follows upstream. Exercism's work is on the `exercism` branch.
8
-
9
- ## What the fork adds
11
+ The fork turns the grammar into a full CodeMirror 6 language package, with highlighting, indentation, folding and autocompletion.
12
+ The highlighting and indentation come from [nextjournal/lang-clojure](https://github.com/nextjournal/lang-clojure) by Andrea Amantini.
13
+ Both projects are licensed under the ISC licence, and so is this fork.
10
14
 
11
15
  The grammar has nodes for the names bound by a form, so the editor can highlight them and offer them as completions:
12
16
 
@@ -16,25 +20,29 @@ The grammar has nodes for the names bound by a form, so the editor can highlight
16
20
  - Destructuring works in all of these, for example `[{:keys [a b] :as m} & more]`.
17
21
  - Special forms and the core macros (`if`, `when`, `cond`, `->` and so on) are highlighted as keywords when they start a list. Other symbols that start a list are highlighted as function calls.
18
22
 
19
- Every new form also parses as an ordinary list. If a form does not have the shape expected by the grammar (for example while it is still being typed), it parses as a plain list.
23
+ If a form does not have the shape expected by the grammar (for example while it is still being typed), it parses as a plain list.
20
24
 
21
25
  The completion offers:
22
26
 
23
27
  - special forms, and the public functions, macros and vars of `clojure.core`.
24
- - snippets for `defn`, `fn`, `let`, `if`, `when`, `cond`, `case`, `loop`, `doseq`, `for`, `ns`, `defrecord`, `defprotocol`, `defmulti`, `defmethod`, `try` and the threading macros. If the word follows an open paren, the snippet goes inside it. Otherwise the snippet brings its own parens.
28
+ - snippets for `defn`, `fn`, `let`, `if`, `when`, `cond`, `case`, `loop`, `doseq`, `for`, `ns`, `defrecord`, `defprotocol`, `defmulti`, `defmethod`, `try` and the threading macros. If the word follows an open paren, the snippet goes inside that paren. Otherwise the snippet includes its own parens.
25
29
  - the names defined with `def`, `defn` and the like anywhere in the file, and the `->Name` and `map->Name` constructors of each record.
26
30
  - local names (bindings and parameters) inside the form that binds them, once they are bound.
27
31
  - `clojure.string` and `clojure.set` functions, both with the full namespace (`clojure.string/join`) and with the alias given in the `ns` form (`str/join`).
28
32
 
29
33
  It offers nothing inside strings, comments, keywords or numbers, or while a new name is being typed.
30
34
 
31
- ## Install
35
+ The lists in `src/builtins.js` come from the public vars of Clojure 1.12.7.
36
+
37
+ ### Install and use
38
+
39
+ To install it, run:
32
40
 
33
41
  ```sh
34
42
  npm install @exercism/codemirror-lang-clojure
35
43
  ```
36
44
 
37
- ## Usage
45
+ Then add `clojure()` to the editor's extensions:
38
46
 
39
47
  ```js
40
48
  import {EditorView, basicSetup} from "codemirror"
@@ -49,8 +57,26 @@ new EditorView({
49
57
 
50
58
  The package also exports `parser` (the Lezer parser), `clojureLanguage`, the two completion sources (`localCompletionSource` and `builtinCompletionSource`) and the lists of `builtins`.
51
59
 
52
- ## Developing
60
+ ### Building and testing
53
61
 
54
62
  Run `npm install`, then `npm run build` to build the parser and the package, and `npm test` to run the tests. The grammar tests are in `test/*.txt`, and the completion and language tests are in `test/test-completion.js` and `test/test-language.js`.
55
63
 
56
- The lists in `src/builtins.js` come from the public vars of Clojure 1.12.7.
64
+ ### Contributing
65
+
66
+ Contributions to this fork follow the Exercism [Code of Conduct](https://exercism.org/docs/using/legal/code-of-conduct).
67
+ Please read about how to [contribute to Exercism](https://exercism.org/docs/building).
68
+
69
+ ---
70
+
71
+ This is a Clojure grammar for the
72
+ [lezer](https://lezer.codemirror.net/) parser system.
73
+
74
+ The code is licensed under an ISC license.
75
+
76
+ # Dev
77
+
78
+ To watch & test, with [entr](http://eradman.com/entrproject/) installed run `npm run watch`
79
+
80
+ # Previous Package Name
81
+
82
+ This package has been previously released (unscoped) as [lezer-clojure](https://www.npmjs.com/package/lezer-clojure).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exercism/codemirror-lang-clojure",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Clojure language support for CodeMirror, with a Lezer grammar and autocompletion",
5
5
  "main": "dist/index.cjs",
6
6
  "author": "Martin Kavalar <martin@nextjournal.com>",