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

Commit46d1e27

Browse files
committed
fix launch errors
1 parenta92d52f commit46d1e27

File tree

6 files changed

+32
-40
lines changed

6 files changed

+32
-40
lines changed

‎src/editor/commands/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as CR from 'typings'
33
import*asGfrom'typings/graphql'
44
import*asvscodefrom'vscode'
55
importReactWebViewfrom'../ReactWebView'
6-
import{setStorage}from'../storage'
6+
importstoragefrom'../storage'
77
import{isEmptyWorkspace}from'../workspace'
88
importrunTestfrom'./runTest'
99

@@ -53,7 +53,8 @@ export const createCommands = ({vscodeExt, machine, git}: CreateCommandProps) =>
5353
webviewState='RESTARTING'
5454
}
5555

56-
setStorage(vscodeExt.workspaceState)
56+
// ini
57+
storage.init(vscodeExt.workspaceState)
5758

5859
// activate machine
5960
webview=newReactWebView(vscodeExt.extensionPath)

‎src/editor/commands/loadSolution.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
11
import*asCRfrom'typings'
22
import*asGfrom'typings/graphql'
33
import{TutorialModel}from'../../services/tutorial'
4-
import*asstoragefrom'../../services/storage'
54
import{gitLoadCommits,gitClear}from'../../services/git'
65

76
exportdefaultasyncfunctionloadSolution(dispatch:CR.EditorDispatch,tutorialModel:TutorialModel):Promise<void>{
8-
const[position,tutorial]:[CR.Position,G.Tutorial|undefined]=awaitPromise.all([
9-
storage.getPosition(),
10-
storage.getTutorial(),
11-
])
12-
if(!position){
13-
thrownewError('No tutorial position state found')
14-
}
15-
if(!tutorial||!tutorial.version||!tutorial.version.levels){
16-
thrownewError('Local tutorial not found')
17-
}
18-
// eslint-disable-next-line
19-
20-
conststep=tutorialModel.step()
7+
conststep:G.Step=tutorialModel.step()
218
constsolution=step.solution
229

2310
awaitgitClear()

‎src/editor/storage.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
import*asCRfrom'typings'
21
import*asvscodefrom'vscode'
32

4-
letstorage:vscode.Memento
5-
6-
// storage must be set initially
7-
exportfunctionsetStorage(workspaceState:vscode.Memento):void{
8-
storage=workspaceState
9-
}
10-
11-
exportfunctionget<T>(key:string):T|undefined{
12-
returnstorage.get(key)
3+
classStorage{
4+
privatestorage:vscode.Memento
5+
constructor(){
6+
this.storage={}asvscode.Memento
7+
}
8+
publicinit=(storage:vscode.Memento):void=>{
9+
console.log('setStorage workspace')
10+
this.storage=storage
11+
}
12+
publicget=<T>(key:string):T|undefined=>{
13+
console.log(`called get${key}`)
14+
returnthis.storage.get(key)
15+
}
16+
publicupdate=<T>(key:string,value:string|object):Thenable<void>=>{
17+
console.log(`called update on${key}`)
18+
returnthis.storage.update(key,value)
19+
}
1320
}
1421

15-
exportfunctionupdate<T>(key:string,value:string|object):Thenable<void>{
16-
returnstorage.update(key,value)
17-
}
22+
exportdefaultnewStorage()
File renamed without changes.

‎src/services/storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import*asCRfrom'typings'
22
import*asGfrom'typings/graphql'
3-
import*asstoragefrom'../editor/storage'
3+
importstoragefrom'../editor/storage'
44

55
// TUTORIAL
66
constSTORE_TUTORIAL='coderoad:tutorial'

‎src/services/tutorial/index.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import * as G from 'typings/graphql'
22
import*asCRfrom'typings'
33
import*asstoragefrom'../storage'
44
importapifrom'../api'
5-
importtutorialQueryfrom'@gql/tutorial'
6-
import{timingSafeEqual}from'crypto'
5+
importtutorialQueryfrom'../../services/api/gql/getTutorial'
76

87
interfaceTutorialConfig{
98
codingLanguage:G.EnumCodingLanguage
@@ -41,14 +40,14 @@ class Tutorial implements TutorialModel {
4140
this.position={}asCR.Position
4241
this.progress={}asCR.Progress
4342

44-
Promise.all([
45-
storage.getTutorial(),
46-
storage.getProgress(),
47-
]).then((data)=>{
48-
const[tutorial,progress]=data
49-
console.log('load continue tutorial')
50-
console.log(tutorial,progress)
51-
})
43+
//Promise.all([
44+
//storage.getTutorial(),
45+
//storage.getProgress(),
46+
//]).then((data) => {
47+
//const [tutorial, progress] = data
48+
//console.log('load continue tutorial')
49+
//console.log(tutorial, progress)
50+
//})
5251

5352
}
5453

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp