Skip to content

Commit

Permalink
Merge branch 'master' of github.com:idris-hackers/atom-language-idris
Browse files Browse the repository at this point in the history
  • Loading branch information
archaeron committed Jun 3, 2016
2 parents 9526baa + 7dec2aa commit 10e7022
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 10 additions & 2 deletions lib/idris-controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class IdrisController

getDocsForWord: ({ target }) =>
word = Symbol.serializeWord @getWordUnderCursor(target)
uri = target.model.getURI()

successHandler = ({ responseType, msg }) =>
[type, highlightingInfo] = msg
Expand All @@ -128,7 +129,10 @@ class IdrisController
@messages.add informationView

@model
.docsFor word
.load uri
.filter ({ responseType }) -> responseType == 'return'
.flatMap => @model.docsFor word
.catch (e) => @model.docsFor word
.subscribe successHandler, @displayErrors

getTypeForWord: ({ target }) =>
Expand Down Expand Up @@ -348,6 +352,7 @@ class IdrisController

printDefinition: ({ target }) =>
word = Symbol.serializeWord @getWordUnderCursor(target)
uri = target.model.getURI()

successHandler = ({ responseType, msg }) =>
[type, highlightingInfo] = msg
Expand All @@ -362,7 +367,10 @@ class IdrisController
@messages.add informationView

@model
.printDefinition word
.load uri
.filter ({ responseType }) -> responseType == 'return'
.flatMap => @model.printDefinition word
.catch (e) => @model.printDefinition word
.subscribe successHandler, @displayErrors

openREPL: ({ target }) =>
Expand Down
6 changes: 5 additions & 1 deletion lib/idris-model.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ class IdrisModel
oldCompilerOptions: { }

ideMode: (compilerOptions) ->
if !@ideModeRef || !JS.objectEqual(@oldCompilerOptions, compilerOptions)
if @ideModeRef && !JS.objectEqual(@oldCompilerOptions, compilerOptions)
@ideModeRef.process.removeAllListeners()
@ideModeRef.stop()
@ideModeRef = null
if !@ideModeRef
@ideModeRef = new IdrisIdeMode
@ideModeRef.on 'message', @handleCommand
@ideModeRef.start compilerOptions
Expand Down

0 comments on commit 10e7022

Please sign in to comment.