Skip to content

Commit

Permalink
Cursorless tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
pokey committed Apr 29, 2024
1 parent 02e7087 commit b936253
Show file tree
Hide file tree
Showing 63 changed files with 2,658 additions and 52 deletions.
11 changes: 11 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
},
"group": "build"
},
{
"label": "Build tutorial webview",
"type": "npm",
"script": "build:dev",
"path": "packages/cursorless-vscode-tutorial-webview",
"presentation": {
"reveal": "silent"
},
"group": "build"
},
{
"label": "Build test harness",
"type": "npm",
Expand All @@ -57,6 +67,7 @@
"type": "npm",
"script": "populate-dist",
"path": "packages/cursorless-vscode",
"dependsOn": ["Build tutorial webview"],
"presentation": {
"reveal": "silent"
},
Expand Down
1 change: 1 addition & 0 deletions cursorless-talon/src/cheatsheet/cheat_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def private_cursorless_cheat_sheet_update_json():

def private_cursorless_open_instructions():
"""Open web page with cursorless instructions"""
actions.user.private_cursorless_notify_docs_opened()
webbrowser.open(instructions_url)


Expand Down
10 changes: 10 additions & 0 deletions cursorless-talon/src/cursorless.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ def private_cursorless_show_command_statistics():
actions.user.private_cursorless_run_rpc_command_no_wait(
"cursorless.analyzeCommandHistory"
)

def private_cursorless_notify_docs_opened():
"""Notify the ide that the docs were opened in case the tutorial is waiting for that event"""
actions.user.private_cursorless_run_rpc_command_no_wait("cursorless.docsOpened")

def private_cursorless_start_tutorial():
"""Start Cursorless tutorial"""
actions.user.private_cursorless_run_rpc_command_no_wait(
"cursorless.tutorial.start", "unit-2-basic-coding"
)
3 changes: 3 additions & 0 deletions cursorless-talon/src/cursorless.talon
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ bar {user.cursorless_homophone}:

{user.cursorless_homophone} stats:
user.private_cursorless_show_command_statistics()

{user.cursorless_homophone} tutorial:
user.private_cursorless_start_tutorial()
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
languageId: python
command:
version: 6
spokenForm: bring block made
action:
name: replaceWithTarget
source:
type: primitive
modifiers:
- type: containingScope
scopeType: {type: paragraph}
mark: {type: decoratedSymbol, symbolColor: default, character: m}
destination: {type: implicit}
usePrePhraseSnapshot: false
initialState:
documentContents: |+
from talon import Context, Module
mod = Module()
ctx = Context()
mod.list("cursorless_walkthrough_list", desc="My tutorial list")
ctx.list['user.cursorless_walkthrough_list'] = {
"spoken form": "whatever",
}
selections:
- anchor: {line: 10, character: 0}
active: {line: 10, character: 0}
marks:
default.m:
start: {line: 5, character: 0}
end: {line: 5, character: 3}
finalState:
documentContents: |-
from talon import Context, Module
mod = Module()
ctx = Context()
mod.list("cursorless_walkthrough_list", desc="My tutorial list")
ctx.list['user.cursorless_walkthrough_list'] = {
"spoken form": "whatever",
}
mod.list("cursorless_walkthrough_list", desc="My tutorial list")
ctx.list['user.cursorless_walkthrough_list'] = {
"spoken form": "whatever",
}
selections:
- anchor: {line: 13, character: 1}
active: {line: 13, character: 1}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
languageId: python
command:
version: 6
spokenForm: change inside pair sun
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- {type: interiorOnly}
- type: containingScope
scopeType: {type: surroundingPair, delimiter: any}
mark: {type: decoratedSymbol, symbolColor: default, character: s}
usePrePhraseSnapshot: false
initialState:
documentContents: |-
from talon import Context, Module
mod = Module()
ctx = Context()
mod.list("cursorless_walkthrough_list", desc="My tutorial list")
ctx.list['user.cursorless_walkthrough_list'] = {
"spoken form": "whatever",
}
mod.list("emoji", desc="Emojis")
ctx.list['user.emoji'] = {
"spoken form": "whatever",
}
selections:
- anchor: {line: 10, character: 30}
active: {line: 10, character: 30}
marks:
default.s:
start: {line: 12, character: 5}
end: {line: 12, character: 11}
finalState:
documentContents: |-
from talon import Context, Module
mod = Module()
ctx = Context()
mod.list("cursorless_walkthrough_list", desc="My tutorial list")
ctx.list['user.cursorless_walkthrough_list'] = {
"spoken form": "whatever",
}
mod.list("emoji", desc="Emojis")
ctx.list['user.emoji'] = {
"": "whatever",
}
selections:
- anchor: {line: 12, character: 5}
active: {line: 12, character: 5}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
languageId: python
command:
version: 6
spokenForm: change inside pair yank
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- {type: interiorOnly}
- type: containingScope
scopeType: {type: surroundingPair, delimiter: any}
mark: {type: decoratedSymbol, symbolColor: default, character: 'y'}
usePrePhraseSnapshot: false
initialState:
documentContents: |-
from talon import Context, Module
mod = Module()
ctx = Context()
mod.list("cursorless_walkthrough_list", desc="My tutorial list")
ctx.list['user.cursorless_walkthrough_list'] = {
"spoken form": "whatever",
}
mod.list("emoji", desc="My tutorial list")
ctx.list['user.emoji'] = {
"spoken form": "whatever",
}
selections:
- anchor: {line: 10, character: 15}
active: {line: 10, character: 15}
- anchor: {line: 11, character: 20}
active: {line: 11, character: 20}
marks:
default.y:
start: {line: 10, character: 24}
end: {line: 10, character: 26}
finalState:
documentContents: |-
from talon import Context, Module
mod = Module()
ctx = Context()
mod.list("cursorless_walkthrough_list", desc="My tutorial list")
ctx.list['user.cursorless_walkthrough_list'] = {
"spoken form": "whatever",
}
mod.list("emoji", desc="")
ctx.list['user.emoji'] = {
"spoken form": "whatever",
}
selections:
- anchor: {line: 10, character: 24}
active: {line: 10, character: 24}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
languageId: python
command:
version: 6
spokenForm: change underscore and cap
action:
name: clearAndSetSelection
target:
type: list
elements:
- type: primitive
mark: {type: decoratedSymbol, symbolColor: default, character: _}
- type: primitive
mark: {type: decoratedSymbol, symbolColor: default, character: c}
usePrePhraseSnapshot: false
initialState:
documentContents: |-
from talon import Context, Module
mod = Module()
ctx = Context()
mod.list("cursorless_walkthrough_list", desc="My tutorial list")
ctx.list['user.cursorless_walkthrough_list'] = {
"spoken form": "whatever",
}
mod.list("cursorless_walkthrough_list", desc="My tutorial list")
ctx.list['user.cursorless_walkthrough_list'] = {
"spoken form": "whatever",
}
selections:
- anchor: {line: 13, character: 1}
active: {line: 13, character: 1}
marks:
default._:
start: {line: 10, character: 10}
end: {line: 10, character: 37}
default.c:
start: {line: 11, character: 15}
end: {line: 11, character: 42}
finalState:
documentContents: |-
from talon import Context, Module
mod = Module()
ctx = Context()
mod.list("cursorless_walkthrough_list", desc="My tutorial list")
ctx.list['user.cursorless_walkthrough_list'] = {
"spoken form": "whatever",
}
mod.list("", desc="My tutorial list")
ctx.list['user.'] = {
"spoken form": "whatever",
}
selections:
- anchor: {line: 10, character: 10}
active: {line: 10, character: 10}
- anchor: {line: 11, character: 15}
active: {line: 11, character: 15}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
languageId: python
command:
version: 6
spokenForm: change right paren
action:
name: clearAndSetSelection
target:
type: primitive
mark: {type: decoratedSymbol, symbolColor: default, character: )}
usePrePhraseSnapshot: false
initialState:
documentContents: |-
from talon import Context, Module
mod = Module()
ctx = Context()
mod.list("cursorless_walkthrough_list", desc="My tutorial list")
ctx.list['user.cursorless_walkthrough_list'] = {
"spoken form": "whatever",
}
mod.list("emoji", desc="Emojis")
ctx.list['user.emoji'] = {
"smile": ":-)",
"frown": ":-)",
}
selections:
- anchor: {line: 13, character: 10}
active: {line: 13, character: 10}
marks:
default.):
start: {line: 13, character: 16}
end: {line: 13, character: 17}
finalState:
documentContents: |-
from talon import Context, Module
mod = Module()
ctx = Context()
mod.list("cursorless_walkthrough_list", desc="My tutorial list")
ctx.list['user.cursorless_walkthrough_list'] = {
"spoken form": "whatever",
}
mod.list("emoji", desc="Emojis")
ctx.list['user.emoji'] = {
"smile": ":-)",
"frown": ":-",
}
selections:
- anchor: {line: 13, character: 16}
active: {line: 13, character: 16}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
languageId: python
command:
version: 6
spokenForm: change whale
action:
name: clearAndSetSelection
target:
type: primitive
mark: {type: decoratedSymbol, symbolColor: default, character: w}
usePrePhraseSnapshot: false
initialState:
documentContents: |-
from talon import Context, Module
mod = Module()
ctx = Context()
mod.list("cursorless_walkthrough_list", desc="My tutorial list")
ctx.list['user.cursorless_walkthrough_list'] = {
"spoken form": "whatever",
}
mod.list("emoji", desc="Emojis")
ctx.list['user.emoji'] = {
"smile": "whatever",
}
selections:
- anchor: {line: 12, character: 10}
active: {line: 12, character: 10}
marks:
default.w:
start: {line: 12, character: 14}
end: {line: 12, character: 22}
finalState:
documentContents: |-
from talon import Context, Module
mod = Module()
ctx = Context()
mod.list("cursorless_walkthrough_list", desc="My tutorial list")
ctx.list['user.cursorless_walkthrough_list'] = {
"spoken form": "whatever",
}
mod.list("emoji", desc="Emojis")
ctx.list['user.emoji'] = {
"smile": "",
}
selections:
- anchor: {line: 12, character: 14}
active: {line: 12, character: 14}

0 comments on commit b936253

Please sign in to comment.