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

Commit3113e7e

Browse files
committed
listener progress
1 parentf983329 commit3113e7e

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

‎src/actions/setupActions.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ const runCommands = async (commands: string[], language: string = 'JAVASCRIPT')
4040
// collect active file watchers (listeners)
4141
constwatchers:{[key:string]:vscode.FileSystemWatcher}={}
4242

43+
constdisposeWatcher=(listener:string)=>{
44+
watchers[listener].dispose()
45+
deletewatchers[listener]
46+
}
47+
4348
constsetupActions=async(workspaceRoot:vscode.WorkspaceFolder,{commands, commits, files, listeners}:G.StepActions):Promise<void>=>{
4449
// run commits
4550
if(commits){
@@ -55,13 +60,18 @@ const setupActions = async (workspaceRoot: vscode.WorkspaceFolder, {commands, co
5560
watchers[listener]=vscode.workspace.createFileSystemWatcher(listener)
5661
watchers[listener].onDidChange(()=>{
5762
// trigger save
58-
vscode.commands.executeCommand('coderoad.run_test')
59-
// cleanup watcher
60-
watchers[listener].dispose()
61-
deletewatchers[listener]
63+
vscode.commands.executeCommand('coderoad.run_test',null,()=>{
64+
// cleanup watcher on success
65+
disposeWatcher(listener)
66+
})
6267
})
6368
}
6469
}
70+
}else{
71+
// remove all watchers
72+
for(constlistenerofObject.keys(watchers)){
73+
disposeWatcher(listener)
74+
}
6575
}
6676

6777
// run command

‎src/editor/commands.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,15 @@ export const createCommands = ({extensionPath, workspaceState, workspaceRoot}: C
5454
// set from last setup stepAction
5555
currentStepId=stepId
5656
},
57-
[COMMANDS.RUN_TEST]:(current:{stepId:string}|undefined)=>{
57+
[COMMANDS.RUN_TEST]:(current:{stepId:string}|undefined,onSuccess:()=>void)=>{
5858
console.log('-------- command.run_test ------ ')
5959
// use stepId from client, or last set stepId
6060
constpayload={stepId:current ?current.stepId :currentStepId}
6161
runTest({
6262
onSuccess:()=>{
6363
// send test pass message back to client
6464
webview.send({type:'TEST_PASS', payload})
65+
onSuccess()
6566
vscode.window.showInformationMessage('PASS')
6667
},
6768
onFail:()=>{

‎web-app/src/services/apollo/queries/tutorial.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export default gql`
4242
commits
4343
commands
4444
files
45+
listeners
4546
}
4647
solution {
4748
commits

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp