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

Commit32edbcf

Browse files
committed
setup xstate machine as core
1 parent820097a commit32edbcf

File tree

15 files changed

+318
-212
lines changed

15 files changed

+318
-212
lines changed

‎TODO.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Todos
2+
- add to scripts when url fixed
3+
4+
```
5+
"postinstall": "node ./node_modules/vscode/bin/install",
6+
```

‎package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,56 +16,12 @@
1616
"main":"./out/extension.js",
1717
"contributes": {
1818
"commands": [
19-
{
20-
"command":"coderoad.tutorial_setup",
21-
"title":"Tutorial Setup",
22-
"category":"CodeRoad"
23-
},
2419
{
2520
"command":"coderoad.tutorial_load",
2621
"title":"Load Tutorial",
2722
"category":"CodeRoad"
28-
},
29-
{
30-
"command":"coderoad.test_run",
31-
"title":"Run Test",
32-
"category":"CodeRoad"
33-
},
34-
{
35-
"command":"coderoad.solution_load",
36-
"title":"Load Solution",
37-
"category":"CodeRoad"
3823
}
39-
],
40-
"viewsContainers": {
41-
"activitybar": [
42-
{
43-
"id":"coderoad-tutorial",
44-
"title":"CodeRoad Tutorial",
45-
"icon":"resources/icons/icon.svg"
46-
}
47-
]
48-
},
49-
"views": {
50-
"coderoad-tutorial": [
51-
{
52-
"id":"progress",
53-
"name":"Progress"
54-
},
55-
{
56-
"id":"explanation",
57-
"name":"Explanation"
58-
},
59-
{
60-
"id":"instructions",
61-
"name":"Instructions"
62-
},
63-
{
64-
"id":"hints",
65-
"name":"Hints"
66-
}
67-
]
68-
}
24+
]
6925
},
7026
"scripts": {
7127
"vscode:prepublish":"npm run compile",
@@ -82,5 +38,8 @@
8238
"tslint-config-prettier":"^1.18.0",
8339
"typescript":"^3.3.1",
8440
"vscode":"^1.1.28"
41+
},
42+
"dependencies": {
43+
"xstate":"^4.6.0"
8544
}
8645
}

‎src/commands/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import*asvscodefrom'vscode'
22

3-
importrunTestfrom'./runTest'
3+
//import runTest from './runTest'
44
importtutorialLoadfrom'./tutorialLoad'
5-
importloadSolutionfrom'./loadSolution'
5+
//import loadSolution from './loadSolution'
66
// import quit from './quit'
77

88
constCOMMANDS={
9-
TUTORIAL_SETUP:'coderoad.tutorial_setup',
9+
//TUTORIAL_SETUP: 'coderoad.tutorial_setup',
1010
TUTORIAL_LOAD:'coderoad.tutorial_load',
11-
RUN_TEST:'coderoad.test_run',
12-
LOAD_SOLUTION:'coderoad.solution_load',
11+
//RUN_TEST: 'coderoad.test_run',
12+
//LOAD_SOLUTION: 'coderoad.solution_load',
1313
// QUIT: 'coderoad.quit',
1414
}
1515

@@ -18,8 +18,8 @@ export default (context: vscode.ExtensionContext): void => {
1818
[COMMANDS.TUTORIAL_LOAD]():void{
1919
tutorialLoad(context)
2020
},
21-
[COMMANDS.RUN_TEST]:runTest,
22-
[COMMANDS.LOAD_SOLUTION]:loadSolution,
21+
//[COMMANDS.RUN_TEST]: runTest,
22+
//[COMMANDS.LOAD_SOLUTION]: loadSolution,
2323
// [COMMANDS.QUIT]: () => quit(context.subscriptions),
2424
}
2525

‎src/commands/tutorialLoad.ts

Lines changed: 64 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -62,69 +62,72 @@ async function validateCanContinue(): Promise<boolean> {
6262
}
6363

