Skip to content

Commit

Permalink
Fixes #25
Browse files Browse the repository at this point in the history
  • Loading branch information
zjhmale committed Mar 24, 2017
1 parent 3aa6424 commit cdce0bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ let withCompilerOptions = (callback) => {
})
}

let typeCheckOnSave = () => {
withCompilerOptions(commands.typecheckFile)
}

let runCommand = (command) => {
return (_) => {
withCompilerOptions(command)
Expand All @@ -47,5 +51,6 @@ module.exports = {
getCommands,
destroy: commands.destroy,
diagnosticCollection: commands.diagnosticCollection,
withCompilerOptions: withCompilerOptions
withCompilerOptions: withCompilerOptions,
typeCheckOnSave: typeCheckOnSave
}
4 changes: 4 additions & 0 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ function activate(context) {
}
})

vscode.workspace.onDidSaveTextDocument((event) => {
controller.typeCheckOnSave()
})

context.subscriptions.push(controller.diagnosticCollection)
controller.getCommands().forEach(([key, value]) => {
let disposable = vscode.commands.registerCommand(key, value)
Expand Down

0 comments on commit cdce0bf

Please sign in to comment.