@@ -3,7 +3,6 @@ import { assign } from 'xstate'
33import { machine } from '../../extension'
44import api from '../../services/api'
55import * as CR from 'typings'
6- import * as vscode from 'vscode'
76import * as storage from '../../services/storage'
87import * as git from '../../services/git'
98
@@ -15,10 +14,10 @@ let currentProgress: CR.Progress = {
1514complete :false ,
1615}
1716
18- export default {
17+ export default ( dispatch : CR . EditorDispatch ) => ( {
1918createWebview ( ) {
2019console . log ( 'execute coderoad.open_webview' )
21- vscode . commands . executeCommand ( 'coderoad.open_webview' )
20+ dispatch ( 'coderoad.open_webview' )
2221} ,
2322async newOrContinue ( ) {
2423// verify that the user has a tutorial & progress
@@ -45,11 +44,11 @@ export default {
4544currentTutorial = tutorial
4645console . log ( 'api' )
4746console . log ( tutorial )
48- vscode . commands . executeCommand ( 'coderoad.tutorial_launch' , tutorial )
47+ dispatch ( 'coderoad.tutorial_launch' , tutorial )
4948} ,
5049tutorialSetup ( ) {
51- vscode . commands . executeCommand ( 'coderoad.tutorial_setup' , currentTutorial )
52- vscode . commands . executeCommand ( 'coderoad.open_webview' , vscode . ViewColumn . Two )
50+ dispatch ( 'coderoad.tutorial_setup' , currentTutorial )
51+ dispatch ( 'coderoad.open_webview' , 2 )
5352} ,
5453initializeNewTutorial :assign ( {
5554position :( context :any ) :CR . Position => {
@@ -104,13 +103,13 @@ export default {
104103}
105104} ) ,
106105testStart ( ) {
107- vscode . commands . executeCommand ( 'coderoad.run_test' )
106+ dispatch ( 'coderoad.run_test' )
108107} ,
109108testPass ( ) {
110- vscode . window . showInformationMessage ( 'PASS ')
109+ dispatch ( 'coderoad.test_pass ')
111110} ,
112111testFail ( ) {
113- vscode . window . showWarningMessage ( 'FAIL ')
112+ dispatch ( 'coderoad.test_fail ')
114113} ,
115114//@ts -ignore
116115progressUpdate :assign ( {
@@ -166,6 +165,6 @@ export default {
166165stepLoadCommits ( context :CR . MachineContext ) :void {
167166const { data, position} = context
168167const { setup} = data . steps [ position . stepId ] . actions
169- git . gitLoadCommits ( setup )
168+ git . gitLoadCommits ( setup , dispatch )
170169}
171- }
170+ } )