@exercism/codemirror-lang-rust 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/CHANGELOG.md ADDED
@@ -0,0 +1,71 @@
1
+ ## 1.0.1
2
+
3
+ The README is restructured. This release is the first published from GitHub Actions, with npm provenance.
4
+
5
+ ## 1.0.0
6
+
7
+ This is Exercism's first release of the package, published as
8
+ `@exercism/codemirror-lang-rust`. It adds completion of keywords, `std` names,
9
+ macros, snippets and the names in scope, and of members after a `.` or `::`.
10
+
11
+ ## 6.0.2 (2025-06-19)
12
+
13
+ ### Bug fixes
14
+
15
+ Add a .d.cts file to make TypeScript happy.
16
+ ## 6.0.1 (2022-10-24)
17
+
18
+ ### Bug fixes
19
+
20
+ Allow prefixed strings to be closed by `closeBrackets`.
21
+
22
+ ## 6.0.0 (2022-06-08)
23
+
24
+ ### Breaking changes
25
+
26
+ Update dependencies to 6.0.0
27
+
28
+ ## 0.20.0 (2022-04-20)
29
+
30
+ ### Breaking changes
31
+
32
+ Update dependencies to 0.20.0
33
+
34
+ ## 0.19.2 (2022-03-21)
35
+
36
+ ### Bug fixes
37
+
38
+ Add syntax highlighting for character literals
39
+
40
+ Make sure the editor doesn't indent statements with attributes before them.
41
+
42
+ ## 0.19.1 (2021-08-11)
43
+
44
+ ### Bug fixes
45
+
46
+ Fix incorrect versions for @lezer dependencies.
47
+
48
+ ## 0.19.0 (2021-08-11)
49
+
50
+ ### Breaking changes
51
+
52
+ Update dependencies to 0.19.0
53
+
54
+ ## 0.18.0 (2021-03-03)
55
+
56
+ ### Breaking changes
57
+
58
+ Update dependencies to 0.18.
59
+
60
+ ## 0.17.1 (2021-01-06)
61
+
62
+ ### New features
63
+
64
+ The package now also exports a CommonJS module.
65
+
66
+ ## 0.17.0 (2020-12-29)
67
+
68
+ ### Breaking changes
69
+
70
+ First numbered release.
71
+
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (C) 2018-2021 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
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,112 @@
1
- # Temporary Holding Version
1
+ <!-- NOTE: README.md is generated from src/README.md -->
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
+ # @codemirror/lang-rust [![NPM version](https://img.shields.io/npm/v/@codemirror/lang-rust.svg)](https://www.npmjs.org/package/@codemirror/lang-rust)
4
+
5
+ ## Exercism's fork
6
+
7
+ This is Exercism's fork of [@codemirror/lang-rust](https://code.haverbeke.berlin/codemirror/lang-rust).
8
+ Exercism uses it in the Rust editor on [exercism.org](https://exercism.org).
9
+ It is published on npm as `@exercism/codemirror-lang-rust`.
10
+ Our changes are on the `exercism` branch, and the `main` branch follows upstream.
11
+ Below this section, the README is upstream's.
12
+
13
+ The fork adds autocompletion:
14
+
15
+ - Keywords, primitive types, prelude names (such as `Option`, `Some`
16
+ and `Iterator`) and common `std` types (such as `HashMap`).
17
+ - The standard macros (such as `println!`, `vec!` and `assert_eq!`), as
18
+ snippets.
19
+ - Snippets for functions, structs, enums, traits, impl blocks, `if`,
20
+ `if let`, `match`, loops, closures and test modules.
21
+ - Names declared in the file, where they are in scope: functions,
22
+ structs, enums, traits, constants, modules, `use` imports, macros,
23
+ generic parameters, parameters, `let` bindings (after the `let`), and
24
+ names bound by `for`, `match`, `if let`, `while let` and closures.
25
+ - Fields, methods and common `std` methods after a `.`.
26
+ - Enum variants and associated functions after `Type::` and `Self::`.
27
+
28
+ Completion offers nothing inside strings and comments, or where you declare a new name.
29
+
30
+ ### Install
31
+
32
+ ```
33
+ npm install @exercism/codemirror-lang-rust
34
+ ```
35
+
36
+ ### Building and testing
37
+
38
+ To build and test it from a checkout, run `npm install` (which also builds the package), then `npm test`.
39
+
40
+ ### Contributing
41
+
42
+ Contributions to this fork follow the Exercism [Code of Conduct](https://exercism.org/docs/using/legal/code-of-conduct).
43
+ Please read about how to [contribute to Exercism](https://exercism.org/docs/building).
44
+
45
+ ---
46
+
47
+ [ [**WEBSITE**](https://codemirror.net/) | [**ISSUES**](https://code.haverbeke.berlin/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://code.haverbeke.berlin/codemirror/lang-rust/src/branch/main/CHANGELOG.md) ]
48
+
49
+ This package implements Rust language support for the
50
+ [CodeMirror](https://codemirror.net/) code editor.
51
+
52
+ The [project page](https://codemirror.net/) has more information, a
53
+ number of [examples](https://codemirror.net/examples/) and the
54
+ [documentation](https://codemirror.net/docs/).
55
+
56
+ This code is released under an
57
+ [MIT license](https://code.haverbeke.berlin/codemirror/lang-rust/tree/main/LICENSE).
58
+
59
+ We aim to be an inclusive, welcoming community. To make that explicit,
60
+ we have a [code of
61
+ conduct](http://contributor-covenant.org/version/1/1/0/) that applies
62
+ to communication around the project.
63
+
64
+ ## Usage
65
+
66
+ ```javascript
67
+ import {EditorView, basicSetup} from "codemirror"
68
+ import {rust} from "@exercism/codemirror-lang-rust"
69
+
70
+ const view = new EditorView({
71
+ parent: document.body,
72
+ doc: `println!("Hello World!");`,
73
+ extensions: [basicSetup, rust()]
74
+ })
75
+ ```
76
+
77
+ ## API Reference
78
+
79
+ <dl>
80
+ <dt id="user-content-rust">
81
+ <code><strong><a href="#user-content-rust">rust</a></strong>() → <a href="https://codemirror.net/docs/ref#language.LanguageSupport">LanguageSupport</a></code></dt>
82
+
83
+ <dd><p>Rust language support. Includes snippet, keyword and local name completion.</p>
84
+ </dd>
85
+ <dt id="user-content-rustlanguage">
86
+ <code><strong><a href="#user-content-rustlanguage">rustLanguage</a></strong>: <a href="https://codemirror.net/docs/ref#language.LRLanguage">LRLanguage</a></code></dt>
87
+
88
+ <dd><p>A syntax provider based on the <a href="https://code.haverbeke.berlin/lezer/rust">Lezer Rust
89
+ parser</a>, extended with
90
+ highlighting and indentation information.</p>
91
+ </dd>
92
+ <dt id="user-content-snippets">
93
+ <code><strong><a href="#user-content-snippets">snippets</a></strong>: readonly <a href="https://codemirror.net/docs/ref#autocomplete.Completion">Completion</a>[]</code></dt>
94
+
95
+ <dd><p>A collection of Rust-related snippets.</p>
96
+ </dd>
97
+ <dt id="user-content-localcompletionsource">
98
+ <code><strong><a href="#user-content-localcompletionsource">localCompletionSource</a></strong>: <a href="https://codemirror.net/docs/ref#autocomplete.CompletionSource">CompletionSource</a></code></dt>
99
+
100
+ <dd><p>Completion source that looks up names declared in Rust code. It offers names in scope at the cursor, fields and methods after <code>.</code>, and variants and associated functions after <code>Type::</code>.</p>
101
+ </dd>
102
+ <dt id="user-content-keywordcompletionsource">
103
+ <code><strong><a href="#user-content-keywordcompletionsource">keywordCompletionSource</a></strong>: <a href="https://codemirror.net/docs/ref#autocomplete.CompletionSource">CompletionSource</a></code></dt>
104
+
105
+ <dd><p>Completion source for Rust's keywords, built-in and prelude names, standard macros and snippets. It stays quiet inside strings and comments, after <code>.</code> and in <code>::</code> paths.</p>
106
+ </dd>
107
+ <dt id="user-content-builtins">
108
+ <code><strong><a href="#user-content-builtins">builtins</a></strong>, <strong><a href="#user-content-builtins">macros</a></strong>, <strong><a href="#user-content-builtins">commonMethods</a></strong>: readonly <a href="https://codemirror.net/docs/ref#autocomplete.Completion">Completion</a>[]</code></dt>
109
+
110
+ <dd><p>The fixed lists behind the completion sources.</p>
111
+ </dd>
112
+ </dl>