Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
db3ab51
feat: codium sandbox setup cmd (wip)
rinOfTheStars Jun 27, 2025
9edd9ad
hacky workaround to OpenVSX Marketplace stuff
rinOfTheStars Jun 29, 2025
963c0e4
Update CONTRIBUTING docs and change format to mdx
rinOfTheStars Jun 29, 2025
5d67e7f
Merge branch 'main' into main
rinOfTheStars Jun 29, 2025
c7b00dd
Setup script consolidation, update CONTRIBUTING.mdx
rinOfTheStars Jul 3, 2025
18b145a
Fix lack of tabs on a code/codium command mention
rinOfTheStars Jul 3, 2025
498aca0
Merge branch 'main' into main
rinOfTheStars Jul 3, 2025
3caf6ef
Merge branch 'main' into main
rinOfTheStars Jul 4, 2025
1593ee4
Update .gitignore
rinOfTheStars Jul 4, 2025
7c80580
Update CONTRIBUTING.mdx
rinOfTheStars Jul 4, 2025
148ff04
Update CONTRIBUTING.mdx
rinOfTheStars Jul 4, 2025
3b58880
Pass cli tool name as param, update CONTRIBUTING.mdx
rinOfTheStars Jul 4, 2025
687bd4c
Merge branch 'main' of https://github.com/rinOfTheStars/cursorless
rinOfTheStars Jul 4, 2025
85a3c3f
Merge branch 'cursorless-dev:main' into main
rinOfTheStars Jul 4, 2025
75605c0
Merge branch 'main' into main
rinOfTheStars Jul 10, 2025
4692560
Update packages/cursorless-org-docs/src/docs/contributing/CONTRIBUTIN…
rinOfTheStars Jul 10, 2025
811221e
Update initLaunchSandbox.ts
rinOfTheStars Jul 10, 2025
7d74c0c
ran prettier
AndreasArvidsson Jul 12, 2025
36ff867
Clean up sandbox script
AndreasArvidsson Jul 12, 2025
b4803f4
Merge branch 'main' into main
AndreasArvidsson Jul 12, 2025
f679748
Fix build problem with quotes
AndreasArvidsson Jul 12, 2025
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@ cursorless.nvim/node/test-harness

# nix
.direnv/

