Skip to content

Commit

Permalink
initial way to populate a window even if not really the right way
Browse files Browse the repository at this point in the history
  • Loading branch information
Cedric Halbronn committed Dec 13, 2023
1 parent 016e4d8 commit f761306
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cursorless-talon/src/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def process_action(argument: str):


def process_scope_type(argument: str):
# TODO not sure what we are trying to achieve here
_, spoken_form = lookup_scope_type(argument)
return f'<*"{spoken_form}"/>'

Expand All @@ -37,6 +38,7 @@ def process_cursorless_command_step(argument: str):
{
"version": 0,
"stepFixture": step_fixture,
"yamlFilename": argument,
},
)
print(f"{result=}")
Expand Down
1 change: 1 addition & 0 deletions packages/cursorless-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"license": "MIT",
"dependencies": {
"@cursorless/common": "workspace:*",
"@cursorless/vscode-common": "workspace:*",
"immer": "^9.0.15",
"immutability-helper": "^3.1.1",
"itertools": "^2.1.1",
Expand Down
32 changes: 31 additions & 1 deletion packages/cursorless-engine/src/core/Tutorial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,23 @@
// import produce from "immer";
// import { sortBy } from "lodash";
// import { ide } from "../singletons/ide.singleton";
// import path from "path";
import path from "path";
// import { getCursorlessRepoRoot } from "@cursorless/common";

// TODO the engine is editor agnostic so we shouldn't really import that
// TODO Editor specific features are accessed via the injected ide instance.
// TODO packages\cursorless-engine\src\singletons\ide.singleton.ts
import { openNewEditor } from "@cursorless/vscode-common";

Check failure on line 12 in packages/cursorless-engine/src/core/Tutorial.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, stable)

Cannot find module '@cursorless/vscode-common' or its corresponding type declarations.

Check failure on line 12 in packages/cursorless-engine/src/core/Tutorial.ts

View workflow job for this annotation

GitHub Actions / test-docs-build

Cannot find module '@cursorless/vscode-common' or its corresponding type declarations.

Check failure on line 12 in packages/cursorless-engine/src/core/Tutorial.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, stable)

Cannot find module '@cursorless/vscode-common' or its corresponding type declarations.

Check failure on line 12 in packages/cursorless-engine/src/core/Tutorial.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, stable)

Cannot find module '@cursorless/vscode-common' or its corresponding type declarations.

Check failure on line 12 in packages/cursorless-engine/src/core/Tutorial.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, legacy)

Cannot find module '@cursorless/vscode-common' or its corresponding type declarations.

import * as yaml from "js-yaml";
import { promises as fsp } from "node:fs";

import { TestCaseFixture } from "@cursorless/common";
import { Dictionary } from "lodash";

const tutorial_dir =
"C:\\work\\tools\\voicecoding\\cursorless_fork\\packages\\cursorless-vscode-e2e\\src\\suite\\fixtures\\recorded\\tutorial\\unit-2-basic-coding";

/**
* The argument expected by the tutorial command.
*/
Expand All @@ -21,15 +33,33 @@ interface TutorialCommandArg {
* A representation of the yaml file
*/
stepFixture: Dictionary<string>;

/**
* The yaml file for the current step
*/
yamlFilename: string;
}

export async function tutorialCreate({
version,
stepFixture,
yamlFilename,
}: TutorialCommandArg) {
if (version !== 0) {
throw new Error(`Unsupported tutorial api version: ${version}`);
}

// const fixture = stepFixture as TestCaseFixture;
createEnvironment(yamlFilename);
// TODO need to answer to the talon side only what is necessary
return stepFixture;
}

async function createEnvironment(yamlFilename: string) {
const buffer = await fsp.readFile(path.join(tutorial_dir, yamlFilename));
const fixture = yaml.load(buffer.toString()) as TestCaseFixture;

const editor = await openNewEditor(fixture.initialState.documentContents, {
languageId: fixture.languageId,
});
}
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f761306

Please sign in to comment.