Skip to content

Commit 9da7941

Browse files
Improved tutorial definitions for better docs inclusion (#3342)
1 parent 0ea521a commit 9da7941

68 files changed

Lines changed: 612 additions & 331 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎cursorless-talon/src/cursorless.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def private_cursorless_show_command_statistics():
3434
def private_cursorless_start_tutorial():
3535
"""Start the introductory Cursorless tutorial"""
3636
actions.user.private_cursorless_run_rpc_command_no_wait(
37-
"cursorless.tutorial.start", "tutorial-1-basics"
37+
"cursorless.tutorial.start", "1-introduction"
3838
)
3939

4040
def private_cursorless_tutorial_next():

‎packages/app-web-docs/src/docs/user/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar_position: 1
55

66
# Cursorless
77

8-
Welcome to Cursorless! If you're new, start with the [learning resources](./learning-resources.md) or the [how-to guides](./how-to.md).
8+
Welcome to Cursorless! If you're new, start with the [tutorial](./tutorial/README.mdx) or the [learning resources](./learning-resources.md).
99

1010
This guide assumes you've already [installed Cursorless](./installation.md).
1111

packages/app-web-docs/src/docs/user/tutorial/1-basics.mdx renamed to packages/app-web-docs/src/docs/user/tutorial/1-introduction.mdx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { RecordedTestVisualizer, RecordedTestVisualizerOptions, RecordedTestVisualizerProvider } from "@site/src/docs/components/RecordedTestVisualizer";
2-
import recordedTests from "./fixtures/1-basics.json";
2+
import recordedTests from "./fixtures/1-introduction.json";
33

44
# 1. Introduction
55

6+
This tutorial will teach you the basics of Cursorless.
7+
68
<RecordedTestVisualizerProvider recordedTests={recordedTests}>
79

810
<RecordedTestVisualizerOptions />
@@ -11,78 +13,76 @@ import recordedTests from "./fixtures/1-basics.json";
1113

1214
Say `"take cap"`
1315

14-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/takeCap" />
16+
<RecordedTestVisualizer fixtureName="tutorial/1-introduction/takeCap" />
1517

1618
## Step 2
1719

1820
Well done! 🙌 You just used the code word for 'c', "cap", to refer to the word with a gray hat over the 'c'.
1921

2022
When a hat is not gray, we say its color: say `"take blue sun"`
2123

22-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/takeBlueSun" />
24+
<RecordedTestVisualizer fixtureName="tutorial/1-introduction/takeBlueSun" />
2325

2426
## Step 3
2527

2628
Selecting a single token is great, but often we need something bigger.
2729

2830
Say `"take harp past drum"` to select a range.
2931

30-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/takeHarpPastDrum" />
32+
<RecordedTestVisualizer fixtureName="tutorial/1-introduction/takeHarpPastDrum" />
3133

3234
## Step 4
3335

3436
Despite its name, one of the most powerful aspects of Cursorless is the ability to use more than one cursor.
3537

3638
Let's try that: `"take near and sun"`
3739

38-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/takeNearAndSun" />
40+
<RecordedTestVisualizer fixtureName="tutorial/1-introduction/takeNearAndSun" />
3941

4042
## Step 5
4143

4244
But let's show that Cursorless can live up to its name: we can say `"chuck trap"` to delete a word without ever moving our cursor.
4345

44-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/chuckTrap" />
46+
<RecordedTestVisualizer fixtureName="tutorial/1-introduction/chuckTrap" />
4547

4648
## Step 6
4749

4850
Tokens are great, but they're just one way to think of a document.
4951

5052
Let's try working with lines: `"chuck line odd"`
5153

52-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/chuckLineOdd" />
54+
<RecordedTestVisualizer fixtureName="tutorial/1-introduction/chuckLineOdd" />
5355

5456
## Step 7
5557

5658
We can also use "line" to refer to the line containing our cursor: `"take line"`
5759

58-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/takeLine" />
60+
<RecordedTestVisualizer fixtureName="tutorial/1-introduction/takeLine" />
5961

6062
## Step 8
6163

6264
You now know how to select and delete; let's give you a couple more actions to play with: say "pre" to place the cursor before a target, as in `"pre urge"`
6365

64-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/preUrge" />
66+
<RecordedTestVisualizer fixtureName="tutorial/1-introduction/preUrge" />
6567

6668
## Step 9
6769

6870
Say "post" to place the cursor after a target: `"post air"`
6971

70-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/postAir" />
72+
<RecordedTestVisualizer fixtureName="tutorial/1-introduction/postAir" />
7173

7274
## Step 10
7375

7476
Say "change" to delete a word and move your cursor to where it used to be: `"change sit"`
7577

76-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/changeSit" />
78+
<RecordedTestVisualizer fixtureName="tutorial/1-introduction/changeSit" />
7779

7880
## Step 11
7981

8082
And that wraps up unit 1 of the Cursorless tutorial! Next time, we'll write some code 🙌.
8183

82-
Feel free to keep playing with this document, then say `"tutorial next"` to continue.
84+
</RecordedTestVisualizerProvider>
8385

84-
:::note
85-
This step has no visualisation. To get the full experience try the interactive tutorial in VS Code by saying `"cursorless tutorial"`.
86-
:::
86+
## Next tutorial: 2. Basic coding
8787

88-
</RecordedTestVisualizerProvider>
88+
[Continue to Basic coding](./2-basic-coding.mdx) - This tutorial will teach you the basics of coding with Cursorless.

‎packages/app-web-docs/src/docs/user/tutorial/2-basic-coding.mdx‎

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import recordedTests from "./fixtures/2-basic-coding.json";
33

44
# 2. Basic coding
55

6+
This tutorial will teach you the basics of coding with Cursorless.
7+
68
<RecordedTestVisualizerProvider recordedTests={recordedTests}>
79

810
<RecordedTestVisualizerOptions />
@@ -11,80 +13,56 @@ import recordedTests from "./fixtures/2-basic-coding.json";
1113

1214
When editing code, we often think in terms of statements, functions, etc. Let's clone a statement: `"clone state sit"`
1315

14-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-2-basic-coding/cloneStateInk" />
16+
<RecordedTestVisualizer fixtureName="tutorial/2-basic-coding/cloneStateInk" />
1517

1618
## Step 2
1719

18-
"state" is one of many scopes supported by Cursorless. To see all available scopes, have a look at the Scopes section below, and use the "visualize" command to see them live: `"visualize funk"`
19-
20-
:::note
21-
This step has no visualisation. To get the full experience try the interactive tutorial in VS Code by saying `"cursorless tutorial"`.
22-
:::
23-
24-
## Step 3
25-
26-
Say `"visualize nothing"` to hide the visualization.
27-
28-
:::note
29-
This step has no visualisation. To get the full experience try the interactive tutorial in VS Code by saying `"cursorless tutorial"`.
30-
:::
31-
32-
## Step 4
33-
3420
Cursorless tries its best to keep your commands short.
3521

3622
In the following command, we just say "string" once, but Cursorless infers that both targets are strings: `"swap string air with whale"`
3723

38-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-2-basic-coding/swapStringAirWithWhale" />
24+
<RecordedTestVisualizer fixtureName="tutorial/2-basic-coding/swapStringAirWithWhale" />
3925

40-
## Step 5
26+
## Step 3
4127

4228
Great. Let's learn a new action. The "pour" action lets you start editing a new line below any line on your screen: `"pour urge"`
4329

44-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-2-basic-coding/pourUrge" />
30+
<RecordedTestVisualizer fixtureName="tutorial/2-basic-coding/pourUrge" />
4531

46-
## Step 6
32+
## Step 4
4733

4834
Now let's try applying a Cursorless action to the current line: `"dedent this"`
4935

50-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-2-basic-coding/dedentThis" />
36+
<RecordedTestVisualizer fixtureName="tutorial/2-basic-coding/dedentThis" />
5137

52-
## Step 7
38+
## Step 5
5339

5440
Code reuse is a fact of life as a programmer. Cursorless makes this easy with the "bring" command: `"bring state urge"`
5541

56-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-2-basic-coding/bringStateUrge" />
42+
<RecordedTestVisualizer fixtureName="tutorial/2-basic-coding/bringStateUrge" />
5743

58-
## Step 8
44+
## Step 6
5945

6046
"bring" also works with two targets just like "swap": `"bring blue cap to value red"`
6147

62-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-2-basic-coding/bringBlueCapToValueRisk" />
48+
<RecordedTestVisualizer fixtureName="tutorial/2-basic-coding/bringBlueCapToValueRisk" />
6349

64-
## Step 9
50+
## Step 7
6551

6652
Cursorless tries its best to use its knowledge of programming languages to leave you with syntactically valid code.
6753

6854
Note how it cleans up the comma here: `"chuck arg blue vest"`
6955

70-
<RecordedTestVisualizer fixtureName="tutorial/tutorial-2-basic-coding/chuckArgueBlueVest" />
56+
<RecordedTestVisualizer fixtureName="tutorial/2-basic-coding/chuckArgueBlueVest" />
7157

72-
## Step 10
58+
## Step 8
7359

7460
We introduced a lot of different scopes today. If you're anything like us, you've already forgotten them all.
7561

7662
The important thing to remember is that you can always say `"cursorless help"` to see a list.
7763

78-
:::note
79-
This step has no visualisation. To get the full experience try the interactive tutorial in VS Code by saying `"cursorless tutorial"`.
80-
:::
81-
82-
## Step 11
83-
84-
As always, feel free to stick around and play with this file to practice what you've just learned. Happy coding 😊. Say `"tutorial next"` to get back home.
64+
## Step 9
8565

86-
:::note
87-
This step has no visualisation. To get the full experience try the interactive tutorial in VS Code by saying `"cursorless tutorial"`.
88-
:::
66+
That wraps up the Basic coding tutorial. Happy coding 😊.
8967

9068
</RecordedTestVisualizerProvider>

‎packages/app-web-docs/src/docs/user/tutorial/README.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ To follow along interactively, focus VS Code and say `"cursorless tutorial"`.
66

77
## 1. Introduction
88

9-
[Start Introduction](./1-basics.mdx)
9+
[Start Introduction](./1-introduction.mdx) - This tutorial will teach you the basics of Cursorless.
1010

1111
## 2. Basic coding
1212

13-
[Start Basic coding](./2-basic-coding.mdx)
13+
[Start Basic coding](./2-basic-coding.mdx) - This tutorial will teach you the basics of coding with Cursorless.
1414

1515
## Use the interactive tutorial
1616

packages/app-web-docs/src/docs/user/tutorial/fixtures/1-basics.json renamed to packages/app-web-docs/src/docs/user/tutorial/fixtures/1-introduction.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
3-
"path": "tutorial/tutorial-1-basics/takeCap.yml",
4-
"name": "tutorial/tutorial-1-basics/takeCap",
3+
"path": "tutorial/1-introduction/takeCap.yml",
4+
"name": "tutorial/1-introduction/takeCap",
55
"fixture": {
66
"languageId": "plaintext",
77
"command": {
@@ -629,8 +629,8 @@
629629
}
630630
},
631631
{
632-
"path": "tutorial/tutorial-1-basics/takeBlueSun.yml",
633-
"name": "tutorial/tutorial-1-basics/takeBlueSun",
632+
"path": "tutorial/1-introduction/takeBlueSun.yml",
633+
"name": "tutorial/1-introduction/takeBlueSun",
634634
"fixture": {
635635
"languageId": "plaintext",
636636
"command": {
@@ -1258,8 +1258,8 @@
12581258
}
12591259
},
12601260
{
1261-
"path": "tutorial/tutorial-1-basics/takeHarpPastDrum.yml",
1262-
"name": "tutorial/tutorial-1-basics/takeHarpPastDrum",
1261+
"path": "tutorial/1-introduction/takeHarpPastDrum.yml",
1262+
"name": "tutorial/1-introduction/takeHarpPastDrum",
12631263
"fixture": {
12641264
"languageId": "plaintext",
12651265
"command": {
@@ -1910,8 +1910,8 @@
19101910
}
19111911
},
19121912
{
1913-
"path": "tutorial/tutorial-1-basics/takeNearAndSun.yml",
1914-
"name": "tutorial/tutorial-1-basics/takeNearAndSun",
1913+
"path": "tutorial/1-introduction/takeNearAndSun.yml",
1914+
"name": "tutorial/1-introduction/takeNearAndSun",
19151915
"fixture": {
19161916
"languageId": "plaintext",
19171917
"command": {
@@ -2572,8 +2572,8 @@
25722572
}
25732573
},
25742574
{
2575-
"path": "tutorial/tutorial-1-basics/chuckTrap.yml",
2576-
"name": "tutorial/tutorial-1-basics/chuckTrap",
2575+
"path": "tutorial/1-introduction/chuckTrap.yml",
2576+
"name": "tutorial/1-introduction/chuckTrap",
25772577
"fixture": {
25782578
"languageId": "plaintext",
25792579
"command": {
@@ -3207,8 +3207,8 @@
32073207
}
32083208
},
32093209
{
3210-
"path": "tutorial/tutorial-1-basics/chuckLineOdd.yml",
3211-
"name": "tutorial/tutorial-1-basics/chuckLineOdd",
3210+
"path": "tutorial/1-introduction/chuckLineOdd.yml",
3211+
"name": "tutorial/1-introduction/chuckLineOdd",
32123212
"fixture": {
32133213
"languageId": "plaintext",
32143214
"command": {
@@ -3752,8 +3752,8 @@
37523752
}
37533753
},
37543754
{
3755-
"path": "tutorial/tutorial-1-basics/takeLine.yml",
3756-
"name": "tutorial/tutorial-1-basics/takeLine",
3755+
"path": "tutorial/1-introduction/takeLine.yml",
3756+
"name": "tutorial/1-introduction/takeLine",
37573757
"fixture": {
37583758
"languageId": "plaintext",
37593759
"command": {
@@ -4187,8 +4187,8 @@
41874187
}
41884188
},
41894189
{
4190-
"path": "tutorial/tutorial-1-basics/preUrge.yml",
4191-
"name": "tutorial/tutorial-1-basics/preUrge",
4190+
"path": "tutorial/1-introduction/preUrge.yml",
4191+
"name": "tutorial/1-introduction/preUrge",
41924192
"fixture": {
41934193
"languageId": "plaintext",
41944194
"command": {
@@ -4620,8 +4620,8 @@
46204620
}
46214621
},
46224622
{
4623-
"path": "tutorial/tutorial-1-basics/postAir.yml",
4624-
"name": "tutorial/tutorial-1-basics/postAir",
4623+
"path": "tutorial/1-introduction/postAir.yml",
4624+
"name": "tutorial/1-introduction/postAir",
46254625
"fixture": {
46264626
"languageId": "plaintext",
46274627
"command": {
@@ -5053,8 +5053,8 @@
50535053
}
50545054
},
50555055
{
5056-
"path": "tutorial/tutorial-1-basics/changeSit.yml",
5057-
"name": "tutorial/tutorial-1-basics/changeSit",
5056+
"path": "tutorial/1-introduction/changeSit.yml",
5057+
"name": "tutorial/1-introduction/changeSit",
50585058
"fixture": {
50595059
"languageId": "plaintext",
50605060
"command": {

0 commit comments

Comments
 (0)