Skip to content

Commit 663934c

Browse files
Merge branch 'main' into bash-lang
2 parents ee9c2c1 + aa76859 commit 663934c

File tree

332 files changed

+8600
-2846
lines changed

Some content is hidden

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

332 files changed

+8600
-2846
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
* @pokey @AndreasArvidsson
2+
3+
*keyboard* @pokey @josharian
4+
*Keyboard* @pokey @josharian

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ repos:
3030
- id: detect-private-key
3131
- id: end-of-file-fixer
3232
exclude_types: [svg]
33-
exclude: patches/.*\.patch
33+
exclude: ^patches/.*\.patch$|\.scope$
3434
- id: fix-byte-order-marker
3535
- id: forbid-submodules
3636
- id: mixed-line-ending
@@ -71,16 +71,16 @@ repos:
7171
files: ^packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/.*/[^/]*\.yml$
7272
language: system
7373
entry: pnpm exec ./packages/common/scripts/my-ts-node.js packages/cursorless-engine/src/scripts/transformRecordedTests/index.ts --check-marks
74-
- repo: https://github.com/ikamensh/flynt/
75-
rev: "0.78"
74+
- repo: https://github.com/ikamensh/flynt
75+
rev: "1.0.1"
7676
hooks:
7777
- id: flynt
78-
- repo: https://github.com/charliermarsh/ruff-pre-commit
79-
rev: "v0.0.260"
78+
- repo: https://github.com/astral-sh/ruff-pre-commit
79+
rev: v0.1.11
8080
hooks:
8181
- id: ruff
8282
args: [--fix, --exit-non-zero-on-fix]
83-
- repo: https://github.com/psf/black
84-
rev: 23.3.0
83+
- repo: https://github.com/psf/black-pre-commit-mirror
84+
rev: 24.1.1
8585
hooks:
8686
- id: black

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<img alt="Tests" src="https://img.shields.io/github/actions/workflow/status/cursorless-dev/cursorless-vscode/test.yml?branch=main&logo=github&label=tests" />
1111
</a>
1212
<a href="https://github.com/cursorless-dev/cursorless/graphs/contributors" target="_blank">
13-
<img alt="Maintenance" src="https://img.shields.io/maintenance/yes/2023.svg?logo=data:image/svg%2bxml;base64,PHN2ZyBhcmlhLWhpZGRlbj0idHJ1ZSIgZm9jdXNhYmxlPSJmYWxzZSIgZGF0YS1wcmVmaXg9ImZhcyIgZGF0YS1pY29uPSJ3cmVuY2giIGNsYXNzPSJzdmctaW5saW5lLS1mYSBmYS13cmVuY2ggZmEtdy0xNiIgcm9sZT0iaW1nIgogICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+CiAgICA8cGF0aCBmaWxsPSJ3aGl0ZSIgZD0iTTUwNy43MyAxMDkuMWMtMi4yNC05LjAzLTEzLjU0LTEyLjA5LTIwLjEyLTUuNTFsLTc0LjM2IDc0LjM2LTY3Ljg4LTExLjMxLTExLjMxLTY3Ljg4IDc0LjM2LTc0LjM2YzYuNjItNi42MiAzLjQzLTE3LjktNS42Ni0yMC4xNi00Ny4zOC0xMS43NC05OS41NS45MS0xMzYuNTggMzcuOTMtMzkuNjQgMzkuNjQtNTAuNTUgOTcuMS0zNC4wNSAxNDcuMkwxOC43NCA0MDIuNzZjLTI0Ljk5IDI0Ljk5LTI0Ljk5IDY1LjUxIDAgOTAuNSAyNC45OSAyNC45OSA2NS41MSAyNC45OSA5MC41IDBsMjEzLjIxLTIxMy4yMWM1MC4xMiAxNi43MSAxMDcuNDcgNS42OCAxNDcuMzctMzQuMjIgMzcuMDctMzcuMDcgNDkuNy04OS4zMiAzNy45MS0xMzYuNzN6TTY0IDQ3MmMtMTMuMjUgMC0yNC0xMC43NS0yNC0yNCAwLTEzLjI2IDEwLjc1LTI0IDI0LTI0czI0IDEwLjc0IDI0IDI0YzAgMTMuMjUtMTAuNzUgMjQtMjQgMjR6Ij48L3BhdGg+Cjwvc3ZnPg==" />
13+
<img alt="Maintenance" src="https://img.shields.io/maintenance/yes/2024.svg?logo=data:image/svg%2bxml;base64,PHN2ZyBhcmlhLWhpZGRlbj0idHJ1ZSIgZm9jdXNhYmxlPSJmYWxzZSIgZGF0YS1wcmVmaXg9ImZhcyIgZGF0YS1pY29uPSJ3cmVuY2giIGNsYXNzPSJzdmctaW5saW5lLS1mYSBmYS13cmVuY2ggZmEtdy0xNiIgcm9sZT0iaW1nIgogICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+CiAgICA8cGF0aCBmaWxsPSJ3aGl0ZSIgZD0iTTUwNy43MyAxMDkuMWMtMi4yNC05LjAzLTEzLjU0LTEyLjA5LTIwLjEyLTUuNTFsLTc0LjM2IDc0LjM2LTY3Ljg4LTExLjMxLTExLjMxLTY3Ljg4IDc0LjM2LTc0LjM2YzYuNjItNi42MiAzLjQzLTE3LjktNS42Ni0yMC4xNi00Ny4zOC0xMS43NC05OS41NS45MS0xMzYuNTggMzcuOTMtMzkuNjQgMzkuNjQtNTAuNTUgOTcuMS0zNC4wNSAxNDcuMkwxOC43NCA0MDIuNzZjLTI0Ljk5IDI0Ljk5LTI0Ljk5IDY1LjUxIDAgOTAuNSAyNC45OSAyNC45OSA2NS41MSAyNC45OSA5MC41IDBsMjEzLjIxLTIxMy4yMWM1MC4xMiAxNi43MSAxMDcuNDcgNS42OCAxNDcuMzctMzQuMjIgMzcuMDctMzcuMDcgNDkuNy04OS4zMiAzNy45MS0xMzYuNzN6TTY0IDQ3MmMtMTMuMjUgMC0yNC0xMC43NS0yNC0yNCAwLTEzLjI2IDEwLjc1LTI0IDI0LTI0czI0IDEwLjc0IDI0IDI0YzAgMTMuMjUtMTAuNzUgMjQtMjQgMjR6Ij48L3BhdGg+Cjwvc3ZnPg==" />
1414
</a>
1515
<a href="https://github.com/cursorless-dev/cursorless/blob/main/LICENSE" target="_blank">
1616
<img alt="License: MIT" src="https://img.shields.io/github/license/cursorless-dev/cursorless-vscode?color=success&logo=data:image/svg%2bxml;base64,PHN2ZyBhcmlhLWhpZGRlbj0idHJ1ZSIgZm9jdXNhYmxlPSJmYWxzZSIgZGF0YS1wcmVmaXg9ImZhcyIgZGF0YS1pY29uPSJiYWxhbmNlLXNjYWxlIiBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYmFsYW5jZS1zY2FsZSBmYS13LTIwIiByb2xlPSJpbWciCiAgICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NDAgNTEyIj4KICAgIDxwYXRoIGZpbGw9IndoaXRlIiBkPSJNMjU2IDMzNmgtLjAyYzAtMTYuMTggMS4zNC04LjczLTg1LjA1LTE4MS41MS0xNy42NS0zNS4yOS02OC4xOS0zNS4zNi04NS44NyAwQy0yLjA2IDMyOC43NS4wMiAzMjAuMzMuMDIgMzM2SDBjMCA0NC4xOCA1Ny4zMSA4MCAxMjggODBzMTI4LTM1LjgyIDEyOC04MHpNMTI4IDE3Nmw3MiAxNDRINTZsNzItMTQ0em01MTEuOTggMTYwYzAtMTYuMTggMS4zNC04LjczLTg1LjA1LTE4MS41MS0xNy42NS0zNS4yOS02OC4xOS0zNS4zNi04NS44NyAwLTg3LjEyIDE3NC4yNi04NS4wNCAxNjUuODQtODUuMDQgMTgxLjUxSDM4NGMwIDQ0LjE4IDU3LjMxIDgwIDEyOCA4MHMxMjgtMzUuODIgMTI4LTgwaC0uMDJ6TTQ0MCAzMjBsNzItMTQ0IDcyIDE0NEg0NDB6bTg4IDEyOEgzNTJWMTUzLjI1YzIzLjUxLTEwLjI5IDQxLjE2LTMxLjQ4IDQ2LjM5LTU3LjI1SDUyOGM4Ljg0IDAgMTYtNy4xNiAxNi0xNlY0OGMwLTguODQtNy4xNi0xNi0xNi0xNkgzODMuNjRDMzY5LjA0IDEyLjY4IDM0Ni4wOSAwIDMyMCAwcy00OS4wNCAxMi42OC02My42NCAzMkgxMTJjLTguODQgMC0xNiA3LjE2LTE2IDE2djMyYzAgOC44NCA3LjE2IDE2IDE2IDE2aDEyOS42MWM1LjIzIDI1Ljc2IDIyLjg3IDQ2Ljk2IDQ2LjM5IDU3LjI1VjQ0OEgxMTJjLTguODQgMC0xNiA3LjE2LTE2IDE2djMyYzAgOC44NCA3LjE2IDE2IDE2IDE2aDQxNmM4Ljg0IDAgMTYtNy4xNiAxNi0xNnYtMzJjMC04Ljg0LTcuMTYtMTYtMTYtMTZ6Ij48L3BhdGg+Cjwvc3ZnPg==" />
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
tags: [enhancement]
3+
pullRequest: 2236
4+
---
5+
6+
- Added increment action. Will increment a number. eg `"increment this"` to change `1` to `2`.
7+
8+
- Added decrement action. Will decrement a number. eg `"decrement this"` to change `2` to `1`.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
tags: [enhancement]
3+
pullRequest: 2235
4+
---
5+
6+
- Fall back to text-based Talon actions when editor is not focused. This allows you to say things like "take token", "bring air", etc, when in the terminal, search bar, etc.

