diff --git a/lib/idris-controller.coffee b/lib/idris-controller.coffee index 15d7ee5..545e961 100644 --- a/lib/idris-controller.coffee +++ b/lib/idris-controller.coffee @@ -10,6 +10,7 @@ class IdrisController constructor: (@statusbar, @model) -> @idrisBuffers = 0 + @errorMarkers = [] atom.workspace.getTextEditors().forEach (editor) => uri = editor.getURI() @@ -99,6 +100,10 @@ class IdrisController uri = editor.getURI() console.log 'Loading ' + uri @messages.clear() + + for marker in @errorMarkers + marker.destroy() + @model.load uri, (err, message, progress) => if err @statusbar.setStatus 'Idris: ' + err.message @@ -110,6 +115,14 @@ class IdrisController line: warning[1][0] character: warning[1][1] message: warning[3] + + startPoint = warning[1] + startPoint[0] = startPoint[0] - 1 + endPoint = warning[2] + endPoint[0] = endPoint[0] - 1 + marker = @markCode editor, [startPoint, endPoint] + + @errorMarkers.push marker else if progress console.log '... ' + progress @statusbar.setStatus 'Idris: ' + progress @@ -200,4 +213,11 @@ class IdrisController # And then replace the replacement with the guess.. editor.insertText res + markCode: (editor, range) -> + marker = editor.markBufferRange(range, invalidate: 'never') + editor.decorateMarker marker, + type: 'line-number' + class: 'highlight-idris-error' + marker + module.exports = IdrisController diff --git a/styles/highlight.atom-text-editor.less b/styles/highlight.atom-text-editor.less new file mode 100644 index 0000000..123fa2a --- /dev/null +++ b/styles/highlight.atom-text-editor.less @@ -0,0 +1,14 @@ +@import "syntax-variables"; + +@red-color: @syntax-color-removed; + +atom-text-editor::shadow +{ + .gutter .line-number + { + &.highlight-idris-error + { + background-color: @red-color; + } + } +}