Skip to content

Fix/issues #19

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix fail to initialize bug
  • Loading branch information
ShMcK committed Jul 20, 2019
commit ca0cfb3aecb812631d7fcf4ba52a87626f690d12
18 changes: 9 additions & 9 deletions src/editor/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const createCommands = ({ context, machine, storage, git, position }: Cre
},
// launch a new tutorial
// NOTE: may be better to move into action as logic is primarily non-vscode
[COMMANDS.TUTORIAL_LAUNCH]: async (tutorial: CR.Tutorial) => {
[COMMANDS.TUTORIAL_LAUNCH]: async ({ tutorial, dispatch }: any) => {
console.log('launch tutorial')

await isEmptyWorkspace()
Expand All @@ -86,21 +86,21 @@ export const createCommands = ({ context, machine, storage, git, position }: Cre
// eslint-disable-next-line
const { steps } = tutorial.data
const { setup } = steps[pos.stepId].actions
await git.gitLoadCommits(setup)
await git.gitLoadCommits(setup, dispatch)
machine.send('TUTORIAL_LOADED')
},
[COMMANDS.TUTORIAL_SETUP]: async (tutorial: CR.Tutorial) => {
console.log('tutorial setup', tutorial)
// setup onSave hook
const languageIds = tutorial.meta.languages
console.log(`languageIds: ${languageIds.join(', ')}`)
vscode.workspace.onDidSaveTextDocument((document: vscode.TextDocument) => {
console.log('save document', document)
if (languageIds.includes(document.languageId) && document.uri.scheme === 'file') {
// do work
machine.send('TEST_RUN')
}
})
// vscode.workspace.onDidSaveTextDocument((document: vscode.TextDocument) => {
// console.log('save document', document)
// if (languageIds.includes(document.languageId) && document.uri.scheme === 'file') {
// // do work
// machine.send('TEST_RUN')
// }
// })
},
// open a file
[COMMANDS.OPEN_FILE]: async (relativeFilePath: string) => {
Expand Down
2 changes: 1 addition & 1 deletion src/state/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default (dispatch: CR.EditorDispatch) => ({
currentTutorial = tutorial
console.log('api')
console.log(tutorial)
dispatch('coderoad.tutorial_launch', tutorial)
dispatch('coderoad.tutorial_launch', { tutorial, dispatch })
},
tutorialSetup() {
dispatch('coderoad.tutorial_setup', currentTutorial)
Expand Down
2 changes: 1 addition & 1 deletion src/state/machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const machine = (dispatch: CR.EditorDispatch) =>
initial: 'Initialize',
onEntry: ['tutorialSetup'],
on: {
WEBVIEW_INITIALIZED: '#tutorial-load-currents'
WEBVIEW_INITIALIZED: '#tutorial-load-current'
},
states: {
Initialize: {
Expand Down