@exercism/codemirror-lang-julia 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +78 -2
- package/dist/index.cjs +2116 -0
- package/dist/index.d.cts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +2086 -0
- package/package.json +59 -4
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,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@plutojl/lang-julia` [](https://www.npmjs.org/package/@plutojl/lang-julia)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Exercism's fork
|
|
4
|
+
|
|
5
|
+
This is Exercism's fork of [`@plutojl/lang-julia`](https://github.com/JuliaPluto/lang-julia), by the Pluto team.
|
|
6
|
+
Exercism uses it in the Julia editor on [exercism.org](https://exercism.org).
|
|
7
|
+
It is published on npm as `@exercism/codemirror-lang-julia`.
|
|
8
|
+
Our changes are on the `exercism` branch, and the `main` branch follows upstream.
|
|
9
|
+
Below this section, the README is upstream's.
|
|
10
|
+
|
|
11
|
+
The grammar comes from `@exercism/lezer-julia`, Exercism's fork of [`@plutojl/lezer-julia`](https://github.com/JuliaPluto/lezer-julia).
|
|
12
|
+
The fork adds autocompletion, which offers these names:
|
|
13
|
+
|
|
14
|
+
- 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.
|
|
15
|
+
- The names exported by `Core` and `Base`, with the first signature from each docstring.
|
|
16
|
+
- The names exported by `Dates`, `Printf`, `Random`, `Statistics`, `LinearAlgebra`, `Unicode` and `Test`, once the file has a `using` or `import` line for that library.
|
|
17
|
+
- The names in a module after `Base.` or `Dates.`.
|
|
18
|
+
- 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`.
|
|
19
|
+
|
|
20
|
+
Completion is off inside strings and comments, except in `$(...)` interpolations.
|
|
21
|
+
|
|
22
|
+
`src/base-names.ts` lists the names in `Core` and `Base`, and a script generates it by running Julia.
|
|
23
|
+
To regenerate it, run `npm run base-names` (this needs Docker).
|
|
24
|
+
The file holds each name, its kind and one signature line.
|
|
25
|
+
|
|
26
|
+
### Install and use
|
|
27
|
+
|
|
28
|
+
To install it, run:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
npm install @exercism/codemirror-lang-julia
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Then add `julia()` to the editor's extensions:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
import { julia } from "@exercism/codemirror-lang-julia";
|
|
38
|
+
|
|
39
|
+
let state = EditorState.create({
|
|
40
|
+
extensions: [julia()],
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`julia()` turns on completion by default.
|
|
45
|
+
Pass `julia({ enableCompletion: false })` to turn it off, or `julia({ enableCompletion: false, enableKeywordCompletion: true })` to complete keywords only, as upstream does.
|
|
46
|
+
|
|
47
|
+
### Building and testing
|
|
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).
|
|
52
|
+
|
|
53
|
+
### Contributing
|
|
54
|
+
|
|
55
|
+
Contributions to this fork follow the Exercism [Code of Conduct](https://exercism.org/docs/using/legal/code-of-conduct).
|
|
56
|
+
Please read about how to [contribute to Exercism](https://exercism.org/docs/building).
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
This package implements [Julia](https://julialang.org) language support for the [CodeMirror 6](https://codemirror.net) code editor.
|
|
61
|
+
|
|
62
|
+
This is a wrapper around [`@plutojl/lezer-julia`](https://github.com/JuliaPluto/lezer-julia). Go there for issues, latest developments, releases and more.
|
|
63
|
+
|
|
64
|
+
## Demo site
|
|
65
|
+
See this parser in action on our demo page: https://juliapluto.github.io/lang-julia-demo/
|
|
66
|
+
|
|
67
|
+
## Usage
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
import { julia } from "@exercism/codemirror-lang-julia";
|
|
71
|
+
|
|
72
|
+
let state = EditorState.create({
|
|
73
|
+
...
|
|
74
|
+
extensions: [
|
|
75
|
+
julia(),
|
|
76
|
+
...
|
|
77
|
+
]
|
|
78
|
+
});
|
|
79
|
+
```
|