(context: vscode.ExtensionContext)
| 9 | import CommandRunner from "./core/commandRunner/CommandRunner"; |
| 10 | |
| 11 | export async function activate(context: vscode.ExtensionContext) { |
| 12 | const { getNodeAtLocation } = await getParseTreeApi(); |
| 13 | const commandServerApi = await getCommandServerApi(); |
| 14 | |
| 15 | const graph = makeGraph({ |
| 16 | ...graphFactories, |
| 17 | extensionContext: () => context, |
| 18 | commandServerApi: () => commandServerApi, |
| 19 | getNodeAtLocation: () => getNodeAtLocation, |
| 20 | } as FactoryMap<Graph>); |
| 21 | graph.debug.init(); |
| 22 | graph.snippets.init(); |
| 23 | await graph.decorations.init(); |
| 24 | graph.hatTokenMap.init(); |
| 25 | |
| 26 | const thatMark = new ThatMark(); |
| 27 | const sourceMark = new ThatMark(); |
| 28 | const testCaseRecorder = new TestCaseRecorder(context); |
| 29 | |
| 30 | const cursorlessRecordTestCaseDisposable = vscode.commands.registerCommand( |
| 31 | "cursorless.recordTestCase", |
| 32 | async (isHatTokenMapTest: boolean = false) => { |
| 33 | if (testCaseRecorder.active) { |
| 34 | vscode.window.showInformationMessage("Stopped recording test cases"); |
| 35 | testCaseRecorder.stop(); |
| 36 | } else { |
| 37 | if (await testCaseRecorder.start(isHatTokenMapTest)) { |
| 38 | vscode.window.showInformationMessage( |
| 39 | `Recording test cases for following commands in:\n${testCaseRecorder.fixtureSubdirectory}` |
| 40 | ); |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | ); |
| 45 | |
| 46 | // TODO: Do this using the graph once we migrate its dependencies onto the graph |
| 47 | const commandRunner = new CommandRunner( |
| 48 | graph, |
| 49 | thatMark, |
| 50 | sourceMark, |
| 51 | testCaseRecorder |
| 52 | ); |
| 53 | |
| 54 | // Disabled for now. |
| 55 | // See https://github.com/pokey/cursorless-vscode/issues/320 |
| 56 | // vscode.workspace.onDidChangeTextDocument(checkForEditsOutsideViewport) |
| 57 | function checkForEditsOutsideViewport(event: vscode.TextDocumentChangeEvent) { |
| 58 | // TODO: Only activate this code during the course of a cursorless action |
| 59 | // Can register pre/post command hooks the way we do with test case recorder |
| 60 | // TODO: Move this thing to a graph component |
| 61 | // TODO: Need to move command executor and test case recorder to graph |
| 62 | // component while we're doing this stuff so it's easier to register the |
| 63 | // hooks |
| 64 | // TODO: Should run this code even if document is not in a visible editor |
| 65 | // as long as we are during the course of a cursorless command. |
| 66 | const editor = vscode.window.activeTextEditor; |
| 67 | |
| 68 | if ( |
nothing calls this directly
no test coverage detected