@@ -8,6 +8,7 @@ import tutorialConfig from '../actions/tutorialConfig'
88import { COMMANDS } from '../editor/commands'
99import logger from '../services/logger'
1010import Context from './context'
11+ import { version as gitVersion } from '../services/git'
1112import { openWorkspace , checkWorkspaceEmpty } from '../services/workspace'
1213
1314interface Channel {
@@ -106,13 +107,21 @@ class Channel implements Channel {
106107 // update the current stepId on startup
107108 vscode . commands . executeCommand ( COMMANDS . SET_CURRENT_STEP , action . payload )
108109 return
109- case 'EDITOR_CHECK_WORKSPACE' :
110+ case 'EDITOR_VALIDATE_SETUP' :
111+ // 1. check workspace is selected
110112 const isEmptyWorkspace = await checkWorkspaceEmpty ( this . workspaceRoot . uri . path )
111- if ( isEmptyWorkspace ) {
112- this . send ( { type : 'IS_EMPTY_WORKSPACE' } )
113- } else {
113+ if ( ! isEmptyWorkspace ) {
114114 this . send ( { type : 'NOT_EMPTY_WORKSPACE' } )
115+ return
116+ }
117+ // 2. check Git is installed.
118+ // Should wait for workspace before running otherwise requires access to root folder
119+ const isGitInstalled = await gitVersion ( )
120+ if ( ! isGitInstalled ) {
121+ this . send ( { type : 'GIT_NOT_INSTALLED' } )
122+ return
115123 }
124+ this . send ( { type : 'SETUP_VALIDATED' } )
116125 return
117126 case 'EDITOR_REQUEST_WORKSPACE' :
118127 console . log ( 'request workspace' )
0 commit comments