@exercism/codemirror-lang-perl 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (C) 2024 by Glenn Rice <grice1@missouriwestern.edu>
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
13
+ all 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
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,68 @@
1
- # Temporary Holding Version
1
+ # CodeMirror 6 Perl language package
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
+ ## Exercism's fork
4
+
5
+ This is Exercism's fork of [drgrice1/codemirror-lang-perl](https://github.com/drgrice1/codemirror-lang-perl), by Glenn Rice.
6
+ Exercism uses it in the Perl editor on [exercism.org](https://exercism.org).
7
+ It is published on npm as `@exercism/codemirror-lang-perl`.
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 fork adds:
12
+
13
+ - Autocomplete for keywords, builtin functions, snippets, and the variables, subs, packages and constants declared in the file.
14
+ A `my` variable is offered after its declaration, inside the block that declares it.
15
+ After a `$`, it also offers the elements of declared arrays and hashes, so a declared `@items` gives `$items`.
16
+ - Postfix dereference, such as `$list->@*`, `$hash->%*`, `$list->$#*` and the slices `$list->@[0, 1]` and `$hash->@{...}`.
17
+ - The class feature of Perl 5.38: `class`, `field`, `method` and `ADJUST`.
18
+ - `given`, `when` and `default` blocks.
19
+ - Smaller parsing improvements, such as `s"a"b"`, `y///c`, `grep /x/, @list` and `/^$word$/`.
20
+
21
+ As well as `perl()` and `perlLanguage`, the package exports:
22
+
23
+ - `perlCompletion`, which holds the two completion sources below as language data.
24
+ - `localCompletionSource`, which completes the names declared in the file.
25
+ - `keywordCompletionSource`, which completes keywords, builtin functions and snippets.
26
+ - `snippets`, which holds the snippets offered by `keywordCompletionSource`.
27
+
28
+ ### Install and use
29
+
30
+ To install it, run:
31
+
32
+ ```sh
33
+ npm install @exercism/codemirror-lang-perl
34
+ ```
35
+
36
+ Then add `perl()` to the editor's extensions:
37
+
38
+ ```js
39
+ import { EditorView, basicSetup } from 'codemirror';
40
+ import { perl } from '@exercism/codemirror-lang-perl';
41
+
42
+ new EditorView({
43
+ doc: 'my $name = "World";\nprint "Hello, $name!\\n";\n',
44
+ extensions: [basicSetup, perl()],
45
+ parent: document.body
46
+ });
47
+ ```
48
+
49
+ ### Building and testing
50
+
51
+ Run `npm install` to install the dependencies and build the package into `dist/`.
52
+ Run `npm run build` to rebuild it, and `npm test` to run the tests.
53
+
54
+ ### Contributing
55
+
56
+ Contributions to this fork follow the Exercism [Code of Conduct](https://exercism.org/docs/using/legal/code-of-conduct).
57
+ Please read about how to [contribute to Exercism](https://exercism.org/docs/building).
58
+
59
+ ---
60
+
61
+ This package implements Perl language support for the [CodeMirror](https://codemirror.net/6/) code editor.
62
+
63
+ This code is released under an [MIT license](https://github.com/drgrice1/lang-perl/tree/main/LICENSE).
64
+
65
+ ## API Reference
66
+
67
+ - perl() → [LanguageSupport](https://codemirror.net/docs/ref#language.LanguageSupport)
68
+ - perlLanguage: [LRLanguage](https://codemirror.net/docs/ref#language.LRLanguage)