File tree Expand file tree Collapse file tree 4 files changed +16
-7
lines changed Expand file tree Collapse file tree 4 files changed +16
-7
lines changed Original file line number Diff line number Diff line change 11import * as vscode from 'vscode'
22import start from './start'
3+ import ReactPanel from '../views/createWebview'
34
45// import runTest from './runTest'
56// import loadSolution from './loadSolution'
@@ -8,6 +9,7 @@ import start from './start'
89const COMMANDS = {
910 // TUTORIAL_SETUP: 'coderoad.tutorial_setup',
1011 START : 'coderoad.start' ,
12+ OPEN_WEBVIEW : 'coderoad.open_webview'
1113 // RUN_TEST: 'coderoad.test_run',
1214 // LOAD_SOLUTION: 'coderoad.solution_load',
1315 // QUIT: 'coderoad.quit',
@@ -19,6 +21,10 @@ export default (context: vscode.ExtensionContext): void => {
1921 [ COMMANDS . START ] : async function startCommand ( ) : Promise < void > {
2022 return start ( context )
2123 } ,
24+ [ COMMANDS . OPEN_WEBVIEW ] : ( ) => {
25+ console . log ( 'webview createOrShow' )
26+ ReactPanel . createOrShow ( context . extensionPath ) ;
27+ }
2228 // [COMMANDS.RUN_TEST]: runTest,
2329 // [COMMANDS.LOAD_SOLUTION]: loadSolution,
2430 // [COMMANDS.QUIT]: () => quit(context.subscriptions),
Original file line number Diff line number Diff line change @@ -21,10 +21,10 @@ class ReactPanel {
2121 public static async createOrShow ( extensionPath : string ) : Promise < void > {
2222 const hasActiveEditor = vscode . window . activeTextEditor
2323
24- if ( ! hasActiveEditor ) {
25- throw new Error ( 'Should have an open file on launch' )
26- }
27- const column = vscode . ViewColumn . Two
24+ // if (!hasActiveEditor) {
25+ // throw new Error('Should have an open file on launch')
26+ // }
27+ const column = vscode . ViewColumn . One
2828
2929 // If we already have a panel, show it.
3030 // Otherwise, create a new panel.
Original file line number Diff line number Diff line change 11import { assign } from 'xstate'
22import * as CR from 'typings'
3- import * as storage from '../../services/storage'
4- import * as git from '../../services/git'
3+ import * as vscode from 'vscode'
54
65let initialTutorial : CR . Tutorial | undefined
76let initialProgress : CR . Progress = {
@@ -46,5 +45,8 @@ export default {
4645 return position
4746 }
4847 } ) ,
49-
48+ createWebview ( ) {
49+ console . log ( 'execute coderoad.open_webview' )
50+ vscode . commands . executeCommand ( 'coderoad.open_webview' )
51+ }
5052}
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export const machine = Machine<
2525 } ,
2626 } ,
2727 NewTutorial : {
28+ onEntry : [ 'createWebview' ] ,
2829 initial : 'SelectTutorial' ,
2930 states : {
3031 SelectTutorial : {
You can’t perform that action at this time.
0 commit comments