Skip to content

Commit 923311f

Browse files
committed
Merge remote-tracking branch 'origin/main' into pokey/initial-work-towards-next-gen-collectionitem
2 parents b5a8038 + 8d15172 commit 923311f

File tree

3,358 files changed

+20212
-14138
lines changed

Some content is hidden

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

3,358 files changed

+20212
-14138
lines changed

.eslintrc.json

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
"extends": [
55
"eslint:recommended",
66
"plugin:@typescript-eslint/recommended",
7+
// We want to enable this in the long run. For now there are a lot of errors that needs to be handled.
8+
// "plugin:@typescript-eslint/recommended-requiring-type-checking",
79
"plugin:import/typescript",
810
"prettier"
911
],
1012
"parserOptions": {
1113
"ecmaVersion": 6,
12-
"sourceType": "module"
14+
"sourceType": "module",
15+
"project": true
1316
},
1417
"plugins": [
1518
"@typescript-eslint",
@@ -20,6 +23,7 @@
2023
],
2124
"rules": {
2225
"import/no-relative-packages": "error",
26+
"@typescript-eslint/consistent-type-imports": "error",
2327
"@typescript-eslint/consistent-type-assertions": [
2428
"error",
2529
{
@@ -37,6 +41,7 @@
3741
}
3842
}
3943
],
44+
"@typescript-eslint/no-floating-promises": "error",
4045
"@typescript-eslint/no-explicit-any": "off",
4146
"@typescript-eslint/no-inferrable-types": "off",
4247
"@typescript-eslint/no-non-null-assertion": "off",
@@ -85,22 +90,30 @@
8590
}
8691
]
8792
}
93+
},
94+
{
95+
"files": [
96+
"jest.config.ts",
97+
"docusaurus.config.mts",
98+
"mdx-components.tsx",
99+
"typings/**"
100+
],
101+
"extends": ["plugin:@typescript-eslint/disable-type-checked"]
88102
}
89103
],
90104
"settings": {
91105
"import/resolver": {
92106
"typescript": {
93107
"alwaysTryTypes": true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
94-
95108
"project": ["tsconfig.json", "packages/*/tsconfig.json"]
96109
}
97110
}
98111
},
99112
"ignorePatterns": [
100-
"**/vendor/**/*.ts",
101-
"**/vendor/**/*.js",
102-
"**/out/**",
103113
"**/generated/**",
104-
"data/playground/**"
114+
"**/out/**",
115+
"**/vendor/**/*.js",
116+
"**/vendor/**/*.ts",
117+
"/data/playground/**"
105118
]
106119
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: "Lua Language Server Lint"
2+
description: "Lints all lua files with lua-language-server"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- uses: cachix/install-nix-action@v27
7+
with:
8+
nix_path: nixpkgs=channel:nixos-unstable
9+
- uses: DeterminateSystems/magic-nix-cache-action@v2
10+
- run: nix profile install --accept-flake-config .#lua-language-server
11+
shell: bash
12+
- run: scripts/lint-lua-ls.sh
13+
shell: bash

.github/workflows/pre-commit.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ on:
88
types: [opened, synchronize, reopened]
99
merge_group:
1010
branches: [main]
11+
workflow_dispatch:
1112

1213
jobs:
1314
pre-commit:
1415
name: Pre-commit
1516
runs-on: ubuntu-latest
17+
env:
18+
CURSORLESS_REPO_ROOT: ${{ github.workspace }}
1619
steps:
1720
- uses: actions/checkout@v4
1821
- uses: actions/setup-python@v5

.github/workflows/test.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
VSCODE_LOGS_DIR: ${{ github.workspace }}/artifacts/logs
3030
CURSORLESS_REPO_ROOT: ${{ github.workspace }}
3131
TEMP_DIR: ${{ github.workspace }}/temp
32+
NODE_OPTIONS: "--max-old-space-size=4096"
3233
steps:
3334
- uses: actions/checkout@v4
3435
- run: corepack enable
@@ -45,6 +46,14 @@ jobs:
4546
if: runner.os == 'Linux'
4647
- run: pnpm --color test
4748
if: runner.os != 'Linux'
49+
- run: xvfb-run -a pnpm -F @cursorless/test-harness test:talonJs
50+
if: runner.os == 'Linux' && matrix.vscode_version == 'stable'
51+
- run: pnpm -F @cursorless/test-harness test:talonJs
52+
if: runner.os != 'Linux' && matrix.vscode_version == 'stable'
53+
- run: xvfb-run -a pnpm -F @cursorless/cursorless-everywhere-talon-e2e test:quickjs
54+
if: runner.os == 'Linux' && matrix.vscode_version == 'stable'
55+
- run: pnpm -F @cursorless/cursorless-everywhere-talon-e2e test:quickjs
56+
if: runner.os != 'Linux' && matrix.vscode_version == 'stable'
4857
- run: bash -x scripts/install-neovim-dependencies.sh
4958
- uses: rhysd/action-setup-vim@v1
5059
id: vim
@@ -58,6 +67,8 @@ jobs:
5867
NEOVIM_PATH: ${{ steps.vim.outputs.executable }}
5968
- uses: ./.github/actions/test-neovim-lua/
6069
if: runner.os == 'Linux' && matrix.app_version == 'stable'
70+
- uses: ./.github/actions/lint-lua-ls/
71+
if: runner.os == 'Linux' && matrix.app_version == 'stable'
6172
- name: Create vscode dist that can be installed locally
6273
run: pnpm -F @cursorless/cursorless-vscode populate-dist --local-install
6374
if: runner.os == 'Linux' && matrix.app_version == 'stable'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
out
22
dist
3+
testOut
34
node_modules
45
.vscode-test/
56
*.vsix
67
/package-lock.json
78
*.DS_Store
9+
meta.json
810
.luacheckcache
911

