@exercism/codemirror-lang-swift 1.0.0 → 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 +4 -0
- package/README.md +27 -30
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# @exercism/codemirror-lang-swift [](https://www.npmjs.org/package/@exercism/codemirror-lang-swift)
|
|
2
2
|
|
|
3
|
-
[ [**CHANGELOG**](
|
|
3
|
+
[ [**CHANGELOG**](CHANGELOG.md) ]
|
|
4
4
|
|
|
5
5
|
This package implements Swift language support for the
|
|
6
6
|
[CodeMirror](https://codemirror.net/) code editor, using a
|
|
7
7
|
[Lezer](https://lezer.codemirror.net/) grammar written for this package.
|
|
8
|
+
Exercism uses it in the Swift editor on [exercism.org](https://exercism.org).
|
|
8
9
|
|
|
9
10
|
CodeMirror 6 has never shipped Swift. What it offers is the stream mode ported
|
|
10
11
|
from CodeMirror 5, which colours a list of keywords and leaves no tree behind,
|
|
@@ -12,35 +13,7 @@ so nothing above it can fold a function, indent a switch or ask what the word
|
|
|
12
13
|
under the cursor is. No Lezer grammar for Swift existed anywhere before this
|
|
13
14
|
one.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
platform, where it colours the editor people solve puzzles in.
|
|
17
|
-
|
|
18
|
-
This code is released under an
|
|
19
|
-
[MIT license](https://codeberg.org/reeven/codemirror-lang-swift/src/branch/master/LICENSE).
|
|
20
|
-
|
|
21
|
-
## Exercism's fork
|
|
22
|
-
|
|
23
|
-
This is Exercism's fork of `@codincod/codemirror-lang-swift`, published as
|
|
24
|
-
`@exercism/codemirror-lang-swift`. Our changes are on the `main` branch.
|
|
25
|
-
The original is [@codincod/codemirror-lang-swift](https://codeberg.org/reeven/codemirror-lang-swift)
|
|
26
|
-
by CodinCod. The grammar is unchanged.
|
|
27
|
-
|
|
28
|
-
The fork adds completion to `swift()`:
|
|
29
|
-
|
|
30
|
-
- keywords, and the standard library types and functions that Swift solutions
|
|
31
|
-
use most often
|
|
32
|
-
- snippets for functions, `if`, `if let`, `guard`, loops, `switch`, `do` and
|
|
33
|
-
`catch`, and type definitions
|
|
34
|
-
- the names declared in the file: functions, types, enum cases, generic
|
|
35
|
-
parameters, properties, locals, parameters, closure parameters, and the
|
|
36
|
-
names bound by `for`, `if let`, `guard let` and `case let`, plus `error` in
|
|
37
|
-
a `catch` and `newValue` and `oldValue` in accessors
|
|
38
|
-
|
|
39
|
-
Each name is offered inside its scope. Inside a function body, a local
|
|
40
|
-
is offered after its declaration. Members and top-level names are offered
|
|
41
|
-
anywhere, because Swift lets code use them before they are declared.
|
|
42
|
-
Completion stays quiet inside strings and comments, and where a new name is
|
|
43
|
-
being written. Code inside `\( )` in a string still gets names.
|
|
16
|
+
This code is released under an [MIT license](LICENSE).
|
|
44
17
|
|
|
45
18
|
## Install
|
|
46
19
|
|
|
@@ -68,6 +41,25 @@ const view = new EditorView({
|
|
|
68
41
|
})
|
|
69
42
|
```
|
|
70
43
|
|
|
44
|
+
## Completion
|
|
45
|
+
|
|
46
|
+
`swift()` includes completion for:
|
|
47
|
+
|
|
48
|
+
- keywords, and the standard library types and functions that Swift solutions
|
|
49
|
+
use most often
|
|
50
|
+
- snippets for functions, `if`, `if let`, `guard`, loops, `switch`, `do` and
|
|
51
|
+
`catch`, and type definitions
|
|
52
|
+
- the names declared in the file: functions, types, enum cases, generic
|
|
53
|
+
parameters, properties, locals, parameters, closure parameters, and the
|
|
54
|
+
names bound by `for`, `if let`, `guard let` and `case let`, plus `error` in
|
|
55
|
+
a `catch` and `newValue` and `oldValue` in accessors
|
|
56
|
+
|
|
57
|
+
Each name is offered inside its scope. Inside a function body, a local
|
|
58
|
+
is offered after its declaration. Members and top-level names are offered
|
|
59
|
+
anywhere, because Swift lets code use them before they are declared.
|
|
60
|
+
Completion stays quiet inside strings and comments, and where a new name is
|
|
61
|
+
being written. Code inside `\( )` in a string still gets names.
|
|
62
|
+
|
|
71
63
|
## Coverage
|
|
72
64
|
|
|
73
65
|
Swift 6.2. Async and await, actors, structured concurrency, opaque and
|
|
@@ -170,3 +162,8 @@ npm install # installs the dependencies and builds dist/
|
|
|
170
162
|
npm run build # regenerates the parser and rebuilds dist/
|
|
171
163
|
npm test # builds, then runs the tests
|
|
172
164
|
```
|
|
165
|
+
|
|
166
|
+
## Contributing
|
|
167
|
+
|
|
168
|
+
Please read about how to [contribute to Exercism](https://exercism.org/docs/building).
|
|
169
|
+
Be sure to read the Exercism [Code of Conduct](https://exercism.org/docs/using/legal/code-of-conduct).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exercism/codemirror-lang-swift",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Swift language support for the CodeMirror code editor, with completion, for Exercism",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"editor",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"homepage": "https://github.com/exercism/codemirror-lang-swift",
|
|
46
46
|
"repository": {
|
|
47
47
|
"type": "git",
|
|
48
|
-
"url": "https://github.com/exercism/codemirror-lang-swift"
|
|
48
|
+
"url": "git+https://github.com/exercism/codemirror-lang-swift.git"
|
|
49
49
|
},
|
|
50
50
|
"bugs": {
|
|
51
51
|
"url": "https://github.com/exercism/codemirror-lang-swift/issues"
|