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/actions/test-neovim-lua/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ runs:
luarocks install luafilesystem
- shell: bash
run: |
cd cursorless.nvim
cd packages/app-neovim/cursorless.nvim
busted --run unit
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
/packages/*/out/
/packages/*/dist/
/packages/app-web-docs/.docusaurus/
/packages/app-neovim/cursorless.nvim/node/cursorless-neovim/
/packages/app-neovim/cursorless.nvim/node/test-runner/
/packages/*/tsconfig.tsbuildinfo
/packages/test-runner/testSubsetGrep.properties
/packages/test-runner/failedTests.properties

# Cursorless Neovim
/cursorless.nvim/node/cursorless-neovim/
/cursorless.nvim/node/test-runner/

# Anywhere
node_modules/
*.vsix
Expand Down
1 change: 1 addition & 0 deletions eslint.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const ignoresConfig: ConfigWithExtends = {
"packages/*/out/**",
"packages/*/dist/**",
"packages/app-web-docs/.docusaurus/**",
"packages/app-neovim/cursorless.nvim/**",
"packages/app-vscode/src/keyboard/grammar/generated/**",
"packages/lib-engine/src/customCommandGrammar/generated/**",
"packages/lib-engine/src/snippets/vendor/**",
Expand Down
2 changes: 1 addition & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local repo_root = os.getenv("CURSORLESS_REPO_ROOT")
if not repo_root then
error("CURSORLESS_REPO_ROOT is not set. Run via debug-neovim.sh script.")
end
vim.opt.runtimepath:append(repo_root .. "/cursorless.nvim")
vim.opt.runtimepath:append(repo_root .. "/packages/app-neovim/cursorless.nvim")

require("talon").setup()
require("cursorless").setup()
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
"@types/mocha": "^10.0.10",
"@types/node": "^24.12.0",
"@types/rimraf": "^^3.0.0",
"@types/vscode": "^1.98.0",
"@types/vscode": "1.98.0",
"@typescript-eslint/eslint-plugin": "^8.32.1",
"@typescript-eslint/parser": "^8.32.1",
"esbuild": "^0.27.4",
"eslint": "^10.0.0",
"eslint": "^10.0.3",
"fast-glob": "^3.3.3",
"mocha": "^8.1.3",
"neovim": "^5.0.1",
"typescript": "^5.8.3",
"mocha": "^11.7.5",
"neovim": "^5.4.0",
"typescript": "^5.9.3",
"vscode-test": "^1.6.1"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/app-neovim/scripts/populate-dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [ ! -e "${CURSORLESS_REPO_ROOT-nonexistent}" ]; then
CURSORLESS_REPO_ROOT=$(git rev-parse --show-toplevel)
fi
echo "CURSORLESS_REPO_ROOT: $CURSORLESS_REPO_ROOT"
cursorless_nvim_dir="$CURSORLESS_REPO_ROOT/cursorless.nvim"
cursorless_nvim_dir="$CURSORLESS_REPO_ROOT/packages/app-neovim/cursorless.nvim"
cursorless_neovim_node_in_dir="$CURSORLESS_REPO_ROOT/packages/app-neovim"
test_runner_node_in_dir="$CURSORLESS_REPO_ROOT/packages/test-runner"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,21 @@ This ends up passing the `init.lua` script as the default config file (`-u`):
nvim -u %CURSORLESS_REPO_ROOT%/init.lua
```

This `init.lua` adds the local `cursorless.nvim` relative path to the runtime path and initializes Cursorless:
This `init.lua` adds the local `packages/app-neovim/cursorless.nvim` relative path to the runtime path and initializes Cursorless:

```lua
local repo_root = os.getenv("CURSORLESS_REPO_ROOT")
if not repo_root then
error("CURSORLESS_REPO_ROOT is not set. Run via debug-neovim.sh script.")
end
vim.opt.runtimepath:append(repo_root .. "/cursorless.nvim")
vim.opt.runtimepath:append(repo_root .. "/packages/app-neovim/cursorless.nvim")
...
require("cursorless").setup()
```

NOTE: this relies on having symlinks inside `cursorless.nvim/node/` to point to the development paths `packages/app-neovim` and `packages/test-runner`. This is required in order to have all the symbols loaded for debugging.
NOTE: this relies on having symlinks inside `packages/app-neovim/cursorless.nvim/node/` to point to the development paths `packages/app-neovim` and `packages/test-runner`. This is required in order to have all the symbols loaded for debugging.

This ends up calling `setup()` from `cursorless.nvim/lua/cursorless/init.lua`:
This ends up calling `setup()` from `packages/app-neovim/cursorless.nvim/lua/cursorless/init.lua`:

```lua
local function setup(user_config)
Expand Down Expand Up @@ -257,7 +257,7 @@ export async function launchNeovimAndRunTests() {
console.log(`done: ${done}`);
```

At this stage, we are in a similar situation to the "Cursorless tests for neovim locally" case where `nvim` is started with the `packages/test-runner/src/config/init.lua` config file. Similarly, this `init.lua` adds the local `cursorless.nvim` relative path to the runtime path and initializes Cursorless:
At this stage, we are in a similar situation to the "Cursorless tests for neovim locally" case where `nvim` is started with the `packages/test-runner/src/config/init.lua` config file. Similarly, this `init.lua` adds the local `dist/cursorless.nvim` relative path to the runtime path and initializes Cursorless:

```lua
local repo_root = os.getenv("CURSORLESS_REPO_ROOT")
Expand All @@ -271,7 +271,7 @@ This ends up calling `setup()` from `dist/cursorless.nvim/lua/cursorless/init.lu

NOTE: Because `NVIM_NODE_HOST_DEBUG` is not set on CI, `nvim` loads entirely right away and tests are executed.

NOTE: CI uses `dist/cursorless.nvim/` (and not `cursorless.nvim/`), since the symlinks in `cursorless.nvim/` are only created locally in order to get symbols loaded, which we don't need on CI.
NOTE: CI uses `dist/cursorless.nvim/` (and not `packages/app-neovim/cursorless.nvim/`), since the symlinks in `packages/app-neovim/cursorless.nvim/` are only created locally in order to get symbols loaded, which we don't need on CI.

## Lua unit tests

Expand All @@ -280,19 +280,19 @@ This is supported on Linux only, both locally and on CI.
Here is the call path when running lua unit tests locally. Note that `->` indicates one file calling another file:

```
launch.json -> .vscode/tasks.json -> cd cursorless.nvim && busted --run unit
cursorless.nvim/.busted
-> lua interpreter: cursorless.nvim/test/nvim-shim.sh -> nvim -l <spec_script>
-> test specification files: cursorless.nvim/test/unit/*_spec.lua
launch.json -> .vscode/tasks.json -> cd packages/app-neovim/cursorless.nvim && busted --run unit
packages/app-neovim/cursorless.nvim/.busted
-> lua interpreter: packages/app-neovim/cursorless.nvim/test/nvim-shim.sh -> nvim -l <spec_script>
-> test specification files: packages/app-neovim/cursorless.nvim/test/unit/*_spec.lua
```

And here is the call path when running lua unit tests on CI:

```
.github/workflows/test.yml -> .github/actions/test-neovim-lua/action.yml -> cd cursorless.nvim && busted --run unit
cursorless.nvim/.busted
-> lua interpreter: cursorless.nvim/test/nvim-shim.sh -> nvim -l <spec_script>
-> test specification files: cursorless.nvim/test/unit/*_spec.lua
.github/workflows/test.yml -> .github/actions/test-neovim-lua/action.yml -> cd packages/app-neovim/cursorless.nvim && busted --run unit
packages/app-neovim/cursorless.nvim/.busted
-> lua interpreter: packages/app-neovim/cursorless.nvim/test/nvim-shim.sh -> nvim -l <spec_script>
-> test specification files: packages/app-neovim/cursorless.nvim/test/unit/*_spec.lua
```

### Running lua unit tests
Expand All @@ -301,7 +301,7 @@ Many of the cursorless.nvim lua functions are run in order to complete Cursorles
indirectly tested by the tests described in the [previous section](#running-neovim-tests-locally). Nevertheless, we run
more specific unit tests in order to give better visibility into exactly which functions are failing.
The [busted](https://github.com/lunarmodules/busted) framework is used to test lua functions defined in cursorless.nvim.
This relies on a `cursorless.nvim/.busted` file which directs busted to use a lua interpreter and test specifications files:
This relies on a `packages/app-neovim/cursorless.nvim/.busted` file which directs busted to use a lua interpreter and test specifications files:

```bash
return {
Expand All @@ -314,12 +314,12 @@ return {
}
```

The `.busted` file declares the `cursorless.nvim/test/nvim-shim.sh` shell wrapper as its lua interpreter. This script sets up an enclosed neovim environment by using [XDG Base
The `.busted` file declares the `packages/app-neovim/cursorless.nvim/test/nvim-shim.sh` shell wrapper as its lua interpreter. This script sets up an enclosed neovim environment by using [XDG Base
Directory](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) environment variables (Linux
only) pointing to a temp directory. This allows loading cursorless.nvim, any helpers and (optional) plugins needed to run
the tests. Consequently, the cursorless.nvim lua functions are exposed to the tests. Afterwards, the shim will use `nvim -l <spec_script>` for each of the [lua test specifications scripts](https://neovim.io/doc/user/starting.html#-l).
The `.busted` file declares that test specifications files are in
`cursorless.nvim/test/unit/`. Any file in that folder ending with `_spec.lua` contains tests and will be executed
`packages/app-neovim/cursorless.nvim/test/unit/`. Any file in that folder ending with `_spec.lua` contains tests and will be executed
by neovim's lua interpreter.
NOTE: Different tests rely on
the same custom test helper functions. These functions are exposed as globals in a file called `helpers.lua` placed in `nvim/plugin/` inside the isolated XDG environment. These helpers themselves also have their own unit tests that will be run by busted.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ On Windows, open the Control Panel, navigate to `User Accounts > User Accounts`.

This step is only required on Windows if you don't run VSCode with Administrator privileges.

Open a `cmd.exe` with Administrator privileges and create the symbolic links between the source folders and the `cursorless.nvim` destination folder:
Open a `cmd.exe` with Administrator privileges and create the symbolic links between the source folders and the `packages/app-neovim/cursorless.nvim` destination folder:

```bat
mklink /D C:\path\to\cursorless\cursorless.nvim\node\cursorless-neovim C:\path\to\cursorless\packages\app-neovim
mklink /D C:\path\to\cursorless\cursorless.nvim\node\test-runner C:\path\to\cursorless\packages\test-runner
mklink /D C:\path\to\cursorless\packages\app-neovim\cursorless.nvim\node\cursorless-neovim C:\path\to\cursorless\packages\app-neovim
mklink /D C:\path\to\cursorless\packages\app-neovim\cursorless.nvim\node\test-runner C:\path\to\cursorless\packages\test-runner
```

Note that the `C:\path\to\cursorless` path above should match your cloned cursorless repository.
Expand All @@ -49,7 +49,7 @@ If you don't have the `cursorless-talon-dev` files in your Talon user directory

### Running lua tests

Their are separate cursorless and lua tests. You can run the lua tests by entering the `cursorless.nvim` folder and
Their are separate cursorless and lua tests. You can run the lua tests by entering the `packages/app-neovim/cursorless.nvim` folder and
running: `busted --run unit`. These tests currently only work on Linux.

## Sending pull requests
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy-cursorless-nvim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ git rm -r '*'
cd -

# Copy static files
rsync -avhW --no-compress --exclude test --exclude .busted cursorless.nvim/ "$staging_dir/"
rsync -avhW --no-compress --exclude test --exclude .busted packages/app-neovim/cursorless.nvim/ "$staging_dir/"

# Copy the built .js file
mkdir -p "$staging_dir/node/cursorless-neovim/out"
Expand Down
Loading