# unignore .vsix files in data/vsix
# required for vscodium dev env setup until https://github.com/jrieken/vscode-tree-sitter-query/issues/28 is closed
!data/vsix/*.vsix
21 changes: 21 additions & 0 deletions data/vsix/LICENSE-vscode-tree-sitter-query-0.0.6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 - present Microsoft Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 4 additions & 0 deletions data/vsix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Used in the rare case an extension required for the development environment is not present on the OpenVSX Marketplace (or the VSCode Marketplace, though that is far less likely).

As such, `.vsix` files in this directory are included in the git repository. **Make sure the extension license permits redistribution before adding it to this directory, and include a copy of the license!**

Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"fix:meta": "pnpm run meta-updater:base && pnpm -r exec prettier --write tsconfig.json package.json",
"fix:syncpack": "pnpm syncpack fix-mismatches",
"init-vscode-sandbox": "pnpm --filter=@cursorless/cursorless-vscode init-launch-sandbox",
"init-codium-sandbox": "pnpm --filter=@cursorless/cursorless-vscode init-launch-sandbox-codium",
"lint:meta": "pnpm run meta-updater:base --test",
"lint:ts": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint packages --ext ts,tsx,mts",
"lint": "pnpm run lint:meta && syncpack list-mismatches && pnpm run lint:ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Contributing

Welcome! So glad you've decided to help make Cursorless better. You'll want to start by getting [set up](#initial-setup) and learning how to [run / test a local copy of the
Expand All @@ -10,44 +13,71 @@ extension](#running--testing-extension-locally). You may also find the [VSCode A
- [Git](https://git-scm.com/)
- [Node.js](https://nodejs.org/en/)
- [Corepack](https://nodejs.org/api/corepack.html) or [pnpm](https://pnpm.io/installation)
- [VSCode](https://code.visualstudio.com/); minimum version for local development is 1.72.0 in order to support settings profiles for sandboxed development. Please file an issue if that is a problem.
- [VSCode](https://code.visualstudio.com/) or [VSCodium](https://vscodium.com/); minimum version for local development is 1.72.0 (1.72.0.22279 for VSCodium) in order to support settings profiles for sandboxed development. Please file an issue if that is a problem.

### Steps

1. Clone [`cursorless`](https://github.com/cursorless-dev/cursorless) locally. Note that it doesn't matter where you clone it, as long as you _**do not**_ clone it into your Talon user directory.
2. Open the newly created `cursorless` directory in VSCode. If you're on Windows, don't use WSL (see [#919](https://github.com/cursorless-dev/cursorless/issues/919) for discussion / workaround).
2. Open the newly created `cursorless` directory in VSCode/VSCodium. If you're on Windows, don't use WSL (see [#919](https://github.com/cursorless-dev/cursorless/issues/919) for discussion / workaround).
3. Run the following in the terminal:

```bash
pnpm install
pnpm compile
```

4. Run
4. Run the following in the terminal:

```bash
code --profile=cursorlessDevelopment
```
<Tabs groupId="vsx">
<TabItem value="vscode" label="VSCode" default>
```bash
code --profile=cursorlessDevelopment
```
</TabItem>
<TabItem value="vscodium" label="VSCodium">
```bash
codium --profile=cursorlessDevelopment
```
</TabItem>
</Tabs>

and then close the window that opens (eg say `"window close"`). This step is necessary to create the [VSCode settings profile](https://code.visualstudio.com/updates/v1_72#_settings-profiles) that acts as a sandbox containing a specific set of VSCode extensions that will be run alongside Cursorless when you launch Cursorless in debug or test mode. Once https://github.com/microsoft/vscode/issues/172046 is resolved, we will be able to remove this step, as the profile can then automatically be created.
and then close the window that opens (eg say `"window close"`). This step is necessary to create the [settings profile](https://code.visualstudio.com/updates/v1_72#_settings-profiles) that acts as a sandbox containing a specific set of VSX extensions that will be run alongside Cursorless when you launch Cursorless in debug or test mode. Once https://github.com/microsoft/vscode/issues/172046 is resolved, we will be able to remove this step, as the profile can then automatically be created.

5. Run the following in the terminal:

```bash
pnpm init-vscode-sandbox
```

The `pnpm init-vscode-sandbox` command creates a local [VSCode settings profile](https://code.visualstudio.com/updates/v1_72#_settings-profiles) that acts as a sandbox containing a specific set of VSCode extensions that will be run alongside Cursorless when you launch Cursorless in debug or test mode. This approach is [suggested](https://code.visualstudio.com/updates/v1_72#_extension-debugging-in-a-clean-environment) by the VSCode documentation. If you need to update any of the extension dependencies in the sandbox, you can add `--force` to the command. If you'd like to use additional extensions when debugging locally, you can use the following command:

```bash
code --profile=cursorlessDevelopment --install-extension some.extension
```
<Tabs groupId="vsx">
<TabItem value="vscode" label="VSCode">
```bash
pnpm init-vscode-sandbox
```
</TabItem>
<TabItem value="vscodium" label="VSCodium">
```bash
pnpm init-codium-sandbox
```
</TabItem>
</Tabs>

Said command adds extensions to the aforementioned settings profile that acts as a sandbox containing a specific set of VSX extensions that will be run alongside Cursorless when you launch Cursorless in debug or test mode. This approach is [suggested](https://code.visualstudio.com/updates/v1_72#_extension-debugging-in-a-clean-environment) by the VSCode documentation. If you need to update any of the extension dependencies in the sandbox, you can add `--force` to the command. If you'd like to use additional extensions when debugging locally, you can use the following command:

<Tabs groupId="vsx">
<TabItem value="vscode" label="VSCode">
```bash
code --profile=cursorlessDevelopment --install-extension some.extension
```
</TabItem>
<TabItem value="vscodium" label="VSCodium">
```bash
codium --profile=cursorlessDevelopment --install-extension some.extension
```
</TabItem>
</Tabs>

where `some.extension` is the id of the extension you'd like to install into the sandbox.

Note that you do not need to install the Cursorless extension into the `cursorlessDevelopment` profile. A local development version of Cursorless will be automatically installed there every time you debug the extension, as described below.

Also note that if you are adding support for a new language that isn't in the default list of [language identifiers](https://code.visualstudio.com/docs/languages/identifiers#_known-language-identifiers) supported by VSCode, you may need to add an extension dependency. See [Adding a new language](./adding-a-new-language.md#2-ensure-file-type-is-supported-by-vscode) for more details.
Also note that if you are adding support for a new language that isn't in the default list of [language identifiers](https://code.visualstudio.com/docs/languages/identifiers#_known-language-identifiers) supported by VSCode/VSCodium, you may need to add an extension dependency. See [Adding a new language](./adding-a-new-language.md#2-ensure-file-type-is-supported-by-vscode) for more details.

6. Copy / symlink [`cursorless-talon-dev`](../../cursorless-talon-dev) into your Talon user directory for some useful voice commands for developing Cursorless.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The implementation of the local version of the cheatsheet is split between the T

When you add a new scope type, action, modifier, etc, you'll need to ensure that it shows up both locally and on the website. It will usually automatically show up in the local cheatsheet. You can verify this by saying `"cursorless cheatsheet"` with your development version of `cursorless-talon` active in your Talon user directory, and inspecting the cheatsheet that appears. If it does not, you'll need to make fixes to [the Talon side of the cheatsheet](../../../../../cursorless-talon/src/cheatsheet).

In either case, to get your changes to appear on the website, you need to update the defaults in [`defaults.json`](../../../../../packages/cheatsheet/src/lib/sampleSpokenFormInfos/defaults.json). First make sure you have the `cursorless-talon-dev` user file set in your Talon home directory, as indicated in the [initial contributor setup instructions](CONTRIBUTING.md#initial-setup). Then you can say `"cursorless update cheatsheet"` to update the default spoken forms. Note that this will use your custom spoken forms, so you may need to do some manual cleanup.
In either case, to get your changes to appear on the website, you need to update the defaults in [`defaults.json`](../../../../../packages/cheatsheet/src/lib/sampleSpokenFormInfos/defaults.json). First make sure you have the `cursorless-talon-dev` user file set in your Talon home directory, as indicated in the [initial contributor setup instructions](CONTRIBUTING.mdx#initial-setup). Then you can say `"cursorless update cheatsheet"` to update the default spoken forms. Note that this will use your custom spoken forms, so you may need to do some manual cleanup.

## Running the cheatsheet in development mode

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Note that Cursorless is maintained as a monorepo, hosted at [`cursorless`](https

### 1. Follow the initial contributor setup guide

Follow the steps in [CONTRIBUTING.md](./CONTRIBUTING.md#initial-setup).
Follow the steps in [CONTRIBUTING.mdx](./CONTRIBUTING.mdx#initial-setup).

### 2. Get production Cursorless neovim working

Expand Down Expand Up @@ -45,7 +45,7 @@ In order to test out your local version of the extension or to run unit tests lo

NOTE: This will spawn a standalone nvim instance that is independent of VSCode. Consequently after you're done debugging, you need to close nvim.

If you don't have the `cursorless-talon-dev` files in your Talon user directory as described in step 6 of [CONTRIBUTING.md](./CONTRIBUTING.md#initial-setup), then you instead need to run the `workbench.action.debug.selectandstart` command in VSCode and then select either "Neovim: Run" or "Neovim: Test".
If you don't have the `cursorless-talon-dev` files in your Talon user directory as described in step 6 of [CONTRIBUTING.mdx](./CONTRIBUTING.mdx#initial-setup), then you instead need to run the `workbench.action.debug.selectandstart` command in VSCode and then select either "Neovim: Run" or "Neovim: Test".

### Running lua tests

Expand Down
1 change: 1 addition & 0 deletions packages/cursorless-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,7 @@
"esbuild:meta": "pnpm run esbuild:base --metafile=meta.json",
"populate-dist": "my-ts-node ./src/scripts/populateDist/index.ts",
"init-launch-sandbox": "my-ts-node src/scripts/initLaunchSandbox.ts",
"init-launch-sandbox-codium": "my-ts-node src/scripts/initLaunchSandboxCodium.ts",
"preprocess-svg-hats": "my-ts-node src/scripts/preprocessSvgHats.ts",
"hat-adjustment-add": "my-ts-node src/scripts/hatAdjustments/add.ts",
"hat-adjustment-average": "my-ts-node src/scripts/hatAdjustments/average.ts",
Expand Down
55 changes: 55 additions & 0 deletions packages/cursorless-vscode/src/scripts/initLaunchSandboxCodium.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* A clone of initLaunchSandbox.ts for VSCodium setup (as the command codium is used instead of code)
*/
import { extensionDependencies } from "@cursorless/common";
import * as cp from "child_process";
import * as path from "node:path"

const extraExtensions = ["pokey.command-server"];

async function main() {
try {

const args = [
"--profile=cursorlessDevelopment",
...[...extensionDependencies, ...extraExtensions].flatMap(
(dependency) => ["--install-extension", dependency],
),
];

// remove attempt to get vscode-tree-sitter-query from OpenVSX marketplace
var index: number = args.findIndex((value) => value.includes("vscode-tree-sitter-query"))
args.splice(index, 1)

// add vscode-tree-sitter-query via .vsix file
const location : string = path.join("..", "..", "data", "vsix", "jrieken.vscode-tree-sitter-query-0.0.6.vsix")
args.push("--profile=cursorlessDevelopment --install-extension ".concat(location))

if (process.argv.includes("--force")) {
args.push("--force");
}

// Install extension dependencies
const subprocess = cp.spawn("codium", args, {
stdio: "inherit",
shell: true,
});

await new Promise<void>((resolve, reject) => {
subprocess.on("error", reject);
subprocess.on("exit", (codium) => {
if (codium === 0) {
resolve();
} else {
reject(new Error(`Process returned code ${codium}`));
}
});
});
} catch (err) {
console.error("Failed to init launch sandbox");
console.error(err);
process.exit(1);
}
}

void main();
Loading