@exercism/codemirror-lang-perl 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) 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,54 @@
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
+ This package implements Perl language support for the [CodeMirror](https://codemirror.net/6/) code editor.
4
+
5
+ This code is released under an [MIT license](https://github.com/drgrice1/lang-perl/tree/main/LICENSE).
6
+
7
+ ## Exercism's branch
8
+
9
+ This is Exercism's fork of [drgrice1/codemirror-lang-perl](https://github.com/drgrice1/codemirror-lang-perl), by Glenn Rice.
10
+ The `main` branch follows upstream.
11
+ Exercism's work is on the `exercism` branch, which is published as `@exercism/codemirror-lang-perl` and used by the editor on [exercism.org](https://exercism.org).
12
+
13
+ The `exercism` branch adds:
14
+
15
+ - Autocomplete for keywords, builtin functions, snippets, and the variables, subs, packages and constants declared in the file.
16
+ A `my` variable is offered after its declaration, inside the block that declares it.
17
+ After a `$`, the elements of declared arrays and hashes are offered too, so `@items` gives `$items`.
18
+ - Postfix dereference, such as `$list->@*`, `$hash->%*`, `$list->$#*` and the slices `$list->@[0, 1]` and `$hash->@{...}`.
19
+ - The class feature of Perl 5.38: `class`, `field`, `method` and `ADJUST`.
20
+ - `given`, `when` and `default` blocks.
21
+ - Smaller parsing improvements, such as `s"a"b"`, `y///c`, `grep /x/, @list` and `/^$word$/`.
22
+
23
+ ## Install
24
+
25
+ ```sh
26
+ npm install @exercism/codemirror-lang-perl
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ```js
32
+ import { EditorView, basicSetup } from 'codemirror';
33
+ import { perl } from '@exercism/codemirror-lang-perl';
34
+
35
+ new EditorView({
36
+ doc: 'my $name = "World";\nprint "Hello, $name!\\n";\n',
37
+ extensions: [basicSetup, perl()],
38
+ parent: document.body
39
+ });
40
+ ```
41
+
42
+ ## API Reference
43
+
44
+ - perl() → [LanguageSupport](https://codemirror.net/docs/ref#language.LanguageSupport)
45
+ - perlLanguage: [LRLanguage](https://codemirror.net/docs/ref#language.LRLanguage)
46
+ - perlCompletion: the two completion sources below, as language data
47
+ - localCompletionSource: completes names declared in the file
48
+ - keywordCompletionSource: completes keywords, builtin functions and snippets
49
+ - snippets: the snippets offered by keywordCompletionSource
50
+
51
+ ## Development
52
+
53
+ Run `npm install` to install the dependencies and build the package into `dist/`.
54
+ Run `npm run build` to rebuild it, and `npm test` to run the tests.