Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Migrate to xstate as app skeleton#2

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 11 commits intoxstatefromfeature/treeview
Jun 2, 2019
Merged
Show file tree
Hide file tree
Changes from1 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
PrevPrevious commit
NextNext commit
setup xstate machine as core
  • Loading branch information
@ShMcK
ShMcK committedJun 2, 2019
commit32edbcf7e6f6bc62c14b76fc465f6b24451154d6
6 changes: 6 additions & 0 deletionsTODO.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
# Todos
- add to scripts when url fixed

```
"postinstall": "node ./node_modules/vscode/bin/install",
```
5 changes: 5 additions & 0 deletionspackage-lock.json
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

49 changes: 4 additions & 45 deletionspackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,56 +16,12 @@
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "coderoad.tutorial_setup",
"title": "Tutorial Setup",
"category": "CodeRoad"
},
{
"command": "coderoad.tutorial_load",
"title": "Load Tutorial",
"category": "CodeRoad"
},
{
"command": "coderoad.test_run",
"title": "Run Test",
"category": "CodeRoad"
},
{
"command": "coderoad.solution_load",
"title": "Load Solution",
"category": "CodeRoad"
}
],
"viewsContainers": {
"activitybar": [
{
"id": "coderoad-tutorial",
"title": "CodeRoad Tutorial",
"icon": "resources/icons/icon.svg"
}
]
},
"views": {
"coderoad-tutorial": [
{
"id": "progress",
"name": "Progress"
},
{
"id": "explanation",
"name": "Explanation"
},
{
"id": "instructions",
"name": "Instructions"
},
{
"id": "hints",
"name": "Hints"
}
]
}
]
},
"scripts": {
"vscode:prepublish": "npm run compile",
Expand All@@ -82,5 +38,8 @@
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.3.1",
"vscode": "^1.1.28"
},
"dependencies": {
"xstate": "^4.6.0"
}
}
14 changes: 7 additions & 7 deletionssrc/commands/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
import * as vscode from 'vscode'

import runTest from './runTest'
//import runTest from './runTest'
import tutorialLoad from './tutorialLoad'
import loadSolution from './loadSolution'
//import loadSolution from './loadSolution'
// import quit from './quit'

const COMMANDS = {
TUTORIAL_SETUP: 'coderoad.tutorial_setup',
//TUTORIAL_SETUP: 'coderoad.tutorial_setup',
TUTORIAL_LOAD: 'coderoad.tutorial_load',
RUN_TEST: 'coderoad.test_run',
LOAD_SOLUTION: 'coderoad.solution_load',
//RUN_TEST: 'coderoad.test_run',
//LOAD_SOLUTION: 'coderoad.solution_load',
// QUIT: 'coderoad.quit',
}

Expand All@@ -18,8 +18,8 @@ export default (context: vscode.ExtensionContext): void => {
[COMMANDS.TUTORIAL_LOAD](): void {
tutorialLoad(context)
},
[COMMANDS.RUN_TEST]: runTest,
[COMMANDS.LOAD_SOLUTION]: loadSolution,
//[COMMANDS.RUN_TEST]: runTest,
//[COMMANDS.LOAD_SOLUTION]: loadSolution,
// [COMMANDS.QUIT]: () => quit(context.subscriptions),
}

Expand Down
125 changes: 64 additions & 61 deletionssrc/commands/tutorialLoad.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,69 +62,72 @@ async function validateCanContinue(): Promise<boolean> {
}

export default async function tutorialLoad(context: vscode.ExtensionContext): Promise<void> {
console.log(`tutorialLoad ${JSON.stringify(context)}`)

// setup connection to workspace
await rootSetup(context)

const modes = ['New']

const canContinue = await validateCanContinue()
if (canContinue) {
modes.push('Continue')
}

const selectedMode: string | undefined = await vscode.window.showQuickPick(modes)

if (!selectedMode) {
throw new Error('No mode selected')
return
}

interface TutorialQuickPickItem extends vscode.QuickPickItem {
id: string
}

// load tutorial summaries
const tutorialsData: { [id: string]: CR.TutorialSummary } = await fetch({
resource: 'getTutorialsSummary',
})
const selectableTutorials: TutorialQuickPickItem[] = Object.keys(tutorialsData).map(id => {
const tutorial = tutorialsData[id]
return {
label: tutorial.title,
description: tutorial.description,
// detail: '', // optional additional info
id,
}
})
const selectedTutorial: TutorialQuickPickItem | undefined = await vscode.window.showQuickPick(selectableTutorials)

if (!selectedTutorial) {
throw new Error('No tutorial selected')
}

// load specific tutorial
const tutorial: CR.Tutorial | undefined = await fetch({
resource: 'getTutorial',
params: { id: selectedTutorial.id },
})

if (!tutorial) {
throw new Error('No tutorial found')
}

switch (selectedMode) {
// new tutorial
case modes[0]:
await newTutorial(tutorial)
break
// continue
case modes[1]:
await continueTutorial()
break
}

// setup hook to run tests on save
onSaveHook(tutorial.meta.languages)
return;

// const modes = ['New']

// const canContinue = await validateCanContinue()
// if (canContinue) {
// modes.push('Continue')
// }

// const selectedMode: string | undefined = await vscode.window.showQuickPick(modes)

// if (!selectedMode) {
// throw new Error('No mode selected')
// return
// }

// interface TutorialQuickPickItem extends vscode.QuickPickItem {
// id: string
// }

// // load tutorial summaries
// const tutorialsData: { [id: string]: CR.TutorialSummary } = await fetch({
// resource: 'getTutorialsSummary',
// })
// const selectableTutorials: TutorialQuickPickItem[] = Object.keys(tutorialsData).map(id => {
// const tutorial = tutorialsData[id]
// return {
// label: tutorial.title,
// description: tutorial.description,
// // detail: '', // optional additional info
// id,
// }
// })
// const selectedTutorial: TutorialQuickPickItem | undefined = await vscode.window.showQuickPick(selectableTutorials)

// if (!selectedTutorial) {
// throw new Error('No tutorial selected')
// }

// // load specific tutorial
// const tutorial: CR.Tutorial | undefined = await fetch({
// resource: 'getTutorial',
// params: { id: selectedTutorial.id },
// })

// if (!tutorial) {
// throw new Error('No tutorial found')
// }

// switch (selectedMode) {
// // new tutorial
// case modes[0]:
// await newTutorial(tutorial)
// break
// // continue
// case modes[1]:
// await continueTutorial()
// break
// }

// // setup hook to run tests on save
// onSaveHook(tutorial.meta.languages)

// TODO: start
}
1 change: 1 addition & 0 deletionssrc/state/actions/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
export default {}
20 changes: 20 additions & 0 deletionssrc/state/context/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
import basicTutorialData from './tutorials/basic'
import * as CR from 'typings'

const tutorialContext: CR.MachineContext = {
position: {
levelId: '',
stageId: '',
stepId: '',
},
progress: {
levels: {},
stages: {},
steps: {},
complete: false,
},
// TODO: load tutorial instead of preloading demo
data: basicTutorialData.data,
}

export default tutorialContext
File renamed without changes.
1 change: 1 addition & 0 deletionssrc/state/guards/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
export default {}
Loading

[8]ページ先頭

©2009-2025 Movatter.jp