@@ -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 = {
1514 complete : false ,
1615}
1716
18- export default {
17+ export default ( dispatch : CR . EditorDispatch ) => ( {
1918 createWebview ( ) {
2019 console . log ( 'execute coderoad.open_webview' )
21- vscode . commands . executeCommand ( 'coderoad.open_webview' )
20+ dispatch ( 'coderoad.open_webview' )
2221 } ,
2322 async newOrContinue ( ) {
2423 // verify that the user has a tutorial & progress
@@ -45,11 +44,11 @@ export default {
4544 currentTutorial = tutorial
4645 console . log ( 'api' )
4746 console . log ( tutorial )
48- vscode . commands . executeCommand ( 'coderoad.tutorial_launch' , tutorial )
47+ dispatch ( 'coderoad.tutorial_launch' , tutorial )
4948 } ,
5049 tutorialSetup ( ) {
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 } ,
5453 initializeNewTutorial : assign ( {
5554 position : ( context : any ) : CR . Position => {
@@ -104,13 +103,13 @@ export default {
104103 }
105104 } ) ,
106105 testStart ( ) {
107- vscode . commands . executeCommand ( 'coderoad.run_test' )
106+ dispatch ( 'coderoad.run_test' )
108107 } ,
109108 testPass ( ) {
110- vscode . window . showInformationMessage ( 'PASS ')
109+ dispatch ( 'coderoad.test_pass ')
111110 } ,
112111 testFail ( ) {
113- vscode . window . showWarningMessage ( 'FAIL ')
112+ dispatch ( 'coderoad.test_fail ')
114113 } ,
115114 // @ts -ignore
116115 progressUpdate : assign ( {
@@ -166,6 +165,6 @@ export default {
166165 stepLoadCommits ( context : CR . MachineContext ) : void {
167166 const { data, position } = context
168167 const { setup } = data . steps [ position . stepId ] . actions
169- git . gitLoadCommits ( setup )
168+ git . gitLoadCommits ( setup , dispatch )
170169 }
171- }
170+ } )
0 commit comments