1
1
import * as T from 'typings'
2
2
import * as TT from 'typings/tutorial'
3
- import * as E from 'typings/error'
4
3
import * as vscode from 'vscode'
5
4
import { setupActions , solutionActions } from './actions/setupActions'
6
5
import { COMMANDS } from './commands'
7
6
import Context from './services/context/context'
8
7
import logger from './services/logger'
9
- import { version } from './services/dependencies'
10
- import { openWorkspace , checkWorkspaceEmpty } from './services/workspace'
8
+ import { openWorkspace } from './services/workspace'
11
9
import { showOutput } from './services/testRunner/output'
12
10
import { exec } from './services/node'
13
11
import reset from './services/reset'
@@ -48,7 +46,6 @@ class Channel implements Channel {
48
46
case 'EDITOR_STARTUP' :
49
47
actions . onStartup ( this . context , this . workspaceState , this . send )
50
48
return
51
-
52
49
// clear tutorial local storage
53
50
case 'TUTORIAL_CLEAR' :
54
51
// clear current progress/position/tutorial
@@ -62,52 +59,7 @@ class Channel implements Channel {
62
59
actions . onTutorialContinueConfig ( action , this . context , this . send )
63
60
return
64
61
case '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 )
111
63
return
112
64
case 'EDITOR_REQUEST_WORKSPACE' :
113
65
openWorkspace ( )