1012
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

.luarc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"runtime.version": "Lua 5.1",
3+
"diagnostics.ignoredFiles": "Disable",
4+
"diagnostics.globals": ["vim", "talon", "it", "describe"],
5+
"workspace.ignoreDir": ["data/playground/lua/", ".luarocks", ".lua"]
6+
}

.pre-commit-config.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
minimum_pre_commit_version: "2.9.0"
22
ci:
33
autoupdate_schedule: monthly
4-
exclude: /vendor/
4+
exclude: /vendor/|^data/playground/
55
repos:
66
- repo: meta
77
hooks:
@@ -85,9 +85,7 @@ repos:
8585
rev: v1.2.0
8686
hooks:
8787
- id: luacheck
88-
exclude: ^data/playground/lua/.*\.lua$
8988
- repo: https://github.com/JohnnyMorganz/StyLua
9089
rev: v0.20.0
9190
hooks:
9291
- id: stylua
93-
exclude: ^data/playground/lua/.*\.lua$

.vscode/launch.json

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130

131131
// Talon launch configs
132132
{
133-
"name": "Talon: Test",
133+
"name": "Talon: Test grammar",
134134
"type": "node",
135135
"request": "launch",
136136
"program": "${workspaceFolder}/packages/test-harness/dist/runTalonTests.cjs",
@@ -146,7 +146,7 @@
146146
]
147147
},
148148
{
149-
"name": "Talon: Test (subset)",
149+
"name": "Talon: Test grammar (subset)",
150150
"type": "node",
151151
"request": "launch",
152152
"program": "${workspaceFolder}/packages/test-harness/dist/runTalonTests.cjs",
@@ -163,6 +163,41 @@
163163
]
164164
},
165165

166+
// Talon everywhere/JS launch configs
167+
{
168+
"name": "TalonJS: Test",
169+
"type": "node",
170+
"request": "launch",
171+
"program": "${workspaceFolder}/packages/test-harness/dist/runTalonJsTests.cjs",
172+
"env": {
173+
"CURSORLESS_MODE": "test",
174+
"CURSORLESS_REPO_ROOT": "${workspaceFolder}"
175+
},
176+
"outFiles": ["${workspaceFolder}/**/out/**/*.js"],
177+
"preLaunchTask": "VSCode: Build extension and tests",
178+
"resolveSourceMapLocations": [
179+
"${workspaceFolder}/**",
180+
"!**/node_modules/**"
181+
]
182+
},
183+
{
184+
"name": "TalonJS: Test (subset)",
185+
"type": "node",
186+
"request": "launch",
187+
"program": "${workspaceFolder}/packages/test-harness/dist/runTalonJsTests.cjs",
188+
"env": {
189+
"CURSORLESS_MODE": "test",
190+
"CURSORLESS_RUN_TEST_SUBSET": "true",
191+
"CURSORLESS_REPO_ROOT": "${workspaceFolder}"
192+
},
193+
"outFiles": ["${workspaceFolder}/**/out/**/*.js"],
194+
"preLaunchTask": "VSCode: Build extension and tests",
195+
"resolveSourceMapLocations": [
196+
"${workspaceFolder}/**",
197+
"!**/node_modules/**"
198+
]
199+
},
200+
166201
// Unit tests launch configs
167202
{
168203
"name": "Unit tests: Test",

.vscode/settings.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
"typescript.enablePromptUseWorkspaceTsdk": true,
2727
"typescript.tsdk": "node_modules/typescript/lib",
2828
"eslint.workingDirectories": [{ "pattern": "packages/*/" }],
29-
"Lua.runtime.version": "Lua 5.1",
30-
"Lua.diagnostics.globals": ["vim", "talon", "it", "describe"],
31-
"Lua.diagnostics.ignoredFiles": "Disable",
32-
"Lua.workspace.ignoreDir": ["data/playground/lua/"],
3329
"[lua]": {
3430
"editor.defaultFormatter": "JohnnyMorganz.stylua"
3531
},
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
from typing import TypedDict
2+
3+
from talon import Module
4+
5+
6+
class SelectionOffsets(TypedDict):
7+
anchor: int
8+
active: int
9+
10+
11+
class EditorState(TypedDict):
12+
text: str
13+
selections: list[SelectionOffsets]
14+
15+
16+
class EditorChange(TypedDict):
17+
text: str
18+
rangeOffset: int
19+
rangeLength: int
20+
21+
22+
class EditorEdit(TypedDict):
23+
# The new document content after the edit
24+
text: str
25+
26+
# A list of changes that were made to the document. If you can not handle
27+
# this, you can ignore it and just replace the entire document with the
28+
# value of the `text` field above.
29+
changes: list[EditorChange]
30+
31+
32+
mod = Module()
33+
34+
mod.tag("cursorless_everywhere_talon", desc="Enable cursorless everywhere in Talon")
35+
36+
37+
@mod.action_class
38+
class Actions:
39+
def cursorless_everywhere_get_editor_state() -> EditorState: # pyright: ignore [reportReturnType]
40+
"""Get the focused editor element state"""
41+
42+
def cursorless_everywhere_set_selections(
43+
selections: list[SelectionOffsets], # pyright: ignore [reportGeneralTypeIssues]
44+
):
45+
"""Set focused element selections"""
46+
47+
def cursorless_everywhere_edit_text(
48+
edit: EditorEdit, # pyright: ignore [reportGeneralTypeIssues]
49+
):
50+
"""Edit focused element text"""

0 commit comments

Comments
 (0)