Skip to content

Commit c7b00dd

Browse files
committed
Setup script consolidation, update CONTRIBUTING.mdx
- Consolidate initLaunchSandbox.ts and initLaunchSandboxCodium.ts into a single script which determines which editor-cli tool pair is installed automatically. - Remove pointers to now-removed initLaunchSandboxCodium.ts in package.json and packages/cursorless-vscode/package.json - Remove auto-installation of missing extension from VSCodium setup from .vsix file, add documentation on how to install it manually instead to CONTRIBUTING.mdx - Remove data/vsix dir and all files within due to above - Update CONTRIBUTING.mdx to note that running pnpm compile is not strictly required to contribute to Cursorless - Update CONTRIBUTING.mdx to remove reference to the specific version settings profiles were added, and instead just tell contributors to raise an issue if they're a problem for some reason - Fix odd line break at the top of CONTRIBUTING.mdx
1 parent 5d67e7f commit c7b00dd

File tree

8 files changed

+58
-90
lines changed

8 files changed

+58
-90
lines changed

data/vsix/LICENSE-vscode-tree-sitter-query-0.0.6.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

data/vsix/README.md

Lines changed: 0 additions & 4 deletions
This file was deleted.
-2.73 MB
Binary file not shown.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"fix:meta": "pnpm run meta-updater:base && pnpm -r exec prettier --write tsconfig.json package.json",
1818
"fix:syncpack": "pnpm syncpack fix-mismatches",
1919
"init-vscode-sandbox": "pnpm --filter=@cursorless/cursorless-vscode init-launch-sandbox",
20-
"init-codium-sandbox": "pnpm --filter=@cursorless/cursorless-vscode init-launch-sandbox-codium",
2120
"lint:meta": "pnpm run meta-updater:base --test",
2221
"lint:ts": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint packages --ext ts,tsx,mts",
2322
"lint": "pnpm run lint:meta && syncpack list-mismatches && pnpm run lint:ts",

packages/cursorless-org-docs/src/docs/contributing/CONTRIBUTING.mdx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import TabItem from '@theme/TabItem';
33

44
# Contributing
55

6-
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
7-
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.
6+
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.
87

98
## Initial setup
109

@@ -13,18 +12,20 @@ extension](#running--testing-extension-locally). You may also find the [VSCode A
1312
- [Git](https://git-scm.com/)
1413
- [Node.js](https://nodejs.org/en/)
1514
- [Corepack](https://nodejs.org/api/corepack.html) or [pnpm](https://pnpm.io/installation)
16-
- [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.
15+
- [VSCode](https://code.visualstudio.com/) or [VSCodium](https://vscodium.com/); Please file an issue if you are unable to use [settings profiles](https://code.visualstudio.com/updates/v1_72#_settings-profiles), as they are required for the development environment.
16+
Both VSCode and VSCodium will be referred to as VSCode except when instructions differ between the editors.
1717

1818
### Steps
1919

2020
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.
21-
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).
21+
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).
2222
3. Run the following in the terminal:
2323

2424
```bash
2525
pnpm install
2626
pnpm compile
2727
```
28+
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.
2829

2930
4. Run the following in the terminal:
3031

@@ -41,7 +42,7 @@ extension](#running--testing-extension-locally). You may also find the [VSCode A
4142
</TabItem>
4243
</Tabs>
4344

44-
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.
45+
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 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.
4546

4647
5. Run the following in the terminal:
4748

@@ -53,12 +54,14 @@ extension](#running--testing-extension-locally). You may also find the [VSCode A
5354
</TabItem>
5455
<TabItem value="vscodium" label="VSCodium">
5556
```bash
56-
pnpm init-codium-sandbox
57+
pnpm init-vscode-sandbox
5758
```
59+
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.
60+
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.
5861
</TabItem>
5962
</Tabs>
6063

61-
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:
64+
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:
6265

6366
<Tabs groupId="vsx">
6467
<TabItem value="vscode" label="VSCode">

packages/cursorless-vscode/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,6 @@
12481248
"esbuild:meta": "pnpm run esbuild:base --metafile=meta.json",
12491249
"populate-dist": "my-ts-node ./src/scripts/populateDist/index.ts",
12501250
"init-launch-sandbox": "my-ts-node src/scripts/initLaunchSandbox.ts",
1251-
"init-launch-sandbox-codium": "my-ts-node src/scripts/initLaunchSandboxCodium.ts",
12521251
"preprocess-svg-hats": "my-ts-node src/scripts/preprocessSvgHats.ts",
12531252
"hat-adjustment-add": "my-ts-node src/scripts/hatAdjustments/add.ts",
12541253
"hat-adjustment-average": "my-ts-node src/scripts/hatAdjustments/average.ts",

packages/cursorless-vscode/src/scripts/initLaunchSandbox.ts

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,47 @@ import { extensionDependencies } from "@cursorless/common";
77
import * as cp from "child_process";
88

99
const extraExtensions = ["pokey.command-server"];
10+
const vsCodeToolName = "code";
11+
const vsCodiumToolName = "codium";
1012

1113
async function main() {
14+
15+
// CLI tool name check
16+
17+
var cliToolName: string = vsCodeToolName;
18+
var foundTool: boolean = false;
19+
20+
console.log("Checking avalible VSC cli tool...");
21+
22+
while (!foundTool) {
23+
try {
24+
const checkToolSubprocess = cp.spawn(cliToolName, ["-v"], {
25+
stdio: "inherit",
26+
shell: true,
27+
});
28+
29+
await new Promise<void>((resolve, reject) => {
30+
checkToolSubprocess.on("error", reject);
31+
checkToolSubprocess.on("exit", (code) => {
32+
if (code === 0) {
33+
foundTool = true;
34+
resolve();
35+
} else {
36+
reject(new Error(`Process returned code ${code}`));
37+
}
38+
});
39+
});
40+
41+
} catch(error) {
42+
if (cliToolName === vsCodeToolName) {
43+
cliToolName = vsCodiumToolName;
44+
} else if (cliToolName === vsCodiumToolName) {
45+
console.error("No VSC command line interface found!");
46+
process.exit(2);
47+
}
48+
}
49+
}
50+
console.log("Found '%s' cli tool!", vsCodeToolName)
1251
try {
1352
const args = [
1453
"--profile=cursorlessDevelopment",
@@ -21,8 +60,16 @@ async function main() {
2160
args.push("--force");
2261
}
2362

63+
// Do not attempt to install jrieken:vscode-tree-sitter-query if editor is VSCodium
64+
if (cliToolName === vsCodiumToolName) {
65+
const index: number = args.findIndex((value) => value.includes("vscode-tree-sitter-query"))
66+
args.splice(index, 1)
67+
console.log("Not installing jrieken:vscode-tree-sitter-query as it is not on the OpenVSX Marketplace.")
68+
console.log("You should install this extension manually. Check the Cursorless contributor documentation for more info.")
69+
}
70+
2471
// Install extension dependencies
25-
const subprocess = cp.spawn("code", args, {
72+
const subprocess = cp.spawn(cliToolName, args, {
2673
stdio: "inherit",
2774
shell: true,
2875
});

packages/cursorless-vscode/src/scripts/initLaunchSandboxCodium.ts

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)