8000 listener progress · dashinja/coderoad-vscode@3113e7e · GitHub
[go: up one dir, main page]

Skip to content

Commit 3113e7e

Browse files
committed
listener progress
1 parent f983329 commit 3113e7e

File tree

3 files changed

+17
-5
lines changed
  • editor
  • web-app/src/services/apollo/queries
  • 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
    const watchers: {[key: string]: vscode.FileSystemWatcher} = {}
    4242

    43+
    const disposeWatcher = (listener: string) => {
    44+
    watchers[listener].dispose()
    45+
    delete wat 8000 chers[listener]
    46+
    }
    47+
    4348
    const setupActions = 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-
    delete watchers[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 (const listener of Object.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
    const payload = {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)
    0