Skip to content

Commit

Permalink
Merge branch 'main' into migrateNotebookCell
Browse files Browse the repository at this point in the history
  • Loading branch information
phillco authored Jan 19, 2025
2 parents f8a8ed9 + 09eb32b commit 64da045
Show file tree
Hide file tree
Showing 126 changed files with 2,627 additions and 1,262 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<img alt="Tests" src="https://img.shields.io/github/actions/workflow/status/cursorless-dev/cursorless-vscode/test.yml?branch=main&logo=github&label=tests" />
</a>
<a href="https://github.com/cursorless-dev/cursorless/graphs/contributors" target="_blank">
<img alt="Maintenance" src="https://img.shields.io/maintenance/yes/2024.svg?logo=data:image/svg%2bxml;base64,PHN2ZyBhcmlhLWhpZGRlbj0idHJ1ZSIgZm9jdXNhYmxlPSJmYWxzZSIgZGF0YS1wcmVmaXg9ImZhcyIgZGF0YS1pY29uPSJ3cmVuY2giIGNsYXNzPSJzdmctaW5saW5lLS1mYSBmYS13cmVuY2ggZmEtdy0xNiIgcm9sZT0iaW1nIgogICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+CiAgICA8cGF0aCBmaWxsPSJ3aGl0ZSIgZD0iTTUwNy43MyAxMDkuMWMtMi4yNC05LjAzLTEzLjU0LTEyLjA5LTIwLjEyLTUuNTFsLTc0LjM2IDc0LjM2LTY3Ljg4LTExLjMxLTExLjMxLTY3Ljg4IDc0LjM2LTc0LjM2YzYuNjItNi42MiAzLjQzLTE3LjktNS42Ni0yMC4xNi00Ny4zOC0xMS43NC05OS41NS45MS0xMzYuNTggMzcuOTMtMzkuNjQgMzkuNjQtNTAuNTUgOTcuMS0zNC4wNSAxNDcuMkwxOC43NCA0MDIuNzZjLTI0Ljk5IDI0Ljk5LTI0Ljk5IDY1LjUxIDAgOTAuNSAyNC45OSAyNC45OSA2NS41MSAyNC45OSA5MC41IDBsMjEzLjIxLTIxMy4yMW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S4zMiAzNy45MS0xMzYuNzN6TTY0IDQ3MmMtMTMuMjUgMC0yNC0xMC43NS0yNC0yNCAwLTEzLjI2IDEwLjc1LTI0IDI0LTI0czI0IDEwLjc0IDI0IDI0YzAgMTMuMjUtMTAuNzUgMjQtMjQgMjR6Ij48L3BhdGg+Cjwvc3ZnPg==" />
</a>
<a href="https://github.com/cursorless-dev/cursorless/blob/main/LICENSE" target="_blank">
<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==" />
Expand Down
6 changes: 6 additions & 0 deletions changelog/2025-01-addedCollectionItemScopeProvider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
tags: [enhancement]
pullRequest: 2683
---

At long last, collection items have been migrated to our next generation scope framework! This means, within a list of items, you can now use relative navigation (`previous item`), absolute navigation via ordinals (`fifth item`), multiple selection (`two items`, optionally preceded with `previous` or `next`), and lastly, requesting multiple items to be individually selected via `every` (`every two items`)!
17 changes: 15 additions & 2 deletions cursorless-everywhere-talon/cursorless_everywhere_talon.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@

from talon import Context, Module, actions

from .cursorless_everywhere_types import EditorEdit, EditorState, SelectionOffsets
from .cursorless_everywhere_types import (
EditorEdit,
EditorState,
RangeOffsets,
SelectionOffsets,
)

mod = Module()

Expand Down Expand Up @@ -57,6 +62,14 @@ def cursorless_everywhere_edit_text(
):
"""Edit focused element text"""

def cursorless_everywhere_flash_ranges(
ranges: list[RangeOffsets], # pyright: ignore [reportGeneralTypeIssues]
):
"""Flash ranges in focused element"""
actions.skip()

# Private actions

