From 4acd44f567eafb94d835232d656fd694c3e01d85 Mon Sep 17 00:00:00 2001 From: Pokey Rule Date: Fri, 21 Jan 2022 12:34:59 +0000 Subject: [PATCH 1/5] Create FUNDING.yml (#151) --- .github/FUNDING.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..dec4065c --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,13 @@ +# These are supported funding model platforms + +github: pokey # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] From ec91866ee4439b9bef2829776637406ed8bd55d5 Mon Sep 17 00:00:00 2001 From: Pokey Rule Date: Sun, 9 Jan 2022 16:17:13 +0000 Subject: [PATCH 2/5] Initial tutorial code --- src/tutorial.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/tutorial.py diff --git a/src/tutorial.py b/src/tutorial.py new file mode 100644 index 00000000..ac94a52c --- /dev/null +++ b/src/tutorial.py @@ -0,0 +1,20 @@ +import json +import re + +regex = re.compile(r"\{(\w+):([^}]+)\}") + +def process_tutorial_step(raw: str): + print([(match.group(1), match.group(2)) for match in regex.finditer(raw)]) + content = "whatever" + + return { + "content": content, + "modes": ["command"], + "app": "vscode", + "context_hint": "Please open VSCode", + } + +with open("/Users/pokey/src/cursorless-vscode/src/test/suite/fixtures/recorded/tutorial/unit-2-basic-coding/script.json") as f: + script = json.load(f) + +print([process_tutorial_step(step) for step in script]) \ No newline at end of file From cecf601c315bee5ad6cd04c34df03edfe3990847 Mon Sep 17 00:00:00 2001 From: Pokey Rule Date: Sun, 9 Jan 2022 16:19:21 +0000 Subject: [PATCH 3/5] Black --- src/tutorial.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/tutorial.py b/src/tutorial.py index ac94a52c..ba705763 100644 --- a/src/tutorial.py +++ b/src/tutorial.py @@ -3,18 +3,22 @@ regex = re.compile(r"\{(\w+):([^}]+)\}") + def process_tutorial_step(raw: str): print([(match.group(1), match.group(2)) for match in regex.finditer(raw)]) content = "whatever" return { "content": content, - "modes": ["command"], - "app": "vscode", - "context_hint": "Please open VSCode", + "modes": ["command"], + "app": "vscode", + "context_hint": "Please open VSCode", } -with open("/Users/pokey/src/cursorless-vscode/src/test/suite/fixtures/recorded/tutorial/unit-2-basic-coding/script.json") as f: + +with open( + "/Users/pokey/src/cursorless-vscode/src/test/suite/fixtures/recorded/tutorial/unit-2-basic-coding/script.json" +) as f: script = json.load(f) -print([process_tutorial_step(step) for step in script]) \ No newline at end of file +print([process_tutorial_step(step) for step in script]) From 6fae7d0e47b934c385728654cbacc2357ff64485 Mon Sep 17 00:00:00 2001 From: Pokey Rule Date: Sun, 23 Jan 2022 16:22:17 +0000 Subject: [PATCH 4/5] Initial displaying tutorial --- src/tutorial.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/tutorial.py b/src/tutorial.py index ba705763..473feb6b 100644 --- a/src/tutorial.py +++ b/src/tutorial.py @@ -1,24 +1,34 @@ import json import re +from talon import actions, app + regex = re.compile(r"\{(\w+):([^}]+)\}") def process_tutorial_step(raw: str): print([(match.group(1), match.group(2)) for match in regex.finditer(raw)]) - content = "whatever" + content = raw return { "content": content, + "restore_callback": print, "modes": ["command"], - "app": "vscode", - "context_hint": "Please open VSCode", + "app": "Code", + "context_hint": "Please open VSCode and enter command mode", } -with open( - "/Users/pokey/src/cursorless-vscode/src/test/suite/fixtures/recorded/tutorial/unit-2-basic-coding/script.json" -) as f: - script = json.load(f) +def get_basic_coding_walkthrough(): + with open( + "/Users/pokey/src/cursorless-vscode/src/test/suite/fixtures/recorded/tutorial/unit-2-basic-coding/script.json" + ) as f: + script = json.load(f) + + return [actions.user.hud_create_walkthrough_step(**process_tutorial_step(step)) for step in script] + +def on_ready(): + actions.user.hud_add_lazy_walkthrough("Cursorless basic coding", get_basic_coding_walkthrough) + -print([process_tutorial_step(step) for step in script]) +app.register("ready", on_ready) From 304922b10b9d1bb1c333fdc9ce0b51a75fe2fbfd Mon Sep 17 00:00:00 2001 From: Pokey Rule Date: Sun, 23 Jan 2022 16:46:26 +0000 Subject: [PATCH 5/5] Black --- src/tutorial.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/tutorial.py b/src/tutorial.py index 473feb6b..afe03fb8 100644 --- a/src/tutorial.py +++ b/src/tutorial.py @@ -24,11 +24,17 @@ def get_basic_coding_walkthrough(): "/Users/pokey/src/cursorless-vscode/src/test/suite/fixtures/recorded/tutorial/unit-2-basic-coding/script.json" ) as f: script = json.load(f) - - return [actions.user.hud_create_walkthrough_step(**process_tutorial_step(step)) for step in script] + + return [ + actions.user.hud_create_walkthrough_step(**process_tutorial_step(step)) + for step in script + ] + def on_ready(): - actions.user.hud_add_lazy_walkthrough("Cursorless basic coding", get_basic_coding_walkthrough) + actions.user.hud_add_lazy_walkthrough( + "Cursorless basic coding", get_basic_coding_walkthrough + ) app.register("ready", on_ready)