Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into pokey/initial-work-to…
Browse files Browse the repository at this point in the history
…wards-next-gen-collectionitem
  • Loading branch information
phillco committed Aug 3, 2024
2 parents b5a8038 + 8d15172 commit 923311f
Show file tree
Hide file tree
Showing 3,358 changed files with 20,212 additions and 14,138 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
25 changes: 19 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
// We want to enable this in the long run. For now there are a lot of errors that needs to be handled.
// "plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/typescript",
"prettier"
],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
"sourceType": "module",
"project": true
},
"plugins": [
"@typescript-eslint",
Expand All @@ -20,6 +23,7 @@
],
"rules": {
"import/no-relative-packages": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-assertions": [
"error",
{
Expand All @@ -37,6 +41,7 @@
}
}
],
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
Expand Down Expand Up @@ -85,22 +90,30 @@
}
]
}
},
{
"files": [
"jest.config.ts",
"docusaurus.config.mts",
"mdx-components.tsx",
"typings/**"
],
"extends": ["plugin:@typescript-eslint/disable-type-checked"]
}
],
"settings": {
"import/resolver": {
"typescript": {
"alwaysTryTypes": true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`

"project": ["tsconfig.json", "packages/*/tsconfig.json"]
}
}
},
"ignorePatterns": [
"**/vendor/**/*.ts",
"**/vendor/**/*.js",
"**/out/**",
"**/generated/**",
"data/playground/**"
"**/out/**",
"**/vendor/**/*.js",
"**/vendor/**/*.ts",
"/data/playground/**"
]
}
13 changes: 13 additions & 0 deletions .github/actions/lint-lua-ls/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "Lua Language Server Lint"
description: "Lints all lua files with lua-language-server"
runs:
using: "composite"
steps:
- uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: DeterminateSystems/magic-nix-cache-action@v2
- run: nix profile install --accept-flake-config .#lua-language-server
shell: bash
- run: scripts/lint-lua-ls.sh
shell: bash
3 changes: 3 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ on:
types: [opened, synchronize, reopened]
merge_group:
branches: [main]
workflow_dispatch:

jobs:
pre-commit:
name: Pre-commit
runs-on: ubuntu-latest
env:
CURSORLESS_REPO_ROOT: ${{ github.workspace }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
VSCODE_LOGS_DIR: ${{ github.workspace }}/artifacts/logs
CURSORLESS_REPO_ROOT: ${{ github.workspace }}
TEMP_DIR: ${{ github.workspace }}/temp
NODE_OPTIONS: "--max-old-space-size=4096"
steps:
- uses: actions/checkout@v4
- run: corepack enable
Expand All @@ -45,6 +46,14 @@ jobs:
if: runner.os == 'Linux'
- run: pnpm --color test
if: runner.os != 'Linux'
- run: xvfb-run -a pnpm -F @cursorless/test-harness test:talonJs
if: runner.os == 'Linux' && matrix.vscode_version == 'stable'
- run: pnpm -F @cursorless/test-harness test:talonJs
if: runner.os != 'Linux' && matrix.vscode_version == 'stable'
- run: xvfb-run -a pnpm -F @cursorless/cursorless-everywhere-talon-e2e test:quickjs
if: runner.os == 'Linux' && matrix.vscode_version == 'stable'
- run: pnpm -F @cursorless/cursorless-everywhere-talon-e2e test:quickjs
if: runner.os != 'Linux' && matrix.vscode_version == 'stable'
- run: bash -x scripts/install-neovim-dependencies.sh
- uses: rhysd/action-setup-vim@v1
id: vim
Expand All @@ -58,6 +67,8 @@ jobs:
NEOVIM_PATH: ${{ steps.vim.outputs.executable }}
- uses: ./.github/actions/test-neovim-lua/
if: runner.os == 'Linux' && matrix.app_version == 'stable'
- uses: ./.github/actions/lint-lua-ls/
if: runner.os == 'Linux' && matrix.app_version == 'stable'
- name: Create vscode dist that can be installed locally
run: pnpm -F @cursorless/cursorless-vscode populate-dist --local-install
if: runner.os == 'Linux' && matrix.app_version == 'stable'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
out
dist
testOut
node_modules
.vscode-test/
*.vsix
/package-lock.json
*.DS_Store
meta.json
.luacheckcache

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
Expand Down
6 changes: 6 additions & 0 deletions .luarc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"runtime.version": "Lua 5.1",
"diagnostics.ignoredFiles": "Disable",
"diagnostics.globals": ["vim", "talon", "it", "describe"],
"workspace.ignoreDir": ["data/playground/lua/", ".luarocks", ".lua"]
}
4 changes: 1 addition & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
minimum_pre_commit_version: "2.9.0"
ci:
autoupdate_schedule: monthly
exclude: /vendor/
exclude: /vendor/|^data/playground/
repos:
- repo: meta
hooks:
Expand Down Expand Up @@ -85,9 +85,7 @@ repos:
rev: v1.2.0
hooks:
- id: luacheck
exclude: ^data/playground/lua/.*\.lua$
- repo: https://github.com/JohnnyMorganz/StyLua
rev: v0.20.0
hooks:
- id: stylua
exclude: ^data/playground/lua/.*\.lua$
39 changes: 37 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@

// Talon launch configs
{
"name": "Talon: Test",
"name": "Talon: Test grammar",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/packages/test-harness/dist/runTalonTests.cjs",
Expand All @@ -146,7 +146,7 @@
]
},
{
"name": "Talon: Test (subset)",
"name": "Talon: Test grammar (subset)",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/packages/test-harness/dist/runTalonTests.cjs",
Expand All @@ -163,6 +163,41 @@
]
},

// Talon everywhere/JS launch configs
{
"name": "TalonJS: Test",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/packages/test-harness/dist/runTalonJsTests.cjs",
"env": {
"CURSORLESS_MODE": "test",
"CURSORLESS_REPO_ROOT": "${workspaceFolder}"
},
"outFiles": ["${workspaceFolder}/**/out/**/*.js"],
"preLaunchTask": "VSCode: Build extension and tests",
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
]
},
{
"name": "TalonJS: Test (subset)",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/packages/test-harness/dist/runTalonJsTests.cjs",
"env": {
"CURSORLESS_MODE": "test",
"CURSORLESS_RUN_TEST_SUBSET": "true",
"CURSORLESS_REPO_ROOT": "${workspaceFolder}"
},
"outFiles": ["${workspaceFolder}/**/out/**/*.js"],
"preLaunchTask": "VSCode: Build extension and tests",
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
]
},

// Unit tests launch configs
{
"name": "Unit tests: Test",
Expand Down
4 changes: 0 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.workingDirectories": [{ "pattern": "packages/*/" }],
"Lua.runtime.version": "Lua 5.1",
"Lua.diagnostics.globals": ["vim", "talon", "it", "describe"],
"Lua.diagnostics.ignoredFiles": "Disable",
"Lua.workspace.ignoreDir": ["data/playground/lua/"],
"[lua]": {
"editor.defaultFormatter": "JohnnyMorganz.stylua"
},
Expand Down
50 changes: 50 additions & 0 deletions cursorless-everywhere-talon/cursorless_everywhere_talon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from typing import TypedDict

from talon import Module


class SelectionOffsets(TypedDict):
anchor: int
active: int


class EditorState(TypedDict):
text: str
selections: list[SelectionOffsets]


class EditorChange(TypedDict):
text: str
rangeOffset: int
rangeLength: int


class EditorEdit(TypedDict):
# The new document content after the edit
text: str

# A list of changes that were made to the document. If you can not handle
# this, you can ignore it and just replace the entire document with the
# value of the `text` field above.
changes: list[EditorChange]


mod = Module()

mod.tag("cursorless_everywhere_talon", desc="Enable cursorless everywhere in Talon")


@mod.action_class
class Actions:
def cursorless_everywhere_get_editor_state() -> EditorState: # pyright: ignore [reportReturnType]
"""Get the focused editor element state"""

def cursorless_everywhere_set_selections(
selections: list[SelectionOffsets], # pyright: ignore [reportGeneralTypeIssues]
):
"""Set focused element selections"""

def cursorless_everywhere_edit_text(
edit: EditorEdit, # pyright: ignore [reportGeneralTypeIssues]
):
"""Edit focused element text"""
Loading

0 comments on commit 923311f

Please sign in to comment.