- Notifications
You must be signed in to change notification settings - Fork39
Feature/hooks#417
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
Uh oh!
There was an error while loading.Please reload this page.
Merged
Feature/hooks#417
Changes fromall commits
Commits
Show all changes
5 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
1 change: 0 additions & 1 deletionsrc/actions/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
55 changes: 0 additions & 55 deletionssrc/actions/onActions.ts
This file was deleted.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
7 changes: 3 additions & 4 deletionssrc/channel.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
40 changes: 23 additions & 17 deletionssrc/commands.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletionssrc/services/hooks/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import * as TT from 'typings/tutorial' | ||
import * as git from '../git' | ||
import loadCommits from './utils/loadCommits' | ||
import loadWatchers from './utils/loadWatchers' | ||
import openFiles from './utils/openFiles' | ||
import runCommands from './utils/runCommands' | ||
import runVSCodeCommands from './utils/runVSCodeCommands' | ||
import { onError as telemetryOnError } from '../telemetry' | ||
import { onRunTest } from '../../actions/onTest' | ||
export const onInit = async (actions: TT.StepActions): Promise<void> => { | ||
await loadCommits(actions.commits) | ||
await runCommands(actions.commands) | ||
await runVSCodeCommands(actions.vscodeCommands) | ||
} | ||
export const onLevelEnter = async (actions: TT.StepActions): Promise<void> => { | ||
await loadCommits(actions.commits) | ||
await runCommands(actions.commands) | ||
} | ||
export const onSetupEnter = async (actions: TT.StepActions): Promise<void> => { | ||
// TODO: set position | ||
await loadCommits(actions.commits) | ||
await openFiles(actions.files) | ||
await loadWatchers(actions.watchers) | ||
await runCommands(actions.commands) | ||
await runVSCodeCommands(actions.vscodeCommands) | ||
} | ||
export const onSolutionEnter = async (actions: TT.StepActions): Promise<void> => { | ||
// TODO: set position | ||
await git.clear() | ||
await loadCommits(actions.commits) | ||
await openFiles(actions.files) | ||
await runCommands(actions.commands) | ||
await runVSCodeCommands(actions.vscodeCommands) | ||
await onRunTest() | ||
} | ||
export const onError = async (error: Error): Promise<void> => { | ||
telemetryOnError(error) | ||
} |
12 changes: 12 additions & 0 deletionssrc/services/hooks/utils/loadCommits.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as git from '../../git' | ||
const loadCommits = async (commits: string[]): Promise<void> => { | ||
if (commits) { | ||
// load the current list of commits for validation | ||
for (const commit of commits) { | ||
await git.loadCommit(commit) | ||
} | ||
} | ||
} | ||
export default loadCommits |
6 changes: 3 additions & 3 deletionssrc/actions/utils/loadWatchers.ts → src/services/hooks/utils/loadWatchers.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletionssrc/actions/utils/openFiles.ts → src/services/hooks/utils/openFiles.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
16 changes: 5 additions & 11 deletionssrc/actions/utils/runCommands.ts → src/services/hooks/utils/runCommands.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletionssrc/services/hooks/utils/runVSCodeCommands.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as vscode from 'vscode' | ||
import * as TT from 'typings/tutorial' | ||
// what are VSCode commands? | ||
// - https://code.visualstudio.com/api/references/vscode-api#commands | ||
// a list of commands: | ||
// - https://code.visualstudio.com/api/references/commands (note many take params) | ||
// - https://code.visualstudio.com/docs/getstarted/keybindings (anything keybound is a command) | ||
const runVSCodeCommands = async (commands: TT.VSCodeCommand[] = []): Promise<void> => { | ||
if (!commands.length) { | ||
return | ||
} | ||
for (const command of commands) { | ||
if (typeof command === 'string') { | ||
// string named commands | ||
await vscode.commands.executeCommand(command) | ||
} else if (Array.isArray(command)) { | ||
// array commands with params | ||
const [name, params] = command | ||
await vscode.commands.executeCommand(name, params) | ||
} | ||
} | ||
} | ||
export default runVSCodeCommands |
7 changes: 3 additions & 4 deletionssrc/services/reset/lastHash.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionsrc/services/reset/lastHash.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionsrc/services/testRunner/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionsrc/services/webview/render.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletionstypings/tutorial.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.