File tree 4 files changed +16
-7
lines changed
4 files changed +16
-7
lines changed Original file line number Diff line number Diff line change 1
1
import * as vscode from 'vscode'
2
2
import start from './start'
3
+ import ReactPanel from '../views/createWebview'
3
4
4
5
// import runTest from './runTest'
5
6
// import loadSolution from './loadSolution'
@@ -8,6 +9,7 @@ import start from './start'
8
9
const COMMANDS = {
9
10
// TUTORIAL_SETUP: 'coderoad.tutorial_setup',
10
11
START : 'coderoad.start' ,
12
+ OPEN_WEBVIEW : 'coderoad.open_webview'
11
13
// RUN_TEST: 'coderoad.test_run',
12
14
// LOAD_SOLUTION: 'coderoad.solution_load',
13
15
// QUIT: 'coderoad.quit',
@@ -19,6 +21,10 @@ export default (context: vscode.ExtensionContext): void => {
19
21
[ COMMANDS . START ] : async function startCommand ( ) : Promise < void > {
20
22
return start ( context )
21
23
} ,
24
+ [ COMMANDS . OPEN_WEBVIEW ] : ( ) => {
25
+ console . log ( 'webview createOrShow' )
26
+ ReactPanel . createOrShow ( context . extensionPath ) ;
27
+ }
22
28
// [COMMANDS.RUN_TEST]: runTest,
23
29
// [COMMANDS.LOAD_SOLUTION]: loadSolution,
24
30
// [COMMANDS.QUIT]: () => quit(context.subscriptions),
Original file line number Diff line number Diff line change @@ -21,10 +21,10 @@ class ReactPanel {
21
21
public static async createOrShow ( extensionPath : string ) : Promise < void > {
22
22
const hasActiveEditor = vscode . window . activeTextEditor
23
23
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
28
28
29
29
// If we already have a panel, show it.
30
30
// Otherwise, create a new panel.
Original file line number Diff line number Diff line change 1
1
import { assign } from 'xstate'
2
2
import * as CR from 'typings'
3
- import * as storage from '../../services/storage'
4
- import * as git from '../../services/git'
3
+ import * as vscode from 'vscode'
5
4
6
5
let initialTutorial : CR . Tutorial | undefined
7
6
let initialProgress : CR . Progress = {
@@ -46,5 +45,8 @@ export default {
46
45
return position
47
46
}
48
47
} ) ,
49
-
48
+ createWebview ( ) {
49
+ console . log ( 'execute coderoad.open_webview' )
50
+ vscode . commands . executeCommand ( 'coderoad.open_webview' )
51
+ }
50
52
}
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export const machine = Machine<
25
25
} ,
26
26
} ,
27
27
NewTutorial : {
28
+ onEntry : [ 'createWebview' ] ,
28
29
initial : 'SelectTutorial' ,
29
30
states : {
30
31
SelectTutorial : {
You can’t perform that action at this time.
0 commit comments