-
-
Notifications
You must be signed in to change notification settings - Fork 88
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
base: main
Are you sure you want to change the base?
Changes from all commits
db3ab51
9edd9ad
963c0e4
5d67e7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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. |
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!** | ||
|
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 | ||
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since vscodium is a vscode fork I think it's totally fine if we just refer to vscode. Specifying that it is a vscode settings profile makes it a bit clearer. |
||
|
||
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need to be these specific |
||
|
||
6. Copy / symlink [`cursorless-talon-dev`](../../cursorless-talon-dev) into your Talon user directory for some useful voice commands for developing Cursorless. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
rinOfTheStars marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* 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(); |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite an old version as this point see I don't think we need to be that specific. I would just I remove the vscodium version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make more sense to just remove reference to the minimum version entirely (given it is multiple years old and required extensions might not even work anymore), and just state that if a lack of settings profiles is required for some reason, the contributor should file an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds reasonable