@@ -2,6 +2,7 @@ import * as G from 'typings/graphql'
22import * as vscode from 'vscode'
33import * as git from '../services/git'
44import languageMap from '../editor/languageMap'
5+ import { COMMANDS } from '../editor/commands'
56
67interface TutorialConfigParams {
78 config : G . TutorialConfig ,
@@ -19,15 +20,17 @@ const tutorialConfig = async ({config, alreadyConfigured, }: TutorialConfigParam
1920 await git . setupRemote ( config . repo . uri )
2021 }
2122
22- vscode . commands . executeCommand ( 'coderoad.config_test_runner' , config . testRunner )
23+ vscode . commands . executeCommand ( COMMANDS . CONFIG_TEST_RUNNER , config . testRunner )
2324
2425 const fileFormats = config . testRunner . fileFormats
2526
2627 // verify if file test should run based on document saved
27- const shouldRun = ( document : vscode . TextDocument ) : boolean => {
28+ const shouldRunTest = ( document : vscode . TextDocument ) : boolean => {
29+ // must be a file
2830 if ( document . uri . scheme !== 'file' ) {
2931 return false
3032 }
33+ // must configure with file formatss
3134 if ( fileFormats && fileFormats . length ) {
3235 const fileFormat : G . FileFormat = languageMap [ document . languageId ]
3336 if ( ! fileFormats . includes ( fileFormat ) ) {
@@ -39,7 +42,7 @@ const tutorialConfig = async ({config, alreadyConfigured, }: TutorialConfigParam
3942
4043 // setup onSave hook
4144 vscode . workspace . onDidSaveTextDocument ( ( document : vscode . TextDocument ) => {
42- if ( shouldRun ( document ) ) {
45+ if ( shouldRunTest ( document ) ) {
4346 vscode . commands . executeCommand ( 'coderoad.run_test' )
4447 }
4548 } )
0 commit comments