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