@exercism/codemirror-lang-julia 0.0.0-stage → 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Andrey Popp
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,51 @@
1
- # Temporary Holding Version
1
+ # `@exercism/codemirror-lang-julia`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ This package gives the [CodeMirror 6](https://codemirror.net) editor support for [Julia](https://julialang.org): highlighting, indentation, folding and autocompletion.
4
+ Exercism uses it in the editor on exercism.org.
5
+
6
+ It is Exercism's fork of [`@plutojl/lang-julia`](https://github.com/JuliaPluto/lang-julia), by the Pluto team.
7
+ The `main` branch tracks upstream. Exercism's changes are on the `exercism` branch.
8
+ The grammar comes from `@exercism/lezer-julia`, Exercism's fork of [`@plutojl/lezer-julia`](https://github.com/JuliaPluto/lezer-julia).
9
+
10
+ ## Usage
11
+
12
+ To use it, install it from npm:
13
+
14
+ ```
15
+ npm install @exercism/codemirror-lang-julia
16
+ ```
17
+
18
+ Then add `julia()` to the editor's extensions:
19
+
20
+ ```js
21
+ import { julia } from "@exercism/codemirror-lang-julia";
22
+
23
+ let state = EditorState.create({
24
+ extensions: [julia()],
25
+ });
26
+ ```
27
+
28
+ `julia()` turns on completion by default.
29
+ Pass `julia({ enableCompletion: false })` to turn it off, or `julia({ enableCompletion: false, enableKeywordCompletion: true })` to complete keywords only, as upstream does.
30
+
31
+ ## Completion
32
+
33
+ Completion offers these names:
34
+
35
+ - Julia's keywords, and snippets for `function`, `struct`, `mutable struct`, `abstract type`, `module`, `macro`, `if`, `if`/`else`, `if`/`elseif`/`else`, `for`, `while`, `let`, `do`, `begin`, `try`/`catch` and comprehensions.
36
+ - The names exported by `Core` and `Base`, with the first signature from each docstring.
37
+ - The names exported by `Dates`, `Printf`, `Random`, `Statistics`, `LinearAlgebra`, `Unicode` and `Test`, once the file has a `using` or `import` line for that library.
38
+ - The names in a module after `Base.` or `Dates.`.
39
+ - Names defined in the file and in scope at the cursor: functions, macros, structs and other types, modules, constants, variables, parameters, keyword arguments, type parameters, struct fields, and the variables of loops, comprehensions, `let`, `do` blocks, arrow functions and `catch`.
40
+
41
+ Completion is off inside strings and comments, except in `$(...)` interpolations.
42
+
43
+ `src/base-names.ts` lists the names in `Core` and `Base`, and a script generates it by running Julia.
44
+ To regenerate it, run `npm run base-names` (this needs Docker).
45
+ The file holds each name, its kind and one signature line.
46
+
47
+ ## Development
48
+
49
+ To install the dependencies and build the package, run `npm install`.
50
+ To build it again after a change, run `npm run prepare`.
51
+ To run the tests, run `bun test`. The tests need [Bun](https://bun.sh).