Skip to content

Commit e098b6f

Browse files
Cleanup
1 parent 8d769ee commit e098b6f

File tree

6 files changed

+84
-100
lines changed

6 files changed

+84
-100
lines changed

packages/cursorless-engine/src/cursorlessEngine.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export async function createCursorlessEngine({
6262
talonSpokenForms = new DisabledTalonSpokenForms(),
6363
snippets = new DisabledSnippets(),
6464
}: EngineProps): Promise<CursorlessEngine> {
65-
console.log("createCursorlessEngine");
6665
injectIde(ide);
6766

6867
const debug = new Debug(ide);

packages/cursorless-engine/src/disabledComponents/DisabledTalonSpokenForms.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66

77
export class DisabledTalonSpokenForms implements TalonSpokenForms {
88
getSpokenFormEntries(): Promise<SpokenFormEntry[]> {
9-
console.log("getSpokenFormEntries() throw DisabledCustomSpokenFormsError");
109
throw new DisabledCustomSpokenFormsError();
1110
}
1211

packages/cursorless-engine/src/generateSpokenForm/CustomSpokenFormGeneratorImpl.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export class CustomSpokenFormGeneratorImpl
2828
public readonly customSpokenFormsInitialized: Promise<void>;
2929

3030
constructor(talonSpokenForms: TalonSpokenForms) {
31-
console.log("CustomSpokenFormGeneratorImpl constructor");
3231
this.customSpokenForms = new CustomSpokenForms(talonSpokenForms);
3332
this.customSpokenFormsInitialized =
3433
this.customSpokenForms.customSpokenFormsInitialized;
@@ -37,15 +36,11 @@ export class CustomSpokenFormGeneratorImpl
3736
);
3837
this.disposable = this.customSpokenForms.onDidChangeCustomSpokenForms(
3938
() => {
40-
console.log(
41-
"CustomSpokenFormGeneratorImpl.onDidChangeCustomSpokenForms",
42-
);
4339
this.spokenFormGenerator = new SpokenFormGenerator(
4440
this.customSpokenForms.spokenFormMap,
4541
);
4642
},
4743
);
48-
console.log("CustomSpokenFormGeneratorImpl constructor done");
4944
}
5045

5146
onDidChangeCustomSpokenForms(listener: Listener<[]>) {

packages/cursorless-engine/src/spokenForms/CustomSpokenForms.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,11 @@ export class CustomSpokenForms {
5858
}
5959

6060
constructor(private talonSpokenForms: TalonSpokenForms) {
61-
console.log("CustomSpokenForms constructor");
62-
6361
this.disposable = talonSpokenForms.onDidChange(() =>
6462
this.updateSpokenFormMaps(),
6563
);
6664

6765
this.customSpokenFormsInitialized = this.updateSpokenFormMaps();
68-
69-
console.log("CustomSpokenForms constructor done");
7066
}
7167

7268
/**
@@ -77,7 +73,6 @@ export class CustomSpokenForms {
7773
onDidChangeCustomSpokenForms = this.notifier.registerListener;
7874

7975
private async updateSpokenFormMaps(): Promise<void> {
80-
console.log("updateSpokenFormMaps()");
8176
let allCustomEntries: SpokenFormEntry[];
8277
try {
8378
allCustomEntries = await this.talonSpokenForms.getSpokenFormEntries();
@@ -89,7 +84,6 @@ export class CustomSpokenForms {
8984
// Handle case where spokenForms.json doesn't exist yet
9085
this.needsInitialTalonUpdate_ = true;
9186
} else if (err instanceof DisabledCustomSpokenFormsError) {
92-
console.log("catch DisabledCustomSpokenFormsError");
9387
// Do nothing: this ide doesn't currently support custom spoken forms
9488
} else {
9589
console.error("Error loading custom spoken forms", err);
@@ -104,8 +98,6 @@ export class CustomSpokenForms {
10498
this.spokenFormMap_ = { ...defaultSpokenFormMap };
10599
this.notifier.notifyListeners();
106100

107-
console.log("return early");
108-
109101
return;
110102
}
111103

packages/cursorless-everywhere-talon-core/src/extension.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export async function activate(
2121
try {
2222
return await activateHelper(talon, runMode);
2323
} catch (error) {
24-
console.log("Error activating talon.js");
2524
console.error(error);
2625
throw error;
2726
}
Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// import type { ActionDescriptor, CommandLatest } from "@cursorless/common";
1+
import type { ActionDescriptor, CommandLatest } from "@cursorless/common";
22
import { activate } from "@cursorless/cursorless-everywhere-talon-core";
33
import * as std from "std";
44
import talonMock from "./talonMock";
@@ -12,95 +12,95 @@ async function runTests() {
1212
console.log();
1313
console.log("Running quickjs tests");
1414

15-
// await test("testTake", testTake);
16-
// await test("testChuck", testChuck);
15+
await test("testTake", testTake);
16+
await test("testChuck", testChuck);
1717
} catch (_error) {
1818
hasFailed = true;
1919
}
2020

2121
std.exit(hasFailed ? 1 : 0);
2222
}
2323

24-
// async function testTake() {
25-
// const testHelpers = talonMock.getTestHelpers();
26-
// const initialText = "Hello, world!";
27-
28-
// testHelpers.setEditorState({
29-
// text: initialText,
30-
// selections: [{ anchor: 0, active: 0 }],
31-
// });
32-
33-
// await runAction({
34-
// name: "setSelection",
35-
// target: {
36-
// type: "primitive",
37-
// modifiers: [{ type: "containingScope", scopeType: { type: "token" } }],
38-
// },
39-
// });
40-
41-
// const { text, selections } = testHelpers.getFinalEditorState();
42-
43-
// assert.equal(text, initialText);
44-
// assert.equal(selections.length, 1);
45-
// assert.equal(selections[0].anchor, 0);
46-
// assert.equal(selections[0].active, 5);
47-
// }
48-
49-
// async function testChuck() {
50-
// const testHelpers = talonMock.getTestHelpers();
51-
52-
// testHelpers.setEditorState({
53-
// text: "Hello, world!",
54-
// selections: [{ anchor: 0, active: 0 }],
55-
// });
56-
57-
// await runAction({
58-
// name: "remove",
59-
// target: {
60-
// type: "primitive",
61-
// modifiers: [{ type: "containingScope", scopeType: { type: "token" } }],
62-
// },
63-
// });
64-
65-
// const { text, selections } = testHelpers.getFinalEditorState();
66-
67-
// assert.equal(text, ", world!");
68-
// assert.equal(selections.length, 1);
69-
// assert.equal(selections[0].anchor, 0);
70-
// assert.equal(selections[0].active, 0);
71-
// }
72-
73-
// function runAction(action: ActionDescriptor) {
74-
// const command: CommandLatest = {
75-
// version: 7,
76-
// usePrePhraseSnapshot: false,
77-
// action,
78-
// };
79-
// return talonMock
80-
// .getTestHelpers()
81-
// .contextActions.private_cursorless_talonjs_run_and_wait(
82-
// "cursorless.command",
83-
// command,
84-
// );
85-
// }
86-
87-
// const assert = {
88-
// equal: (actual: unknown, expected: unknown) => {
89-
// if (actual !== expected) {
90-
// throw new Error(`Actual '${actual}' Expected '${expected}'`);
91-
// }
92-
// },
93-
// };
94-
95-
// async function test(name: string, fn: () => Promise<void>) {
96-
// try {
97-
// await fn();
98-
// console.log(` * ${name}`);
99-
// } catch (error) {
100-
// console.error(` x ${name}`);
101-
// console.error(error);
102-
// hasFailed = true;
103-
// }
104-
// }
24+
async function testTake() {
25+
const testHelpers = talonMock.getTestHelpers();
26+
const initialText = "Hello, world!";
27+
28+
testHelpers.setEditorState({
29+
text: initialText,
30+
selections: [{ anchor: 0, active: 0 }],
31+
});
32+
33+
await runAction({
34+
name: "setSelection",
35+
target: {
36+
type: "primitive",
37+
modifiers: [{ type: "containingScope", scopeType: { type: "token" } }],
38+
},
39+
});
40+
41+
const { text, selections } = testHelpers.getFinalEditorState();
42+
43+
assert.equal(text, initialText);
44+
assert.equal(selections.length, 1);
45+
assert.equal(selections[0].anchor, 0);
46+
assert.equal(selections[0].active, 5);
47+
}
48+
49+
async function testChuck() {
50+
const testHelpers = talonMock.getTestHelpers();
51+
52+
testHelpers.setEditorState({
53+
text: "Hello, world!",
54+
selections: [{ anchor: 0, active: 0 }],
55+
});
56+
57+
await runAction({
58+
name: "remove",
59+
target: {
60+
type: "primitive",
61+
modifiers: [{ type: "containingScope", scopeType: { type: "token" } }],
62+
},
63+
});
64+
65+
const { text, selections } = testHelpers.getFinalEditorState();
66+
67+
assert.equal(text, ", world!");
68+
assert.equal(selections.length, 1);
69+
assert.equal(selections[0].anchor, 0);
70+
assert.equal(selections[0].active, 0);
71+
}
72+
73+
function runAction(action: ActionDescriptor) {
74+
const command: CommandLatest = {
75+
version: 7,
76+
usePrePhraseSnapshot: false,
77+
action,
78+
};
79+
return talonMock
80+
.getTestHelpers()
81+
.contextActions.private_cursorless_talonjs_run_and_wait(
82+
"cursorless.command",
83+
command,
84+
);
85+
}
86+
87+
const assert = {
88+
equal: (actual: unknown, expected: unknown) => {
89+
if (actual !== expected) {
90+
throw new Error(`Actual '${actual}' Expected '${expected}'`);
91+
}
92+
},
93+
};
94+
95+
async function test(name: string, fn: () => Promise<void>) {
96+
try {
97+
await fn();
98+
console.log(` * ${name}`);
99+
} catch (error) {
100+
console.error(` x ${name}`);
101+
console.error(error);
102+
hasFailed = true;
103+
}
104+
}
105105

106106
await runTests();

0 commit comments

Comments
 (0)