Skip to content

Setup #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jun 8, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
initialize webview
  • Loading branch information
ShMcK committed Jun 2, 2019
commit 563874f696d94aca511b8f643822a48b6830bb86
6 changes: 6 additions & 0 deletions src/editor/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as vscode from 'vscode'
import start from './start'
import ReactPanel from '../views/createWebview'

// import runTest from './runTest'
// import loadSolution from './loadSolution'
@@ -8,6 +9,7 @@ import start from './start'
const COMMANDS = {
// TUTORIAL_SETUP: 'coderoad.tutorial_setup',
START: 'coderoad.start',
OPEN_WEBVIEW: 'coderoad.open_webview'
// RUN_TEST: 'coderoad.test_run',
// LOAD_SOLUTION: 'coderoad.solution_load',
// QUIT: 'coderoad.quit',
@@ -19,6 +21,10 @@ export default (context: vscode.ExtensionContext): void => {
[COMMANDS.START]: async function startCommand(): Promise<void> {
return start(context)
},
[COMMANDS.OPEN_WEBVIEW]: () => {
console.log('webview createOrShow')
ReactPanel.createOrShow(context.extensionPath);
}
// [COMMANDS.RUN_TEST]: runTest,
// [COMMANDS.LOAD_SOLUTION]: loadSolution,
// [COMMANDS.QUIT]: () => quit(context.subscriptions),
8 changes: 4 additions & 4 deletions src/editor/views/createWebview.ts
Original file line number Diff line number Diff line change
@@ -21,10 +21,10 @@ class ReactPanel {
public static async createOrShow(extensionPath: string): Promise<void> {
const hasActiveEditor = vscode.window.activeTextEditor

if (!hasActiveEditor) {
throw new Error('Should have an open file on launch')
}
const column = vscode.ViewColumn.Two
// if (!hasActiveEditor) {
// throw new Error('Should have an open file on launch')
// }
const column = vscode.ViewColumn.One

// If we already have a panel, show it.
// Otherwise, create a new panel.
8 changes: 5 additions & 3 deletions src/state/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { assign } from 'xstate'
import * as CR from 'typings'
import * as storage from '../../services/storage'
import * as git from '../../services/git'
import * as vscode from 'vscode'

let initialTutorial: CR.Tutorial | undefined
let initialProgress: CR.Progress = {
@@ -46,5 +45,8 @@ export default {
return position
}
}),

createWebview() {
console.log('execute coderoad.open_webview')
vscode.commands.executeCommand('coderoad.open_webview')
}
}
1 change: 1 addition & 0 deletions src/state/machine.ts
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ export const machine = Machine<
},
},
NewTutorial: {
onEntry: ['createWebview'],
initial: 'SelectTutorial',
states: {
SelectTutorial: {