6464
exportdefaultasyncfunctiontutorialLoad(context:vscode.ExtensionContext):Promise<void>{
65+
console.log(`tutorialLoad${JSON.stringify(context)}`)
66+
6567
// setup connection to workspace
6668
awaitrootSetup(context)
67-
68-
constmodes=['New']
69-
70-
constcanContinue=awaitvalidateCanContinue()
71-
if(canContinue){
72-
modes.push('Continue')
73-
}
74-
75-
constselectedMode:string|undefined=awaitvscode.window.showQuickPick(modes)
76-
77-
if(!selectedMode){
78-
thrownewError('No mode selected')
79-
return
80-
}
81-
82-
interfaceTutorialQuickPickItemextendsvscode.QuickPickItem{
83-
id:string
84-
}
85-
86-
// load tutorial summaries
87-
consttutorialsData:{[id:string]:CR.TutorialSummary}=awaitfetch({
88-
resource:'getTutorialsSummary',
89-
})
90-
constselectableTutorials:TutorialQuickPickItem[]=Object.keys(tutorialsData).map(id=>{
91-
consttutorial=tutorialsData[id]
92-
return{
93-
label:tutorial.title,
94-
description:tutorial.description,
95-
// detail: '', // optional additional info
96-
id,
97-
}
98-
})
99-
constselectedTutorial:TutorialQuickPickItem|undefined=awaitvscode.window.showQuickPick(selectableTutorials)
100-
101-
if(!selectedTutorial){
102-
thrownewError('No tutorial selected')
103-
}
104-
105-
// load specific tutorial
106-
consttutorial:CR.Tutorial|undefined=awaitfetch({
107-
resource:'getTutorial',
108-
params:{id:selectedTutorial.id},
109-
})
110-
111-
if(!tutorial){
112-
thrownewError('No tutorial found')
113-
}
114-
115-
switch(selectedMode){
116-
// new tutorial
117-
casemodes[0]:
118-
awaitnewTutorial(tutorial)
119-
break
120-
// continue
121-
casemodes[1]:
122-
awaitcontinueTutorial()
123-
break
124-
}
125-
126-
// setup hook to run tests on save
127-
onSaveHook(tutorial.meta.languages)
69+
return;
70+
71+
// const modes = ['New']
72+
73+
// const canContinue = await validateCanContinue()
74+
// if (canContinue) {
75+
// modes.push('Continue')
76+
// }
77+
78+
// const selectedMode: string | undefined = await vscode.window.showQuickPick(modes)
79+
80+
// if (!selectedMode) {
81+
// throw new Error('No mode selected')
82+
// return
83+
// }
84+
85+
// interface TutorialQuickPickItem extends vscode.QuickPickItem {
86+
// id: string
87+
// }
88+
89+
// // load tutorial summaries
90+
// const tutorialsData: { [id: string]: CR.TutorialSummary } = await fetch({
91+
// resource: 'getTutorialsSummary',
92+
// })
93+
// const selectableTutorials: TutorialQuickPickItem[] = Object.keys(tutorialsData).map(id => {
94+
// const tutorial = tutorialsData[id]
95+
// return {
96+
// label: tutorial.title,
97+
// description: tutorial.description,
98+
// // detail: '', // optional additional info
99+
// id,
100+
// }
101+
// })
102+
// const selectedTutorial: TutorialQuickPickItem | undefined = await vscode.window.showQuickPick(selectableTutorials)
103+
104+
// if (!selectedTutorial) {
105+
// throw new Error('No tutorial selected')
106+
// }
107+
108+
// // load specific tutorial
109+
// const tutorial: CR.Tutorial | undefined = await fetch({
110+
// resource: 'getTutorial',
111+
// params: { id: selectedTutorial.id },
112+
// })
113+
114+
// if (!tutorial) {
115+
// throw new Error('No tutorial found')
116+
// }
117+
118+
// switch (selectedMode) {
119+
// // new tutorial
120+
// case modes[0]:
121+
// await newTutorial(tutorial)
122+
// break
123+
// // continue
124+
// case modes[1]:
125+
// await continueTutorial()
126+
// break
127+
// }
128+
129+
// // setup hook to run tests on save
130+
// onSaveHook(tutorial.meta.languages)
128131

129132
// TODO: start
130133
}

‎src/state/actions/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exportdefault{}

‎src/state/context/index.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
importbasicTutorialDatafrom'./tutorials/basic'
2+
import*asCRfrom'typings'
3+
4+
consttutorialContext:CR.MachineContext={
5+
position:{
6+
levelId:'',
7+
stageId:'',
8+
stepId:'',
9+
},
10+
progress:{
11+
levels:{},
12+
stages:{},
13+
steps:{},
14+
complete:false,
15+
},
16+
// TODO: load tutorial instead of preloading demo
17+
data:basicTutorialData.data,
18+
}
19+
20+
exportdefaulttutorialContext
File renamed without changes.

‎src/state/guards/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exportdefault{}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp