Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7
with:
# This is needed to get the number of commits in the current branch
fetch-depth: 0
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7
with:
# Deploy the exact commit that passed the test workflow.
ref: ${{ github.event.workflow_run.head_sha }}
Expand All @@ -72,7 +72,7 @@ jobs:
CURSORLESS_DEPLOY: true

- name: Checkout cursorless.nvim plugin repo
uses: actions/checkout@v6
uses: actions/checkout@v7
with:
token: ${{ secrets.CURSORLESS_BOT_TOKEN }}
repository: hands-free-vim/cursorless.nvim
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7
with:
fetch-depth: 0
token: ${{ secrets.CURSORLESS_BOT_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7

- name: Setup python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
Comment thread
AndreasArvidsson marked this conversation as resolved.
with:
python-version-file: "pyproject.toml"

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7

- name: Set up Node.js
uses: ./.github/actions/setup-node
Expand All @@ -38,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7

- name: Set up Node.js
uses: ./.github/actions/setup-node
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
run: git config --global core.autocrlf false

- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7

- name: Set up Node.js
uses: ./.github/actions/setup-node
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
run: git config --global core.autocrlf false

- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7

- name: Set up Node.js
uses: ./.github/actions/setup-node
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ repos:
- id: ruff-format

- repo: https://github.com/cursorless-dev/talon-tools
rev: v0.9.0
rev: v0.11.2
hooks:
- id: talon-fmt
- id: tree-sitter-fmt
Expand Down
6 changes: 4 additions & 2 deletions cursorless-talon/src/actions/call.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Optional

from talon import Module, actions

from ..targets.target_types import CursorlessTarget, ImplicitTarget
Expand All @@ -11,13 +13,13 @@ class Actions:
@staticmethod
def private_cursorless_call(
callee: CursorlessTarget,
argument: CursorlessTarget = ImplicitTarget(),
argument: Optional[CursorlessTarget] = None,
):
"""Execute Cursorless call action"""
actions.user.private_cursorless_command_and_wait(
{
"name": "callAsFunction",
"callee": callee,
"argument": argument,
"argument": argument or ImplicitTarget(),
}
)
8 changes: 6 additions & 2 deletions cursorless-talon/src/actions/execute_command.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
from typing import Optional

from talon import actions

from ..targets.target_types import CursorlessTarget


def cursorless_execute_command_action(
command_id: str, target: CursorlessTarget, command_options: dict = {}
command_id: str,
target: CursorlessTarget,
command_options: Optional[dict] = None,
):
"""Execute Cursorless execute command action"""
actions.user.private_cursorless_command_and_wait(
{
"name": "executeCommand",
"commandId": command_id,
"options": command_options,
"options": command_options or {},
"target": target,
}
)
3 changes: 1 addition & 2 deletions cursorless-talon/src/apps/vscode_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def vscode_get_setting(key: str, default_value: Any = None):

if default_value is not None:
return settings.get(key, default_value)
else:
return settings[key]
return settings[key]

@staticmethod
def vscode_get_setting_with_fallback(
Expand Down
4 changes: 2 additions & 2 deletions cursorless-talon/src/csv_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def unsubscribe() -> None:
def check_for_duplicates(filename: str, default_values: ListToSpokenForms):
results_map = {}
for list_name, values in default_values.items():
for key, value in values.items():
for _key, value in values.items():
if value in results_map:
existing_list_name = results_map[value]
warning = f"WARNING ({filename}): Value `{value}` duplicated between lists '{existing_list_name}' and '{list_name}'"
Expand All @@ -233,7 +233,7 @@ def create_default_vocabulary_dicts(
updated_dict: dict[str, str] = {}
for key2, value2 in value.items():
# Enable deactivated(prefixed with a `-`) items
active_key = key2[1:] if key2.startswith("-") else key2
active_key = key2.removeprefix("-")
if active_key:
updated_dict[active_key] = value2
default_values_updated[key] = updated_dict
Expand Down
4 changes: 2 additions & 2 deletions cursorless-talon/src/fallback.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ def get_modifier_callback(modifier: dict) -> Callable:
def get_simple_modifier_callback(key: str) -> Callable:
try:
return modifier_callbacks[key]
except KeyError:
raise ValueError(f"Unknown Cursorless fallback modifier: {key}")
except KeyError as e:
raise ValueError(f"Unknown Cursorless fallback modifier: {key}") from e
4 changes: 2 additions & 2 deletions cursorless-talon/src/snippets/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Actions:
@staticmethod
def cursorless_insert_snippet(
body: str,
destination: CursorlessDestination = ImplicitDestination(),
destination: Optional[CursorlessDestination] = None,
scope_type: Optional[Union[str, list[str]]] = None,
):
"""Cursorless: Insert custom snippet <body>"""
Expand All @@ -48,7 +48,7 @@ def cursorless_insert_snippet(
languages=None,
substitutions=None,
)
action = InsertSnippetAction(snippet, destination)
action = InsertSnippetAction(snippet, destination or ImplicitDestination())
actions.user.private_cursorless_command_and_wait(action)

@staticmethod
Expand Down
4 changes: 3 additions & 1 deletion cursorless-talon/src/targets/destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def cursorless_destination(m) -> Union[ListDestination, PrimitiveDestination]:
destinations = [
PrimitiveDestination(insertion_mode, target)
for insertion_mode, target in zip(
m.cursorless_insertion_mode_list, m.cursorless_target_list
m.cursorless_insertion_mode_list,
m.cursorless_target_list,
strict=True,
)
]

Expand Down
22 changes: 20 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,26 @@ target-version = "py311"
extend-exclude = ["vendor", "resources/playground"]

[tool.ruff.lint]
select = ["E", "F", "C4", "I001", "UP", "SIM", "FLY"]
ignore = ["E501", "SIM105", "UP007", "UP035", "UP045"]
select = [
"E", # pycodestyle
"F", # Pyflakes
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
"I", # isort
"C4", # Catch incorrect use of comprehensions, dict, list, etc
"ICN", # Use common import conventions
"RET", # Good return practices
"FURB", # Suggest more idiomatic Python patterns
"FLY", # Checks for str.join calls that can be replaced with f-strings.
]
ignore = [
"E501", # Line too long
"SIM105", # Alow try-except-pass instead of contextlib.suppress({exception})
"UP007", # Union[X, Y] -> X | Y not supported in Talon 0.4 actions
"UP045", # Optional[X] -> X | None not supported in Talon 0.4 actions
"UP035", # Deprecated import
]

[tool.pyright]
pythonVersion = "3.11"
Expand Down
Loading