def private_cursorless_talonjs_run_and_wait(
command_id: str, # pyright: ignore [reportGeneralTypeIssues]
arg1: Any = None,
Expand All @@ -71,5 +84,5 @@ def private_cursorless_talonjs_run_no_wait(
):
"""Executes a Cursorless command, but does not wait for it to finish, nor return the response"""

def private_cursorless_talonjs_get_response_json() -> str:
def private_cursorless_talonjs_get_response_json() -> str: # pyright: ignore [reportReturnType]
"""Returns the response from the last Cursorless command"""
15 changes: 15 additions & 0 deletions cursorless-everywhere-talon/cursorless_everywhere_talon_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .cursorless_everywhere_types import (
EditorEdit,
EditorState,
RangeOffsets,
SelectionOffsets,
)

Expand Down Expand Up @@ -61,6 +62,20 @@ def cursorless_everywhere_edit_text(
if use_fallback(res):
actions.next(edit)

def cursorless_everywhere_flash_ranges(
ranges: list[RangeOffsets], # pyright: ignore [reportGeneralTypeIssues]
):
command = {
"id": "flashRanges",
"ranges": [
js_object_to_python_dict(r, ["start", "end"])
for r in js_array_to_python_list(ranges)
],
}
res = rpc_get(command)
if use_fallback(res):
actions.next(ranges)


def rpc_get(command: dict):
return actions.user.run_rpc_command_get(RPC_COMMAND, command)
Expand Down
5 changes: 5 additions & 0 deletions cursorless-everywhere-talon/cursorless_everywhere_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ class SelectionOffsets(TypedDict):
active: int


class RangeOffsets(TypedDict):
start: int
end: int


class EditorState(TypedDict):
text: str
selections: list[SelectionOffsets]
Expand Down
4 changes: 4 additions & 0 deletions cursorless-talon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ Cursorless is a spoken language for structural code editing, enabling developers

This repository holds the Talon side of Cursorless. If you've arrived here as part of the [Cursorless installation process](https://www.cursorless.org/docs/user/installation/), then you're in the right place!

# Installation

See [Cursorless Installation](https://www.cursorless.org/docs/user/installation/#installing-the-talon-side) ("Installing the Talon side") for how to clone this repo into your Talon user folder.

# Contributing

If you're looking to improve Cursorless, note that Cursorless is now maintained as a monorepo, so if you're here in a browser, and your address bar points to https://github.com/cursorless-dev/cursorless-talon, then you're probably in the wrong place. The monorepo is hosted at [`cursorless`](https://github.com/cursorless-dev/cursorless), and the source of truth for these talon files is in the [`cursorless-talon`](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon) subdirectory.
Expand Down
2 changes: 0 additions & 2 deletions cursorless-talon/src/apps/vscode_settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import traceback
from pathlib import Path
from typing import Any

Expand Down Expand Up @@ -61,7 +60,6 @@ def vscode_get_setting_with_fallback(
return actions.user.vscode_get_setting(key, default_value), False
except Exception:
print(fallback_message)
traceback.print_exc()
return fallback_value, True


Expand Down
13 changes: 10 additions & 3 deletions cursorless-talon/src/marks/decorated_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ def setup_hat_styles_csv(hat_colors: dict[str, str], hat_shapes: dict[str, str])
def init_hats(hat_colors: dict[str, str], hat_shapes: dict[str, str]):
setup_hat_styles_csv(hat_colors, hat_shapes)

vscode_settings_path: Path = actions.user.vscode_settings_path().resolve()
vscode_settings_path: Path | None = None

try:
vscode_settings_path = actions.user.vscode_settings_path().resolve()
except Exception as ex:
print(ex)

def on_watch(path, flags):
global fast_reload_job, slow_reload_job
Expand All @@ -166,10 +171,12 @@ def on_watch(path, flags):
"10s", lambda: setup_hat_styles_csv(hat_colors, hat_shapes)
)

fs.watch(str(vscode_settings_path), on_watch)
if vscode_settings_path is not None:
fs.watch(vscode_settings_path, on_watch)

def unsubscribe():
fs.unwatch(str(vscode_settings_path), on_watch)
if vscode_settings_path is not None:
fs.unwatch(vscode_settings_path, on_watch)
if unsubscribe_hat_styles is not None:
unsubscribe_hat_styles()

Expand Down
31 changes: 0 additions & 31 deletions data/fixtures/recorded/itemTextual/chuckItem4.yml

This file was deleted.

25 changes: 0 additions & 25 deletions data/fixtures/recorded/itemTextual/clearEveryItemToken.yml

This file was deleted.

23 changes: 0 additions & 23 deletions data/fixtures/recorded/itemTextual/clearItem10.yml

This file was deleted.

23 changes: 0 additions & 23 deletions data/fixtures/recorded/itemTextual/clearItem11.yml

This file was deleted.

23 changes: 0 additions & 23 deletions data/fixtures/recorded/itemTextual/clearItem13.yml

This file was deleted.

23 changes: 0 additions & 23 deletions data/fixtures/recorded/itemTextual/clearItem14.yml

This file was deleted.

23 changes: 0 additions & 23 deletions data/fixtures/recorded/itemTextual/clearItem6.yml

This file was deleted.

27 changes: 0 additions & 27 deletions data/fixtures/recorded/itemTextual/clearItemDrip.yml

This file was deleted.

6 changes: 2 additions & 4 deletions data/fixtures/recorded/languages/clojure/chuckItemZip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ finalState:
documentContents: |-
{
:foo "bar",
;; hello
,
}
selections:
- anchor: {line: 4, character: 1}
active: {line: 4, character: 1}
- anchor: {line: 2, character: 1}
active: {line: 2, character: 1}
5 changes: 2 additions & 3 deletions data/fixtures/recorded/languages/clojure/clearEveryItem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ finalState:
{
,
;; hello
,
}
selections:
- anchor: {line: 2, character: 4}
active: {line: 2, character: 4}
- anchor: {line: 4, character: 4}
active: {line: 4, character: 4}
- anchor: {line: 3, character: 4}
active: {line: 3, character: 4}
9 changes: 6 additions & 3 deletions data/fixtures/recorded/languages/clojure/clearItem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ initialState:
finalState:
documentContents: |-
{
:bongo {
:foo "bar",
,
}
}
selections:
- anchor: {line: 1, character: 4}
active: {line: 1, character: 4}
- anchor: {line: 3, character: 8}
active: {line: 3, character: 8}
Loading

0 comments on commit 64da045

Please sign in to comment.