Skip to content

Add sandbox setup cmd for VSCodium #2989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jul 12, 2025
Merged
Show file tree
Hide file tree
Changes from 14 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
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
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
extension](#running--testing-extension-locally). You may also find the [VSCode API docs](https://code.visualstudio.com/api) helpful to learn about VSCode extension development.
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 extension](#running--testing-extension-locally). You may also find the [VSCode API docs](https://code.visualstudio.com/api) helpful to learn about VSCode extension development.

## Initial setup

Expand All @@ -10,7 +12,8 @@ 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/)
Both VSCode and VSCodium will be referred to as VSCode except when instructions differ between the editors.

### Steps

Expand All @@ -22,26 +25,56 @@ extension](#running--testing-extension-locally). You may also find the [VSCode A
pnpm install
pnpm compile
```

4. Run

```bash
code --profile=cursorlessDevelopment
```
Don't fret if `pnpm compile` fails! While required for running tests locally on your machine, you will still be able to run tests through GitHub Actions, and it will not prevent you from contributing otherwise.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed if it should go in a separate PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should compile fail locally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish I knew 😓 but as I noted in the talon slack, it fails locally on my machine despite seemingly having no reason to. Still trying to track down what's wrong with my setup (or if its a regression/bug that only occurs for new contributors).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably have a discord session about that. Not being able to compile locally is not a good developer experience.

Copy link
Contributor Author

@rinOfTheStars rinOfTheStars Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this is a known issue on the @types maintainers' end that fell through the cracks and never got fixed: DefinitelyTyped/DefinitelyTyped#43912

Adding "skipLibCheck": true to the base ts config (tsconfig.base.json) seems to fix this issue without causing any itself (running all tests seems to work fine); no clue why the bug happens on some systems but not others, however, or if there are potential major caveats to this fix. If there's some way to detect when a build fails due to the conflict between @types/mocha and @types/jest and only then pass this config argument, that would probably be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I have a link to the discord, then? Idk if I want to do voice call stuff but seeing if other people can replicate this (bc it is extremely odd it only happens on my machine, and yet occurs regardless of install location) is probably best done there, yeah

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly.
https://discord.gg/zGdVz2pD

That sounds like it might be a path or other environment variable interfering?

Anyhow I don't think we should have texts in the documentation expecting people not to be able to compile cursorless.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly. https://discord.gg/zGdVz2pD

That sounds like it might be a path or other environment variable interfering?

Anyhow I don't think we should have texts in the documentation expecting people not to be able to compile cursorless.

Yeah, fair enough honestly. I wish I had any clue as to what exactly is preventing pnpm compile from working, but honestly I'm entirely clueless at this point. My only guess is it has something to do with homebrew itself, or with the filesystem being used? I'm probably going to do a disk wipe + reinstall sometime soon anyway (I've got backups through a Time Machine external disk, so I'll manually restore stuff piecemeal when I need it) so if that doesn't fix this issue when running everything from as fresh of an install as possible, then I guess that'd could as reproduction?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's really strange. Let's do this. Can you run the below commands and give me the full log? You can do it on slack if you don't want to post it here.

node -v
npm -v
pnpm -v
pnpm run clean
pnpm install
pnpm compile

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://gist.github.com/rinOfTheStars/522c9b95f28cc3d4b0b9d9b98eacfb95

Unless there's something going on with one of the node/npm/pnpm versions being used, nothing seems out of the ordinary until the pnpm compile failure at the end.


4. Run the following in the terminal:

<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.

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-vscode-sandbox --codium
```
VSCodium users will also need to manually download and install the `jrieken:vscode-tree-sitter-query` extension, as it is [currently not avalible](https://github.com/jrieken/vscode-tree-sitter-query/issues/28) on the OpenVSX Marketplace.
Instructions on how to manually download the extension can be found [in this Stack Overflow post](https://stackoverflow.com/a/79565372) ([archived](https://web.archive.org/web/20250421130639/https://stackoverflow.com/questions/79359919/how-can-i-manually-download-vsix-files-now-that-the-vs-code-marketplace-no-long/79565372#79565372)), while manual installation instructions can be found directly below—replace `some.extension` with the acquired `.vsix` file's path instead of an extension id.
</TabItem>
</Tabs>

Said command adds extensions to the aforementioned settings profile 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:

<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.

Expand Down Expand Up @@ -106,9 +139,18 @@ vsce package -o bundle.vsix

Once you have your package then you can install it into the sandbox using the following command:

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

## Installing a local build of the Cursorless extension

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
23 changes: 22 additions & 1 deletion packages/cursorless-vscode/src/scripts/initLaunchSandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@ import * as cp from "child_process";

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

const vsCodeToolName : string = "code"
const validCliToolParams : Array<string> = ["--code", "--codium"]

async function main() {
try {
// Read cli tool name from arguments, assume tool name is 'code' if not present
var cliToolName = vsCodeToolName;

process.argv.forEach(argument => {
if (validCliToolParams.includes(argument)) {
cliToolName = argument.replace("--", "");
console.log("Cli tool name manually set to " + cliToolName);
}
});

const args = [
"--profile=cursorlessDevelopment",
...[...extensionDependencies, ...extraExtensions].flatMap(
Expand All @@ -21,8 +34,16 @@ async function main() {
args.push("--force");
}

// Do not attempt to install jrieken:vscode-tree-sitter-query if editor is NOT VSCode, assuming lack of access to VSCode Marketplace
if (cliToolName !== vsCodeToolName) {
const index: number = args.findIndex((value) => value.includes("vscode-tree-sitter-query"))
args.splice(index, 1)
console.log("Not installing jrieken:vscode-tree-sitter-query as it is not on the OpenVSX Marketplace.")
console.log("You should install this extension manually. Check the Cursorless contributor documentation for more info.")
}

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