Fixes for vscode 1.75.0 (#1249)

## Checklist

- [ ] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [ ] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [ ] I have not broken the cheatsheet

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>
This commit is contained in:
Pokey Rule 2023-02-10 00:18:22 -07:00 committed by GitHub
parent bac6592da7
commit bca3c8a008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 57 additions and 14 deletions

View File

@ -21,14 +21,30 @@ jobs:
runs-on: ${{ matrix.os }}
env:
VSCODE_VERSION: ${{ matrix.vscode_version }}
VSCODE_CRASH_DIR: ${{ github.workspace }}/artifacts/dumps
VSCODE_LOGS_DIR: ${{ github.workspace }}/artifacts/logs
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
- run: mkdir -p "${{ env.VSCODE_CRASH_DIR }}" "${{ env.VSCODE_LOGS_DIR }}"
shell: bash
- run: yarn install --frozen-lockfile
- run: xvfb-run -a yarn test
if: runner.os == 'Linux'
- run: yarn test
if: runner.os != 'Linux'
- name: Archive logs
uses: actions/upload-artifact@v3
with:
name: logs
path: ${{ env.VSCODE_LOGS_DIR }}
if: failure()
- name: Archive dumps
uses: actions/upload-artifact@v3
with:
name: dumps
path: ${{ env.VSCODE_CRASH_DIR }}
if: failure()

View File

@ -18,15 +18,7 @@ extension](#running--testing-extension-locally), you may want to check out the
1. Clone [`cursorless`](https://github.com/cursorless-dev/cursorless)
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).
3. Add the following to your [VSCode `settings.json`](https://code.visualstudio.com/docs/getstarted/settings#_settingsjson) (can be opened by saying `"show settings json"` with a recent install of knausj)
```json
"workbench.experimental.settingsProfiles.enabled": true
```
This setting allows you to debug the Cursorless extension in a clean, sandboxed version of VSCode, with its own extensions and settings, using the experimental [VSCode settings profile feature](https://code.visualstudio.com/updates/v1_72#_settings-profiles).
4. Run the following in the terminal:
3. Run the following in the terminal:
```bash
yarn
@ -42,7 +34,7 @@ extension](#running--testing-extension-locally), you may want to check out the
where `some.extension` is the id of the extension you'd like to install into the sandbox
5. Copy / symlink `cursorless-talon-dev` into your Talon user directory for some useful voice commands for developing Cursorless.
4. Copy / symlink `cursorless-talon-dev` into your Talon user directory for some useful voice commands for developing Cursorless.
## Running / testing extension locally

View File

@ -6,9 +6,12 @@ import * as assert from "assert";
import { window } from "vscode";
import { endToEndTestSetup, sleepWithBackoff } from "../endToEndTestSetup";
import { runCursorlessCommand } from "../runCommand";
import { skipIfWindowsCi } from "./skipIfWindowsCi";
// Check that setSelection is able to focus the correct cell
suite("Cross-cell set selection", async function () {
// Skipped for now; see #1260
skipIfWindowsCi();
endToEndTestSetup(this);
test("Cross-cell set selection", runTest);

View File

@ -8,9 +8,12 @@ import { window } from "vscode";
import { endToEndTestSetup, sleepWithBackoff } from "../endToEndTestSetup";
import { getPlainNotebookContents } from "../notebook";
import { runCursorlessCommand } from "../runCommand";
import { skipIfWindowsCi } from "./skipIfWindowsCi";
// Check that setSelection is able to focus the correct cell
suite("Edit new cell", async function () {
// Skipped for now; see #1260
skipIfWindowsCi();
endToEndTestSetup(this);
test("drink cell", () =>
@ -30,7 +33,7 @@ async function runTest(
// FIXME: There seems to be some timing issue when you create a notebook
// editor
await sleepWithBackoff(1000);
await sleepWithBackoff(100);
await graph.hatTokenMap.addDecorations();
@ -50,6 +53,8 @@ async function runTest(
],
});
await sleepWithBackoff(100);
assert.equal(notebook.cellCount, 2);
const activeCelIndex = getCellIndex(

View File

@ -6,9 +6,12 @@ import * as assert from "assert";
import { window } from "vscode";
import { endToEndTestSetup, sleepWithBackoff } from "../endToEndTestSetup";
import { runCursorlessCommand } from "../runCommand";
import { skipIfWindowsCi } from "./skipIfWindowsCi";
// Check that setSelection is able to focus the correct cell
suite("Within cell set selection", async function () {
// Skipped for now; see #1260
skipIfWindowsCi();
endToEndTestSetup(this);
test("Within cell set selection", runTest);

View File

@ -0,0 +1,7 @@
export function skipIfWindowsCi() {
suiteSetup(function () {
if (process.env.RUNNER_OS === "Windows" && process.env.CI === "true") {
this.skip();
}
});
}

View File

@ -5,7 +5,6 @@ import {
resolveCliArgsFromVSCodeExecutablePath,
runTests,
} from "@vscode/test-electron";
import { env } from "process";
import { extensionDependencies } from "./extensionDependencies";
/**
@ -20,10 +19,15 @@ export async function launchVscodeAndRunTests(extensionTestsPath: string) {
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, "../../");
const crashDir = getEnvironmentVariableStrict("VSCODE_CRASH_DIR");
const logsDir = getEnvironmentVariableStrict("VSCODE_LOGS_DIR");
const useLegacyVscode =
getEnvironmentVariableStrict("VSCODE_VERSION") === "legacy";
// NB: We include the exact version here instead of in `test.yml` so that
// we don't have to update the branch protection rules every time we bump
// the legacy VSCode version.
const vscodeVersion = env.VSCODE_VERSION === "legacy" ? "1.66.0" : "stable";
const vscodeVersion = useLegacyVscode ? "1.66.0" : "stable";
const vscodeExecutablePath = await downloadAndUnzipVSCode(vscodeVersion);
const [cli, ...args] =
resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath);
@ -49,9 +53,22 @@ export async function launchVscodeAndRunTests(extensionTestsPath: string) {
vscodeExecutablePath,
extensionDevelopmentPath,
extensionTestsPath,
// Note: Crash dump causes legacy VSCode to hang, so we just don't bother
launchArgs: useLegacyVscode
? undefined
: [`--crash-reporter-directory=${crashDir}`, `--logsPath=${logsDir}`],
});
} catch (err) {
console.error("Failed to run tests");
console.error("Test run threw exception:");
console.error(err);
process.exit(1);
}
}
function getEnvironmentVariableStrict(name: string): string {
const value = process.env[name];
if (value == null) {
throw new Error(`Missing environment variable ${name}`);
}
return value;
}