cursorless-talon/src/cheatsheet/get_list.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,21 @@ def get_raw_list(name: str) -> Mapping[str, str]:
4040
return registry.lists[cursorless_list_name][0].copy()
4141

4242

43+
def get_spoken_form_from_list(list_name: str, value: str) -> str:
44+
"""Get the spoken form of a value from a list.
45+
46+
Args:
47+
list_name (str): The name of the list.
48+
value (str): The value to look up.
49+
50+
Returns:
51+
str: The spoken form of the value.
52+
"""
53+
return next(
54+
spoken_form for spoken_form, v in get_raw_list(list_name).items() if v == value
55+
)
56+
57+
4358
def make_dict_readable(
4459
type: str, dict: Mapping[str, str], descriptions: Mapping[str, str]
4560
) -> list[ListItemDescriptor]:

cursorless-talon/src/cheatsheet/sections/compound_targets.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ..get_list import get_raw_list
1+
from ..get_list import get_raw_list, get_spoken_form_from_list
22

33
FORMATTERS = {
44
"rangeExclusive": lambda start, end: f"between {start} and {end}",
@@ -10,16 +10,10 @@
1010

1111

1212
def get_compound_targets():
13-
list_connective_term = next(
14-
spoken_form
15-
for spoken_form, value in get_raw_list("list_connective").items()
16-
if value == "listConnective"
17-
)
18-
vertical_range_term = next(
19-
spoken_form
20-
for spoken_form, value in get_raw_list("range_type").items()
21-
if value == "verticalRange"
13+
list_connective_term = get_spoken_form_from_list(
14+
"list_connective", "listConnective"
2215
)
16+
vertical_range_term = get_spoken_form_from_list("range_type", "verticalRange")
2317

2418
return [
2519
{

cursorless-talon/src/cheatsheet/sections/scopes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from ..get_list import get_lists, get_raw_list
1+
from ..get_list import get_lists, get_spoken_form_from_list
22

33

44
def get_scopes():
5-
complex_scopes = get_raw_list("glyph_scope_type")
5+
glyph_spoken_form = get_spoken_form_from_list("glyph_scope_type", "glyph")
66
return [
77
*get_lists(
88
["scope_type"],
@@ -17,7 +17,7 @@ def get_scopes():
1717
"type": "scopeType",
1818
"variations": [
1919
{
20-
"spokenForm": f"{complex_scopes['glyph']} <character>",
20+
"spokenForm": f"{glyph_spoken_form} <character>",
2121
"description": "Instance of single character <character>",
2222
},
2323
],

cursorless-talon/src/command.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33

44
from talon import Module, actions, speech_system
55

6+
from .fallback import perform_fallback
7+
from .versions import COMMAND_VERSION
8+
69

710
@dataclasses.dataclass
811
class CursorlessCommand:
9-
version = 6
12+
version = COMMAND_VERSION
1013
spokenForm: str
1114
usePrePhraseSnapshot: bool
1215
action: dict
@@ -30,10 +33,12 @@ def on_phrase(d):
3033
class Actions:
3134
def private_cursorless_command_and_wait(action: dict):
3235
"""Execute cursorless command and wait for it to finish"""
33-
actions.user.private_cursorless_run_rpc_command_and_wait(
36+
response = actions.user.private_cursorless_run_rpc_command_get(
3437
CURSORLESS_COMMAND_ID,
3538
construct_cursorless_command(action),
3639
)
40+
if "fallback" in response:
41+
perform_fallback(response["fallback"])
3742

3843
def private_cursorless_command_no_wait(action: dict):
3944
"""Execute cursorless command without waiting"""
@@ -44,10 +49,15 @@ def private_cursorless_command_no_wait(action: dict):
4449

4550
def private_cursorless_command_get(action: dict):
4651
"""Execute cursorless command and return result"""
47-
return actions.user.private_cursorless_run_rpc_command_get(
52+
response = actions.user.private_cursorless_run_rpc_command_get(
4853
CURSORLESS_COMMAND_ID,
4954
construct_cursorless_command(action),
5055
)
56+
if "fallback" in response:
57+
return perform_fallback(response["fallback"])
58+
if "returnValue" in response:
59+
return response["returnValue"]
60+
return None
5161

5262

5363
def construct_cursorless_command(action: dict) -> dict:

cursorless-talon/src/csv_overrides.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pathlib import Path
77
from typing import Callable, Iterable, Optional, TypedDict
88

9-
from talon import Context, Module, actions, app, fs
9+
from talon import Context, Module, actions, app, fs, settings
1010

1111
from .conventions import get_cursorless_list_name
1212
from .vendor.inflection import pluralize
@@ -20,7 +20,7 @@
2020
"cursorless_default_vocabulary",
2121
desc="Use default cursorless vocabulary instead of user custom",
2222
)
23-
cursorless_settings_directory = mod.setting(
23+
mod.setting(
2424
"cursorless_settings_directory",
2525
type=str,
2626
default="cursorless-settings",
@@ -453,7 +453,7 @@ def get_full_path(filename: str):
453453
filename = f"{filename}.csv"
454454

455455
user_dir: Path = actions.path.talon_user()
456-
settings_directory = Path(cursorless_settings_directory.get())
456+
settings_directory = Path(settings.get("user.cursorless_settings_directory"))
457457

458458
if not settings_directory.is_absolute():
459459
settings_directory = user_dir / settings_directory

0 commit comments

Comments
 (0)