-
-
Notifications
You must be signed in to change notification settings - Fork 92
Added tutorial to docs #3341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Added tutorial to docs #3341
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bae2759
Added tutorial to docs
AndreasArvidsson dd5f034
add tutorial fixtures as json files
AndreasArvidsson d1c748c
Add separate json fixtures for each reference and scope
AndreasArvidsson 8d56235
Fix better had defaults in test mode
AndreasArvidsson 1928f17
Added notes to tutorial steps without visualization
AndreasArvidsson f762063
Fix failing test
AndreasArvidsson 93446ec
Exclude recorded tests from talonjs e2e
AndreasArvidsson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| --- | ||
| sidebar_group: Getting started | ||
| sidebar_position: 4 | ||
| sidebar_position: 3 | ||
| --- | ||
|
|
||
| # How-to guides | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import { RecordedTestVisualizer, RecordedTestVisualizerOptions, RecordedTestVisualizerProvider } from "@site/src/docs/components/RecordedTestVisualizer"; | ||
|
|
||
| # 1. Introduction | ||
|
|
||
| <RecordedTestVisualizerProvider> | ||
|
|
||
| <RecordedTestVisualizerOptions /> | ||
|
|
||
| ## Step 1 | ||
|
|
||
| Say `"take cap"` | ||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/takeCap" /> | ||
|
|
||
| ## Step 2 | ||
|
|
||
| Well done! 🙌 You just used the code word for 'c', "cap", to refer to the word with a gray hat over the 'c'. | ||
|
|
||
| When a hat is not gray, we say its color: say `"take blue sun"` | ||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/takeBlueSun" /> | ||
|
|
||
| ## Step 3 | ||
|
|
||
| Selecting a single token is great, but often we need something bigger. | ||
|
|
||
| Say `"take harp past drum"` to select a range. | ||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/takeHarpPastDrum" /> | ||
|
|
||
| ## Step 4 | ||
|
|
||
| Despite its name, one of the most powerful aspects of Cursorless is the ability to use more than one cursor. | ||
|
|
||
| Let's try that: `"take near and sun"` | ||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/takeNearAndSun" /> | ||
|
|
||
| ## Step 5 | ||
|
|
||
| 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. | ||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/chuckTrap" /> | ||
|
|
||
| ## Step 6 | ||
|
|
||
| Tokens are great, but they're just one way to think of a document. | ||
|
|
||
| Let's try working with lines: `"chuck line odd"` | ||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/chuckLineOdd" /> | ||
|
|
||
| ## Step 7 | ||
|
|
||
| We can also use "line" to refer to the line containing our cursor: `"take line"` | ||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/takeLine" /> | ||
|
|
||
| ## Step 8 | ||
|
|
||
| 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"` | ||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/preUrge" /> | ||
|
|
||
| ## Step 9 | ||
|
|
||
| Say "post" to place the cursor after a target: `"post air"` | ||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/postAir" /> | ||
|
|
||
| ## Step 10 | ||
|
|
||
| Say "change" to delete a word and move your cursor to where it used to be: `"change sit"` | ||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-1-basics/changeSit" /> | ||
|
|
||
| ## Step 11 | ||
|
|
||
| And that wraps up unit 1 of the Cursorless tutorial! Next time, we'll write some code 🙌. | ||
|
|
||
| Feel free to keep playing with this document, then say `"tutorial next"` to continue. | ||
|
|
||
| </RecordedTestVisualizerProvider> | ||
73 changes: 73 additions & 0 deletions
73
packages/app-web-docs/src/docs/user/tutorial/2-basic-coding.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| import { RecordedTestVisualizer, RecordedTestVisualizerOptions, RecordedTestVisualizerProvider } from "@site/src/docs/components/RecordedTestVisualizer"; | ||
|
|
||
| # 2. Basic coding | ||
|
|
||
| <RecordedTestVisualizerProvider> | ||
|
|
||
| <RecordedTestVisualizerOptions /> | ||
|
|
||
| ## Step 1 | ||
|
|
||
| When editing code, we often think in terms of statements, functions, etc. Let's clone a statement: `"clone state sit"` | ||
|
AndreasArvidsson marked this conversation as resolved.
|
||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-2-basic-coding/cloneStateInk" /> | ||
|
|
||
| ## Step 2 | ||
|
|
||
| "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"` | ||
|
AndreasArvidsson marked this conversation as resolved.
|
||
|
|
||
| ## Step 3 | ||
|
|
||
| Say `"visualize nothing"` to hide the visualization. | ||
|
|
||
| ## Step 4 | ||
|
|
||
| Cursorless tries its best to keep your commands short. | ||
|
|
||
| In the following command, we just say "string" once, but Cursorless infers that both targets are strings: `"swap string air with whale"` | ||
|
AndreasArvidsson marked this conversation as resolved.
|
||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-2-basic-coding/swapStringAirWithWhale" /> | ||
|
|
||
| ## Step 5 | ||
|
|
||
| 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"` | ||
|
AndreasArvidsson marked this conversation as resolved.
|
||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-2-basic-coding/pourUrge" /> | ||
|
|
||
| ## Step 6 | ||
|
|
||
| Now let's try applying a Cursorless action to the current line: `"dedent this"` | ||
|
AndreasArvidsson marked this conversation as resolved.
|
||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-2-basic-coding/dedentThis" /> | ||
|
|
||
| ## Step 7 | ||
|
|
||
| Code reuse is a fact of life as a programmer. Cursorless makes this easy with the "bring" command: `"bring state urge"` | ||
|
AndreasArvidsson marked this conversation as resolved.
|
||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-2-basic-coding/bringStateUrge" /> | ||
|
|
||
| ## Step 8 | ||
|
|
||
| "bring" also works with two targets just like "swap": `"bring blue cap to value red"` | ||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-2-basic-coding/bringBlueCapToValueRisk" /> | ||
|
|
||
| ## Step 9 | ||
|
|
||
| Cursorless tries its best to use its knowledge of programming languages to leave you with syntactically valid code. | ||
|
|
||
| Note how it cleans up the comma here: `"chuck arg blue vest"` | ||
|
|
||
| <RecordedTestVisualizer fixtureName="tutorial/tutorial-2-basic-coding/chuckArgueBlueVest" /> | ||
|
|
||
| ## Step 10 | ||
|
|
||
| We introduced a lot of different scopes today. If you're anything like us, you've already forgotten them all. | ||
|
|
||
| The important thing to remember is that you can always say `"cursorless help"` to see a list. | ||
|
|
||
| ## Step 11 | ||
|
|
||
| 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. | ||
|
|
||
| </RecordedTestVisualizerProvider> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.