@@ -2,6 +2,7 @@ import * as T from 'typings'
22import * as TT from 'typings/tutorial'
33import * as E from 'typings/error'
44import * as vscode from 'vscode'
5+ import fetch from 'node-fetch'
56import { satisfies } from 'semver'
67import saveCommit from '../actions/saveCommit'
78import { setupActions , solutionActions } from '../actions/setupActions'
@@ -15,7 +16,7 @@ import { readFile } from 'fs'
1516import { join } from 'path'
1617import { promisify } from 'util'
1718import { showOutput } from '../services/testRunner/output'
18- import { WORKSPACE_ROOT } from '../environment'
19+ import { WORKSPACE_ROOT , TUTORIAL_URL } from '../environment'
1920
2021const readFileAsync = promisify ( readFile )
2122
@@ -52,8 +53,8 @@ class Channel implements Channel {
5253 case 'EDITOR_STARTUP' :
5354 try {
5455 // check if a workspace is open, otherwise nothing works
55- const noActiveWorksapce = ! WORKSPACE_ROOT . length
56- if ( noActiveWorksapce ) {
56+ const noActiveWorkspace = ! WORKSPACE_ROOT . length
57+ if ( noActiveWorkspace ) {
5758 const error : E . ErrorMessage = {
5859 type : 'NoWorkspaceFound' ,
5960 message : '' ,
@@ -73,6 +74,18 @@ class Channel implements Channel {
7374 sessionId : vscode . env . sessionId ,
7475 }
7576
77+ // load tutorial from url
78+ if ( TUTORIAL_URL ) {
79+ try {
80+ const tutorialRes = await fetch ( TUTORIAL_URL )
81+ const tutorial = await tutorialRes . json ( )
82+ this . send ( { type : 'START_TUTORIAL_FROM_URL' , payload : { tutorial } } )
83+ return
84+ } catch ( e ) {
85+ console . log ( `Failed to load tutorial from url ${ TUTORIAL_URL } with error "${ e . message } "` )
86+ }
87+ }
88+
7689 // continue from tutorial from local storage
7790 const tutorial : TT . Tutorial | null = this . context . tutorial . get ( )
7891
0 commit comments