Skip to content
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

mark errors on the line numbers #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lib/idris-controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class IdrisController

constructor: (@statusbar, @model) ->
@idrisBuffers = 0
@errorMarkers = []

atom.workspace.getTextEditors().forEach (editor) =>
uri = editor.getURI()
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
14 changes: 14 additions & 0 deletions styles/highlight.atom-text-editor.less
Original file line number Diff line number Diff line change
@@ -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;
}
}
}