11import * as T from 'typings'
22import * as TT from 'typings/tutorial'
3- import * as E from 'typings/error'
43import * as vscode from 'vscode'
54import { setupActions , solutionActions } from './actions/setupActions'
65import { COMMANDS } from './commands'
76import Context from './services/context/context'
87import logger from './services/logger'
9- import { version } from './services/dependencies'
10- import { openWorkspace , checkWorkspaceEmpty } from './services/workspace'
8+ import { openWorkspace } from './services/workspace'
119import { showOutput } from './services/testRunner/output'
1210import { exec } from './services/node'
1311import reset from './services/reset'
@@ -48,7 +46,6 @@ class Channel implements Channel {
4846case 'EDITOR_STARTUP' :
4947actions . onStartup ( this . context , this . workspaceState , this . send )
5048return
51-
5249// clear tutorial local storage
5350case 'TUTORIAL_CLEAR' :
5451// clear current progress/position/tutorial
@@ -62,52 +59,7 @@ class Channel implements Channel {
6259actions . onTutorialContinueConfig ( action , this . context , this . send )
6360return
6461case 'EDITOR_VALIDATE_SETUP' :
65- try {
66- // check workspace is selected
67- const isEmptyWorkspace = await checkWorkspaceEmpty ( )
68- if ( ! isEmptyWorkspace ) {
69- const error :E . ErrorMessage = {
70- type :'WorkspaceNotEmpty' ,
71- message :'' ,
72- actions :[
73- {
74- label :'Open Workspace' ,
75- transition :'REQUEST_WORKSPACE' ,
76- } ,
77- {
78- label :'Check Again' ,
79- transition :'RETRY' ,
80- } ,
81- ] ,
82- }
83- this . send ( { type :'VALIDATE_SETUP_FAILED' , payload :{ error} } )
84- return
85- }
86- // check Git is installed.
87- // Should wait for workspace before running otherwise requires access to root folder
88- const isGitInstalled = await version ( 'git' )
89- if ( ! isGitInstalled ) {
90- const error :E . ErrorMessage = {
91- type :'GitNotFound' ,
92- message :'' ,
93- actions :[
94- {
95- label :'Check Again' ,
96- transition :'RETRY' ,
97- } ,
98- ] ,
99- }
100- this . send ( { type :'VALIDATE_SETUP_FAILED' , payload :{ error} } )
101- return
102- }
103- this . send ( { type :'SETUP_VALIDATED' } )
104- } catch ( e ) {
105- const error = {
106- type :'UknownError' ,
107- message :e . message ,
108- }
109- this . send ( { type :'VALIDATE_SETUP_FAILED' , payload :{ error} } )
110- }
62+ actions . onValidateSetup ( this . send )
11163return
11264case 'EDITOR_REQUEST_WORKSPACE' :
11365openWorkspace ( )